Class CompositionManager
java.lang.Object
de.uni_trier.wi2.procake.utils.composition.CompositionManager
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 Factory
interface and the implementations must
implement the FactoryObjectImplementation
.
Usage: The usage is quite simple:
CompositionManager compo = new CompositionManager(); compo.setConfigrationFile("application.comp"); compo.build();
An example definition file looks like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE Composition SYSTEM "composition.dtd"> <Composition> <Factory name="data_model" class="de.uni_trier.wi2.procake.data.model.ModelFactory"> <Implementation class="de.uni_trier.wi2.procake.data.model.impl.ModelFactoryObjectImpl"> <Parameter value="modelName" value="default"/> <Parameter value="modelPath" value="/de/uni_trier/wi2/procake/model.xml"/> </Implementation> </Factory> </Composition>
- Author:
- rmaximi
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the system.build
(FactoryConfiguration configuration) Builds the system.void
setConfigurationFile
(String pathComposition) void
setConfigurationSource
(InputSource configurationSource)
-
Constructor Details
-
CompositionManager
public CompositionManager()
-
-
Method Details
-
build
Builds the system. First, the configuration file is loaded and second, the implementations are assigned to the factories. It is necessary to first callsetConfigurationFile(String)
.- Returns:
- A cache containing the built factories and the implementations
-
build
Builds the system. The given configuration is used to assign the specified implementations to the factories.- Parameters:
configuration
- The build configuration.- Returns:
- A cache containing the built factories and the implementations
-
setConfigurationSource
- Parameters:
configurationSource
- The configuration file that is necessary forbuild()
.
-
setConfigurationFile
-