Package org.geoserver.catalog

Examples of org.geoserver.catalog.CatalogInfo


            this.id = id;
        }

        @Override
        public CatalogInfo call() throws Exception {
            CatalogInfo info;
            try {
                String sql = "select blob from object where id = :id";
                Map<String, String> params = ImmutableMap.of("id", id);
                logStatement(sql, params);
                info = template.queryForObject(sql, params, catalogRowMapper);
View Full Code Here


        setModel(tileLayerModel);

        final GWC mediator = GWC.get();
        final IModel<String> createTileLayerLabelModel;

        final CatalogInfo info = layerModel.getObject();
        final GeoServerTileLayerInfo tileLayerInfo = tileLayerModel.getObject();

        if (info instanceof LayerInfo) {
            createTileLayerLabelModel = new ResourceModel("createTileLayerForLayer");
            ResourceInfo resource = ((LayerInfo) info).getResource();
View Full Code Here

    }

    public void save() {
        final GWC gwc = GWC.get();

        final CatalogInfo layer = layerModel.getObject();
        final GeoServerTileLayerInfo tileLayerInfo = getModelObject();
        final boolean tileLayerExists = gwc.hasTileLayer(layer);
        final boolean createLayer = this.createLayer.getModelObject().booleanValue();

        if (!createLayer) {
            if (tileLayerExists) {
                String tileLayerName = tileLayerInfo.getName();
                gwc.removeTileLayers(Arrays.asList(tileLayerName));
            }
            return;
        }

        // if we're creating a new layer, at this point the layer has already been created and hence
        // has an id
        Preconditions.checkState(layer.getId() != null);
        tileLayerInfo.setId(layer.getId());

        final String name;
        final GridSetBroker gridsets = gwc.getGridSetBroker();
        GeoServerTileLayer tileLayer;
        if (layer instanceof LayerGroupInfo) {
View Full Code Here

       
        // 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 ) {
                notRemoved.put(root, reason);
                i.remove();
            }
            else {
                root.accept(visitor);
            }
        }
        visitor.removeAll(roots);
       
        // add roots
        WebMarkupContainer root = new WebMarkupContainer("rootObjects");
        root.add(new Label("rootObjectNames", names(roots)));
        root.setVisible( !roots.isEmpty() );
        add(root);
       
        // objects that could not be removed
        WebMarkupContainer nr = new WebMarkupContainer("notRemovedObjects");
        nr.setVisible( !notRemoved.isEmpty() );
        nr.add( notRemovedList(notRemoved));
        add(nr);
       
        // removed objects root (we show it if any removed object is on the list)
        WebMarkupContainer removed = new WebMarkupContainer("removedObjects");
        List<CatalogInfo> cascaded = visitor.getObjects(CatalogInfo.class, DELETE);
        // remove the resources, they are cascaded, but won't be show in the UI
        for (Iterator it = cascaded.iterator(); it.hasNext();) {
            CatalogInfo catalogInfo = (CatalogInfo) it.next();
            if(catalogInfo instanceof ResourceInfo)
                it.remove();
        }
        removed.setVisible(cascaded.size() > 0);
        add(removed);
View Full Code Here

        List<CatalogInfo> items = new ArrayList(notRemoved.keySet());
        ListView lv = new ListView("notRemovedList", items) {
           
            @Override
            protected void populateItem(ListItem item) {
                CatalogInfo object = (CatalogInfo) item.getModelObject();
                StringResourceModel reason = notRemoved.get(object);
                item.add( new Label( "name", name(object) ) );
                item.add( new Label( "reason", reason));
            }
        };
View Full Code Here

    protected void beforeSaved(CatalogInfo object) {
        // this object is a proxy
        ModificationProxy h = (ModificationProxy) Proxy.getInvocationHandler(object);

        // get the real object
        CatalogInfo real = (CatalogInfo) h.getProxyObject();

        // fire out what changed
        List propertyNames = h.getPropertyNames();
        List newValues = h.getNewValues();
        List oldValues = h.getOldValues();
View Full Code Here

       
        return real;
    }
   
    protected void afterSaved(CatalogInfo object) {
        CatalogInfo real = ModificationProxy.unwrap(object);

        // fire the post modify event
        getCatalog().firePostModified(real);
    }
View Full Code Here

        final int numCopies = duplicateCount.getModelObject();
        final String s = sufix.getModelObject();

        LayerInfo layer = null;

        CatalogInfo original;
        {
            Tuple modelObject = resourceAndLayer.getModelObject();
            if (modelObject != null) {
                original = getCatalog().getResource(modelObject.id, ResourceInfo.class);
                List<LayerInfo> layers = getCatalog().getLayers((ResourceInfo) original);
View Full Code Here

    private void copyOne(Catalog catalog, final CatalogInfo original,
            final Class<CatalogInfo> clazz, final LayerInfo layer, final String nameSuffix,
            final Stopwatch sw) {

        CatalogInfo prototype = prototype(original, catalog);

        try {
            OwsUtils.set(prototype, "id", null);
            OwsUtils.copy(clazz.cast(original), clazz.cast(prototype), clazz);
            final String newName = OwsUtils.get(prototype, "name") + nameSuffix;
            OwsUtils.set(prototype, "name", newName);
            if (prototype instanceof WorkspaceInfo) {

                sw.start();
                catalog.add((WorkspaceInfo) prototype);
                sw.stop();

                String originalWsName = ((WorkspaceInfo) original).getName();
                NamespaceInfo ns = catalog.getNamespaceByPrefix(originalWsName);
                NamespaceInfoImpl ns2 = new NamespaceInfoImpl();
                ns2.setPrefix(newName);
                ns2.setURI(ns.getURI() + newName);
                sw.start();
                catalog.add(ns2);
                sw.stop();

            } else if (prototype instanceof StoreInfo) {

                sw.start();
                catalog.add((StoreInfo) prototype);
                sw.stop();

            } else if (prototype instanceof ResourceInfo) {
                ((ResourceInfo) prototype).setNativeName(((ResourceInfo) original).getNativeName());
                ((ResourceInfo) prototype).setName(newName);
                sw.start();
                catalog.add((ResourceInfo) prototype);
                sw.stop();

                String id = prototype.getId();
                // prototype = catalog.getResource(id, ResourceInfo.class);

                if (layer == null) {
                    return;
                }
View Full Code Here

            throw new RuntimeException(e.getMessage(), e);
        }
    }

    private CatalogInfo prototype(CatalogInfo original, Catalog catalog) {
        CatalogInfo prototype;
        if (original instanceof WorkspaceInfo) {
            prototype = new WorkspaceInfoImpl();
        } else if (original instanceof DataStoreInfo) {
            prototype = new DataStoreInfoImpl(catalog);
        } else if (original instanceof CoverageStoreInfo) {
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.CatalogInfo

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.