if( !services.isEmpty() ){
return true;
}
ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
List<IService> availableServices;
monitor.beginTask(Messages.ConnectionState_task, IProgressMonitor.UNKNOWN);
errors = null;
try {
// use the context object to try to build connection info
Object context = getWorkflow().getContext();
if( context instanceof IService ){
services.add((IService)context);
//services = Collections.singleton((IService)context);
}else if (context instanceof IGeoResource){
IService service = ((IGeoResource) context).service(monitor);
services.add((IService)context);
services.add(service);
}else{
Map<String, Serializable> params = factory.createConnectionParameters(context);
URL url = factory.createConnectionURL(context);
if (params == null && url == null)
return false; // could not build connection info
if(url != null){
availableServices = catalog.constructServices(url, monitor);
if(!availableServices.isEmpty()){
services.add(availableServices.iterator().next());
return true;
}
}
if(params != null && !params.isEmpty()){
availableServices = catalog.constructServices(params, monitor);
if(!availableServices.isEmpty()){
services.add(availableServices.iterator().next());
}
}
}