Examples of XStreamPersister


Examples of org.geoserver.config.util.XStreamPersister

        // Exposing this is a hack to provide JDBCConfig with the information it needs to compute
        // the "change" between logging.xml and the versions stored in JDBC. KS
        // TODO find a better solution than re-initializing on JDBCCOnfig startup.
        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);
                return loginfo;
            }
            finally {
                in.close();
            }
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

                dialog.setInitialHeight(500);
                dialog.setInitialWidth(700);
                dialog.showOkCancel(target, new DialogDelegate() {
                    @Override
                    protected Component getContents(String id) {
                        XStreamPersister xp = importer()
                                .createXStreamPersisterXML();
                        ByteArrayOutputStream bout = new ByteArrayOutputStream();
                        try {
                            xp.save(model.getObject(), bout);
                        } catch (IOException e) {
                            bout = new ByteArrayOutputStream();
                            LOGGER.log(Level.FINER, e.getMessage(), e);
                            e.printStackTrace(new PrintWriter(bout));
                        }
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

            File dir = new File(getRoot(), name);
            if (!dir.exists()) {
                return null;
            }

            XStreamPersister xp = persister();
            if(migrationHelper != null) {
                migrationHelper.migrationPersister(xp);
            }
            return (C) loadConfigFile(dir, xp);
        }
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

    void toJSON(Object o, OutputStream out) throws IOException {
        toJSON(o, out, null);
    }
   
    void toJSON(Object o, OutputStream out, Callback callback) throws IOException {
        XStreamPersister xp = persister();
        if (callback != null) {
            xp.setCallback(callback);
        }
        xp.save(o, out);
        out.flush();
    }
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

        xp.save(o, out);
        out.flush();
    }

    XStreamPersister persister() {
        XStreamPersister xp =
            importer.initXStreamPersister(new XStreamPersisterFactory().createJSONPersister());
       
        xp.setReferenceByName(true);
        xp.setExcludeIds();

        //xp.setCatalog(importer.getCatalog());
        xp.setHideFeatureTypeAttributes();
        // @todo this is copy-and-paste from org.geoserver.catalog.rest.FeatureTypeResource
        xp.setCallback(new XStreamPersister.Callback() {

            @Override
            protected void postEncodeFeatureType(FeatureTypeInfo ft,
                    HierarchicalStreamWriter writer, MarshallingContext context) {
                try {
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

        }
        return result;
    }

    XStreamPersister globalPersister() throws IOException {
        XStreamPersister xp = persister();
        xp.getXStream().alias("security", SecurityManagerConfig.class);
        xp.getXStream().alias("masterPassword", MasterPasswordConfig.class);
        xp.getXStream().registerLocalConverter( SecurityManagerConfig.class, "filterChain",
            new FilterChainConverter(xp.getXStream().getMapper()));
       
        // The field anonymousAuth is deprecated
        xp.getXStream().omitField(SecurityManagerConfig.class, "anonymousAuth");
       
        return xp;
    }
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

     */
    XStreamPersister persister() throws IOException{
        List<GeoServerSecurityProvider> all = lookupSecurityProviders();
       
        //create and configure an xstream persister to load the configuration files
        XStreamPersister xp = new XStreamPersisterFactory().createXMLPersister();
        xp.getXStream().alias("security", SecurityManagerConfig.class);
       
        for (GeoServerSecurityProvider roleService : all) {
            roleService.configure(xp);
        }
        return xp;
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

    @Test
    public void testSerializeWithNewStore() throws Exception {
        File dir = unpack("shape/archsites_epsg_prj.zip");
        ImportContext context = importer.createContext(new Directory(dir));

        XStreamPersister xp = importer.createXStreamPersisterXML();
        XStreamInfoSerialBinding<ImportContext> binding =
                new XStreamInfoSerialBinding<ImportContext>(xp, ImportContext.class);
        binding.setCompress(false);

        DatabaseEntry e = new DatabaseEntry();
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

        ds = cat.getDataStore(ds.getId());
        ImportContext context = importer.createContext(new Directory(dir), ds);
        assertEquals(2, context.getTasks().size());

        XStreamPersister xp = new XStreamPersisterFactory().createXMLPersister();
        xp.getXStream().omitField(ImportTask.class, "context");

        XStreamInfoSerialBinding<ImportContext> binding =
                new XStreamInfoSerialBinding<ImportContext>(xp, ImportContext.class);
        binding.setCompress(false);
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);
            }
            catch (Exception e) {
                throw new RuntimeException( e );
            }
        }
       
        if ( bean instanceof GeoServer ) {
            geoserver = (GeoServer) bean;
            try {
                XStreamPersister xp = xpf.createXMLPersister() ;
                xp.setCatalog(geoserver.getCatalog());
                loadGeoServer(geoserver, xp);
               
                //load initializers
                loadInitializers(geoserver);
            }
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.