public abstract class AbstractBusinessObjectMediator extends java.lang.Object implements BusinessObjectMediator
The main function of the business object mediator is to call ID resolver to resolve keys and also determine whether it is a new object or an existing object.
The business object mediator will call the configured DataWriter
to write
the data out to the data store.
The business object builder will call the business object mediator in the following sequence:
init()
- initialize the business object mediator.preProcess()
- Pre-process the data.execute()
- Resolve the ID in the data object and call the
DataWriter.insert()
or DataWriter.update()
to write out the data.postProcess()
- Post process the data.close()
- Close the business object mediator.BusinessObjectMediator
,
BusinessObjectMediator.init()
,
BusinessObjectMediator.initConfig(Node, ConfigProperties)
,
BusinessObjectMediator.preProcess(Object)
,
BusinessObjectMediator.execute(Object)
,
BusinessObjectMediator.postProcess()
,
BusinessObjectMediator.close()
,
BusinessObjectMediator.setConfigProperties(ConfigProperties)
,
BusinessObjectMediator.getConfigProperties()
Constructor and Description |
---|
AbstractBusinessObjectMediator() |
Modifier and Type | Method and Description |
---|---|
void |
close()
This method will perform cleanup on the business object mediator.
|
void |
execute(java.lang.Object obj)
It calls the transform() method to transform the logic
noun to a list of physical objects.
|
ConfigProperties |
getConfigProperties()
Returns the instance of the
ConfigProperties of the BusinessObjectWriter . |
java.lang.Long |
getEndKey()
Returns the end key.
|
java.lang.Long |
getStartKey()
Returns the start key.
|
void |
init()
This method performs some initialization for the business object mediator.
|
ConfigProperties |
initConfig(org.w3c.dom.Node businessObjectMediatorNode,
ConfigProperties parentConfigProperties)
This method parses the
BusinessObjectMediator xml node read in from the business object configuration file
and stores the configuration in memory. |
void |
postProcess()
This method performs any post processing of the data after the data has been written to the data store.
|
void |
preProcess(java.lang.Object bod)
This method performs any pre-processing of the data if needed.
|
void |
setConfigProperties(ConfigProperties aConfigProperties)
Sets the configuration properties for this business object mediator.
|
public ConfigProperties getConfigProperties()
Returns the instance of the ConfigProperties
of the BusinessObjectWriter
.
Call this method when you need to get specific properties from the configuration properties.
getConfigProperties
in interface BusinessObjectMediator
public java.lang.Long getStartKey()
Returns the start key.
public java.lang.Long getEndKey()
Returns the end key.
public void setConfigProperties(ConfigProperties aConfigProperties)
Sets the configuration properties for this business object mediator.
This method is not normally called unless overriding the configuration properties for this business object mediator is required.
setConfigProperties
in interface BusinessObjectMediator
aConfigProperties
- The configuration properties for this business object mediator.public ConfigProperties initConfig(org.w3c.dom.Node businessObjectMediatorNode, ConfigProperties parentConfigProperties) throws DataLoadException
This method parses the BusinessObjectMediator
xml node read in from the business object configuration file
and stores the configuration in memory.
initConfig
in interface BusinessObjectMediator
businessObjectMediatorNode
- The BusinessObjectMediator
xml node read in from the business object configuration file.parentConfigProperties
- The configuration properties for the parent business object builder of this data reader.DataLoadException
- An application exception will be thrown if there was a problem initializing the configuration for the business object mediator.public void init() throws DataLoadException
This method performs some initialization for the business object mediator.
The values for the batch size, commit count, start key, end key as well as a list of data writers will be attained from the data load configuration.
If any subclasses wish to override this method, then this init()
method
should be called from the subclass.
init
in interface BusinessObjectMediator
DataLoadException
- An application exception will be thrown if there was a problem initializing the business object mediator.public void preProcess(java.lang.Object bod) throws DataLoadException
This method performs any pre-processing of the data if needed. This default implementation performs no function.
The subclass should implement this method only if any pre-processing of the populated data object is needed.
preProcess
in interface BusinessObjectMediator
bod
- The data object data load with input data read in from the data reader.DataLoadException
- An application exception will be thrown is there was a problem pre-processing the data from the data object.public void execute(java.lang.Object obj) throws DataLoadException
execute
in interface BusinessObjectMediator
obj
- the business object with the action codeDataLoadException
- if there are some errors calling the transform(),
dataWrite.save().public void postProcess() throws DataLoadException
This method performs any post processing of the data after the data has been written to the data store. This default implementation performs no function.
Sub classes should implement this method only if any post processing of the data loaded is needed.
postProcess
in interface BusinessObjectMediator
DataLoadException
- An application exception will be thrown is there was a problem post processing the loaded data.public void close() throws DataLoadException
This method will perform cleanup on the business object mediator. It will attempt to close all of the data writers configured for this business object mediator.
This method will flush and commit any data waiting to be persisted in the batch as well as clear the ID resolver cache.
close
in interface BusinessObjectMediator
DataLoadException
- An application exception will be thrown if there was a problem closing the business object mediator or its data writers.