本文整理汇总了Java中org.exist.xquery.value.Sequence类的典型用法代码示例。如果您正苦于以下问题:Java Sequence类的具体用法?Java Sequence怎么用?Java Sequence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Sequence类属于org.exist.xquery.value包,在下文中一共展示了Sequence类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: eval
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
@Override
public Sequence eval(final Sequence[] args, final Sequence contextSequence) throws XPathException {
// User must either be DBA or in the correct group
if (!context.getSubject().hasDbaRole() && !context.getSubject().hasGroup(Constants.COUCHBASE_GROUP)) {
final String txt = String.format("Permission denied, user '%s' must be a DBA or be in group '%s'",
context.getSubject().getName(), Constants.COUCHBASE_GROUP);
LOG.error(txt);
throw new XPathException(this, CouchbaseModule.COBA0003, txt);
}
final CouchbaseClusterManager cmm = CouchbaseClusterManager.getInstance();
final MemTreeBuilder builder = context.getDocumentBuilder();
// start root element
final int nodeNr = builder.startElement("", "couchbase", "couchbase", null);
cmm.getClusterConnections().forEach((connection) -> connection.getReport(builder));
builder.endElement();
return builder.getDocument().getNode(nodeNr);
}
开发者ID:weXsol,项目名称:Couchbase,代码行数:25,代码来源:ConnectionReport.java
示例2: eval
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
@Override
public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
TDBIndexWorker worker = (TDBIndexWorker) context.getBroker().getIndexController().getWorkerByIndexId(TDBRDFIndex.ID);
Sequence result = EmptySequence.EMPTY_SEQUENCE;
if (worker == null) {
LOG.error("Unable to access SPARQL index worker");
} else {
String query = "";
if (!args[0].isEmpty()) {
query = args[0].getStringValue();
}
result = worker.query(context, query);
}
return result;
}
开发者ID:ljo,项目名称:exist-sparql,代码行数:18,代码来源:FunSparql.java
示例3: readMARCRecords
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
private Sequence readMARCRecords(final MarcReader aReader) throws XPathException {
final MemTreeBuilder builder = context.getDocumentBuilder();
final DocumentBuilderReceiver receiver = new DocumentBuilderReceiver(builder);
final SAXResult saxResult = new SAXResult(receiver);
final MarcWriter writer = new MarcXmlWriter(saxResult);
writer.setConverter(new AnselToUnicode());
while (aReader.hasNext()) {
final Record record = aReader.next();
final String recordId = record.getControlNumber();
if (LOGGER.isDebugEnabled() && recordId != null) {
LOGGER.debug("Reading MARC record: " + recordId);
}
writer.write(record);
}
writer.close();
return (DocumentImpl) receiver.getDocument();
}
开发者ID:ksclarke,项目名称:freelib-marc4j-exist,代码行数:24,代码来源:ReadFromFile.java
示例4: test01
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
@Test
public void test01() throws EXistException, PermissionDeniedException, XPathException, SAXException, CollectionConfigurationException, LockException, IOException {
configureAndStore(XPROC, "hello.xproc");
try (final DBBroker broker = pool.get(Optional.of(pool.getSecurityManager().getSystemSubject()))) {
final XQuery xquery = pool.getXQueryService();
assertNotNull(xquery);
final Sequence seq = xquery.execute(broker, "xmlcalabash:process('xmldb:exist:///db/test/hello.xproc')", null);
assertNotNull(seq);
assertEquals(1, seq.getItemCount());
final String result = queryResult2String(broker, seq);
System.out.println(result);
}
}
开发者ID:eXist-db,项目名称:xquery-xproc-xmlcalabash-module,代码行数:18,代码来源:Simplest.java
示例5: test02
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
@Test
public void test02() throws EXistException, PermissionDeniedException, XPathException, SAXException {
try (final DBBroker broker = pool.get(Optional.of(pool.getSecurityManager().getSystemSubject()))) {
final XQuery xquery = pool.getXQueryService();
assertNotNull(xquery);
final Sequence seq = xquery.execute(broker,
"xmlcalabash:process(" +
"<p:declare-step version='1.0' xmlns:p='http://www.w3.org/ns/xproc'>" +
" <p:input port='source'>" +
" <p:inline><doc>Helloworld</doc></p:inline>" +
" </p:input>" +
" <p:output port='result'/>" +
" <p:identity/>" +
"</p:declare-step>)",
null);
assertNotNull(seq);
assertEquals(1, seq.getItemCount());
final String result = queryResult2String(broker, seq);
System.out.println(result);
}
}
开发者ID:eXist-db,项目名称:xquery-xproc-xmlcalabash-module,代码行数:24,代码来源:Simplest.java
示例6: store
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
@Test
public void store() throws EXistException, PermissionDeniedException, XPathException, SAXException, CollectionConfigurationException, LockException, IOException {
configureAndStore(STORE, "store.xproc");
try (final DBBroker broker = pool.get(Optional.of(pool.getSecurityManager().getSystemSubject()))) {
final XQuery xquery = pool.getXQueryService();
assertNotNull(xquery);
final Sequence seq = xquery.execute(broker, "xmlcalabash:process('xmldb:exist:///db/test/store.xproc')", null);
assertNotNull(seq);
assertEquals(1, seq.getItemCount());
final String result = queryResult2String(broker, seq);
System.out.println(result);
}
}
开发者ID:eXist-db,项目名称:xquery-xproc-xmlcalabash-module,代码行数:18,代码来源:Simplest.java
示例7: test
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
@Test
public void test() throws CollectionConfigurationException, EXistException, LockException, SAXException, PermissionDeniedException, IOException, XPathException {
configureAndStore(FIRST_XML, "first.xml");
configureAndStore(XPROC, "multiXSL.xproc");
configureAndStore(FIRST_XSL, "first.xsl");
configureAndStore(FINAL_XSL, "final.xsl");
try (final DBBroker broker = pool.get(Optional.of(pool.getSecurityManager().getSystemSubject()))) {
final XQuery xquery = pool.getXQueryService();
assertNotNull(xquery);
final Sequence seq = xquery.execute(broker,
"xmlcalabash:process("
+ "'xmldb:exist:///db/test/multiXSL.xproc',"
+ "(<input type='xml' port='source' url='xmldb:exist:///db/test/first.xml'/>)"
+ ")", null);
assertNotNull(seq);
assertEquals(1, seq.getItemCount());
final String result = queryResult2String(broker, seq);
System.out.println(result);
}
}
开发者ID:eXist-db,项目名称:xquery-xproc-xmlcalabash-module,代码行数:27,代码来源:MultiInputTests.java
示例8: run
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
public Sequence run(final BinaryDocument xq) throws Exception {
try (final DBBroker broker = pool.get(Optional.of(pool.getSecurityManager().getSystemSubject()))) {
assertNotNull(broker);
final XQuery xquery = pool.getXQueryService();
assertNotNull(xquery);
final DBSource source = new DBSource(broker, xq, true);
final XQueryContext context = new XQueryContext(pool);
context.setModuleLoadPath(XmldbURI.EMBEDDED_SERVER_URI.append(xq.getCollection().getURI()).toString());
context.setStaticallyKnownDocuments(new XmldbURI[]{
xq.getCollection().getURI()
});
final CompiledXQuery compiled = xquery.compile(broker, context, source);
return xquery.execute(broker, compiled, null);
}
}
开发者ID:eXist-db,项目名称:xquery-xproc-xmlcalabash-module,代码行数:20,代码来源:ExternalTests.java
示例9: borkenQuery
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
@Test
public void borkenQuery() {
DocumentSet docs = configureAndStore(COLLECTION_CONFIG, XML, "test1.xml");
final BrokerPool pool = existEmbeddedServer.getBrokerPool();
final TransactionManager transact = pool.getTransactionManager();
try (final DBBroker broker = pool.get(Optional.of(pool.getSecurityManager().getSystemSubject()));
final Txn transaction = transact.beginTransaction()) {
XQuery xquery = pool.getXQueryService();
assertNotNull(xquery);
String query = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT $x WHERE {$x a unknownPrefix:asd }";
XPathException expectedException = null;
Sequence seq = null;
try {
seq = xquery.execute(broker, "import module namespace sparql=\"http://exist-db.org/xquery/sparql\"; sparql:query(\"" + query + "\")", null);
} catch (XPathException ex) {
expectedException = ex;
}
assertNotNull(expectedException);
transact.commit(transaction);
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
开发者ID:ljo,项目名称:exist-sparql,代码行数:31,代码来源:RDFIndexTest.java
示例10: eval
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
@Override
public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
if(args[0].isEmpty()) {
return Sequence.EMPTY_SEQUENCE;
}
InputStream inputImage = null;
byte[] outputImage = null;
try {
//get the image data
inputImage = ((BinaryValue) args[0].itemAt(0)).getInputStream();
if (inputImage == null) {
LOGGER.error("Unable to read image data!");
return Sequence.EMPTY_SEQUENCE;
}
outputImage = Convert.convert2ImageFormat(inputImage, "jpg");
if (outputImage != null) {
return BinaryValueFromInputStream.getInstance(context, new Base64BinaryValueType(), new ByteArrayInputStream(outputImage));
}
return Sequence.EMPTY_SEQUENCE;
} catch (IOException | InterruptedException | IM4JavaException ex) {
throw new XPathException(this, ex.getMessage());
}
}
开发者ID:exc-asia-and-europe,项目名称:imagemagick.xq,代码行数:30,代码来源:Convert2JPGFunction.java
示例11: eval
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
@Override
public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
if(args[0].isEmpty()) {
return Sequence.EMPTY_SEQUENCE;
}
InputStream inputImage = null;
byte[] outputImage = null;
try {
//get the image data
inputImage = ((BinaryValue) args[0].itemAt(0)).getInputStream();
if (inputImage == null) {
LOGGER.error("Unable to read image data!");
return Sequence.EMPTY_SEQUENCE;
}
outputImage = Convert.convert2ImageFormat(inputImage, "png");
if (outputImage != null) {
return BinaryValueFromInputStream.getInstance(context, new Base64BinaryValueType(), new ByteArrayInputStream(outputImage));
}
return Sequence.EMPTY_SEQUENCE;
} catch (IOException | InterruptedException | IM4JavaException ex) {
throw new XPathException(this, ex.getMessage());
}
}
开发者ID:exc-asia-and-europe,项目名称:imagemagick.xq,代码行数:30,代码来源:Convert2PNGFunction.java
示例12: eval
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
@Override
public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
if(args[0].isEmpty() || args[1].isEmpty()) {
return Sequence.EMPTY_SEQUENCE;
}
byte[] image = convertWithOptions(((BinaryValue)args[0].itemAt(0)).getInputStream(), ((StringValue) args[1]).toString());
return BinaryValueFromInputStream.getInstance(context, new Base64BinaryValueType(), new ByteArrayInputStream(image));
}
开发者ID:exc-asia-and-europe,项目名称:imagemagick.xq,代码行数:9,代码来源:ConvertFunction.java
示例13: eval
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
@Override
public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
//was an image and a mime-type speficifed
if (args[0].isEmpty()) {
return Sequence.EMPTY_SEQUENCE;
}
InputStream inputImage = null;
try {
//get the image data
inputImage = ((BinaryValue) args[0].itemAt(0)).getInputStream();
if (inputImage == null) {
LOGGER.error("Unable to read image data!");
return Sequence.EMPTY_SEQUENCE;
}
Info info = new Info("-", inputImage, false);
LOGGER.debug("ImageFormat: " + info.getImageFormat());
LOGGER.debug("ImageWidth: " + info.getImageWidth());
LOGGER.debug("ImageHeight: " + info.getImageHeight());
LOGGER.debug("ImageGeometry: " + info.getImageGeometry());
LOGGER.debug("ImageDepth: " + info.getImageDepth());
LOGGER.debug("ImageClass: " + info.getImageClass());
return Sequence.EMPTY_SEQUENCE;
} catch (InfoException e) {
throw new XPathException(this, e.getMessage());
}
}
开发者ID:exc-asia-and-europe,项目名称:imagemagick.xq,代码行数:35,代码来源:InfoFunction.java
示例14: completeExample
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
@Test
public void completeExample() throws XPathException {
Sequence input = getRequiredArgumentsSequence();
input.add(new StringValue("-o"));
input.add(new StringValue("c:\\Temp\\dita\\out"));
input.add(new StringValue("-Dargs.debug=yes"));
input.add(new StringValue("-Dargs.logdir=c:\\Temp\\dita\\log"));
input.add(new StringValue("-Ddita.dir=c:\\Programs\\DITA-OT"));
input.add(new StringValue("-Dclean.temp=yes"));
input.add(new StringValue("-Dbasedir=c:\\Temp\\dita\\base"));
input.add(new StringValue("-temp=c:\\Temp\\dita\\temp"));
Sequence result = RunDitaOTFunction.staticEval(new Sequence[]{ input }, null);
Assert.assertEquals(Sequence.EMPTY_SEQUENCE, result);
}
开发者ID:lagivan,项目名称:exist-dita,代码行数:15,代码来源:RunDitaOTFunctionTest.java
示例15: getRequiredArgumentsSequence
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
private Sequence getRequiredArgumentsSequence() throws XPathException {
Sequence input = new ValueSequence(true);
input.add(new StringValue("-i"));
input.add(new StringValue("c:\\Programs\\DITA-OT\\samples\\taskbook\\installing.dita"));
input.add(new StringValue("-f"));
input.add(new StringValue("pdf"));
return input;
}
开发者ID:lagivan,项目名称:exist-dita,代码行数:9,代码来源:RunDitaOTFunctionTest.java
示例16: eval
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
@Override
public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
String id = args[0].itemAt(0).getStringValue();
Future future = futures.get(id);
if (future == null) throw new XPathException("Unknown task " + id);
return valueOf(future.isCancelled());
}
开发者ID:shabanovd,项目名称:eXecutor,代码行数:8,代码来源:IsCanceled.java
示例17: RunFunction
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
public RunFunction(String id, XQueryContext context, Sequence contextSequence, Expression expr, Item callback) throws XPathException {
this.id = id;
context.setShared(true);
this.context = context.copyContext();
final DBBroker broker = context.getBroker();
db = broker.getDatabase();
subject = broker.getSubject();
this.contextSequence = contextSequence;
this.callback = callback;
//XXX: copy!!! and replace context
//this.expr = expr;
this.r = expr.eval(contextSequence, null);
}
开发者ID:shabanovd,项目名称:eXecutor,代码行数:16,代码来源:RunFunction.java
示例18: eval
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
@Override
public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
String id = args[0].itemAt(0).getStringValue();
Future future = futures.get(id);
if (future == null) throw new XPathException("Unknown task" + id);
return valueOf(future.isDone());
}
开发者ID:shabanovd,项目名称:eXecutor,代码行数:8,代码来源:IsDone.java
示例19: testName
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
@Test
public void testName() throws Exception {
Sequence result = eval("let $a := 'a' return executor:submit(xmldb:store('/db', 'test.xml', <a>{upper-case($a)}</a>))");
assertEquals(1, result.getItemCount());
assertEquals(36, result.itemAt(0).getStringValue().length());
}
开发者ID:shabanovd,项目名称:eXecutor,代码行数:9,代码来源:ExecutorTest.java
示例20: eval
import org.exist.xquery.value.Sequence; //导入依赖的package包/类
private Sequence eval(String query) throws Exception {
try (DBBroker broker = db.get(db.getSecurityManager().getSystemSubject())) {
XQuery xquery = broker.getXQueryService();
return xquery.execute(query, null, AccessContext.TEST);
}
}
开发者ID:shabanovd,项目名称:eXecutor,代码行数:9,代码来源:ExecutorTest.java
注:本文中的org.exist.xquery.value.Sequence类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论