Examples of CollectionManager


Examples of org.apache.xindice.client.xmldb.services.CollectionManager

            System.out.println("ERROR : Collection not found!");
            return false;
         }
                
         // Create a collection manager instance for the parent of the collection
         CollectionManager colman = (CollectionManager)col.getService("CollectionManager",XMLDBAPIVERSION);
           
         String[] idx = colman.listIndexers();

         System.out.println("Indexes:\n");

         for(int i = 0; i < idx.length; i++) {
            System.out.println(idx[i]);
View Full Code Here

Examples of org.apache.xindice.client.xmldb.services.CollectionManager

                 System.out.println("ERROR : Collection not found!");
                 return false;
              }

              // Create a collection manager instance for the collection
              CollectionManager colman = (CollectionManager)col.getService("CollectionManager",XMLDBAPIVERSION);

              if (table.get(XMLTools.NAME_OF) != null) {
                 colman.dropIndexer((String)table.get(XMLTools.NAME_OF));
                 System.out.println("DELETED: " + (String)table.get(XMLTools.NAME_OF));
              }
              else {
                 System.out.println("ERROR : Name switch and Indexer name required");
              }
View Full Code Here

Examples of org.apache.xindice.client.xmldb.services.CollectionManager

                  System.out.println("ERROR : Collection not found!");
                  return false;
                }
                   
                // Create a collection manager instance for the collection
                CollectionManager colman = (CollectionManager)col.getService("CollectionManager",XMLDBAPIVERSION);
   
                if (table.get(XMLTools.NAME_OF) != null && table.get(XMLTools.PATTERN) != null ) {
               
                    Document doc = new DocumentImpl();

                    // Create the index element to hold attributes
                    Element idxEle = doc.createElement("index");
                    idxEle.setAttribute("class", XINDICE_VAL_INDEXER);
                    idxEle.setAttribute("name", (String)table.get(XMLTools.NAME_OF));
                    idxEle.setAttribute("pattern", (String)table.get(XMLTools.PATTERN) );


                    // Setup optional index attributes
                    if ( table.containsKey(XMLTools.TYPE) ) {
                        String t = (String)table.get(XMLTools.TYPE);
                        if ( t.equalsIgnoreCase("name") )
                           idxEle.setAttribute("class", XINDICE_NAME_INDEXER);
                        else
                           idxEle.setAttribute("type", (String)table.get(XMLTools.TYPE));
                    }

                    if ( table.containsKey(XMLTools.PAGE_SIZE) ) {
                        idxEle.setAttribute("pagesize", (String)table.get(XMLTools.PAGE_SIZE));
                    }

                    if (table.containsKey(XMLTools.MAX_KEY_SIZE) ) {
                        idxEle.setAttribute("maxkeysize", (String)table.get(XMLTools.MAX_KEY_SIZE) );
                    }

                    // Add Element to the document
                    doc.appendChild(idxEle);
                       
                    //If in verbose mode, show....
                    if ( (String)table.get(XMLTools.VERBOSE) == "true" ) {
                        String indexstr = TextWriter.toString(doc);
                        System.out.println("Index node element = ");
                        System.out.println("\t" + indexstr + "\n" );
                    }
                   

                    // Create the indexer for this collection manager
                    colman.createIndexer(doc);

                    System.out.println("CREATED : " + table.get(XMLTools.NAME_OF));
                   
                }
                else {
View Full Code Here

Examples of org.apache.xindice.client.xmldb.services.CollectionManager

   public Collection createCollection(String path,
                                      String name)
         throws Exception {
      Collection col = DatabaseManager.getCollection(driver + "/" + path);
      CollectionManager service = (CollectionManager) col.getService("CollectionManager", "1.0");

      String collectionConfig = "<collection compressed=\"true\" name=\"" + name + "\">" +
            "   <filer class=\"org.apache.xindice.core.filer.BTreeFiler\" gzip=\"true\"/>" +
            "</collection>";
      return service.createCollection(name, DOMParser.toDocument(collectionConfig));
   }
View Full Code Here

Examples of org.apache.xindice.client.xmldb.services.CollectionManager

   public void dropCollection(String path,
                              String name)
         throws Exception {
      Collection col = DatabaseManager.getCollection(driver + "/" + path);
      CollectionManager service = (CollectionManager) col.getService("CollectionManager", "1.0");

      service.dropCollection(name);
   }
View Full Code Here

Examples of org.apache.xindice.client.xmldb.services.CollectionManager

   public void createIndexer(String path,
                             String name,
                             String indexdef)
         throws Exception {
      Collection col = DatabaseManager.getCollection(driver + "/" + path);
      CollectionManager service = (CollectionManager) col.getService("CollectionManager", "1.0");

      service.createIndexer(DOMParser.toDocument(indexdef));
   }
View Full Code Here

Examples of org.apache.xindice.client.xmldb.services.CollectionManager

   }

   public String[] listIndexes(String path)
         throws Exception {
      Collection col = DatabaseManager.getCollection(driver + "/" + path);
      CollectionManager service = (CollectionManager) col.getService("CollectionManager", "1.0");

      return service.listIndexers();
   }
View Full Code Here

Examples of org.apache.xindice.client.xmldb.services.CollectionManager

   public void dropIndexer(String path,
                           String name)
         throws Exception {
      Collection col = DatabaseManager.getCollection(driver + "/" + path);
      CollectionManager service = (CollectionManager) col.getService("CollectionManager", "1.0");

      service.dropIndexer(name);
   }
View Full Code Here

Examples of org.apache.xindice.client.xmldb.services.CollectionManager

                    System.out.println("ERROR : Collection not found!");
                    return false;
                }

                // Create a collection manager instance for the parent of the collection
                CollectionManager colman = (CollectionManager) col.getService("CollectionManager", XMLDBAPIVERSION);

                // Drop the collection
                colman.dropCollection((String) table.get(XMLTools.NAME_OF));

                System.out.println("Deleted: " + table.get(XMLTools.COLLECTION) + "/" + (String) table.get(XMLTools.NAME_OF));
            } else
                System.out.println("Error : Collection Context and Name required");
View Full Code Here

Examples of org.apache.xindice.client.xmldb.services.CollectionManager

//      collection = getCollection("xmldb:xindice:///db/");
      collection = getCollection("xmldb:xindice://localhost:8888/db/");
//      collection = getCollection("xmldb:xindice-embed:///db/");

      CollectionManager service = (CollectionManager) collection.getService("CollectionManager", "1.0");

      try{
        service.dropCollection(COLLECTION_NAME);
        System.out.println("Dropped existing collection with name: " + COLLECTION_NAME);
      }
      catch (Exception e) {
                ; // nothing, this may be the first pass.
            }

      // Build up the Collection XML configuration.
      String collectionConfig =
        "<collection compressed=\"true\" name=\""
          + COLLECTION_NAME
          + "\">"
          + "   <filer class=\"org.apache.xindice.core.filer.BTreeFiler\" gzip=\"true\"/>"
          + "</collection>";

      service.createCollection(COLLECTION_NAME, DOMParser.toDocument(collectionConfig));

      System.out.println("Collection " + COLLECTION_NAME + " created.");
    }
    catch (XMLDBException e) {
      System.err.println("XML:DB Exception occured " + e.errorCode + " " + e.getMessage());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.