Package org.apache.xindice.core

Examples of org.apache.xindice.core.Collection


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

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

        col.remove(message.get(NAME));

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


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

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

        col.dropIndexer(col.getIndexer((String) message.get(NAME)));

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

    protected static String getHierarchy(XPathPseudoParser parser, String contextPath, Database db) throws DBException, Exception {
        StringBuffer result = new StringBuffer();

        String path = parser.getPath();

        Collection col;
        if (!path.equals("")) {
            col = db.getCollection(parser.getPath());
        } else {
            col = db;
        }

        if (col == null) {
            result.append("Collection not found! " + parser.getPath());
            return result.toString();
        }

        String[] cols = col.listCollections();
        String dbLoc = parser.getDatabase();
        String parserPath = parser.getPath();
        StringBuffer baseHref = new StringBuffer();
        baseHref.append("<a href=\"" + contextPath + "/?/" + dbLoc);
        if(parserPath.startsWith("/") || dbLoc.endsWith("/")) {
            baseHref.append(parserPath);
        } else {
            baseHref.append("/" + parserPath);
        }

        for (int i = 0; i < cols.length; i++) {
            result.append(baseHref);
            if(!baseHref.toString().endsWith("/")) {
                result.append("/");
            }
            result.append(cols[i]);
            result.append("\">");
            result.append(cols[i]);
            result.append("</a><br>");
        }

        try {
            String[] docs = col.listDocuments();
            for (int i = 0; i < docs.length; i++) {
                result.append(baseHref);
                result.append("&");
                result.append(docs[i]);
                result.append("\">");
View Full Code Here

        return result.toString();
    }

    protected static String getDetailView(XPathPseudoParser parser, Database db) throws Exception {
        Collection col = db.getCollection(parser.getPath());

        String document = parser.getDocument();
        if (document == null) {
            return "";
        }

        Document doc = col.getDocument(document);
        if (doc == null) {
            return "Document '" + document + "' not found";
        }

        return "Document '" + document + "'<p>\n"
View Full Code Here

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

        Collection col = getCollection((String) message.get(COLLECTION));
        String[] cols = col.listCollections();

        Vector list = new Vector();
        for (int i = 0; (cols != null) && (i < cols.length); i++) {
            list.addElement(cols[i]);
        }
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, new Integer((int) col.getDocumentCount()));
        return result;
    }
View Full Code Here

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

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

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

        if (!message.containsKey(META)) {
            throw new Exception(MISSING_META_PARAM);
        }

        String collection = (String) message.get(COLLECTION);
        Collection col = getCollection(collection);
        Hashtable result = new Hashtable();
        if (!col.isMetaEnabled()) {
            // meta information is not enabled !
            throw new Exception(MISSING_META_CONFIGURATION);
        }

        // Read and store sent meta data
        MetaData meta = new MetaData();
        Document doc = DOMParser.toDocument((String) message.get(META));
        meta.streamFromXML(doc.getDocumentElement());
        col.setCollectionMeta(meta);

        // Retreive stored meta data and sent back
        meta = col.getCollectionMeta();
        doc = new DocumentImpl();
        doc.appendChild(meta.streamToXML(doc, true));
        result.put(RESULT, TextWriter.toString(doc));
        return result;
    }
View Full Code Here

            throw new Exception(MISSING_META_PARAM);
        }

        String collection = (String) message.get(COLLECTION);
        String docname = (String) message.get(NAME);
        Collection col = getCollection(collection);
        Hashtable result = new Hashtable();
        if (!col.isMetaEnabled()) {
            // meta information is not enabled !
            throw new Exception(MISSING_META_CONFIGURATION);
        }

        // Read and store sent meta data
        MetaData meta = new MetaData();
        Document doc = DOMParser.toDocument((String) message.get(META));
        meta.streamFromXML(doc.getDocumentElement());
        col.setDocumentMeta(docname, meta);

        // Retreive stored meta data and sent back
        meta = col.getDocumentMeta(docname);
        doc = new DocumentImpl();
        meta.streamToXML(doc, true);
        result.put(RESULT, TextWriter.toString(doc));
        return result;
    }
View Full Code Here

* @version $Revision: 511426 $, $Date: 2007-02-24 22:25:02 -0500 (Sat, 24 Feb 2007) $
*/
public class GetCollectionCount extends RPCDefaultMessage {

    public Hashtable execute(Hashtable message) throws Exception {
        Collection col = getCollection((String) message.get(COLLECTION));

        Hashtable result = new Hashtable();
        result.put(RESULT, new Integer((int) col.countCollections()));
        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.