/* * Required adaptions: <ul> <li>IGeoResourceInfo.class <li>IService.class * </ul> * * @see net.refractions.udig.catalog.IResolve#resolve(java.lang.Class, * org.eclipse.core.runtime.IProgressMonitor) */ public <T> T resolve(Class<T> adaptee, IProgressMonitor monitor) throws IOException { if (adaptee == null) return null; if (adaptee.isAssignableFrom(IGeoResourceInfo.class)) { return adaptee.cast(createInfo(monitor)); } if (adaptee.isAssignableFrom(IGeoResource.class)) { return adaptee.cast(this); } JDBCDataStore dataStore = parent.getDataStore(); if (adaptee.isAssignableFrom(DataStore.class)) { return adaptee.cast(dataStore); } if (adaptee.isAssignableFrom(SimpleFeatureStore.class)) { FeatureSource<SimpleFeatureType, SimpleFeature> fs = dataStore.getFeatureSource(typename); if (fs instanceof FeatureStore) { readOnly = false; return adaptee.cast(fs); } else { readOnly = true; } if (adaptee.isAssignableFrom(SimpleFeatureSource.class)) { return adaptee.cast(dataStore.getFeatureSource(typename)); } } if (adaptee.isAssignableFrom(Connection.class)) { return service.resolve(adaptee, monitor); } return super.resolve(adaptee, monitor); }
public TeradataGeoResource(TeradataService service, TableDescriptor desc) { this.service = this.parent = service; this.desc = desc; this.typename = desc.name; try { URL identifier2 = service.getIdentifier(); identifier = new URL( identifier2, identifier2.toExternalForm() + "#" + typename, CorePlugin.RELAXED_HANDLER); } catch (MalformedURLException e) { throw new IllegalArgumentException("The service URL must not contain a #", e); } }
/** * returns the schema of the GeoResource * * @return the schema of the GeoResource * @throws IOException */ public SimpleFeatureType getSchema() throws IOException { return parent.getDataStore().getSchema(typename); }