Package com.thoughtworks.xstream

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


            if (form != null) {
                XStream xstream = new XStream();
                xstream.setClassLoader(this.getClass().getClassLoader());

                try {
                    Object object = xstream.fromXML(form);
                    WorkgroupForm workgroupForm = (WorkgroupForm)object;
                    if (workgroupForm != null) {
                        addWorkgroupForm(workgroup, workgroupForm);
                    }
                }
View Full Code Here


    String decodeMessage = URLDecoder.decode(sb.toString(), "UTF-8");

    XStream xStream = new XStream(new DomDriver());
    xStream.alias("TelnetMessage", TelnetMessage.class);
    xStream.alias("TelnetCommand", TelnetCommand.class);
    telnetMessage = (TelnetMessage) xStream.fromXML(decodeMessage);
   
    String instanceId = telnetMessage.getInstanceId();
    String eventParentDivName = telnetMessage.getEventParentDivName();
    String eventDivName = telnetMessage.getEventDivName();
   
View Full Code Here

                xml.append(line).append("\n");
            }

            Config c = null;
            xstream.alias("config", Config.class);
            c = (Config) xstream.fromXML(xml.toString());
            c.setXmlFile(file);

            return c;
        } catch (FileNotFoundException fileNotFoundException) {
            LOG.warning(fileNotFoundException.getLocalizedMessage());
View Full Code Here

                    Trigger trigger = null;
                    try {
                        //validate the object against a predefined DTD
                        String xml =
                                DOMValidateDTD.validate(file, Info.getApplicationPath() + "/config/validator/trigger.dtd");
                        trigger = (Trigger) xstream.fromXML(xml);
                    } catch (Exception e) {
                        LOG.log(Level.SEVERE, "Trigger file {0} is not well formatted: {1}", new Object[]{file.getPath(), e.getLocalizedMessage()});
                        continue;
                    }
View Full Code Here

                    Trigger trigger = null;
                    try {
                        //validate the object against a predefined DTD
                        String xml =
                                DOMValidateDTD.validate(file, Info.getApplicationPath() + "/config/validator/trigger.dtd");
                        trigger = (Trigger) xstream.fromXML(xml);
                    } catch (Exception e) {
                        LOG.log(Level.SEVERE, "Trigger file {0} is not well formatted: {1}", new Object[]{file.getPath(), e.getLocalizedMessage()});
                        continue;
                    }
View Full Code Here

        String xml;

        try {
            xml = DOMValidateDTD.validate(file, Info.getApplicationPath() + "/config/validator/object.dtd");

            EnvObject pojo = (EnvObject) xstream.fromXML(xml);
            EnvObjectLogic objectLogic = null;

            try {
                objectLogic = EnvObjectFactory.create(pojo);
                LOG.config("Created a new logic for " + objectLogic.getPojo().getName()
View Full Code Here

                     } catch (Exception e) {
                        LOG.log(Level.SEVERE, "Reaction file {0} is not well formatted: {1}", new Object[]{file.getPath(), e.getLocalizedMessage()});
                        continue;
                    }
                    try {
                        command = (Command) xstream.fromXML(xml);

                        if (command.isHardwareLevel()) { //an hardware level command
                            hardwareCommands.put(command.getName(),
                                    command);
                        } else { //a user level commmand
View Full Code Here

                    //validate the object against a predefined DTD
                    try {
                        String xml =
                                DOMValidateDTD.validate(file, Info.getApplicationPath() + "/config/validator/reaction.dtd");

                        reaction = (Reaction) xstream.fromXML(xml);
                    } catch (Exception e) {
                        LOG.log(Level.SEVERE, "Reaction file {0} is not well formatted: {1}", new Object[]{file.getName(), e.getLocalizedMessage()});
                        continue;
                    }
View Full Code Here

            source.serialize(writer);
            String w = writer.toString();
            // FIXME: a better way to get eliminate param0
            w = w.replaceAll("param0", "xobject");
            w = w.replaceAll("xmlns=\"\"", "");
            mo = (MetaObjectImpl)xs.fromXML(w.trim());
            return mo.getInstance();
        } catch (XMLStreamException e) {

            e.printStackTrace();
        }
View Full Code Here

            source.serialize(writer);
            String w = writer.toString();
            // FIXME: a better way to get eliminate param0
            w = w.replaceAll("param0", "xobject");
            w = w.replaceAll("xmlns=\"\"", "");
            mo = (MetaObjectImpl)xs.fromXML(w.trim());
            return mo.getInstance();
        } catch (XMLStreamException e) {

            e.printStackTrace();
        }
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.