org.compass.gps.device
Class AbstractGpsDevice

java.lang.Object
  extended by org.compass.gps.device.AbstractGpsDevice
All Implemented Interfaces:
CompassGpsDevice
Direct Known Subclasses:
AbstractJdbcGpsDevice, AbstractMirrorGpsDevice, AbstractParallelGpsDevice, JdoGpsDevice, OjbGpsDevice

public abstract class AbstractGpsDevice
extends Object
implements CompassGpsDevice

A general abstract device which can be used by all types of devices.

Provides support for device name, state management isRunning(), as well as general helper methods.

Author:
kimchy

Field Summary
protected  CompassGpsInterfaceDevice compassGps
           
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
AbstractGpsDevice()
           
 
Method Summary
 String buildMessage(String message)
           
protected abstract  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.
 CompassGps getGps()
          Returns the CompassGps that manages the device.
 String getName()
          Returns the name associated with the device.
 void index(IndexPlan indexPlan)
          Index the device using the given index plan
 void injectGps(CompassGps compassGps)
          Sets the CompassGps that manages the device.
 boolean isFilteredForIndex(String entity)
           
 boolean isPerformingIndexOperation()
          Retuns true if the devide performs the index operaiton.
 boolean isRunning()
          Returns if the device is running.
 void setFilteredEntitiesForIndex(String[] filteredEntitiesForIndex)
           
 void setName(String name)
          Sets the name associated with the device.
 boolean shouldMirrorDataChanges()
          Returns true if the device is required to perform mirror operation.
 void start()
          Starts the device.
 void stop()
          Stops the device.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected org.apache.commons.logging.Log log

compassGps

protected CompassGpsInterfaceDevice compassGps
Constructor Detail

AbstractGpsDevice

public AbstractGpsDevice()
Method Detail

getName

public String getName()
Description copied from interface: CompassGpsDevice
Returns the name associated with the device.

Specified by:
getName in interface CompassGpsDevice
Returns:
The name of the device.

setName

public void setName(String name)
Description copied from interface: CompassGpsDevice
Sets the name associated with the device.

Specified by:
setName in interface CompassGpsDevice

getGps

public CompassGps getGps()
Description copied from interface: CompassGpsDevice
Returns the CompassGps that manages the device.

Specified by:
getGps in interface CompassGpsDevice
Returns:
compassGps

injectGps

public void injectGps(CompassGps compassGps)
Description copied from interface: CompassGpsDevice
Sets the CompassGps that manages the device. Optional, since if the device is added to a CompassGps instance, it will be done automatically.

Specified by:
injectGps in interface CompassGpsDevice

setFilteredEntitiesForIndex

public void setFilteredEntitiesForIndex(String[] filteredEntitiesForIndex)

buildMessage

public String buildMessage(String message)

isFilteredForIndex

public boolean isFilteredForIndex(String entity)

index

public void index(IndexPlan indexPlan)
           throws CompassGpsException
Description copied from interface: CompassGpsDevice
Index the device using the given index plan

Specified by:
index in interface CompassGpsDevice
Throws:
CompassGpsException

doIndex

protected abstract void doIndex(CompassSession session,
                                IndexPlan indexPlan)
                         throws CompassGpsException
Derived devices must implement the method to perform the actual indexing operation.

Throws:
CompassGpsException

start

public void start()
           throws CompassGpsException
Description copied from interface: CompassGpsDevice
Starts the device. Optional, since it is preferable to manage the all the devices through the CompassGps API.

Specified by:
start in interface CompassGpsDevice
Throws:
CompassGpsException

doStart

protected void doStart()
                throws CompassGpsException
Derived devices can implement it in case of start event notification.

Throws:
CompassGpsException

stop

public void stop()
          throws CompassGpsException
Description copied from interface: CompassGpsDevice
Stops the device. Optional, since it is preferable to manage the all the devices through the CompassGps API.

Specified by:
stop in interface CompassGpsDevice
Throws:
CompassGpsException

doStop

protected void doStop()
               throws CompassGpsException
Derived devices can implement it in case of stop event notification.

Throws:
CompassGpsException

isRunning

public boolean isRunning()
Description copied from interface: CompassGpsDevice
Returns if the device is running.

Specified by:
isRunning in interface CompassGpsDevice
Returns:
true if theh device is running

isPerformingIndexOperation

public boolean isPerformingIndexOperation()
Description copied from interface: CompassGpsDevice
Retuns true if the devide performs the index operaiton.

Specified by:
isPerformingIndexOperation in interface CompassGpsDevice

shouldMirrorDataChanges

public boolean shouldMirrorDataChanges()
Description copied from interface: CompassGpsDevice
Returns true if the device is required to perform mirror operation.

Specified by:
shouldMirrorDataChanges in interface CompassGpsDevice


Copyright (c) 2004-2008 The Compass Project.