org.geotools.catalog
Class AbstractService

Object
  extended by AbstractService
All Implemented Interfaces:
Resolve, Service
Direct Known Subclasses:
AbstractFileService, DataStoreService, ShapefileService, WFSService, WMSService

public abstract class AbstractService
extends Object
implements Service

Abstract implementation of Service.

Module:
modules/library/main   (gt2-main.jar) (Maven report) (SVN head)

Nested Class Summary
 
Nested classes/interfaces inherited from interface Resolve
Resolve.Status
 
Field Summary
protected static Logger logger
          Logger
 
Constructor Summary
AbstractService(Catalog parent)
          Creates a new service handle contained within a catalog.
AbstractService(Catalog parent, Map params)
          Creates a new service handle contained within a catalog, with a set of connection paramters.
 
Method Summary
 void addListener(ResolveChangeListener listener)
          This method does nothing.
 boolean equals(Object other)
          This should represent the identifier
 void fire(ResolveChangeEvent event)
          This method does nothing.
 Map getConnectionParams()
          Accessor to the set of params used to create this entry.
protected  List getMembers()
           
 Throwable getMessage()
          In the event that an error occurs during a resolve, that error can be reported back with this method.
 Resolve.Status getStatus()
          Default implementation of getStatus.
 int hashCode()
          This should represent the identified
 Resolve parent(ProgressListener monitor)
          Blocking method which resolves this instance into its parent.
 void removeListener(ResolveChangeListener listener)
          This method does nothing.
protected  void setConnectionParams(Map params)
          Sets the connection params for the service handle.
protected  void setMembers(List members)
          Sets the cached value of the members of the service.
protected  void setMessage(Throwable msg)
          Sets the cached error message.
 String toString()
          Indicate class and id.
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface Service
getInfo, members, resolve
 
Methods inherited from interface Resolve
canResolve, getIdentifier
 

Field Detail

logger

protected static Logger logger
Logger

Constructor Detail

AbstractService

public AbstractService(Catalog parent)
Creates a new service handle contained within a catalog.

Parameters:
parent - The catalog containg the service.

AbstractService

public AbstractService(Catalog parent,
                       Map params)
Creates a new service handle contained within a catalog, with a set of connection paramters.

Parameters:
parent - The catalog containing the service.
params - The connection params used to connect to the service.
Method Detail

parent

public Resolve parent(ProgressListener monitor)
Description copied from interface: Resolve
Blocking method which resolves this instance into its parent. This method may return null if the parent can not be determined.

Specified by:
parent in interface Resolve
Parameters:
monitor - Progress monitor for blocking call.
Returns:
he parent Catalog.

getConnectionParams

public Map getConnectionParams()
Description copied from interface: Service
Accessor to the set of params used to create this entry. There is no guarantee that these params created a usable service (@see getStatus() ). These params may have been modified within the factory during creation. This method is intended to be used for cloning (@see IServiceFactory) or for persistence between sessions.

Specified by:
getConnectionParams in interface Service
Returns:
Connection parameters, possibly null.
See Also:
ServiceFinder

setConnectionParams

protected void setConnectionParams(Map params)
Sets the connection params for the service handle.

Parameters:
params - Map of connection paramters.

setMembers

protected void setMembers(List members)
Sets the cached value of the members of the service.

Parameters:
members - List of GeoResource.

getMembers

protected List getMembers()
Returns:
The cached members.

getMessage

public Throwable getMessage()
Description copied from interface: Resolve
In the event that an error occurs during a resolve, that error can be reported back with this method. This method returns a value when Resolve.getStatus() returns Resolve.Status.BROKEN, otherwise it return null.

Specified by:
getMessage in interface Resolve
Returns:
The cached error message.
See Also:
Resolve.Status

setMessage

protected void setMessage(Throwable msg)
Sets the cached error message.

Parameters:
msg - An exception which occured when connecting to the service.

getStatus

public Resolve.Status getStatus()
Default implementation of getStatus.

The following rules are used to determine the status:

  1. If msg is non-null, then the service handle is Status#BROKEN.
  2. If above is false, then if members is non-null then the service handle is Status#CONNECTED
  3. If non of the above hold, the service handle is Status#NOTCONNECTED.

Subclasses can control this method by setting the members msg and members with setMessage(Throwable) and setMembers(List) respectivley. Or subclasses may wish to override this method entirley.

Specified by:
getStatus in interface Resolve
Returns:
One of Resolve.Status.BROKEN,Resolve.Status.CONNECTED, or Resolve.Status.NOTCONNECTED.

equals

public final boolean equals(Object other)
This should represent the identifier

Overrides:
equals in class Object
Parameters:
other -
See Also:
Object.equals(java.lang.Object)

addListener

public void addListener(ResolveChangeListener listener)
This method does nothing. Sublcasses should override if events are supported.

Specified by:
addListener in interface Resolve
Parameters:
listener - DOCUMENT ME!

removeListener

public void removeListener(ResolveChangeListener listener)
This method does nothing. Sublcasses should override if events are supported.

Specified by:
removeListener in interface Resolve
Parameters:
listener - DOCUMENT ME!

fire

public void fire(ResolveChangeEvent event)
This method does nothing. Sublcasses should override if events are supported.

Specified by:
fire in interface Resolve
Parameters:
event - DOCUMENT ME!

hashCode

public final int hashCode()
This should represent the identified

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

toString

public String toString()
Indicate class and id.

Overrides:
toString in class Object
Returns:
string representing this IResolve


Copyright © 1996-2008 Geotools. All Rights Reserved.