Package com.thoughtworks.xstream

Examples of com.thoughtworks.xstream.XStream.toXML()


    XStream xstream = new XStream();
    xstream.setMode(XStream.NO_REFERENCES);
    xstream.processAnnotations(FireburnDataImport.class);
    xstream.processAnnotations(FireburnProperty.class);
    OutputStreamWriter fw = new OutputStreamWriter(new FileOutputStream(new File(notfoundFilename)), "UTF8");
    xstream.toXML(fdi.pNotFoundList, fw);
    // DEBUG
    long time2 = System.currentTimeMillis();
    long time = time2 - time1;
    logger.debug("Execution time (ms): " + time);
  }
View Full Code Here


        return result.toByteArray();
    }

    private byte[] toXML(Fact[] facts) {
        XStream x = new XStream(new DomDriver());
        return x.toXML(facts).getBytes();

    }

    public Fact[] loadMetaModel(JarInputStream jis) throws Exception {
        JarEntry entry = null;
View Full Code Here

            synchronized ( this.events ) {
                log = new WorkingMemoryLog(new ArrayList<LogEvent>( this.events ),
                                           isPhreak ? "PHREAK" : "RETEOO");
                clear();
            }
            fileWriter.write( xstream.toXML( log ) + "\n" );
        } catch ( final FileNotFoundException exc ) {
            throw new RuntimeException( "Could not create the log file.  Please make sure that directory that the log file should be placed in does exist." );
        } catch ( final Throwable t ) {
            logger.error("error", t);
        } finally {
View Full Code Here

        return ids;
    }

    private String serialize(Object task) {
        XStream xStream = new XStream();
        return xStream.toXML(task);
    }

    private Object deserialize(String serializedRunnable) {
        XStream xStream = new XStream();
        return xStream.fromXML(serializedRunnable);
View Full Code Here

            synchronized ( this.events ) {
                eventsToWrite = new ArrayList<LogEvent>( this.events );
                clear();
            }
            for ( LogEvent event : eventsToWrite ) {
                fileWriter.write( xstream.toXML( event ) + "\n" );
            }
        } catch ( final FileNotFoundException exc ) {
            throw new RuntimeException( "Could not create the log file.  Please make sure that directory that the log file should be placed in does exist." );
        } catch ( final Throwable t ) {
            logger.error("error", t);
View Full Code Here

            synchronized (this.events) {
              eventsToWrite = new ArrayList<LogEvent>(this.events);
                clear();
            }
            for (LogEvent event : eventsToWrite) {
                fileWriter.write(xstream.toXML(event) + "\n");
            }
            if (split) {
                this.nbOfFile++;
                initialized = false;
            }
View Full Code Here

    public Object transform(PipelineContext context, Object object) {
        XStream xstream = (XStream) context.getProperties().get( "xstream-instance" );
        xstream.setClassLoader(context.getClassLoader());
        Object result = null;
        try {
            result = xstream.toXML(object);
        } catch (Exception e) {
            handleException(this, object, e);
        }
        return result;
    }
View Full Code Here

            File dir = new File(outputDirectory, "META-INF");
            dir.mkdirs();
            File outputFile = new File(dir, "template-suite.xml");
            outputFile.createNewFile();
            Writer writer = new FileWriter(outputFile);
            xstream.toXML(suite, writer);
            writer.close();
            Resource resource = new Resource();
            resource.setDirectory(outputDirectory.getAbsolutePath());
            project.addResource(resource);
        } catch (InclusionScanException e) {
View Full Code Here

            synchronized ( this.events ) {
                eventsToWrite = new ArrayList<LogEvent>( this.events );
                clear();
            }
            for ( LogEvent event : eventsToWrite ) {
                fileWriter.write( xstream.toXML( event ) + "\n" );
            }
        } catch ( final FileNotFoundException exc ) {
            throw new RuntimeException( "Could not create the log file.  Please make sure that directory that the log file should be placed in does exist." );
        } catch ( final Throwable t ) {
            logger.error("error", t);
View Full Code Here

    return xstream.fromXML(value);
  }

  public String writeValue(Object value) {
    XStream xstream = new XStream();
    return xstream.toXML(value);
  }

  public String getStringType() {
    return className == null ? "Object" : className;
  }
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.