Package org.jitterbit.util.persist

Examples of org.jitterbit.util.persist.XmlPersistor


            XmlPersistor p = persistProject(project);
            p.store(dir.getFile(project.getID() + ".xml"));
        }

        private XmlPersistor persistProject(IntegrationProject project) {
            XmlPersistor root = XmlPersistor.newRoot("project");
            storeNameAndId(project, root);
            Persistor operations = root.createChild(OPERATIONS);
            addItems(project, operations, EntityType.Operation);
            Persistor schedules = root.createChild(SCHEDULES);
            addItems(project, schedules, EntityType.Schedule);
            return root;
        }
View Full Code Here


        public ProjectRestorer(File file) {
            this.file = file;
        }

        public IntegrationProject restoreProject() throws SAXException, IOException {
            XmlPersistor root = XmlPersistor.load(file);
            IntegrationProject project = createProjectShell(root);
            restoreType(project, EntityType.Operation, root.getFirstChild(OPERATIONS));
            restoreType(project, EntityType.Schedule, root.getFirstChild(SCHEDULES));
            return project;
        }
View Full Code Here

    @Override
    public Set<ProjectLoadingIssue> loadProject(ProjectLoadingTracker tracker) throws InterchangeLoadingException {
        logDetail("Starting loading the project " + project.getName() + " from " + rootDirectory.getAbsolutePath());
        try {
            Set<ProjectLoadingIssue> issues = Sets.newHashSet();
            XmlPersistor xml = XmlPersistor.load(getProjectStructureFile());
            EnumMap<EntityType, ProjectStructurePersistor.Node> roots = ProjectStructurePersistor.load(xml, issues);
            IntegrationEntityMapLookup lookup = loadEntities(roots);
            SystemObjects.populate(lookup);
            restoreDependentData(lookup);
            return issues;
View Full Code Here

        if (entity instanceof Folder) {
            return;
        }
        File file = FileSupport.getFile(dataDirectory, entity);
        try {
            XmlPersistor xml = XmlPersistor.load(file);
            entity.restoreDependentData(xml, lookup);
        } catch (Exception ex) {
            throw new InterchangeLoadingException("Failed to load dependent data from the file "
                            + file.getAbsolutePath() + ". Reason: " + ex.getMessage(), ex);
        }
View Full Code Here

        }

        private void loadItemData(IntegrationEntity parent, File file, IntegrationEntity entity)
                        throws InterchangeLoadingException {
            try {
                XmlPersistor xml = XmlPersistor.load(file);
                entity.restoreFrom(xml);
            } catch (Exception ex) {
                throw new InterchangeLoadingException("Failed to read the entity data from the file "
                        + file.getAbsolutePath() + ". Reason: " + ex.getMessage(), ex);
            }
View Full Code Here

    @Override
    public void save(IntegrationEntity entity) throws InterchangeSavingException {
        synchronized (lock) {
            try {
                XmlPersistor xml = XmlPersistor.newRoot("Entity");
                xml.putString("type", entity.getEntityType().name());
                entity.willBeSaved();
                entity.writeTo(xml);
                xml.store(getFile(entity));
                entity.setTransient(false);
            } catch (Exception ex) {
                throw new InterchangeSavingException("An error occurred while saving \"" + entity.getName() + "\" ["
                                + entity.getEntityType() + "]" + ": " + ex.getMessage(), ex);
            }
View Full Code Here

    void saveToFile(IntegrationProject project) throws XmlSavingException {
        File target = getProjectStructureFile();
        File copy = createCopyOfProjectStructureFile(target);
        try {
            XmlPersistor xml = XmlPersistor.newRoot("Project");
            ProjectStructurePersistor.save(project, xml);
            xml.store(target);
            validateProjectStructureFile(target, copy);
            if (copy != null) {
                copy.delete();
            }
        } catch (Exception ex) {
View Full Code Here

        }
    }

    @Override
    public synchronized Persistor getClassSettings(EntityType type) {
        XmlPersistor root = getRoot(type);
        Persistor p = root.getFirstChild(CLASS_SETTINGS);
        if (p == null) {
            p = root.createChild(CLASS_SETTINGS);
        }
        return p;
    }
View Full Code Here

        return files.getRoot();
    }

    @Override
    public synchronized Persistor getEntitySettings(IntegrationEntity entity) {
        XmlPersistor root = getRoot(entity.getEntityType());
        String name = getNameOfEntityPersistor(entity);
        Persistor p = root.getFirstChild(name);
        if (p == null) {
            p = root.createChild(name);
        }
        return p;
    }
View Full Code Here

        return "ID-" + entity.getID().toString();
    }

    @Override
    public synchronized void deleteSettings(IntegrationEntity entity) {
        XmlPersistor root = getRoot(entity.getEntityType());
        root.removeChildren(getNameOfEntityPersistor(entity));
    }
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.