Package com.thoughtworks.xstream

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


        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


                    // marshall the SObject
                    // first process annotations on the class, for things like alias, etc.
                    localXStream.processAnnotations(sObject.getClass());
                    ByteArrayOutputStream out = new ByteArrayOutputStream();
                    // make sure we write the XML with the right encoding
                    localXStream.toXML(sObject, new OutputStreamWriter(out, StringUtil.__UTF8_CHARSET));
                    request = new ByteArrayInputStream(out.toByteArray());
                } else {
                    // if all else fails, get body as String
                    final String body = in.getBody(String.class);
                    if (null == body) {
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;
      }
      UserProfileImpl impl = (UserProfileImpl)up;
      userName = up.getUserName();
      XStream xstream = getXStream();
      profile = xstream.toXML(impl);
   }

   static private XStream getXStream()
   {
      if (xstream_ == null)
View Full Code Here

                       org.drools.verifier.components.Field.class );

        xstream.alias( "LiteralRestriction",
                       LiteralRestriction.class );

        out.write( ("<?xml version=\"1.0\"?>\n" + xstream.toXML( result )).getBytes() );
    }

}
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

        FileWriter fileWriter = null;
        try {
            fileWriter = new FileWriter(this.fileName + (this.nbOfFile == 0 ? ".log" : this.nbOfFile + ".log"), true );
            final XStream xstream = new XStream();
            for (LogEvent event : this.events) {
                fileWriter.write(xstream.toXML(event) + "\n");
            }
            if (split) {
                this.nbOfFile++;
                initialized = false;
            }
View Full Code Here

                               final String fileName) throws IOException {
        final XStream xstream = new XStream();

        final PrintWriter out = new PrintWriter( new BufferedWriter( new FileWriter( "src/test/resources/org/drools/reteoo/" + fileName ) ) );

        xstream.toXML( ruleBase,
                       out );
    }

    private void checkRuleBase(final String name) throws Exception {
        final PackageBuilder builder = new PackageBuilder();
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 ? "java.lang.Object" : className;
  }
View Full Code Here

        Writer w = new StringWriter();
        XStream xstream = new XStream(new DomDriver());
        xstream.alias("person", PersonImpl.class);
        xstream.aliasField("given-name", PersonImpl.class, "givenName");
        xstream.aliasField("sur-name", PersonImpl.class, "surName");
        xstream.toXML(this, w);
        return w.toString();
    }
}
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.