Package org.apache.xindice.core

Examples of org.apache.xindice.core.Database


                // 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


                    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

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

            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

         while (i < dbs.length) {
            String instance = dbs[i];

            // create servant and register it with the ORB
            Database db = Database.getDatabase(instance);
            DatabaseServant dbRef = new DatabaseServant(db, kernel);

            rootPOA.activate_object(dbRef);
            rootPOA.the_POAManager().activate();
           
            String iorFile = null;
            try {
               iorFile = System.getProperty(Xindice.PROP_XINDICE_HOME) +
                  "/docs/" +  db.getName() + "_bootstrap.ior";
               PrintWriter out = new PrintWriter(new FileOutputStream( iorFile ),
                  true);
     
               out.println( orb.object_to_string( dbRef._this(orb) ) );
               out.close();
            }
            catch ( Exception e ) {
               org.apache.xindice.Debug.println("Unable to bootstrap the instance '" +
                  db.getName() + "' due to an error writing: " + iorFile);
            }
           
            if ( useNaming ) {
               // bind the Object Reference in Naming
               NameComponent nc = new NameComponent(db.getName(), "");
               NameComponent path[] = {root, nc};
  
               ncRef.bind(path, dbRef._this(orb));
  
               System.out.println(getName() + ": '" + instance +
View Full Code Here

         System.out.println("Database: '" + serviceName + "' initializing");

         /*
          * Setup the Database instance. This is the key to the Xindice system
          */
         db = new Database();
         db.setConfig(config);
      }
      catch (Exception e) {
         org.apache.xindice.Debug.printStackTrace(e);
      }
View Full Code Here

        tests++;
    }

    public void setUp() throws Exception {
        if (db == null) {
            Database db = new Database();
            db.setConfig(new Configuration(DOMParser.toDocument(DATABASE)));
            col = db.createCollection("testcol", new Configuration(DOMParser.toDocument(COLLECTION)));
            col.insertDocument(DOMParser.toDocument(DOCUMENT));

            XPathQueryResolverTest.db = db;
        }
View Full Code Here

        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

        tests++;
    }

    public void setUp() throws Exception {
        if (db == null) {
            Database db = new Database();
            db.setConfig(new Configuration(DOMParser.toDocument(DATABASE)));
            col = db.createCollection("testcol", new Configuration(DOMParser.toDocument(COLLECTION)));
            col.insertDocument(DOMParser.toDocument(DOCUMENT));

            XPathQueryResolverTest.db = db;
        }
View Full Code Here

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

    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

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.