Package org.apache.xindice.core

Examples of org.apache.xindice.core.Collection


     *
     * @param message the parameters passed to the xmlrpc method.
     * @return Hashtable containing the XML for the requested MetaData object.
     */
    public Hashtable execute(Hashtable message) throws Exception {
        Collection col = getCollection((String) message.get(COLLECTION));
        Hashtable result = new Hashtable();
        if (!col.isMetaEnabled()) {
            // meta information is not enabled !
            throw new Exception(MISSING_META_CONFIGURATION);
        }
        MetaData meta = col.getCollectionMeta();
        Document doc = new DocumentImpl();
        doc.appendChild(meta.streamToXML(doc, true));

        result.put(RESULT, TextWriter.toString(doc));
        return result;
View Full Code Here


     *
     * @param message the parameters passed to the xmlrpc method.
     * @return Hashtable containing the XML for the requested MetaData object.
     */
    public Hashtable execute(Hashtable message) throws Exception {
        Collection col = getCollection((String) message.get(COLLECTION));
        Hashtable result = new Hashtable();
        if (!col.isMetaEnabled()) {
            // meta information is not enabled !
            throw new Exception(MISSING_META_CONFIGURATION);
        }

        if (!message.containsKey(NAME)) {
            throw new Exception(MISSING_NAME_PARAM);
        }
        String docname = (String) message.get(NAME);
        MetaData meta = col.getDocumentMeta(docname);
        Document doc = new DocumentImpl();
        doc.appendChild(meta.streamToXML(doc, true));

        result.put(RESULT, TextWriter.toString(doc));
        return result;
View Full Code Here

        String id = (String) message.get(NAME);
        if ("".equals(id)) {
            id = null;
        }

        Collection col = getCollection((String) message.get(COLLECTION));
        if (obj instanceof byte[]) {
            id = col.insertBinary(id, (byte[])obj).toString();
        } else {
            Document doc = DOMParser.toDocument((String) obj);
            id = col.insertDocument(id, doc).toString();
        }

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

            throw new Exception(MISSING_COLLECTION_PARAM);
        }

        Hashtable result = new Hashtable();
        try {
            Collection col = getCollection((String) message.get(COLLECTION));
            if (col == null) {
                // No such collection
                result.put(RESULT, "no");
            } else {
                Indexer idx = col.getIndexer((String) message.get(NAME));
                if (idx != null) {
                    result.put(RESULT, "yes");
                } else {
                    result.put(RESULT, "no");
                }
View Full Code Here

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

        Collection col = getCollection((String) message.get(COLLECTION));
        String[] list = col.listIndexers();

        Vector indexers = new Vector();
        for (int i = 0; (list != null) && (i < list.length); i++) {
            indexers.addElement(list[i]);
        }
View Full Code Here

        if (!message.containsKey(NAME)) {
            throw new Exception(MISSING_NAME_PARAM);
        }

        Collection col = getCollection((String) message.get(COLLECTION));
        Object obj = col.getEntry(message.get(NAME));

        Hashtable result = new Hashtable();
        if (obj == null) {
            // Return empty result
        } else if (obj instanceof byte[]) {
            // Binary resource
            result.put(RESULT, obj);
        } else if (message.containsKey(COMPRESSED)) {
            SymbolSerializer symbolSerializer = null;
            try {
                symbolSerializer = new SymbolSerializer(col.getSymbols());
            } catch (Exception e) {
                // It's ok (in theory) for a Collection to have no symbol table
                if (log.isWarnEnabled()) {
                    log.warn("ignored exception", e);
                }
View Full Code Here

        final String query = (String) message.get(QUERY);
        if (query == null) {
            throw new Exception(MISSING_QUERY_PARAM);
        }

        Collection col = getCollection((String) message.get(COLLECTION));
        NamespaceMap nsMap = QueryUtil.mapNamespaces((Hashtable) message.get(NAMESPACES));

        NodeSet ns;
        if (message.containsKey(NAME)) {
            ns = col.queryDocument(type, query, nsMap, message.get(NAME));
        } else {
            ns = col.queryCollection(type, query, nsMap);
        }

        Hashtable result = new Hashtable();
        result.put(RESULT, QueryUtil.queryResultsToString(ns));
        return result;
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.");
        }

        final Hashtable result = new Hashtable();
        col.dropCollection(col.getCollection(childName));
        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);

        Hashtable result = new Hashtable();
        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));

        Hashtable result = new Hashtable();
        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.