Class 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 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 interface WrapperRegistry
        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 interface WrapperRegistry
        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 interface WrapperRegistry
        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 interface WrapperRegistry
        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 interface WrapperRegistry
        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 interface WrapperRegistry
        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 interface WrapperRegistry
        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 interface WrapperRegistry
        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)