/** * 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; }
/** * Execute the interaction and set the output into the output record. * Return true or false if the execute returned data (similar to row-count). */ @Override 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; }
/** * 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; } }
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){ try{ setDOM((Element)AccessController.doPrivileged(new PrivilegedMethodInvoker(domMethod, record, null))); }catch (PrivilegedActionException ex){ throw (Exception)ex.getCause(); setDOM((Element)PrivilegedAccessHelper.invokeMethod(domMethod, record, null));
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){ try{ setDOM((Element)AccessController.doPrivileged(new PrivilegedMethodInvoker(domMethod, record, null))); }catch (PrivilegedActionException ex){ throw (Exception)ex.getCause(); setDOM((Element)PrivilegedAccessHelper.invokeMethod(domMethod, record, null));
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){ try{ setDOM((Element)AccessController.doPrivileged(new PrivilegedMethodInvoker(domMethod, record, null))); }catch (PrivilegedActionException ex){ throw (Exception)ex.getCause(); setDOM((Element)PrivilegedAccessHelper.invokeMethod(domMethod, record, null));
/** * 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; } }