Class CompositionManager

  • public class CompositionManager
    extends Object
    The composition manager binds possible implementation of a factory to a factory. The definition is done in a XML file, defined by composition.dtd.

    The factories must implement the Factoryinterface and the implementations must implement the FactoryObjectImplementation.

    Usage: The usage is quite simple:

     CompositionManager compo = new CompositionManager();

    An example definition file looks like this:

     <?xml version="1.0" encoding="UTF-8"?>
     <!DOCTYPE Composition SYSTEM "composition.dtd">
       <Factory name="logger" class="cake.logger.LoggerFactory">
         <Implementation class="cake.logger.log4j_1_2_8.Log4JLogger">
           <Parameter value="config" name="resources/jrelogger.conf"/>
       <Factory name="util_multilanguag" class="cake.utils.multilanguage.MessageFormatterFactory">
         <Implementation class="cake.utils.multilanguage.jdk1_4.MessageFormatter">
           <Parameter value="locale" name="de"/>
    See Also:
    FactoryObjectImplementation, Factory
    • Constructor Detail

      • CompositionManager

        public CompositionManager()
    • Method Detail

      • build

        public CakeInstanceCache build()
        Builds the system. First, the configuation file is loaded and second, the implementations are assigned to the factories. It is necessary to first call setConfigurationFile(String).
        A cache containing the built factories and the implementations
      • build

        public CakeInstanceCache build​(FactoryConfiguration configuration)
        Builds the system. The given configuration is used to assign the specified implementations to the factories.
        configuration - The build configuration.
        A cache containing the built factories and the implementations
      • setConfigurationSource

        public void setConfigurationSource​(InputSource configurationSource)
        configurationSource - The configuration file that is necessary for build().
      • setConfigurationFile

        public void setConfigurationFile​(String pathComposition)