WebObjects 5.4.2

com.webobjects.appserver.parser.woml.namespaces
Class WOMLAbstractNamespace

java.lang.Object
  extended by com.webobjects.appserver.parser.woml.namespaces.WOMLAbstractNamespace
All Implemented Interfaces:
WOMLNamespace
Direct Known Subclasses:
WOMLWebObjectsNamespace

public abstract class WOMLAbstractNamespace
extends Object
implements WOMLNamespace


Nested Class Summary
static class WOMLAbstractNamespace.WOGenericElementRule
           
static interface WOMLAbstractNamespace.WOMLElementGenerator
           
 
Field Summary
static String ATTRIBUTE_VALUE_CONTENT
           
static String ATTRIBUTE_VALUE_REMOVE
           
static String WOGENERIC_CONTAINER_NAME
           
static String WOGENERIC_ELEMENT_NAME
           
 
Constructor Summary
WOMLAbstractNamespace(String namespace)
           
 
Method Summary
 boolean canGenerateElement(WOMLElement element)
          Default implementation returns true if (a) the element name is in the same namespace as the receiver or (b) it contains the component identifier attribute in the same namespace as the receiver.
 void contributeToDeclaration(WOMLElement element, WOMutableDeclaration declaration, NSArray languages, WOAssociationFactory associationFactory)
          Default implementation copies all associations from the defined element that match the namespace of the receiver into the declaration.
 WOElement generateElement(WOMLElement element, WOElement template, WOMutableDeclaration declaration, NSArray languages, WOAssociationFactory associationFactory)
          The default implementation will generate a WOElement from the declaration given.
 String getAlias(String elementName)
          Returns either the alias for a given element name of the element name itself.
protected  Map getAssociations(WOMLElement element, WOAssociationFactory associationFactory)
          Returns the map of associations that should be contributed by this namespace.
abstract  String getComponentIdentifierAttributeName()
           
 String getDeclaredType(WOMLElement element)
          Returns the type of component as determined by either the specified JSP-style tag name or the wo:component specification.
 WOMLAbstractNamespace.WOMLElementGenerator getDefaultElementGenerator()
           
 WOMLAbstractNamespace.WOMLElementGenerator getElementGenerator(String elementName)
           
 String getGenericElementType(WOElement element)
           
 String getNamespaceId()
          Returns the namespace identifier for this namespace.
 String getRawComponentType(WOMLElement element)
          Returns the raw component type as determined from the parsed element.
 String setAlias(String fromElementName, String toElementName)
           
 void setDefaultElementGenerator(WOMLAbstractNamespace.WOMLElementGenerator elementGenerator)
           
 void setElementGenerator(String elementName, WOMLAbstractNamespace.WOMLElementGenerator elementGenerator)
           
protected  boolean shouldContributeAssociation(WOMLElement element, WOMutableDeclaration declaration, NSArray languages, String name, WOAssociation association)
          Returns true if the given association with the given name should be contributed to the declaration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.webobjects.appserver.parser.woml.WOMLNamespace
contributeToDeclaration
 

Field Detail

ATTRIBUTE_VALUE_REMOVE

public static final String ATTRIBUTE_VALUE_REMOVE
See Also:
Constant Field Values

ATTRIBUTE_VALUE_CONTENT

public static final String ATTRIBUTE_VALUE_CONTENT
See Also:
Constant Field Values

WOGENERIC_CONTAINER_NAME

public static final String WOGENERIC_CONTAINER_NAME
See Also:
Constant Field Values

WOGENERIC_ELEMENT_NAME

public static final String WOGENERIC_ELEMENT_NAME
See Also:
Constant Field Values
Constructor Detail

WOMLAbstractNamespace

public WOMLAbstractNamespace(String namespace)
Method Detail

getAssociations

protected Map getAssociations(WOMLElement element,
                              WOAssociationFactory associationFactory)
Returns the map of associations that should be contributed by this namespace. Default implementation returns the associations from this namespace identifier from WOMLElement.getAssociations().

Parameters:
element -
associationFactory -
Returns:

shouldContributeAssociation

protected boolean shouldContributeAssociation(WOMLElement element,
                                              WOMutableDeclaration declaration,
                                              NSArray languages,
                                              String name,
                                              WOAssociation association)
