dataStores = catalog.getStores( DataStoreInfo.class ); The methods {@link #getDataStores()} and {@link #getCoverageStores()} providea convenience for the two well known types. A store is contained within a workspace (see {@link StoreInfo#getWorkspace()}). The {@link #getStoresByWorkspace(WorkspaceInfo,Class)} method for only stores contained with a specific workspace. For instance, the following would obtain all datastores store within a particular workspace:
//get a workspace WorkspaceInfo workspace = catalog.getWorkspace( "myWorkspace" ); //get all datastores in that workspace List dataStores = catalog.getStoresByWorkspace( workspace, DataStoreInfo.class );
Resources
The {@link #getResources(Class)} method provides access to all resources in the catalog of a particular type. For instance, to acess all feature types in the catalog:
List featureTypes = catalog.getResources( FeatureTypeInfo.class );
The {@link #getFeatureTypes()} and {@link #getCoverages()} methods are a conveniencefor the well known types. A resource is contained within a namespace, therefore it is identified by a namespace uri, local name pair. The {@link #getResourceByName(String,String,Class)} method provides access to a resource by its namespace qualified name. The method {@link #getResourceByName(String,Class)} provides access to a resource by its unqualified name. The latter method will do an exhaustive search of all namespaces for a resource with the specified name. If only a single resoure with the name is found it is returned. Some examples:
//get a feature type by its qualified name FeatureTypeInfo ft = catalog.getResourceByName( "http://myNamespace.org", "myFeatureType", FeatureTypeInfo.class ); //get a feature type by its unqualified name ft = catalog.getResourceByName( "myFeatureType", FeatureTypeInfo.class ); //get all feature types in a namespace NamespaceInfo ns = catalog.getNamespaceByURI( "http://myNamespace.org" ); List featureTypes = catalog.getResourcesByNamespace( ns, FeatureTypeINfo.class );
Layers
A layers is used to publish a resource. The {@link #getLayers()} provides access to all layers in the catalog. A layer is uniquely identified by its name. The {@link #getLayerByName(String)} method provides access to a layer by its name.The {@link #getLayers(ResourceInfo)} return all the layers publish a specific resource. Some examples:
//get a layer by its name LayerInfo layer = catalog.getLayer( "myLayer" ); //get all the layers for a particualr feature type FeatureTypeInfo ft = catalog.getFeatureType( "http://myNamespace", "myFeatureType" ); List layers = catalog.getLayers( ft );
Modifing the Catalog
Catalog objects such as stores and resoures are mutable and can be modified. However, any modifications made on an object do not apply until they are saved. For instance, consider the following example of modifying a feature type:
//get a feature type FeatureTypeInfo featureType = catalog.getFeatureType( "http://myNamespace.org", "myFeatureType" ); //modify it featureType.setBoundingBox( new Envelope(...) ); //save it catalog.save( featureType );
@author Justin Deoliveira, The Open Planning project