Package org.geoserver.catalog

Examples of org.geoserver.catalog.DataStoreInfo


    private synchronized int getLockCount() {
        int count = 0;

        for (Iterator i = getDataStores().iterator(); i.hasNext();) {
            DataStoreInfo meta = (DataStoreInfo) i.next();

            if (!meta.isEnabled()) {
                // Don't count locks from disabled datastores.
                continue;
            }

            try {
                DataAccess store = meta.getDataStore(null);
                if(store instanceof DataStore) {
                    LockingManager lockingManager = ((DataStore) store).getLockingManager();
                    if (lockingManager != null){
                        // we can't actually *count* locks right now?
                        // count += lockingManager.getLockSet().size();
View Full Code Here


    private synchronized int getConnectionCount() {
        int count = 0;

        for (Iterator i = getDataStores().iterator(); i.hasNext();) {
            DataStoreInfo meta = (DataStoreInfo) i.next();

            if (!meta.isEnabled()) {
                // Don't count connections from disabled datastores.
                continue;
            }

            try {
                meta.getDataStore(null);
            } catch (Throwable notAvailable) {
                // TODO: Logging.
                continue;
            }
View Full Code Here

       
        tester.assertLabel("form:panel:removedObjects:storesRemoved:stores", "cite");
       
        String layers = tester.getComponentFromLastRenderedPage("form:panel:removedObjects:layersRemoved:layers").getModelObjectAsString();
        String[] layerArray = layers.split(", ");
        DataStoreInfo citeStore = getCatalog().getStoreByName("cite", DataStoreInfo.class);
        List<FeatureTypeInfo> typeInfos = getCatalog().getResourcesByStore(citeStore, FeatureTypeInfo.class);
        assertEquals(typeInfos.size(), layerArray.length);
    }
View Full Code Here

        return new OneTimeTestSetup(new NewLayerPageTest());
    }
   
    public void testKnownStore() {
        login();
        DataStoreInfo store = getCatalog().getStoreByName(MockData.CDF_PREFIX, DataStoreInfo.class);
        tester.startPage(new NewLayerPage(store.getId()));
       
        tester.assertRenderedPage(NewLayerPage.class);
        assertNull(tester.getComponentFromLastRenderedPage("selector"));
        GeoServerTablePanel table = (GeoServerTablePanel) tester.getComponentFromLastRenderedPage(TABLE_PATH);
        assertEquals(getCatalog().getResourcesByStore(store, FeatureTypeInfo.class).size(), table.getDataProvider().size());
View Full Code Here

        assertNull(tester.getComponentFromLastRenderedPage("selectLayersContainer:selectLayers"));
    }
   
    public void testAddLayer() throws Exception {
        login();
        DataStoreInfo store = getCatalog().getStoreByName(MockData.CITE_PREFIX, DataStoreInfo.class);
        NewLayerPage page = new NewLayerPage(store.getId());
        tester.startPage(page);
       
        // get the name of the first layer in the list
        String[] names = ((DataStore) store.getDataStore(null)).getTypeNames();
        Arrays.sort(names);
       
        tester.clickLink(TABLE_PATH + ":listContainer:items:1:itemProperties:2:component:link", true);
        tester.assertRenderedPage(ResourceConfigurationPage.class);
        assertEquals(names[0], ((ResourceConfigurationPage) tester.getLastRenderedPage()).getResourceInfo().getName());
View Full Code Here

        endTransaction();
        startNewTransaction();

        // create a new store
        DataStoreInfo store = catalog.getFactory().createDataStore();
        store.setWorkspace(ws);
        store.setName("dataStore");
        store.setDescription("store description");
        store.setEnabled(true);

        store.getConnectionParameters().put("param1", "value1");
        store.getConnectionParameters().put("param2", new Integer(2));

        store.getMetadata().put("1", "one");
        store.getMetadata().put("2", "two");

        assertEquals("one", store.getMetadata().get("1"));

        catalog.add(store);

        assertEquals("one", store.getMetadata().get("1"));

        endTransaction();

        assertEquals("one", store.getMetadata().get("1"));

        startNewTransaction();
        Iterator<DataStoreInfo> stores = catalog.getDataStores().iterator();
        assertTrue("Datastore not properly stored.", stores.hasNext());

        store = catalog.getDataStore(store.getId());
        assertEquals("dataStore", store.getName());
        assertEquals("store description", store.getDescription());
        assertTrue(store.isEnabled());

        assertEquals("value1", store.getConnectionParameters().get("param1"));
        assertEquals(new Integer(2), store.getConnectionParameters().get("param2"));

        assertEquals("one", store.getMetadata().get("1"));
        assertEquals("two", store.getMetadata().get("2"));
    }
View Full Code Here

        endTransaction();
        startNewTransaction();

        // feature type needs a store
        DataStoreInfo dataStore = catalog.getFactory().createDataStore();
        dataStore.setEnabled(true);
        dataStore.setName("ds1");
        dataStore.setWorkspace(ws);
        catalog.add(dataStore);

        endTransaction();
        startNewTransaction();
View Full Code Here

        StyleInfo style = catalog.getFactory().createStyle();
        style.setName("style_testFeatureType");
        style.setFilename("style_testFeatureType");
        catalog.add(style);

        DataStoreInfo dataStore = catalog.getFactory().createDataStore();
        dataStore.setName("dataStore2");
        dataStore.setDescription("store description");
        dataStore.setEnabled(true);
        dataStore.setWorkspace(ws);
        catalog.add(dataStore);

        FeatureTypeInfo refFeatureType = catalog.getFactory().createFeatureType();
        refFeatureType.setName("featureType");
        refFeatureType.setNativeName("nativefeatureType");
View Full Code Here

       
        NodeList links = xp.getMatchingNodes("//html:a", dom );
        assertEquals( datastores.size(), links.getLength() );
       
        for ( int i = 0; i < datastores.size(); i++ ){
            DataStoreInfo ds = datastores.get( i );
            Element link = (Element) links.item( i );
           
            assertTrue( link.getAttribute("href").endsWith( ds.getName() + ".html") );
        }
    }
View Full Code Here

    }
   
    public void testGetAsHTML() throws Exception {
        Document dom = getAsDOM( "/rest/workspaces/sf/datastores/sf.html");
       
        DataStoreInfo ds = catalog.getDataStoreByName( "sf" );
        List<FeatureTypeInfo> featureTypes = catalog.getFeatureTypesByDataStore( ds );
       
        NodeList links = xp.getMatchingNodes("//html:a", dom );
        assertEquals( featureTypes.size(), links.getLength() );
       
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.