Returns true if the given association with the given name should be contributed to the declaration. The default implementation returns true if the name of the association is not equal to the component identifier attribute for the namespace.

Parameters:
namespace -
element -
declaration -
name -
association -
Returns:

getElementGenerator

public WOMLAbstractNamespace.WOMLElementGenerator getElementGenerator(String elementName)

setElementGenerator

public void setElementGenerator(String elementName,
                                WOMLAbstractNamespace.WOMLElementGenerator elementGenerator)

getDefaultElementGenerator

public WOMLAbstractNamespace.WOMLElementGenerator getDefaultElementGenerator()

setDefaultElementGenerator

public void setDefaultElementGenerator(WOMLAbstractNamespace.WOMLElementGenerator elementGenerator)

getAlias

public String getAlias(String elementName)
Returns either the alias for a given element name of the element name itself.

Parameters:
elementName -
Returns:

setAlias

public String setAlias(String fromElementName,
                       String toElementName)

getComponentIdentifierAttributeName

public abstract String getComponentIdentifierAttributeName()

getRawComponentType

public String getRawComponentType(WOMLElement element)
Returns the raw component type as determined from the parsed element. This is either the name of the element (for JSP-style specification of tag name) or the component value from the wo:component attribute.

Parameters:
element -
Returns:

getDeclaredType

public String getDeclaredType(WOMLElement element)
Returns the type of component as determined by either the specified JSP-style tag name or the wo:component specification. The value returned by this method is the actual component or dynamic element name that will be used in the declaration. Any aliases are resolved (i.e. "if" and "else" both become WOConditional).

Parameters:
element -
Returns:

getGenericElementType

public String getGenericElementType(WOElement element)

getNamespaceId

public String getNamespaceId()
Returns the namespace identifier for this namespace.

Specified by:
getNamespaceId in interface WOMLNamespace
Returns:
See Also:
WOMLNamespace.getNamespaceId()

canGenerateElement

public boolean canGenerateElement(WOMLElement element)
Default implementation returns true if (a) the element name is in the same namespace as the receiver or (b) it contains the component identifier attribute in the same namespace as the receiver.

Specified by:
canGenerateElement in interface WOMLNamespace
Parameters:
element -
Returns:
See Also:
WOMLNamespace.canGenerateElement(com.webobjects.appserver.parser.woml.WOMLElement)

generateElement

public WOElement generateElement(WOMLElement element,
                                 WOElement template,
                                 WOMutableDeclaration declaration,
                                 NSArray languages,
                                 WOAssociationFactory associationFactory)
                          throws WOMLElementGenerationException
The default implementation will generate a WOElement from the declaration given. If the type of the element (as indicated by the declaration's type()) is one of the special "$remove" or "$content" the appropriate element is returned. Otherwise the element is generated by the WOMLElementGenerator registered with the receiver via setElementGenerator().

Specified by:
generateElement in interface WOMLNamespace
Parameters:
element -
template -
declaration -
associationFactory -
Returns:
Throws:
WOMLElementGenerationException
See Also:
com.webobjects.appserver.parser.woml.WOMLNamespace#generateElement(com.webobjects.appserver.parser.woml.WOMLElement, com.webobjects.appserver.WOElement, com.webobjects.appserver._private.WOMutableDeclaration, com.webobjects.appserver.WOAssociationFactory)

contributeToDeclaration

public void contributeToDeclaration(WOMLElement element,
                                    WOMutableDeclaration declaration,
                                    NSArray languages,
                                    WOAssociationFactory associationFactory)
                             throws WOMLElementGenerationException
Default implementation copies all associations from the defined element that match the namespace of the receiver into the declaration. It then calls the registered element generator to contribute to the declaration.

Parameters:
element -
declaration -
associationFactory -
Throws:
WOMLElementGenerationException
See Also:
com.webobjects.appserver.parser.woml.WOMLNamespace#contributeToDeclaration(com.webobjects.appserver.parser.woml.WOMLElement, com.webobjects.appserver._private.WOMutableDeclaration, com.webobjects.appserver.WOAssociationFactory)

Last updated June 2008

Copyright © 2000-2008 Apple Inc.