Package org.apache.xindice.util

Examples of org.apache.xindice.util.Configuration


            colEle.appendChild(filEle);
        }

        CollectionManager colman = getCollection((String) message.get(COLLECTION));

        Configuration config = new Configuration(doc.getDocumentElement(), false);
        colman.createCollection((String) message.get(NAME), config);

        Map result = new HashMap(3);
        result.put(RESULT, message.get(NAME));
        return result;
View Full Code Here


        if (config.getBooleanAttribute(CACHE, true)) {
            cache = getDatabase().getDocumentCache();
        }

        // If no Filer is defined, skip Symbols and Indexes
        Configuration filerConfig = config.getChild(FILER);
        if (filerConfig != null) {
            if (log.isTraceEnabled()) {
                log.trace(localDebugHeader + "Have filer config...");
            }

            // Symbol Table Setup
            Configuration symConfig = config.getChild(SYMBOLS);
            if (symConfig != null) {
                if (log.isTraceEnabled()) {
                    log.trace(localDebugHeader +
                              "Internal symbols=<" + TextWriter.toString(symConfig.getElement()) + ">");
                }

                try {
                    symbols = new SymbolTable(symConfig.getElement(), true);
                } catch (Exception e) {
                    if (log.isWarnEnabled()) {
                        log.warn(localDebugHeader + "Error building symbol table from internal symbols", e);
                    }
                }
            } else {
                if (log.isTraceEnabled()) {
                    log.trace(localDebugHeader + "No internal symbols...");
                }

                try {
                    symbols = getSystemCollection().loadSymbols(this);
                    if (log.isDebugEnabled()) {
                        log.debug(localDebugHeader + "Loaded symbols=<" +
                                  TextWriter.toString(symbols.streamToXML(new DocumentImpl())) + ">");
                    }
                } catch (Exception e) {
                    if (log.isWarnEnabled()) {
                        log.warn(localDebugHeader + "Error loading symbol table from system collection", e);
                    }
                }
            }

            String className = filerConfig.getAttribute(CLASS);
            if (log.isDebugEnabled()) {
                log.debug(localDebugHeader + "Filer class=<" + className + ">");
            }
            try {
                filer = (Filer) Class.forName(className).newInstance();
                filer.setLocation(getCollectionRoot(), getName());
                filer.setConfig(filerConfig);
                if (!filer.exists()) {
                    filer.create();
                }
                filer.open();
            } catch (Exception e) {
                if (log.isWarnEnabled()) {
                    log.warn("Filer '" + className + "' is not available", e);
                }
            }

            // Index Manager
            try {
                indexManager = new IndexManager(this, getDatabase().getTimer());
                Configuration idxConfig = config.getChild(INDEXES, true);
                indexManager.setConfig(idxConfig);
            } catch (Exception e) {
                if (log.isWarnEnabled()) {
                    log.warn("Failed to initialize indexer", e);
                }
View Full Code Here

            output.print(CREATE_FORM_FILER);
            printEndSingleTableBox(output);
            printEndTable(output);
        } else {
            try {
                Configuration config = CollectionConfigurationHelper.createConfiguration(name, compressed, inlineMeta, filer);
                col.createCollection(name, config);

                printStartTable(title, output);
                printStartSingleTableBox(output);
                output.print("<b>Collection <a href=\"./");
View Full Code Here

    }

    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'/>" +
                        "</collection>"), false
        ));
View Full Code Here

            String alias = (String) i.next();
            config += "<pattern pattern='" + patterns.get(alias) + "' alias='" + alias + "' />";
        }
        config += "</index>";

        LuceneIndexer ind = (LuceneIndexer) collection.createIndexer(new Configuration(DOMParser.toDocument(config)));
        Thread.sleep(2000);
        return ind;
    }
View Full Code Here

        assertEquals(WebdavStatus.SC_CONFLICT, httpResponse.getStatus());
    }

    public void testCopyResource() throws Exception {
        String name = "new";
        Collection child = collection.createCollection(name, new Configuration(
                DOMParser.toDocument(
                        "<collection compressed='true' name='" + name + "' inline-metadata='true'>" +
                        "<filer class='org.apache.xindice.core.filer.BTreeFiler' />" +
                        "</collection>"), false
        ));
View Full Code Here

        assertEquals(document.toString(), child.getDocument(docName).toString());
    }

    public void testCopyResourceNoOverwrite() throws Exception {
        String name = "new";
        Collection child = collection.createCollection(name, new Configuration(
                DOMParser.toDocument(
                        "<collection compressed='true' name='" + name + "' inline-metadata='true'>" +
                        "<filer class='org.apache.xindice.core.filer.BTreeFiler' />" +
                        "</collection>"), false
        ));
View Full Code Here

        assertEquals(child.getDocumentCount(), 0);
    }

    public void testCopyCollection() throws Exception {
        String childName = "col1";
        Collection col1 = collection.createCollection(childName, new Configuration(
                DOMParser.toDocument(
                        "<collection compressed='true' name='" + childName + "' inline-metadata='true'>" +
                        "<filer class='org.apache.xindice.core.filer.BTreeFiler' />" +
                        "</collection>"), false
        ));

        int docs = 50;
        for (int i = 0; i < docs; i++) {
            String xml = "<test document='true'>This is the test XML " + i + "</test>";
            Document document = DOMParser.toDocument(xml);

            String docName = "resource" + i;
            collection.setDocument(docName, document);
        }

        for (int i = 0; i < docs; i++) {
            String xml = "<test>This is the inner collection test XML " + i + "</test>";
            Document document = DOMParser.toDocument(xml);

            String docName = "resource" + i;
            col1.setDocument(docName, document);
        }

        Collection destParent = null;
        try {
            String destName = "new";
            destParent = db.createCollection(destName, new Configuration(
                    DOMParser.toDocument(
                            "<collection compressed='true' name='" + destName + "' inline-metadata='true'>" +
                            "<filer class='org.apache.xindice.core.filer.BTreeFiler' />" +
                            "</collection>"), false
            ));
View Full Code Here

    }

    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'/>" +
                        "</collection>"), false
        ));
View Full Code Here

    private Indexer createIndex(String name, String pattern, String type) throws Exception {
        String config = "<index name='" + name + "' " +
                          "class='" + indexClass + "' " +
                          "pattern='" + pattern + "' type='" + type + "'/>";
        Indexer ind = collection.createIndexer(new Configuration(DOMParser.toDocument(config)));
        Thread.sleep(100);
        return ind;
    }
View Full Code Here

TOP

Related Classes of org.apache.xindice.util.Configuration

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.