//load the stores for this workspace
for ( File sd : list(wsd, DirectoryFileFilter.INSTANCE) ) {
File f = new File( sd, "datastore.xml");
if ( f.exists() ) {
//load as a datastore
DataStoreInfo ds = null;
try {
ds = depersist( xp, f, DataStoreInfo.class );
catalog.add( ds );
LOGGER.info( "Loaded data store '" + ds.getName() +"'");
if (ds.isEnabled()) {
//connect to the datastore to determine if we should disable it
try {
ds.getDataStore(null);
}
catch( Throwable t ) {
LOGGER.warning( "Error connecting to '" + ds.getName() + "'. Disabling." );
LOGGER.log( Level.INFO, "", t );
ds.setError(t);
ds.setEnabled(false);
}
}
}
catch( Exception e ) {
LOGGER.log( Level.WARNING, "Failed to load data store '" + sd.getName() +"'", e);
continue;
}
//load feature types
for ( File ftd : list(sd,DirectoryFileFilter.INSTANCE) ) {
f = new File( ftd, "featuretype.xml" );
if( f.exists() ) {
FeatureTypeInfo ft = null;
try {
ft = depersist(xp,f,FeatureTypeInfo.class);
}
catch( Exception e ) {
LOGGER.log( Level.WARNING, "Failed to load feature type '" + ftd.getName() +"'", e);
continue;
}
catalog.add( ft );
LOGGER.info( "Loaded feature type '" + ds.getName() +"'");
f = new File( ftd, "layer.xml" );
if ( f.exists() ) {
try {
LayerInfo l = depersist(xp, f, LayerInfo.class );