Package org.jitterbit.util.persist

Examples of org.jitterbit.util.persist.XmlPersistor


                            " to the target resource store.", ex);
        }
    }

    private void exportSettings(IntegrationEntity entity, EntityResourcesImpl target) {
        XmlPersistor from = (XmlPersistor) settings.getEntitySettings(entity);
        XmlPersistor to = (XmlPersistor) target.settings.getEntitySettings(entity);
        from.exportTo(to);
        target.settings.persist();
    }
View Full Code Here


    }
   
    @Test
    public void testSaveAndLoad() {
        LdapStructureEntryPersistor toTest = new LdapStructureEntryPersistor();
        XmlPersistor xml = XmlPersistor.newRoot("Test");
        LdapStructureEntry[] entries = createEntries();
        for (LdapStructureEntry e : entries) {
            Persistor p = xml.createChild("Entry");
            toTest.writeTo(e, p);
        }
        if (PRINT_XML) {
            xml.printToConsole();
        }
        int n = 0;
        for (Persistor p : xml.getChildren("Entry")) {
            if (n >= entries.length) {
                fail("To many entries in the Persistor");
            }
            assertEquals(entries[n], toTest.restoreFrom(p));
            ++n;
View Full Code Here

    }
   
    @Test
    public void testSaveAndLoad() {
        LdapSearchParametersPersistor toTest = new LdapSearchParametersPersistor();
        XmlPersistor xml = XmlPersistor.newRoot("Test");
        LdapSearchParameters[] entries = createSearchParams();
        for (LdapSearchParameters e : entries) {
            Persistor p = xml.createChild("Params");
            toTest.writeTo(e, p);
        }
        if (PRINT_XML) {
            xml.printToConsole();
        }
        int n = 0;
        for (Persistor p : xml.getChildren("Params")) {
            if (n >= entries.length) {
                fail("To many entries in the Persistor");
            }
            assertEquals(entries[n], toTest.restoreFrom(p));
            ++n;
View Full Code Here

public class ClassStructureXmlPersistor implements ClassStructureFilePersistor, ClassStructureStringPersistor {

    @Override
    public void store(ObjectClassStructure struct, File file) {
        try {
            XmlPersistor xml = XmlPersistor.newRoot("OID_" + struct.getOid());
            new PersistableObjectClassStructure(struct).save(xml);
            xml.store(file);
        } catch (IOException ex) {
            // TODO: Log this
            ex.printStackTrace();
        }
    }
View Full Code Here

    }

    @Override
    public ObjectClassStructure load(File file) {
        try {
            XmlPersistor xml = XmlPersistor.load(file);
            return load(xml);
        } catch (Exception ex) {
            // TODO: Log this
            ex.printStackTrace();
            return null;
View Full Code Here

    }

    @Override
    public ObjectClassStructure load(String s) {
        try {
            XmlPersistor xml = XmlPersistor.load(s);
            return load(xml);
        } catch (Exception ex) {
            // TODO: Log this
            ex.printStackTrace();
            return null;
View Full Code Here

        }
    }

    @Override
    public String store(ObjectClassStructure struct) {
        XmlPersistor xml = XmlPersistor.newRoot("OID_" + struct.getOid());
        new PersistableObjectClassStructure(struct).save(xml);
        StringWriter writer = new StringWriter();
        xml.store(writer);
        return writer.toString();
    }
View Full Code Here

    private static final String TYPE = "type";

    static void persist(ObjectClassDefinition[] classDefs, File file) {
        try {
            XmlPersistor p = XmlPersistor.newRoot(ROOT);
            for (ObjectClassDefinition classDef : classDefs) {
                persistDefinition(classDef, p);
            }
            p.store(file);
        } catch (IOException ex) {
            logPersistError(ex);
        }
    }
View Full Code Here

        child.putString(TYPE, classDef.getType().name());
    }

    static ObjectClassDefinition[] restore(File file) {
        try {
            XmlPersistor root = XmlPersistor.load(file);
            List<ObjectClassDefinition> classDefs = new ArrayList<ObjectClassDefinition>();
            for (Persistor p : root.getChildren(CLASS_DEFINITION)) {
                try {
                    ObjectClassDefinition classDef = restoreDefinition(p);
                    classDefs.add(classDef);
                } catch (RuntimeException ex) {
                    ApplicationLog.getMainLogger().severe(
View Full Code Here

        public ProjectSaver(org.jitterbit.util.file.Folder dir) {
            this.dir = dir;
        }

        public void storeProject(IntegrationProject project) throws IOException {
            XmlPersistor p = persistProject(project);
            p.store(dir.getFile(project.getID() + ".xml"));
        }
View Full Code Here

TOP

Related Classes of org.jitterbit.util.persist.XmlPersistor

Copyright © 2018 www.massapicom. 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.