Package org.apache.xindice.core

Examples of org.apache.xindice.core.Collection


    * @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 Exception(MISSING_COLLECTION_PARAM);
        }

        Map result = new HashMap(3);
        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 (db == null) {
                throw new XMLDBException(ErrorCodes.NO_SUCH_DATABASE,
                                         "Database '" + dbName + "' could not be found");
            }

            Collection col = db.getCollection(colName);
            if (col == null) {
                throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION,
                                         "Collection '" + colName + "' could not be found");
            }
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)));

        Map result = new HashMap(3);
        result.put(RESULT, "yes");
        return result;
    }
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

     *
     * @param message the parameters passed to the xmlrpc method.
     * @return Map containing the XML for the requested MetaData object.
     */
    public Map execute(Map message) throws Exception {
        Collection col = getCollection((String) message.get(COLLECTION));
        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));

        Map result = new HashMap(3);
        result.put(RESULT, TextWriter.toString(doc));
View Full Code Here

        if (target.isRoot()) {
            res.setStatus(WebdavStatus.SC_FORBIDDEN);
            return;
        }

        Collection col = target.getCollection();
        String name = target.getName();

        if (col == null) {
            res.setStatus(WebdavStatus.SC_NOT_FOUND);
            return;
        }

        String dest = req.getDestinationPath();
        if (dest == null) {
            res.setStatus(WebdavStatus.SC_BAD_REQUEST);
            return;
        }

        if (dest.equals(req.getPath())) {
            res.setStatus(WebdavStatus.SC_FORBIDDEN);
            return;
        }

        if (name == null) { // copying collection
            try {
                boolean deep = req.getDepth() != 0;
                Map results = DAVOperations.copy(col, dest, req.getOverwrite(), deep);
                interpretResults(results, res, dest);

            } catch (DBException e) {
                log.error("Failed to copy collection " + col.getCanonicalName(), e);
                throw new ServletException(e);
            }

        } else { // copying resource
            try {
                int status = DAVOperations.copy(col, name, dest, req.getOverwrite());
                res.setStatus(status);
            } catch (DBException e) {
                log.error("Failed to copy resource " + name + " from collection " + col.getCanonicalName(), e);
                throw new ServletException(e);
            }
        }

    }
View Full Code Here

*/
public class Head implements DAVComponent {
    private static final Log log = LogFactory.getLog(Head.class);

    public void execute(DAVRequest req, DAVResponse res, Location target) throws ServletException, IOException {
        Collection col = target.getCollection();
        String name = target.getName();

        if (target.isRoot() || (col != null && name == null)) {
            if (log.isDebugEnabled()) {
                log.debug("Method Head not allowed on collections!");
            }
            res.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
            return;
        }

        if (col == null) {
            res.setStatus(HttpServletResponse.SC_NOT_FOUND);
            return;
        }

        try {
            Entry resource = col.getEntry(name);

            if (resource != null) {

                byte[] resultBytes;
                if (resource.getEntryType() == Entry.DOCUMENT) {
                    resultBytes = TextWriter.toString((Document) resource.getValue()).getBytes();
                    res.setContentType(MimeTable.XML_MIME_TYPE);
                } else {
                    resultBytes = (byte[]) resource.getValue();
                    res.setContentType(MimeTable.getMimeType(name));
                }

                if (resource.getModificationTime() != 0) {
                    res.addDateHeader("Last-Modified", resource.getModificationTime());
                }
                res.setContentLength(resultBytes.length);
            } else {
                res.setStatus(HttpServletResponse.SC_NOT_FOUND);
            }
        } catch (DBException e) {
            log.error("Could not get resource " + name + " from collection " + col.getCanonicalName(), e);
            res.setStatus(HttpServletResponse.SC_NOT_FOUND);
        }
    }
View Full Code Here

                container = col.getContainer(name);
                document = container.getDocument();
                return DOCUMENT;

            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

            if (db == null) {
                throw new XMLDBException(ErrorCodes.NO_SUCH_DATABASE,
                                         "Database '" + dbName + "' could not be found");
            }

            Collection col = db.getCollection(colName);
            if (col == null) {
                throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION,
                                         "Collection '" + colName + "' could not be found");
            }
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.