org.geotools.catalog.defaults
Class DefaultCatalog

java.lang.Object
  extended byorg.geotools.catalog.AbstractCatalog
      extended byorg.geotools.catalog.defaults.DefaultCatalog
All Implemented Interfaces:
Catalog, Resolve

public class DefaultCatalog
extends AbstractCatalog

Default Catalog implementation. All services are stored in memory.

Since:
0.6
Author:
David Zwiers, Refractions Research, Justin Deoliveira, jdeolive@openplans.org

Nested Class Summary
 
Nested classes inherited from class org.geotools.catalog.Resolve
Resolve.Status
 
Constructor Summary
DefaultCatalog()
           
DefaultCatalog(CatalogInfo metadata)
           
 
Method Summary
 void add(Service entry)
          Adds the specified entry to this catalog.
 void addCatalogListener(ResolveChangeListener listener)
           
 boolean canResolve(java.lang.Class adaptee)
          Non blocking method which is used to determine if a resolve into an instance of a particular class is supported.
protected static boolean check(GeoResource resource, AST pattern)
           
protected static boolean check(GeoResource resource, AST pattern, com.vividsolutions.jts.geom.Envelope bbox)
           
protected static boolean check(Service service, AST pattern)
           
 java.util.List find(java.net.URI query, ProgressListener monitor)
          Quick search by url match.
 java.util.List findService(java.net.URI query, ProgressListener monitor)
          Quick search by url match.
 void fire(ResolveChangeEvent event)
          Fire a resource changed event, these may be batched into one delta for performance.
 java.net.URI getIdentifier()
          Returns a URI which uniqley identifies the Resolve.
 java.lang.Throwable getMessage()
          In the event that an error occurs during a resolve, that error can be reported back with this method.
 Resolve.Status getStatus()
          Status of the resolve.
 java.util.List members(ProgressListener monitor)
          Blocking method which resolves this instance into its members (children).
 void remove(Service entry)
          Removes the specified entry to this catalog.
 void removeCatalogListener(ResolveChangeListener listener)
           
 void replace(java.net.URI id, Service entry)
          Replaces the specified entry in this catalog.
 java.lang.Object resolve(java.lang.Class adaptee, ProgressListener monitor)
          Will attempt to morph into the adaptee, and return that object.
 java.util.List search(java.lang.String pattern, com.vividsolutions.jts.geom.Envelope bbox, ProgressListener monitor)
          Performs a search on this catalog based on the specified inputs.
 
Methods inherited from class org.geotools.catalog.AbstractCatalog
addListener, getInfo, parent, removeListener, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultCatalog

public DefaultCatalog()

DefaultCatalog

public DefaultCatalog(CatalogInfo metadata)
Method Detail

addCatalogListener

public void addCatalogListener(ResolveChangeListener listener)
Parameters:
listener -
See Also:
net.refractions.udig.catalog.ICatalog#addCatalogListener(net.refractions.udig.catalog.ICatalog.ICatalogListener)

removeCatalogListener

public void removeCatalogListener(ResolveChangeListener listener)
Parameters:
listener -
See Also:
net.refractions.udig.catalog.ICatalog#removeCatalogListener(net.refractions.udig.catalog.ICatalog.ICatalogListener)

add

public void add(Service entry)
         throws java.lang.UnsupportedOperationException
Description copied from interface: Catalog
Adds the specified entry to this catalog. In some cases the catalog will be backed onto a server, which may not allow for additions.

An IService may belong to more than one Catalog.

Parameters:
entry -
Throws:
java.lang.UnsupportedOperationException
See Also:
net.refractions.udig.catalog.ICatalog#add(net.refractions.udig.catalog.IService)

remove

public void remove(Service entry)
            throws java.lang.UnsupportedOperationException
Description copied from interface: Catalog
Removes the specified entry to this catalog. In some cases the catalog will be backed onto a server, which may not allow for deletions.

Parameters:
entry -
Throws:
java.lang.UnsupportedOperationException
See Also:
net.refractions.udig.catalog.ICatalog#remove(net.refractions.udig.catalog.IService)

replace

public void replace(java.net.URI id,
                    Service entry)
             throws java.lang.UnsupportedOperationException
Description copied from interface: Catalog
Replaces the specified entry in this catalog. In some cases the catalog will be backed onto a server, which may not allow for deletions.

Parameters:
id -
entry -
Throws:
java.lang.UnsupportedOperationException

find

