001: /*
002: * uDig - User Friendly Desktop Internet GIS client
003: * http://udig.refractions.net
004: * (C) 2004, Refractions Research Inc.
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: */
017: package net.refractions.udig.catalog;
018:
019: import java.net.URI;
020: import java.net.URL;
021:
022: import org.eclipse.jface.resource.ImageDescriptor;
023:
024: /**
025: * Provides metadata information about a service.
026: * <p>
027: * Information is provided in the form of a single, simple, Java bean.
028: * You can treat this bean as a "view" on more complete metadata information
029: * that may be accessable via a subclass (or other resolve target). This
030: * bean offers up service metadata information to the uDig search
031: * facilities, this information may also be displayed to users.
032: * </p>
033: * <p>
034: * Much of the names and motivation have been taken from Dublin Code
035: * and it's application profile for RDF.
036: * </p>
037: *
038: * @author David Zwiers, Refractions Research
039: * @since 0.6
040: */
041: public class IServiceInfo {
042:
043: protected String title, description, _abstract;
044: protected URI schema;
045: protected URL source, publisher;
046: protected String[] keywords;
047: protected ImageDescriptor icon;
048:
049: protected IServiceInfo() {
050: // to be used in an over-ride
051: }
052:
053: public IServiceInfo(String title, String description,
054: String _abstract, URL source, URL publisher, URI schema,
055: String[] keywords, ImageDescriptor icon) {
056: this .title = title;
057: this .description = description;
058: this ._abstract = _abstract;
059: this .schema = schema;
060: this .source = source;
061: this .publisher = publisher;
062: int i = 0;
063: if (keywords != null)
064: i = keywords.length;
065: String[] k = new String[i];
066: if (keywords != null)
067: System.arraycopy(keywords, 0, k, 0, k.length);
068: this .keywords = k;
069: this .icon = icon;
070: }
071:
072: /**
073: * Returns the service title, may be empty or null if unsupported.
074: * <p>
075: * Note this is always metadata, and is in user terms.
076: * </p>
077: *
078: * @return title, may be empty, null if unsupported.
079: */
080: public String getTitle() {
081: return title;
082: }
083:
084: /**
085: * Returns the service keywords. Maps to the Dublin Core Subject element.
086: *
087: * @return
088: */
089: public String[] getKeywords() { // aka Subject
090: int i = 0;
091: if (keywords != null)
092: i = keywords.length;
093: String[] k = new String[i];
094: if (keywords != null)
095: System.arraycopy(keywords, 0, k, 0, k.length);
096: return k;
097:
098: }
099:
100: /**
101: * Returns the service description.
102: *
103: * This use is understood to be in agreement with "dublin-core",
104: * implementors may use either abstract or description as needed.
105: * <p>
106: * Dublin Core:
107: * <quote>
108: * A textual description of the content of the resource, including
109: * abstracts in the case of document-like objects or content
110: * descriptions in the case of visual resources.
111: * </quote>
112: *
113: * When providing actual dublin-core metadata you can gather up
114: * all the description information into a single string for
115: * searching.
116: *
117: * @return Description of visual contents
118: */
119: public String getDescription() {
120: return description;
121: }
122:
123: /**
124: * Return the service abstract.
125: *
126: * This use is understood to be in agreement with OGC Open Web Services,
127: * implementors may use either abstract or description as needed.
128: * <p>
129: * When working with an Open Web Service this method is a direct match,
130: * you may also choose it when providing actual dublin-core information
131: * if the description element is specifically an abstract.
132: * </p>
133: *
134: * @return text Abstract of document-like services
135: */
136: public String getAbstract() {
137: return _abstract;
138: }
139:
140: /**
141: * Return the service publisher
142: *
143: * @return
144: */
145: public URL getPublisher() {
146: return publisher;
147: }
148:
149: /**
150: * Returns the xml schema namespace for this service type.
151: * <p>
152: * Maps to the Dublin Code Format element.
153: * </p>
154: *
155: * @return namespace for service type
156: */
157: public URI getSchema() { // aka format
158: return schema;
159: }
160:
161: /**
162: * Returns the service source. Maps to the Dublin Core Server Element
163: *
164: * @return
165: */
166: public URL getSource() { // aka server
167: return source;
168: }
169:
170: /**
171: * Base symbology (with out decorators) representing this IService.
172: * <p>
173: * The ImageDescriptor returned should conform the the Eclipse User Interface Guidelines (16x16
174: * image with a 16x15 glyph centered).
175: * </p>
176: * <p>
177: * This plug-in provides default images based on service type:
178: *
179: * <pre><code>
180: * <b>return</b> ISharedImages.getImagesDescriptor( IService );
181: * </code></pre>
182: *
183: * <ul>
184: * <p>
185: * Any LabelProvider should use the default image, a label decorator should be used to pick up
186: * these images in a separate thread. This allows services like WFS make blocking request to
187: * pick up the image from their GetCapabilities.
188: * </p>
189: *
190: * @return ImageDescriptor symbolizing this IService.
191: */
192: public ImageDescriptor getIcon() {
193: return icon;
194: }
195: }
|