Package org.exist.util

Examples of org.exist.util.DatabaseConfigurationException


    private AbstractIndex initIndex(BrokerPool pool, String id, Element config, String dataDir, String className) throws DatabaseConfigurationException {
        try {
            final Class<?> clazz = Class.forName(className);
            if (!AbstractIndex.class.isAssignableFrom(clazz)) {
                throw new DatabaseConfigurationException("Class " + className + " does not implement " +
                        AbstractIndex.class.getName());
            }
            final AbstractIndex index = (AbstractIndex)clazz.newInstance();
            index.configure(pool, dataDir, config);
            index.open();
View Full Code Here


        if(INCLUDE_ELEMENT.equals(next.getLocalName())) {
                elem = (Element) next;
                content = elem.getAttribute(CONTENT_ATTRIB);
                ps = elem.getAttribute(PATH_ATTRIB);
                if (ps == null || ps.length() == 0) {
                    throw new DatabaseConfigurationException("include element requires an attribute 'path' in collection configuration.");
                }
                if (content != null && content.length() != 0 && CONTENT_MIXED.equals(content)) {
                    mixedList.add(new NodePath(namespaces, ps, false));
                } else {
                    includeList.add( new NodePath(namespaces, ps) );
                }
            } else if(EXCLUDE_INTERFACE.equals(next.getLocalName())) {
            ps = ((Element) next).getAttribute(PATH_ATTRIB);
                if (ps == null || ps.length() == 0) {
                    throw new DatabaseConfigurationException("exclude element requires an attribute 'path' in collection configuration.");
                }
                excludeList.add( new NodePath(namespaces, ps) );
            } else if(PRESERVE_CONTENT_ELEMENT.equals(next.getLocalName())) {
            ps = ((Element) next).getAttribute(PATH_ATTRIB);
                if (ps == null || ps.length() == 0) {
                    throw new DatabaseConfigurationException("preserveContent element requires an attribute 'path' in collection configuration.");
                }
                preserveList.add( new NodePath(namespaces, ps) );
        } else if(CREATE_ELEMENT.equals(next.getLocalName())) {
                elem = (Element) next;
                String name = elem.getAttribute(QNAME_ATTRIB);
                if (name == null || name.length() == 0) {
                    throw new DatabaseConfigurationException("create element requires an attribute 'qname' in collection configuration.");
                }
                boolean isAttribute = false;
                if (name.startsWith("@")) {
                    isAttribute = true;
                    name = name.substring(1);
                }
                final String prefix = QName.extractPrefix(name);
                final String localName = QName.extractLocalName(name);
                String namespaceURI = "";
                if (prefix != null) {
                    namespaceURI = (String) namespaces.get(prefix);
                    if(namespaceURI == null) {
                        throw new DatabaseConfigurationException("No namespace defined for prefix: " + prefix +
                                " in index definition");
                    }
                }
                final QName qname = new QName(localName, namespaceURI, null);
                if (isAttribute)
View Full Code Here

  public QNameRangeIndexSpec(Map<String, String> namespaces, String name, String typeStr)
  throws DatabaseConfigurationException {
    try {
            this.type = getSuperType(Type.getType(typeStr));
        } catch (final XPathException e) {
            throw new DatabaseConfigurationException("Unknown type: " + typeStr);
        }
       
        boolean isAttribute = false;
        if (name.startsWith("@")) {
            isAttribute = true;
            name = name.substring(1);
        }
        final String prefix = QName.extractPrefix(name);
        final String localName = QName.extractLocalName(name);
        String namespaceURI = "";
        if (prefix != null) {
            namespaceURI = namespaces.get(prefix);
            if(namespaceURI == null) {
                throw new DatabaseConfigurationException("No namespace defined for prefix: " + prefix +
                    " in index definition");
            }
        }
        qname = new QName(localName, namespaceURI, prefix);
        if (isAttribute)
View Full Code Here

                    {LOG.debug("Reading " + dataFile.getName() + " took " +
                        (System.currentTimeMillis() - start) + "ms. Size of " +
                        "the graph: " + dataGuide.getSize());}
            } catch (final IOException e) {
                LOG.error(e.getMessage(), e);
                throw new DatabaseConfigurationException("Error while loading " +
                    dataFile.getAbsolutePath() + ": " + e.getMessage(), e);
            }
        }
    }
View Full Code Here

   
    private NodePath path;
   
    public GeneralRangeIndexSpec(Map<String, String> namespaces, String pathStr, String typeStr) throws DatabaseConfigurationException {
        if(pathStr.length() == 0)
            {throw new DatabaseConfigurationException("The path attribute is required in index.create");}
        path = new NodePath(namespaces, pathStr, false);
        try {
            type = getSuperType(Type.getType(typeStr));
        } catch (final XPathException e) {
            throw new DatabaseConfigurationException("Unknown type: " + typeStr);
        }
    }
View Full Code Here

                        final GeneralRangeIndexSpec valueIdx = new GeneralRangeIndexSpec(namespaces, path, type);
                        addValueIndex(valueIdx);
                    } else {
                        final String error_message = "Configuration error: element " + elem.getNodeName() +
                            " must have attribute " + PATH_ATTRIB + " or " + QNAME_ATTRIB;
                        throw new DatabaseConfigurationException(error_message);
                    }
                }
            }
        }
        // configure custom indexes, but not if broker is null (which means we are reading
View Full Code Here

TOP

Related Classes of org.exist.util.DatabaseConfigurationException

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.