Search in sources :

Example 16 with XUpdateQueryService

use of org.xmldb.api.modules.XUpdateQueryService in project exist by eXist-db.

the class ConcurrencyTest method xupdateDocs.

private void xupdateDocs(final String collectionName) throws XMLDBException, IOException, URISyntaxException {
    storeDocs(collectionName);
    final EXistXQueryService xqs = (EXistXQueryService) test.getService("XQueryService", "1.0");
    ResourceSet result = xqs.query("//SPEECH[ft:query(SPEAKER, 'juliet')]");
    assertEquals(118, result.getSize());
    final String xupdate = LuceneIndexTest.XUPDATE_START + "   <xu:remove select=\"//SPEECH[ft:query(SPEAKER, 'juliet')]\"/>" + LuceneIndexTest.XUPDATE_END;
    final XUpdateQueryService xuqs = (XUpdateQueryService) test.getService("XUpdateQueryService", "1.0");
    xuqs.update(xupdate);
    result = xqs.query("//SPEECH[ft:query(SPEAKER, 'juliet')]");
    assertEquals(0, result.getSize());
    result = xqs.query("//SPEECH[ft:query(LINE, 'king')]");
    assertEquals(98, result.getSize());
}
Also used : EXistXQueryService(org.exist.xmldb.EXistXQueryService) XUpdateQueryService(org.xmldb.api.modules.XUpdateQueryService) ResourceSet(org.xmldb.api.base.ResourceSet)

Example 17 with XUpdateQueryService

use of org.xmldb.api.modules.XUpdateQueryService in project exist by eXist-db.

the class RemoveAppendAction method execute.

@Override
public boolean execute() throws XMLDBException, IOException {
    final Collection col = DatabaseManager.getCollection(collectionPath, "admin", "");
    final XUpdateQueryService service = (XUpdateQueryService) col.getService("XUpdateQueryService", "1.0");
    append(service);
    remove(service);
    return true;
}
Also used : XUpdateQueryService(org.xmldb.api.modules.XUpdateQueryService) Collection(org.xmldb.api.base.Collection)

Example 18 with XUpdateQueryService

use of org.xmldb.api.modules.XUpdateQueryService in project exist by eXist-db.

the class ValueAppendAction method execute.

@Override
public boolean execute() throws XMLDBException {
    final Collection col = DatabaseManager.getCollection(collectionPath, "admin", "");
    final XUpdateQueryService service = (XUpdateQueryService) col.getService("XUpdateQueryService", "1.0");
    final XPathQueryService query = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    append(service);
    query(query);
    remove(service);
    return true;
}
Also used : XUpdateQueryService(org.xmldb.api.modules.XUpdateQueryService) XPathQueryService(org.xmldb.api.modules.XPathQueryService) Collection(org.xmldb.api.base.Collection)

Example 19 with XUpdateQueryService

use of org.xmldb.api.modules.XUpdateQueryService in project exist by eXist-db.

the class AttributeUpdateAction method execute.

@Override
public boolean execute() throws XMLDBException {
    final Collection col = DatabaseManager.getCollection(collectionPath, "admin", "");
    final XUpdateQueryService service = (XUpdateQueryService) col.getService("XUpdateQueryService", "1.0");
    final int attrSize = rand.nextInt(5);
    for (int i = 0; i < 10; i++) {
        final String xupdate = XUPDATE_START + xmlGenerator.generateText(attrSize) + XUPDATE_END;
        long mods = service.update(xupdate);
    }
    return true;
}
Also used : XUpdateQueryService(org.xmldb.api.modules.XUpdateQueryService) Collection(org.xmldb.api.base.Collection)

Aggregations

XUpdateQueryService (org.xmldb.api.modules.XUpdateQueryService)19 XPathQueryService (org.xmldb.api.modules.XPathQueryService)8 Collection (org.xmldb.api.base.Collection)6 ResourceSet (org.xmldb.api.base.ResourceSet)6 XMLResource (org.xmldb.api.modules.XMLResource)3 EXistCollectionManagementService (org.exist.xmldb.EXistCollectionManagementService)2 IndexQueryService (org.exist.xmldb.IndexQueryService)2 Test (org.junit.Test)2 Resource (org.xmldb.api.base.Resource)2 XMLDBException (org.xmldb.api.base.XMLDBException)2 StringWriter (java.io.StringWriter)1 URISyntaxException (java.net.URISyntaxException)1 Properties (java.util.Properties)1 UnsupportedLookAndFeelException (javax.swing.UnsupportedLookAndFeelException)1 TransformerException (javax.xml.transform.TransformerException)1 BuildException (org.apache.tools.ant.BuildException)1 Account (org.exist.security.Account)1 UserAider (org.exist.security.internal.aider.UserAider)1 StartException (org.exist.start.StartException)1 DOMSerializer (org.exist.util.serializer.DOMSerializer)1