Package org.geoserver.catalog

Examples of org.geoserver.catalog.DataStoreInfo


           hints.put( Hints.ASSOCIATION_TRAVERSAL_DEPTH , depth);
        }
       
        //walk through datastores finding one that is gmlobject aware
        for ( Iterator d = catalog.getDataStores().iterator(); d.hasNext(); ) {
            DataStoreInfo dsInfo = (DataStoreInfo) d.next();
            DataAccess<? extends FeatureType, ? extends Feature> ds;
            try {
                ds = dsInfo.getDataStore(null);
            }
            catch (IOException e) {
                throw new WFSException( e );
            }
           
View Full Code Here


                //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 );
View Full Code Here

        testAddWorkspace();
       
        File dir = new File( testData.getDataDirectoryRoot(), "workspaces/acme/foostore");
        assertFalse( dir.exists() );
       
        DataStoreInfo ds = catalog.getFactory().createDataStore();
        ds.setName( "foostore" );
        ds.setWorkspace( catalog.getWorkspaceByName( "acme" ) );
        catalog.add( ds );
       
        assertTrue( dir.exists() );
        assertTrue( new File( dir, "datastore.xml").exists() );
    }
View Full Code Here

            boolean refresh = false;

            List dataStores = catalog.getDataStores();

            for (Iterator i = dataStores.iterator(); i.hasNext();) {
                DataStoreInfo meta = (DataStoreInfo) i.next();
                DataStore dataStore = null;
               
                // TODO: support locking for DataAccess
                if (meta.isEnabled()) {
                    DataAccess da = meta.getDataStore(null);
                    if ( da instanceof DataStore ) {
                        dataStore = (DataStore) da;
                    }
                }
               
                if ( dataStore == null ) {
                    continue; // disabled or not a DataStore
                }

                LockingManager lockingManager = dataStore.getLockingManager();

                if (lockingManager == null) {
                    continue; // locks not supported
                }

                org.geotools.data.Transaction t = new DefaultTransaction("Refresh "
                        + meta.getWorkspace().getName());

                try {
                    t.addAuthorization(lockId);

                    if (lockingManager.release(lockId, t)) {
View Full Code Here

    }
   
    public void testModifyDataStore() throws Exception {
        testAddDataStore();
       
        DataStoreInfo ds = catalog.getDataStoreByName( "acme", "foostore" );
        assertTrue( ds.getConnectionParameters().isEmpty() );
       
        ds.getConnectionParameters().put( "foo", "bar" );
        catalog.save( ds );
       
        File f =
            new File( testData.getDataDirectoryRoot(), "workspaces/acme/foostore/datastore.xml");
        Document dom = dom( f );
View Full Code Here

       
        WorkspaceInfo nws = catalog.getFactory().createWorkspace();
        nws.setName( "topp");
        catalog.add( nws );
       
        DataStoreInfo ds = catalog.getDataStoreByName( "acme", "foostore" );
        ds.setWorkspace( nws );
        catalog.save( ds );
       
        assertFalse( f1.exists() );
        File f2 = new File( testData.getDataDirectoryRoot(), "workspaces/topp/foostore/datastore.xml");
        assertTrue( f2.exists() );
View Full Code Here

    public void releaseAll() throws WFSException {
        try {
            List dataStores = catalog.getDataStores();

            for (Iterator i = dataStores.iterator(); i.hasNext();) {
                DataStoreInfo meta = (DataStoreInfo) i.next();
                DataStore dataStore = null;
               
                // TODO: support locking for DataAccess
                if (meta.isEnabled()) {
                    DataAccess da = meta.getDataStore(null);
                    if ( da instanceof DataStore ) {
                        dataStore = (DataStore) da;
                    }
                }
               
View Full Code Here

        testAddDataStore();
       
        File f = new File( testData.getDataDirectoryRoot(), "workspaces/acme/foostore");
        assertTrue( f.exists() );
       
        DataStoreInfo ds = catalog.getDataStoreByName( "acme", "foostore");
        catalog.remove( ds );
        assertFalse( f.exists() );
    }
View Full Code Here

    public boolean exists(String lockId) throws WFSException {
        try {
            List dataStores = catalog.getDataStores();

            for (Iterator i = dataStores.iterator(); i.hasNext();) {
                DataStoreInfo meta = (DataStoreInfo) i.next();
                DataStore dataStore = null;
               
                // TODO: support locking for DataAccess
                if (meta.isEnabled()) {
                    DataAccess da = meta.getDataStore(null);
                    if ( da instanceof DataStore ) {
                        dataStore = (DataStore) da;
                    }
                }
               
View Full Code Here

            boolean refresh = false;

            List dataStores = catalog.getDataStores();

            for (Iterator i = dataStores.iterator(); i.hasNext();) {
                DataStoreInfo meta = (DataStoreInfo) i.next();
                DataStore dataStore = null;
               
                // TODO: support locking for DataAccess
                if (meta.isEnabled()) {
                    DataAccess da = meta.getDataStore(null);
                    if ( da instanceof DataStore ) {
                        dataStore = (DataStore) da;
                    }
                }
               
                if ( dataStore == null ) {
                    continue; // disabled or not a DataStore
                }
               
                LockingManager lockingManager = dataStore.getLockingManager();

                if (lockingManager == null) {
                    continue; // locks not supported
                }

                org.geotools.data.Transaction t = new DefaultTransaction("Refresh "
                        + meta.getWorkspace().getName());

                try {
                    t.addAuthorization(lockId);

                    if (lockingManager.refresh(lockId, t)) {
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.DataStoreInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.