Package org.geoserver.catalog

Examples of org.geoserver.catalog.WorkspaceInfo


        namespaces.remove(getCatalog().getDefaultNamespace());
        NamespaceInfo newDefault = namespaces.get(0);
        getCatalog().setDefaultNamespace(newDefault);
       
        // check the default namespace changed accordingly
        WorkspaceInfo ws = getCatalog().getDefaultWorkspace();
        assertNotNull(ws);
        assertEquals(newDefault.getName(), ws.getName());
    }
View Full Code Here


        assertEquals(newDefault.getName(), ws.getName());
    }
   
    public void testChangeNamespaceURI() {
        // gran a workspace that has stores in it
        WorkspaceInfo ws = getCatalog().getStores(DataStoreInfo.class).get(0).getWorkspace();
        // alter the namespace uri
        NamespaceInfo ns = getCatalog().getNamespaceByPrefix(ws.getName());
        ns.setURI("http://www.geoserver.org/newNamespace");
        getCatalog().save(ns);
       
        List<DataStoreInfo> stores = getCatalog().getDataStoresByWorkspace(ws);
        assertTrue(stores.size() > 0);
View Full Code Here

        tester.assertRenderedPage(WorkspacePage.class);
        tester.assertNoErrorMessage();
       
        DataView dv = (DataView) tester.getComponentFromLastRenderedPage("table:listContainer:items");
        assertEquals(dv.size(), getCatalog().getWorkspaces().size());
        WorkspaceInfo ws = (WorkspaceInfo) dv.getDataProvider().iterator(0, 1).next();
        assertEquals("cdf", ws.getName());
    }
View Full Code Here

     * Uses a "name" parameter to locate the workspace
     * @param parameters
     */
    public WorkspaceEditPage(PageParameters parameters) {
        String wsName = parameters.getString("name");
        WorkspaceInfo wsi = getCatalog().getWorkspaceByName(wsName);
       
        if(wsi == null) {
            error(new ParamResourceModel("WorkspaceEditPage.notFound", this, wsName).getString());
            setResponsePage(WorkspacePage.class);
            return;
View Full Code Here

    private void saveWorkspace() {
        final Catalog catalog = getCatalog();

        NamespaceInfo namespaceInfo = (NamespaceInfo) nsModel.getObject();
        WorkspaceInfo workspaceInfo = (WorkspaceInfo) wsModel.getObject();
       
        // sync up workspace name with namespace prefix, temp measure until the two become separate
        namespaceInfo.setPrefix(workspaceInfo.getName());
       
        // this will ensure all datastore namespaces are updated when the workspace is modified
        catalog.save(workspaceInfo);
        catalog.save(namespaceInfo);
        if(defaultWs) {
View Full Code Here

    Form form;
    TextField nsUriTextField;
    boolean defaultWs;
   
    public WorkspaceNewPage() {
        WorkspaceInfo ws = getCatalog().getFactory().createWorkspace();
       
        form = new Form( "form", new CompoundPropertyModel( ws ) ) {
            @Override
            protected void onSubmit() {
                Catalog catalog = getCatalog();
               
                WorkspaceInfo ws = (WorkspaceInfo) form.getModelObject();
               
                NamespaceInfo ns = catalog.getFactory().createNamespace();
                ns.setPrefix ( ws.getName() );
                ns.setURI(nsUriTextField.getModelObjectAsString());
               
                catalog.add( ws );
                catalog.add( ns );
                if(defaultWs)
View Full Code Here

        Catalog cat = geoServer.getCatalog();
        verify(cat, times(1)).save(isA(NamespaceInfo.class));
        verify(cat, times(1)).save(isA(NamespaceInfo.class));

        WorkspaceInfo ws = cat.getWorkspaceByName("foo");
        verify(ws, times(1)).setName("blah");
    }
View Full Code Here

    public <T extends Info> void add(Class<T> clazz, T obj) {
        if (!OwsUtils.has(obj, "workspace")) {
            throw new IllegalArgumentException("Object has no workspace property, use add(Class,T,String) method");
        }

        WorkspaceInfo ws = (WorkspaceInfo) OwsUtils.get(obj, "workspace");
        add(clazz, obj, ws!=null?ws.getName():null);
    }
View Full Code Here

    protected Integer offset(Integer page, Integer count) {
        return page != null ? page * (count != null ? count : DEFAULT_PAGESIZE) : null;
    }

    protected WorkspaceInfo findWorkspace(String wsName, Catalog cat) {
        WorkspaceInfo ws = cat.getWorkspaceByName(wsName);
        if (ws == null) {
            throw new NotFoundException(String.format("No such workspace %s", wsName));
        }
        return ws;
    }
View Full Code Here

    }
   
    @RequestMapping(value = "/{wsName}", method = RequestMethod.GET)
    public @ResponseBody JSONArr list(@PathVariable String wsName, HttpServletRequest request) throws IOException {

        WorkspaceInfo ws = findWorkspace(wsName, catalog());

        JSONArr arr = new JSONArr();

        Resource styles =  dataDir().get(ws, "styles");
        if (styles.getType() != Type.UNDEFINED) {
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.WorkspaceInfo

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.