Package org.jitterbit.integration.client.entity.settings

Examples of org.jitterbit.integration.client.entity.settings.FileResource


    @Override
    public DataFilesInfo getCurrentFilesInfo() {
        synchronized (this) {
            if (info == null) {
                FileResource projectResource = getInfoResource();
                if (projectResource.exists()) {
                    try {
                        info = projectResource.deserialize(DataFilesInfo.class);
                    } catch (Exception e) {
                        ErrorLog.log(this, "Corrupt project data.", e);
                        projectResource.delete();
                    }
                }
            }
        }
        return info;
View Full Code Here


    @Override
    public TransformationDataFile getFile(DataFileIdentifier fileId) {
        synchronized (this) {
            if (info != null && info.contains(fileId)) {
                String name = DataFileName.fromIdentifier(fileId);
                FileResource resource = rc.getFileResource(tx, name);
                if (resource.exists()) {
                    return new TransformationDataFileImpl(fileId, resource.toFile());
                }
            }
        }
        return TransformationDataFile.NULL;
    }
View Full Code Here

                throw new IllegalStateException("No file info");
            }
            if (!info.getGuid().equals(guid)) {
                return TransformationDataFile.NULL;
            }
            FileResource resource = getProjectResourceForDataFile(fileId);
            return writeDataFileToProjectResource(fileId, data, resource);
        }
    }
View Full Code Here

        }
    }

    private FileResource getProjectResourceForDataFile(DataFileIdentifier fileId) {
        String name = DataFileName.fromIdentifier(fileId);
        FileResource resource = rc.getFileResource(tx, name);
        resource.setLifeTime(LifeTime.PROJECT_SESSION);
        return resource;
    }
View Full Code Here

        deleteDataFiles(new AllDataFiles());
    }

    private void deleteDataFiles(FileFilter filter) {
        // HACK: There must be a better way of getting the name of the folder.
        FileResource tmp = rc.getFileResource(tx, "__dummy__");
        Folder parent = Folder.parentOf(tmp.toFile());
        parent.deleteFiles(filter);
    }
View Full Code Here

    private void setFilesInfo(DataFilesInfo info) {
        synchronized (this) {
            this.info = info;
            try {
                FileResource projectResource = getInfoResource();
                if (info == null) {
                    projectResource.delete();
                } else {
                    projectResource.setLifeTime(LifeTime.PROJECT_SESSION);
                    projectResource.serialize(info);
                }
            } catch (IOException e) {
                ErrorLog.log(this, "Failed to store information about returned data files.", e);
            }
        }
View Full Code Here

    }

    @Override
    public void removeAll() {
        synchronized (this) {
            FileResource projectResource = getInfoResource();
            projectResource.delete();
            deleteAllDataFiles();
            info = null;
        }
    }
View Full Code Here

        String xml = getLayoutData(original);
        return (xml == null) ? null : DomParser.parseXmlString(xml);
    }

    private String getLayoutData(Operation op) {
        FileResource rc = getResource(op);
        // If the Operation has not been open for editing, or its layout file has been deleted,
        // the file resource will not exist.
        return rc.exists() ? rc.read() : null;
    }
View Full Code Here

    private void saveNewLayout(Document dom) throws IOException {
        XmlFileWriter writer = new XmlFileWriter();
        StringWriter xml = new StringWriter();
        writer.write(dom, xml);
        FileResource rc = getResource(copy);
        rc.write(new StringReader(xml.getBuffer().toString()));
    }
View Full Code Here

TOP

Related Classes of org.jitterbit.integration.client.entity.settings.FileResource

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.