Examples of XStreamPersister


Examples of org.geoserver.config.util.XStreamPersister

    @Override
    protected ReflectiveXMLFormat createXMLFormat(Request request,Response response) {
        return new ReflectiveXMLFormat() {
            @Override
            protected void write(Object data, OutputStream output) throws IOException  {
                XStreamPersister p = xpf.createXMLPersister();
                p.setCatalog( catalog );
                p.setReferenceByName(true);
                p.setExcludeIds();
               
                configurePersister(p,this);
                p.save( data, output );
            }
           
            @Override
            protected Object read(InputStream in)
                    throws IOException {
                XStreamPersister p = xpf.createXMLPersister();
                p.setCatalog( catalog );
               
                configurePersister(p,this);
                return p.load( in, clazz );
            }
        };
    }
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

    protected ReflectiveJSONFormat createJSONFormat(Request request,Response response) {
        return new ReflectiveJSONFormat() {
            @Override
            protected void write(Object data, OutputStream output)
                    throws IOException {
                XStreamPersister p = xpf.createJSONPersister();
                p.setCatalog(catalog);
                p.setReferenceByName(true);
                p.setExcludeIds();
               
                configurePersister(p,this);
                p.save( data, output );
            }
           
            @Override
            protected Object read(InputStream input)
                    throws IOException {
                XStreamPersister p = xpf.createJSONPersister();
                p.setCatalog(catalog);
               
                configurePersister(p,this);
                return p.load( input, clazz );
            }
        };
    }
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

   
    protected abstract Collection handleListGet() throws Exception;
   
    @Override
    protected void configureXStream(XStream xstream) {
        XStreamPersister xp = xpf.createXMLPersister();
        final String name = xp.getClassAliasingMapper().serializedClass( clazz );
       
        xstream.alias( name, clazz );
        aliasCollection( name + "s", xstream );
       
        xstream.registerConverter(
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

            }
           
            //load
            try {
                Catalog catalog = (Catalog) bean;
                XStreamPersister xp = xpf.createXMLPersister();
                xp.setCatalog( catalog );
                loadCatalog( catalog, xp );
            }
            catch (Exception e) {
                throw new RuntimeException( e );
            }
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

        Catalog catalog = geoserver.getCatalog();
        if ( catalog instanceof Wrapper ) {
            catalog = ((Wrapper)geoserver.getCatalog()).unwrap(Catalog.class);
        }
       
        XStreamPersister xp = xpf.createXMLPersister();
        xp.setCatalog( catalog );
       
        loadCatalog( catalog, xp );
        loadGeoServer( geoserver, xp);
    }
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

   
    //TODO: kill this method, it is not longer needed since persistance is event based
    public void persist() throws Exception {
        //TODO: make the configuration backend pluggable... or loadable
        // from application context, or web.xml, or env variable, etc...
        XStreamPersister p = xpf.createXMLPersister();
        BufferedOutputStream out = new BufferedOutputStream(
            new FileOutputStream( resourceLoader.createFile( "catalog2.xml" ) )
        );
       
        //persist catalog
        Catalog catalog = geoserver.getCatalog();
        if( catalog instanceof Wrapper ) {
            catalog = ((Wrapper)catalog).unwrap( Catalog.class );
        }
        p.save( catalog, out );
        out.flush();
        out.close();
    
        //persist resources
        File workspaces = resourceLoader.findOrCreateDirectory( "workspaces" );
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

                File baseDir = new File(GeoserverDataDirectory.findGeoServerDataDir(context));
                GeoServerResourceLoader loader = new GeoServerResourceLoader(baseDir);
               
                File f= loader.find( "logging.xml" );
                if ( f != null ) {
                    XStreamPersister xp = new XStreamPersisterFactory().createXMLPersister();
                    BufferedInputStream in = new BufferedInputStream( new FileInputStream( f ) );
                    try {
                        LoggingInfo loginfo = xp.load(in,LoggingInfo.class);
                        LoggingUtils.initLogging(loader, loginfo.getLevel(), !loginfo.isStdOutLogging(),
                            loginfo.getLocation());
                    }
                    finally {
                        in.close();
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

            }
           
            //load
            try {
                Catalog catalog = (Catalog) bean;
                XStreamPersister xp = xpf.createXMLPersister();
                xp.setCatalog( catalog );
                loadCatalog( catalog, xp );
               
                //initialize styles
                initializeStyles(catalog, xp);
            }
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

        Catalog catalog = geoserver.getCatalog();
        if ( catalog instanceof Wrapper ) {
            catalog = ((Wrapper)geoserver.getCatalog()).unwrap(Catalog.class);
        }
       
        XStreamPersister xp = xpf.createXMLPersister();
        xp.setCatalog( catalog );
       
        loadCatalog( catalog, xp );
        loadGeoServer( geoserver, xp);
    }
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

                File baseDir = new File(GeoserverDataDirectory.findGeoServerDataDir(context));
                GeoServerResourceLoader loader = new GeoServerResourceLoader(baseDir);
               
                File f= loader.find( "logging.xml" );
                if ( f != null ) {
                    XStreamPersister xp = new XStreamPersisterFactory().createXMLPersister();
                    BufferedInputStream in = new BufferedInputStream( new FileInputStream( f ) );
                    try {
                        LoggingInfo loginfo = xp.load(in,LoggingInfo.class);
                        final String location = getLogFileLocation(loginfo.getLocation());
                        LoggingUtils.initLogging(loader, loginfo.getLevel(), !loginfo.isStdOutLogging(),
                            location);
                    }
                    finally {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.