|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.compass.gps.device.AbstractGpsDevice
org.compass.gps.device.ojb.OjbGpsDevice
public class OjbGpsDevice
An ObJectRelationalBridge (OJB) device, provides support for using ojb and ojb mapping files to index a database. The path can be views as: Database <-> OJB <-> Objects <-> Compass::Gps <-> Compass::Core (Search Engine). What it means is that for every object that has both ojb and compass mappings, you will be able to index it's data, as well as real time mirroring of data changes.
Indexing the data (using theindex()
operation) requires the
batchPersistentBroker
property to be set, before the
index()
operation is called.
Real-time mirroring of data changes requires to use the
attachLifecycleListeners(PersistenceBroker)
to let the
device listen for any data changes, and
removeLifecycleListeners(PersistenceBroker)
to remove
the listener. Since the lifecycle listener can only be set on the instance
level, and not the factory level (why would you do that, ojb developers?),
attach and remove must be called every time a PersistentBroker is
instantiated. You can use the
OjbGpsDeviceUtils.attachPersistenceBrokerForIndex(org.compass.gps.CompassGpsDevice, org.apache.ojb.broker.PersistenceBroker)
and
OjbGpsDeviceUtils.removePersistenceBrokerForMirror(org.compass.gps.CompassGpsDevice, org.apache.ojb.broker.PersistenceBroker)
as helper methods if attache to a generic device is required (which must be
the OjbGpsDevice).
Since the real time mirroring and the event listener registration sounds like
an aspect for Ojb aware classes/methods, Compass::Spring utilizes spring
support for OJB and aspects for a much simpler event registration, please see
Compass::Spring for more documentation.
Field Summary | |
---|---|
protected static org.apache.commons.logging.Log |
log
|
Fields inherited from class org.compass.gps.device.AbstractGpsDevice |
---|
compassGps |
Constructor Summary | |
---|---|
OjbGpsDevice()
|
|
OjbGpsDevice(String name,
org.apache.ojb.broker.PersistenceBroker indexPersistenceBroker)
|
Method Summary | |
---|---|
void |
attachLifecycleListeners(org.apache.ojb.broker.PersistenceBroker pb)
Attached the OjbGpsDevice lifecycle listener to the instance of the persistence broker. |
protected org.apache.ojb.broker.PersistenceBroker |
doGetIndexPersistentBroker()
A method which can be used by derived classes to supply the persistent broker by a means of a centrelized registry (for example). |
protected void |
doIndex(CompassSession session,
IndexPlan indexPlan)
Derived devices must implement the method to perform the actual indexing operation. |
protected void |
doStart()
Derived devices can implement it in case of start event notification. |
protected void |
doStop()
Derived devices can implement it in case of stop event notification. |
org.apache.ojb.broker.PersistenceBroker |
getIndexPersistenceBroker()
Returns the batch persistence broker used for indexing. |
boolean |
isMirrorDataChanges()
Should the device perform real time data mirroring. |
void |
removeLifecycleListeners(org.apache.ojb.broker.PersistenceBroker pb)
Removed the OjbGpsDevice lifecycle listener from the instance of the persistence broker. |
void |
setIndexPersistenceBroker(org.apache.ojb.broker.PersistenceBroker indexPersistenceBroker)
Sets the batch persistence broker used for indexing. |
void |
setMirrorDataChanges(boolean mirrorDataChanges)
Sets if the device will perform real time data changes mirroring. |
Methods inherited from class org.compass.gps.device.AbstractGpsDevice |
---|
buildMessage, getGps, getName, index, injectGps, isFilteredForIndex, isPerformingIndexOperation, isRunning, setFilteredEntitiesForIndex, setName, shouldMirrorDataChanges, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.compass.gps.CompassGpsDevice |
---|
getGps, getName, index, injectGps, isPerformingIndexOperation, isRunning, setName, shouldMirrorDataChanges, start, stop |
Field Detail |
---|
protected static org.apache.commons.logging.Log log
Constructor Detail |
---|
public OjbGpsDevice()
public OjbGpsDevice(String name, org.apache.ojb.broker.PersistenceBroker indexPersistenceBroker)
Method Detail |
---|
protected void doIndex(CompassSession session, IndexPlan indexPlan) throws CompassGpsException
AbstractGpsDevice
doIndex
in class AbstractGpsDevice
CompassGpsException
protected org.apache.ojb.broker.PersistenceBroker doGetIndexPersistentBroker() throws CompassGpsException
CompassGpsException
protected void doStart() throws CompassGpsException
AbstractGpsDevice
doStart
in class AbstractGpsDevice
CompassGpsException
protected void doStop() throws CompassGpsException
AbstractGpsDevice
doStop
in class AbstractGpsDevice
CompassGpsException
public void attachLifecycleListeners(org.apache.ojb.broker.PersistenceBroker pb)
pb
- The persistence brokerpublic void removeLifecycleListeners(org.apache.ojb.broker.PersistenceBroker pb)
pb
- The persistence brokerpublic org.apache.ojb.broker.PersistenceBroker getIndexPersistenceBroker()
public void setIndexPersistenceBroker(org.apache.ojb.broker.PersistenceBroker indexPersistenceBroker)
public boolean isMirrorDataChanges()
MirrorDataChangesGpsDevice
isMirrorDataChanges
in interface MirrorDataChangesGpsDevice
true
if the device mirror data changespublic void setMirrorDataChanges(boolean mirrorDataChanges)
MirrorDataChangesGpsDevice
setMirrorDataChanges
in interface MirrorDataChangesGpsDevice
mirrorDataChanges
- Should the device mirror data changes
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |