001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2005-2006, GeoTools Project Managment Committee (PMC)
005: * (C) 2005, Refractions Research Inc.
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation;
010: * version 2.1 of the License.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: */
017: package org.geotools.catalog;
018:
019: import java.io.IOException;
020: import java.util.Map;
021:
022: import org.geotools.util.ProgressListener;
023:
024: /**
025: * Abstract implementation of Catalog.
026: *
027: * @author Justin Deoliveira, The Open Planning Project
028: *
029: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/catalog/AbstractCatalog.java $
030: */
031: public abstract class AbstractCatalog implements Catalog {
032:
033: /** user data */
034: private Map userData;
035:
036: /**
037: * Catalogs do not have a parent so null is returned.
038: * <p>
039: * We can consider adding a global 'root' parent - but we will wait until we find a need, or if
040: * users request.
041: * </p>
042: *
043: * @return null as catalogs do not have a parent
044: */
045: public Resolve parent(ProgressListener monitor) {
046: return null;
047: }
048:
049: /**
050: * Aquire info on this Catalog.
051: * <p>
052: * This is functionally equivalent to: <core>resolve(ICatalogInfo.class,monitor)</code>
053: * </p>
054: *
055: * @see Catalog#resolve(Class, ProgressListener)
056: * @return ICatalogInfo resolve(ICatalogInfo.class,ProgressListener monitor);
057: */
058: public CatalogInfo getInfo(ProgressListener monitor)
059: throws IOException {
060: return (CatalogInfo) resolve(CatalogInfo.class, monitor);
061: }
062:
063: /**
064: * @return The user / application specific data.
065: */
066: public Map getUserData() {
067: return userData;
068: }
069:
070: /**
071: * Indicate class and id.
072: *
073: * @return string representing this IResolve
074: */
075: public String toString() {
076: StringBuffer buf = new StringBuffer();
077: String classname = getClass().getName();
078: String name = classname
079: .substring(classname.lastIndexOf('.') + 1);
080: buf.append(name);
081: buf.append("("); //$NON-NLS-1$
082: buf.append(getIdentifier());
083: buf.append(")"); //$NON-NLS-1$
084: return buf.toString();
085: }
086:
087: /**
088: * This method does nothing. Sublcasses should override if events are
089: * supported.
090: */
091: public void addListener(ResolveChangeListener listener) {
092: // do nothing
093: }
094:
095: /**
096: * This method does nothing. Sublcasses should override if events are
097: * supported.
098: */
099: public void removeListener(ResolveChangeListener listener) {
100: // do nothing
101: }
102:
103: /**
104: * This method does nothing. Sublcasses should override if events are
105: * supported.
106: */
107: public void fire(ResolveChangeEvent event) {
108: // do nothing
109: }
110: }
|