/** * Specifies the format of the content and returns the handle * as a fluent convenience. * @param format the format of the content * @return this handle */ public InputStreamHandle withFormat(Format format) { setFormat(format); return this; } /**
/** * Specifies the format of the content and returns the handle * as a fluent convenience. * @param format the format of the content * @return this handle */ public InputStreamHandle withFormat(Format format) { setFormat(format); return this; } /**
protected void installModule(String path, String localPath) { InputStreamHandle handle = new InputStreamHandle(HubTestBase.class.getClassLoader().getResourceAsStream(localPath)); String ext = FilenameUtils.getExtension(path); DocumentMetadataHandle permissions = new DocumentMetadataHandle() .withPermission(getHubAdminConfig().getHubRoleName(), DocumentMetadataHandle.Capability.EXECUTE, UPDATE, READ); switch(ext) { case "xml": handle.setFormat(Format.XML); break; case "json": handle.setFormat(Format.JSON); break; default: handle.setFormat(Format.TEXT); } modMgr.write(path, permissions, handle); clearFlowCache(); }
protected void installModules(Map<String, String> modules) { DocumentWriteSet writeSet = modMgr.newWriteSet(); modules.forEach((String path, String localPath) -> { InputStreamHandle handle = new InputStreamHandle(HubTestBase.class.getClassLoader().getResourceAsStream(localPath)); String ext = FilenameUtils.getExtension(path); switch(ext) { case "xml": handle.setFormat(Format.XML); break; case "json": handle.setFormat(Format.JSON); break; default: handle.setFormat(Format.TEXT); } DocumentMetadataHandle permissions = new DocumentMetadataHandle() .withPermission(getHubAdminConfig().getHubRoleName(), DocumentMetadataHandle.Capability.EXECUTE, UPDATE, READ); writeSet.add(path, permissions, handle); }); modMgr.write(writeSet); clearFlowCache(); }
@Test public void evalAndInvokeXQuery() throws ParserConfigurationException, DatatypeConfigurationException, JsonProcessingException, IOException, SAXException { InputStreamHandle xquery = new InputStreamHandle( this.getClass().getClassLoader().getResourceAsStream("evaltest.xqy")); // first read it locally and run it as ad-hoc eval runAndTestXQuery( Common.evalClient.newServerEval().xquery(xquery) ); // run the same code, this time as a module we'll invoke xquery = new InputStreamHandle( this.getClass().getClassLoader().getResourceAsStream("evaltest.xqy")); xquery.setFormat(Format.TEXT); // libMgr is connected with admin privileges (as rest-admin user) libMgr.write("/ext/test/evaltest.xqy", xquery); // now module is installed, let's invoke it runAndTestXQuery( Common.evalClient.newServerEval().modulePath("/ext/test/evaltest.xqy") ); // clean up module we no longer need libMgr.delete("/ext/test/evaltest.xqy"); }
FileInputStream fis = new FileInputStream(file1); InputStreamHandle handle1 = new InputStreamHandle(fis); handle1.setFormat(Format.BINARY);
FileInputStream fis = new FileInputStream(file1); InputStreamHandle handle1 = new InputStreamHandle(fis); handle1.setFormat(Format.BINARY);
fis = new FileInputStream(file1); InputStreamHandle handle1 = new InputStreamHandle(fis); handle1.setFormat(Format.BINARY); docMgr.write("/binary4mbdoc", handle1); String query = "declare variable $myInteger as xs:integer external;"
FileInputStream fis = new FileInputStream(file1); InputStreamHandle handle1 = new InputStreamHandle(fis); handle1.setFormat(Format.BINARY);
FileInputStream fis = new FileInputStream(file1); InputStreamHandle handle1 = new InputStreamHandle(fis); handle1.setFormat(Format.BINARY);