Package nl.gx.webmanager.foundation
Class WrapperRegistry
- java.lang.Object
-
- nl.gx.webmanager.foundation.WrapperRegistry
-
- All Implemented Interfaces:
WrapperRegistry
public class WrapperRegistry extends Object implements WrapperRegistry
Registry for mappings between siteworks types, interfaces and implementation classes. The mappings are defined in web/WEB-INF/classes/mappings.xml. If you want to add mappings or define new ones, you should create an overridemappings.xml. example of xml:<wrappers> <wrapper> <objecttype>ss_element</objecttype> <interfaceclass>nl.gx.webmanager.Element</interfaceclass> <implementationclass>nl.gx.webmanager.implementation.ElementImpl</implementationclass> </wrapper> <wrapper> ... </wrapper> ... </wrapper>
This class implements the singleton pattern. You can get a reference to the registry using the getInstance() method. You should not keep a reference to the returned object because it is replaced every 60 seconds by a new registry when webmanager re-reads mappings.xml and overridemappings.xml.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description WrapperDefinition
getByContentType(String contentType)
Returns null or a WrapperDefinition identified by its content type.WrapperDefinition
getByImplementation(String implementingClass)
Returns null or a WrapperDefinition identified by its fully qualified classname.WrapperDefinition
getByInterface(String interfaceClass)
Returns null or a WrapperDefinition identified by its fully qualified classname.WrapperDefinition
getByNodeType(String nodetype)
Returns null or a WrapperDefinition identified by its fully qualified node type name.WrapperDefinition
getByObjectType(String objectTypeName)
Needed for the SiteWorksWrapperFactory.Class
getClassByName(String className)
Returns null or a class based on its fully qualified class name.Component
getComponentByInterface(String fullyQualifiedClassName)
Not implemented.static WrapperRegistry
getInstance()
Return and renew the singleton instance for this class.Object
getInstance(String className)
Returns an object instance based on its fully qualified class name.String
getObjectTypeNameByInterface(String interfaceClass)
Return the name of the object type from the name of the interfacevoid
loadMappings(File mappingsFile)
-
-
-
Method Detail
-
getInstance
public static WrapperRegistry getInstance()
Return and renew the singleton instance for this class.- Returns:
- and renew the singleton instance for this class.
-
getByContentType
public WrapperDefinition getByContentType(String contentType)
Description copied from interface:WrapperRegistry
Returns null or a WrapperDefinition identified by its content type.- Specified by:
getByContentType
in interfaceWrapperRegistry
- Parameters:
contentType
- Name of the content type- Returns:
- null or a WrapperDefinition identified by its content type
-
getByImplementation
public WrapperDefinition getByImplementation(String implementingClass)
Description copied from interface:WrapperRegistry
Returns null or a WrapperDefinition identified by its fully qualified classname.- Specified by:
getByImplementation
in interfaceWrapperRegistry
- Parameters:
implementingClass
- Fully qualified classname- Returns:
- null or a WrapperDefinition identified by its fully qualified classname
-
getByInterface
public WrapperDefinition getByInterface(String interfaceClass)
Description copied from interface:WrapperRegistry
Returns null or a WrapperDefinition identified by its fully qualified classname.- Specified by:
getByInterface
in interfaceWrapperRegistry
- Parameters:
interfaceClass
- Fully qualified classname- Returns:
- null or a WrapperDefinition identified by its fully qualified classname
-
getComponentByInterface
public Component getComponentByInterface(String fullyQualifiedClassName)
Not implemented. Do not use- Specified by:
getComponentByInterface
in interfaceWrapperRegistry
- Parameters:
fullyQualifiedClassName
-- Returns:
- The component that provides an implementation for the specified interface
-
getByNodeType
public WrapperDefinition getByNodeType(String nodetype)
Description copied from interface:WrapperRegistry
Returns null or a WrapperDefinition identified by its fully qualified node type name.- Specified by:
getByNodeType
in interfaceWrapperRegistry
- Parameters:
nodetype
- Fully qualified node type name- Returns:
- null or a WrapperDefinition identified by its fully qualified node type name
-
getClassByName
public Class getClassByName(String className)
Description copied from interface:WrapperRegistry
Returns null or a class based on its fully qualified class name.- Specified by:
getClassByName
in interfaceWrapperRegistry
- Parameters:
className
- Fully qualified classname- Returns:
- null or a class based on its fully qualified class name
-
getInstance
public Object getInstance(String className)
Description copied from interface:WrapperRegistry
Returns an object instance based on its fully qualified class name.- Specified by:
getInstance
in interfaceWrapperRegistry
- Parameters:
className
- Fully qualified classname- Returns:
- an object instance based on its fully qualified class name
-
getByObjectType
public WrapperDefinition getByObjectType(String objectTypeName)
Needed for the SiteWorksWrapperFactory.- Parameters:
objectTypeName
- the name of the objecttype- Returns:
- the wrapperdefinition for the given objecttype, or null if it is not registered
-
getObjectTypeNameByInterface
public String getObjectTypeNameByInterface(String interfaceClass)
Return the name of the object type from the name of the interface- Specified by:
getObjectTypeNameByInterface
in interfaceWrapperRegistry
- Parameters:
interfaceClass
- Name of the interface for which the corresponding object type name should be retrieved- Returns:
- Object type name that corresponds to the given interface
-
loadMappings
public void loadMappings(File mappingsFile)
-
-