public java.util.List find(java.net.URI query,
                           ProgressListener monitor)
Quick search by url match.

Parameters:
query -
monitor - used to show the progress of the find.
Returns:
List
Throws:
java.io.IOException
See Also:
net.refractions.udig.catalog.ICatalog#search(org.geotools.filter.Filter)

findService

public java.util.List findService(java.net.URI query,
                                  ProgressListener monitor)
Quick search by url match.

Parameters:
query -
monitor - monitor used to watch progress
Returns:
List
Throws:
java.io.IOException
See Also:
net.refractions.udig.catalog.ICatalog#search(org.geotools.filter.Filter)

search

public java.util.List search(java.lang.String pattern,
                             com.vividsolutions.jts.geom.Envelope bbox,
                             ProgressListener monitor)
Performs a search on this catalog based on the specified inputs. The pattern uses the following conventions: use " " to surround a phase use + to represent 'AND' use - to represent 'OR' use ! to represent 'NOT' use ( ) to designate scope The bbox provided shall be in Lat - Long, or null if the search is not to be contained within a specified area.

Parameters:
pattern -
bbox - used for an intersection test
monitor - for progress, or null if monitoring is not desired
Returns:
See Also:
net.refractions.udig.catalog.ICatalog#search(java.lang.String, com.vividsolutions.jts.geom.Envelope)

check

protected static boolean check(Service service,
                               AST pattern)

check

protected static boolean check(GeoResource resource,
                               AST pattern)

check

protected static boolean check(GeoResource resource,
                               AST pattern,
                               com.vividsolutions.jts.geom.Envelope bbox)

fire

public void fire(ResolveChangeEvent event)
Fire a resource changed event, these may be batched into one delta for performance.

Specified by:
fire in interface Resolve
Overrides:
fire in class AbstractCatalog
Throws:
java.io.IOException - protected void fireResourceEvent( IGeoResource resource, IResolveDelta.Kind kind ) throws IOException { Object[] listeners = catalogListeners.getListeners(); if( listeners.length == 0 ) return; GeoReferenceDelta rDelta = new GeoReferenceDelta( resource, kind ); ServiceDelta sDelta = new ServiceDelta( resource.getService(null), IDelta.Kind.NO_CHANGE, Collections.singletonList( rDelta ) ); CatalogDelta cDelta = new CatalogDelta( Collections.singletonList( (IDelta)sDelta ) ); fire( new CatalogChangeEvent( resource, ICatalogChangeEvent.Type.POST_CHANGE, cDelta ) ); }

resolve

public java.lang.Object resolve(java.lang.Class adaptee,
                                ProgressListener monitor)
Description copied from interface: Catalog
Will attempt to morph into the adaptee, and return that object. Required adaptions: May Block.

Parameters:
adaptee -
monitor - May Be Null
Returns:
See Also:
net.refractions.udig.catalog.ICatalog#resolve(java.lang.Class, org.eclipse.core.runtime.IProgressMonitor)

canResolve

public boolean canResolve(java.lang.Class adaptee)
Description copied from interface: Resolve
Non blocking method which is used to determine if a resolve into an instance of a particular class is supported.

Parameters:
adaptee - Class of object to resolve into.
Returns:
true if a resolution for adaptee is avaialble
See Also:
IResolve#resolve(Class,ProgressListener)

members

public java.util.List members(ProgressListener monitor)
Description copied from interface: Resolve
Blocking method which resolves this instance into its members (children). This method returns null if the instance does not have any children, or the children could be determined.

Parameters:
monitor - Progress monitor used to report status while blocking. May be null.
Returns:
A list (possibly empty) of members, null if the members could not be obtained or the instance has not members. Objects in the returned list implement the Resolve interface.

getStatus

public Resolve.Status getStatus()
Description copied from interface: Resolve
Status of the resolve. Resolving into other types of objects often involves connecting to a remote service or resource. This method is provided to indicate the state of any connections.

Returns:
One of Resolve.Status.BROKEN,Resolve.Status.CONNECTED, or Resolve.Status.NOTCONNECTED.

getMessage

public java.lang.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.

Returns:
An exception that occured during a resolve, otherwise null.
See Also:
Resolve.Status

getIdentifier

public java.net.URI getIdentifier()
Description copied from interface: Resolve
Returns a URI which uniqley identifies the Resolve.

Returns:
Id of the Resolve, should never be null.


Copyright © GeoTools. All Rights Reserved.