net.refractions.udig.catalog
Interface ServiceExtension
- All Known Subinterfaces:
- ServiceExtension2
- All Known Implementing Classes:
- AbstractDataStoreServiceExtension, MemoryServiceExtensionImpl
public interface ServiceExtension
This is the required addition on the part of a data provider.
Example:
public class MyService implements ServiceExtension {
public Map createParams( URL url ) {
if( url.toString().endsWith(".my") ){
Map map = new HashMap();
map.put("url",url);
return map;
}
return null; // url must be for someone else
}
public IService createService( URL id, Map params ) {
if( params.get("url") == null ||
!params.get("url").toString().endsWith(".xml") ){
return null;
}
return new MyService( params );
}
}
We also use this interface internally, so look in this plugin for additional examples.
- Since:
- 0.6
- Author:
- David Zwiers, Refractions Research
Method Summary |
java.util.Map<java.lang.String,java.io.Serializable> |
createParams(java.net.URL url)
The primary intention is for drag 'n' drop. |
IService |
createService(java.net.URL id,
java.util.Map<java.lang.String,java.io.Serializable> params)
Creates an IService based on the params provided. |
EXTENSION_ID
static final java.lang.String EXTENSION_ID
- See Also:
- Constant Field Values
createService
IService createService(java.net.URL id,
java.util.Map<java.lang.String,java.io.Serializable> params)
- Creates an IService based on the params provided. This may or may not return a singleton,
caching is optional. Error messages can be retrieved using the getStatus and getMessage
methods. It is important to note that this method must inspect the url to determine if it can
be used to create the service. If it cannot, null must be returned.
- Parameters:
id
- The sugested service id, should be generated when null.params
- The set of connection params. These param values may either be parsed, or
unparsed (String).
- Returns:
- the IService created, or null when a service cannot be created from these params.
- See Also:
IResolve.getStatus()
,
IResolve.getMessage()
createParams
java.util.Map<java.lang.String,java.io.Serializable> createParams(java.net.URL url)
- The primary intention is for drag 'n' drop. This generates a set of params for the given URL
... in most cases this will be passed to the createService method. It is important to note
that this method must inspect the url to determine if it can be used to create the service.
If it cannot, null must be returned.
- Parameters:
url
- The potential source of params.
- Returns:
- Map of params to be used for creation,
null
if the URL cannot be used.