Package com.thoughtworks.xstream

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


   public Message insertOrder(Message message) throws Exception
   {
      Body msgBody = message.getBody();
      XStream xstream = new XStream(new DomDriver());
      xstream.alias("order", Order.class);
      Order order = (Order) xstream.fromXML((String) msgBody.get());

      PetStoreFacade petStore = (PetStoreFacade) getBeanFactory()
            .getBean("petStore");
      petStore.insertOrder(order);
View Full Code Here


                assertSame(getComponentAdapterType(), componentAdapter.getClass());
                final Object instance = componentAdapter.getComponentInstance(picoContainer);
                assertNotNull(instance);
                final XStream xstream = new XStream(new XppDriver());
                final String xml = xstream.toXML(componentAdapter);
                final ComponentAdapter serializedComponentAdapter = (ComponentAdapter) xstream.fromXML(xml);
                assertEquals(componentAdapter.getComponentKey(), serializedComponentAdapter.getComponentKey());
                final Object instanceAfterSerialization = serializedComponentAdapter.getComponentInstance(picoContainer);
                assertNotNull(instanceAfterSerialization);
                assertSame(instance.getClass(), instanceAfterSerialization.getClass());
            }
View Full Code Here

            File proxyConfFile = getConfigFile();
            InputStream proxyConfStream = new FileInputStream(proxyConfFile);
            XStream xs = new XStream();
            //Take the read lock, then read the file
            configReadLock.lock();
            retval = (ProxyConfig) (xs.fromXML(proxyConfStream));
            configReadLock.unlock();
        } catch (Exception e) {
            LOG.warning("Failed to open configuration for Proxy module. Using default. Exception:"
                    + e.toString());
            //writeConfigToDisk(DEFAULT);
View Full Code Here

        // start with the default configuration, override if we can load the file
        OgrConfiguration configuration = OgrConfiguration.DEFAULT;
        try {
            if (configFile.exists()) {
                XStream xstream = buildXStream();
                configuration = (OgrConfiguration) xstream.fromXML(new FileInputStream(configFile));
            }
        } catch (Exception e) {
            LOGGER.log(Level.SEVERE, "Error reading the ogr2ogr.xml configuration file", e);
        }
View Full Code Here

      Serializable readObject = null;
      InputStream inputStream = null;
      try {
          inputStream = new BufferedInputStream(new FileInputStream(path));
          XStream xstream = new XStream();
        readObject = (Serializable) xstream.fromXML(inputStream, readObject);
      } catch (Exception e) {
          log.error(e.getLocalizedMessage(), e);
          throw new IllegalStateException("Unable to load object instance from file", e);
      } finally {
          JOrphanUtils.closeQuietly(inputStream);
View Full Code Here

     */
    private static Serializable transformXmlToObjectMessage(final String xmlMessage) {
      Serializable readObject = null;
      try {
          XStream xstream = new XStream();
          readObject = (Serializable) xstream.fromXML(xmlMessage, readObject);
      } catch (Exception e) {
          log.error(e.getLocalizedMessage(), e);
          throw new IllegalStateException("Unable to load object instance from text", e);
      }
      return readObject;
View Full Code Here

   
    try{
      String filePath = chooser.getSelectedFile().getPath();
      XStream xstream = new XStream( new DomDriver() );
      FileReader fr = new FileReader(filePath);
      serializableConfList = (ScreenerConfList)xstream.fromXML(fr);

      confList.setModel( serializableConfList.confListModel);

    }
    catch(InitializationException e)
View Full Code Here

  {
    Configuration c = null;
    try{
      XStream xstream = new XStream( new DomDriver() );
      FileReader fr = new FileReader(fp_confFilePath);
      c =  (Configuration)xstream.fromXML(fr);     
    }
    catch(InitializationException e)
    {
      JOptionPane.showMessageDialog( null, e.getMessage());
    }
View Full Code Here

    {
      try{
       
        XStream xstream = new XStream( new DomDriver() );
        FileReader fr = new FileReader( path );
        return xstream.fromXML(fr);

      }
      catch(InitializationException e)
      {
        JOptionPane.showMessageDialog( null, e.getMessage());
View Full Code Here

   
    XStream xs = new XStream();
    xs.alias("graph", Graph.class);
    String test = xs.toXML(graph);
    System.out.println(test);
    graph = (Graph<Integer>) xs.fromXML(test);
       
    System.out.println(graph);
  }
}
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.