Package org.geoserver.catalog

Examples of org.geoserver.catalog.WMSStoreInfo


  public static WMSStoreInfo localizeWMSStore(final WMSStoreInfo info,
      final Catalog catalog) throws IllegalAccessException, InvocationTargetException {
    if (info==null || catalog==null)
      throw new NullArgumentException("Arguments may never be null");
   
    final WMSStoreInfo localObject=catalog.getStoreByName(info.getWorkspace(), info.getName(), WMSStoreInfo.class);
   
    final CatalogBuilder builder = new CatalogBuilder(catalog);
   
    if (localObject !=null){
      return localObject;
    }
   
    final WMSStoreInfo createdObject = catalog.getFactory().createWebMapServer();

    // let's using the created object (see getGridCoverageReader)
    BeanUtils.copyProperties(createdObject, info);

    createdObject.setWorkspace(localizeWorkspace(info.getWorkspace(), catalog));
   
    builder.attach(createdObject);
    return createdObject;
  }
View Full Code Here


   
    @Override
    protected String handleObjectPost(Object object) throws Exception {
        String workspace = getAttribute( "workspace" );

        WMSStoreInfo wms = (WMSStoreInfo) object;
        if ( wms.getWorkspace() != null ) {
             //ensure the specifried workspace matches the one dictated by the uri
             WorkspaceInfo ws = (WorkspaceInfo) wms.getWorkspace();
             if ( !workspace.equals( ws.getName() ) ) {
                 throw new RestletException( "Expected workspace " + workspace +
                     " but client specified " + ws.getName(), Status.CLIENT_ERROR_FORBIDDEN );
             }
        } else {
             wms.setWorkspace( catalog.getWorkspaceByName( workspace ) );
        }
        wms.setEnabled(true);
       
        catalog.validate(wms, false).throwIfInvalid();
        catalog.add( wms );
       
        LOGGER.info( "POST WSM store " + wms.getName() );
        return wms.getName();
    }
View Full Code Here

    @Override
    protected void handleObjectPut(Object object) throws Exception {
        String workspace = getAttribute("workspace");
        String wmsstore = getAttribute("wmsstore");
       
        WMSStoreInfo wms = (WMSStoreInfo) object;
        WMSStoreInfo original = catalog.getStoreByName(workspace, wmsstore, WMSStoreInfo.class);
       
        //ensure this is not a name or workspace change
        if ( wms.getName() != null && !wms.getName().equals( original.getName() ) ) {
            throw new RestletException( "Can't change name of data store.", Status.CLIENT_ERROR_FORBIDDEN );
        }
        if ( wms.getWorkspace() != null && !wms.getWorkspace().equals( original.getWorkspace() ) ) {
            throw new RestletException( "Can't change workspace of data store.", Status.CLIENT_ERROR_FORBIDDEN );
        }
       
        new CatalogBuilder( catalog ).updateWMSStore( original, wms );
       
View Full Code Here

    protected void handleObjectDelete() throws Exception {
        String workspace = getAttribute("workspace");
        String wmsstore = getAttribute("wmsstore");
        boolean recurse = getQueryStringValue("recurse", Boolean.class, false);
       
        WMSStoreInfo wms = catalog.getStoreByName(workspace, wmsstore, WMSStoreInfo.class);
        if (!recurse) {
            if ( !catalog.getResourcesByStore(wms, WMSLayerInfo.class).isEmpty() ) {
                throw new RestletException( "store not empty", Status.CLIENT_ERROR_FORBIDDEN);
            }
            catalog.remove( wms );
View Full Code Here

   
    @Override
    protected String handleObjectPost(Object object) throws Exception {
        String workspace = getAttribute( "workspace" );

        WMSStoreInfo wms = (WMSStoreInfo) object;
        if ( wms.getWorkspace() != null ) {
             //ensure the specifried workspace matches the one dictated by the uri
             WorkspaceInfo ws = (WorkspaceInfo) wms.getWorkspace();
             if ( !workspace.equals( ws.getName() ) ) {
                 throw new RestletException( "Expected workspace " + workspace +
                     " but client specified " + ws.getName(), Status.CLIENT_ERROR_FORBIDDEN );
             }
        } else {
             wms.setWorkspace( catalog.getWorkspaceByName( workspace ) );
        }
        wms.setEnabled(true);

        catalog.add( wms );
       
        LOGGER.info( "POST WSM store " + wms.getName() );
        return wms.getName();
    }
View Full Code Here

    @Override
    protected void handleObjectPut(Object object) throws Exception {
        String workspace = getAttribute("workspace");
        String wmsstore = getAttribute("wmsstore");
       
        WMSStoreInfo wms = (WMSStoreInfo) object;
        WMSStoreInfo original = catalog.getStoreByName(workspace, wmsstore, WMSStoreInfo.class);
       
        //ensure this is not a name or workspace change
        if ( wms.getName() != null && !wms.getName().equals( original.getName() ) ) {
            throw new RestletException( "Can't change name of data store.", Status.CLIENT_ERROR_FORBIDDEN );
        }
        if ( wms.getWorkspace() != null && !wms.getWorkspace().equals( original.getWorkspace() ) ) {
            throw new RestletException( "Can't change workspace of data store.", Status.CLIENT_ERROR_FORBIDDEN );
        }
       
        new CatalogBuilder( catalog ).updateWMSStore( original, wms );
       
View Full Code Here

    protected void handleObjectDelete() throws Exception {
        String workspace = getAttribute("workspace");
        String wmsstore = getAttribute("wmsstore");
        boolean recurse = getQueryStringValue("recurse", Boolean.class, false);
       
        WMSStoreInfo wms = catalog.getStoreByName(workspace, wmsstore, WMSStoreInfo.class);
        if (!recurse) {
            if ( !catalog.getResourcesByStore(wms, WMSLayerInfo.class).isEmpty() ) {
                throw new RestletException( "store not empty", Status.CLIENT_ERROR_FORBIDDEN);
            }
            catalog.remove( wms );
View Full Code Here

            throw new RestletException( "", Status.CLIENT_ERROR_NOT_FOUND );
        }

        LOGGER.fine( "GET wms layer " + wmsstore + "," + wmslayer );
        WMSStoreInfo wms = catalog.getStoreByName(workspace, wmsstore, WMSStoreInfo.class);
        return catalog.getResourceByStore( wms, wmslayer, WMSLayerInfo.class );
    }
View Full Code Here

        String wmsstore = getAttribute( "wmsstore");

        WMSLayerInfo wml = (WMSLayerInfo) object;
        
        //ensure the store matches up
        WMSStoreInfo wms = catalog.getStoreByName( workspace, wmsstore, WMSStoreInfo.class);
        if ( wml.getStore() != null ) {
            if ( !wmsstore.equals( wml.getStore().getName() ) ) {
                throw new RestletException( "Expected wms store " + wmsstore +
                " but client specified " + wml.getStore().getName(), Status.CLIENT_ERROR_FORBIDDEN );
            }
View Full Code Here

       
        String workspace = getAttribute("workspace");
        String wmsstore = getAttribute("wmsstore");
        String wmslayer = getAttribute("wmslayer");
       
        WMSStoreInfo wms = catalog.getStoreByName(workspace, wmsstore, WMSStoreInfo.class);
        WMSLayerInfo original = catalog.getResourceByStore( wms,  wmslayer, WMSLayerInfo.class );
        new CatalogBuilder(catalog).updateWMSLayer(original,wml);
        catalog.save( original );
       
        LOGGER.info( "PUT wms layer " + wmsstore + "," + wmslayer );
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.WMSStoreInfo

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.