/** * 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; } }
/** * 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; } }
/** * Allow the platform to handle the creation of the Record for the DOM record. * Translate the indexed record text into a DOM record. */ public AbstractRecord createDatabaseRowFromDOMRecord(Record record, EISInteraction call, EISAccessor accessor) { IndexedRecord indexedRecord = (IndexedRecord)record; if (indexedRecord.size() == 0) { return null; } EISDOMRecord domRecord = new EISDOMRecord(); // the record is assumed to contain either: // - a TextMessage object if a converter was not defined // - a string of XML if a converter was defined Object recordData = indexedRecord.get(0); if (recordData instanceof TextMessage) { try { domRecord.transformFromXML(((TextMessage)recordData).getText()); } catch (Exception ex) { return null; } } else if (recordData instanceof String) { domRecord.transformFromXML((String)recordData); } else { throw EISException.unsupportedMessageInOutputRecord(); } return domRecord; } }
/** * Allow the platform to handle the creation of the Record for the DOM record. * Translate the indexed record text into a DOM record. */ public AbstractRecord createDatabaseRowFromDOMRecord(Record record, EISInteraction call, EISAccessor accessor) { IndexedRecord indexedRecord = (IndexedRecord)record; if (indexedRecord.size() == 0) { return null; } EISDOMRecord domRecord = new EISDOMRecord(); // the record is assumed to contain either: // - a TextMessage object if a converter was not defined // - a string of XML if a converter was defined Object recordData = indexedRecord.get(0); if (recordData instanceof TextMessage) { try { domRecord.transformFromXML(((TextMessage)recordData).getText()); } catch (Exception ex) { return null; } } else if (recordData instanceof String) { domRecord.transformFromXML((String)recordData); } else { throw EISException.unsupportedMessageInOutputRecord(); } return domRecord; } }