01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2005-2006, GeoTools Project Managment Committee (PMC)
05: * (C) 2005, Refractions Research Inc.
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation;
10: * version 2.1 of the License.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: */
17: package org.geotools.catalog;
18:
19: import java.net.URI;
20: import java.util.Map;
21:
22: /**
23: * This is the required addition on the part of a data provider. We also use
24: * this interface internally, so look in this plugin for examples.
25: *
26: * @author David Zwiers, Refractions Research
27: *
28: * @since 0.6
29: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/api/src/main/java/org/geotools/catalog/ServiceFactory.java $
30: */
31: public interface ServiceFactory {
32: /**
33: * Creates an IService based on the params provided. This may or may not
34: * return a singleton, caching is optional. Error messages can be
35: * retrieved using the getStatus and getMessage methods. It is important
36: * to note that this method must inspect the url to determine if it can be
37: * used to create the service. If it cannot, null must be returned.
38: *
39: * @param parent The catalog containing the service, may be null
40: * @param id The sugested service id, should be generated when null.
41: * @param params The set of connection params. These param values may
42: * either be parsed, or unparsed (String).
43: *
44: * @return the IService created, or null when a service cannot be created
45: * from these params.
46: *
47: * @see IService#getStatus()
48: * @see IService#getMessage()
49: */
50: Service createService(Catalog parent, URI id, Map params);
51:
52: /**
53: * Determines if the ServiceExtension can process the specified uri and use
54: * it to create a set of connection paramters.
55: *
56: * @param uri The uri representing the service.
57: *
58: * @return true if the uri can be processed, otherwise false.
59: */
60: boolean canProcess(URI uri);
61:
62: /**
63: * The primary intention is for drag 'n' drop. This generates a set of
64: * params for the given URL ... in most cases this will be passed to the
65: * createService method. It is important to note that this method must
66: * inspect the url to determine if it can be used to create the service.
67: * If it cannot, null must be returned.
68: *
69: * @param uri The potential source of params.
70: *
71: * @return Map of params to be used for creation, null if the URL cannot be
72: * used.
73: */
74: Map createParams(URI uri);
75: }
|