Package org.exist.xmldb

Examples of org.exist.xmldb.IndexQueryService


                System.out.println("Element occurrences in collection "
                        + current.getName());
                System.out
                        .println("--------------------------------------------"
                        + "-----------");
                final IndexQueryService service = (IndexQueryService) current
                        .getService("IndexQueryService", "1.0");
                final Occurrences[] elements = service.getIndexedElements(true);
                for (int i = 0; i < elements.length; i++) {
                    System.out
                            .println(formatString(elements[i].getTerm().toString(),
                            Integer.toString(elements[i]
                            .getOccurrences()), 50));
                }
                return true;
               
            } else if (args[0].equalsIgnoreCase("terms")) {
                if (args.length < 3) {
                    System.out
                            .println("Usage: terms [xpath] sequence-start sequence-end");
                    return true;
                }
                final IndexQueryService service = (IndexQueryService) current
                        .getService("IndexQueryService", "1.0");
                Occurrences[] terms;
                if (args.length == 3) {
                    terms = service.scanIndexTerms(args[1], args[2], true);
                } else {
                    terms = service.scanIndexTerms(args[1], args[2], args[3]);
                }
                System.out.println("Element occurrences in collection " + current.getName());
                System.out.println("-------------------------------------------------------");
                for (int i = 0; i < terms.length; i++) {
                    System.out.println(formatString(terms[i].getTerm().toString(), Integer.toString(terms[i].getOccurrences()), 50));
                }
            } else if (args[0].equalsIgnoreCase("xupdate")) {
                if (startGUI) {
                    messageln("command not supported in GUI mode.");
                    return true;
                }
                String lastLine, command = "";
                try {
                    while (true) {
                        lastLine = console.readLine("| ");
                        if (lastLine == null || lastLine.length() == 0) {
                            break;
                        }
                        command += lastLine;
                    }
                } catch (final EOFException e) {
                    //TODO report error?
                } catch (final IOException e) {
                    //TODO report error?
                }
                final String xupdate = "<xu:modifications version=\"1.0\" "
                        + "xmlns:xu=\"http://www.xmldb.org/xupdate\">"
                        + command + "</xu:modifications>";
                final XUpdateQueryService service = (XUpdateQueryService) current
                        .getService("XUpdateQueryService", "1.0");
                final long mods = service.update(xupdate);
                System.out.println(mods + " modifications processed.");
               
            } else if (args[0].equalsIgnoreCase("map")) {
                final StringTokenizer tok = new StringTokenizer(args[1], "= ");
                final String prefix;
View Full Code Here


            mgtService.copy(source, destination, destName);
        }
    }
   
    private void reindex() throws XMLDBException {
        final IndexQueryService service = (IndexQueryService)
        current.getService("IndexQueryService", "1.0");
        message("reindexing collection " + current.getName());
        service.reindexCollection();
        messageln("done.");
    }
View Full Code Here

  }
 
  protected void setUp() {
    try {
      super.setUp();   
      IndexQueryService idxConf = (IndexQueryService)
        getTestCollection().getService("IndexQueryService", "1.0");
      assertNotNull(idxConf);
      idxConf.configureCollection(CONFIG);     
      String[] wordList = DBUtils.wordList(rootCol);
      assertNotNull(wordList);
      tempFile = DBUtils.generateXMLFile(500, 10, wordList);
      DBUtils.addXMLResource(getTestCollection(), "R1.xml", tempFile);
     
View Full Code Here

            {
              public void run()
              {
                try
                        {
                  IndexQueryService service = (IndexQueryService)client.current.getService("IndexQueryService", "1.0");
                 
                  ArrayList subCollections = getCollections(client.getCollection((String)cmbCollections.getSelectedItem()), new ArrayList());
                 
                            for(int i = 0; i < subCollections.size(); i++)
                            {
                              service.reindexCollection(((ResourceDescriptor)subCollections.get(i)).getName());
                            }
                           
                            //reindex done
                            JOptionPane.showMessageDialog(getContentPane(), "Reindex Complete");
                        }
View Full Code Here

     */
    protected void setUp() {
        try {
            rootCol = DBUtils.setupDB(rootColURI);
            assertNotNull(rootCol);
            IndexQueryService idxConf = (IndexQueryService) rootCol.getService("IndexQueryService", "1.0");
            idxConf.configureCollection(COLLECTION_CONFIG);
            testCol = rootCol.getChildCollection(testColName);
            if (testCol != null) {
                CollectionManagementService mgr = DBUtils.getCollectionManagementService(rootCol);
                mgr.removeCollection(testColName);
            }
View Full Code Here

    @Test
    public void storeDocument() {
        try {
            Collection root = DatabaseManager.getCollection(BASE_URI + testCollection, "admin", "");
            IndexQueryService iqs = (IndexQueryService) root.getService("IndexQueryService", "1.0");
            iqs.configureCollection(COLLECTION_CONFIG);
           
            Resource resource = root.createResource("data.xml", "XMLResource");
            resource.setContent(DOCUMENT_CONTENT);
            root.storeResource(resource);
            printMessages();
View Full Code Here

    @Test
    public void removeDocument() {
        try {
            Collection root = DatabaseManager.getCollection(BASE_URI + testCollection, "admin", "");
            IndexQueryService iqs = (IndexQueryService) root.getService("IndexQueryService", "1.0");
            iqs.configureCollection(COLLECTION_CONFIG);

            Resource resource = root.createResource("data.xml", "XMLResource");
            resource.setContent(DOCUMENT_CONTENT);
            root.storeResource(resource);
View Full Code Here

    @Test
    public void removeTriggers() {
        try {
            Collection root = DatabaseManager.getCollection(BASE_URI + testCollection, "admin", "");
            IndexQueryService iqs = (IndexQueryService) root.getService("IndexQueryService", "1.0");
            iqs.configureCollection(EMPTY_COLLECTION_CONFIG);

            Resource resource = root.createResource("data.xml", "XMLResource");
            resource.setContent(DOCUMENT_CONTENT);
            root.storeResource(resource);
View Full Code Here

    @Test
    public void updateTriggers() {
        try {
            Collection root = DatabaseManager.getCollection(BASE_URI + testCollection, "admin", "");
            IndexQueryService iqs = (IndexQueryService) root.getService("IndexQueryService", "1.0");
            iqs.configureCollection(EMPTY_COLLECTION_CONFIG);

            Collection configCol =  DatabaseManager.getCollection(BASE_URI + "/db/system/config" + testCollection, "admin", null);
            Resource resource = configCol.createResource("collection.xconf", "XMLResource");
            resource.setContent(COLLECTION_CONFIG);
            configCol.storeResource(resource);
View Full Code Here

    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);
    }
View Full Code Here

TOP

Related Classes of org.exist.xmldb.IndexQueryService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.