Examples of EISDOMRecord


Examples of org.eclipse.persistence.eis.EISDOMRecord

        try {
            // store any dom to their files
            for (Iterator doms = domFiles.entrySet().iterator(); doms.hasNext();) {
                Map.Entry entry = (Map.Entry)doms.next();
                String fileName = (String)entry.getKey();
                EISDOMRecord record = (EISDOMRecord)entry.getValue();

                Writer fileWriter = new FileWriter(fileName);
                record.transformToWriter(fileWriter);
                fileWriter.flush();
                fileWriter.close();
            }
        } catch (Exception exception) {
            throw new ResourceException(exception.toString());
View Full Code Here

Examples of org.eclipse.persistence.eis.EISDOMRecord

     * Return the transactional copy of the file's DOM record.
     * This will be written on commit.
     */
    public EISDOMRecord retrieveDOMRecord(File file) throws Exception {
        // Check for transactional copy.
        EISDOMRecord fileRecord = (EISDOMRecord)this.domFiles.get(file.getPath());
        if (fileRecord == null) {
            // If the file exists parse it, otherwise create a new record.
            if (file.exists()) {
                Reader fileReader = new FileReader(file);
                fileRecord = new EISDOMRecord();
                // Parse file.
                fileRecord.transformFromXML(fileReader);
                fileReader.close();
            } else {
                fileRecord = new EISDOMRecord();
                fileRecord.setDOM(fileRecord.createNewDocument("root"));
            }
            this.domFiles.put(file.getPath(), fileRecord);
        }
        return fileRecord;
    }
View Full Code Here

Examples of org.eclipse.persistence.eis.EISDOMRecord

    public Record executeRead(XMLFileInteractionSpec spec, File file) throws Exception {
        // Parse file and return document, or xpath/xquery result from dom. 
        if (!file.exists()) {
            return null;
        }
        EISDOMRecord fileRecord = connection.getXMLFileTransaction().retrieveDOMRecord(file);

        // Check for and process XPath or XQuery   
        if (spec.getXPath() != null) {
            // Either a value/string or list of element records is returned
            Object result = fileRecord.getValues(buildField(spec));
            EISDOMRecord output = new EISDOMRecord();
            if (result instanceof List) {
                List results = (List)result;
                output.setDOM(output.createNewDocument("results"));
                if (results != null) {
                    for (int index = 0; index < results.size(); index++) {
                        output.add(new DatabaseField("result"), results.get(index));
                    }
                }
            } else {
                output.setDOM(output.createNewDocument("results"));
                output.add(new DatabaseField("result"), result);
            }
            return output;
        } else {
            return fileRecord;
        }
View Full Code Here

Examples of org.eclipse.persistence.eis.EISDOMRecord

    /**
     * Execute the insert operation.
     */
    public Record executeInsert(XMLFileInteractionSpec spec, File file, EISDOMRecord input) throws Exception {
        // Write input record dom to file, or insert dom node. 
        EISDOMRecord outputToFile = input;

        // If xpath, parse, insert node, then write back 
        if (spec.getXPath() != null) {
            // If the file exists get tx dom.
            outputToFile = connection.getXMLFileTransaction().retrieveDOMRecord(file);
            outputToFile.add(buildField(spec), input);
        }
        return null;
    }
View Full Code Here

Examples of org.eclipse.persistence.eis.EISDOMRecord

        if (!file.exists()) {
            return null;
        }

        // Write input record dom to file, or insert dom node.
        EISDOMRecord outputToFile = input;

        // If xpath, get tx dom, find and update node, (tx commit will write back)     
        if (spec.getXPath() != null) {
            outputToFile = connection.getXMLFileTransaction().retrieveDOMRecord(file);
            outputToFile.put(buildField(spec), input);
        }
        return null;
    }
View Full Code Here

Examples of org.eclipse.persistence.eis.EISDOMRecord

            return null;
        }

        // If xpath, get tx dom, delete node, (tx commit will write back) 
        if (spec.getXPath() != null) {
            EISDOMRecord outputToFile = connection.getXMLFileTransaction().retrieveDOMRecord(file);
            outputToFile.remove(buildField(spec));
        } else {
            boolean success = file.delete();

            if (!success) {
                throw EISException.couldNotDeleteFile(new Object[] { file });
View Full Code Here

Examples of org.eclipse.persistence.eis.EISDOMRecord

    /**
     * Execute the interaction and set the output into the output record.
     * Return true or false if the execute returned data (similar to row-count).
     */
    public boolean execute(InteractionSpec spec, Record input, Record output) throws ResourceException {
        EISDOMRecord result = (EISDOMRecord)execute(spec, input);
        if (result == null) {
            return false;
        }
        ((EISDOMRecord)output).setDOM(result.getDOM());
        return true;
    }
View Full Code Here

Examples of org.eclipse.persistence.eis.EISDOMRecord

    public IndexedRecord createIndexedRecord(String recordName) {
        return null;
    }

    public MappedRecord createMappedRecord(String recordName) {
        EISDOMRecord record = new EISDOMRecord();
        record.setRecordName(recordName);
        return record;
    }
View Full Code Here

Examples of org.eclipse.persistence.eis.EISDOMRecord

        try {
            // store any dom to their files
            for (Iterator doms = domFiles.entrySet().iterator(); doms.hasNext();) {
                Map.Entry entry = (Map.Entry)doms.next();
                String fileName = (String)entry.getKey();
                EISDOMRecord record = (EISDOMRecord)entry.getValue();

                Writer fileWriter = new FileWriter(fileName);
                record.transformToWriter(fileWriter);
                fileWriter.flush();
                fileWriter.close();
            }
        } catch (Exception exception) {
            throw new ResourceException(exception.toString());
View Full Code Here

Examples of org.eclipse.persistence.eis.EISDOMRecord

     * Return the transactional copy of the file's DOM record.
     * This will be written on commit.
     */
    public EISDOMRecord retrieveDOMRecord(File file) throws Exception {
        // Check for transactional copy.
        EISDOMRecord fileRecord = (EISDOMRecord)this.domFiles.get(file.getPath());
        if (fileRecord == null) {
            // If the file exists parse it, otherwise create a new record.
            if (file.exists()) {
                Reader fileReader = new FileReader(file);
                fileRecord = new EISDOMRecord();
                // Parse file.
                fileRecord.transformFromXML(fileReader);
                fileReader.close();
            } else {
                fileRecord = new EISDOMRecord();
                fileRecord.setDOM(fileRecord.createNewDocument("root"));
            }
            this.domFiles.put(file.getPath(), fileRecord);
        }
        return fileRecord;
    }
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.