Package org.geoserver.config.util

Examples of org.geoserver.config.util.XStreamServiceLoader


    @Override
    public void handleServiceChange(ServiceInfo service, List<String> propertyNames,
            List<Object> oldValues, List<Object> newValues) {

        XStreamServiceLoader loader = findServiceLoader(service);

        //handle the case of a service changing workspace and move the file
        int i = propertyNames.indexOf("workspace");
        if (i != -1) {
            //TODO: share code with GeoServerPersister
            WorkspaceInfo old = (WorkspaceInfo) oldValues.get(i);
            if (old != null) {
                WorkspaceInfo ws = (WorkspaceInfo) newValues.get(i);
                File f;
                try {
                    f = new File(dir(ws), loader.getFilename());
                    f.renameTo(new File(dir(ws,true), loader.getFilename()));
                } catch (IOException e) {
                    throw new RuntimeException( e );
                }
            }
        }
View Full Code Here


            }
        }
    }

    public void handlePostServiceChange(ServiceInfo service) {
        XStreamServiceLoader loader = findServiceLoader(service);

        try {
            //TODO: handle workspace move, factor this class out into
            // separate persister class
            File directory = service.getWorkspace() != null
                ? dir(service.getWorkspace(), true) : null;
            loader.save( service, geoServer, directory);
        } catch (Throwable t) {
            throw new RuntimeException( t );
            //LOGGER.log(Level.SEVERE, "Error occurred while saving configuration", t);
        }
    }
View Full Code Here

            //LOGGER.log(Level.SEVERE, "Error occurred while saving configuration", t);
        }
    }

    public void handleServiceRemove(ServiceInfo service) {
        XStreamServiceLoader loader = findServiceLoader(service);
        try {
            File dir = service.getWorkspace() != null ? dir(service.getWorkspace())
                : resourceLoader.getBaseDirectory();
            new File(dir, loader.getFilename()).delete();
        }
        catch(Throwable t) {
            throw new RuntimeException(t);
        }
    }
View Full Code Here

            throw new RuntimeException(t);
        }
    }

    XStreamServiceLoader findServiceLoader(ServiceInfo service) {
        XStreamServiceLoader loader = null;
        for ( XStreamServiceLoader<ServiceInfo> l : loaders  ) {
            if ( l.getServiceClass().isInstance( service ) ) {
                loader = l;
                break;
            }
View Full Code Here

TOP

Related Classes of org.geoserver.config.util.XStreamServiceLoader

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.