Package org.geoserver.catalog

Examples of org.geoserver.catalog.NamespaceInfo


    public void testUpdatesDataStoresNamespace() {
        final Catalog catalog = getCatalog();
        final List<DataStoreInfo> storesInitial = catalog.getStoresByWorkspace(citeWorkspace,
                DataStoreInfo.class);

        final NamespaceInfo citeNamespace = catalog.getNamespaceByPrefix(citeWorkspace.getName());

        for (DataStoreInfo store : storesInitial) {
            assertEquals(citeNamespace.getURI(), store.getConnectionParameters().get("namespace"));
        }

        FormTester form = tester.newFormTester("form");
        final String newNsURI = "http://www.geoserver.org/changed";
        form.setValue("uri", newNsURI);
View Full Code Here


    private void init(WorkspaceInfo ws) {
        defaultWs = ws.getId().equals(getCatalog().getDefaultWorkspace().getId());
       
        wsModel = new WorkspaceDetachableModel( ws );

        NamespaceInfo ns = getCatalog().getNamespaceByPrefix( ws.getName() );
        nsModel = new NamespaceDetachableModel(ns);
       
        Form form = new Form( "form", new CompoundPropertyModel( nsModel ) ) {
            protected void onSubmit() {
                try {
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

    /**
     * @see IChoiceRenderer#getDisplayValue(Object)
     */
    public Object getDisplayValue(Object object) {
        NamespaceInfo nsInfo = (NamespaceInfo) object;
        String displayValue = nsInfo.getPrefix() + ": <" + nsInfo.getURI() + ">";
        return displayValue;
    }
View Full Code Here

            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)
                    catalog.setDefaultWorkspace(ws);
View Full Code Here

        }

        @Override
        public Object getObject() {
            String nsUri = (String) super.getObject();
            NamespaceInfo namespaceInfo = getCatalog().getNamespaceByURI(nsUri);
            return namespaceInfo;
        }
View Full Code Here

            return namespaceInfo;
        }

        @Override
        public void setObject(Object object) {
            NamespaceInfo namespaceInfo = (NamespaceInfo) object;
            String nsUri = namespaceInfo.getURI();
            super.setObject(nsUri);
        }
View Full Code Here

     */
    protected QName resolveLayerName(String typename){
        int i = typename.indexOf(":");
        String prefix = typename.substring(0, i);
        String name = typename.substring(i + 1);
        NamespaceInfo ns = getCatalog().getNamespaceByPrefix(prefix);
        QName qname = new QName(ns.getURI(), name, ns.getPrefix());
        return qname;
    }
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);
            }
View Full Code Here

 
 
  /** {@inheritDoc} */
  public String getNamespacePrefix( String namespaceUri )
  {
    NamespaceInfo namespaceInfo = this.catalog.getNamespaceByURI( namespaceUri );
    if (namespaceInfo == null)
    {
      return null;
    }
    else
    {
      return namespaceInfo.getPrefix();
    }
  }
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.NamespaceInfo

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.