Construct business object (BObj)
During parsing, a business object is constructed and populated.
<TCRMTxObject>TCRMAddressBObj</TCRMTxObject>
Before OSGi
####################################
# COREPARTY BUSINESS OBJECTS #
####################################
TCRMAddressBObj=com.dwl.tcrm.coreParty.component
TCRMPartyAddressBObj=com.dwl.tcrm.coreParty.component
The parser would look up the correct fully qualified class name of the business object using the simple name included in the request. The value would represent the package name of the business object. By attaching the key (or BObj simple name) to the value (or package name), the parser could derive the fully qualified class name and have enough information to use reflection to construct the business object.
With OSGi
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<service id="BObjFactoryService"
interface="com.ibm.mdm.common.bobj.api.BObjFactoryService">
<service-properties>
<entry key="business.object">
<list>
<value>MyBObj</value>
<value>...</value>
</list>
</entry>
</service-properties>
<bean class="com.ibm.mdm.common.bobj.BObjFactoryServiceImpl">
<argument>
<map key-type="java.lang.String" value-type="java.lang.Class">
<entry key="MyBObj" value="com.org.MyBObj"/>
<entry key="..." value="com.org..."/>
</map>
</argument>
<argument ref="blueprintBundle"/>
</bean>
</service>
</blueprint>
The service has a property called business.object
that
lists the simple names of the business objects found in the bundle.
Like most OSGi services, this service consists of a service interface
and a service implementation. The interface is com.ibm.mdm.common.bobj.api.BObjFactoryService
and
the implementation is com.ibm.mdm.common.bobj.BObjFactoryServiceImpl
.
A technique used in OSGi known as injection is used to
load a java.util.Map
type object with the business
objects contained in this bundle into the factory service implementation.
For
every business object in the bundle, an entry such as <entry
key="MyBObj" value="com.org.MyBObj"/>
is included in the
map. This map is passed as a Java constructor <argument>
to
the service implementation by the blueprint container.
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<service id="BObjFactoryService"
interface="com.ibm.mdm.common.bobj.api.BObjFactoryService"
ranking="10">
<service-properties>
<entry key="business.object">
<list>
<value>PersonBObj</value>
<value>PersonBObjEXT</value>
</list>
</entry>
</service-properties>
<bean class="com.ibm.mdm.common.bobj.BObjFactoryServiceImpl">
<argument>
<map key-type="java.lang.String" value-type="java.lang.Class">
<entry key="PersonBObj" value="com.org.BaseBObjEXT"/>
<entry key="PersonBObjEXT" value="com.org.BaseBObjEXT"/>
</map>
</argument>
<argument ref="blueprintBundle"/>
</bean>
</service>
</blueprint>
In the preceding example, PersonBObj
is extended by PersonBObjEXT. The service declaration includes a ranking
setting: ranking="10". The ranking can be any value,
provided it is greater than the ranking of the original service where
PersonBObj is specified. All default services in InfoSphere MDM have
a ranking of 0, so a ranking of 10 will
do. Notice, however, that the map that is injected into the factory
service implementation, the name of the PersonBObj and the name of
the PersonBObjEXT are linked to the extending business object class
name: com.org.BaseBObjEXT
. This ensures that the
extending business object will always be used throughout InfoSphere MDM.