Package org.geoserver.catalog

Examples of org.geoserver.catalog.Catalog


                };
            }
           
            protected boolean onSubmit(AjaxRequestTarget target, Component contents) {
                // cascade delete the whole selection
                Catalog catalog = GeoServerApplication.get().getCatalog();
                CascadeDeleteVisitor visitor = new CascadeDeleteVisitor(catalog);
                DataAccessRuleDAO dao = DataAccessRuleDAO.get();
                for (DataAccessRule rule : selection) {
                    dao.removeRule(rule);  
                }
View Full Code Here


       
        // track objects that could not be removed
        Map<CatalogInfo, StringResourceModel> notRemoved = new HashMap();
       
        // collect the objects that will be removed (besides the roots)
        Catalog catalog = GeoServerApplication.get().getCatalog();
        CascadeRemovalReporter visitor = new CascadeRemovalReporter(catalog);
        for (Iterator<CatalogInfo> i = (Iterator<CatalogInfo>) roots.iterator(); i.hasNext();) {
            CatalogInfo root = i.next();
            StringResourceModel reason = canRemove(root);
            if ( reason != null ) {
View Full Code Here

     *
     * @param dataStoreInfoId
     *            the datastore id to modify, as per {@link DataStoreInfo#getId()}
     */
    public DataAccessEditPage(final String dataStoreInfoId) throws IllegalArgumentException {
        final Catalog catalog = getCatalog();
        final DataStoreInfo dataStoreInfo = catalog.getDataStore(dataStoreInfoId);

        if (null == dataStoreInfo) {
            throw new IllegalArgumentException("DataStore " + dataStoreInfoId + " not found");
        }

View Full Code Here

     * @see AbstractDataAccessPage#onSaveDataStore(Form)
     */
    protected final void onSaveDataStore(final DataStoreInfo info,
            final AjaxRequestTarget requestTarget) {

        final Catalog catalog = getCatalog();
        final ResourcePool resourcePool = catalog.getResourcePool();
        resourcePool.clear(info);

        if (info.isEnabled()) {
            // store's enabled, check availability
            DataAccess<? extends FeatureType, ? extends Feature> dataStore;
            try {
                dataStore = catalog.getResourcePool().getDataStore(info);
                LOGGER.finer("connection parameters verified for store " + info.getName()
                        + ". Got a " + dataStore.getClass().getName());
                doSaveStore(info);
                setResponsePage(StorePage.class);
            } catch (IOException e) {
View Full Code Here

        });
    }

    private void doSaveStore(final DataStoreInfo info) {
        try {
            final Catalog catalog = getCatalog();

            // The namespace may have changed, in which case we need to update the store resources
            NamespaceInfo namespace = catalog.getNamespaceByPrefix(info.getWorkspace().getName());
            List<FeatureTypeInfo> configuredResources = catalog.getResourcesByStore(info,
                    FeatureTypeInfo.class);
            for (FeatureTypeInfo alreadyConfigured : configuredResources) {
                alreadyConfigured.setNamespace(namespace);
            }

            ResourcePool resourcePool = catalog.getResourcePool();
            resourcePool.clear(info);
            catalog.save(info);
            // save the resources after saving the store
            for (FeatureTypeInfo alreadyConfigured : configuredResources) {
                catalog.save(alreadyConfigured);
            }
            LOGGER.finer("Saved store " + info.getName());
        } catch (Exception e) {
            LOGGER.log(Level.WARNING, "Error saving data store to catalog", e);
            throw new IllegalArgumentException("Error saving data store:" + e.getMessage());
View Full Code Here

    public void testSimple() throws Exception {
        new CatalogCreator(cat).workspace("foo")
            .property("bar")
            .featureType("stuff", "geom:Point:srid=4326,name:String,id:Integer", stuff()).layer();

        Catalog cat2 = createCatalog();
        new CatalogCreator(cat2).workspace("bam");

        doImport(doExport("foo"), "bam", cat2);

        LayerInfo stuff = cat2.getLayerByName("bam:stuff");
        assertNotNull(stuff);

        assertNotNull(stuff.getDefaultStyle());
        assertNotNull(stuff.getResource());
View Full Code Here

                .property("bar")
                .featureType("stuff", "geom:Point:srid=4326,name:String,id:Integer", stuff())
                    .layer()
                    .style(false);

        Catalog cat2 = createCatalog();
        new CatalogCreator(cat2).workspace("bam");

        doImport(doExport("foo"), "bam", cat2);

        LayerInfo stuff = cat2.getLayerByName("bam:stuff");
        assertNotNull(stuff);

        assertNotNull(stuff.getDefaultStyle());
        assertEquals(1, stuff.getStyles().size());
View Full Code Here

        List<LayerBuilder> layers = new ArrayList<LayerBuilder>();
        List<MapBuilder> maps = new ArrayList<MapBuilder>();

        public WorkspaceBuilder(String name, String uri, boolean isDefault, CatalogBuilder catalogBuilder) {
            this.catalogBuilder = catalogBuilder;
            Catalog cat = catalogBuilder.catalog;

            workspace = mock(WorkspaceInfo.class);
            when(workspace.getName()).thenReturn(name);

            namespace = mock(NamespaceInfo.class);
            when(namespace.getName()).thenReturn(name);
            when(namespace.getPrefix()).thenReturn(name);
            when(namespace.getURI()).thenReturn(uri);

            when(cat.getWorkspaceByName(name)).thenReturn(workspace);
            when(cat.getNamespaceByPrefix(name)).thenReturn(namespace);
            when(cat.getNamespaceByURI(uri)).thenReturn(namespace);

            if (isDefault) {
                when(cat.getDefaultWorkspace()).thenReturn(workspace);
                when(cat.getDefaultNamespace()).thenReturn(namespace);
            }
        }
View Full Code Here

            MetadataMap meta = new MetadataMap();
            meta.put(Metadata.CREATED, new Date());
            meta.put(Metadata.MODIFIED, new Date());
            when(map.getMetadata()).thenReturn(meta);

            Catalog catalog = workspaceBuilder.catalogBuilder.catalog;
            when(catalog.getLayerGroup(id)).thenReturn(map);
            when(catalog.getLayerGroupByName(name)).thenReturn(map);
            when(catalog.getLayerGroupByName(wsName, name)).thenReturn(map);
        }
View Full Code Here

        WorkspaceCreator(String name, CatalogCreator parent) {
            super(parent.catalog);

            this.parent = parent;

            Catalog cat = parent.catalog;

            workspace = cat.getFactory().createWorkspace();
            workspace.setName(name);

            namespace = cat.getFactory().createNamespace();
            namespace.setPrefix(name);
            namespace.setURI("http://"+name+".org");

            cat.add(workspace);
            cat.add(namespace);
        }
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.Catalog

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.