Package org.apache.xindice.core

Examples of org.apache.xindice.core.Collection


        if (!message.containsKey(DOCUMENT)) {
            throw new Exception(MISSING_DOCUMENT_PARAM);
        }

        Collection col = getCollection((String) message.get(COLLECTION));

        Document doc = DOMParser.toDocument((String) message.get(DOCUMENT));
        if (doc == null) {
            throw new Exception("Unable to parse Document");
        }

        String id = (String) message.get(NAME);
        col.setDocument(id, doc);

        Hashtable result = new Hashtable();
        result.put(RESULT, id);
        return result;
    }
View Full Code Here


      Configuration colConfig = config.getChild(COLLECTIONS);
      if ( colConfig != null ) {
         colConfig.processChildren(COLLECTION,
            new ConfigurationCallback() {
               public void process(Configuration cfg) throws XindiceException {
                  Collection col = new Collection((Collection)CollectionManager.this);
                  col.setConfig(cfg);
                  collections.put(col.getName(), col);
               }
         });
      }
   }
View Full Code Here

    */
   public boolean dropCollection(Collection collection) throws DBException  {
      if ( collection == null )
         throw new DBException(FaultCodes.COL_COLLECTION_NOT_FOUND, "Collection Value Null");
           
      Collection cm = collection.getParentCollection();

      if ( cm == null )
         throw new DBException(FaultCodes.DBE_CANNOT_DROP, "You Cannot Drop The Database");
     
      if ( cm != this )
         return cm.dropCollection(collection);
      else {
         String path = collection.getCanonicalName();
         final String name = collection.getName();
         boolean dropped = collection.drop();
         if ( dropped ) {
View Full Code Here

         }
         throw new DBException(FaultCodes.COL_COLLECTION_NOT_FOUND, "Parent Collection '"+path+"' doesn't exist");
      }

      String url = "";
      Collection collection = null;

      if ( CollectionManager.this instanceof Database )
         collection = new Collection((Database)CollectionManager.this);
      else
         collection = new Collection((Collection)CollectionManager.this);
     
      try {
         // Do a name check to see if all is well
         String n = cfg.getAttribute(NAME);
         if ( n == null || n.trim().equals("") )
            throw new DBException(FaultCodes.COL_CANNOT_CREATE, "No name specified");
        
         if ( getCollection(n) != null )
            throw new DBException(FaultCodes.COL_DUPLICATE_COLLECTION, "Duplicate Collection '"+n+"'");

         Configuration colConfig = this.config.getChild(COLLECTIONS, true);
         colConfig.add(cfg);
        
         collection.setConfig(cfg);
         collection.create();
         collections.put(n, collection);
      }
      catch ( DBException d ) {
         throw d;
      }
View Full Code Here

               return XMLOBJECT;
            }
            break;

         case COLLECTION:
            Collection c = col.getCollection(name);
            if ( c != null ) {
               collection = c;
               String tmp = parseName("/(?");
               // If we have another name recurse to handle it.
               if (! tmp.equals("")) {
View Full Code Here

    * @return The requested SymbolTable
    */
   public SymbolTable loadSymbols(Collection collection) throws DBException  {
      String name = getSymbolTableName(collection);

      Collection symCol = getCollection(SYMBOLS);

      SymbolTable symbols = (SymbolTable)symCol.getObject(name);
      if ( symbols == null ) {
         symbols = new SymbolTable();
         saveSymbols(collection, symbols);
      }
      return symbols;
View Full Code Here

    * @param symbols The SymbolTable
    */
   public void saveSymbols(Collection collection, SymbolTable symbols) throws DBException  {
      String name = getSymbolTableName(collection);

      Collection symCol = getCollection(SYMBOLS);

      if ( symbols != null ) {
         symCol.setObject(name, symbols);
         symbols.setDirty(false);
      }
   }
View Full Code Here

            throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION,
                                     FaultCodes.COL_COLLECTION_NOT_FOUND,
                                     MISSING_NAME_PARAM);
        }

        final Collection col = getCollection((String) message.get(COLLECTION));
        if (col == null) {
            // No such collection
            throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION,
                                     FaultCodes.COL_COLLECTION_NOT_FOUND,
                                     "Cannot remove child collection '" + childName + "': Parent collection '" + parentName + "' not found.");
        }

        col.dropCollection(col.getCollection(childName));

        Map result = new HashMap(3);
        result.put(RESULT, "yes");
        return result;
    }
View Full Code Here

            index.setAttribute("pattern", (String) message.get(PATTERN));

            doc.appendChild(index);
        }

        Collection col = getCollection((String) message.get(COLLECTION));
        Configuration config = new Configuration(doc.getDocumentElement(), false);
        col.createIndexer(config);

        Map result = new HashMap(3);
        result.put(RESULT, message.get(NAME));
        return result;
    }
View Full Code Here

        if (!message.containsKey(COLLECTION)) {
            throw new Exception(MISSING_COLLECTION_PARAM);
        }

        Collection col = getCollection((String) message.get(COLLECTION));

        Map result = new HashMap(3);
        result.put(RESULT, col.createNewOID().toString());
        return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.xindice.core.Collection

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.