Search in sources :

Example 16 with IndexQueryService

use of org.exist.xmldb.IndexQueryService in project exist by eXist-db.

the class InteractiveClient method reindex.

private void reindex() throws XMLDBException {
    final IndexQueryService service = (IndexQueryService) current.getService("IndexQueryService", "1.0");
    message("reindexing collection " + current.getName());
    service.reindexCollection();
    messageln("done.");
}
Also used : IndexQueryService(org.exist.xmldb.IndexQueryService)

Example 17 with IndexQueryService

use of org.exist.xmldb.IndexQueryService in project exist by eXist-db.

the class OptimizerTest method initDatabase.

@BeforeClass
public static void initDatabase() throws ClassNotFoundException, IllegalAccessException, InstantiationException, XMLDBException, IOException, URISyntaxException {
    // initialize driver
    Class<?> cl = Class.forName("org.exist.xmldb.DatabaseImpl");
    Database database = (Database) cl.newInstance();
    database.setProperty("create-database", "true");
    DatabaseManager.registerDatabase(database);
    Collection root = DatabaseManager.getCollection(XmldbURI.LOCAL_DB, "admin", "");
    CollectionManagementService service = (CollectionManagementService) root.getService("CollectionManagementService", "1.0");
    testCollection = service.createCollection("test");
    Assert.assertNotNull(testCollection);
    IndexQueryService idxConf = (IndexQueryService) testCollection.getService("IndexQueryService", "1.0");
    idxConf.configureCollection(COLLECTION_CONFIG);
    XMLResource resource = (XMLResource) testCollection.createResource("test.xml", "XMLResource");
    resource.setContent(XML);
    testCollection.storeResource(resource);
    for (final String sampleName : SAMPLES.getShakespeareXmlSampleNames()) {
        resource = (XMLResource) testCollection.createResource(sampleName, XMLResource.RESOURCE_TYPE);
        try (final InputStream is = SAMPLES.getShakespeareSample(sampleName)) {
            resource.setContent(InputStreamUtil.readString(is, UTF_8));
        }
        testCollection.storeResource(resource);
    }
}
Also used : CollectionManagementService(org.xmldb.api.modules.CollectionManagementService) InputStream(java.io.InputStream) Database(org.xmldb.api.base.Database) IndexQueryService(org.exist.xmldb.IndexQueryService) Collection(org.xmldb.api.base.Collection) XMLResource(org.xmldb.api.modules.XMLResource)

Example 18 with IndexQueryService

use of org.exist.xmldb.IndexQueryService in project exist by eXist-db.

the class ValueIndexTest method configureCollection.

/**
 * @throws XMLDBException
 */
protected void configureCollection(String config) throws XMLDBException {
    IndexQueryService idxConf = (IndexQueryService) testCollection.getService("IndexQueryService", "1.0");
    idxConf.configureCollection(config);
}
Also used : IndexQueryService(org.exist.xmldb.IndexQueryService)

Example 19 with IndexQueryService

use of org.exist.xmldb.IndexQueryService in project exist by eXist-db.

the class CollectionTriggerTest method createTestCollection.

@Before
public void createTestCollection() throws XMLDBException {
    // create a test collection
    testCollection = rootSrv.createCollection(TEST_COLLECTION);
    // configure the test collection with the trigger
    IndexQueryService idxConf = (IndexQueryService) testCollection.getService("IndexQueryService", "1.0");
    idxConf.configureCollection(COLLECTION_CONFIG);
}
Also used : IndexQueryService(org.exist.xmldb.IndexQueryService)

Example 20 with IndexQueryService

use of org.exist.xmldb.IndexQueryService in project exist by eXist-db.

the class SAXTriggerTest method saxEventModificationsAtXConf.

@Test
public void saxEventModificationsAtXConf() throws EXistException, XMLDBException {
    final Collection root = DatabaseManager.getCollection(BASE_URI + testCollection, "admin", "");
    final IndexQueryService idxConf = (IndexQueryService) root.getService("IndexQueryService", "1.0");
    idxConf.configureCollection(COLLECTION_CONFIG);
    Resource resource = root.createResource("data.xml", "XMLResource");
    resource.setContent(DOCUMENT2_CONTENT);
    root.storeResource(resource);
    resource = root.createResource("data.xml", "XMLResource");
    assertEquals(DOCUMENT3_CONTENT, resource.getContent().toString());
}
Also used : IndexQueryService(org.exist.xmldb.IndexQueryService) Resource(org.xmldb.api.base.Resource) Collection(org.xmldb.api.base.Collection)

Aggregations

IndexQueryService (org.exist.xmldb.IndexQueryService)25 Collection (org.xmldb.api.base.Collection)9 ResourceSet (org.xmldb.api.base.ResourceSet)9 XMLResource (org.xmldb.api.modules.XMLResource)9 CollectionManagementService (org.xmldb.api.modules.CollectionManagementService)6 XPathQueryService (org.xmldb.api.modules.XPathQueryService)6 EXistCollectionManagementService (org.exist.xmldb.EXistCollectionManagementService)5 EXistResource (org.exist.xmldb.EXistResource)4 Resource (org.xmldb.api.base.Resource)4 BinaryResource (org.xmldb.api.modules.BinaryResource)4 XQueryService (org.xmldb.api.modules.XQueryService)4 InputStream (java.io.InputStream)3 XmldbURI (org.exist.xmldb.XmldbURI)3 Before (org.junit.Before)3 XUpdateQueryService (org.xmldb.api.modules.XUpdateQueryService)2 URISyntaxException (java.net.URISyntaxException)1 UnsupportedLookAndFeelException (javax.swing.UnsupportedLookAndFeelException)1 Account (org.exist.security.Account)1 UserAider (org.exist.security.internal.aider.UserAider)1 StartException (org.exist.start.StartException)1