Apache Struts API Documentation: Class FactorySet

Apache Struts API


org.apache.struts.tiles.xmlDefinition Class FactorySet

java.lang.Object
  |
  +--org.apache.struts.tiles.xmlDefinition.FactorySet
All Implemented Interfaces:
ComponentDefinitionsFactory, java.io.Serializable
Direct Known Subclasses:
I18nFactorySet

public abstract class FactorySet
extends java.lang.Object
implements ComponentDefinitionsFactory

Component Definitions factory. This factory contains several factories identified by a key. The getDefinition() method first looks for the factory key, retrieves or creates this factory and then calls its getDefinition().

See Also:
Serialized Form

Field Summary
protected  java.util.Map factories
          Loaded factories
 
Constructor Summary
FactorySet()
          Constructor.
 
Method Summary
protected abstract  DefinitionsFactory createFactory(java.lang.Object key, javax.servlet.ServletRequest request, javax.servlet.ServletContext servletContext)
          Create a factory for specified key.
protected abstract  DefinitionsFactory getDefaultFactory()
          Get default factory.
 ComponentDefinition getDefinition(java.lang.String name, javax.servlet.ServletRequest request, javax.servlet.ServletContext servletContext)
          Get a definition by its name.
protected abstract  java.lang.Object getDefinitionsFactoryKey(java.lang.String name, javax.servlet.ServletRequest request, javax.servlet.ServletContext servletContext)
          Extract key that will be used to get the sub factory.
protected  DefinitionsFactory getFactory(java.lang.Object key, javax.servlet.ServletRequest request, javax.servlet.ServletContext servletContext)
          Get a factory by its key.
abstract  void initFactory(javax.servlet.ServletContext servletContext, java.util.Map properties)
          Init factory set.
 java.lang.String toString()
          Return String representation.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

factories

protected java.util.Map factories
Loaded factories
Constructor Detail

FactorySet

public FactorySet()
Constructor.
Method Detail

getDefinitionsFactoryKey

protected abstract java.lang.Object getDefinitionsFactoryKey(java.lang.String name,
                                                             javax.servlet.ServletRequest request,
                                                             javax.servlet.ServletContext servletContext)
Extract key that will be used to get the sub factory.
Parameters:
name - Name of requested definition.
request - Current servlet request.
servletContext - Current servlet context.
Returns:
Object.

getDefaultFactory

protected abstract DefinitionsFactory getDefaultFactory()
Get default factory.
Returns:
Default factory.

getFactory

protected DefinitionsFactory getFactory(java.lang.Object key,
                                        javax.servlet.ServletRequest request,
                                        javax.servlet.ServletContext servletContext)
                                 throws DefinitionsFactoryException
Get a factory by its key. If key is null, return defaultFactory. Search in loaded factories. If not found, create factory and store return value in loaded factories.
Parameters:
key - Key of requested definition.
request - Current servlet request.
servletContext - Current servlet context.
Throws:
DefinitionsFactoryException - If an error occur while creating factory.

getDefinition

public ComponentDefinition getDefinition(java.lang.String name,
                                         javax.servlet.ServletRequest request,
                                         javax.servlet.ServletContext servletContext)
                                  throws NoSuchDefinitionException,
                                         DefinitionsFactoryException
Get a definition by its name.
Specified by:
getDefinition in interface ComponentDefinitionsFactory
Parameters:
name - Name of requested definition.
request - Current servlet request.
servletContext - Current servlet context.
Throws:
NoSuchDefinitionException - No definition found for specified name
DefinitionsFactoryException - General exception

createFactory

protected abstract DefinitionsFactory createFactory(java.lang.Object key,
                                                    javax.servlet.ServletRequest request,
                                                    javax.servlet.ServletContext servletContext)
                                             throws DefinitionsFactoryException
Create a factory for specified key. This method is called by getFactory() when the requested factory doesn't already exist. Must return a factory, or a default one. Real implementation needs to provide this method.
Parameters:
key - Key of requested definition.
request - Current servlet request.
servletContext - Current servlet context
Throws:
DefinitionsFactoryException - If an error occur while creating factory.

initFactory

public abstract void initFactory(javax.servlet.ServletContext servletContext,
                                 java.util.Map properties)
                          throws DefinitionsFactoryException
Init factory set.
Specified by:
initFactory in interface ComponentDefinitionsFactory
Parameters:
servletContext - Current servlet context
properties - properties used to initialized factory set;

toString

public java.lang.String toString()
Return String representation.
Overrides:
toString in class java.lang.Object
Returns:
String representation.


Copyright © 2000-2005 - The Apache Software Foundation