org.compass.gps.impl
Class AbstractCompassGps

java.lang.Object
  extended by org.compass.gps.impl.AbstractCompassGps
All Implemented Interfaces:
CompassGps, CompassGpsInterfaceDevice
Direct Known Subclasses:
DualCompassGps, SingleCompassGps

public abstract class AbstractCompassGps
extends Object
implements CompassGpsInterfaceDevice

A simple base class for CompassGps implementations.

Author:
kimchy

Field Summary
protected  HashMap<String,CompassGpsDevice> devices
           
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
AbstractCompassGps()
           
 
Method Summary
 void addGpsDevice(CompassGpsDevice gpsDevice)
          Adds a CompassGpsDevice to be managed.
protected abstract  void doIndex(IndexPlan indexPlan)
           
protected abstract  void doStart()
           
protected abstract  void doStop()
           
protected  void finalize()
           
protected  CompassGpsDevice getGpsDevice(String name)
           
protected  ResourceMapping getMappingForEntity(String name, Compass checkedCompass)
           
protected  ResourceMapping getRootMappingForEntity(Class clazz, Compass checkedCompass)
           
protected  ResourceMapping getRootMappingForEntity(String name, Compass checkedCompass)
           
protected  boolean hasMappingForEntity(Class clazz, Compass checkedCompass, CascadeMapping.Cascade cascade)
           
protected  boolean hasMappingForEntity(String name, Compass checkedCompass, CascadeMapping.Cascade cascade)
           
protected  boolean hasRootMappingForEntity(Class clazz, Compass checkedCompass)
           
protected  boolean hasRootMappingForEntity(String name, Compass checkedCompass)
           
 void index()
          Indexes all the different devices (by calling their respective index() operation.
 void index(Class... types)
          Index just the given types.
 void index(IndexPlan indexPlan)
          Indexes all the different devices based on the given index plan.
 void index(String... aliases)
          Index just the aliases.
 boolean isPerformingIndexOperation()
          Retuns true if the devide performs the index operaiton.
 boolean isRunning()
          Return true is started.
 void setGpsDevices(CompassGpsDevice[] devices)
          Sets a list of CompassGpsDevices that will be managed.
 void start()
          Start CompassGps (also starts all the devices).
 void stop()
          Stops CompassGps (also starts all the devices).
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.compass.gps.spi.CompassGpsInterfaceDevice
executeForIndex, executeForMirror, getIndexCompass, getMappingForEntityForIndex, getMappingForEntityForIndex, getMirrorCompass, hasMappingForEntityForIndex, hasMappingForEntityForIndex, hasMappingForEntityForMirror, hasMappingForEntityForMirror
 

Field Detail

log

protected org.apache.commons.logging.Log log

devices

protected HashMap<String,CompassGpsDevice> devices
Constructor Detail

AbstractCompassGps

public AbstractCompassGps()
Method Detail

addGpsDevice

public void addGpsDevice(CompassGpsDevice gpsDevice)
Description copied from interface: CompassGps
Adds a CompassGpsDevice to be managed.

Specified by:
addGpsDevice in interface CompassGps

setGpsDevices

public void setGpsDevices(CompassGpsDevice[] devices)
Description copied from interface: CompassGps
Sets a list of CompassGpsDevices that will be managed.

Specified by:
setGpsDevices in interface CompassGps

getGpsDevice

protected CompassGpsDevice getGpsDevice(String name)

hasRootMappingForEntity

protected boolean hasRootMappingForEntity(Class clazz,
                                          Compass checkedCompass)

hasMappingForEntity

protected boolean hasMappingForEntity(Class clazz,
                                      Compass checkedCompass,
                                      CascadeMapping.Cascade cascade)

hasMappingForEntity

protected boolean hasMappingForEntity(String name,
                                      Compass checkedCompass,
                                      CascadeMapping.Cascade cascade)

getRootMappingForEntity

protected ResourceMapping getRootMappingForEntity(Class clazz,
                                                  Compass checkedCompass)

hasRootMappingForEntity

protected boolean hasRootMappingForEntity(String name,
                                          Compass checkedCompass)

getMappingForEntity

protected ResourceMapping getMappingForEntity(String name,
                                              Compass checkedCompass)

getRootMappingForEntity

protected ResourceMapping getRootMappingForEntity(String name,
                                                  Compass checkedCompass)

index

public void index()
           throws CompassGpsException,
                  IllegalStateException
Description copied from interface: CompassGps
Indexes all the different devices (by calling their respective index() operation.

Similar to calling the CompassGps.index(IndexPlan) with a new instance of DefaultIndexPlan (and nothing else set).

Specified by:
index in interface CompassGps
Throws:
CompassGpsException
IllegalStateException

index

public void index(Class... types)
           throws CompassGpsException,
                  IllegalStateException
Description copied from interface: CompassGps
Index just the given types.

Specified by:
index in interface CompassGps
Throws:
CompassGpsException
IllegalStateException

index

public void index(String... aliases)
           throws CompassGpsException,
                  IllegalStateException
Description copied from interface: CompassGps
Index just the aliases.

Specified by:
index in interface CompassGps
Throws:
CompassGpsException
IllegalStateException

index

public void index(IndexPlan indexPlan)
           throws CompassGpsException,
                  IllegalStateException
Description copied from interface: CompassGps
Indexes all the different devices based on the given index plan. The index plan, by default, supports constraining the indexing process to specific classes/aliases/sub indexes.

Specified by:
index in interface CompassGps
Throws:
CompassGpsException
IllegalStateException

doIndex

protected abstract void doIndex(IndexPlan indexPlan)
                         throws CompassGpsException
Throws:
CompassGpsException

start

public void start()
           throws CompassGpsException
Description copied from interface: CompassGps
Start CompassGps (also starts all the devices).

Specified by:
start in interface CompassGps
Throws:
CompassGpsException

doStart

protected abstract void doStart()
                         throws CompassGpsException
Throws:
CompassGpsException

doStop

protected abstract void doStop()
                        throws CompassGpsException
Throws:
CompassGpsException

stop

public void stop()
          throws CompassGpsException
Description copied from interface: CompassGps
Stops CompassGps (also starts all the devices).

Specified by:
stop in interface CompassGps
Throws:
CompassGpsException

isRunning

public boolean isRunning()
Description copied from interface: CompassGps
Return true is started.

Specified by:
isRunning in interface CompassGps

isPerformingIndexOperation

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

Specified by:
isPerformingIndexOperation in interface CompassGps

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable


Copyright (c) 2004-2008 The Compass Project.