SAP NetWeaver '04

com.sapportals.wcm.rendering.collection
Class ComponentFactory

[contained in: com.sap.km.cm.ui.flex.par - km.shared.ui.flex.collection_api.jar]
com.sapportals.wcm.rendering.collection.ComponentFactory
All Implemented Interfaces:
IFactoryInfoProvider

public final class ComponentFactory
implements IFactoryInfoProvider

Since:
EP5 SP6 and EP6 SP1 The ComponentFactory is a singleton factory, that allows other classes to retrieve instances of IComponents. When the factory is called for the first time or when it receives a ConfigEvent , it reads out information from the config framework. This information allows a mapping of a descriptive name ("alias") to a java-class. This allows a usage of the descriptive name throughout the configuration of the other parts of the rendering framework. If a mapping points to a not-existing or non-loadable class or if the class found does not implement the needed interface, an error message is written in the log.files, stating the name of the alias and the mapped java-class.

Inner classes inherited from class com.sapportals.wcm.rendering.base.IFactoryInfoProvider
IFactoryInfoProvider.MappingInformation
 
Field Summary
static java.lang.String COMPONENT_PAGER
          key to retrieve a pager class instance from the factory using the factory's getComponent method and stating this constant as alias-parameter
static java.lang.String COMPONENT_PATH
          key to retrieve a path class instance (a.k.a.
static java.lang.String COMPONENT_SORT_HEADER
          key to retrieve a sort header class instance from the factory using the factory's getComponent method and stating this constant as alias-parameter
static java.lang.String DATA_KEY_PAGER_DATA
          key to use when transferring data to an IComponent instance using its setData method.
static java.lang.String DATA_KEY_PARENT
          key to use when transferring data to an IComponent instance using its setData method.
static java.lang.String DATA_KEY_RESOURCE_LIST
          key to use when transferring data to an IComponent instance using its setData method.
static java.lang.String DATA_KEY_SEARCH_SESSION
          key to use when transferring data to an IComponent instance using its setData method.
static java.lang.String DATA_KEY_SORT_DATA
          key to use when transferring data to an IComponent instance using its setData method.
static java.lang.String LINE_BREAK
          constant used to separate debugging information
 
Method Summary
 void configEvent(com.sapportals.config.event.ConfigEvent parm1)
          is called by the configuration, if configuration for the factory was changed.
 java.lang.String createLinkID(IComponent component, java.util.ArrayList values)
          creates a unique ID that also holds the given IComponent's alias and all the entries of the given ArrayList.
 java.lang.String createStaticLinkID(IComponent component, java.util.ArrayList values, java.lang.String id)
          creates a unique ID that also holds the given IComponent's alias and all the entries of the given ArrayList.
 IComponentEvent decodeEvent(ICollectionRenderer renderer, IProxy proxy, com.sapportals.htmlb.event.Event event, java.util.Map values)
          creates a new IComponent from the component's alias found inside the given event and let's it fire the returned IComponentEvent or null.
 IComponent getComponent(IProxy proxy, IResource res, com.sapportals.wcm.repository.service.layout.customizing.flavor.IFlavor impFlavor, java.lang.String alias)
           
 IComponent getComponent(java.lang.String alias, IProxy proxy)
          returns a new instance of an IComponent that is defined for the given alias or null, if no component is defined for the given alias.
 IComponent getComponent(java.lang.String alias, IProxy proxy, ICollectionRenderer renderer)
          returns a new instance of an IComponent that is defined for the given alias or null, if no component is defined for the given alias.
 IComponent getComponent(java.lang.String alias, IProxy proxy, ICollectionRenderer renderer, IResource res, com.sapportals.wcm.repository.service.layout.customizing.flavor.IFlavor flavor)
           
 IComponent getComponent(java.lang.String alias, IProxy proxy, com.sapportals.wcm.repository.service.layout.customizing.flavor.IFlavor flavor)
           
 java.lang.String getConfigListenerId()
          Gets the configListenerId attribute of the UICommandFactory object
 java.lang.String getFactoryName()
           
static ComponentFactory getInstance()
          Gets the instance attribute of the ComponentFactory class.
 long getLastReloadTime()
           
 java.util.List getMappings(java.util.Locale locale)
           
 java.util.List getPresentConfiguration(IResourceContext context)
          returns a list of setting information of the groupcommands.
 java.lang.String getPresentConfiguration(IResourceContext context, java.lang.String style, boolean showJavaClassNames)
          returns a string representation of the structure of all defined groupcommands with their children.
 Status getStatus()
           
 

Field Detail

LINE_BREAK

public static final java.lang.String LINE_BREAK
constant used to separate debugging information

COMPONENT_PAGER

public static final java.lang.String COMPONENT_PAGER
key to retrieve a pager class instance from the factory using the factory's getComponent method and stating this constant as alias-parameter

COMPONENT_PATH

public static final java.lang.String COMPONENT_PATH
key to retrieve a path class instance (a.k.a. "breadcrumb") from the factory using the factory's getComponent method and stating this constant as alias-parameter

COMPONENT_SORT_HEADER

public static final java.lang.String COMPONENT_SORT_HEADER
key to retrieve a sort header class instance from the factory using the factory's getComponent method and stating this constant as alias-parameter

DATA_KEY_SORT_DATA

public static final java.lang.String DATA_KEY_SORT_DATA
key to use when transferring data to an IComponent instance using its setData method. It is used as the key for a Map entry that must be of class SortDefinition.

DATA_KEY_PAGER_DATA

public static final java.lang.String DATA_KEY_PAGER_DATA
key to use when transferring data to an IComponent instance using its setData method. It is used as the key for a Map entry that must be of class PagerData.

DATA_KEY_RESOURCE_LIST

public static final java.lang.String DATA_KEY_RESOURCE_LIST
key to use when transferring data to an IComponent instance using its setData method. It is used as the key for a Map entry that must be of class IResourceList.

DATA_KEY_SEARCH_SESSION

public static final java.lang.String DATA_KEY_SEARCH_SESSION
key to use when transferring data to an IComponent instance using its setData method. It is used as the key for a Map entry that must be of class ISearchSession.

DATA_KEY_PARENT

public static final java.lang.String DATA_KEY_PARENT
key to use when transferring data to an IComponent instance using its setData method. It is used as the key for a Map entry that must be of class ICollection.
Method Detail

getInstance

public static ComponentFactory getInstance()
Gets the instance attribute of the ComponentFactory class.
Returns:
the only available instance of this factory in the VM.

getComponent

public IComponent getComponent(java.lang.String alias,
                               IProxy proxy,
                               ICollectionRenderer renderer)
returns a new instance of an IComponent that is defined for the given alias or null, if no component is defined for the given alias. The components attributes alias, flavor, proxy, renderer, resource, startUri will be set with the values obtained from the given parameters.

getComponent

public IComponent getComponent(IProxy proxy,
                               IResource res,
                               com.sapportals.wcm.repository.service.layout.customizing.flavor.IFlavor impFlavor,
                               java.lang.String alias)

getComponent

public IComponent getComponent(java.lang.String alias,
                               IProxy proxy,
                               ICollectionRenderer renderer,
                               IResource res,
                               com.sapportals.wcm.repository.service.layout.customizing.flavor.IFlavor flavor)

getComponent

public IComponent getComponent(java.lang.String alias,
                               IProxy proxy)
returns a new instance of an IComponent that is defined for the given alias or null, if no component is defined for the given alias. The components attributes alias, proxy, resource, startUri will be set with the values obtained from the given parameters.

getComponent

public IComponent getComponent(java.lang.String alias,
                               IProxy proxy,
                               com.sapportals.wcm.repository.service.layout.customizing.flavor.IFlavor flavor)

decodeEvent

public IComponentEvent decodeEvent(ICollectionRenderer renderer,
                                   IProxy proxy,
                                   com.sapportals.htmlb.event.Event event,
                                   java.util.Map values)
                            throws WcmException
creates a new IComponent from the component's alias found inside the given event and let's it fire the returned IComponentEvent or null. If the id of the Htmlb-Component that fired the Event was not created using the factory's createLinkID or createStaticLinkID, this method might throw an WcmException or simply return null. Otherwise, a new Component instance is created, its attributes alias, proxy, renderer are set with the parameters given and its decodeEvent method is called, using again the given parameters. The created instance of the IComponent will not be reused by the factory in later calls.

createLinkID

public java.lang.String createLinkID(IComponent component,
                                     java.util.ArrayList values)
                              throws WcmException
creates a unique ID that also holds the given IComponent's alias and all the entries of the given ArrayList. It also adds a String obtained from IDCounter.currentID(). Therefore, the ID created by this method cannot be reproduced at a later time. If you need to access the htmlb-Component inside your IComponent after an http-request-cycle, use the factory's createStaticLinkID method. None of the given parameters must be null.
Throws:
WcmException - if the creation of the linkID failed. This exception might wrap a WdfException.

createStaticLinkID

public java.lang.String createStaticLinkID(IComponent component,
                                           java.util.ArrayList values,
                                           java.lang.String id)
                                    throws WcmException
creates a unique ID that also holds the given IComponent's alias and all the entries of the given ArrayList. It also adds the id-parameter given. Therefore, the ID created by this method can be reproduced at a later time. Note that if you create two htmlb-Components within the same IComponent and the same ArrayList and id, there will be a NonUniqueIDException thrown when rendering the html-page. None of the given parameters must be null.
Throws:
WcmException - if the creation of the linkID failed. This exception might wrap a WdfException.

getConfigListenerId

public java.lang.String getConfigListenerId()
Gets the configListenerId attribute of the UICommandFactory object
Returns:
The configListenerId value

configEvent

public void configEvent(com.sapportals.config.event.ConfigEvent parm1)
is called by the configuration, if configuration for the factory was changed. If the event is of type ConfigEvent.CONFIGURABLE_LOADED or ConfigEvent.CONFIGMANAGER_TERMINATED , the factory deletes all its entries and reloads the configuration, creating all commands anew.
Parameters:
parm1 - the event raised by the configuration

getPresentConfiguration

public java.lang.String getPresentConfiguration(IResourceContext context,
                                                java.lang.String style,
                                                boolean showJavaClassNames)
returns a string representation of the structure of all defined groupcommands with their children.
Parameters:
context - the current context of the user, sets e.g. the language of the labels for the commands
style - currently not used
showJavaClassNames - flag to show (true) or hide (false) java class names in the returned string
Returns:
a String with line breaks and indentions to show the structure of all configured commands

getPresentConfiguration

public java.util.List getPresentConfiguration(IResourceContext context)
returns a list of setting information of the groupcommands. GroupCommands are free to add information to this list. When using this list a type check should be done before casting to String to avoid ClassCastException s.
Parameters:
context - Description of the param
Returns:
a list containing information provided by the factory's groupcommands.

getFactoryName

public java.lang.String getFactoryName()
Specified by:
getFactoryName in interface IFactoryInfoProvider
Following copied from interface: com.sapportals.wcm.rendering.base.IFactoryInfoProvider
Returns:
a human-readable name of the factory, must not be null

getMappings

public java.util.List getMappings(java.util.Locale locale)
Specified by:
getMappings in interface IFactoryInfoProvider
Following copied from interface: com.sapportals.wcm.rendering.base.IFactoryInfoProvider
Parameters:
locale - defines the language to use, if the factory offers translated information, must not be null
Returns:
a list that must only contain IFactoryInfoProvider.MappingInformation, must not be null

getStatus

public Status getStatus()
Specified by:
getStatus in interface IFactoryInfoProvider
Following copied from interface: com.sapportals.wcm.rendering.base.IFactoryInfoProvider
Returns:
the aggregated status of the factory. If, e.g., there have been errors creating a class defined in the config, the factory should return Status.ERROR

getLastReloadTime

public long getLastReloadTime()
Specified by:
getLastReloadTime in interface IFactoryInfoProvider
Following copied from interface: com.sapportals.wcm.rendering.base.IFactoryInfoProvider
Returns:
the time of the last reload of the config by this factory. Expects a format such as returned by System.currentTimeMillis(). An implementing class might also return -1 to indicate, that no information is available.

SAP NetWeaver '04

Copyright © 2004 by SAP AG. All Rights Reserved.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.