Examples of XStreamPersister


Examples of org.geoserver.config.util.XStreamPersister

    }
   
    protected Document marshallToXML(DimensionInfo di) throws Exception{
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        XStreamPersisterFactory xpf = GeoServerExtensions.bean(XStreamPersisterFactory.class);
        XStreamPersister persister = xpf.createXMLPersister();
        persister.save(di, baos);
        baos.flush();
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();       
        DocumentBuilder builder = factory.newDocumentBuilder();
        return builder.parse(new ByteArrayInputStream(baos.toByteArray()));
    }
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

        DOMSource source = new DOMSource(doc);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        StreamResult result = new StreamResult(baos);
        transformer.transform(source, result);
        XStreamPersisterFactory xpf = GeoServerExtensions.bean(XStreamPersisterFactory.class);
        XStreamPersister persister = xpf.createXMLPersister();
        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        return persister.load(bais, DimensionInfo.class);
    }
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

        };
    }
   
    @Override
    protected void configureXStream(XStream xstream) {
        XStreamPersister xp = xpf.createXMLPersister();
        final String name = getItemName(xp);
        xstream.alias( name, clazz );
       
        xstream.registerConverter(
            new CollectionConverter(xstream.getMapper()) {
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

     * The default works with list, subclasses may override for instance
     * to work with a Set.
     * </p>
     */
    protected void aliasCollection( Object data, XStream xstream ) {
        XStreamPersister xp = xpf.createXMLPersister();
        final String alias = getItemName(xp);
        xstream.alias(alias + "s", Collection.class, data.getClass());
    }
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

        };
    }
   
    @Override
    protected void configureXStream(XStream xstream) {
        XStreamPersister xp = xpf.createXMLPersister();
        final String name = xp.getClassAliasingMapper().serializedClass( clazz );
        xstream.alias( name, clazz );
       
        xstream.registerConverter(
            new CollectionConverter(xstream.getMapper()) {
                public boolean canConvert(Class type) {
View Full Code Here

Examples of org.geoserver.config.util.XStreamPersister

     * The default works with list, subclasses may override for instance
     * to work with a Set.
     * </p>
     */
    protected void aliasCollection( Object data, XStream xstream ) {
        XStreamPersister xp = xpf.createXMLPersister();
        final String alias = xp.getClassAliasingMapper().serializedClass( clazz );
        xstream.alias(alias + "s", Collection.class, data.getClass());
    }
View Full Code Here

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
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.