Package org.geoserver.catalog

Examples of org.geoserver.catalog.StoreInfo


    }

    @RequestMapping(value = "/{wsName}/{stName}/{name}", method = RequestMethod.GET)
    public @ResponseBody JSONObj resource(@PathVariable String wsName, @PathVariable String stName, @PathVariable String name, HttpServletRequest req) throws IOException {
        Catalog cat = geoServer.getCatalog();
        StoreInfo store = findStore(wsName, stName, cat );
        JSONObj obj = resource( new JSONObj(), store, name, req);
        obj.putObject("store")
            .put("name", stName )
            .put("url", IO.url(req, "/stores/%s/%s",wsName,stName));
        return obj;
View Full Code Here


    public @ResponseBody
    JSONObj delete(@PathVariable String wsName,
                   @PathVariable String name,
                   @RequestParam(value="recurse",defaultValue="false") boolean recurse,
                   HttpServletRequest req) {
        StoreInfo store = findStore(wsName, name, geoServer.getCatalog());
        Catalog cat = geoServer.getCatalog();
       
        List<ResourceInfo> layers = cat.getResourcesByStore(store, ResourceInfo.class );
        if( layers.isEmpty() ){
            cat.remove(store);
View Full Code Here

    JSONObj create(@PathVariable String wsName, @PathVariable String name, @RequestBody JSONObj obj, HttpServletRequest req) throws IOException {
        Catalog cat = geoServer.getCatalog();
        CatalogFactory factory = cat.getFactory();
       
        WorkspaceInfo workspace = findWorkspace(wsName);
        StoreInfo store = null;
       
        JSONObj params = obj.object("connection");
        if( params == null ){
            throw new IllegalArgumentException("connection parameters required");
        }
View Full Code Here

        return storeDetails(new JSONObj(), store,req);
    }
    @RequestMapping(value="/{wsName}/{name}", method = RequestMethod.PATCH)
    public @ResponseBody JSONObj patch(@PathVariable String wsName, @PathVariable String name, @RequestBody JSONObj obj, HttpServletRequest req) throws IOException {
        Catalog cat = geoServer.getCatalog();
        StoreInfo store = cat.getStoreByName(wsName, name, StoreInfo.class );
       
        boolean refresh = define(store, obj);
        cat.save(store);
        if (refresh) {
            resetConnection(store);
View Full Code Here

    }
   
    @RequestMapping(value="/{wsName}/{name}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody JSONObj put(@PathVariable String wsName, @PathVariable String name, @RequestBody JSONObj obj, HttpServletRequest req) throws IOException {
        Catalog cat = geoServer.getCatalog();
        StoreInfo store = cat.getStoreByName(wsName, name, StoreInfo.class );
       
        // pending: clear store to defaults
        boolean refresh = define( store, obj );
        cat.save( store );
        if (refresh) {
View Full Code Here

        @Override
        protected void postDoMarshal(Object result,
                HierarchicalStreamWriter writer, MarshallingContext context) {
           
            StoreInfo store = (StoreInfo) result;
            if ( store instanceof DataStoreInfo ) {
                callback.postEncodeDataStore( (DataStoreInfo) store, writer, context );
            } else if( store instanceof CoverageStoreInfo ){
                callback.postEncodeCoverageStore( (CoverageStoreInfo) store, writer, context );
            } else {
View Full Code Here

            }
           
        }
        public Object doUnmarshal(Object result,
                HierarchicalStreamReader reader, UnmarshallingContext context) {
            StoreInfo store = (StoreInfo) super.doUnmarshal(result, reader, context);
           
            LOGGER.info( "Loaded store '" +  store.getName() "', " + (store.isEnabled() ? "enabled" : "disabled") );
            return store;
        }
View Full Code Here

    /**
     * @see ResourceInfo#enabled()
     */
    public boolean enabled(){
        StoreInfo store = getStore();
        boolean storeEnabled = store != null && store.isEnabled();
        return storeEnabled && this.isEnabled();
    }
View Full Code Here

        selectLayers.setVisible(storeId != null);
        selectLayersContainer.add(selectLayers);
       
        selectLayers.add(storeName = new Label("storeName", new Model()));
        if(storeId != null) {
            StoreInfo store = getCatalog().getStore(storeId, StoreInfo.class);
            storeName.setDefaultModelObject(store.getName());
        }
       
        provider = new NewLayerPageProvider();
        provider.setStoreId(storeId);
        provider.setShowPublished(true);
        layers = new GeoServerTablePanel<Resource>("layers", provider) {

            @Override
            protected Component getComponentForProperty(String id,
                    IModel itemModel, Property<Resource> property) {
                if (property == NewLayerPageProvider.NAME) {
                    return new Label(id, property.getModel(itemModel));
                } else if (property == NewLayerPageProvider.PUBLISHED) {
                    final Resource resource = (Resource) itemModel.getObject();
                    final CatalogIconFactory icons = CatalogIconFactory.get();
                    if(resource.isPublished()) {
                        ResourceReference icon = icons.getEnabledIcon();
                        Fragment f = new Fragment(id, "iconFragment", NewLayerPage.this);
                        f.add(new Image("layerIcon", icon));
                        return f;
                    } else {
                        return new Label(id);
                    }
                } else if(property == NewLayerPageProvider.ACTION) {
                    final Resource resource = (Resource) itemModel.getObject();
                    if(resource.isPublished()) {
                        return resourceChooserLink(id, itemModel, new ParamResourceModel("publishAgain", this));
                    } else {
                        return resourceChooserLink(id, itemModel, new ParamResourceModel("publish", this));
                    }
                } else {
                    throw new IllegalArgumentException(
                            "Don't know of property " + property.getName());
                }
            }

        };
        layers.setFilterVisible(true);
       
        selectLayers.add(layers);
       
        createTypeContainer = new WebMarkupContainer("createTypeContainer");
        createTypeContainer.setVisible(false);
        createTypeContainer.add(newFeatureTypeLink());
        selectLayersContainer.add(createTypeContainer);
       
        createSQLViewContainer = new WebMarkupContainer("createSQLViewContainer");
        createSQLViewContainer.setVisible(false);
        createSQLViewContainer.add(newSQLViewLink());
        selectLayersContainer.add(createSQLViewContainer);
       
        createWMSLayerImportContainer = new WebMarkupContainer("createWMSLayerImportContainer");
        createWMSLayerImportContainer.setVisible(false);
        createWMSLayerImportContainer.add(newWMSImportLink());
        selectLayersContainer.add(createWMSLayerImportContainer);
       
        // case where the store is selected, or we have just created new one
        if(storeId != null) {
            StoreInfo store = getCatalog().getStore(storeId, StoreInfo.class);
            updateSpecialFunctionPanels(store);
        }
    }
View Full Code Here

        stores.add(new AjaxFormComponentUpdatingBehavior("onchange") {
           
            @Override
            protected void onUpdate(AjaxRequestTarget target) {
                if (stores.getModelObject() != null) {
                    StoreInfo store = (StoreInfo) stores.getModelObject();
                    NewLayerPage.this.storeId = store.getId();
                    provider.setStoreId(store.getId());
                    storeName.setDefaultModelObject(store.getName());
                    selectLayers.setVisible(true);

                    // make sure we can actually list the contents, it may happen
                    // the store is actually unreachable, in that case we
                    // want to display an error message
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.StoreInfo

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.