Package org.apache.xindice.util

Examples of org.apache.xindice.util.Configuration


        super(name);
    }

    public void setUp() throws Exception {
        db = new Database();
        db.setConfig(new Configuration(DOMParser.toDocument(DATABASE)));
        configurationA = new Configuration(DOMParser.toDocument(COLLECTIONA));
        configurationB = new Configuration(DOMParser.toDocument(COLLECTIONB));
        configurationC = new Configuration(DOMParser.toDocument(COLLECTIONC));
    }
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

    }

    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

    public void setUp() throws Exception {
        root.mkdir();
        filer.setLocation(root, TEST_COLLECTION_NAME);
        // FSFiler needs location attribute
        filer.setConfig(new Configuration(DOMParser.toDocument("<filer location=\"" + TEST_COLLECTION_NAME + "\" />")));
        if (!filer.exists()) {
            filer.create();
        }
        filer.open();
View Full Code Here

            // Observer
            DBObserver.getInstance().flushDatabaseConfig(this, getConfig());
        }

        if (isMetaEnabled()) {
            Configuration config = metaSystemCollection.getConfig();
            if (config.isDirty()) {
                try {
                    Document d = config.getElement().getOwnerDocument();
                    systemCollection.getCollection(SystemCollection.CONFIGS).setDocument(METAKEY, d);
                    config.resetDirty();
                } catch (Exception e) {
                    log.error("Error writing configuration '" + METAKEY + "', for database " + getName(), e);
                }
            }
        }
View Full Code Here

        timer = new Timer(false);
        closed = false;

        // Initialize query engine
        try {
            Configuration queryCfg = config.getChild(QUERYENGINE);
            if (queryCfg != null) {
                engine.setConfig(queryCfg);
            }
        } catch (Exception e) {
            if (log.isWarnEnabled()) {
                log.warn("ignored exception", e);
            }
        }

        // Initialize system collection
        if (!sysInit) {
            systemCollection = new SystemCollection(this);
            systemCollection.init();
            super.addCollection(systemCollection);
            this.sysInit = true;
        }

        Collection sysConfigCollection = systemCollection.getCollection(SystemCollection.CONFIGS);
        try {
            // Bootstrap from the database itself...  This is accomplished
            // by intercepting the setConfig call and using a Configuration
            // retrieved from the database instead of the standard config
            Document colDoc = sysConfigCollection.getDocument(COLKEY);
            if (colDoc == null) {
                DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                colDoc = db.newDocument();
                Element root = colDoc.createElement(DATABASE);
                root.setAttribute(NAME, getName());
                colDoc.appendChild(root);
                sysConfigCollection.setDocument(COLKEY, colDoc);
            }

            super.setConfig(new Configuration(colDoc.getDocumentElement(), false));
        } catch (Exception e) {
            if (log.isWarnEnabled()) {
                log.warn("ignored exception", e);
            }
        }

        // Register the Database with the VM
        // databases.put(getName(), this);

        // initialize the meta collection
        // but only if it's turned on in the config.
        String metaCfg = config.getAttribute(METADATA);
        if (metaCfg.equalsIgnoreCase("on")) {
            metaEnabled = true;
        }

        if (metaEnabled && !metaInit) {
            try {
                metaSystemCollection = new MetaSystemCollection(this);

                Document colDoc = sysConfigCollection.getDocument(METAKEY);
                if (colDoc == null) {
                    metaSystemCollection.init();
                    Document metaConfig = metaSystemCollection.getConfig().getElement().getOwnerDocument();
                    sysConfigCollection.setDocument(METAKEY, metaConfig);
                } else {
                    metaSystemCollection.setConfig(new Configuration(colDoc, false));
                }

                super.addCollection(metaSystemCollection);
                metaInit = true;
                if (log.isDebugEnabled()) {
View Full Code Here

    public static String getDefaultFilerClass() {
        return DEFAULT_FILER_CLASS;
    }

    public static boolean isInlineMetaEnabled(final Collection col) {
        Configuration config = col.getConfig();
        return config.getBooleanAttribute(INLINE_META_ATTR, false);
    }
View Full Code Here

        filEle.setAttribute(FILER_CLASS_ATTR, filerClass);
        colEle.appendChild(filEle);
        if (log.isDebugEnabled()) {
            log.debug("Created Configuration: \n" + TextWriter.toString(doc));
        }
        return new Configuration(doc.getDocumentElement(), false);
    }
View Full Code Here

        }
        return new Configuration(doc.getDocumentElement(), false);
    }

    public static Configuration copyConfiguration(final Configuration srcConfig) {
        Configuration newConfig = createConfiguration();
        try {
            return copyConfigurationContent(srcConfig, newConfig);
        } catch (ReadOnlyException e) {
            log.error(e);
            return null;
View Full Code Here

            return null;
        }
    }

    public static Configuration copyConfiguration(String name, final Configuration srcConfig) {
        Configuration destConfig = createConfiguration();
        try {
            copyConfigurationContent(srcConfig, destConfig);
            destConfig.setAttribute(COL_NAME_ATTR, name);
        } catch (ReadOnlyException e) {
            // ignore, cannot happen
        }

        return destConfig;
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.