The component framework uses XML declarations of contracts, implementations and instances. Related documents are the concept and cookbook of the component framework.
<COMPONENTS> tag is the body tag for component definitions.<?xml version="1.0" encoding="UTF-8"?> <components xmlns="http://www.intershop.de/component/2010"/>
scopeThis attribute is optional.
The attribute scope defines a default scope to instantiate contained instances. Currently available are app and global.
<components scope="global|app" />
Note
If no scope is defined within the instance definition, the component framework applies the default value global.
Note
The provided interface should declare what the instance is doing. It should not declare what is needed to fulfill this functionality.
The <CONTRACT> tag allows to define a component contract.
Note
Currently, only JAVA interfaces are supported.
<?xml version="1.0" encoding="UTF-8"?> <components xmlns="http://www.intershop.de/component/2010"> <contract name="[name]" class="[classname]"/> </components>
nameThis attribute is required.
classThis attribute is required.
<IMPLEMENTATION> tag allows to define an implementation of a contract.<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://www.intershop.de/component/2010">
<implementation name="[name]" implements="[contract-name]" factory="[factory-name]" class="[class-name]" start="nameOfStartMethod" stop="nameOfStopMethod">
<!-- multiple implements can be listed -->
<implements contract="[contract-name]" />
<requires name="[property-name]" contract="[contract-name]" cardinality="[1..1|0..1|1..n|0..n]" />
</implementation>
</components>
nameThis attribute is required.
factoryThis attribute is optional.
JavaBeanFactory)implementsThis attribute is required.
classThis attribute is optional when using a factory which already have the class attribute. When using the JavaBeanFactory the attribute is required.
startThis attribute is optional.
stopThis attribute is optional.
<REQUIRES> tag allows to define the requirements of the implementation.<REQUIRES> tag is a child element of the <IMPLEMENTATION> tag. For a syntax example see syntax of <IMPLEMENTATION>.nameThis tag is required.
contractThis tag is required.
cardinalityThis tag is optional (default: 1..1).
<IMPLEMENTS> tag allows to define the names of additional implemented contracts (extension to the attribute implements of <IMPLEMENTATION> tag).<IMPLEMENTS> tag is a child element of the <IMPLEMENTATION> tag. For a syntax example see syntax of <IMPLEMENTATION>.contractThis attribute is required.
<INSTANCE> tag allows to define a component configuration for a component instance.<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://www.intershop.de/component/2010">
<!-- an instance for an implementation without requirements -->
<instance name="[name]" with="[implementation-name]" />
<!-- an instance for an implementation with directly fulfilled requirements -->
<instance name="[name]" with="[implementation-name]">
<!-- fulfill the requirement with a constant -->
<fulfill requirement="[property-name]" value="[constant]"/>
<!-- fulfill the requirement with another instance -->
<fulfill requirement="[property-name]" with="[instance-name]" />
</instance>
<!-- outside of instance tag -->
<fulfill requirement="[property-name]" of="[instance-name]" with="[instance-name]" />
<fulfill requirement="[property-name]" of="[instance-name]" value="[constant]" />
<!-- instance inside of fulfill tag -->
<instance name="[name]" with="[implementation-name]">
<!-- with attribute of fulfill tag is implicit - filled with inner instance element(s) -->
<fulfill requirement="[property-name]">
<!-- name of instance is optional - anonymous instances are allowed here -->
<instance with="[implementation-name] requirement="[property-name]" with="[instance-name]" />
</instance>
<!-- recursive declaration of instances and fulfillment -->
<instance with="[implementation-name]">
<fulfill requirement="[property-name]">
<instance with="[implementation-name]" />
</fulfill>
</instance>
</fulfill>
</instance>
<!-- replace an instance with a new one, the old is available via the name - value of delegate attribute -->
<replace name="[name]" with="[implementation-name]" delegate="[renamed-instance-name]">
<fulfill requirement="[delegate-property-name]" with="[renamed-instance-name]" />
<!-- other fulfill tags ... -->
</replace>
</components>
nameThis attribute is optional.
Note
If you use <INSTANCE> tag as a child element of <COMPONENTS> tag, the name attribute is required for wiring.
It is recommended to use anonymous instances if you do not need the instance twice for wiring.
withThis attribute is required.
scopeThis attribute is optional.
The attribute scope defines the context in which an instance is created. So it is possible to create different instances for different applications.
<instance name="[aName]" with="[anImplementation]" scope="global|app" />
Note
If no scope is defined within the instance definition, the component framework applies the value set in the components tag. If the components tag does not have a scope the default value is global.
globalA single instance of the implementation is created. The instance is available from all applications.
appThe framework creates an instance of the implementation for each application. An instance is created exclusively for the current application and cannot be accessed by any other application.
<FULFILL> tag allows to define the wiring or simple configuration of the component instance.<FULFILL> tag can be used both as a child element of <INSTANCE> tag and outside as a child element of the <COMPONENTS> tag.<INSTANCE>.requirementThis attribute is required.
ofOne attribute out of with, of or value is mandatory.
withOne attribute out of with, of or value is mandatory.
valueOne attribute out of with, of or value is mandatory.
<REPLACE> tag allows to define replacement of an existing instance.<INSTANCE>.nameThis attribute is required.
<INSTANCE> tag)withThis attribute is required.
<INSTANCE> tag)delegateThis attribute is required.
The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Website, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.