/** * INTERNAL: * Allow the platform to handle the creation of the Record for the DOM record. * By default instantiate an EISDOMRecord which introspects the record for a getDOM method. */ public AbstractRecord createDatabaseRowFromDOMRecord(Record record, EISInteraction call, EISAccessor accessor) { return new EISDOMRecord(record); }
/** * INTERNAL: * Allow the platform to handle the creation of the Record for the DOM record. * By default instantiate an EISDOMRecord which introspects the record for a getDOM method. */ public AbstractRecord createDatabaseRowFromDOMRecord(Record record, EISInteraction call, EISAccessor accessor) { return new EISDOMRecord(record); }
/** * INTERNAL: * Allow the platform to handle the creation of the Record for the DOM record. * By default instantiate an EISDOMRecord which introspects the record for a getDOM method. */ public AbstractRecord createDatabaseRowFromDOMRecord(Record record, EISInteraction call, EISAccessor accessor) { return new EISDOMRecord(record); }
/** * INTERNAL: * Build the nested record, this can be overwriten by subclasses to use their subclass instance. */ public XMLRecord buildNestedRow(Element element) { if (getRecord() != null) { return new EISDOMRecord(getRecord(), element); } else { return new EISDOMRecord(element); } } }
/** * INTERNAL: * Build the nested record, this can be overwriten by subclasses to use their subclass instance. */ public XMLRecord buildNestedRow(Element element) { if (getRecord() != null) { return new EISDOMRecord(getRecord(), element); } else { return new EISDOMRecord(element); } } }
public MappedRecord createMappedRecord(String recordName) { EISDOMRecord record = new EISDOMRecord(); record.setRecordName(recordName); return record; } }
/** * INTERNAL: * Build the nested record, this can be overwriten by subclasses to use their subclass instance. */ public XMLRecord buildNestedRow(Element element) { if (getRecord() != null) { return new EISDOMRecord(getRecord(), element); } else { return new EISDOMRecord(element); } } }
public MappedRecord createMappedRecord(String recordName) { EISDOMRecord record = new EISDOMRecord(); record.setRecordName(recordName); return record; } }
/** * 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; } }
/** * Return the string for logging purposes. */ public String getLogString(Accessor accessor) { StringWriter writer = new StringWriter(); writer.write("Executing "); writer.write(toString()); writer.write(Helper.cr()); writer.write("\tspec => "); writer.write(String.valueOf(getInteractionSpec())); writer.write(Helper.cr()); writer.write("\tproperties => "); writer.write(String.valueOf(getProperties())); writer.write(Helper.cr()); writer.write("\txml => "); Element dom = createInputDOM((EISAccessor)accessor); EISDOMRecord record = new EISDOMRecord(dom); record.transformToWriter(writer); return writer.toString(); }
/** * Return the string for logging purposes. */ public String getLogString(Accessor accessor) { StringWriter writer = new StringWriter(); writer.write("Executing "); writer.write(toString()); writer.write(Helper.cr()); writer.write("\tspec => "); writer.write(String.valueOf(getInteractionSpec())); writer.write(Helper.cr()); writer.write("\tproperties => "); writer.write(String.valueOf(getProperties())); writer.write(Helper.cr()); writer.write("\txml => "); Element dom = createInputDOM((EISAccessor)accessor); EISDOMRecord record = new EISDOMRecord(dom); record.transformToWriter(writer); return writer.toString(); }
/** * Return the string for logging purposes. */ public String getLogString(Accessor accessor) { StringWriter writer = new StringWriter(); writer.write("Executing "); writer.write(toString()); writer.write(Helper.cr()); writer.write("\tspec => "); writer.write(String.valueOf(getInteractionSpec())); writer.write(Helper.cr()); writer.write("\tproperties => "); writer.write(String.valueOf(getProperties())); writer.write(Helper.cr()); writer.write("\txml => "); Element dom = createInputDOM((EISAccessor)accessor); EISDOMRecord record = new EISDOMRecord(dom); record.transformToWriter(writer); return writer.toString(); }
/** * 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; } }
/** * Execute the read operation. */ 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")); 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; } }
EISDOMRecord output = new EISDOMRecord(); if (result instanceof List) { List results = (List)result;