Package org.apache.xindice.core

Examples of org.apache.xindice.core.Database


        indexClass = "org.apache.xindice.core.indexer.LuceneIndexer";
    }

    public void setUp() throws Exception {
        String name = getClass().getName();
        db = new Database();
        db.setConfig(new Configuration(DOMParser.toDocument(DatabaseTest.DATABASE)));
        collection = db.createCollection(name, new Configuration(
                DOMParser.toDocument(
                        "<collection compressed='true' name='" + name + "' inline-metadata='true'>" +
                        "<filer class='org.apache.xindice.core.filer.BTreeFiler'/>" +
View Full Code Here


        super(name);
    }

    public void setUp() throws Exception {
        String name = getClass().getName();
        db = new Database();
        db.setConfig(new Configuration(DOMParser.toDocument(DatabaseTest.DATABASE)));
        collection = db.createCollection(name, new Configuration(
                DOMParser.toDocument(
                        "<collection compressed='true' name='" + name + "' inline-metadata='true'>" +
                        "  <filer class='org.apache.xindice.core.filer.BTreeFiler'/>" +
View Full Code Here

       indexClass = "org.apache.xindice.core.indexer.NameIndexer";
   }

   public void setUp() throws Exception {
       String name = getClass().getName();
       db = new Database();
       db.setConfig(new Configuration(DOMParser.toDocument(DatabaseTest.DATABASE)));
       collection = db.createCollection(name, new Configuration(
               DOMParser.toDocument(
                       "<collection compressed='true' name='" + name + "' inline-metadata='true'>" +
                       "<filer class='org.apache.xindice.core.filer.BTreeFiler'/>" +
View Full Code Here

     * @return Database instance
     * @throws XMLDBException if configuration for this database is not found,
     *                        or could not be read.
     */
    private Database getDatabase(String dbName, String uri) throws XMLDBException {
        Database database = Database.getDatabase(dbName);
        if (database == null && !isManaged()) {
            Configuration dbConfig = getConfiguration(dbName);
            if (log.isDebugEnabled()) {
                log.debug("Mounting database: '" + dbName + "'");
            }

            if (dbConfig == null) {
                throw new XMLDBException(ErrorCodes.NO_SUCH_DATABASE,
                                         "Database '" + dbName + "' not found: " + uri);
            }

            try {
                database = Database.getDatabase(dbConfig);
            } catch (DBException e) {
                throw FaultCodes.createXMLDBException(e);
            }
            if (log.isDebugEnabled()) {
                log.info("Mounted database: '" + database.getName() + "'");
            }
        }

        return database;
    }
View Full Code Here

        // If colIndex isn't -1 then we need to pick out the db name
        if (colIndex != -1) {
            dbName = collPath.substring(1, colIndex);
        }

        Database database = getDatabase(dbName, uri);
        if (database == null) {
            throw new XMLDBException(ErrorCodes.NO_SUCH_DATABASE,
                                     "Database '" + dbName + "' not found. URL: " + uri);
        }
View Full Code Here

                    sb.append("<a href=\"" + contextPath + "/?/" + db + "\">" + db + "</a> ");
                }
            } else {
                // we have something to chew on
                XPathPseudoParser parser = new XPathPseudoParser(path);
                Database db = Database.getDatabase(parser.getDatabase());

                /* building the page once we have all the information */
                sb.append("<table border=\"1\" width=\"90%\">\n");
                sb.append("<tr><td rowspan=\"1\" colspan=\"2\">" + getPathNavigation(parser, contextPath) + "</td></tr>\n");
                sb.append("<tr><td valign=\"top\">" + getHierarchy(parser, contextPath, db) + "</td>");
View Full Code Here

                // The rest of the name locates the collection
                colName = name.substring(colIndex + 1);
            }

            Database db = Database.getDatabase(dbName);
            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

     *
     * @throws XMLDBException if configuration for this database is not found,
     *                        or could not be read.
     */
    private Database getDatabase(String dbName, String uri) throws XMLDBException {
        Database database = Database.getDatabase(dbName);
        if (database == null && !isManaged()) {
            Configuration dbConfig = getConfiguration(dbName);
            if (log.isDebugEnabled()) {
                log.debug("Mounting database: '" + dbName + "'");
            }

            if (dbConfig == null) {
                throw new XMLDBException(ErrorCodes.NO_SUCH_DATABASE,
                                         "Database '" + dbName + "' not found: " + uri);
            }

            database = Database.getDatabase(dbConfig);
            if (log.isDebugEnabled()) {
                log.info("Mounted database: '" + database.getName() + "'");
            }
        }

        return database;
    }
View Full Code Here

        // If colIndex isn't -1 then we need to pick out the db name
        if (colIndex != -1) {
            dbName = collPath.substring(1, colIndex);
        }

        Database database = getDatabase(dbName, uri);
        if (database == null) {
            throw new XMLDBException(ErrorCodes.NO_SUCH_DATABASE,
                                     "Database '" + dbName + "' not found. URL: " + uri);
        }
View Full Code Here

        if (path == null || path.length() == 0 || path.equals("/")) {
            isRoot = true;
            return;
        }

        Database db = getDatabase(path);
        if (db == null) {
            collection = null;
            name = null;
            return;
        }

        StringBuffer buf = new StringBuffer(path);

        // strip database name
        String dbName = db.getName();
        buf.delete(0, dbName.length() + 1);

        Collection col;
        if (buf.length() == 0 || (buf.length() == 1 && buf.charAt(0) == '/')) {
            col = db;
        } else {
            col = db.getCollection(buf.toString());
        }

        String resourceName = null;
        if (col == null) { // no collection found -> try resource
            if (buf.charAt(buf.length() - 1) ==  '/') {
                buf.deleteCharAt(buf.length() - 1);
            }

            int split = buf.lastIndexOf("/");
            resourceName = buf.substring(split + 1, buf.length());
            String colPath = buf.substring(0, split);

            if (colPath.length() > 0) {
                col = db.getCollection(colPath);
            } else {
                col = db;
            }
        }
View Full Code Here

TOP

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

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.