| | |
| | | <echo message=" builds the server without the debug logging facility." /> |
| | | <echo message=" No debug logging messages will be included on test failures." /> |
| | | <echo message=""/> |
| | | <echo message=" -Dtest.debug.target=org.opends.server.core:level=verbose,category=data_access"/> |
| | | <echo message=" -Dorg.opends.test.debug.target=org.opends.server.core:level=verbose,category=data_access"/> |
| | | <echo message=" for example only include debug messages in the core"/> |
| | | <echo message=" package that are related to data access and at the" /> |
| | | <echo message=" verbose level or higher. The syntax of this target" /> |
| | |
| | | </target> |
| | | |
| | | <target name="enableweave"> |
| | | <condition property="WEAVE_ENABLED" value="true"> |
| | | <not> |
| | | <isset property="WEAVE_ENABLED" /> |
| | | </not> |
| | | </condition> |
| | | <condition property="WEAVE_ENABLED" value="true"> |
| | | <not> |
| | | <or> |
| | | <isset property="WEAVE_ENABLED" /> |
| | | <isset property="test.groups" /> |
| | | <isset property="test.packages" /> |
| | | <isset property="test.classes" /> |
| | | <isset property="test.methods" /> |
| | | </or> |
| | | </not> |
| | | </condition> |
| | | </target> |
| | | |
| | | <target name="testreport" |
| New file |
| | |
| | | #!/bin/sh |
| | | # |
| | | # CDDL HEADER START |
| | | # |
| | | # The contents of this file are subject to the terms of the |
| | | # Common Development and Distribution License, Version 1.0 only |
| | | # (the "License"). You may not use this file except in compliance |
| | | # with the License. |
| | | # |
| | | # You can obtain a copy of the license at |
| | | # trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | # or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | # See the License for the specific language governing permissions |
| | | # and limitations under the License. |
| | | # |
| | | # When distributing Covered Code, include this CDDL HEADER in each |
| | | # file and include the License file at |
| | | # trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | # add the following below this CDDL HEADER, with the fields enclosed |
| | | # by brackets "[]" replaced with your own identifying information: |
| | | # Portions Copyright [yyyy] [name of copyright owner] |
| | | # |
| | | # CDDL HEADER END |
| | | # |
| | | # |
| | | # Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | |
| | | |
| | | # This script may be used to rebuild the contents of a Directory |
| | | # Server backend storing its data in the Berkeley DB Java Edition. |
| | | OPENDS_INVOKE_CLASS="org.opends.server.tools.RebuildIndex" |
| | | export OPENDS_INVOKE_CLASS |
| | | |
| | | SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=rebuild-index" |
| | | export SCRIPT_NAME_ARG |
| | | |
| | | SCRIPT_DIR=`dirname "${0}"` |
| | | "${SCRIPT_DIR}/_server-script.sh" "${@}" |
| New file |
| | |
| | | |
| | | @echo off |
| | | rem CDDL HEADER START |
| | | rem |
| | | rem The contents of this file are subject to the terms of the |
| | | rem Common Development and Distribution License, Version 1.0 only |
| | | rem (the "License"). You may not use this file except in compliance |
| | | rem with the License. |
| | | rem |
| | | rem You can obtain a copy of the license at |
| | | rem trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | rem or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | rem See the License for the specific language governing permissions |
| | | rem and limitations under the License. |
| | | rem |
| | | rem When distributing Covered Code, include this CDDL HEADER in each |
| | | rem file and include the License file at |
| | | rem trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | rem add the following below this CDDL HEADER, with the fields enclosed |
| | | rem by brackets "[]" replaced with your own identifying information: |
| | | rem Portions Copyright [yyyy] [name of copyright owner] |
| | | rem |
| | | rem CDDL HEADER END |
| | | rem |
| | | rem |
| | | rem Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | |
| | | setlocal |
| | | |
| | | set OPENDS_INVOKE_CLASS="org.opends.server.tools.RebuildIndex" |
| | | set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=rebuild-index" |
| | | call "%~dP0\_server-script.bat" %* |
| | | |
| | |
| | | ds-cfg-default-root-privilege-name: password-reset |
| | | ds-cfg-default-root-privilege-name: update-schema |
| | | ds-cfg-default-root-privilege-name: privilege-change |
| | | ds-cfg-default-root-privilege-name: index-rebuild |
| | | |
| | | dn: cn=Directory Manager,cn=Root DNs,cn=config |
| | | objectClass: top |
| | |
| | | NAME 'ds-cfg-virtual-attribute-conflict-behavior' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.332 |
| | | NAME 'ds-task-rebuild-base-dn' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.333 |
| | | NAME 'ds-task-rebuild-index' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.334 |
| | | NAME 'ds-task-rebuild-max-threads' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | objectClasses: ( 1.3.6.1.4.1.26027.1.2.1 |
| | | NAME 'ds-cfg-access-control-handler' SUP top STRUCTURAL |
| | | MUST ( cn $ ds-cfg-acl-handler-class $ ds-cfg-acl-handler-enabled ) |
| | |
| | | ds-cfg-virtual-attribute-conflict-behavior ) |
| | | MAY ( ds-cfg-virtual-attribute-base-dn $ ds-cfg-virtual-attribute-group-dn $ |
| | | ds-cfg-virtual-attribute-filter ) X-ORIGIN 'OpenDS Directory Server' ) |
| | | objectClasses: ( 1.3.6.1.4.1.26027.1.2.92 |
| | | NAME 'ds-task-rebuild' SUP ds-task |
| | | MUST ( ds-task-rebuild-base-dn $ ds-task-rebuild-index ) |
| | | MAY ( ds-task-rebuild-max-threads ) |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | | import com.sleepycat.je.Transaction; |
| | | |
| | | import java.util.*; |
| | | |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.protocols.asn1.ASN1OctetString; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugCaught; |
| | | import org.opends.server.api.ApproximateMatchingRule; |
| | | |
| | | /** |
| | | * An implementation of an Indexer for attribute approximate matching. |
| | | */ |
| | | public class ApproximateIndexer extends Indexer |
| | | { |
| | | /** |
| | | * The comparator for index keys generated by this class. |
| | | */ |
| | | private static final Comparator<byte[]> comparator = |
| | | new AttributeIndex.KeyComparator(); |
| | | |
| | | /** |
| | | * The attribute type approximate matching rule. |
| | | */ |
| | | private ApproximateMatchingRule approximateRule; |
| | | |
| | | /** |
| | | * The attribute index configuration for which this instance will |
| | | * generate index keys. |
| | | */ |
| | | private IndexConfig indexConfig; |
| | | |
| | | /** |
| | | * Create a new attribute approximate indexer for the given index |
| | | * configuration. |
| | | * @param indexConfig The index configuration for which an indexer is |
| | | * required. |
| | | */ |
| | | public ApproximateIndexer(IndexConfig indexConfig) |
| | | { |
| | | this.indexConfig = indexConfig; |
| | | approximateRule = |
| | | indexConfig.getAttributeType().getApproximateMatchingRule(); |
| | | } |
| | | |
| | | /** |
| | | * Get a string representation of this object. The returned value is |
| | | * used to name an index created using this object. |
| | | * @return A string representation of this object. |
| | | */ |
| | | public String toString() |
| | | { |
| | | return indexConfig.getAttributeType().getNameOrOID() + ".approximate"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get the comparator that must be used to compare index keys |
| | | * generated by this class. |
| | | * |
| | | * @return A byte array comparator. |
| | | */ |
| | | public Comparator<byte[]> getComparator() |
| | | { |
| | | return comparator; |
| | | } |
| | | |
| | | /** |
| | | * Generate the set of index keys for an entry. |
| | | * |
| | | * @param txn A database transaction to be used if the database need to be |
| | | * accessed in the course of generating the index keys. |
| | | * @param entry The entry. |
| | | * @param keys The set into which the generated keys will be inserted. |
| | | */ |
| | | public void indexEntry(Transaction txn, Entry entry, |
| | | Set<ASN1OctetString> keys) |
| | | { |
| | | List<Attribute> attrList = |
| | | entry.getAttribute(indexConfig.getAttributeType()); |
| | | if (attrList != null) |
| | | { |
| | | indexAttribute(attrList, keys); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Generate the set of index keys to be added and the set of index keys |
| | | * to be deleted for an entry that has been replaced. |
| | | * |
| | | * @param txn A database transaction to be used if the database need to be |
| | | * accessed in the course of generating the index keys. |
| | | * @param oldEntry The original entry contents. |
| | | * @param newEntry The new entry contents. |
| | | * @param addKeys The set into which the keys to be added will be inserted. |
| | | * @param delKeys The set into which the keys to be deleted will be inserted. |
| | | */ |
| | | public void replaceEntry(Transaction txn, |
| | | Entry oldEntry, Entry newEntry, |
| | | Set<ASN1OctetString> addKeys, |
| | | Set<ASN1OctetString> delKeys) |
| | | { |
| | | List<Attribute> attrList; |
| | | |
| | | attrList = oldEntry.getAttribute(indexConfig.getAttributeType()); |
| | | Set<ASN1OctetString> oldSet = new HashSet<ASN1OctetString>(); |
| | | indexAttribute(attrList, oldSet); |
| | | |
| | | attrList = newEntry.getAttribute(indexConfig.getAttributeType()); |
| | | Set<ASN1OctetString> newSet = new HashSet<ASN1OctetString>(); |
| | | indexAttribute(attrList, newSet); |
| | | |
| | | HashSet<ASN1OctetString> removeSet = new HashSet<ASN1OctetString>(oldSet); |
| | | removeSet.removeAll(newSet); |
| | | for (ASN1OctetString k : removeSet) |
| | | { |
| | | delKeys.add(k); |
| | | } |
| | | |
| | | HashSet<ASN1OctetString> addSet = new HashSet<ASN1OctetString>(newSet); |
| | | addSet.removeAll(oldSet); |
| | | for (ASN1OctetString k : addSet) |
| | | { |
| | | addKeys.add(k); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Generate the set of index keys to be added and the set of index keys |
| | | * to be deleted for an entry that was modified. |
| | | * |
| | | * @param txn A database transaction to be used if the database need to be |
| | | * accessed in the course of generating the index keys. |
| | | * @param oldEntry The original entry contents. |
| | | * @param newEntry The new entry contents. |
| | | * @param mods The set of modifications that were applied to the entry. |
| | | * @param addKeys The set into which the keys to be added will be inserted. |
| | | * @param delKeys The set into which the keys to be deleted will be inserted. |
| | | */ |
| | | public void modifyEntry(Transaction txn, Entry oldEntry, Entry newEntry, |
| | | List<Modification> mods, |
| | | Set<ASN1OctetString> addKeys, |
| | | Set<ASN1OctetString> delKeys) |
| | | { |
| | | replaceEntry(txn, oldEntry, newEntry, addKeys, delKeys); |
| | | } |
| | | |
| | | /** |
| | | * Generate the set of index keys for an attribute. |
| | | * @param attrList The attribute to be indexed. |
| | | * @param keys The set into which the keys will be inserted. |
| | | */ |
| | | private void indexAttribute(List<Attribute> attrList, |
| | | Set<ASN1OctetString> keys) |
| | | { |
| | | if (attrList == null) return; |
| | | |
| | | for (Attribute attr : attrList) |
| | | { |
| | | indexValues(attr.getValues(), keys); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Generate the set of index keys for a set of attribute values. |
| | | * @param values The set of attribute values to be indexed. |
| | | * @param keys The set into which the keys will be inserted. |
| | | */ |
| | | private void indexValues(Set<AttributeValue> values, |
| | | Set<ASN1OctetString> keys) |
| | | { |
| | | if (values == null) return; |
| | | |
| | | for (AttributeValue value : values) |
| | | { |
| | | try |
| | | { |
| | | byte[] keyBytes = |
| | | approximateRule.normalizeValue(value.getValue()).value(); |
| | | |
| | | keys.add(new ASN1OctetString(keyBytes)); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import org.opends.server.api.SubstringMatchingRule; |
| | | import org.opends.server.api.OrderingMatchingRule; |
| | | import org.opends.server.api.ApproximateMatchingRule; |
| | | import org.opends.server.protocols.asn1.ASN1OctetString; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.AttributeValue; |
| | |
| | | Index orderingIndex = null; |
| | | |
| | | /** |
| | | * The index database for attribute approximate. |
| | | */ |
| | | Index approximateIndex = null; |
| | | |
| | | /** |
| | | * Create a new attribute index object. |
| | | * @param entryContainer The entryContainer of this attribute index. |
| | | * @param indexConfig The attribute index configuration. |
| | |
| | | indexConfig.getEqualityEntryLimit(), |
| | | indexConfig.getCursorEntryLimit()); |
| | | } |
| | | if (indexConfig.isApproximateIndex()) |
| | | { |
| | | Indexer approximateIndexer = new ApproximateIndexer(indexConfig); |
| | | this.approximateIndex = new Index(this.entryContainer, |
| | | name + ".approximate", |
| | | approximateIndexer, |
| | | indexConfig.getEqualityEntryLimit(), |
| | | indexConfig.getCursorEntryLimit()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | orderingIndex.open(dbConfig); |
| | | } |
| | | |
| | | if (approximateIndex != null) |
| | | { |
| | | approximateIndex.open(dbConfig); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | return indexConfig.getAttributeType(); |
| | | } |
| | | |
| | | //TODO: Make all modify/add methods return success boolean |
| | | /** |
| | | * Update the attribute index for a new entry. |
| | | * |
| | | * @param txn The database transaction to be used for the insertions. |
| | | * @param entryID The entry ID. |
| | | * @param entry The contents of the new entry. |
| | | * @return True if all the index keys for the entry are added. False if the |
| | | * entry ID alreadly exists for some keys. |
| | | * @throws DatabaseException If an error occurs in the JE database. |
| | | * @throws DirectoryException If a Directory Server error occurs. |
| | | * @throws JebException If an error occurs in the JE backend. |
| | | */ |
| | | public void addEntry(Transaction txn, EntryID entryID, Entry entry) |
| | | public boolean addEntry(Transaction txn, EntryID entryID, Entry entry) |
| | | throws DatabaseException, DirectoryException, JebException |
| | | { |
| | | boolean success = true; |
| | | |
| | | if (equalityIndex != null) |
| | | { |
| | | equalityIndex.addEntry(txn, entryID, entry); |
| | | if(!equalityIndex.addEntry(txn, entryID, entry)) |
| | | { |
| | | success = false; |
| | | } |
| | | } |
| | | |
| | | if (presenceIndex != null) |
| | | { |
| | | presenceIndex.addEntry(txn, entryID, entry); |
| | | if(!presenceIndex.addEntry(txn, entryID, entry)) |
| | | { |
| | | success = false; |
| | | } |
| | | } |
| | | |
| | | if (substringIndex != null) |
| | | { |
| | | substringIndex.addEntry(txn, entryID, entry); |
| | | if(!substringIndex.addEntry(txn, entryID, entry)) |
| | | { |
| | | success = false; |
| | | } |
| | | } |
| | | |
| | | if (orderingIndex != null) |
| | | { |
| | | orderingIndex.addEntry(txn, entryID, entry); |
| | | if(!orderingIndex.addEntry(txn, entryID, entry)) |
| | | { |
| | | success = false; |
| | | } |
| | | } |
| | | |
| | | if (approximateIndex != null) |
| | | { |
| | | if(!approximateIndex.addEntry(txn, entryID, entry)) |
| | | { |
| | | success = false; |
| | | } |
| | | } |
| | | |
| | | return success; |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | orderingIndex.removeEntry(txn, entryID, entry); |
| | | } |
| | | |
| | | if(approximateIndex != null) |
| | | { |
| | | approximateIndex.removeEntry(txn, entryID, entry); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | orderingIndex.modifyEntry(txn, entryID, oldEntry, newEntry, mods); |
| | | } |
| | | |
| | | if (approximateIndex != null) |
| | | { |
| | | approximateIndex.modifyEntry(txn, entryID, oldEntry, newEntry, mods); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieve the entry IDs that might match an approximate filter. |
| | | * |
| | | * @param approximateFilter The approximate filter. |
| | | * @return The candidate entry IDs that might contain the filter |
| | | * assertion value. |
| | | */ |
| | | public EntryIDSet evaluateApproximateFilter(SearchFilter approximateFilter) |
| | | { |
| | | if (!indexConfig.isApproximateIndex()) |
| | | { |
| | | return new EntryIDSet(); |
| | | } |
| | | |
| | | try |
| | | { |
| | | ApproximateMatchingRule approximateMatchingRule = |
| | | approximateFilter.getAttributeType().getApproximateMatchingRule(); |
| | | // Make a key from the normalized assertion value. |
| | | byte[] keyBytes = |
| | | approximateMatchingRule.normalizeValue( |
| | | approximateFilter.getAssertionValue().getValue()).value(); |
| | | DatabaseEntry key = new DatabaseEntry(keyBytes); |
| | | |
| | | // Read the key. |
| | | return approximateIndex.readKey(key, null, LockMode.DEFAULT); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | return new EntryIDSet(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove the index from disk. The index must not be open. |
| | | * @throws DatabaseException If an error occurs in the JE database. |
| | | */ |
| | |
| | | { |
| | | entryContainer.removeDatabase(name + ".ordering"); |
| | | } |
| | | if (indexConfig.isApproximateIndex()) |
| | | { |
| | | entryContainer.removeDatabase(name + ".approximate"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | entryLimitExceededCount += orderingIndex.getEntryLimitExceededCount(); |
| | | } |
| | | |
| | | if (approximateIndex != null) |
| | | { |
| | | entryLimitExceededCount += |
| | | approximateIndex.getEntryLimitExceededCount(); |
| | | } |
| | | |
| | | return entryLimitExceededCount; |
| | | } |
| | | |
| | | /** |
| | | * Removes all records related to this attribute index. |
| | | * @param txn A JE database transaction to be used during the clear operation |
| | | * or null if not required. Using transactions increases the chance |
| | | * of lock contention. |
| | | * @return The number of records removed. |
| | | * @throws DatabaseException If an error occurs while cleaning the database. |
| | | */ |
| | | public long clear(Transaction txn) throws DatabaseException |
| | | { |
| | | long deletedCount = 0; |
| | | |
| | | if (equalityIndex != null) |
| | | { |
| | | deletedCount += equalityIndex.clear(txn); |
| | | } |
| | | if (presenceIndex != null) |
| | | { |
| | | deletedCount += presenceIndex.clear(txn); |
| | | } |
| | | if (substringIndex != null) |
| | | { |
| | | deletedCount += substringIndex.clear(txn); |
| | | } |
| | | if (orderingIndex != null) |
| | | { |
| | | deletedCount += orderingIndex.clear(txn); |
| | | } |
| | | if (approximateIndex != null) |
| | | { |
| | | deletedCount += approximateIndex.clear(txn); |
| | | } |
| | | |
| | | return deletedCount; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get a string representation of this object. |
| | | * @return return A string representation of this object. |
| | | */ |
| | | public String toString() |
| | | { |
| | | return indexConfig.getAttributeType().getNameOrOID(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | try |
| | | { |
| | | rootContainer.close(); |
| | | rootContainer = null; |
| | | } |
| | | catch (DatabaseException e) |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Rebuild index(es) in the backend instance. Note that the server will not |
| | | * explicitly initialize this backend before calling this method. |
| | | * @param rebuildConfig The rebuild configuration. |
| | | * @param configEntry The backend instance configuration entry. |
| | | * @param baseDNs The set of base DNs that have been configured for this |
| | | * backend. |
| | | * @throws ConfigException If an unrecoverable problem arises during |
| | | * initialization. |
| | | * @throws InitializationException If a problem occurs during initialization |
| | | * that is not related to the server |
| | | * configuration. |
| | | * @throws DirectoryException If a Directory Server error occurs. |
| | | */ |
| | | public void rebuildBackend(RebuildConfig rebuildConfig, |
| | | ConfigEntry configEntry, DN[] baseDNs) |
| | | throws InitializationException, ConfigException, DirectoryException |
| | | { |
| | | // If the backend already has the root container open, we must use the same |
| | | // underlying root container |
| | | boolean openRootContainer = rootContainer == null; |
| | | |
| | | // If the rootContainer is open, the backend is initizlied by something else |
| | | // We can't do any rebuild of system indexes while others are using this |
| | | // backend. Throw error. TODO: Need to make baseDNs disablable. |
| | | if(!openRootContainer && rebuildConfig.includesSystemIndex()) |
| | | { |
| | | String message = getMessage(MSGID_JEB_REBUILD_BACKEND_ONLINE); |
| | | throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), |
| | | message, MSGID_JEB_REBUILD_BACKEND_ONLINE); |
| | | } |
| | | |
| | | try |
| | | { |
| | | if (openRootContainer) |
| | | { |
| | | // Initialize a config object. |
| | | config = new Config(); |
| | | config.initializeConfig(configEntry, baseDNs); |
| | | |
| | | // Open the database environment |
| | | rootContainer = new RootContainer(config, this); |
| | | rootContainer.open(); |
| | | rootContainer.openEntryContainers(baseDNs); |
| | | } |
| | | |
| | | RebuildJob rebuildJob = new RebuildJob(rebuildConfig); |
| | | rebuildJob.rebuildBackend(rootContainer); |
| | | } |
| | | catch (DatabaseException e) |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | String message = getMessage(MSGID_JEB_DATABASE_EXCEPTION, |
| | | e.getMessage()); |
| | | throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), |
| | | message, MSGID_JEB_DATABASE_EXCEPTION); |
| | | } |
| | | catch (JebException e) |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), |
| | | e.getMessage(), |
| | | e.getMessageID()); |
| | | } |
| | | finally |
| | | { |
| | | //If a root container was opened in this method as read only, close it |
| | | //to leave the backend in the same state. |
| | | if (openRootContainer && rootContainer != null) |
| | | { |
| | | try |
| | | { |
| | | rootContainer.close(); |
| | | rootContainer = null; |
| | | } |
| | | catch (DatabaseException e) |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a backup of the contents of this backend in a form that may be |
| | |
| | | indexTypeSet.add("equality"); |
| | | indexTypeSet.add("substring"); |
| | | indexTypeSet.add("ordering"); |
| | | indexTypeSet.add("approximate"); |
| | | typeStub = |
| | | new MultiChoiceConfigAttribute(ATTR_INDEX_TYPE, msg, false, |
| | | true, true, indexTypeSet); |
| | |
| | | throw new ConfigException(messageID, message); |
| | | } |
| | | } |
| | | else if (indexType.equalsIgnoreCase("approximate")) |
| | | { |
| | | indexConfig.setApproximateIndex(true); |
| | | if(attrType.getApproximateMatchingRule() == null) |
| | | { |
| | | int messageID = MSGID_CONFIG_INDEX_TYPE_NEEDS_MATCHING_RULE; |
| | | String message = getMessage(messageID, attrType, indexType); |
| | | throw new ConfigException(messageID, message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | | import com.sleepycat.je.BtreeStats; |
| | | import com.sleepycat.je.Cursor; |
| | | import com.sleepycat.je.CursorConfig; |
| | | import com.sleepycat.je.Database; |
| | |
| | | import com.sleepycat.je.DatabaseException; |
| | | import com.sleepycat.je.LockMode; |
| | | import com.sleepycat.je.OperationStatus; |
| | | import com.sleepycat.je.StatsConfig; |
| | | import com.sleepycat.je.Transaction; |
| | | |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import org.opends.server.util.StaticUtils; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugInfo; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugVerbose; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugCaught; |
| | | |
| | | /** |
| | | * This class represents the DN database, or dn2id, which has one record |
| | |
| | | { |
| | | database = entryContainer.openDatabase(dbConfig, name); |
| | | threadLocalDatabase.set(database); |
| | | |
| | | if(debugEnabled()) |
| | | { |
| | | debugInfo("JE DN2ID database %s opened with %d records.", |
| | | database.getDatabaseName(), database.count()); |
| | | } |
| | | } |
| | | return database; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * Compute the count of the number of records stored. This can be a |
| | | * long running computation as it must walk the entire btree. |
| | | * Removes all records from the database. |
| | | * @param txn A JE database transaction to be used during the clear operation |
| | | * or null if not required. Using transactions increases the chance |
| | | * of lock contention. |
| | | * @return The number of records removed. |
| | | * @throws DatabaseException If an error occurs while cleaning the database. |
| | | */ |
| | | public long clear(Transaction txn) throws DatabaseException |
| | | { |
| | | long deletedCount = 0; |
| | | Cursor cursor = openCursor(txn, null); |
| | | try |
| | | { |
| | | if(debugEnabled()) |
| | | { |
| | | debugVerbose("%d existing records will be deleted from the " + |
| | | "database", getRecordCount()); |
| | | } |
| | | DatabaseEntry data = new DatabaseEntry(); |
| | | DatabaseEntry key = new DatabaseEntry(); |
| | | |
| | | OperationStatus status; |
| | | |
| | | // Step forward until we deleted all records. |
| | | for (status = cursor.getFirst(key, data, LockMode.DEFAULT); |
| | | status == OperationStatus.SUCCESS; |
| | | status = cursor.getNext(key, data, LockMode.DEFAULT)) |
| | | { |
| | | cursor.delete(); |
| | | deletedCount++; |
| | | } |
| | | if(debugEnabled()) |
| | | { |
| | | debugVerbose("%d records deleted", deletedCount); |
| | | } |
| | | } |
| | | catch(DatabaseException de) |
| | | { |
| | | if(debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | throw de; |
| | | } |
| | | finally |
| | | { |
| | | cursor.close(); |
| | | } |
| | | |
| | | return deletedCount; |
| | | } |
| | | |
| | | /** |
| | | * Get the count of the number of entries stored. |
| | | * |
| | | * @return The number of records stored. |
| | | * @return The number of entries stored. |
| | | * |
| | | * @throws DatabaseException If an error occurs in the JE database. |
| | | */ |
| | | public long computeRecordCount() throws DatabaseException |
| | | public long getRecordCount() throws DatabaseException |
| | | { |
| | | BtreeStats stats = (BtreeStats)getDatabase().getStats(new StatsConfig()); |
| | | return stats.getLeafNodeCount(); |
| | | return EntryContainer.count(getDatabase()); |
| | | } |
| | | |
| | | /** |
| | | * Get a string representation of this object. |
| | | * @return return A string representation of this object. |
| | | */ |
| | | public String toString() |
| | | { |
| | | return name; |
| | | } |
| | | |
| | | } |
| | |
| | | import static org.opends.server.util.ServerConstants.ATTR_REFERRAL_URL; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugCaught; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugInfo; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugVerbose; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import static org.opends.server.messages.JebMessages. |
| | | MSGID_JEB_REFERRAL_RESULT_MESSAGE; |
| | |
| | | { |
| | | database = entryContainer.openDatabase(dbConfig, name); |
| | | threadLocalDatabase.set(database); |
| | | |
| | | if(debugEnabled()) |
| | | { |
| | | debugInfo("JE DN2URI database %s opened with %d records.", |
| | | database.getDatabaseName(), database.count()); |
| | | } |
| | | } |
| | | return database; |
| | | } |
| | |
| | | * @param txn A database transaction used for the update, or null if none is |
| | | * required. |
| | | * @param entry The entry to be added. |
| | | * @return True if the entry was added successfully or False otherwise. |
| | | * @throws DatabaseException If an error occurs in the JE database. |
| | | */ |
| | | public void addEntry(Transaction txn, Entry entry) |
| | | public boolean addEntry(Transaction txn, Entry entry) |
| | | throws DatabaseException |
| | | { |
| | | boolean success = true; |
| | | Set<String> labeledURIs = entry.getReferralURLs(); |
| | | if (labeledURIs != null) |
| | | { |
| | | DN dn = entry.getDN(); |
| | | for (String labeledURI : labeledURIs) |
| | | { |
| | | insert(txn, dn, labeledURI); |
| | | if(!insert(txn, dn, labeledURI)) |
| | | { |
| | | success = false; |
| | | } |
| | | } |
| | | } |
| | | return success; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * Open a JE cursor on the DN database. |
| | | * @param txn A JE database transaction to be used by the cursor, |
| | | * or null if none. |
| | | * @param cursorConfig The JE cursor configuration. |
| | | * @return A JE cursor. |
| | | * @throws DatabaseException If an error occurs while attempting to open |
| | | * the cursor. |
| | | */ |
| | | public Cursor openCursor(Transaction txn, CursorConfig cursorConfig) |
| | | throws DatabaseException |
| | | { |
| | | return getDatabase().openCursor(txn, cursorConfig); |
| | | } |
| | | |
| | | /** |
| | | * Removes all records from the database. |
| | | * @param txn A JE database transaction to be used during the clear operation |
| | | * or null if not required. Using transactions increases the chance |
| | | * of lock contention. |
| | | * @return The number of records removed. |
| | | * @throws DatabaseException If an error occurs while cleaning the database. |
| | | */ |
| | | public long clear(Transaction txn) throws DatabaseException |
| | | { |
| | | long deletedCount = 0; |
| | | Cursor cursor = openCursor(txn, null); |
| | | try |
| | | { |
| | | if(debugEnabled()) |
| | | { |
| | | debugVerbose("%d existing records will be deleted from the " + |
| | | "database", getRecordCount()); |
| | | } |
| | | DatabaseEntry data = new DatabaseEntry(); |
| | | DatabaseEntry key = new DatabaseEntry(); |
| | | |
| | | OperationStatus status; |
| | | |
| | | // Step forward until we deleted all records. |
| | | for (status = cursor.getFirst(key, data, LockMode.DEFAULT); |
| | | status == OperationStatus.SUCCESS; |
| | | status = cursor.getNext(key, data, LockMode.DEFAULT)) |
| | | { |
| | | cursor.delete(); |
| | | deletedCount++; |
| | | } |
| | | if(debugEnabled()) |
| | | { |
| | | debugVerbose("%d records deleted", deletedCount); |
| | | } |
| | | } |
| | | catch(DatabaseException de) |
| | | { |
| | | if(debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | throw de; |
| | | } |
| | | finally |
| | | { |
| | | cursor.close(); |
| | | } |
| | | |
| | | return deletedCount; |
| | | } |
| | | |
| | | /** |
| | | * Checks whether the target of an operation is a referral entry and throws |
| | | * a Directory referral exception if it is. |
| | | * @param entry The target entry of the operation, or the base entry of a |
| | |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Get the count of the number of entries stored. |
| | | * |
| | | * @return The number of entries stored. |
| | | * |
| | | * @throws DatabaseException If an error occurs in the JE database. |
| | | */ |
| | | public long getRecordCount() throws DatabaseException |
| | | { |
| | | return EntryContainer.count(getDatabase()); |
| | | } |
| | | |
| | | /** |
| | | * Get a string representation of this object. |
| | | * @return return A string representation of this object. |
| | | */ |
| | | public String toString() |
| | | { |
| | | return name; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | // Update the referral database for referral entries. |
| | | dn2uri.addEntry(txn, entry); |
| | | if (!dn2uri.addEntry(txn, entry)) |
| | | { |
| | | // Do not ever expect to come through here. |
| | | int msgID = MSGID_JEB_ADD_ENTRY_ALREADY_EXISTS; |
| | | String message = getMessage(msgID, entry.getDN().toString()); |
| | | throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS, |
| | | message, msgID); |
| | | } |
| | | |
| | | // Insert into id2entry. |
| | | if (!id2entry.insert(txn, entryID, entry)) |
| | |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugInfo; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.server.messages.MessageHandler.getMessage; |
| | | import static org.opends.server.messages.JebMessages.*; |
| | | |
| | |
| | | { |
| | | database = entryContainer.openDatabase(dbConfig, name); |
| | | threadLocalDatabase.set(database); |
| | | |
| | | if(debugEnabled()) |
| | | { |
| | | debugInfo("JE ID2Entry database %s opened with %d records.", |
| | | database.getDatabaseName(), database.count()); |
| | | } |
| | | } |
| | | return database; |
| | | } |
| | |
| | | { |
| | | return EntryContainer.count(getDatabase()); |
| | | } |
| | | |
| | | /** |
| | | * Get a string representation of this object. |
| | | * @return return A string representation of this object. |
| | | */ |
| | | public String toString() |
| | | { |
| | | return name; |
| | | } |
| | | } |
| | |
| | | indexConfig.getEqualityEntryLimit()); |
| | | mergers.add(indexMergeThread); |
| | | } |
| | | if (indexConfig.isApproximateIndex()) |
| | | { |
| | | Index index = attrIndex.approximateIndex; |
| | | String name = containerName + "_" + index.toString(); |
| | | IndexMergeThread indexMergeThread = |
| | | new IndexMergeThread(name, config, ldifImportConfig, index, |
| | | indexConfig.getEqualityEntryLimit()); |
| | | mergers.add(indexMergeThread); |
| | | } |
| | | } |
| | | |
| | | // Id2Children index. |
| | |
| | | { |
| | | nIndexes++; |
| | | } |
| | | if (indexConfig.isApproximateIndex()) |
| | | { |
| | | nIndexes++; |
| | | } |
| | | } |
| | | |
| | | // Divide the total buffer size by the number of threads |
| | |
| | | indexBufferSize); |
| | | builders.add(indexBuilder); |
| | | } |
| | | if (indexConfig.isApproximateIndex()) |
| | | { |
| | | IndexBuilder indexBuilder = |
| | | new IndexBuilder(importContext, attrIndex.approximateIndex, |
| | | indexConfig.getEqualityEntryLimit(), |
| | | indexBufferSize); |
| | | builders.add(indexBuilder); |
| | | } |
| | | } |
| | | |
| | | // Create an index builder for the children index. |
| | |
| | | |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugCaught; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugInfo; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugVerbose; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import static org.opends.server.messages.JebMessages. |
| | | MSGID_JEB_DATABASE_EXCEPTION; |
| | | import static org.opends.server.messages.MessageHandler.getMessage; |
| | | |
| | | import com.sleepycat.je.Cursor; |
| | | import com.sleepycat.je.CursorConfig; |
| | |
| | | { |
| | | database = entryContainer.openDatabase(dbConfig, name); |
| | | threadLocalDatabase.set(database); |
| | | |
| | | if(debugEnabled()) |
| | | { |
| | | debugInfo("JE Index database %s opened with %d records.", |
| | | database.getDatabaseName(), database.count()); |
| | | } |
| | | } |
| | | return database; |
| | | } |
| | |
| | | * @param txn A database transaction, or null if none is required. |
| | | * @param key The index key. |
| | | * @param entryID The entry ID. |
| | | * @return True if the entry ID is inserted or ignored because the entry limit |
| | | * count is exceeded. False if it alreadly exists in the entry ID set |
| | | * for the given key. |
| | | * @throws DatabaseException If an error occurs in the JE database. |
| | | */ |
| | | public void insertID(Transaction txn, DatabaseEntry key, EntryID entryID) |
| | | public boolean insertID(Transaction txn, DatabaseEntry key, EntryID entryID) |
| | | throws DatabaseException |
| | | { |
| | | OperationStatus status; |
| | | LockMode lockMode = LockMode.RMW; |
| | | DatabaseEntry entryIDData = entryID.getDatabaseEntry(); |
| | | DatabaseEntry data = new DatabaseEntry(); |
| | | boolean success = true; |
| | | |
| | | status = EntryContainer.read(getDatabase(), txn, key, data, lockMode); |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | entryIDList.add(entryID); |
| | | if(!entryIDList.add(entryID)) |
| | | { |
| | | success = false; |
| | | } |
| | | } |
| | | |
| | | byte[] after = entryIDList.toDatabase(); |
| | |
| | | { |
| | | EntryContainer.put(getDatabase(), txn, key, entryIDData); |
| | | } |
| | | |
| | | return success; |
| | | } |
| | | |
| | | /** |
| | |
| | | * or null if none is required. |
| | | * @param cursorConfig The requested JE cursor configuration. |
| | | * @return A new JE cursor. |
| | | * @throws JebException If an error occurs in the JE backend. |
| | | * @throws DatabaseException If an error occurs while attempting to open |
| | | * the cursor. |
| | | */ |
| | | public Cursor openCursor(Transaction txn, CursorConfig cursorConfig) |
| | | throws JebException |
| | | throws DatabaseException |
| | | { |
| | | return getDatabase().openCursor(txn, cursorConfig); |
| | | } |
| | | |
| | | /** |
| | | * Removes all records from the database. |
| | | * @param txn A JE database transaction to be used during the clear operation |
| | | * or null if not required. Using transactions increases the chance |
| | | * of lock contention. |
| | | * @return The number of records removed. |
| | | * @throws DatabaseException If an error occurs while cleaning the database. |
| | | */ |
| | | public long clear(Transaction txn) throws DatabaseException |
| | | { |
| | | long deletedCount = 0; |
| | | Cursor cursor = openCursor(txn, null); |
| | | try |
| | | { |
| | | return getDatabase().openCursor(txn, cursorConfig); |
| | | } |
| | | catch (DatabaseException e) |
| | | { |
| | | if (debugEnabled()) |
| | | if(debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | debugVerbose("%d existing records will be deleted from the " + |
| | | "database", getRecordCount()); |
| | | } |
| | | int msgID = MSGID_JEB_DATABASE_EXCEPTION; |
| | | String message = getMessage(msgID, e.getMessage()); |
| | | throw new JebException(msgID, message, e); |
| | | DatabaseEntry data = new DatabaseEntry(); |
| | | DatabaseEntry key = new DatabaseEntry(); |
| | | |
| | | OperationStatus status; |
| | | |
| | | // Step forward until we deleted all records. |
| | | for (status = cursor.getFirst(key, data, LockMode.DEFAULT); |
| | | status == OperationStatus.SUCCESS; |
| | | status = cursor.getNext(key, data, LockMode.DEFAULT)) |
| | | { |
| | | cursor.delete(); |
| | | deletedCount++; |
| | | } |
| | | if(debugEnabled()) |
| | | { |
| | | debugVerbose("%d records deleted", deletedCount); |
| | | } |
| | | } |
| | | catch(DatabaseException de) |
| | | { |
| | | if(debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | throw de; |
| | | } |
| | | finally |
| | | { |
| | | cursor.close(); |
| | | } |
| | | |
| | | return deletedCount; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param txn A database transaction, or null if none is required. |
| | | * @param entryID The entry ID. |
| | | * @param entry The entry to be indexed. |
| | | * @return True if all the indexType keys for the entry are added. False if |
| | | * the entry ID alreadly exists for some keys. |
| | | * @throws DatabaseException If an error occurs in the JE database. |
| | | * @throws DirectoryException If a Directory Server error occurs. |
| | | */ |
| | | public void addEntry(Transaction txn, EntryID entryID, Entry entry) |
| | | public boolean addEntry(Transaction txn, EntryID entryID, Entry entry) |
| | | throws DatabaseException, DirectoryException |
| | | { |
| | | HashSet<ASN1OctetString> addKeys = new HashSet<ASN1OctetString>(); |
| | | boolean success = true; |
| | | |
| | | indexer.indexEntry(txn, entry, addKeys); |
| | | |
| | |
| | | for (ASN1OctetString keyBytes : addKeys) |
| | | { |
| | | key.setData(keyBytes.value()); |
| | | insertID(txn, key, entryID); |
| | | if(!insertID(txn, key, entryID)) |
| | | { |
| | | success = false; |
| | | } |
| | | } |
| | | |
| | | return success; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Get the count of the number of entries stored. |
| | | * |
| | | * @return The number of entries stored. |
| | | * |
| | | * @throws DatabaseException If an error occurs in the JE database. |
| | | */ |
| | | public long getRecordCount() throws DatabaseException |
| | | { |
| | | return EntryContainer.count(getDatabase()); |
| | | } |
| | | |
| | | } |
| | |
| | | private boolean isOrdering = false; |
| | | |
| | | /** |
| | | * Indicates whether this index is configured for attribute approximate. |
| | | */ |
| | | private boolean isApproximate = false; |
| | | |
| | | /** |
| | | * The index entry limit for the attribute equality database. |
| | | */ |
| | | private int equalityEntryLimit = 4000; |
| | |
| | | } |
| | | |
| | | /** |
| | | * Determine if this index is configured for attribute approximating. |
| | | * @return true if the index is configured for attribute approximating. |
| | | */ |
| | | public boolean isApproximateIndex() |
| | | { |
| | | return isApproximate; |
| | | } |
| | | |
| | | /** |
| | | * Configures this index for attribute approximating. |
| | | * @param isApproximate Sets attribute approximate indexing if true. |
| | | */ |
| | | public void setApproximateIndex(boolean isApproximate) |
| | | { |
| | | this.isApproximate = isApproximate; |
| | | } |
| | | |
| | | /** |
| | | * Get the configured entry limit for attribute equality indexing. |
| | | * @return The index entry limit, or 0 if there is no limit. |
| | | */ |
| | |
| | | candidates = evaluatePresenceFilter(filter); |
| | | break; |
| | | |
| | | case NOT: |
| | | case APPROXIMATE_MATCH: |
| | | if (buffer != null) |
| | | { |
| | | filter.toString(buffer); |
| | | } |
| | | candidates = evaluateApproximateFilter(filter); |
| | | break; |
| | | |
| | | case NOT: |
| | | case EXTENSIBLE_MATCH: |
| | | default: |
| | | if (buffer != null) |
| | |
| | | return candidates; |
| | | } |
| | | |
| | | /** |
| | | * Evaluate an approximate filter against the indexes. |
| | | * |
| | | * @param approximateFilter The approximate filter to be evaluated. |
| | | * @return A set of entry IDs representing candidate entries. |
| | | */ |
| | | private EntryIDSet evaluateApproximateFilter(SearchFilter approximateFilter) |
| | | { |
| | | EntryIDSet candidates; |
| | | AttributeIndex attributeIndex = |
| | | entryContainer.getAttributeIndex(approximateFilter.getAttributeType()); |
| | | if (attributeIndex == null) |
| | | { |
| | | candidates = new EntryIDSet(); |
| | | } |
| | | else |
| | | { |
| | | candidates = attributeIndex.evaluateApproximateFilter(approximateFilter); |
| | | } |
| | | return candidates; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | | import org.opends.server.api.DirectoryThread; |
| | | |
| | | import com.sleepycat.je.*; |
| | | |
| | | import org.opends.server.types.*; |
| | | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugError; |
| | | import static org.opends.server.messages.JebMessages. |
| | | MSGID_JEB_MISSING_DN2ID_RECORD; |
| | | import static org.opends.server.messages.JebMessages. |
| | | MSGID_JEB_REBUILD_INDEX_FAILED; |
| | | import static org.opends.server.messages.JebMessages. |
| | | MSGID_JEB_REBUILD_INSERT_ENTRY_FAILED; |
| | | import static org.opends.server.messages.MessageHandler.getMessage; |
| | | import static org.opends.server.loggers.Error.logError; |
| | | import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString; |
| | | |
| | | |
| | | /** |
| | | * A thread to do the actual work of rebuilding an index. |
| | | */ |
| | | public class IndexRebuildThread extends DirectoryThread |
| | | { |
| | | /** |
| | | * The entry container. |
| | | */ |
| | | EntryContainer ec = null; |
| | | |
| | | /** |
| | | * The internal database/indexType to rebuild. |
| | | */ |
| | | IndexType indexType = null; |
| | | |
| | | /** |
| | | * The attribute indexType to rebuild. |
| | | */ |
| | | AttributeIndex attrIndex = null; |
| | | |
| | | /** |
| | | * The indexType to rebuild. |
| | | */ |
| | | Index index = null; |
| | | |
| | | /** |
| | | * Name of the indexType being rebuilt. |
| | | */ |
| | | String indexName = null; |
| | | |
| | | /** |
| | | * The ID2ENTRY database. |
| | | */ |
| | | ID2Entry id2entry = null; |
| | | |
| | | /** |
| | | * The number of total entries to rebuild. An negative value indicates this |
| | | * value is not yet known. |
| | | */ |
| | | long totalEntries = -1; |
| | | |
| | | /** |
| | | * The number of entries processed. |
| | | */ |
| | | long processedEntries = 0; |
| | | |
| | | /** |
| | | * The number of entries rebuilt successfully. |
| | | */ |
| | | long rebuiltEntries = 0; |
| | | |
| | | /** |
| | | * The number of entries rebuilt with possible duplicates. |
| | | */ |
| | | long duplicatedEntries = 0; |
| | | |
| | | /** |
| | | * The number of entries that were skipped because they were not applicable |
| | | * for the indexType or because an error occured. |
| | | */ |
| | | long skippedEntries = 0; |
| | | |
| | | /** |
| | | * The types of internal indexes that are rebuildable. |
| | | */ |
| | | enum IndexType |
| | | { |
| | | DN2ID, DN2URI, ID2CHILDREN, ID2SUBTREE, INDEX, ATTRIBUTEINDEX |
| | | } |
| | | |
| | | /** |
| | | * Construct a new index rebuild thread to rebuild a system index. |
| | | * |
| | | * @param ec The entry container to rebuild in. |
| | | * @param index The index type to rebuild. |
| | | */ |
| | | IndexRebuildThread(EntryContainer ec, IndexType index) |
| | | { |
| | | super("Index Rebuild Thread " + ec.getContainerName() + "_" + |
| | | index.toString()); |
| | | this.ec = ec; |
| | | this.indexType = index; |
| | | this.id2entry = ec.getID2Entry(); |
| | | this.indexName = ec.getContainerName() + "_" + index.toString(); |
| | | } |
| | | |
| | | /** |
| | | * Construct a new index rebuild thread to rebuild an index. |
| | | * |
| | | * @param ec The entry container to rebuild in. |
| | | * @param index The index to rebuild. |
| | | */ |
| | | IndexRebuildThread(EntryContainer ec, Index index) |
| | | { |
| | | super("Index Rebuild Thread " + ec.getContainerName() + "_" + |
| | | index.toString()); |
| | | this.ec = ec; |
| | | this.indexType = IndexType.INDEX; |
| | | this.index = index; |
| | | this.id2entry = ec.getID2Entry(); |
| | | this.indexName = ec.getContainerName() + "_" + index.toString(); |
| | | } |
| | | |
| | | /** |
| | | * Construct a new index rebuild thread to rebuild an attribute index. |
| | | * |
| | | * @param ec The entry container to rebuild in. |
| | | * @param index The attribute index to rebuild. |
| | | */ |
| | | IndexRebuildThread(EntryContainer ec, AttributeIndex index) |
| | | { |
| | | super("Index Rebuild Thread " + ec.getContainerName() + "_" + |
| | | index.toString()); |
| | | this.ec = ec; |
| | | this.indexType = IndexType.ATTRIBUTEINDEX; |
| | | this.attrIndex = index; |
| | | this.id2entry = ec.getID2Entry(); |
| | | this.indexName = ec.getContainerName() + "_" + index.toString(); |
| | | } |
| | | |
| | | /** |
| | | * Start the rebuild process. |
| | | */ |
| | | public void run() |
| | | { |
| | | if(indexType == null) |
| | | { |
| | | //TODO: throw error |
| | | if(debugEnabled()) |
| | | { |
| | | debugError("No index type specified. Rebuild process terminated."); |
| | | } |
| | | |
| | | return; |
| | | } |
| | | if(indexType == IndexType.ATTRIBUTEINDEX && attrIndex == null) |
| | | { |
| | | //TODO: throw error |
| | | if(debugEnabled()) |
| | | { |
| | | debugError("No attribute index specified. Rebuild process terminated."); |
| | | } |
| | | |
| | | return; |
| | | } |
| | | |
| | | if(indexType == IndexType.INDEX && index == null) |
| | | { |
| | | //TODO: throw error |
| | | if(debugEnabled()) |
| | | { |
| | | debugError("No index specified. Rebuild process terminated."); |
| | | } |
| | | |
| | | return; |
| | | } |
| | | |
| | | try |
| | | { |
| | | totalEntries = getTotalEntries(); |
| | | if(debugEnabled()) |
| | | { |
| | | debugInfo("Initiating rebuild of the %s indexType/database", indexName); |
| | | debugVerbose("%d entries will be rebuilt", totalEntries); |
| | | } |
| | | |
| | | switch(indexType) |
| | | { |
| | | case DN2ID : rebuildDN2ID(); |
| | | break; |
| | | case DN2URI : rebuildDN2URI(); |
| | | break; |
| | | case ID2CHILDREN : rebuildID2Children(); |
| | | break; |
| | | case ID2SUBTREE : rebuildID2Subtree(); |
| | | break; |
| | | case ATTRIBUTEINDEX : rebuildAttributeIndex(attrIndex); |
| | | break; |
| | | case INDEX : rebuildAttributeIndex(index); |
| | | } |
| | | |
| | | if(debugEnabled()) |
| | | { |
| | | debugVerbose("Rebuilt %d entries", rebuiltEntries); |
| | | } |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | int msgID = MSGID_JEB_REBUILD_INDEX_FAILED; |
| | | String message = getMessage(msgID, this.getName(), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | |
| | | if(debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Rebuild an interal DN2ID database. |
| | | * |
| | | * @throws DatabaseException If an error occurs during the rebuild. |
| | | */ |
| | | private void rebuildDN2ID() throws DatabaseException |
| | | { |
| | | DN2ID dn2id = ec.getDN2ID(); |
| | | Transaction txn = ec.beginTransaction(); |
| | | try |
| | | { |
| | | //Delete all records in the indexType databases. |
| | | //TODO: Should we do a transactional delete? |
| | | dn2id.clear(txn); |
| | | } |
| | | finally |
| | | { |
| | | EntryContainer.transactionCommit(txn); |
| | | } |
| | | |
| | | //Iterate through the id2entry database and insert associated dn2id |
| | | //records. |
| | | Cursor cursor = id2entry.openCursor(null, null); |
| | | try |
| | | { |
| | | DatabaseEntry key = new DatabaseEntry(); |
| | | DatabaseEntry data = new DatabaseEntry(); |
| | | LockMode lockMode = LockMode.DEFAULT; |
| | | |
| | | OperationStatus status; |
| | | for (status = cursor.getFirst(key, data, lockMode); |
| | | status == OperationStatus.SUCCESS; |
| | | status = cursor.getNext(key, data, lockMode)) |
| | | { |
| | | try |
| | | { |
| | | EntryID entryID = new EntryID(key); |
| | | Entry entry = JebFormat.entryFromDatabase(data.getData()); |
| | | |
| | | //TODO: Should we add all records in a big transaction? |
| | | //TODO: Should we make each insert a transaction? |
| | | // Insert into dn2id. |
| | | if (dn2id.insert(null, entry.getDN(), entryID)) |
| | | { |
| | | rebuiltEntries++; |
| | | } |
| | | else |
| | | { |
| | | // The entry ID alreadly exists in the database. |
| | | // This could happen if some other process got to this entry |
| | | // before we did. Since the backend should be offline, this |
| | | // might be a problem. |
| | | duplicatedEntries++; |
| | | if(debugEnabled()) |
| | | { |
| | | debugInfo("Unable to insert entry with DN %s and ID %d " + |
| | | "into the DN2ID database because it already exists.", |
| | | entry.getDN().toString(), entryID.longValue()); |
| | | } |
| | | } |
| | | processedEntries++; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | //TODO: throw error stating that the indexType could be in an |
| | | // inconsistant state. |
| | | //TODO: Should we continue on or stop right now? |
| | | skippedEntries++; |
| | | |
| | | int msgID = MSGID_JEB_REBUILD_INSERT_ENTRY_FAILED; |
| | | String message = getMessage(msgID, indexName, |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.MILD_ERROR, |
| | | message, msgID); |
| | | |
| | | if (debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | finally |
| | | { |
| | | cursor.close(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Rebuild the ID2URI internal database. |
| | | * |
| | | * @throws DatabaseException if an error occurs during rebuild. |
| | | */ |
| | | private void rebuildDN2URI() throws DatabaseException |
| | | { |
| | | DN2URI dn2uri = ec.getDN2URI(); |
| | | Transaction txn = ec.beginTransaction(); |
| | | try |
| | | { |
| | | //Delete all records in the indexType databases. |
| | | //TODO: Should we do a transactional delete? |
| | | dn2uri.clear(txn); |
| | | } |
| | | finally |
| | | { |
| | | EntryContainer.transactionCommit(txn); |
| | | } |
| | | |
| | | //Iterate through the id2entry database and insert associated dn2uri |
| | | //records. |
| | | Cursor cursor = id2entry.openCursor(null, null); |
| | | try |
| | | { |
| | | DatabaseEntry key = new DatabaseEntry(); |
| | | DatabaseEntry data = new DatabaseEntry(); |
| | | LockMode lockMode = LockMode.DEFAULT; |
| | | |
| | | |
| | | OperationStatus status; |
| | | for (status = cursor.getFirst(key, data, lockMode); |
| | | status == OperationStatus.SUCCESS; |
| | | status = cursor.getNext(key, data, lockMode)) |
| | | { |
| | | try |
| | | { |
| | | EntryID entryID = new EntryID(key); |
| | | Entry entry = JebFormat.entryFromDatabase(data.getData()); |
| | | |
| | | //TODO: Should we add all records in a big transaction? |
| | | //TODO: Should we make each insert a transaction? |
| | | // Insert into dn2uri. |
| | | if (dn2uri.addEntry(null, entry)) |
| | | { |
| | | rebuiltEntries++; |
| | | } |
| | | else |
| | | { |
| | | // The entry DN and URIs alreadly exists in the database. |
| | | // This could happen if some other process got to this entry |
| | | // before we did. Since the backend should be offline, this |
| | | // might be a problem. |
| | | duplicatedEntries++; |
| | | if(debugEnabled()) |
| | | { |
| | | debugInfo("Unable to insert entry with DN %s and ID %d " + |
| | | "into the DN2URI database because it already exists.", |
| | | entry.getDN().toString(), entryID.longValue()); |
| | | } |
| | | } |
| | | processedEntries++; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | //TODO: throw error stating that the indexType could be in an |
| | | // inconsistant state. |
| | | //TODO: Should we continue on or stop right now? |
| | | skippedEntries++; |
| | | |
| | | int msgID = MSGID_JEB_REBUILD_INSERT_ENTRY_FAILED; |
| | | String message = getMessage(msgID, indexName, |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.MILD_ERROR, |
| | | message, msgID); |
| | | |
| | | if (debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | finally |
| | | { |
| | | cursor.close(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Rebuild the ID2Subtree internal index. This depends on the DN2ID and DN2URI |
| | | * databases being complete. |
| | | * |
| | | * @throws DatabaseException if an error occurs during rebuild. |
| | | */ |
| | | private void rebuildID2Children() throws DatabaseException |
| | | { |
| | | Index id2children = ec.getID2Children(); |
| | | Transaction txn = ec.beginTransaction(); |
| | | try |
| | | { |
| | | //Delete all records in the indexType databases. |
| | | //TODO: Should we do a transactional delete? |
| | | id2children.clear(txn); |
| | | } |
| | | finally |
| | | { |
| | | EntryContainer.transactionCommit(txn); |
| | | } |
| | | |
| | | DN2ID dn2id = ec.getDN2ID(); |
| | | DN2URI dn2uri = ec.getDN2URI(); |
| | | |
| | | //Iterate through the id2entry database and insert associated dn2children |
| | | //records. |
| | | Cursor cursor = id2entry.openCursor(null, null); |
| | | try |
| | | { |
| | | DatabaseEntry key = new DatabaseEntry(); |
| | | DatabaseEntry data = new DatabaseEntry(); |
| | | LockMode lockMode = LockMode.DEFAULT; |
| | | |
| | | OperationStatus status; |
| | | for (status = cursor.getFirst(key, data, lockMode); |
| | | status == OperationStatus.SUCCESS; |
| | | status = cursor.getNext(key, data, lockMode)) |
| | | { |
| | | try |
| | | { |
| | | EntryID entryID = new EntryID(key); |
| | | Entry entry = JebFormat.entryFromDatabase(data.getData()); |
| | | |
| | | // Check that the parent entry exists. |
| | | DN parentDN = ec.getParentWithinBase(entry.getDN()); |
| | | if (parentDN != null) |
| | | { |
| | | // Check for referral entries above the target. |
| | | dn2uri.targetEntryReferrals(entry.getDN(), null); |
| | | |
| | | // Read the parent ID from dn2id. |
| | | EntryID parentID = dn2id.get(null, parentDN); |
| | | if (parentID != null) |
| | | { |
| | | // Insert into id2children for parent ID. |
| | | if(id2children.insertID(null, parentID.getDatabaseEntry(), |
| | | entryID)) |
| | | { |
| | | rebuiltEntries++; |
| | | } |
| | | else |
| | | { |
| | | // The entry alreadly exists in the database. |
| | | // This could happen if some other process got to this entry |
| | | // before we did. Since the backend should be offline, this |
| | | // might be a problem. |
| | | if(debugEnabled()) |
| | | { |
| | | duplicatedEntries++; |
| | | debugInfo("Unable to insert entry with DN %s and ID %d " + |
| | | "into the DN2Subtree database because it already " + |
| | | "exists.", |
| | | entry.getDN().toString(), entryID.longValue()); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | int msgID = MSGID_JEB_MISSING_DN2ID_RECORD; |
| | | String msg = getMessage(msgID, parentDN.toNormalizedString()); |
| | | throw new JebException(msgID, msg); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | skippedEntries++; |
| | | } |
| | | processedEntries++; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | //TODO: Should we continue on or stop right now? |
| | | skippedEntries++; |
| | | |
| | | int msgID = MSGID_JEB_REBUILD_INSERT_ENTRY_FAILED; |
| | | String message = getMessage(msgID, indexName, |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.MILD_ERROR, |
| | | message, msgID); |
| | | |
| | | if (debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | finally |
| | | { |
| | | cursor.close(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Rebuild the ID2Subtree internal index. This depends on the DN2ID and DN2URI |
| | | * databases being complete. |
| | | * |
| | | * @throws DatabaseException if an error occurs during rebuild. |
| | | */ |
| | | private void rebuildID2Subtree() throws DatabaseException |
| | | { |
| | | Index id2subtree = ec.getID2Subtree(); |
| | | Transaction txn = ec.beginTransaction(); |
| | | try |
| | | { |
| | | //Delete all records in the indexType databases. |
| | | //TODO: Should we do a transactional delete? |
| | | id2subtree.clear(txn); |
| | | } |
| | | finally |
| | | { |
| | | EntryContainer.transactionCommit(txn); |
| | | } |
| | | |
| | | DN2ID dn2id = ec.getDN2ID(); |
| | | DN2URI dn2uri = ec.getDN2URI(); |
| | | |
| | | //Iterate through the id2entry database and insert associated dn2subtree |
| | | //records. |
| | | Cursor cursor = id2entry.openCursor(null, null); |
| | | try |
| | | { |
| | | DatabaseEntry key = new DatabaseEntry(); |
| | | DatabaseEntry data = new DatabaseEntry(); |
| | | LockMode lockMode = LockMode.DEFAULT; |
| | | |
| | | OperationStatus status; |
| | | for (status = cursor.getFirst(key, data, lockMode); |
| | | status == OperationStatus.SUCCESS; |
| | | status = cursor.getNext(key, data, lockMode)) |
| | | { |
| | | try |
| | | { |
| | | EntryID entryID = new EntryID(key); |
| | | Entry entry = JebFormat.entryFromDatabase(data.getData()); |
| | | |
| | | // Check that the parent entry exists. |
| | | DN parentDN = ec.getParentWithinBase(entry.getDN()); |
| | | if (parentDN != null) |
| | | { |
| | | boolean success = true; |
| | | |
| | | // Check for referral entries above the target. |
| | | dn2uri.targetEntryReferrals(entry.getDN(), null); |
| | | |
| | | // Read the parent ID from dn2id. |
| | | EntryID parentID = dn2id.get(null, parentDN); |
| | | if (parentID != null) |
| | | { |
| | | // Insert into id2subtree for parent ID. |
| | | if(!id2subtree.insertID(null, parentID.getDatabaseEntry(), |
| | | entryID)) |
| | | { |
| | | success = false; |
| | | } |
| | | |
| | | // Iterate up through the superior entries, starting above the |
| | | // parent. |
| | | for (DN dn = ec.getParentWithinBase(parentDN); dn != null; |
| | | dn = ec.getParentWithinBase(dn)) |
| | | { |
| | | // Read the ID from dn2id. |
| | | EntryID nodeID = dn2id.get(null, dn); |
| | | if (nodeID != null) |
| | | { |
| | | // Insert into id2subtree for this node. |
| | | if(!id2subtree.insertID(null, nodeID.getDatabaseEntry(), |
| | | entryID)) |
| | | { |
| | | success = false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | int msgID = MSGID_JEB_MISSING_DN2ID_RECORD; |
| | | String msg = getMessage(msgID, dn.toNormalizedString()); |
| | | throw new JebException(msgID, msg); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | int msgID = MSGID_JEB_MISSING_DN2ID_RECORD; |
| | | String msg = getMessage(msgID, parentDN.toNormalizedString()); |
| | | throw new JebException(msgID, msg); |
| | | } |
| | | |
| | | if(success) |
| | | { |
| | | rebuiltEntries++; |
| | | } |
| | | else |
| | | { |
| | | // The entry alreadly exists in the database. |
| | | // This could happen if some other process got to this entry |
| | | // before we did. Since the backend should be offline, this |
| | | // might be a problem. |
| | | if(debugEnabled()) |
| | | { |
| | | duplicatedEntries++; |
| | | debugInfo("Unable to insert entry with DN %s and ID %d " + |
| | | "into the DN2Subtree database because it already " + |
| | | "exists.", |
| | | entry.getDN().toString(), entryID.longValue()); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | skippedEntries++; |
| | | } |
| | | processedEntries++; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | //TODO: Should we continue on or stop right now? |
| | | skippedEntries++; |
| | | |
| | | int msgID = MSGID_JEB_REBUILD_INSERT_ENTRY_FAILED; |
| | | String message = getMessage(msgID, indexName, |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.MILD_ERROR, |
| | | message, msgID); |
| | | |
| | | if (debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | finally |
| | | { |
| | | cursor.close(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Rebuild the attribute index. |
| | | * |
| | | * @param index The indexType to rebuild. |
| | | * @throws DatabaseException if an error occurs during rebuild. |
| | | */ |
| | | private void rebuildAttributeIndex(AttributeIndex index) |
| | | throws DatabaseException |
| | | { |
| | | Transaction txn = ec.beginTransaction(); |
| | | try |
| | | { |
| | | //Delete all records in the indexType databases. |
| | | //TODO: Should we do a transactional delete? |
| | | index.clear(txn); |
| | | } |
| | | finally |
| | | { |
| | | EntryContainer.transactionCommit(txn); |
| | | } |
| | | |
| | | //Iterate through the id2entry database and insert associated indexType |
| | | //records. |
| | | Cursor cursor = id2entry.openCursor(null, null); |
| | | try |
| | | { |
| | | DatabaseEntry key = new DatabaseEntry(); |
| | | DatabaseEntry data = new DatabaseEntry(); |
| | | LockMode lockMode = LockMode.DEFAULT; |
| | | |
| | | OperationStatus status; |
| | | for (status = cursor.getFirst(key, data, lockMode); |
| | | status == OperationStatus.SUCCESS; |
| | | status = cursor.getNext(key, data, lockMode)) |
| | | { |
| | | try |
| | | { |
| | | EntryID entryID = new EntryID(key); |
| | | Entry entry = JebFormat.entryFromDatabase(data.getData()); |
| | | |
| | | // Insert into attribute indexType. |
| | | if(index.addEntry(null, entryID, entry)) |
| | | { |
| | | rebuiltEntries++; |
| | | } |
| | | else |
| | | { |
| | | // The entry alreadly exists in one or more entry sets. |
| | | // This could happen if some other process got to this entry |
| | | // before we did. Since the backend should be offline, this |
| | | // might be a problem. |
| | | if(debugEnabled()) |
| | | { |
| | | duplicatedEntries++; |
| | | debugInfo("Unable to insert entry with DN %s and ID %d " + |
| | | "into the DN2Subtree database because it already " + |
| | | "exists.", |
| | | entry.getDN().toString(), entryID.longValue()); |
| | | } |
| | | } |
| | | processedEntries++; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | //TODO: Should we continue on or stop right now? |
| | | skippedEntries++; |
| | | |
| | | int msgID = MSGID_JEB_REBUILD_INSERT_ENTRY_FAILED; |
| | | String message = getMessage(msgID, indexName, |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.MILD_ERROR, |
| | | message, msgID); |
| | | |
| | | if (debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | finally |
| | | { |
| | | cursor.close(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Rebuild the partial attribute index. |
| | | * |
| | | * @param index The indexType to rebuild. |
| | | * @throws DatabaseException if an error occurs during rebuild. |
| | | */ |
| | | private void rebuildAttributeIndex(Index index) |
| | | throws DatabaseException |
| | | { |
| | | Transaction txn = ec.beginTransaction(); |
| | | try |
| | | { |
| | | //Delete all records in the indexType databases. |
| | | //TODO: Should we do a transactional delete? |
| | | index.clear(txn); |
| | | } |
| | | finally |
| | | { |
| | | EntryContainer.transactionCommit(txn); |
| | | } |
| | | |
| | | //Iterate through the id2entry database and insert associated indexType |
| | | //records. |
| | | Cursor cursor = id2entry.openCursor(null, null); |
| | | try |
| | | { |
| | | DatabaseEntry key = new DatabaseEntry(); |
| | | DatabaseEntry data = new DatabaseEntry(); |
| | | LockMode lockMode = LockMode.DEFAULT; |
| | | |
| | | OperationStatus status; |
| | | for (status = cursor.getFirst(key, data, lockMode); |
| | | status == OperationStatus.SUCCESS; |
| | | status = cursor.getNext(key, data, lockMode)) |
| | | { |
| | | try |
| | | { |
| | | EntryID entryID = new EntryID(key); |
| | | Entry entry = JebFormat.entryFromDatabase(data.getData()); |
| | | |
| | | // Insert into attribute indexType. |
| | | if(index.addEntry(null, entryID, entry)) |
| | | { |
| | | rebuiltEntries++; |
| | | } |
| | | else |
| | | { |
| | | // The entry alreadly exists in one or more entry sets. |
| | | // This could happen if some other process got to this entry |
| | | // before we did. Since the backend should be offline, this |
| | | // might be a problem. |
| | | if(debugEnabled()) |
| | | { |
| | | duplicatedEntries++; |
| | | debugInfo("Unable to insert entry with DN %s and ID %d " + |
| | | "into the DN2Subtree database because it already " + |
| | | "exists.", |
| | | entry.getDN().toString(), entryID.longValue()); |
| | | } |
| | | } |
| | | processedEntries++; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | //TODO: Should we continue on or stop right now? |
| | | skippedEntries++; |
| | | |
| | | int msgID = MSGID_JEB_REBUILD_INSERT_ENTRY_FAILED; |
| | | String message = getMessage(msgID, indexName, |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.MILD_ERROR, |
| | | message, msgID); |
| | | |
| | | if (debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | finally |
| | | { |
| | | cursor.close(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Get the total entries to process in the rebuild. |
| | | * |
| | | * @return The total entries to process. |
| | | * @throws DatabaseException if an error occurs while getting the total |
| | | * number of entries to process. |
| | | */ |
| | | public long getTotalEntries() throws DatabaseException |
| | | { |
| | | //If total entries is not calculated yet, do it now. |
| | | if(totalEntries < 0) |
| | | { |
| | | totalEntries = id2entry.getRecordCount(); |
| | | } |
| | | return totalEntries; |
| | | } |
| | | |
| | | /** |
| | | * Get the number of entries processed in the rebuild. |
| | | * |
| | | * @return The total entries processed. |
| | | */ |
| | | public long getProcessedEntries() |
| | | { |
| | | return processedEntries; |
| | | } |
| | | |
| | | /** |
| | | * Get the number of entries successfully rebuilt. |
| | | * |
| | | * @return The number of entries successfully rebuilt. |
| | | */ |
| | | public long getRebuiltEntries() |
| | | { |
| | | return rebuiltEntries; |
| | | } |
| | | |
| | | /** |
| | | * Get the number of entries that encountered duplicated indexType values in |
| | | * the rebuild process. |
| | | * |
| | | * @return The number of entries that encountered duplicated indexType values |
| | | * in the rebuild process. |
| | | */ |
| | | public long getDuplicatedEntries() |
| | | { |
| | | return duplicatedEntries; |
| | | } |
| | | |
| | | /** |
| | | * Get the number of entries skipped because they were either not applicable |
| | | * or an error occured during the process. |
| | | * |
| | | * @return The number of entries skipped. |
| | | */ |
| | | public long getSkippedEntries() |
| | | { |
| | | return skippedEntries; |
| | | } |
| | | |
| | | /** |
| | | * Get the index type being rebuilt by this thread. |
| | | * |
| | | * @return The index type being rebuilt by this thread. |
| | | */ |
| | | public IndexType getIndexType() |
| | | { |
| | | return indexType; |
| | | } |
| | | } |
| | | |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | | import org.opends.server.types.DN; |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | /** |
| | | * Configuration for the indexType rebuild process. |
| | | */ |
| | | public class RebuildConfig |
| | | { |
| | | /** |
| | | * The base DN to rebuild. |
| | | */ |
| | | private DN baseDN; |
| | | |
| | | /** |
| | | * The names of indexes to rebuild. |
| | | */ |
| | | private ArrayList<String> rebuildList; |
| | | |
| | | /** |
| | | * The maximum number of rebuild threads to use at one time. An negative |
| | | * number indicates unlimited max number of threads. |
| | | */ |
| | | private int maxRebuildThreads = -1; |
| | | |
| | | /** |
| | | * Create a new rebuild configuraiton. |
| | | */ |
| | | public RebuildConfig() |
| | | { |
| | | rebuildList = new ArrayList<String>(); |
| | | } |
| | | |
| | | /** |
| | | * Get the base DN to rebuild. |
| | | * @return The base DN to rebuild. |
| | | */ |
| | | public DN getBaseDN() |
| | | { |
| | | return baseDN; |
| | | } |
| | | |
| | | /** |
| | | * Set the base DN to rebuild. |
| | | * @param baseDN The base DN to rebuild. |
| | | */ |
| | | public void setBaseDN(DN baseDN) |
| | | { |
| | | this.baseDN = baseDN; |
| | | } |
| | | |
| | | /** |
| | | * Get the list of indexes to rebuild in this configuration. |
| | | * |
| | | * @return The list of indexes to rebuild. |
| | | */ |
| | | public ArrayList<String> getRebuildList() |
| | | { |
| | | return rebuildList; |
| | | } |
| | | |
| | | /** |
| | | * Add an index to be rebuilt into the configuration. Duplicate index names |
| | | * will be ignored. Adding an index that causes a mix of complete and partial |
| | | * rebuild for the same attribute index in the configuration will remove |
| | | * the partial and just keep the complete attribute index name. |
| | | * (ie. uid and uid.presence). |
| | | * |
| | | * @param index The index to add. |
| | | */ |
| | | public void addRebuildIndex(String index) |
| | | { |
| | | String[] newIndexParts = index.split("\\."); |
| | | |
| | | for(String s : new ArrayList<String>(rebuildList)) |
| | | { |
| | | String[] existingIndexParts = s.split("\\."); |
| | | if(existingIndexParts[0].equalsIgnoreCase(newIndexParts[0])) |
| | | { |
| | | if(newIndexParts.length == 1 && existingIndexParts.length == 1) |
| | | { |
| | | return; |
| | | } |
| | | else if(newIndexParts.length > 1 && existingIndexParts.length == 1) |
| | | { |
| | | return; |
| | | } |
| | | else if(newIndexParts.length == 1 && existingIndexParts.length > 1) |
| | | { |
| | | rebuildList.remove(s); |
| | | } |
| | | else if(newIndexParts[1].equalsIgnoreCase(existingIndexParts[1])) |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | |
| | | this.rebuildList.add(index); |
| | | } |
| | | |
| | | /** |
| | | * Check the given config for conflicts with this config. A conflict is |
| | | * detected if both configs specify the same indexType/database to be rebuilt. |
| | | * |
| | | * @param config The rebuild config to check against. |
| | | * @return the name of the indexType causing the conflict or null if no |
| | | * conflict is detected. |
| | | */ |
| | | public String checkConflicts(RebuildConfig config) |
| | | { |
| | | //If they specify different base DNs, no conflicts can occur. |
| | | if(this.baseDN.equals(config.baseDN)) |
| | | { |
| | | for(String thisIndex : this.rebuildList) |
| | | { |
| | | for(String thatIndex : config.rebuildList) |
| | | { |
| | | String[] existingIndexParts = thisIndex.split("\\."); |
| | | String[] newIndexParts = thatIndex.split("\\."); |
| | | if(existingIndexParts[0].equalsIgnoreCase(newIndexParts[0])) |
| | | { |
| | | if(newIndexParts.length == 1 && existingIndexParts.length == 1) |
| | | { |
| | | return thatIndex; |
| | | } |
| | | else if(newIndexParts.length > 1 && existingIndexParts.length == 1) |
| | | { |
| | | return thatIndex; |
| | | } |
| | | else if(newIndexParts.length == 1 && existingIndexParts.length > 1) |
| | | { |
| | | return thatIndex; |
| | | } |
| | | else if(newIndexParts[1].equalsIgnoreCase(existingIndexParts[1])) |
| | | { |
| | | return thatIndex; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * Get the maximum number of rebuild threads to use for the rebuild job |
| | | * at one time. |
| | | * |
| | | * @return The maximum number of rebuild threads. |
| | | */ |
| | | public int getMaxRebuildThreads() |
| | | { |
| | | return maxRebuildThreads; |
| | | } |
| | | |
| | | /** |
| | | * Set the maximum number of rebuild threads to use for the rebuild |
| | | * job at one time. |
| | | * |
| | | * @param maxRebuildThreads The maximum number of rebuild threads. |
| | | */ |
| | | public void setMaxRebuildThreads(int maxRebuildThreads) |
| | | { |
| | | this.maxRebuildThreads = maxRebuildThreads; |
| | | } |
| | | |
| | | /** |
| | | * Test if this rebuild config includes any system indexes to rebuild. |
| | | * |
| | | * @return True if rebuilding of system indexes are included. False otherwise. |
| | | */ |
| | | public boolean includesSystemIndex() |
| | | { |
| | | for(String index : rebuildList) |
| | | { |
| | | if(index.equalsIgnoreCase("id2entry")) |
| | | { |
| | | return true; |
| | | } |
| | | if(index.equalsIgnoreCase("dn2id")) |
| | | { |
| | | return true; |
| | | } |
| | | if(index.equalsIgnoreCase("dn2uri")) |
| | | { |
| | | return true; |
| | | } |
| | | if(index.equalsIgnoreCase("id2children")) |
| | | { |
| | | return true; |
| | | } |
| | | if(index.equalsIgnoreCase("id2subtree")) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | | import org.opends.server.types.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.TimerTask; |
| | | import java.util.Timer; |
| | | import java.util.concurrent.CopyOnWriteArrayList; |
| | | import java.util.concurrent.locks.ReentrantLock; |
| | | |
| | | import com.sleepycat.je.DatabaseException; |
| | | import com.sleepycat.je.StatsConfig; |
| | | import com.sleepycat.je.EnvironmentStats; |
| | | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.loggers.Error.logError; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import static org.opends.server.messages.JebMessages. |
| | | MSGID_JEB_ATTRIBUTE_INDEX_NOT_CONFIGURED; |
| | | import static org.opends.server.messages.JebMessages. |
| | | MSGID_JEB_REBUILD_PROGRESS_REPORT; |
| | | import static org.opends.server.messages.JebMessages. |
| | | MSGID_JEB_REBUILD_FINAL_STATUS; |
| | | import static org.opends.server.messages.JebMessages. |
| | | MSGID_JEB_REBUILD_CACHE_AND_MEMORY_REPORT; |
| | | import static org.opends.server.messages.JebMessages. |
| | | MSGID_JEB_REBUILD_INDEX_CONFLICT; |
| | | import static org.opends.server.messages.JebMessages. |
| | | MSGID_JEB_REBUILD_START; |
| | | import static org.opends.server.messages.MessageHandler.getMessage; |
| | | |
| | | /** |
| | | * Runs a index rebuild process on the backend. Each index selected for rebuild |
| | | * will be done from scratch by first clearing out the database for that index. |
| | | * Different threads will be used to rebuild each index. |
| | | * The rebuild process can run concurrently with the backend online and |
| | | * performing write and read operations. However, during the rebuild process, |
| | | * other reader and writer activeThreads might notice inconsistencies in index |
| | | * databases being rebuilt. They can safely ignore these inconsistencies as long |
| | | * as a rebuild is in progress. |
| | | */ |
| | | public class RebuildJob |
| | | { |
| | | /** |
| | | * The rebuild configuraiton. |
| | | */ |
| | | private RebuildConfig rebuildConfig; |
| | | |
| | | /** |
| | | * The root container used for the verify job. |
| | | */ |
| | | private RootContainer rootContainer; |
| | | |
| | | /** |
| | | * The number of milliseconds between job progress reports. |
| | | */ |
| | | private long progressInterval = 10000; |
| | | |
| | | /** |
| | | * The waiting rebuild threads created to process the rebuild. |
| | | */ |
| | | private CopyOnWriteArrayList<IndexRebuildThread> waitingThreads = |
| | | new CopyOnWriteArrayList<IndexRebuildThread>(); |
| | | |
| | | /** |
| | | * The active rebuild threads created to process the rebuild. |
| | | */ |
| | | private CopyOnWriteArrayList<IndexRebuildThread> activeThreads = |
| | | new CopyOnWriteArrayList<IndexRebuildThread>(); |
| | | |
| | | /** |
| | | * The completed rebuild threads used to process the rebuild. |
| | | */ |
| | | private CopyOnWriteArrayList<IndexRebuildThread> completedThreads = |
| | | new CopyOnWriteArrayList<IndexRebuildThread>(); |
| | | |
| | | /** |
| | | * Rebuild jobs currently running. |
| | | */ |
| | | private static CopyOnWriteArrayList<RebuildJob> rebuildJobs = |
| | | new CopyOnWriteArrayList<RebuildJob>(); |
| | | |
| | | /** |
| | | * A mutex that will be used to provide threadsafe access to methods changing |
| | | * the set of currently running rebuild jobs. |
| | | */ |
| | | private static ReentrantLock jobsMutex = new ReentrantLock(); |
| | | |
| | | /** |
| | | * This class reports progress of the rebuild job at fixed intervals. |
| | | */ |
| | | class ProgressTask extends TimerTask |
| | | { |
| | | /** |
| | | * The number of records that had been processed at the time of the |
| | | * previous progress report. |
| | | */ |
| | | private long previousProcessed = 0; |
| | | |
| | | /** |
| | | * The time in milliseconds of the previous progress report. |
| | | */ |
| | | private long previousTime; |
| | | |
| | | /** |
| | | * The environment statistics at the time of the previous report. |
| | | */ |
| | | private EnvironmentStats prevEnvStats; |
| | | |
| | | /** |
| | | * The number of bytes in a megabyte. |
| | | * Note that 1024*1024 bytes may eventually become known as a mebibyte(MiB). |
| | | */ |
| | | private static final int bytesPerMegabyte = 1024*1024; |
| | | /** |
| | | * Create a new verify progress task. |
| | | * @throws DatabaseException An error occurred while accessing the JE |
| | | * database. |
| | | */ |
| | | public ProgressTask() throws DatabaseException |
| | | { |
| | | previousTime = System.currentTimeMillis(); |
| | | prevEnvStats = |
| | | rootContainer.getEnvironmentStats(new StatsConfig()); |
| | | } |
| | | |
| | | /** |
| | | * The action to be performed by this timer task. |
| | | */ |
| | | public void run() |
| | | { |
| | | long latestTime = System.currentTimeMillis(); |
| | | long deltaTime = latestTime - previousTime; |
| | | |
| | | if (deltaTime == 0) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | long totalEntries = 0; |
| | | long latestProcessed = 0; |
| | | |
| | | ArrayList<IndexRebuildThread> allThreads = |
| | | new ArrayList<IndexRebuildThread>(waitingThreads); |
| | | allThreads.addAll(activeThreads); |
| | | allThreads.addAll(completedThreads); |
| | | |
| | | for(IndexRebuildThread thread : allThreads) |
| | | { |
| | | try |
| | | { |
| | | totalEntries += thread.getTotalEntries(); |
| | | latestProcessed += thread.getProcessedEntries(); |
| | | |
| | | if(debugEnabled()) |
| | | { |
| | | debugVerbose("Rebuild thread %s stats: total %d processed %d " + |
| | | "rebuilt %d duplicated %d skipped %d", |
| | | thread.getTotalEntries(), thread.getProcessedEntries(), |
| | | thread.getRebuiltEntries(), |
| | | thread.getDuplicatedEntries(), |
| | | thread.getSkippedEntries()); |
| | | } |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | if(debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | long deltaCount = (latestProcessed - previousProcessed); |
| | | float rate = 1000f*deltaCount / deltaTime; |
| | | float completed = 0; |
| | | if(totalEntries > 0) |
| | | { |
| | | completed = 100f*latestProcessed / totalEntries; |
| | | } |
| | | |
| | | int msgID = MSGID_JEB_REBUILD_PROGRESS_REPORT; |
| | | String message = getMessage(msgID, completed, latestProcessed, |
| | | totalEntries, rate); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.NOTICE, |
| | | message, msgID); |
| | | |
| | | try |
| | | { |
| | | Runtime runtime = Runtime.getRuntime(); |
| | | long freeMemory = runtime.freeMemory() / bytesPerMegabyte; |
| | | |
| | | EnvironmentStats envStats = |
| | | rootContainer.getEnvironmentStats(new StatsConfig()); |
| | | long nCacheMiss = |
| | | envStats.getNCacheMiss() - prevEnvStats.getNCacheMiss(); |
| | | |
| | | float cacheMissRate = 0; |
| | | if (deltaCount > 0) |
| | | { |
| | | cacheMissRate = nCacheMiss/(float)deltaCount; |
| | | } |
| | | |
| | | msgID = MSGID_JEB_REBUILD_CACHE_AND_MEMORY_REPORT; |
| | | message = getMessage(msgID, freeMemory, cacheMissRate); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.NOTICE, |
| | | message, msgID); |
| | | |
| | | prevEnvStats = envStats; |
| | | } |
| | | catch (DatabaseException e) |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | |
| | | |
| | | previousProcessed = latestProcessed; |
| | | previousTime = latestTime; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Construct a new rebuild job. |
| | | * |
| | | * @param rebuildConfig The configuration to use for this rebuild job. |
| | | */ |
| | | public RebuildJob(RebuildConfig rebuildConfig) |
| | | { |
| | | this.rebuildConfig = rebuildConfig; |
| | | } |
| | | |
| | | private static void addJob(RebuildJob job) |
| | | throws DatabaseException, JebException |
| | | { |
| | | //Make sure there are no running rebuild jobs |
| | | jobsMutex.lock(); |
| | | |
| | | for(RebuildJob otherJob : rebuildJobs) |
| | | { |
| | | String conflictIndex = |
| | | job.rebuildConfig.checkConflicts(otherJob.rebuildConfig); |
| | | if(conflictIndex != null) |
| | | { |
| | | jobsMutex.unlock(); |
| | | //TODO: Throw error and bail out. |
| | | if(debugEnabled()) |
| | | { |
| | | debugError("Conflit detected. This job config: %s, " + |
| | | "That job config: %s.", |
| | | job.rebuildConfig, otherJob.rebuildConfig); |
| | | } |
| | | |
| | | |
| | | int msgID = MSGID_JEB_REBUILD_INDEX_CONFLICT; |
| | | String msg = getMessage(msgID, conflictIndex); |
| | | throw new JebException(msgID, msg); |
| | | } |
| | | } |
| | | |
| | | //No conflicts are found. Add the job to the list of currently running jobs. |
| | | rebuildJobs.add(job); |
| | | |
| | | jobsMutex.unlock(); |
| | | } |
| | | |
| | | private static void removeJob(RebuildJob job) |
| | | { |
| | | jobsMutex.lock(); |
| | | |
| | | rebuildJobs.remove(job); |
| | | |
| | | jobsMutex.unlock(); |
| | | } |
| | | |
| | | /** |
| | | * Initiate the rebuild process on a backend. |
| | | * |
| | | * @param rootContainer The root container to rebuild in. |
| | | * @throws DirectoryException If an error occurs during the rebuild process. |
| | | * @throws DatabaseException If a JE database error occurs during the rebuild |
| | | * process. |
| | | * @throws JebException If a JE database error occurs during the rebuild |
| | | * process. |
| | | */ |
| | | public void rebuildBackend(RootContainer rootContainer) |
| | | throws DirectoryException, DatabaseException, JebException |
| | | { |
| | | //TODO: Add check for only performing internal indexType rebuilds when |
| | | // backend is offline. |
| | | |
| | | addJob(this); |
| | | |
| | | try |
| | | { |
| | | this.rootContainer = rootContainer; |
| | | EntryContainer entryContainer = |
| | | rootContainer.getEntryContainer(rebuildConfig.getBaseDN()); |
| | | |
| | | ArrayList<String> rebuildList = rebuildConfig.getRebuildList(); |
| | | |
| | | if(!rebuildList.isEmpty()) |
| | | { |
| | | |
| | | for (String index : rebuildList) |
| | | { |
| | | IndexRebuildThread rebuildThread; |
| | | String lowerName = index.toLowerCase(); |
| | | if (lowerName.equals("dn2id")) |
| | | { |
| | | rebuildThread = new IndexRebuildThread(entryContainer, |
| | | IndexRebuildThread.IndexType.DN2ID); |
| | | } |
| | | else if (lowerName.equals("dn2uri")) |
| | | { |
| | | rebuildThread = new IndexRebuildThread(entryContainer, |
| | | IndexRebuildThread.IndexType.DN2URI); |
| | | } |
| | | else if (lowerName.equals("id2children")) |
| | | { |
| | | rebuildThread = new IndexRebuildThread(entryContainer, |
| | | IndexRebuildThread.IndexType.ID2CHILDREN); |
| | | } |
| | | else if (lowerName.equals("id2subtree")) |
| | | { |
| | | rebuildThread = new IndexRebuildThread(entryContainer, |
| | | IndexRebuildThread.IndexType.ID2SUBTREE); |
| | | } |
| | | else |
| | | { |
| | | String[] attrIndexParts = lowerName.split("\\."); |
| | | if(attrIndexParts.length <= 0) |
| | | { |
| | | int msgID = MSGID_JEB_ATTRIBUTE_INDEX_NOT_CONFIGURED; |
| | | String msg = getMessage(msgID, index); |
| | | throw new JebException(msgID, msg); |
| | | } |
| | | |
| | | AttributeType attrType = |
| | | DirectoryServer.getAttributeType(attrIndexParts[0]); |
| | | |
| | | if (attrType == null) |
| | | { |
| | | int msgID = MSGID_JEB_ATTRIBUTE_INDEX_NOT_CONFIGURED; |
| | | String msg = getMessage(msgID, index); |
| | | throw new JebException(msgID, msg); |
| | | } |
| | | AttributeIndex attrIndex = |
| | | entryContainer.getAttributeIndex(attrType); |
| | | if (attrIndex == null) |
| | | { |
| | | int msgID = MSGID_JEB_ATTRIBUTE_INDEX_NOT_CONFIGURED; |
| | | String msg = getMessage(msgID, index); |
| | | throw new JebException(msgID, msg); |
| | | } |
| | | |
| | | if(attrIndexParts.length > 1) |
| | | { |
| | | Index partialAttrIndex = null; |
| | | if(attrIndexParts[1].equals("presence")) |
| | | { |
| | | partialAttrIndex = attrIndex.presenceIndex; |
| | | } |
| | | else if(attrIndexParts[1].equals("equality")) |
| | | { |
| | | partialAttrIndex = attrIndex.equalityIndex; |
| | | } |
| | | else if(attrIndexParts[1].equals("substring")) |
| | | { |
| | | partialAttrIndex = attrIndex.substringIndex; |
| | | } |
| | | else if(attrIndexParts[1].equals("ordering")) |
| | | { |
| | | partialAttrIndex = attrIndex.orderingIndex; |
| | | } |
| | | else if(attrIndexParts[1].equals("approximate")) |
| | | { |
| | | partialAttrIndex = attrIndex.approximateIndex; |
| | | } |
| | | |
| | | if(partialAttrIndex == null) |
| | | { |
| | | int msgID = MSGID_JEB_ATTRIBUTE_INDEX_NOT_CONFIGURED; |
| | | String msg = getMessage(msgID, index); |
| | | throw new JebException(msgID, msg); |
| | | } |
| | | |
| | | rebuildThread = |
| | | new IndexRebuildThread(entryContainer, partialAttrIndex); |
| | | } |
| | | else |
| | | { |
| | | rebuildThread = new IndexRebuildThread(entryContainer, |
| | | attrIndex); |
| | | } |
| | | } |
| | | |
| | | waitingThreads.add(rebuildThread); |
| | | |
| | | if(debugEnabled()) |
| | | { |
| | | debugInfo("Created rebuild thread %s", rebuildThread.getName()); |
| | | } |
| | | } |
| | | |
| | | //Log a start message. |
| | | long totalToProcess = 0; |
| | | |
| | | for(IndexRebuildThread thread : waitingThreads) |
| | | { |
| | | totalToProcess += thread.getTotalEntries(); |
| | | } |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | for(String index : rebuildList) |
| | | { |
| | | if(sb.length() > 0) |
| | | { |
| | | sb.append(", "); |
| | | } |
| | | sb.append(index); |
| | | } |
| | | int msgID = MSGID_JEB_REBUILD_START; |
| | | String message = getMessage(msgID, sb.toString(), totalToProcess); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.NOTICE, |
| | | message, msgID); |
| | | |
| | | // Make a note of the time we started. |
| | | long startTime = System.currentTimeMillis(); |
| | | |
| | | // Start a timer for the progress report. |
| | | Timer timer = new Timer(); |
| | | TimerTask progressTask = new ProgressTask(); |
| | | timer.scheduleAtFixedRate(progressTask, progressInterval, |
| | | progressInterval); |
| | | |
| | | try |
| | | { |
| | | while(!waitingThreads.isEmpty()) |
| | | { |
| | | dispatchThreads(); |
| | | joinThreads(); |
| | | } |
| | | } |
| | | finally |
| | | { |
| | | timer.cancel(); |
| | | } |
| | | |
| | | long totalProcessed = 0; |
| | | long totalRebuilt = 0; |
| | | long totalDuplicated = 0; |
| | | long totalSkipped = 0; |
| | | |
| | | for(IndexRebuildThread thread : completedThreads) |
| | | { |
| | | System.out.println(debugEnabled()); |
| | | totalProcessed += thread.getProcessedEntries(); |
| | | totalRebuilt += thread.getRebuiltEntries(); |
| | | totalDuplicated += thread.getDuplicatedEntries(); |
| | | totalSkipped += thread.getSkippedEntries(); |
| | | } |
| | | |
| | | long finishTime = System.currentTimeMillis(); |
| | | long totalTime = (finishTime - startTime); |
| | | |
| | | float rate = 0; |
| | | if (totalTime > 0) |
| | | { |
| | | rate = 1000f*totalProcessed / totalTime; |
| | | } |
| | | |
| | | msgID = MSGID_JEB_REBUILD_FINAL_STATUS; |
| | | message = getMessage(msgID, totalProcessed, totalTime/1000, |
| | | rate); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.NOTICE, |
| | | message, msgID); |
| | | |
| | | if(debugEnabled()) |
| | | { |
| | | debugInfo("Detailed overall rebuild job stats: rebuilt %d, " + |
| | | "duplicated %d, skipped %d", |
| | | totalRebuilt, totalDuplicated, totalSkipped); |
| | | } |
| | | } |
| | | } |
| | | finally |
| | | { |
| | | removeJob(this); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Dispatch a set of threads based on their dependency and ordering. |
| | | */ |
| | | private void dispatchThreads() |
| | | { |
| | | for(IndexRebuildThread t : waitingThreads) |
| | | { |
| | | boolean start = true; |
| | | |
| | | //Check to see if we have exceeded the max number of threads to use at |
| | | //one time. |
| | | if(rebuildConfig.getMaxRebuildThreads() > 0 && |
| | | activeThreads.size() > rebuildConfig.getMaxRebuildThreads()) |
| | | { |
| | | if(debugEnabled()) |
| | | { |
| | | debugInfo("Delaying the start of thread %s because " + |
| | | "the max number of rebuild threads has been reached."); |
| | | } |
| | | start = false; |
| | | } |
| | | |
| | | /** |
| | | * We may need to start the threads in stages since the rebuild process |
| | | * of some index types (id2children, id2subtree) depends on another |
| | | * index being rebuilt to be completed first. |
| | | */ |
| | | if(t.getIndexType() == IndexRebuildThread.IndexType.ID2CHILDREN || |
| | | t.getIndexType() == IndexRebuildThread.IndexType.ID2SUBTREE) |
| | | { |
| | | //Check to see if we have any waiting threads that needs to go |
| | | //first |
| | | for(IndexRebuildThread t2 : waitingThreads) |
| | | { |
| | | if(t2.getIndexType() == IndexRebuildThread.IndexType.DN2ID || |
| | | t2.getIndexType() == IndexRebuildThread.IndexType.DN2URI) |
| | | { |
| | | //We gotta wait for these to start before running the |
| | | //rebuild on ID2CHILDREN or ID2SUBTREE |
| | | |
| | | if(debugEnabled()) |
| | | { |
| | | debugInfo("Delaying the start of thread %s because " + |
| | | "it depends on another index rebuilt to " + |
| | | "go first.", t.getName()); |
| | | } |
| | | start = false; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | //Check to see if we have any active threads that needs to |
| | | //finish first |
| | | for(IndexRebuildThread t3 : activeThreads) |
| | | { |
| | | if(t3.getIndexType() == IndexRebuildThread.IndexType.DN2ID || |
| | | t3.getIndexType() == IndexRebuildThread.IndexType.DN2URI) |
| | | { |
| | | //We gotta wait for these to start before running the |
| | | //rebuild on ID2CHILDREN or ID2SUBTREE |
| | | |
| | | if(debugEnabled()) |
| | | { |
| | | debugInfo("Delaying the start of thread %s because " + |
| | | "it depends on another index being rebuilt to " + |
| | | "finish.", t.getName()); |
| | | } |
| | | start = false; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(start) |
| | | { |
| | | if(debugEnabled()) |
| | | { |
| | | debugInfo("Starting rebuild thread %s.", t.getName()); |
| | | } |
| | | waitingThreads.remove(t); |
| | | activeThreads.add(t); |
| | | t.start(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Wait for all worker activeThreads to exit. |
| | | */ |
| | | private void joinThreads() |
| | | { |
| | | for (IndexRebuildThread t : activeThreads) |
| | | { |
| | | try |
| | | { |
| | | t.join(); |
| | | |
| | | if(debugEnabled()) |
| | | { |
| | | debugInfo("Rebuild thread %s finished.", t.getName()); |
| | | } |
| | | activeThreads.remove(t); |
| | | completedThreads.add(t); |
| | | } |
| | | catch (InterruptedException ie) |
| | | { |
| | | // No action needed? |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | | import com.sleepycat.je.Database; |
| | | import com.sleepycat.je.DatabaseException; |
| | | import com.sleepycat.je.Environment; |
| | | import com.sleepycat.je.EnvironmentConfig; |
| | | import com.sleepycat.je.EnvironmentStats; |
| | | import com.sleepycat.je.PreloadConfig; |
| | | import com.sleepycat.je.PreloadStats; |
| | | import com.sleepycat.je.PreloadStatus; |
| | | import com.sleepycat.je.config.EnvironmentParams; |
| | | import com.sleepycat.je.config.ConfigParam; |
| | | import com.sleepycat.je.StatsConfig; |
| | | import com.sleepycat.je.CheckpointConfig; |
| | | import com.sleepycat.je.*; |
| | | |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.atomic.AtomicLong; |
| | |
| | | |
| | | if (debugEnabled()) |
| | | { |
| | | debugInfo(env.getConfig().toString()); |
| | | debugInfo("JE (%s) environment opened with the following config: %n%s", |
| | | JEVersion.CURRENT_VERSION.toString(), |
| | | env.getConfig().toString()); |
| | | |
| | | // Get current size of heap in bytes |
| | | long heapSize = Runtime.getRuntime().totalMemory(); |
| | | |
| | | // Get maximum size of heap in bytes. The heap cannot grow beyond this size. |
| | | // Any attempt will result in an OutOfMemoryException. |
| | | long heapMaxSize = Runtime.getRuntime().maxMemory(); |
| | | |
| | | // Get amount of free memory within the heap in bytes. This size will |
| | | // increase |
| | | // after garbage collection and decrease as new objects are created. |
| | | long heapFreeSize = Runtime.getRuntime().freeMemory(); |
| | | |
| | | debugInfo("Current size of heap: %d bytes", heapSize); |
| | | debugInfo("Max size of heap: %d bytes", heapMaxSize); |
| | | debugInfo("Free memory in heap: %d bytes", heapFreeSize); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.sleepycat.je.Transaction; |
| | | |
| | | import org.opends.server.api.OrderingMatchingRule; |
| | | import org.opends.server.api.ApproximateMatchingRule; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.asn1.ASN1OctetString; |
| | | import org.opends.server.types.Attribute; |
| | |
| | | */ |
| | | enum IndexType |
| | | { |
| | | PRES, EQ, SUBSTRING, ORDERING |
| | | PRES, EQ, SUBSTRING, ORDERING, APPROXIMATE |
| | | } |
| | | |
| | | /** |
| | |
| | | attrIndex.substringIndex, IndexType.SUBSTRING); |
| | | iterateAttrIndex(attrIndex.getAttributeType(), |
| | | attrIndex.orderingIndex, IndexType.ORDERING); |
| | | iterateAttrIndex(attrIndex.getAttributeType(), |
| | | attrIndex.approximateIndex, IndexType.APPROXIMATE); |
| | | } |
| | | } |
| | | |
| | |
| | | DatabaseEntry key = new DatabaseEntry(); |
| | | DatabaseEntry data = new DatabaseEntry(); |
| | | |
| | | OrderingMatchingRule orderingMatchingRule = |
| | | attrType.getOrderingMatchingRule(); |
| | | ApproximateMatchingRule approximateMatchingRule = |
| | | attrType.getApproximateMatchingRule(); |
| | | ASN1OctetString previousValue = null; |
| | | |
| | | OperationStatus status; |
| | | for (status = cursor.getFirst(key, data, LockMode.DEFAULT); |
| | | status == OperationStatus.SUCCESS; |
| | |
| | | { |
| | | byte[] value = key.getData(); |
| | | SearchFilter sf; |
| | | AttributeValue assertionValue; |
| | | |
| | | switch (indexType) |
| | | { |
| | |
| | | sf = SearchFilter.createSubstringFilter(attrType,null, |
| | | subAnyElements,null); |
| | | break; |
| | | /* TODO |
| | | * This ORDERING case needs further study |
| | | * about what type of SearchFilter should be created. |
| | | * case ORDERING: |
| | | * */ |
| | | case ORDERING: |
| | | // Ordering index checking is two fold: |
| | | // 1. Make sure the entry has an attribute value that is the same |
| | | // as the key. This is done by falling through to the next |
| | | // case and create an equality filter. |
| | | // 2. Make sure the key value is greater then the previous key |
| | | // value. |
| | | assertionValue = |
| | | new AttributeValue(attrType, new ASN1OctetString(value)); |
| | | |
| | | sf = SearchFilter.createEqualityFilter(attrType,assertionValue); |
| | | |
| | | if(orderingMatchingRule != null && previousValue != null) |
| | | { |
| | | ASN1OctetString thisValue = new ASN1OctetString(value); |
| | | int order = orderingMatchingRule.compareValues(thisValue, |
| | | previousValue); |
| | | if(order > 0) |
| | | { |
| | | errorCount++; |
| | | if(debugEnabled()) |
| | | { |
| | | debugError("Reversed ordering of index keys " + |
| | | "(keys dumped in the order found in database)%n" + |
| | | "Key 1:%n%s%nKey 2:%n%s", |
| | | keyDump(index, thisValue.value()), |
| | | keyDump(index,previousValue.value())); |
| | | } |
| | | continue; |
| | | } |
| | | else if(order == 0) |
| | | { |
| | | errorCount++; |
| | | if(debugEnabled()) |
| | | { |
| | | debugError("Duplicate index keys%nKey 1:%n%s%nKey2:%n%s", |
| | | keyDump(index, thisValue.value()), |
| | | keyDump(index,previousValue.value())); |
| | | } |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | previousValue = thisValue; |
| | | } |
| | | } |
| | | break; |
| | | case EQ: |
| | | AttributeValue assertionValue = |
| | | assertionValue = |
| | | new AttributeValue(attrType, new ASN1OctetString(value)); |
| | | |
| | | sf = SearchFilter.createEqualityFilter(attrType,assertionValue); |
| | |
| | | sf = SearchFilter.createPresenceFilter(attrType); |
| | | break; |
| | | |
| | | case APPROXIMATE: |
| | | // This must be handled differently since we can't use a search |
| | | // filter to see if the key matches. |
| | | sf = null; |
| | | break; |
| | | |
| | | default: |
| | | errorCount++; |
| | | if (debugEnabled()) |
| | |
| | | |
| | | try |
| | | { |
| | | if (!sf.matchesEntry(entry)) |
| | | boolean match = false; |
| | | if(indexType != IndexType.APPROXIMATE) |
| | | { |
| | | match = sf.matchesEntry(entry); |
| | | } |
| | | else |
| | | { |
| | | ByteString normalizedValue = new ASN1OctetString(value); |
| | | List<Attribute> attrs = entry.getAttribute(attrType); |
| | | if ((attrs != null) && (!attrs.isEmpty())) |
| | | { |
| | | for (Attribute a : attrs) |
| | | { |
| | | for (AttributeValue v : a.getValues()) |
| | | { |
| | | ByteString nv = |
| | | approximateMatchingRule.normalizeValue(v.getValue()); |
| | | match = approximateMatchingRule. |
| | | approximatelyMatch(nv, normalizedValue); |
| | | if(match) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | if(match) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!match) |
| | | { |
| | | errorCount++; |
| | | if (debugEnabled()) |
| | |
| | | Index presenceIndex = attrIndex.presenceIndex; |
| | | Index substringIndex = attrIndex.substringIndex; |
| | | Index orderingIndex = attrIndex.orderingIndex; |
| | | Index approximateIndex = attrIndex.approximateIndex; |
| | | IndexConfig indexConfig = attrIndex.indexConfig; |
| | | DatabaseEntry presenceKey = AttributeIndex.presenceKey; |
| | | |
| | |
| | | errorCount++; |
| | | } |
| | | } |
| | | // Approximate index. |
| | | if (indexConfig.isApproximateIndex()) |
| | | { |
| | | // Use the approximate matching rule to normalize the value. |
| | | ApproximateMatchingRule approximateRule = |
| | | attr.getAttributeType().getApproximateMatchingRule(); |
| | | |
| | | normalizedBytes = |
| | | approximateRule.normalizeValue(value.getValue()).value(); |
| | | |
| | | DatabaseEntry key = new DatabaseEntry(normalizedBytes); |
| | | try |
| | | { |
| | | ConditionResult cr; |
| | | cr = approximateIndex.containsID(txn, key, entryID); |
| | | if (cr == ConditionResult.FALSE) |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | debugError("Missing ID %d%n%s", |
| | | entryID.longValue(), |
| | | keyDump(orderingIndex, normalizedBytes)); |
| | | } |
| | | errorCount++; |
| | | } |
| | | else if (cr == ConditionResult.UNDEFINED) |
| | | { |
| | | incrEntryLimitStats(orderingIndex, normalizedBytes); |
| | | } |
| | | } |
| | | catch (DatabaseException e) |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | |
| | | debugError("Error reading database: %s%n%s", |
| | | e.getMessage(), |
| | | keyDump(approximateIndex, normalizedBytes)); |
| | | } |
| | | errorCount++; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | public static final String ATTR_LOGGER_ASYNC_WRITE = |
| | | NAME_PREFIX_TASK + "async-write"; |
| | | |
| | | |
| | | /** |
| | | * The name of the attribute in an rebuild task definition that specifies the |
| | | * base DN of the indexes to do the rebuild in. |
| | | */ |
| | | public static final String ATTR_REBUILD_BASE_DN = |
| | | NAME_PREFIX_TASK + "rebuild-base-dn"; |
| | | |
| | | |
| | | /** |
| | | * The name of the attribute in an rebuild task definition that specifies the |
| | | * indexes to rebuild. |
| | | */ |
| | | public static final String ATTR_REBUILD_INDEX = |
| | | NAME_PREFIX_TASK + "rebuild-index"; |
| | | |
| | | |
| | | /** |
| | | * The name of the attribute in an rebuild task definition that specifies the |
| | | * maximum number of threads. |
| | | */ |
| | | public static final String ATTR_REBUILD_MAX_THREADS = |
| | | NAME_PREFIX_TASK + "rebuild-max-threads"; |
| | | } |
| | | |
| | |
| | | CATEGORY_MASK_JEB | SEVERITY_MASK_INFORMATIONAL | 130; |
| | | |
| | | /** |
| | | * The message ID used to log an informational message in the rebuild index |
| | | * process. This message takes four arguments: the completed percentage, |
| | | * the number of entries processed, the total number of entries to process, |
| | | * the floating point average number of records processed per second |
| | | * since the previous progress. |
| | | */ |
| | | public static final int MSGID_JEB_REBUILD_PROGRESS_REPORT = |
| | | CATEGORY_MASK_JEB | SEVERITY_MASK_INFORMATIONAL | 131; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID used to log an informational message in the rebuild index |
| | | * process. This message takes two arguments: the current amount of free heap |
| | | * memory in megabytes, and the floating point number of database cache misses |
| | | * per record processed since the previous progress report. |
| | | */ |
| | | public static final int MSGID_JEB_REBUILD_CACHE_AND_MEMORY_REPORT = |
| | | CATEGORY_MASK_JEB | SEVERITY_MASK_INFORMATIONAL | 132; |
| | | |
| | | |
| | | /** |
| | | * The message ID used to log an informational message in the verify index |
| | | * process. This message takes seven arguments: the total number of entries |
| | | * processed, the total number of rebuilt entries, the total number |
| | | * of duplicated entries, the total number of skipped entries, the total time |
| | | * for the rebuild process to complete, and the floating point overall number |
| | | * of records processed per second. |
| | | */ |
| | | public static final int MSGID_JEB_REBUILD_FINAL_STATUS = |
| | | CATEGORY_MASK_JEB | SEVERITY_MASK_INFORMATIONAL | 133; |
| | | |
| | | /** |
| | | * The message ID used to indicate that an error occured in an index rebuild |
| | | * thread and it is terminated. This message takes two arguments: the name |
| | | * of the index rebuild thread that failed and the exception that caused |
| | | * the failure. |
| | | */ |
| | | public static final int MSGID_JEB_REBUILD_INDEX_FAILED = |
| | | CATEGORY_MASK_JEB | SEVERITY_MASK_SEVERE_ERROR | 134; |
| | | |
| | | /** |
| | | * The message ID used to indicate that an error occured while inserting |
| | | * an entry into a database/index during the rebuild process. This message |
| | | * takes two arguments: the name of the database/index being inserted into, |
| | | * and the exception that caused the failure. |
| | | */ |
| | | public static final int MSGID_JEB_REBUILD_INSERT_ENTRY_FAILED = |
| | | CATEGORY_MASK_JEB | SEVERITY_MASK_MILD_ERROR | 135; |
| | | |
| | | /** |
| | | * The message ID used to indicate that another rebuild process for an index |
| | | * is alreadly in progress. This message takes the name of the conflicting |
| | | * index as the argument. |
| | | */ |
| | | public static final int MSGID_JEB_REBUILD_INDEX_CONFLICT = |
| | | CATEGORY_MASK_JEB | SEVERITY_MASK_SEVERE_ERROR | 136; |
| | | |
| | | /** |
| | | * The message ID used to log an information message about the rebuild job. |
| | | * This message takes 2 arguments: the names of the index in the rebuild job |
| | | * and the number of total records to process. |
| | | */ |
| | | public static final int MSGID_JEB_REBUILD_START = |
| | | CATEGORY_MASK_JEB | SEVERITY_MASK_INFORMATIONAL | 137; |
| | | |
| | | /** |
| | | * The message ID of an error indicating that rebuilding of system indexes |
| | | * can not be done while the backend is online. |
| | | */ |
| | | public static final int MSGID_JEB_REBUILD_BACKEND_ONLINE = |
| | | CATEGORY_MASK_JEB | SEVERITY_MASK_SEVERE_ERROR | 138; |
| | | |
| | | /** |
| | | * Associates a set of generic messages with the message IDs defined in this |
| | | * class. |
| | | */ |
| | |
| | | registerMessage(MSGID_JEB_GET_ENTRY_COUNT_FAILED, |
| | | "Unable to determine the total number of entries in the " + |
| | | "container: %s"); |
| | | registerMessage(MSGID_JEB_REBUILD_START, |
| | | "Rebuild of index(es) %s started with %d total records " + |
| | | "to process."); |
| | | registerMessage(MSGID_JEB_REBUILD_PROGRESS_REPORT, |
| | | "%.1f%% Completed. Processed %d/%d records. " + |
| | | "(recent rate %.1f/sec)."); |
| | | registerMessage(MSGID_JEB_REBUILD_CACHE_AND_MEMORY_REPORT, |
| | | "Free memory = %d MB, Cache miss rate = %.1f/record."); |
| | | registerMessage(MSGID_JEB_REBUILD_FINAL_STATUS, |
| | | "Rebuild complete. Processed %d records in %d seconds " + |
| | | "(average rate %.1f/sec)."); |
| | | registerMessage(MSGID_JEB_REBUILD_INDEX_FAILED, |
| | | "An error occured while rebuilding index %s: %s"); |
| | | registerMessage(MSGID_JEB_REBUILD_INSERT_ENTRY_FAILED, |
| | | "An error occured while inserting entry into the %s " + |
| | | "database/index: %s"); |
| | | registerMessage(MSGID_JEB_REBUILD_INDEX_CONFLICT, |
| | | "Another rebuild of index %s is alreadly in progress."); |
| | | registerMessage(MSGID_JEB_REBUILD_BACKEND_ONLINE, |
| | | "Rebuilding system index(es) must be done with the " + |
| | | "backend containing the base DN disabled."); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used an attempt is made to |
| | | * invoke the index rebuild task by a user that does not have the required |
| | | * privileges. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_TASK_INDEXREBUILD_INSUFFICIENT_PRIVILEGES = |
| | | CATEGORY_MASK_TASK | SEVERITY_MASK_SEVERE_ERROR | 18; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Associates a set of generic messages with the message IDs defined in this |
| | | * class. |
| | | */ |
| | |
| | | registerMessage(MSGID_TASK_LDIFEXPORT_INSUFFICIENT_PRIVILEGES, |
| | | "You do not have sufficient privileges to initiate an " + |
| | | "LDIF export."); |
| | | registerMessage(MSGID_TASK_INDEXREBUILD_INSUFFICIENT_PRIVILEGES, |
| | | "You do not have sufficient privileges to initiate an " + |
| | | "index rebuild."); |
| | | } |
| | | } |
| | | |
| | |
| | | * The message ID for the message that will be used as the description of the |
| | | * configClass argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_ENCPW_DESCRIPTION_CONFIG_CLASS = |
| | | public static final int MSGID_DESCRIPTION_CONFIG_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 12; |
| | | |
| | | |
| | |
| | | * The message ID for the message that will be used as the description of the |
| | | * configFile argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_ENCPW_DESCRIPTION_CONFIG_FILE = |
| | | public static final int MSGID_DESCRIPTION_CONFIG_FILE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 13; |
| | | |
| | | |
| | |
| | | * The message ID for the message that will be used as the description of the |
| | | * help argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_ENCPW_DESCRIPTION_USAGE = |
| | | public static final int MSGID_DESCRIPTION_USAGE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 15; |
| | | |
| | | |
| | |
| | | * initializing the command-line arguments. This takes a single argument, |
| | | * which is an explanation of the problem that occurred. |
| | | */ |
| | | public static final int MSGID_ENCPW_CANNOT_INITIALIZE_ARGS = |
| | | public static final int MSGID_CANNOT_INITIALIZE_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 16; |
| | | |
| | | |
| | |
| | | * parsing the command-line arguments. This takes a single argument, which is |
| | | * an explanation of the problem that occurred. |
| | | */ |
| | | public static final int MSGID_ENCPW_ERROR_PARSING_ARGS = |
| | | public static final int MSGID_ERROR_PARSING_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 17; |
| | | |
| | | |
| | |
| | | * trying to bootstrap the Directory Server. This takes a single argument, |
| | | * which is a string representation of the exception that was caught. |
| | | */ |
| | | public static final int MSGID_ENCPW_SERVER_BOOTSTRAP_ERROR = |
| | | public static final int MSGID_SERVER_BOOTSTRAP_ERROR = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 20; |
| | | |
| | | |
| | |
| | | * argument which is a message with information about the problem that |
| | | * occurred. |
| | | */ |
| | | public static final int MSGID_ENCPW_CANNOT_LOAD_CONFIG = |
| | | public static final int MSGID_CANNOT_LOAD_CONFIG = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 21; |
| | | |
| | | |
| | |
| | | * trying to load the Directory Server schema. This takes a single argument, |
| | | * which is a message with information about the problem that occurred. |
| | | */ |
| | | public static final int MSGID_ENCPW_CANNOT_LOAD_SCHEMA = |
| | | public static final int MSGID_CANNOT_LOAD_SCHEMA = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 22; |
| | | |
| | | |
| | |
| | | * single argument, which is a message with information about the problem that |
| | | * occurred. |
| | | */ |
| | | public static final int MSGID_ENCPW_CANNOT_INITIALIZE_CORE_CONFIG = |
| | | public static final int MSGID_CANNOT_INITIALIZE_CORE_CONFIG = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 23; |
| | | |
| | | |
| | |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 30; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configClass argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_DESCRIPTION_CONFIG_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 31; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configFile argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_DESCRIPTION_CONFIG_FILE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 32; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * ldifFile argument. This does not take any arguments. |
| | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * help argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_DESCRIPTION_USAGE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 45; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * initializing the command-line arguments. This takes a single argument, |
| | | * which is an explanation of the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_CANNOT_INITIALIZE_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 46; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * parsing the command-line arguments. This takes a single argument, which is |
| | | * an explanation of the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_ERROR_PARSING_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 47; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to bootstrap the Directory Server. This takes a single argument, |
| | | * which is a string representation of the exception that was caught. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_SERVER_BOOTSTRAP_ERROR = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 48; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying load the Directory Server configuration. This takes a single |
| | | * argument which is a message with information about the problem that |
| | | * occurred. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_CANNOT_LOAD_CONFIG = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 49; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to load the Directory Server schema. This takes a single argument, |
| | | * which is a message with information about the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_CANNOT_LOAD_SCHEMA = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 50; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to initialize the core Directory Server configuration. This takes a |
| | | * single argument, which is a message with information about the problem that |
| | | * occurred. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_CANNOT_INITIALIZE_CORE_CONFIG = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 51; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to decode an exclude filter. This takes two arguments, which are |
| | | * the provided filter string and a message explaining the problem that was |
| | |
| | | * the provided base DN string and a message explaining the problem that |
| | | * was encountered. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_CANNOT_DECODE_BASE_DN = |
| | | public static final int MSGID_CANNOT_DECODE_BASE_DN = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 54; |
| | | |
| | | |
| | |
| | | * arguments, which are the backend config base DN string and a message |
| | | * explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_CANNOT_DECODE_BACKEND_BASE_DN = |
| | | public static final int MSGID_CANNOT_DECODE_BACKEND_BASE_DN = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 60; |
| | | |
| | | |
| | |
| | | * arguments, which are the DN of the entry and a message explaining the |
| | | * problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY = |
| | | public static final int MSGID_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 61; |
| | | |
| | | |
| | |
| | | * which are the DN of the backend configuration entry and a message |
| | | * explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_CANNOT_DETERMINE_BACKEND_CLASS = |
| | | public static final int MSGID_CANNOT_DETERMINE_BACKEND_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 62; |
| | | |
| | | |
| | |
| | | * arguments, which are the class name, the DN of the configuration entry, and |
| | | * a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_CANNOT_LOAD_BACKEND_CLASS = |
| | | public static final int MSGID_CANNOT_LOAD_BACKEND_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 63; |
| | | |
| | | |
| | |
| | | * three arguments, which are the class name, the DN of the configuration |
| | | * entry, and a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_CANNOT_INSTANTIATE_BACKEND_CLASS = |
| | | public static final int MSGID_CANNOT_INSTANTIATE_BACKEND_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 64; |
| | | |
| | | |
| | |
| | | * entry does not define any base DNs. This takes a single argument, which is |
| | | * the DN of the backend configuration entry. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_NO_BASES_FOR_BACKEND = |
| | | public static final int MSGID_NO_BASES_FOR_BACKEND = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 65; |
| | | |
| | | |
| | |
| | | * arguments, which are the DN of the backend configuration entry and a string |
| | | * representation of the exception that was caught. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_CANNOT_DETERMINE_BASES_FOR_BACKEND = |
| | | public static final int MSGID_CANNOT_DETERMINE_BASES_FOR_BACKEND = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 66; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configClass argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_DESCRIPTION_CONFIG_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 67; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configFile argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_DESCRIPTION_CONFIG_FILE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 68; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * ldifFile argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_DESCRIPTION_LDIF_FILE = |
| | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * help argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_DESCRIPTION_USAGE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 82; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * initializing the command-line arguments. This takes a single argument, |
| | | * which is an explanation of the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_CANNOT_INITIALIZE_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 83; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * parsing the command-line arguments. This takes a single argument, which is |
| | | * an explanation of the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_ERROR_PARSING_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 84; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to bootstrap the Directory Server. This takes a single argument, |
| | | * which is a string representation of the exception that was caught. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_SERVER_BOOTSTRAP_ERROR = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 85; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying load the Directory Server configuration. This takes a single |
| | | * argument which is a message with information about the problem that |
| | | * occurred. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_CANNOT_LOAD_CONFIG = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 86; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to load the Directory Server schema. This takes a single argument, |
| | | * which is a message with information about the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_CANNOT_LOAD_SCHEMA = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 87; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to initialize the core Directory Server configuration. This takes a |
| | | * single argument, which is a message with information about the problem that |
| | | * occurred. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_CANNOT_INITIALIZE_CORE_CONFIG = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 88; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to decode an exclude filter. This takes two arguments, which are |
| | | * the provided filter string and a message explaining the problem that was |
| | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to decode the base DN string. This takes two arguments, which are |
| | | * the provided base DN string and a message explaining the problem that |
| | | * was encountered. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_CANNOT_DECODE_BASE_DN = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 91; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if multiple backends claim |
| | | * to have the requested backend ID. This takes a single argument, which is |
| | | * the requested base DN. |
| | |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 96; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to decode the backend configuration base DN string. This takes two |
| | | * arguments, which are the backend config base DN string and a message |
| | | * explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_CANNOT_DECODE_BACKEND_BASE_DN = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 97; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to retrieve the backend configuration base entry. This takes two |
| | | * arguments, which are the DN of the entry and a message explaining the |
| | | * problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 98; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to determine the backend class name. This takes two arguments, |
| | | * which are the DN of the backend configuration entry and a message |
| | | * explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_CANNOT_DETERMINE_BACKEND_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 99; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to load a class for a Directory Server backend. This takes three |
| | | * arguments, which are the class name, the DN of the configuration entry, and |
| | | * a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_CANNOT_LOAD_BACKEND_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 100; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to instantiate a class for a Directory Server backend. This takes |
| | | * three arguments, which are the class name, the DN of the configuration |
| | | * entry, and a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_CANNOT_INSTANTIATE_BACKEND_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 101; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if a backend configuration |
| | | * entry does not define any base DNs. This takes a single argument, which is |
| | | * the DN of the backend configuration entry. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_NO_BASES_FOR_BACKEND = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 102; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to determine the set of base DNs for a backend. This takes two |
| | | * arguments, which are the DN of the backend configuration entry and a string |
| | | * representation of the exception that was caught. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_CANNOT_DETERMINE_BASES_FOR_BACKEND = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 103; |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be give information |
| | | * on what operation is being processed. |
| | |
| | | * verify indexes specifies the base DN of a backend that does not |
| | | * support indexing. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_WRONG_BACKEND_TYPE = |
| | | public static final int MSGID_BACKEND_NO_INDEXING_SUPPORT = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 212; |
| | | |
| | | |
| | |
| | | * the DN of the backend configuration entry and a message explaining the |
| | | * problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_CANNOT_DETERMINE_BACKEND_ID = |
| | | public static final int MSGID_CANNOT_DETERMINE_BACKEND_ID = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 217; |
| | | |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configClass argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_DESCRIPTION_CONFIG_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 220; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configFile argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_DESCRIPTION_CONFIG_FILE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 221; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * help argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_DESCRIPTION_USAGE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 222; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * initializing the command-line arguments. This takes a single argument, |
| | | * which is an explanation of the problem that occurred. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_CANNOT_INITIALIZE_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 223; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * parsing the command-line arguments. This takes a single argument, which is |
| | | * an explanation of the problem that occurred. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_ERROR_PARSING_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 224; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to bootstrap the Directory Server. This takes a single argument, |
| | | * which is a string representation of the exception that was caught. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_SERVER_BOOTSTRAP_ERROR = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 225; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying load the Directory Server configuration. This takes a single |
| | | * argument which is a message with information about the problem that |
| | | * occurred. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_CANNOT_LOAD_CONFIG = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 226; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to load the Directory Server schema. This takes a single argument, |
| | | * which is a message with information about the problem that occurred. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_CANNOT_LOAD_SCHEMA = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 227; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to initialize the core Directory Server configuration. This takes a |
| | | * single argument, which is a message with information about the problem that |
| | | * occurred. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_CANNOT_INITIALIZE_CORE_CONFIG = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 228; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to decode the base DN string. This takes two arguments, which are |
| | | * the provided base DN string and a message explaining the problem that |
| | | * was encountered. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_CANNOT_DECODE_BASE_DN = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 229; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if multiple backends claim |
| | | * to support the requested base DN. This takes a single argument, which is |
| | | * the requested base DN. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_MULTIPLE_BACKENDS_FOR_BASE = |
| | | public static final int MSGID_MULTIPLE_BACKENDS_FOR_BASE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 230; |
| | | |
| | | |
| | |
| | | * support the requested base DN. This takes a single argument, which is the |
| | | * requested base DN. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_NO_BACKENDS_FOR_BASE = |
| | | public static final int MSGID_NO_BACKENDS_FOR_BASE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 231; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to decode the backend configuration base DN string. This takes two |
| | | * arguments, which are the backend config base DN string and a message |
| | | * explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_CANNOT_DECODE_BACKEND_BASE_DN = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 232; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to retrieve the backend configuration base entry. This takes two |
| | | * arguments, which are the DN of the entry and a message explaining the |
| | | * problem that occurred. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 233; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to determine the backend class name. This takes two arguments, |
| | | * which are the DN of the backend configuration entry and a message |
| | | * explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_CANNOT_DETERMINE_BACKEND_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 234; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to load a class for a Directory Server backend. This takes three |
| | | * arguments, which are the class name, the DN of the configuration entry, and |
| | | * a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_CANNOT_LOAD_BACKEND_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 235; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to instantiate a class for a Directory Server backend. This takes |
| | | * three arguments, which are the class name, the DN of the configuration |
| | | * entry, and a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_CANNOT_INSTANTIATE_BACKEND_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 236; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if a backend configuration |
| | | * entry does not define any base DNs. This takes a single argument, which is |
| | | * the DN of the backend configuration entry. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_NO_BASES_FOR_BACKEND = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 237; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to determine the set of base DNs for a backend. This takes two |
| | | * arguments, which are the DN of the backend configuration entry and a string |
| | | * representation of the exception that was caught. |
| | | */ |
| | | public static final int MSGID_VERIFYINDEX_CANNOT_DETERMINE_BASES_FOR_BACKEND = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 238; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to determine the backend ID. This takes two arguments, which are |
| | | * the DN of the backend configuration entry and a message explaining the |
| | | * problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_CANNOT_DETERMINE_BACKEND_ID = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 239; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * includeBranch argument. This does not take any arguments. |
| | | */ |
| | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configClass argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_DESCRIPTION_CONFIG_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 243; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configFile argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_DESCRIPTION_CONFIG_FILE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 244; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * backendID argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_DESCRIPTION_BACKEND_ID = |
| | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * help argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_DESCRIPTION_USAGE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 253; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * initializing the command-line arguments. This takes a single argument, |
| | | * which is an explanation of the problem that occurred. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_CANNOT_INITIALIZE_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 254; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * parsing the command-line arguments. This takes a single argument, which is |
| | | * an explanation of the problem that occurred. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_ERROR_PARSING_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 255; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to bootstrap the Directory Server. This takes a single argument, |
| | | * which is a string representation of the exception that was caught. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_SERVER_BOOTSTRAP_ERROR = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 256; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying load the Directory Server configuration. This takes a single |
| | | * argument which is a message with information about the problem that |
| | | * occurred. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_CANNOT_LOAD_CONFIG = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 257; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to load the Directory Server schema. This takes a single argument, |
| | | * which is a message with information about the problem that occurred. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_CANNOT_LOAD_SCHEMA = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 258; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to initialize the core Directory Server configuration. This takes a |
| | | * single argument, which is a message with information about the problem that |
| | | * occurred. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_CANNOT_INITIALIZE_CORE_CONFIG = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 259; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if multiple backends claim |
| | | * to have the requested backend ID. This takes a single argument, which is |
| | | * the requested backend ID. |
| | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to decode the backend configuration base DN string. This takes two |
| | | * arguments, which are the backend config base DN string and a message |
| | | * explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_CANNOT_DECODE_BACKEND_BASE_DN = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 266; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to retrieve the backend configuration base entry. This takes two |
| | | * arguments, which are the DN of the entry and a message explaining the |
| | | * problem that occurred. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 267; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to determine the backend class name. This takes two arguments, |
| | | * which are the DN of the backend configuration entry and a message |
| | | * explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_CANNOT_DETERMINE_BACKEND_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 268; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to load a class for a Directory Server backend. This takes three |
| | | * arguments, which are the class name, the DN of the configuration entry, and |
| | | * a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_CANNOT_LOAD_BACKEND_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 269; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to instantiate a class for a Directory Server backend. This takes |
| | | * three arguments, which are the class name, the DN of the configuration |
| | | * entry, and a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_CANNOT_INSTANTIATE_BACKEND_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 270; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if a backend configuration |
| | | * entry does not define any base DNs. This takes a single argument, which is |
| | | * the DN of the backend configuration entry. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_NO_BASES_FOR_BACKEND = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 271; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to determine the set of base DNs for a backend. This takes two |
| | | * arguments, which are the DN of the backend configuration entry and a string |
| | | * representation of the exception that was caught. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_CANNOT_DETERMINE_BASES_FOR_BACKEND = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 272; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to determine the backend ID. This takes two arguments, which are |
| | | * the DN of the backend configuration entry and a message explaining the |
| | | * problem that occurred. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_CANNOT_DETERMINE_BACKEND_ID = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 273; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * backUpAll argument. This does not take any arguments. |
| | | */ |
| | |
| | | * initializing the crypto manager. This takes a single argument, which is a |
| | | * message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFEXPORT_CANNOT_INITIALIZE_CRYPTO_MANAGER = |
| | | public static final int MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 284; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * initializing the crypto manager. This takes a single argument, which is a |
| | | * message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFIMPORT_CANNOT_INITIALIZE_CRYPTO_MANAGER = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 285; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * initializing the crypto manager. This takes a single argument, which is a |
| | | * message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_BACKUPDB_CANNOT_INITIALIZE_CRYPTO_MANAGER = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 286; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * incrementalBaseID argument. This does not take any arguments. |
| | | */ |
| | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configClass argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_DESCRIPTION_CONFIG_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 289; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configFile argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_DESCRIPTION_CONFIG_FILE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 290; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * backendID argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_DESCRIPTION_BACKEND_ID = |
| | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * help argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_DESCRIPTION_USAGE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 296; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * initializing the command-line arguments. This takes a single argument, |
| | | * which is an explanation of the problem that occurred. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_CANNOT_INITIALIZE_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 297; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * parsing the command-line arguments. This takes a single argument, which is |
| | | * an explanation of the problem that occurred. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_ERROR_PARSING_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 298; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to bootstrap the Directory Server. This takes a single argument, |
| | | * which is a string representation of the exception that was caught. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_SERVER_BOOTSTRAP_ERROR = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 299; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying load the Directory Server configuration. This takes a single |
| | | * argument which is a message with information about the problem that |
| | | * occurred. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_CANNOT_LOAD_CONFIG = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 300; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to load the Directory Server schema. This takes a single argument, |
| | | * which is a message with information about the problem that occurred. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_CANNOT_LOAD_SCHEMA = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 301; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to initialize the core Directory Server configuration. This takes a |
| | | * single argument, which is a message with information about the problem that |
| | | * occurred. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_CANNOT_INITIALIZE_CORE_CONFIG = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 302; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * initializing the crypto manager. This takes a single argument, which is a |
| | | * message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_CANNOT_INITIALIZE_CRYPTO_MANAGER = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 303; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to parse the backup descriptor contained in the specified backup |
| | | * directory. This takes two arguments, which are the path to the backup |
| | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to decode the backend configuration base DN string. This takes two |
| | | * arguments, which are the backend config base DN string and a message |
| | | * explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_CANNOT_DECODE_BACKEND_BASE_DN = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 318; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to retrieve the backend configuration base entry. This takes two |
| | | * arguments, which are the DN of the entry and a message explaining the |
| | | * problem that occurred. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 319; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to determine the backend class name. This takes two arguments, |
| | | * which are the DN of the backend configuration entry and a message |
| | | * explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_CANNOT_DETERMINE_BACKEND_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 320; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to load a class for a Directory Server backend. This takes three |
| | | * arguments, which are the class name, the DN of the configuration entry, and |
| | | * a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_CANNOT_LOAD_BACKEND_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 321; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to instantiate a class for a Directory Server backend. This takes |
| | | * three arguments, which are the class name, the DN of the configuration |
| | | * entry, and a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_CANNOT_INSTANTIATE_BACKEND_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 322; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if a backend configuration |
| | | * entry does not define any base DNs. This takes a single argument, which is |
| | | * the DN of the backend configuration entry. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_NO_BASES_FOR_BACKEND = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 323; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to determine the set of base DNs for a backend. This takes two |
| | | * arguments, which are the DN of the backend configuration entry and a string |
| | | * representation of the exception that was caught. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_CANNOT_DETERMINE_BASES_FOR_BACKEND = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 324; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to determine the backend ID. This takes two arguments, which are |
| | | * the DN of the backend configuration entry and a message explaining the |
| | | * problem that occurred. |
| | | */ |
| | | public static final int MSGID_RESTOREDB_CANNOT_DETERMINE_BACKEND_ID = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 325; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if the signHash option was |
| | | * used without the hash option. This takes two arguments, which are the |
| | | * long identifiers for the signHash and the hash arguments. |
| | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * attempting to initialize the command-line argument parser. This takes a |
| | | * single argument, which is a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_STOPDS_CANNOT_INITIALIZE_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 393; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * parsing the provided command-line arguments. This takes a single argument, |
| | | * which is a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_STOPDS_ERROR_PARSING_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 394; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if two arguments that are |
| | | * mutually exclusive were both provided. This takes two arguments, which are |
| | | * the long identifiers for the mutually-exclusive command line arguments. |
| | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configFile argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LDIFSEARCH_DESCRIPTION_CONFIG_FILE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 417; |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configClass argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LDIFSEARCH_DESCRIPTION_CONFIG_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 418; |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * filterFile argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LDIFSEARCH_DESCRIPTION_FILTER_FILE = |
| | |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 424; |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * help argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LDIFSEARCH_DESCRIPTION_USAGE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 425; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * attempting to initialize the command-line argument parser. This takes a |
| | | * single argument, which is a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFSEARCH_CANNOT_INITIALIZE_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 426; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * parsing the provided command-line arguments. This takes a single argument, |
| | | * which is a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFSEARCH_ERROR_PARSING_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 427; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if no filter file or |
| | |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 446; |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configFile argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LDIFDIFF_DESCRIPTION_CONFIG_FILE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 447; |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configClass argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LDIFDIFF_DESCRIPTION_CONFIG_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 448; |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * help argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LDIFDIFF_DESCRIPTION_USAGE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 449; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * attempting to initialize the command-line argument parser. This takes a |
| | | * single argument, which is a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFDIFF_CANNOT_INITIALIZE_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 450; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * parsing the provided command-line arguments. This takes a single argument, |
| | | * which is a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFDIFF_ERROR_PARSING_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 451; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configFile argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_CONFIGDS_DESCRIPTION_CONFIG_FILE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 462; |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configClass argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_CONFIGDS_DESCRIPTION_CONFIG_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 463; |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * ldapPort argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_CONFIGDS_DESCRIPTION_LDAP_PORT = |
| | |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 468; |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * help argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_CONFIGDS_DESCRIPTION_USAGE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 469; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * attempting to initialize the command-line argument parser. This takes a |
| | | * single argument, which is a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_CONFIGDS_CANNOT_INITIALIZE_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 470; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * parsing the provided command-line arguments. This takes a single argument, |
| | | * which is a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_CONFIGDS_ERROR_PARSING_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 471; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description for the |
| | | * configFile argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_INSTALLDS_DESCRIPTION_CONFIG_FILE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 487; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description for the |
| | | * configClass argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_INSTALLDS_DESCRIPTION_CONFIG_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 488; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description for the |
| | | * silentInstall argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_INSTALLDS_DESCRIPTION_SILENT = |
| | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configFile argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_MAKELDIF_DESCRIPTION_CONFIG_FILE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 574; |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configClass argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_MAKELDIF_DESCRIPTION_CONFIG_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 575; |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * templateFile argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_MAKELDIF_DESCRIPTION_TEMPLATE = |
| | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * attempting to initialize the command-line argument parser. This takes a |
| | | * single argument, which is a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_MAKELDIF_CANNOT_INITIALIZE_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 580; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * parsing the provided command-line arguments. This takes a single argument, |
| | | * which is a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_MAKELDIF_ERROR_PARSING_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 581; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * initializing the Directory Server JMX subsystem. This takes two arguments, |
| | | * which are the path to the Directory Server configuration file and a message |
| | | * explaining the problem that occurred. |
| | |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_MILD_ERROR | 617; |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configFile argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LDIFMODIFY_DESCRIPTION_CONFIG_FILE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 618; |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configClass argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LDIFMODIFY_DESCRIPTION_CONFIG_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 619; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description for the |
| | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * attempting to initialize the command-line argument parser. This takes a |
| | | * single argument, which is a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFMODIFY_CANNOT_INITIALIZE_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 624; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * parsing the provided command-line arguments. This takes a single argument, |
| | | * which is a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDIFMODIFY_ERROR_PARSING_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 625; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * initializing the Directory Server JMX subsystem. This takes two arguments, |
| | | * which are the path to the Directory Server configuration file and a message |
| | | * explaining the problem that occurred. |
| | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description for the |
| | | * help argument. It does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LDAPPWMOD_DESCRIPTION_USAGE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 653; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * initializing the command-line arguments. This takes a single argument, |
| | | * which is an explanation of the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDAPPWMOD_CANNOT_INITIALIZE_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 654; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * parsing the command-line arguments. This takes a single argument, which is |
| | | * an explanation of the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LDAPPWMOD_ERROR_PARSING_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 655; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used to indicate that two |
| | | * arguments must not be used together. This takes two arguments, which are |
| | | * the long identifiers for the conflicting arguments. |
| | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * attempting to initialize the command-line argument parser. This takes a |
| | | * single argument, which is a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_WAIT4DEL_CANNOT_INITIALIZE_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 679; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * parsing the provided command-line arguments. This takes a single argument, |
| | | * which is a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_WAIT4DEL_ERROR_PARSING_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 680; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to open the log file for reading. This takes two arguments, which |
| | | * are the path to the log file and a message explaining the problem that |
| | | * occurred. |
| | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configClass argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LISTBACKENDS_DESCRIPTION_CONFIG_CLASS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 724; |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * configFile argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LISTBACKENDS_DESCRIPTION_CONFIG_FILE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 725; |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * backendID argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_LISTBACKENDS_DESCRIPTION_BACKEND_ID = |
| | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * attempting to initialize the command-line argument parser. This takes a |
| | | * single argument, which is a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LISTBACKENDS_CANNOT_INITIALIZE_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 729; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * parsing the provided command-line arguments. This takes a single argument, |
| | | * which is a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LISTBACKENDS_ERROR_PARSING_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 730; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to bootstrap the Directory Server. This takes a single argument, |
| | | * which is a string representation of the exception that was caught. |
| | | */ |
| | | public static final int MSGID_LISTBACKENDS_SERVER_BOOTSTRAP_ERROR = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 731; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying load the Directory Server configuration. This takes a single |
| | | * argument which is a message with information about the problem that |
| | | * occurred. |
| | | */ |
| | | public static final int MSGID_LISTBACKENDS_CANNOT_LOAD_CONFIG = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 732; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to load the Directory Server schema. This takes a single argument, |
| | | * which is a message with information about the problem that occurred. |
| | | */ |
| | | public static final int MSGID_LISTBACKENDS_CANNOT_LOAD_SCHEMA = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 733; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to read backend information from the configuration. This takes a |
| | | * single argument, which is a message explaining the problem that occurred. |
| | | */ |
| | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to decode the base DN for backend configuration entries. This takes |
| | | * two arguments, which are the base DN and a message explaining the problem |
| | | * that occurred. |
| | | */ |
| | | public static final int MSGID_LISTBACKENDS_CANNOT_DECODE_BACKEND_BASE_DN = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 744; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to retrieve the backend configuration base entry. This takes two |
| | | * arguments, which are the DN of the entry and a message explaining the |
| | | * problem that occurred. |
| | | */ |
| | | public static final int |
| | | MSGID_LISTBACKENDS_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 745; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to determine the backend ID. This takes two arguments, which are |
| | | * the DN of the backend configuration entry and a message explaining the |
| | | * problem that occurred. |
| | | */ |
| | | public static final int MSGID_LISTBACKENDS_CANNOT_DETERMINE_BACKEND_ID = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 746; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to determine the set of base DNs for a backend. This takes two |
| | | * arguments, which are the DN of the backend configuration entry and a string |
| | | * representation of the exception that was caught. |
| | | */ |
| | | public static final int |
| | | MSGID_LISTBACKENDS_CANNOT_DETERMINE_BASES_FOR_BACKEND = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 747; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if the encoded password is |
| | | * not valid according to the user password syntax. This takes a single |
| | | * argument, which is a message explaining why it is invalid. |
| | |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 820; |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * initializing the command-line arguments. This takes a single argument, |
| | | * which is an explanation of the problem that occurred. |
| | | */ |
| | | public static final int |
| | | MSGID_CONFIGURE_WINDOWS_SERVICE_CANNOT_INITIALIZE_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 821; |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * parsing the command-line arguments. This takes a single argument, which is |
| | | * an explanation of the problem that occurred. |
| | | */ |
| | | public static final int MSGID_CONFIGURE_WINDOWS_SERVICE_ERROR_PARSING_ARGS = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 822; |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs if |
| | | * the user provided too many arguments. This does not take any argument. |
| | | */ |
| | |
| | | public static final int MSGID_WINDOWS_SERVICE_CLEANUP_ERROR = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 848; |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description for the |
| | | * rebuild-index tool. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_REBUILDINDEX_TOOL_DESCRIPTION = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 849; |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * index name argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_REBUILDINDEX_DESCRIPTION_BASE_DN = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 850; |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * index name argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_REBUILDINDEX_DESCRIPTION_INDEX_NAME = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 851; |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * trying to perform index rebuild. This takes a single argument, |
| | | * which is a message explaining the problem that occurred. |
| | | */ |
| | | public static final int MSGID_REBUILDINDEX_ERROR_DURING_REBUILD = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 852; |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if a request to |
| | | * rebuild indexes specifies the base DN of a backend that does not |
| | | * support indexing. |
| | | */ |
| | | public static final int MSGID_REBUILDINDEX_WRONG_BACKEND_TYPE = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 853; |
| | | |
| | | /** |
| | | * The message ID to inform at least one index is required for the rebuild |
| | | * process. |
| | | */ |
| | | public static final int MSGID_REBUILDINDEX_REQUIRES_AT_LEAST_ONE_INDEX = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 854; |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * attempting to acquire a lock for the backend being rebuilt. This takes |
| | | * two arguments, which are the backend ID and a message explaining the |
| | | * problem that occurred. |
| | | */ |
| | | public static final int MSGID_REBUILDINDEX_CANNOT_EXCLUSIVE_LOCK_BACKEND = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 855; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * attempting to release a lock for the backend being rebuilt. This takes |
| | | * two arguments, which are the backend ID and a message explaining the |
| | | * problem that occurred. |
| | | */ |
| | | public static final int MSGID_REBUILDINDEX_CANNOT_UNLOCK_BACKEND = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_WARNING | 856; |
| | | |
| | | |
| | | /** |
| | | * The message ID for the message that will be used if an error occurs while |
| | | * attempting to acquire a lock for the backend being rebuilt. This takes |
| | | * two arguments, which are the backend ID and a message explaining the |
| | | * problem that occurred. |
| | | */ |
| | | public static final int MSGID_REBUILDINDEX_CANNOT_SHARED_LOCK_BACKEND = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 857; |
| | | |
| | | |
| | | /** |
| | | * Associates a set of generic messages with the message IDs defined in this |
| | |
| | | "password"); |
| | | registerMessage(MSGID_ENCPW_DESCRIPTION_ENCODED_PW_FILE, |
| | | "Encoded password file"); |
| | | registerMessage(MSGID_ENCPW_DESCRIPTION_CONFIG_CLASS, |
| | | "Specifies the fully-qualified name of the Java class " + |
| | | "that serves as the configuration handler for the " + |
| | | "Directory Server."); |
| | | registerMessage(MSGID_ENCPW_DESCRIPTION_CONFIG_FILE, |
| | | registerMessage(MSGID_DESCRIPTION_CONFIG_CLASS, |
| | | "The fully-qualified name of the Java class to use as " + |
| | | "the Directory Server configuration handler. If this is " + |
| | | "not provided, then a default of " + |
| | | ConfigFileHandler.class.getName() + " will be used."); |
| | | registerMessage(MSGID_DESCRIPTION_CONFIG_FILE, |
| | | "Specifies the path to the Directory Server " + |
| | | "configuration file."); |
| | | registerMessage(MSGID_ENCPW_DESCRIPTION_SCHEME, |
| | |
| | | registerMessage(MSGID_ENCPW_DESCRIPTION_USE_COMPARE_RESULT, |
| | | "Use the LDAP compare result as an exit code for the " + |
| | | "password comparison"); |
| | | registerMessage(MSGID_ENCPW_DESCRIPTION_USAGE, |
| | | registerMessage(MSGID_DESCRIPTION_USAGE, |
| | | "Displays this usage information."); |
| | | registerMessage(MSGID_ENCPW_CANNOT_INITIALIZE_ARGS, |
| | | registerMessage(MSGID_CANNOT_INITIALIZE_ARGS, |
| | | "An unexpected error occurred while attempting to " + |
| | | "initialize the command-line arguments: %s."); |
| | | registerMessage(MSGID_ENCPW_ERROR_PARSING_ARGS, |
| | | registerMessage(MSGID_ERROR_PARSING_ARGS, |
| | | "An error occurred while parsing the command-line " + |
| | | "arguments: %s."); |
| | | registerMessage(MSGID_ENCPW_NO_CLEAR_PW, |
| | |
| | | registerMessage(MSGID_ENCPW_NO_SCHEME, |
| | | "No password storage scheme was specified. Use the --%s " + |
| | | "argument to specify the storage scheme."); |
| | | registerMessage(MSGID_ENCPW_SERVER_BOOTSTRAP_ERROR, |
| | | registerMessage(MSGID_SERVER_BOOTSTRAP_ERROR, |
| | | "An unexpected error occurred while attempting to " + |
| | | "bootstrap the Directory Server client-side code: %s."); |
| | | registerMessage(MSGID_ENCPW_CANNOT_LOAD_CONFIG, |
| | | registerMessage(MSGID_CANNOT_LOAD_CONFIG, |
| | | "An error occurred while trying to load the Directory " + |
| | | "Server configuration: %s."); |
| | | registerMessage(MSGID_ENCPW_CANNOT_LOAD_SCHEMA, |
| | | registerMessage(MSGID_CANNOT_LOAD_SCHEMA, |
| | | "An error occurred while trying to load the Directory " + |
| | | "Server schema: %s."); |
| | | registerMessage(MSGID_ENCPW_CANNOT_INITIALIZE_CORE_CONFIG, |
| | | registerMessage(MSGID_CANNOT_INITIALIZE_CORE_CONFIG, |
| | | "An error occurred while trying to initialize the core " + |
| | | "Directory Server configuration: %s."); |
| | | registerMessage(MSGID_ENCPW_CANNOT_INITIALIZE_STORAGE_SCHEMES, |
| | |
| | | "clear-text password: %s."); |
| | | |
| | | |
| | | registerMessage(MSGID_LDIFEXPORT_DESCRIPTION_CONFIG_CLASS, |
| | | "Specifies the fully-qualified name of the Java class " + |
| | | "that serves as the configuration handler for the " + |
| | | "Directory Server."); |
| | | registerMessage(MSGID_LDIFEXPORT_DESCRIPTION_CONFIG_FILE, |
| | | "Specifies the path to the Directory Server " + |
| | | "configuration file."); |
| | | registerMessage(MSGID_LDIFEXPORT_DESCRIPTION_LDIF_FILE, |
| | | "Path to the LDIF file to be written"); |
| | | registerMessage(MSGID_LDIFEXPORT_DESCRIPTION_APPEND_TO_LDIF, |
| | |
| | | "Encrypt the LDIF data as it is exported"); |
| | | registerMessage(MSGID_LDIFEXPORT_DESCRIPTION_SIGN_HASH, |
| | | "Generate a signed hash of the export data"); |
| | | registerMessage(MSGID_LDIFEXPORT_DESCRIPTION_USAGE, |
| | | "Display this usage information."); |
| | | registerMessage(MSGID_LDIFEXPORT_CANNOT_INITIALIZE_ARGS, |
| | | "An unexpected error occurred while attempting to " + |
| | | "initialize the command-line arguments: %s."); |
| | | registerMessage(MSGID_LDIFEXPORT_ERROR_PARSING_ARGS, |
| | | "An error occurred while parsing the command-line " + |
| | | "arguments: %s."); |
| | | registerMessage(MSGID_LDIFEXPORT_SERVER_BOOTSTRAP_ERROR, |
| | | "An unexpected error occurred while attempting to " + |
| | | "bootstrap the Directory Server client-side code: %s."); |
| | | registerMessage(MSGID_LDIFEXPORT_CANNOT_LOAD_CONFIG, |
| | | "An error occurred while trying to load the Directory " + |
| | | "Server configuration: %s."); |
| | | registerMessage(MSGID_LDIFEXPORT_CANNOT_LOAD_SCHEMA, |
| | | "An error occurred while trying to load the Directory " + |
| | | "Server schema: %s."); |
| | | registerMessage(MSGID_LDIFEXPORT_CANNOT_INITIALIZE_CORE_CONFIG, |
| | | "An error occurred while trying to initialize the core " + |
| | | "Directory Server configuration: %s."); |
| | | registerMessage(MSGID_LDIFEXPORT_CANNOT_INITIALIZE_CRYPTO_MANAGER, |
| | | registerMessage(MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER, |
| | | "An error occurred while attempting to initialize the " + |
| | | "crypto manager: %s."); |
| | | registerMessage(MSGID_LDIFEXPORT_CANNOT_INITIALIZE_PLUGINS, |
| | |
| | | registerMessage(MSGID_LDIFEXPORT_CANNOT_PARSE_INCLUDE_FILTER, |
| | | "Unable to decode include filter string \"%s\" as a " + |
| | | "valid search filter: %s."); |
| | | registerMessage(MSGID_LDIFEXPORT_CANNOT_DECODE_BASE_DN, |
| | | registerMessage(MSGID_CANNOT_DECODE_BASE_DN, |
| | | "Unable to decode base DN string \"%s\" as a valid " + |
| | | "distinguished name: %s."); |
| | | registerMessage(MSGID_LDIFEXPORT_MULTIPLE_BACKENDS_FOR_ID, |
| | |
| | | "shared lock for backend %s: %s. This lock should " + |
| | | "automatically be cleared when the export process exits, " + |
| | | "so no further action should be required."); |
| | | registerMessage(MSGID_LDIFEXPORT_CANNOT_DECODE_BACKEND_BASE_DN, |
| | | registerMessage(MSGID_CANNOT_DECODE_BACKEND_BASE_DN, |
| | | "Unable to decode the backend configuration base DN " + |
| | | "string \"%s\" as a valid DN: %s."); |
| | | registerMessage(MSGID_LDIFEXPORT_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY, |
| | | registerMessage(MSGID_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY, |
| | | "Unable to retrieve the backend configuration base entry " + |
| | | "\"%s\" from the server configuration: %s."); |
| | | registerMessage(MSGID_LDIFEXPORT_CANNOT_DETERMINE_BACKEND_CLASS, |
| | | registerMessage(MSGID_CANNOT_DETERMINE_BACKEND_CLASS, |
| | | "Cannot determine the name of the Java class providing " + |
| | | "the logic for the backend defined in configuration " + |
| | | "entry %s: %s."); |
| | | registerMessage(MSGID_LDIFEXPORT_CANNOT_LOAD_BACKEND_CLASS, |
| | | registerMessage(MSGID_CANNOT_LOAD_BACKEND_CLASS, |
| | | "Unable to load class %s referenced in configuration " + |
| | | "entry %s for use as a Directory Server backend: %s."); |
| | | registerMessage(MSGID_LDIFEXPORT_CANNOT_INSTANTIATE_BACKEND_CLASS, |
| | | registerMessage(MSGID_CANNOT_INSTANTIATE_BACKEND_CLASS, |
| | | "Unable to create an instance of class %s referenced in " + |
| | | "configuration entry %s as a Directory Server backend: " + |
| | | "%s."); |
| | | registerMessage(MSGID_LDIFEXPORT_NO_BASES_FOR_BACKEND, |
| | | registerMessage(MSGID_NO_BASES_FOR_BACKEND, |
| | | "No base DNs have been defined in backend configuration " + |
| | | "entry %s. This backend will not be evaluated in the " + |
| | | "LDIF export process."); |
| | | registerMessage(MSGID_LDIFEXPORT_CANNOT_DETERMINE_BASES_FOR_BACKEND, |
| | | "entry %s. This backend will not be evaluated."); |
| | | registerMessage(MSGID_CANNOT_DETERMINE_BASES_FOR_BACKEND, |
| | | "Unable to determine the set of base DNs defined in " + |
| | | "backend configuration entry %s: %s."); |
| | | registerMessage(MSGID_LDIFEXPORT_CANNOT_DETERMINE_BACKEND_ID, |
| | | registerMessage(MSGID_CANNOT_DETERMINE_BACKEND_ID, |
| | | "Cannot determine the backend ID for the backend defined " + |
| | | "in configuration entry %s: %s."); |
| | | registerMessage(MSGID_LDIFEXPORT_CANNOT_DECODE_INCLUDE_BASE, |
| | |
| | | "backend with backend ID %s."); |
| | | |
| | | |
| | | registerMessage(MSGID_LDIFIMPORT_DESCRIPTION_CONFIG_CLASS, |
| | | "Specifies the fully-qualified name of the Java class " + |
| | | "that serves as the configuration handler for the " + |
| | | "Directory Server."); |
| | | registerMessage(MSGID_LDIFIMPORT_DESCRIPTION_CONFIG_FILE, |
| | | "Specifies the path to the Directory Server " + |
| | | "configuration file."); |
| | | registerMessage(MSGID_LDIFIMPORT_DESCRIPTION_LDIF_FILE, |
| | | "Path to the LDIF file to be imported"); |
| | | registerMessage(MSGID_LDIFIMPORT_DESCRIPTION_TEMPLATE_FILE, |
| | |
| | | "LDIF file is encrypted"); |
| | | registerMessage(MSGID_LDIFIMPORT_DESCRIPTION_QUIET, |
| | | "Use quiet mode (no output)"); |
| | | registerMessage(MSGID_LDIFIMPORT_DESCRIPTION_USAGE, |
| | | "Display this usage information."); |
| | | registerMessage(MSGID_LDIFIMPORT_CANNOT_INITIALIZE_ARGS, |
| | | "An unexpected error occurred while attempting to " + |
| | | "initialize the command-line arguments: %s."); |
| | | registerMessage(MSGID_LDIFIMPORT_ERROR_PARSING_ARGS, |
| | | "An error occurred while parsing the command-line " + |
| | | "arguments: %s."); |
| | | registerMessage(MSGID_LDIFIMPORT_CONFLICTING_OPTIONS, |
| | | "The %s and %s arguments are incompatible and may not be " + |
| | | "used together."); |
| | |
| | | "Neither the %s or the %s argument was provided. One " + |
| | | "of these arguments must be given to specify the source " + |
| | | "for the LDIF data to be imported."); |
| | | registerMessage(MSGID_LDIFIMPORT_SERVER_BOOTSTRAP_ERROR, |
| | | "An unexpected error occurred while attempting to " + |
| | | "bootstrap the Directory Server client-side code: %s."); |
| | | registerMessage(MSGID_LDIFIMPORT_CANNOT_LOAD_CONFIG, |
| | | "An error occurred while trying to load the Directory " + |
| | | "Server configuration: %s."); |
| | | registerMessage(MSGID_LDIFIMPORT_CANNOT_LOAD_SCHEMA, |
| | | "An error occurred while trying to load the Directory " + |
| | | "Server schema: %s."); |
| | | registerMessage(MSGID_LDIFIMPORT_CANNOT_INITIALIZE_CORE_CONFIG, |
| | | "An error occurred while trying to initialize the core " + |
| | | "Directory Server configuration: %s."); |
| | | registerMessage(MSGID_LDIFIMPORT_CANNOT_INITIALIZE_CRYPTO_MANAGER, |
| | | "An error occurred while attempting to initialize the " + |
| | | "crypto manager: %s."); |
| | | registerMessage(MSGID_LDIFIMPORT_CANNOT_INITIALIZE_PWPOLICY, |
| | | "An error occurred while attempting to initialize the " + |
| | | "password policy components: %s."); |
| | |
| | | registerMessage(MSGID_LDIFIMPORT_CANNOT_PARSE_INCLUDE_FILTER, |
| | | "Unable to decode include filter string \"%s\" as a " + |
| | | "valid search filter: %s."); |
| | | registerMessage(MSGID_LDIFIMPORT_CANNOT_DECODE_BASE_DN, |
| | | "Unable to decode base DN string \"%s\" as a valid " + |
| | | "distinguished name: %s."); |
| | | registerMessage(MSGID_LDIFIMPORT_MULTIPLE_BACKENDS_FOR_ID, |
| | | "Multiple Directory Server backends are configured with " + |
| | | "backend ID \"%s\"."); |
| | |
| | | "exclusive lock for backend %s: %s. This lock should " + |
| | | "automatically be cleared when the import process exits, " + |
| | | "so no further action should be required."); |
| | | registerMessage(MSGID_LDIFIMPORT_CANNOT_DECODE_BACKEND_BASE_DN, |
| | | "Unable to decode the backend configuration base DN " + |
| | | "string \"%s\" as a valid DN: %s."); |
| | | registerMessage(MSGID_LDIFIMPORT_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY, |
| | | "Unable to retrieve the backend configuration base entry " + |
| | | "\"%s\" from the server configuration: %s."); |
| | | registerMessage(MSGID_LDIFIMPORT_CANNOT_DETERMINE_BACKEND_ID, |
| | | "Cannot determine the backend ID for the backend defined " + |
| | | "in configuration entry %s: %s."); |
| | | registerMessage(MSGID_LDIFIMPORT_CANNOT_DETERMINE_BACKEND_CLASS, |
| | | "Cannot determine the name of the Java class providing " + |
| | | "the logic for the backend defined in configuration " + |
| | | "entry %s: %s."); |
| | | registerMessage(MSGID_LDIFIMPORT_CANNOT_LOAD_BACKEND_CLASS, |
| | | "Unable to load class %s referenced in configuration " + |
| | | "entry %s for use as a Directory Server backend: %s."); |
| | | registerMessage(MSGID_LDIFIMPORT_CANNOT_INSTANTIATE_BACKEND_CLASS, |
| | | "Unable to create an instance of class %s referenced in " + |
| | | "configuration entry %s as a Directory Server backend: " + |
| | | "%s."); |
| | | registerMessage(MSGID_LDIFIMPORT_NO_BASES_FOR_BACKEND, |
| | | "No base DNs have been defined in backend configuration " + |
| | | "entry %s. This backend will not be evaluated in the " + |
| | | "LDIF import process."); |
| | | registerMessage(MSGID_LDIFIMPORT_CANNOT_DETERMINE_BASES_FOR_BACKEND, |
| | | "Unable to determine the set of base DNs defined in " + |
| | | "backend configuration entry %s: %s."); |
| | | |
| | | |
| | | registerMessage(MSGID_PROCESSING_OPERATION, |
| | |
| | | registerMessage(MSGID_VERIFYINDEX_VERIFY_CLEAN_REQUIRES_SINGLE_INDEX, |
| | | "Only one index at a time may be verified for " + |
| | | "cleanliness."); |
| | | registerMessage(MSGID_VERIFYINDEX_WRONG_BACKEND_TYPE, |
| | | registerMessage(MSGID_BACKEND_NO_INDEXING_SUPPORT, |
| | | "The backend does not support indexing."); |
| | | registerMessage(MSGID_VERIFYINDEX_DESCRIPTION_CONFIG_CLASS, |
| | | "Specifies the fully-qualified name of the Java class " + |
| | | "that serves as the configuration handler for the " + |
| | | "Directory Server."); |
| | | registerMessage(MSGID_VERIFYINDEX_DESCRIPTION_CONFIG_FILE, |
| | | "Specifies the path to the Directory Server " + |
| | | "configuration file."); |
| | | registerMessage(MSGID_VERIFYINDEX_DESCRIPTION_USAGE, |
| | | "Displays this usage information."); |
| | | registerMessage(MSGID_VERIFYINDEX_CANNOT_INITIALIZE_ARGS, |
| | | "An unexpected error occurred while attempting to " + |
| | | "initialize the command-line arguments: %s."); |
| | | registerMessage(MSGID_VERIFYINDEX_ERROR_PARSING_ARGS, |
| | | "An error occurred while parsing the command-line " + |
| | | "arguments: %s."); |
| | | registerMessage(MSGID_VERIFYINDEX_SERVER_BOOTSTRAP_ERROR, |
| | | "An unexpected error occurred while attempting to " + |
| | | "bootstrap the Directory Server client-side code: %s."); |
| | | registerMessage(MSGID_VERIFYINDEX_CANNOT_LOAD_CONFIG, |
| | | "An error occurred while trying to load the Directory " + |
| | | "Server configuration: %s."); |
| | | registerMessage(MSGID_VERIFYINDEX_CANNOT_LOAD_SCHEMA, |
| | | "An error occurred while trying to load the Directory " + |
| | | "Server schema: %s."); |
| | | registerMessage(MSGID_VERIFYINDEX_CANNOT_INITIALIZE_CORE_CONFIG, |
| | | "An error occurred while trying to initialize the core " + |
| | | "Directory Server configuration: %s."); |
| | | registerMessage(MSGID_VERIFYINDEX_CANNOT_LOCK_BACKEND, |
| | | "An error occurred while attempting to acquire a shared " + |
| | | "lock for backend %s: %s. This generally means that " + |
| | |
| | | "shared lock for backend %s: %s. This lock should " + |
| | | "automatically be cleared when the verification process " + |
| | | "exits, so no further action should be required."); |
| | | registerMessage(MSGID_VERIFYINDEX_CANNOT_DECODE_BASE_DN, |
| | | "Unable to decode base DN string \"%s\" as a valid " + |
| | | "distinguished name: %s."); |
| | | registerMessage(MSGID_VERIFYINDEX_MULTIPLE_BACKENDS_FOR_BASE, |
| | | registerMessage(MSGID_MULTIPLE_BACKENDS_FOR_BASE, |
| | | "Multiple Directory Server backends are configured to " + |
| | | "support base DN \"%s\"."); |
| | | registerMessage(MSGID_VERIFYINDEX_NO_BACKENDS_FOR_BASE, |
| | | registerMessage(MSGID_NO_BACKENDS_FOR_BASE, |
| | | "None of the Directory Server backends are configured " + |
| | | "to support the requested base DN \"%s\"."); |
| | | registerMessage(MSGID_VERIFYINDEX_CANNOT_DECODE_BACKEND_BASE_DN, |
| | | "Unable to decode the backend configuration base DN " + |
| | | "string \"%s\" as a valid DN: %s."); |
| | | registerMessage(MSGID_VERIFYINDEX_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY, |
| | | "Unable to retrieve the backend configuration base entry " + |
| | | "\"%s\" from the server configuration: %s."); |
| | | registerMessage(MSGID_VERIFYINDEX_CANNOT_DETERMINE_BACKEND_CLASS, |
| | | "Cannot determine the name of the Java class providing " + |
| | | "the logic for the backend defined in configuration " + |
| | | "entry %s: %s."); |
| | | registerMessage(MSGID_VERIFYINDEX_CANNOT_LOAD_BACKEND_CLASS, |
| | | "Unable to load class %s referenced in configuration " + |
| | | "entry %s for use as a Directory Server backend: %s."); |
| | | registerMessage(MSGID_VERIFYINDEX_CANNOT_INSTANTIATE_BACKEND_CLASS, |
| | | "Unable to create an instance of class %s referenced in " + |
| | | "configuration entry %s as a Directory Server backend: " + |
| | | "%s."); |
| | | registerMessage(MSGID_VERIFYINDEX_NO_BASES_FOR_BACKEND, |
| | | "No base DNs have been defined in backend configuration " + |
| | | "entry %s. This backend will not be evaluated in the " + |
| | | "data verification process."); |
| | | registerMessage(MSGID_VERIFYINDEX_CANNOT_DETERMINE_BASES_FOR_BACKEND, |
| | | "Unable to determine the set of base DNs defined in " + |
| | | "backend configuration entry %s: %s."); |
| | | |
| | | registerMessage(MSGID_REBUILDINDEX_TOOL_DESCRIPTION, |
| | | "This utility may be used to rebuild index data within " + |
| | | "a backend based on the Berkeley DB Java Edition."); |
| | | registerMessage(MSGID_REBUILDINDEX_DESCRIPTION_BASE_DN, |
| | | "Specifies the base DN of a backend supporting indexing. " + |
| | | "Rebuild is performed on indexes within the scope " + |
| | | "of the given base DN."); |
| | | registerMessage(MSGID_REBUILDINDEX_DESCRIPTION_INDEX_NAME, |
| | | "Specifies the names of index(es) to rebuild. For an " + |
| | | "attribute index this is simply an attribute name. " + |
| | | "At least one index must be specified for rebuild."); |
| | | registerMessage(MSGID_REBUILDINDEX_ERROR_DURING_REBUILD, |
| | | "An error occurred while attempting to perform index " + |
| | | "rebuild: %s."); |
| | | registerMessage(MSGID_REBUILDINDEX_WRONG_BACKEND_TYPE, |
| | | "The backend does not support rebuilding of indexes."); |
| | | registerMessage(MSGID_REBUILDINDEX_REQUIRES_AT_LEAST_ONE_INDEX, |
| | | "At least one index must be spcified for the rebuild " + |
| | | "process."); |
| | | |
| | | registerMessage(MSGID_BACKUPDB_DESCRIPTION_CONFIG_CLASS, |
| | | "Specifies the fully-qualified name of the Java class " + |
| | | "that serves as the configuration handler for the " + |
| | | "Directory Server."); |
| | | registerMessage(MSGID_BACKUPDB_DESCRIPTION_CONFIG_FILE, |
| | | "Specifies the path to the Directory Server " + |
| | | "configuration file."); |
| | | registerMessage(MSGID_BACKUPDB_DESCRIPTION_BACKEND_ID, |
| | | "Backend ID for the backend to archive"); |
| | | registerMessage(MSGID_BACKUPDB_DESCRIPTION_BACKUP_ALL, |
| | |
| | | "Generate a hash of the backup contents"); |
| | | registerMessage(MSGID_BACKUPDB_DESCRIPTION_SIGN_HASH, |
| | | "Sign the hash of the backup contents"); |
| | | registerMessage(MSGID_BACKUPDB_DESCRIPTION_USAGE, |
| | | "Display this usage information."); |
| | | registerMessage(MSGID_BACKUPDB_CANNOT_INITIALIZE_ARGS, |
| | | "An unexpected error occurred while attempting to " + |
| | | "initialize the command-line arguments: %s."); |
| | | registerMessage(MSGID_BACKUPDB_ERROR_PARSING_ARGS, |
| | | "An error occurred while parsing the command-line " + |
| | | "arguments: %s."); |
| | | registerMessage(MSGID_BACKUPDB_SERVER_BOOTSTRAP_ERROR, |
| | | "An unexpected error occurred while attempting to " + |
| | | "bootstrap the Directory Server client-side code: %s."); |
| | | registerMessage(MSGID_BACKUPDB_CANNOT_LOAD_CONFIG, |
| | | "An error occurred while trying to load the Directory " + |
| | | "Server configuration: %s."); |
| | | registerMessage(MSGID_BACKUPDB_CANNOT_LOAD_SCHEMA, |
| | | "An error occurred while trying to load the Directory " + |
| | | "Server schema: %s."); |
| | | registerMessage(MSGID_BACKUPDB_CANNOT_INITIALIZE_CORE_CONFIG, |
| | | "An error occurred while trying to initialize the core " + |
| | | "Directory Server configuration: %s."); |
| | | registerMessage(MSGID_BACKUPDB_CANNOT_INITIALIZE_CRYPTO_MANAGER, |
| | | "An error occurred while attempting to initialize the " + |
| | | "crypto manager: %s."); |
| | | registerMessage(MSGID_BACKUPDB_MULTIPLE_BACKENDS_FOR_ID, |
| | | "Multiple Directory Server backends are configured with " + |
| | | "the requested backend ID \"%s\"."); |
| | |
| | | registerMessage(MSGID_BACKUPDB_ERROR_DURING_BACKUP, |
| | | "An error occurred while attempting to back up backend " + |
| | | "%s with the requested configuration: %s."); |
| | | registerMessage(MSGID_BACKUPDB_CANNOT_DECODE_BACKEND_BASE_DN, |
| | | "Unable to decode the backend configuration base DN " + |
| | | "string \"%s\" as a valid DN: %s."); |
| | | registerMessage(MSGID_BACKUPDB_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY, |
| | | "Unable to retrieve the backend configuration base entry " + |
| | | "\"%s\" from the server configuration: %s."); |
| | | registerMessage(MSGID_BACKUPDB_CANNOT_DETERMINE_BACKEND_CLASS, |
| | | "Cannot determine the name of the Java class providing " + |
| | | "the logic for the backend defined in configuration " + |
| | | "entry %s: %s."); |
| | | registerMessage(MSGID_BACKUPDB_CANNOT_LOAD_BACKEND_CLASS, |
| | | "Unable to load class %s referenced in configuration " + |
| | | "entry %s for use as a Directory Server backend: %s."); |
| | | registerMessage(MSGID_BACKUPDB_CANNOT_INSTANTIATE_BACKEND_CLASS, |
| | | "Unable to create an instance of class %s referenced in " + |
| | | "configuration entry %s as a Directory Server backend: " + |
| | | "%s."); |
| | | registerMessage(MSGID_BACKUPDB_NO_BASES_FOR_BACKEND, |
| | | "No base DNs have been defined in backend configuration " + |
| | | "entry %s. This backend will not be evaluated in the " + |
| | | "LDIF export process."); |
| | | registerMessage(MSGID_BACKUPDB_CANNOT_DETERMINE_BASES_FOR_BACKEND, |
| | | "Unable to determine the set of base DNs defined in " + |
| | | "backend configuration entry %s: %s."); |
| | | registerMessage(MSGID_BACKUPDB_CANNOT_DETERMINE_BACKEND_ID, |
| | | "Cannot determine the backend ID for the backend defined " + |
| | | "in configuration entry %s: %s."); |
| | | registerMessage(MSGID_BACKUPDB_CANNOT_MIX_BACKUP_ALL_AND_BACKEND_ID, |
| | | "The %s and %s arguments may not be used together. " + |
| | | "Exactly one of them must be provided."); |
| | |
| | | "argument is also provided."); |
| | | |
| | | |
| | | registerMessage(MSGID_RESTOREDB_DESCRIPTION_CONFIG_CLASS, |
| | | "Specifies the fully-qualified name of the Java class " + |
| | | "that serves as the configuration handler for the " + |
| | | "Directory Server."); |
| | | registerMessage(MSGID_RESTOREDB_DESCRIPTION_CONFIG_FILE, |
| | | "Specifies the path to the Directory Server " + |
| | | "configuration file."); |
| | | registerMessage(MSGID_RESTOREDB_DESCRIPTION_BACKEND_ID, |
| | | "Backend ID for the backend to restore"); |
| | | registerMessage(MSGID_RESTOREDB_DESCRIPTION_BACKUP_ID, |
| | |
| | | "List available backups in the backup directory"); |
| | | registerMessage(MSGID_RESTOREDB_DESCRIPTION_VERIFY_ONLY, |
| | | "Verify the contents of the backup but do not restore it"); |
| | | registerMessage(MSGID_RESTOREDB_DESCRIPTION_USAGE, |
| | | "Display this usage information."); |
| | | registerMessage(MSGID_RESTOREDB_CANNOT_INITIALIZE_ARGS, |
| | | "An unexpected error occurred while attempting to " + |
| | | "initialize the command-line arguments: %s."); |
| | | registerMessage(MSGID_RESTOREDB_ERROR_PARSING_ARGS, |
| | | "An error occurred while parsing the command-line " + |
| | | "arguments: %s."); |
| | | registerMessage(MSGID_RESTOREDB_SERVER_BOOTSTRAP_ERROR, |
| | | "An unexpected error occurred while attempting to " + |
| | | "bootstrap the Directory Server client-side code: %s."); |
| | | registerMessage(MSGID_RESTOREDB_CANNOT_LOAD_CONFIG, |
| | | "An error occurred while trying to load the Directory " + |
| | | "Server configuration: %s."); |
| | | registerMessage(MSGID_RESTOREDB_CANNOT_LOAD_SCHEMA, |
| | | "An error occurred while trying to load the Directory " + |
| | | "Server schema: %s."); |
| | | registerMessage(MSGID_RESTOREDB_CANNOT_INITIALIZE_CORE_CONFIG, |
| | | "An error occurred while trying to initialize the core " + |
| | | "Directory Server configuration: %s."); |
| | | registerMessage(MSGID_RESTOREDB_CANNOT_INITIALIZE_CRYPTO_MANAGER, |
| | | "An error occurred while attempting to initialize the " + |
| | | "crypto manager: %s."); |
| | | registerMessage(MSGID_RESTOREDB_CANNOT_READ_BACKUP_DIRECTORY, |
| | | "An error occurred while attempting to examine the " + |
| | | "set of backups contained in backup directory %s: %s."); |
| | |
| | | "exclusive lock for backend %s: %s. This lock should " + |
| | | "automatically be cleared when the restore process " + |
| | | "exits, so no further action should be required."); |
| | | registerMessage(MSGID_RESTOREDB_CANNOT_DECODE_BACKEND_BASE_DN, |
| | | "Unable to decode the backend configuration base DN " + |
| | | "string \"%s\" as a valid DN: %s."); |
| | | registerMessage(MSGID_RESTOREDB_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY, |
| | | "Unable to retrieve the backend configuration base entry " + |
| | | "\"%s\" from the server configuration: %s."); |
| | | registerMessage(MSGID_RESTOREDB_CANNOT_DETERMINE_BACKEND_CLASS, |
| | | "Cannot determine the name of the Java class providing " + |
| | | "the logic for the backend defined in configuration " + |
| | | "entry %s: %s."); |
| | | registerMessage(MSGID_RESTOREDB_CANNOT_LOAD_BACKEND_CLASS, |
| | | "Unable to load class %s referenced in configuration " + |
| | | "entry %s for use as a Directory Server backend: %s."); |
| | | registerMessage(MSGID_RESTOREDB_CANNOT_INSTANTIATE_BACKEND_CLASS, |
| | | "Unable to create an instance of class %s referenced in " + |
| | | "configuration entry %s as a Directory Server backend: " + |
| | | "%s."); |
| | | registerMessage(MSGID_RESTOREDB_NO_BASES_FOR_BACKEND, |
| | | "No base DNs have been defined in backend configuration " + |
| | | "entry %s. This backend will not be evaluated in the " + |
| | | "LDIF export process."); |
| | | registerMessage(MSGID_RESTOREDB_CANNOT_DETERMINE_BASES_FOR_BACKEND, |
| | | "Unable to determine the set of base DNs defined in " + |
| | | "backend configuration entry %s: %s."); |
| | | registerMessage(MSGID_RESTOREDB_CANNOT_DETERMINE_BACKEND_ID, |
| | | "Cannot determine the backend ID for the backend defined " + |
| | | "in configuration entry %s: %s."); |
| | | registerMessage(MSGID_DESCRIPTION_NOOP, |
| | | "Show what would be done but do not perform any operation"); |
| | | registerMessage(MSGID_DESCRIPTION_TYPES_ONLY, |
| | |
| | | "Certificate trust store PIN file"); |
| | | registerMessage(MSGID_STOPDS_DESCRIPTION_SHOWUSAGE, |
| | | "Display this usage information."); |
| | | registerMessage(MSGID_STOPDS_CANNOT_INITIALIZE_ARGS, |
| | | "An unexpected error occurred while attempting to " + |
| | | "initialize the command-line arguments: %s."); |
| | | registerMessage(MSGID_STOPDS_ERROR_PARSING_ARGS, |
| | | "An error occurred while parsing the command-line " + |
| | | "arguments: %s."); |
| | | registerMessage(MSGID_STOPDS_MUTUALLY_EXCLUSIVE_ARGUMENTS, |
| | | "ERROR: You may not provide both the %s and the %s " + |
| | | "arguments."); |
| | |
| | | "The scope for the search. It must be one of 'base', " + |
| | | "'one', 'sub', or 'subordinate'. If it is not provided, " + |
| | | "then 'sub' will be used."); |
| | | registerMessage(MSGID_LDIFSEARCH_DESCRIPTION_CONFIG_FILE, |
| | | "The path to the Directory Server configuration file, " + |
| | | "which will enable the use of the schema definitions " + |
| | | "when processing the searches. If it is not provided, " + |
| | | "then schema processing will not be available."); |
| | | registerMessage(MSGID_LDIFSEARCH_DESCRIPTION_CONFIG_CLASS, |
| | | "The fully-qualified name of the Java class to use as " + |
| | | "the Directory Server configuration handler. If this is " + |
| | | "not provided, then a default of " + |
| | | ConfigFileHandler.class.getName() + " will be used."); |
| | | registerMessage(MSGID_LDIFSEARCH_DESCRIPTION_FILTER_FILE, |
| | | "The path to the file containing the search filter(s) " + |
| | | "to use. If this is not provided, then the filter must " + |
| | |
| | | registerMessage(MSGID_LDIFSEARCH_DESCRIPTION_TIME_LIMIT, |
| | | "Specifies the maximum length of time (in seconds) to " + |
| | | "spend processing."); |
| | | registerMessage(MSGID_LDIFSEARCH_DESCRIPTION_USAGE, |
| | | "Displays usage information for this program."); |
| | | registerMessage(MSGID_LDIFSEARCH_CANNOT_INITIALIZE_ARGS, |
| | | "An unexpected error occurred while attempting to " + |
| | | "initialize the command-line arguments: %s."); |
| | | registerMessage(MSGID_LDIFSEARCH_ERROR_PARSING_ARGS, |
| | | "An error occurred while parsing the command-line " + |
| | | "arguments: %s."); |
| | | registerMessage(MSGID_LDIFSEARCH_NO_FILTER, |
| | | "No search filter was specified. Either a filter file " + |
| | | "or an individual search filter must be provided."); |
| | |
| | | registerMessage(MSGID_LDIFDIFF_DESCRIPTION_OVERWRITE_EXISTING, |
| | | "Indicates that any existing output file should be " + |
| | | "overwritten rather than appending to it."); |
| | | registerMessage(MSGID_LDIFDIFF_DESCRIPTION_CONFIG_FILE, |
| | | "The path to the Directory Server configuration file, " + |
| | | "which will enable the use of the schema definitions " + |
| | | "when processing the LDIF data. If it is not provided, " + |
| | | "then schema processing will not be available."); |
| | | registerMessage(MSGID_LDIFDIFF_DESCRIPTION_CONFIG_CLASS, |
| | | "The fully-qualified name of the Java class to use as " + |
| | | "the Directory Server configuration handler. If this is " + |
| | | "not provided, then a default of " + |
| | | ConfigFileHandler.class.getName() + " will be used."); |
| | | registerMessage(MSGID_LDIFDIFF_DESCRIPTION_USAGE, |
| | | "Display this usage information."); |
| | | registerMessage(MSGID_LDIFDIFF_CANNOT_INITIALIZE_ARGS, |
| | | "An unexpected error occurred while attempting to " + |
| | | "initialize the command-line arguments: %s."); |
| | | registerMessage(MSGID_LDIFDIFF_ERROR_PARSING_ARGS, |
| | | "An error occurred while parsing the command-line " + |
| | | "arguments: %s."); |
| | | registerMessage(MSGID_LDIFDIFF_CANNOT_INITIALIZE_JMX, |
| | | "An error occurred while attempting to initialize the " + |
| | | "Directory Server JMX subsystem based on the information " + |
| | |
| | | "output: %s."); |
| | | |
| | | |
| | | registerMessage(MSGID_CONFIGDS_DESCRIPTION_CONFIG_FILE, |
| | | "The path to the Directory Server configuration file."); |
| | | registerMessage(MSGID_CONFIGDS_DESCRIPTION_CONFIG_CLASS, |
| | | "The fully-qualified name of the Java class to use as " + |
| | | "the Directory Server configuration handler. If this is " + |
| | | "not provided, then a default of " + |
| | | ConfigFileHandler.class.getName() + " will be used."); |
| | | registerMessage(MSGID_CONFIGDS_DESCRIPTION_LDAP_PORT, |
| | | "Specifies the port on which the Directory Server should " + |
| | | "listen for LDAP communication."); |
| | |
| | | registerMessage(MSGID_CONFIGDS_DESCRIPTION_ROOT_PW_FILE, |
| | | "Specifies the path to a file containing the password " + |
| | | "for the initial root user for the Directory Server."); |
| | | registerMessage(MSGID_CONFIGDS_DESCRIPTION_USAGE, |
| | | "Display this usage information."); |
| | | registerMessage(MSGID_CONFIGDS_CANNOT_INITIALIZE_ARGS, |
| | | "An unexpected error occurred while attempting to " + |
| | | "initialize the command-line arguments: %s."); |
| | | registerMessage(MSGID_CONFIGDS_ERROR_PARSING_ARGS, |
| | | "An error occurred while parsing the command-line " + |
| | | "arguments: %s."); |
| | | registerMessage(MSGID_CONFIGDS_CANNOT_ACQUIRE_SERVER_LOCK, |
| | | "An error occurred while attempting to acquire the " + |
| | | "server-wide lock file %s: %s. This generally means " + |
| | |
| | | "Just verify that the JVM can be started properly."); |
| | | registerMessage(MSGID_INSTALLDS_DESCRIPTION_PROGNAME, |
| | | "The setup command used to invoke this program."); |
| | | registerMessage(MSGID_INSTALLDS_DESCRIPTION_CONFIG_FILE, |
| | | "The path to the Directory Server configuration file."); |
| | | registerMessage(MSGID_INSTALLDS_DESCRIPTION_CONFIG_CLASS, |
| | | "The fully-qualified name of the Java class to use as " + |
| | | "the Directory Server configuration handler. If this is " + |
| | | "not provided, then a default of " + |
| | | ConfigFileHandler.class.getName() + " will be used."); |
| | | registerMessage(MSGID_INSTALLDS_DESCRIPTION_CLI, |
| | | "Launch the installer in command-line mode (no GUI)."); |
| | | registerMessage(MSGID_INSTALLDS_DESCRIPTION_SILENT, |
| | |
| | | registerMessage(MSGID_MAKELDIF_TAG_NOT_ALLOWED_IN_BRANCH, |
| | | "Tag %s referenced on line %d of the template file is " + |
| | | "not allowed for use in branch definitions."); |
| | | registerMessage(MSGID_MAKELDIF_DESCRIPTION_CONFIG_FILE, |
| | | "The path to the Directory Server configuration file."); |
| | | registerMessage(MSGID_MAKELDIF_DESCRIPTION_CONFIG_CLASS, |
| | | "The fully-qualified name of the Java class to use as " + |
| | | "the Directory Server configuration handler. If this is " + |
| | | "not provided, then a default of " + |
| | | ConfigFileHandler.class.getName() + " will be used."); |
| | | registerMessage(MSGID_MAKELDIF_DESCRIPTION_RESOURCE_PATH, |
| | | "Specifies the path to look for MakeLDIF resources " + |
| | | "(e.g., data files) not found in the current working " + |
| | |
| | | "The seed to use to initialize the random number " + |
| | | "generator."); |
| | | registerMessage(MSGID_MAKELDIF_DESCRIPTION_HELP, |
| | | "Display this usage information."); |
| | | registerMessage(MSGID_MAKELDIF_CANNOT_INITIALIZE_ARGS, |
| | | "An unexpected error occurred while attempting to " + |
| | | "initialize the command-line arguments: %s."); |
| | | registerMessage(MSGID_MAKELDIF_ERROR_PARSING_ARGS, |
| | | "An error occurred while parsing the command-line " + |
| | | "arguments: %s."); |
| | | "Show this usage information."); |
| | | registerMessage(MSGID_MAKELDIF_CANNOT_INITIALIZE_JMX, |
| | | "An error occurred while attempting to initialize the " + |
| | | "Directory Server JMX subsystem based on the information " + |
| | |
| | | registerMessage(MSGID_LDIFMODIFY_MODIFY_NO_SUCH_ENTRY, |
| | | "Unable to modify entry %s because it does not exist " + |
| | | "in the data set."); |
| | | registerMessage(MSGID_LDIFMODIFY_DESCRIPTION_CONFIG_FILE, |
| | | "The path to the Directory Server configuration file, " + |
| | | "which will enable the use of the schema definitions " + |
| | | "when processing the updates. If it is not provided, " + |
| | | "then schema processing will not be available."); |
| | | registerMessage(MSGID_LDIFMODIFY_DESCRIPTION_CONFIG_CLASS, |
| | | "The fully-qualified name of the Java class to use as " + |
| | | "the Directory Server configuration handler. If this is " + |
| | | "not provided, then a default of " + |
| | | ConfigFileHandler.class.getName() + " will be used."); |
| | | registerMessage(MSGID_LDIFMODIFY_DESCRIPTION_SOURCE, |
| | | "Specifies the LDIF file containing the data to be " + |
| | | "updated."); |
| | |
| | | "written."); |
| | | registerMessage(MSGID_LDIFMODIFY_DESCRIPTION_HELP, |
| | | "Displays this usage information."); |
| | | registerMessage(MSGID_LDIFMODIFY_CANNOT_INITIALIZE_ARGS, |
| | | "An unexpected error occurred while attempting to " + |
| | | "initialize the command-line arguments: %s."); |
| | | registerMessage(MSGID_LDIFMODIFY_ERROR_PARSING_ARGS, |
| | | "An error occurred while parsing the command-line " + |
| | | "arguments: %s."); |
| | | registerMessage(MSGID_LDIFMODIFY_CANNOT_INITIALIZE_JMX, |
| | | "An error occurred while attempting to initialize the " + |
| | | "Directory Server JMX subsystem based on the information " + |
| | |
| | | registerMessage(MSGID_LDAPPWMOD_DESCRIPTION_TRUSTSTORE_PINFILE, |
| | | "The path to a file containing the PIN needed to access" + |
| | | "the contents of the trust store."); |
| | | registerMessage(MSGID_LDAPPWMOD_DESCRIPTION_USAGE, |
| | | "Display this usage information."); |
| | | registerMessage(MSGID_LDAPPWMOD_CANNOT_INITIALIZE_ARGS, |
| | | "An unexpected error occurred while attempting to " + |
| | | "initialize the command-line arguments: %s."); |
| | | registerMessage(MSGID_LDAPPWMOD_ERROR_PARSING_ARGS, |
| | | "An error occurred while parsing the command-line " + |
| | | "arguments: %s."); |
| | | registerMessage(MSGID_LDAPPWMOD_CONFLICTING_ARGS, |
| | | "The %s and %s arguments may not be provided together."); |
| | | registerMessage(MSGID_LDAPPWMOD_BIND_DN_AND_PW_MUST_BE_TOGETHER, |
| | |
| | | "target file to be deleted before exiting."); |
| | | registerMessage(MSGID_WAIT4DEL_DESCRIPTION_HELP, |
| | | "Displays this usage information."); |
| | | registerMessage(MSGID_WAIT4DEL_CANNOT_INITIALIZE_ARGS, |
| | | "An unexpected error occurred while attempting to " + |
| | | "initialize the command-line arguments: %s."); |
| | | registerMessage(MSGID_WAIT4DEL_ERROR_PARSING_ARGS, |
| | | "An error occurred while parsing the command-line " + |
| | | "arguments: %s."); |
| | | registerMessage(MSGID_WAIT4DEL_CANNOT_OPEN_LOG_FILE, |
| | | "WARNING: Unable to open log file %s for reading: %s."); |
| | | registerMessage(MSGID_WAIT4DEL_CANNOT_OPEN_OUTPUT_FILE, |
| | |
| | | "DNs configured in the Directory Server."); |
| | | |
| | | |
| | | registerMessage(MSGID_LISTBACKENDS_DESCRIPTION_CONFIG_CLASS, |
| | | "The fully-qualified name of the Java class to use as " + |
| | | "the Directory Server configuration handler. If this is " + |
| | | "not provided, then a default of " + |
| | | ConfigFileHandler.class.getName() + " will be used."); |
| | | registerMessage(MSGID_LISTBACKENDS_DESCRIPTION_CONFIG_FILE, |
| | | "The path to the Directory Server configuration file, " + |
| | | "which will enable the use of the schema definitions " + |
| | | "when processing the updates. If it is not provided, " + |
| | | "then schema processing will not be available."); |
| | | registerMessage(MSGID_LISTBACKENDS_DESCRIPTION_BACKEND_ID, |
| | | "Backend ID of the backend for which to list the base DNs"); |
| | | registerMessage(MSGID_LISTBACKENDS_DESCRIPTION_BASE_DN, |
| | | "Base DN for which to list the backend ID"); |
| | | registerMessage(MSGID_LISTBACKENDS_DESCRIPTION_HELP, |
| | | "Display this usage information."); |
| | | registerMessage(MSGID_LISTBACKENDS_CANNOT_INITIALIZE_ARGS, |
| | | "An unexpected error occurred while attempting to " + |
| | | "initialize the command-line arguments: %s."); |
| | | registerMessage(MSGID_LISTBACKENDS_ERROR_PARSING_ARGS, |
| | | "An error occurred while parsing the command-line " + |
| | | "arguments: %s."); |
| | | registerMessage(MSGID_LISTBACKENDS_SERVER_BOOTSTRAP_ERROR, |
| | | "An unexpected error occurred while attempting to " + |
| | | "bootstrap the Directory Server client-side code: %s."); |
| | | registerMessage(MSGID_LISTBACKENDS_CANNOT_LOAD_CONFIG, |
| | | "An error occurred while trying to load the Directory " + |
| | | "Server configuration: %s."); |
| | | registerMessage(MSGID_LISTBACKENDS_CANNOT_LOAD_SCHEMA, |
| | | "An error occurred while trying to load the Directory " + |
| | | "Server schema: %s."); |
| | | registerMessage(MSGID_LISTBACKENDS_CANNOT_GET_BACKENDS, |
| | | "An error occurred while trying to read backend " + |
| | | "information from the server configuration: %s."); |
| | |
| | | registerMessage(MSGID_LISTBACKENDS_NO_VALID_BACKENDS, |
| | | "None of the provided backend IDs exist in the server " + |
| | | "configuration."); |
| | | registerMessage(MSGID_LISTBACKENDS_CANNOT_DECODE_BACKEND_BASE_DN, |
| | | "Unable to decode the backend configuration base DN " + |
| | | "string \"%s\" as a valid DN: %s."); |
| | | registerMessage(MSGID_LISTBACKENDS_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY, |
| | | "Unable to retrieve the backend configuration base entry " + |
| | | "\"%s\" from the server configuration: %s."); |
| | | registerMessage(MSGID_LISTBACKENDS_CANNOT_DETERMINE_BACKEND_ID, |
| | | "Cannot determine the backend ID for the backend defined " + |
| | | "in configuration entry %s: %s."); |
| | | registerMessage(MSGID_LISTBACKENDS_CANNOT_DETERMINE_BASES_FOR_BACKEND, |
| | | "Unable to determine the set of base DNs defined in " + |
| | | "backend configuration entry %s: %s."); |
| | | |
| | | |
| | | registerMessage(MSGID_PROMPTTM_REJECTING_CLIENT_CERT, |
| | |
| | | "windows registry information associated with the "+ |
| | | "provided service name."); |
| | | |
| | | registerMessage(MSGID_CONFIGURE_WINDOWS_SERVICE_CANNOT_INITIALIZE_ARGS, |
| | | "An unexpected error occurred while attempting to " + |
| | | "initialize the command-line arguments: %s."); |
| | | |
| | | registerMessage(MSGID_CONFIGURE_WINDOWS_SERVICE_ERROR_PARSING_ARGS, |
| | | "An error occurred while parsing the command-line " + |
| | | "arguments: %s."); |
| | | |
| | | registerMessage(MSGID_CONFIGURE_WINDOWS_SERVICE_TOO_MANY_ARGS, |
| | | "You can only provide one of the following arguments:"+ |
| | | EOL+"enableService, disableService, serviceState or "+ |
| | |
| | | |
| | | registerMessage(MSGID_WINDOWS_SERVICE_CLEANUP_MARKED_FOR_DELETION, |
| | | "Service %s has been marked for deletion."); |
| | | |
| | | registerMessage(MSGID_REBUILDINDEX_CANNOT_SHARED_LOCK_BACKEND, |
| | | "An error occurred while attempting to acquire a shared " + |
| | | "lock for backend %s: %s. This generally means that " + |
| | | "some other process has an exclusive lock on this " + |
| | | "backend (e.g., an LDIF import or a restore). The rebuild" + |
| | | "process cannot continue."); |
| | | |
| | | registerMessage(MSGID_REBUILDINDEX_CANNOT_EXCLUSIVE_LOCK_BACKEND, |
| | | "An error occurred while attempting to acquire a " + |
| | | "exclusive lock for backend %s: %s. This generally " + |
| | | "means that some other process has an lock " + |
| | | "on this backend or the server is running with this " + |
| | | "backend online. The rebuild process cannot continue."); |
| | | |
| | | registerMessage(MSGID_REBUILDINDEX_CANNOT_UNLOCK_BACKEND, |
| | | "An error occurred while attempting to release the " + |
| | | "shared lock for backend %s: %s. This lock should " + |
| | | "automatically be cleared when the rebuild process " + |
| | | "exits, so no further action should be required."); |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.tasks; |
| | | |
| | | import org.opends.server.backends.task.Task; |
| | | import org.opends.server.backends.task.TaskState; |
| | | import org.opends.server.backends.jeb.RebuildConfig; |
| | | import org.opends.server.backends.jeb.BackendImpl; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.ErrorLogCategory; |
| | | import org.opends.server.types.ErrorLogSeverity; |
| | | import org.opends.server.types.Privilege; |
| | | import org.opends.server.types.ResultCode; |
| | | import org.opends.server.core.Operation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.LockFileManager; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.config.ConfigEntry; |
| | | |
| | | import static org.opends.server.core.DirectoryServer.getAttributeType; |
| | | import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugCaught; |
| | | import static org.opends.server.messages.TaskMessages. |
| | | MSGID_TASK_INDEXREBUILD_INSUFFICIENT_PRIVILEGES; |
| | | import static org.opends.server.messages.MessageHandler.getMessage; |
| | | import static org.opends.server.messages.ToolMessages. |
| | | MSGID_REBUILDINDEX_ERROR_DURING_REBUILD; |
| | | import static org.opends.server.messages.ToolMessages. |
| | | MSGID_REBUILDINDEX_WRONG_BACKEND_TYPE; |
| | | import static org.opends.server.messages.ToolMessages. |
| | | MSGID_NO_BACKENDS_FOR_BASE; |
| | | import static org.opends.server.messages.ToolMessages. |
| | | MSGID_CANNOT_DECODE_BASE_DN; |
| | | import static org.opends.server.messages.ToolMessages. |
| | | MSGID_REBUILDINDEX_CANNOT_EXCLUSIVE_LOCK_BACKEND; |
| | | import static org.opends.server.messages.ToolMessages. |
| | | MSGID_REBUILDINDEX_CANNOT_SHARED_LOCK_BACKEND; |
| | | import static org.opends.server.messages.ToolMessages. |
| | | MSGID_REBUILDINDEX_CANNOT_UNLOCK_BACKEND; |
| | | import static org.opends.server.config.ConfigConstants. |
| | | ATTR_REBUILD_BASE_DN; |
| | | import static org.opends.server.config.ConfigConstants. |
| | | ATTR_REBUILD_INDEX; |
| | | import static org.opends.server.config.ConfigConstants. |
| | | ATTR_REBUILD_MAX_THREADS; |
| | | |
| | | import java.util.List; |
| | | import java.util.ArrayList; |
| | | |
| | | /** |
| | | * This class provides an implementation of a Directory Server task that can |
| | | * be used to rebuild indexes in the JEB backend.. |
| | | */ |
| | | public class RebuildTask extends Task |
| | | { |
| | | String baseDN = null; |
| | | ArrayList<String> indexes = null; |
| | | int maxThreads = -1; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override public void initializeTask() throws DirectoryException |
| | | { |
| | | // If the client connection is available, then make sure the associated |
| | | // client has the INDEX_REBUILD privilege. |
| | | |
| | | Operation operation = getOperation(); |
| | | if (operation != null) |
| | | { |
| | | ClientConnection clientConnection = operation.getClientConnection(); |
| | | if (! clientConnection.hasPrivilege(Privilege.INDEX_REBUILD, operation)) |
| | | { |
| | | int msgID = MSGID_TASK_INDEXREBUILD_INSUFFICIENT_PRIVILEGES; |
| | | String message = getMessage(msgID); |
| | | throw new DirectoryException(ResultCode.INSUFFICIENT_ACCESS_RIGHTS, |
| | | message, msgID); |
| | | } |
| | | } |
| | | |
| | | |
| | | Entry taskEntry = getTaskEntry(); |
| | | |
| | | AttributeType typeBaseDN; |
| | | AttributeType typeIndex; |
| | | AttributeType typeMaxThreads; |
| | | |
| | | typeBaseDN = |
| | | getAttributeType(ATTR_REBUILD_BASE_DN, true); |
| | | typeIndex = |
| | | getAttributeType(ATTR_REBUILD_INDEX, true); |
| | | typeMaxThreads = |
| | | getAttributeType(ATTR_REBUILD_MAX_THREADS, true); |
| | | |
| | | List<Attribute> attrList; |
| | | |
| | | attrList = taskEntry.getAttribute(typeBaseDN); |
| | | baseDN = TaskUtils.getSingleValueString(attrList); |
| | | |
| | | attrList = taskEntry.getAttribute(typeIndex); |
| | | indexes = TaskUtils.getMultiValueString(attrList); |
| | | |
| | | |
| | | attrList = taskEntry.getAttribute(typeMaxThreads); |
| | | maxThreads = TaskUtils.getSingleValueInteger(attrList, -1); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected TaskState runTask() |
| | | { |
| | | RebuildConfig rebuildConfig = new RebuildConfig(); |
| | | |
| | | try |
| | | { |
| | | rebuildConfig.setBaseDN(DN.decode(baseDN)); |
| | | } |
| | | catch(DirectoryException de) |
| | | { |
| | | int msgID = MSGID_CANNOT_DECODE_BASE_DN; |
| | | String message = getMessage(msgID, baseDN, de.getErrorMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return TaskState.STOPPED_BY_ERROR; |
| | | } |
| | | |
| | | for(String index : indexes) |
| | | { |
| | | rebuildConfig.addRebuildIndex(index); |
| | | } |
| | | |
| | | rebuildConfig.setMaxRebuildThreads(maxThreads); |
| | | |
| | | Backend backend = |
| | | DirectoryServer.getBackendWithBaseDN(rebuildConfig.getBaseDN()); |
| | | |
| | | if(backend == null) |
| | | { |
| | | int msgID = MSGID_NO_BACKENDS_FOR_BASE; |
| | | String message = getMessage(msgID, baseDN); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return TaskState.STOPPED_BY_ERROR; |
| | | } |
| | | |
| | | if (!(backend instanceof BackendImpl)) |
| | | { |
| | | int msgID = MSGID_REBUILDINDEX_WRONG_BACKEND_TYPE; |
| | | String message = getMessage(msgID); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return TaskState.STOPPED_BY_ERROR; |
| | | } |
| | | |
| | | // Get the config entry for this backend. |
| | | ConfigEntry configEntry = TaskUtils.getConfigEntry(backend); |
| | | DN[] baseDNs = backend.getBaseDNs(); |
| | | |
| | | // Acquire a shared lock for the backend if we are rebuilding attribute |
| | | // indexes only. If we are rebuilding one or more system indexes, we have |
| | | // to aquire exclusive lock. |
| | | String lockFile = LockFileManager.getBackendLockFileName(backend); |
| | | StringBuilder failureReason = new StringBuilder(); |
| | | if(rebuildConfig.includesSystemIndex()) |
| | | { |
| | | // Disable the backend. |
| | | try |
| | | { |
| | | TaskUtils.setBackendEnabled(configEntry, false); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | e.getErrorMessage(), e.getErrorMessageID()); |
| | | return TaskState.STOPPED_BY_ERROR; |
| | | } |
| | | |
| | | try |
| | | { |
| | | if(! LockFileManager.acquireExclusiveLock(lockFile, failureReason)) |
| | | { |
| | | int msgID = MSGID_REBUILDINDEX_CANNOT_EXCLUSIVE_LOCK_BACKEND; |
| | | String message = getMessage(msgID, backend.getBackendID(), |
| | | String.valueOf(failureReason)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return TaskState.STOPPED_BY_ERROR; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_REBUILDINDEX_CANNOT_EXCLUSIVE_LOCK_BACKEND; |
| | | String message = getMessage(msgID, backend.getBackendID(), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return TaskState.STOPPED_BY_ERROR; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | try |
| | | { |
| | | if(! LockFileManager.acquireSharedLock(lockFile, failureReason)) |
| | | { |
| | | int msgID = MSGID_REBUILDINDEX_CANNOT_SHARED_LOCK_BACKEND; |
| | | String message = getMessage(msgID, backend.getBackendID(), |
| | | String.valueOf(failureReason)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return TaskState.STOPPED_BY_ERROR; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_REBUILDINDEX_CANNOT_SHARED_LOCK_BACKEND; |
| | | String message = getMessage(msgID, backend.getBackendID(), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return TaskState.STOPPED_BY_ERROR; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | // Launch the rebuild process. |
| | | try |
| | | { |
| | | BackendImpl jebBackend = (BackendImpl)backend; |
| | | jebBackend.rebuildBackend(rebuildConfig, configEntry, baseDNs); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_REBUILDINDEX_ERROR_DURING_REBUILD; |
| | | String message = getMessage(msgID, e.getMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return TaskState.STOPPED_BY_ERROR; |
| | | } |
| | | |
| | | // Release the lock on the backend. |
| | | try |
| | | { |
| | | lockFile = LockFileManager.getBackendLockFileName(backend); |
| | | failureReason = new StringBuilder(); |
| | | if (! LockFileManager.releaseLock(lockFile, failureReason)) |
| | | { |
| | | int msgID = MSGID_REBUILDINDEX_CANNOT_UNLOCK_BACKEND; |
| | | String message = getMessage(msgID, backend.getBackendID(), |
| | | String.valueOf(failureReason)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_WARNING, |
| | | message, msgID); |
| | | return TaskState.COMPLETED_WITH_ERRORS; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_REBUILDINDEX_CANNOT_UNLOCK_BACKEND; |
| | | String message = getMessage(msgID, backend.getBackendID(), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_WARNING, |
| | | message, msgID); |
| | | return TaskState.COMPLETED_WITH_ERRORS; |
| | | } |
| | | |
| | | if(rebuildConfig.includesSystemIndex()) |
| | | { |
| | | // Enable the backend. |
| | | try |
| | | { |
| | | TaskUtils.setBackendEnabled(configEntry, true); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | e.getErrorMessage(), e.getErrorMessageID()); |
| | | return TaskState.STOPPED_BY_ERROR; |
| | | } |
| | | } |
| | | |
| | | return TaskState.COMPLETED_SUCCESSFULLY; |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_DETERMINE_BACKEND_ID; |
| | | int msgID = MSGID_CANNOT_DETERMINE_BACKEND_ID; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | ce.getMessage()); |
| | | Error.logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_DETERMINE_BACKEND_ID; |
| | | int msgID = MSGID_CANNOT_DETERMINE_BACKEND_ID; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | Error.logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | int msgID = MSGID_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, de.getErrorMessage()); |
| | | Error.logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | int msgID = MSGID_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, |
| | | stackTraceToSingleLineString(e)); |
| | | Error.logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | int msgID = MSGID_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, ce.getMessage()); |
| | | Error.logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | int msgID = MSGID_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, |
| | | stackTraceToSingleLineString(e)); |
| | | Error.logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_DETERMINE_BACKEND_ID; |
| | | int msgID = MSGID_CANNOT_DETERMINE_BACKEND_ID; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | ce.getMessage()); |
| | | Error.logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_DETERMINE_BACKEND_ID; |
| | | int msgID = MSGID_CANNOT_DETERMINE_BACKEND_ID; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | Error.logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | |
| | | OPTION_LONG_CONFIG_CLASS, true, false, |
| | | true, OPTION_VALUE_CONFIG_CLASS, |
| | | ConfigFileHandler.class.getName(), null, |
| | | MSGID_BACKUPDB_DESCRIPTION_CONFIG_CLASS); |
| | | MSGID_DESCRIPTION_CONFIG_CLASS); |
| | | configClass.setHidden(true); |
| | | argParser.addArgument(configClass); |
| | | |
| | |
| | | configFile = |
| | | new StringArgument("configfile", 'f', "configFile", true, false, |
| | | true, "{configFile}", null, null, |
| | | MSGID_BACKUPDB_DESCRIPTION_CONFIG_FILE); |
| | | MSGID_DESCRIPTION_CONFIG_FILE); |
| | | configFile.setHidden(true); |
| | | argParser.addArgument(configFile); |
| | | |
| | |
| | | displayUsage = |
| | | new BooleanArgument("help", OPTION_SHORT_HELP, |
| | | OPTION_LONG_HELP, |
| | | MSGID_BACKUPDB_DESCRIPTION_USAGE); |
| | | MSGID_DESCRIPTION_USAGE); |
| | | argParser.addArgument(displayUsage); |
| | | argParser.setUsageArgument(displayUsage); |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_SERVER_BOOTSTRAP_ERROR; |
| | | int msgID = MSGID_SERVER_BOOTSTRAP_ERROR; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_LOAD_CONFIG; |
| | | int msgID = MSGID_CANNOT_LOAD_CONFIG; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_LOAD_CONFIG; |
| | | int msgID = MSGID_CANNOT_LOAD_CONFIG; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | int msgID = MSGID_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, de.getErrorMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | int msgID = MSGID_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | int msgID = MSGID_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, ce.getMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | int msgID = MSGID_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_DETERMINE_BACKEND_ID; |
| | | int msgID = MSGID_CANNOT_DETERMINE_BACKEND_ID; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | ce.getMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_DETERMINE_BACKEND_ID; |
| | | int msgID = MSGID_CANNOT_DETERMINE_BACKEND_ID; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_DETERMINE_BACKEND_CLASS; |
| | | int msgID = MSGID_CANNOT_DETERMINE_BACKEND_CLASS; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | ce.getMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_DETERMINE_BACKEND_CLASS; |
| | | int msgID = MSGID_CANNOT_DETERMINE_BACKEND_CLASS; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_LOAD_BACKEND_CLASS; |
| | | int msgID = MSGID_CANNOT_LOAD_BACKEND_CLASS; |
| | | String message = getMessage(msgID, backendClassName, |
| | | String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_INSTANTIATE_BACKEND_CLASS; |
| | | int msgID = MSGID_CANNOT_INSTANTIATE_BACKEND_CLASS; |
| | | String message = getMessage(msgID, backendClassName, |
| | | String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | |
| | | (DNConfigAttribute) configEntry.getConfigAttribute(baseDNStub); |
| | | if (baseDNAttr == null) |
| | | { |
| | | msgID = MSGID_BACKUPDB_NO_BASES_FOR_BACKEND; |
| | | msgID = MSGID_NO_BASES_FOR_BACKEND; |
| | | String message = getMessage(msgID, |
| | | String.valueOf(configEntry.getDN())); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_BACKUPDB_CANNOT_DETERMINE_BASES_FOR_BACKEND; |
| | | int msgID = MSGID_CANNOT_DETERMINE_BASES_FOR_BACKEND; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.config.ConfigEntry; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.config.StringConfigAttribute; |
| | | import org.opends.server.config.DNConfigAttribute; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.ErrorLogCategory; |
| | | import org.opends.server.types.ErrorLogSeverity; |
| | | import org.opends.server.core.DirectoryServer; |
| | | |
| | | import static org.opends.server.config.ConfigConstants.DN_BACKEND_BASE; |
| | | import static org.opends.server.config.ConfigConstants.ATTR_BACKEND_ID; |
| | | import static org.opends.server.config.ConfigConstants.ATTR_BACKEND_CLASS; |
| | | import static org.opends.server.config.ConfigConstants.ATTR_BACKEND_BASE_DN; |
| | | import static org.opends.server.messages.ToolMessages. |
| | | MSGID_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | import static org.opends.server.messages.ToolMessages. |
| | | MSGID_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | import static org.opends.server.messages.ToolMessages. |
| | | MSGID_CANNOT_DETERMINE_BACKEND_ID; |
| | | import static org.opends.server.messages.ToolMessages. |
| | | MSGID_CANNOT_DETERMINE_BACKEND_CLASS; |
| | | import static org.opends.server.messages.ToolMessages. |
| | | MSGID_CANNOT_LOAD_BACKEND_CLASS; |
| | | import static org.opends.server.messages.ToolMessages. |
| | | MSGID_CANNOT_INSTANTIATE_BACKEND_CLASS; |
| | | import static org.opends.server.messages.ToolMessages. |
| | | MSGID_NO_BASES_FOR_BACKEND; |
| | | import static org.opends.server.messages.ToolMessages. |
| | | MSGID_CANNOT_DETERMINE_BASES_FOR_BACKEND; |
| | | import static org.opends.server.messages.MessageHandler.getMessage; |
| | | import static org.opends.server.messages.ConfigMessages. |
| | | MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_BACKEND_ID; |
| | | import static org.opends.server.messages.ConfigMessages. |
| | | MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_CLASS; |
| | | import static org.opends.server.messages.ConfigMessages. |
| | | MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_BASE_DNS; |
| | | import static org.opends.server.loggers.Error.logError; |
| | | import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * This class provides utility functions for all JE related client tools. |
| | | */ |
| | | public class BackendToolUtils |
| | | { |
| | | /** |
| | | * Retrieves information about the backends defined in the Directory Server |
| | | * configuration. |
| | | * |
| | | * @param backendList A list into which instantiated (but not initialized) |
| | | * backend instances will be placed. |
| | | * @param entryList A list into which the config entries associated with |
| | | * the backends will be placed. |
| | | * @param dnList A list into which the set of base DNs for each backend |
| | | * will be placed. |
| | | * |
| | | * @return 0 if everything went fine. 1 if an error occurred. |
| | | * |
| | | */ |
| | | public static int getBackends(ArrayList<Backend> backendList, |
| | | ArrayList<ConfigEntry> entryList, |
| | | ArrayList<List<DN>> dnList) |
| | | { |
| | | // Get the base entry for all backend configuration. |
| | | DN backendBaseDN = null; |
| | | try |
| | | { |
| | | backendBaseDN = DN.decode(DN_BACKEND_BASE); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | int msgID = MSGID_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, de.getErrorMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | return 1; |
| | | } |
| | | |
| | | ConfigEntry baseEntry = null; |
| | | try |
| | | { |
| | | baseEntry = DirectoryServer.getConfigEntry(backendBaseDN); |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, ce.getMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | // Iterate through the immediate children, attempting to parse them as |
| | | // backends. |
| | | for (ConfigEntry configEntry : baseEntry.getChildren().values()) |
| | | { |
| | | // Get the backend ID attribute from the entry. If there isn't one, then |
| | | // skip the entry. |
| | | String backendID = null; |
| | | try |
| | | { |
| | | int msgID = MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_BACKEND_ID; |
| | | StringConfigAttribute idStub = |
| | | new StringConfigAttribute(ATTR_BACKEND_ID, getMessage(msgID), |
| | | true, false, true); |
| | | StringConfigAttribute idAttr = |
| | | (StringConfigAttribute) configEntry.getConfigAttribute(idStub); |
| | | if (idAttr == null) |
| | | { |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | backendID = idAttr.activeValue(); |
| | | } |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_CANNOT_DETERMINE_BACKEND_ID; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | ce.getMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CANNOT_DETERMINE_BACKEND_ID; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | // Get the backend class name attribute from the entry. If there isn't |
| | | // one, then just skip the entry. |
| | | String backendClassName = null; |
| | | try |
| | | { |
| | | int msgID = MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_CLASS; |
| | | StringConfigAttribute classStub = |
| | | new StringConfigAttribute(ATTR_BACKEND_CLASS, getMessage(msgID), |
| | | true, false, false); |
| | | StringConfigAttribute classAttr = |
| | | (StringConfigAttribute) configEntry.getConfigAttribute(classStub); |
| | | if (classAttr == null) |
| | | { |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | backendClassName = classAttr.activeValue(); |
| | | } |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_CANNOT_DETERMINE_BACKEND_CLASS; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | ce.getMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CANNOT_DETERMINE_BACKEND_CLASS; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return 1; |
| | | } |
| | | |
| | | Class backendClass = null; |
| | | try |
| | | { |
| | | backendClass = Class.forName(backendClassName); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CANNOT_LOAD_BACKEND_CLASS; |
| | | String message = getMessage(msgID, backendClassName, |
| | | String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return 1; |
| | | } |
| | | |
| | | Backend backend = null; |
| | | try |
| | | { |
| | | backend = (Backend) backendClass.newInstance(); |
| | | backend.setBackendID(backendID); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CANNOT_INSTANTIATE_BACKEND_CLASS; |
| | | String message = getMessage(msgID, backendClassName, |
| | | String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | // Get the base DN attribute from the entry. If there isn't one, then |
| | | // just skip this entry. |
| | | List<DN> baseDNs = null; |
| | | try |
| | | { |
| | | int msgID = MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_BASE_DNS; |
| | | DNConfigAttribute baseDNStub = |
| | | new DNConfigAttribute(ATTR_BACKEND_BASE_DN, getMessage(msgID), |
| | | true, true, true); |
| | | DNConfigAttribute baseDNAttr = |
| | | (DNConfigAttribute) configEntry.getConfigAttribute(baseDNStub); |
| | | if (baseDNAttr == null) |
| | | { |
| | | msgID = MSGID_NO_BASES_FOR_BACKEND; |
| | | String message = getMessage(msgID, |
| | | String.valueOf(configEntry.getDN())); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | } |
| | | else |
| | | { |
| | | baseDNs = baseDNAttr.activeValues(); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CANNOT_DETERMINE_BASES_FOR_BACKEND; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | backendList.add(backend); |
| | | entryList.add(configEntry); |
| | | dnList.add(baseDNs); |
| | | } |
| | | return 0; |
| | | } |
| | | } |
| | |
| | | { |
| | | configFile = new StringArgument("configfile", 'c', "configFile", true, |
| | | false, true, "{configFile}", null, null, |
| | | MSGID_CONFIGDS_DESCRIPTION_CONFIG_FILE); |
| | | MSGID_DESCRIPTION_CONFIG_FILE); |
| | | configFile.setHidden(true); |
| | | argParser.addArgument(configFile); |
| | | |
| | |
| | | OPTION_LONG_CONFIG_CLASS, false, |
| | | false, true, OPTION_VALUE_CONFIG_CLASS, |
| | | ConfigFileHandler.class.getName(), null, |
| | | MSGID_CONFIGDS_DESCRIPTION_CONFIG_CLASS); |
| | | MSGID_DESCRIPTION_CONFIG_CLASS); |
| | | configClass.setHidden(true); |
| | | argParser.addArgument(configClass); |
| | | |
| | |
| | | |
| | | showUsage = new BooleanArgument("showusage", OPTION_SHORT_HELP, |
| | | OPTION_LONG_HELP, |
| | | MSGID_CONFIGDS_DESCRIPTION_USAGE); |
| | | MSGID_DESCRIPTION_USAGE); |
| | | argParser.addArgument(showUsage); |
| | | argParser.setUsageArgument(showUsage); |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_CONFIGURE_WINDOWS_SERVICE_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_CONFIGURE_WINDOWS_SERVICE_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | true, false, true, |
| | | OPTION_VALUE_CONFIG_CLASS, |
| | | ConfigFileHandler.class.getName(), null, |
| | | MSGID_ENCPW_DESCRIPTION_CONFIG_CLASS); |
| | | MSGID_DESCRIPTION_CONFIG_CLASS); |
| | | configClass.setHidden(true); |
| | | argParser.addArgument(configClass); |
| | | |
| | |
| | | configFile = new StringArgument("configfile", 'F', "configFile", |
| | | true, false, true, "{configFile}", null, |
| | | null, |
| | | MSGID_ENCPW_DESCRIPTION_CONFIG_FILE); |
| | | MSGID_DESCRIPTION_CONFIG_FILE); |
| | | configFile.setHidden(true); |
| | | argParser.addArgument(configFile); |
| | | |
| | |
| | | |
| | | showUsage = new BooleanArgument("usage", OPTION_SHORT_HELP, |
| | | OPTION_LONG_HELP, |
| | | MSGID_ENCPW_DESCRIPTION_USAGE); |
| | | MSGID_DESCRIPTION_USAGE); |
| | | argParser.addArgument(showUsage); |
| | | argParser.setUsageArgument(showUsage, out); |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_ENCPW_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_ENCPW_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_ENCPW_SERVER_BOOTSTRAP_ERROR; |
| | | int msgID = MSGID_SERVER_BOOTSTRAP_ERROR; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_ENCPW_CANNOT_LOAD_CONFIG; |
| | | int msgID = MSGID_CANNOT_LOAD_CONFIG; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_ENCPW_CANNOT_LOAD_CONFIG; |
| | | int msgID = MSGID_CANNOT_LOAD_CONFIG; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_ENCPW_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_ENCPW_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_ENCPW_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_ENCPW_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_ENCPW_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_ENCPW_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.config.ConfigEntry; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.config.DNConfigAttribute; |
| | | import org.opends.server.config.StringConfigAttribute; |
| | | import org.opends.server.core.CoreConfigManager; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.LockFileManager; |
| | |
| | | import org.opends.server.util.args.IntegerArgument; |
| | | import org.opends.server.util.args.StringArgument; |
| | | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.Error.*; |
| | | import static org.opends.server.messages.ConfigMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.server.messages.ToolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | |
| | | OPTION_LONG_CONFIG_CLASS, true, false, |
| | | true, OPTION_VALUE_CONFIG_CLASS, |
| | | ConfigFileHandler.class.getName(), null, |
| | | MSGID_LDIFEXPORT_DESCRIPTION_CONFIG_CLASS); |
| | | MSGID_DESCRIPTION_CONFIG_CLASS); |
| | | configClass.setHidden(true); |
| | | argParser.addArgument(configClass); |
| | | |
| | |
| | | configFile = |
| | | new StringArgument("configfile", 'f', "configFile", true, false, |
| | | true, "{configFile}", null, null, |
| | | MSGID_LDIFEXPORT_DESCRIPTION_CONFIG_FILE); |
| | | MSGID_DESCRIPTION_CONFIG_FILE); |
| | | configFile.setHidden(true); |
| | | argParser.addArgument(configFile); |
| | | |
| | |
| | | displayUsage = |
| | | new BooleanArgument("help", OPTION_SHORT_HELP, |
| | | OPTION_LONG_HELP, |
| | | MSGID_LDIFEXPORT_DESCRIPTION_USAGE); |
| | | MSGID_DESCRIPTION_USAGE); |
| | | argParser.addArgument(displayUsage); |
| | | argParser.setUsageArgument(displayUsage); |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_SERVER_BOOTSTRAP_ERROR; |
| | | int msgID = MSGID_SERVER_BOOTSTRAP_ERROR; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_LOAD_CONFIG; |
| | | int msgID = MSGID_CANNOT_LOAD_CONFIG; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_LOAD_CONFIG; |
| | | int msgID = MSGID_CANNOT_LOAD_CONFIG; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | ArrayList<Backend> backendList = new ArrayList<Backend>(); |
| | | ArrayList<ConfigEntry> entryList = new ArrayList<ConfigEntry>(); |
| | | ArrayList<List<DN>> dnList = new ArrayList<List<DN>>(); |
| | | getBackends(backendList, entryList, dnList); |
| | | BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | | |
| | | int numBackends = backendList.size(); |
| | | for (int i=0; i < numBackends; i++) |
| | |
| | | exportConfig.close(); |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves information about the backends defined in the Directory Server |
| | | * configuration. |
| | | * |
| | | * @param backendList A list into which instantiated (but not initialized) |
| | | * backend instances will be placed. |
| | | * @param entryList A list into which the config entries associated with |
| | | * the backends will be placed. |
| | | * @param dnList A list into which the set of base DNs for each backend |
| | | * will be placed. |
| | | */ |
| | | private static void getBackends(ArrayList<Backend> backendList, |
| | | ArrayList<ConfigEntry> entryList, |
| | | ArrayList<List<DN>> dnList) |
| | | { |
| | | // Get the base entry for all backend configuration. |
| | | DN backendBaseDN = null; |
| | | try |
| | | { |
| | | backendBaseDN = DN.decode(DN_BACKEND_BASE); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, de.getErrorMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | ConfigEntry baseEntry = null; |
| | | try |
| | | { |
| | | baseEntry = DirectoryServer.getConfigEntry(backendBaseDN); |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, ce.getMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | |
| | | // Iterate through the immediate children, attempting to parse them as |
| | | // backends. |
| | | for (ConfigEntry configEntry : baseEntry.getChildren().values()) |
| | | { |
| | | // Get the backend ID attribute from the entry. If there isn't one, then |
| | | // skip the entry. |
| | | String backendID = null; |
| | | try |
| | | { |
| | | int msgID = MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_BACKEND_ID; |
| | | StringConfigAttribute idStub = |
| | | new StringConfigAttribute(ATTR_BACKEND_ID, getMessage(msgID), |
| | | true, false, true); |
| | | StringConfigAttribute idAttr = |
| | | (StringConfigAttribute) configEntry.getConfigAttribute(idStub); |
| | | if (idAttr == null) |
| | | { |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | backendID = idAttr.activeValue(); |
| | | } |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_DETERMINE_BACKEND_ID; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | ce.getMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_DETERMINE_BACKEND_ID; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | |
| | | // Get the backend class name attribute from the entry. If there isn't |
| | | // one, then just skip the entry. |
| | | String backendClassName = null; |
| | | try |
| | | { |
| | | int msgID = MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_CLASS; |
| | | StringConfigAttribute classStub = |
| | | new StringConfigAttribute(ATTR_BACKEND_CLASS, getMessage(msgID), |
| | | true, false, false); |
| | | StringConfigAttribute classAttr = |
| | | (StringConfigAttribute) configEntry.getConfigAttribute(classStub); |
| | | if (classAttr == null) |
| | | { |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | backendClassName = classAttr.activeValue(); |
| | | } |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_DETERMINE_BACKEND_CLASS; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | ce.getMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_DETERMINE_BACKEND_CLASS; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | Class backendClass = null; |
| | | try |
| | | { |
| | | backendClass = Class.forName(backendClassName); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_LOAD_BACKEND_CLASS; |
| | | String message = getMessage(msgID, backendClassName, |
| | | String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | Backend backend = null; |
| | | try |
| | | { |
| | | backend = (Backend) backendClass.newInstance(); |
| | | backend.setBackendID(backendID); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_INSTANTIATE_BACKEND_CLASS; |
| | | String message = getMessage(msgID, backendClassName, |
| | | String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | |
| | | // Get the base DN attribute from the entry. If there isn't one, then |
| | | // just skip this entry. |
| | | List<DN> baseDNs = null; |
| | | try |
| | | { |
| | | int msgID = MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_BASE_DNS; |
| | | DNConfigAttribute baseDNStub = |
| | | new DNConfigAttribute(ATTR_BACKEND_BASE_DN, getMessage(msgID), |
| | | true, true, true); |
| | | DNConfigAttribute baseDNAttr = |
| | | (DNConfigAttribute) configEntry.getConfigAttribute(baseDNStub); |
| | | if (baseDNAttr == null) |
| | | { |
| | | msgID = MSGID_LDIFEXPORT_NO_BASES_FOR_BACKEND; |
| | | String message = getMessage(msgID, |
| | | String.valueOf(configEntry.getDN())); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | } |
| | | else |
| | | { |
| | | baseDNs = baseDNAttr.activeValues(); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFEXPORT_CANNOT_DETERMINE_BASES_FOR_BACKEND; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | |
| | | backendList.add(backend); |
| | | entryList.add(configEntry); |
| | | dnList.add(baseDNs); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.config.ConfigEntry; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.config.DNConfigAttribute; |
| | | import org.opends.server.config.StringConfigAttribute; |
| | | import org.opends.server.core.CoreConfigManager; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.LockFileManager; |
| | |
| | | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.Error.*; |
| | | import static org.opends.server.messages.ConfigMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.server.messages.ToolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | |
| | | OPTION_LONG_CONFIG_CLASS, true, false, |
| | | true, OPTION_VALUE_CONFIG_CLASS, |
| | | ConfigFileHandler.class.getName(), null, |
| | | MSGID_LDIFIMPORT_DESCRIPTION_CONFIG_CLASS); |
| | | MSGID_DESCRIPTION_CONFIG_CLASS); |
| | | configClass.setHidden(true); |
| | | argParser.addArgument(configClass); |
| | | |
| | |
| | | configFile = |
| | | new StringArgument("configfile", 'f', "configFile", true, false, |
| | | true, "{configFile}", null, null, |
| | | MSGID_LDIFIMPORT_DESCRIPTION_CONFIG_FILE); |
| | | MSGID_DESCRIPTION_CONFIG_FILE); |
| | | configFile.setHidden(true); |
| | | argParser.addArgument(configFile); |
| | | |
| | |
| | | |
| | | displayUsage = |
| | | new BooleanArgument("help", OPTION_SHORT_HELP, OPTION_LONG_HELP, |
| | | MSGID_LDIFIMPORT_DESCRIPTION_USAGE); |
| | | MSGID_DESCRIPTION_USAGE); |
| | | argParser.addArgument(displayUsage); |
| | | argParser.setUsageArgument(displayUsage); |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_SERVER_BOOTSTRAP_ERROR; |
| | | int msgID = MSGID_SERVER_BOOTSTRAP_ERROR; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_LOAD_CONFIG; |
| | | int msgID = MSGID_CANNOT_LOAD_CONFIG; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_LOAD_CONFIG; |
| | | int msgID = MSGID_CANNOT_LOAD_CONFIG; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | ArrayList<Backend> backendList = new ArrayList<Backend>(); |
| | | ArrayList<ConfigEntry> entryList = new ArrayList<ConfigEntry>(); |
| | | ArrayList<List<DN>> dnList = new ArrayList<List<DN>>(); |
| | | int code = getBackends(backendList, entryList, dnList); |
| | | int code = BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | | if (code != 0) |
| | | { |
| | | return code; |
| | |
| | | importConfig.close(); |
| | | return retCode; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves information about the backends defined in the Directory Server |
| | | * configuration. |
| | | * |
| | | * @param backendList A list into which instantiated (but not initialized) |
| | | * backend instances will be placed. |
| | | * @param entryList A list into which the config entries associated with |
| | | * the backends will be placed. |
| | | * @param dnList A list into which the set of base DNs for each backend |
| | | * will be placed. |
| | | * |
| | | * @return 0 if everything went fine. 1 if an error occurred. |
| | | * |
| | | */ |
| | | private static int getBackends(ArrayList<Backend> backendList, |
| | | ArrayList<ConfigEntry> entryList, |
| | | ArrayList<List<DN>> dnList) |
| | | { |
| | | // Get the base entry for all backend configuration. |
| | | DN backendBaseDN = null; |
| | | try |
| | | { |
| | | backendBaseDN = DN.decode(DN_BACKEND_BASE); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, de.getErrorMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | return 1; |
| | | } |
| | | |
| | | ConfigEntry baseEntry = null; |
| | | try |
| | | { |
| | | baseEntry = DirectoryServer.getConfigEntry(backendBaseDN); |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, ce.getMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | // Iterate through the immediate children, attempting to parse them as |
| | | // backends. |
| | | for (ConfigEntry configEntry : baseEntry.getChildren().values()) |
| | | { |
| | | // Get the backend ID attribute from the entry. If there isn't one, then |
| | | // skip the entry. |
| | | String backendID = null; |
| | | try |
| | | { |
| | | int msgID = MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_BACKEND_ID; |
| | | StringConfigAttribute idStub = |
| | | new StringConfigAttribute(ATTR_BACKEND_ID, getMessage(msgID), |
| | | true, false, true); |
| | | StringConfigAttribute idAttr = |
| | | (StringConfigAttribute) configEntry.getConfigAttribute(idStub); |
| | | if (idAttr == null) |
| | | { |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | backendID = idAttr.activeValue(); |
| | | } |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_DETERMINE_BACKEND_ID; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | ce.getMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_DETERMINE_BACKEND_ID; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | // Get the backend class name attribute from the entry. If there isn't |
| | | // one, then just skip the entry. |
| | | String backendClassName = null; |
| | | try |
| | | { |
| | | int msgID = MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_CLASS; |
| | | StringConfigAttribute classStub = |
| | | new StringConfigAttribute(ATTR_BACKEND_CLASS, getMessage(msgID), |
| | | true, false, false); |
| | | StringConfigAttribute classAttr = |
| | | (StringConfigAttribute) configEntry.getConfigAttribute(classStub); |
| | | if (classAttr == null) |
| | | { |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | backendClassName = classAttr.activeValue(); |
| | | } |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_DETERMINE_BACKEND_CLASS; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | ce.getMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_DETERMINE_BACKEND_CLASS; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return 1; |
| | | } |
| | | |
| | | Class backendClass = null; |
| | | try |
| | | { |
| | | backendClass = Class.forName(backendClassName); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_LOAD_BACKEND_CLASS; |
| | | String message = getMessage(msgID, backendClassName, |
| | | String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return 1; |
| | | } |
| | | |
| | | Backend backend = null; |
| | | try |
| | | { |
| | | backend = (Backend) backendClass.newInstance(); |
| | | backend.setBackendID(backendID); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_INSTANTIATE_BACKEND_CLASS; |
| | | String message = getMessage(msgID, backendClassName, |
| | | String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | // Get the base DN attribute from the entry. If there isn't one, then |
| | | // just skip this entry. |
| | | List<DN> baseDNs = null; |
| | | try |
| | | { |
| | | int msgID = MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_BASE_DNS; |
| | | DNConfigAttribute baseDNStub = |
| | | new DNConfigAttribute(ATTR_BACKEND_BASE_DN, getMessage(msgID), |
| | | true, true, true); |
| | | DNConfigAttribute baseDNAttr = |
| | | (DNConfigAttribute) configEntry.getConfigAttribute(baseDNStub); |
| | | if (baseDNAttr == null) |
| | | { |
| | | msgID = MSGID_LDIFIMPORT_NO_BASES_FOR_BACKEND; |
| | | String message = getMessage(msgID, |
| | | String.valueOf(configEntry.getDN())); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | } |
| | | else |
| | | { |
| | | baseDNs = baseDNAttr.activeValues(); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_DETERMINE_BASES_FOR_BACKEND; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | backendList.add(backend); |
| | | entryList.add(configEntry); |
| | | dnList.add(baseDNs); |
| | | } |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | configFile = new StringArgument("configfile", 'c', "configFile", false, |
| | | false, true, "{configFile}", null, null, |
| | | MSGID_INSTALLDS_DESCRIPTION_CONFIG_FILE); |
| | | MSGID_DESCRIPTION_CONFIG_FILE); |
| | | configFile.setHidden(true); |
| | | argParser.addArgument(configFile); |
| | | |
| | |
| | | OPTION_LONG_CONFIG_CLASS, false, |
| | | false, true, OPTION_VALUE_CONFIG_CLASS, |
| | | ConfigFileHandler.class.getName(), null, |
| | | MSGID_INSTALLDS_DESCRIPTION_CONFIG_CLASS); |
| | | MSGID_DESCRIPTION_CONFIG_CLASS); |
| | | configClass.setHidden(true); |
| | | argParser.addArgument(configClass); |
| | | |
| | |
| | | argParser.setUsageArgument(showUsage, out); |
| | | } catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_ENCPW_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_ENCPW_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | argParser.setUsageArgument(showUsage, out); |
| | | } catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_ENCPW_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_ENCPW_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | argParser.setUsageArgument(showUsage, out); |
| | | } catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_ENCPW_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_ENCPW_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | |
| | | showUsage = new BooleanArgument("help", OPTION_SHORT_HELP, |
| | | OPTION_LONG_HELP, |
| | | MSGID_LDAPPWMOD_DESCRIPTION_USAGE); |
| | | MSGID_DESCRIPTION_USAGE); |
| | | argParser.addArgument(showUsage); |
| | | argParser.setUsageArgument(showUsage, out); |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_LDAPPWMOD_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_LDAPPWMOD_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | argParser.setUsageArgument(showUsage, out); |
| | | } catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_ENCPW_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_ENCPW_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | |
| | | configFile = new StringArgument("configfile", 'c', "configFile", false, |
| | | false, true, "{configFile}", null, null, |
| | | MSGID_LDIFDIFF_DESCRIPTION_CONFIG_FILE); |
| | | MSGID_DESCRIPTION_CONFIG_FILE); |
| | | configFile.setHidden(true); |
| | | argParser.addArgument(configFile); |
| | | |
| | |
| | | OPTION_LONG_CONFIG_CLASS, false, |
| | | false, true, OPTION_VALUE_CONFIG_CLASS, |
| | | ConfigFileHandler.class.getName(), null, |
| | | MSGID_LDIFDIFF_DESCRIPTION_CONFIG_CLASS); |
| | | MSGID_DESCRIPTION_CONFIG_CLASS); |
| | | configClass.setHidden(true); |
| | | argParser.addArgument(configClass); |
| | | |
| | | showUsage = new BooleanArgument("showusage", OPTION_SHORT_HELP, |
| | | OPTION_LONG_HELP, |
| | | MSGID_LDIFDIFF_DESCRIPTION_USAGE); |
| | | MSGID_DESCRIPTION_USAGE); |
| | | argParser.addArgument(showUsage); |
| | | argParser.setUsageArgument(showUsage); |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_LDIFDIFF_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | System.err.println(message); |
| | | return 1; |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_LDIFDIFF_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | System.err.println(message); |
| | |
| | | { |
| | | configFile = new StringArgument("configfile", 'c', "configFile", true, |
| | | false, true, "{configFile}", null, null, |
| | | MSGID_LDIFMODIFY_DESCRIPTION_CONFIG_FILE); |
| | | MSGID_DESCRIPTION_CONFIG_FILE); |
| | | configFile.setHidden(true); |
| | | argParser.addArgument(configFile); |
| | | |
| | |
| | | OPTION_LONG_CONFIG_CLASS, false, |
| | | false, true, OPTION_VALUE_CONFIG_CLASS, |
| | | ConfigFileHandler.class.getName(), null, |
| | | MSGID_LDIFMODIFY_DESCRIPTION_CONFIG_CLASS); |
| | | MSGID_DESCRIPTION_CONFIG_CLASS); |
| | | configClass.setHidden(true); |
| | | argParser.addArgument(configClass); |
| | | |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_LDIFMODIFY_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | System.err.println(message); |
| | | return 1; |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_LDIFMODIFY_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | System.err.println(message); |
| | |
| | | |
| | | configFile = new StringArgument("configfile", 'c', "configFile", false, |
| | | false, true, "{configFile}", null, null, |
| | | MSGID_LDIFSEARCH_DESCRIPTION_CONFIG_FILE); |
| | | MSGID_DESCRIPTION_CONFIG_FILE); |
| | | configFile.setHidden(true); |
| | | argParser.addArgument(configFile); |
| | | |
| | |
| | | OPTION_LONG_CONFIG_CLASS, false, |
| | | false, true, OPTION_VALUE_CONFIG_CLASS, |
| | | ConfigFileHandler.class.getName(), null, |
| | | MSGID_LDIFSEARCH_DESCRIPTION_CONFIG_CLASS); |
| | | MSGID_DESCRIPTION_CONFIG_CLASS); |
| | | configClass.setHidden(true); |
| | | argParser.addArgument(configClass); |
| | | |
| | |
| | | |
| | | showUsage = new BooleanArgument("help", OPTION_SHORT_HELP, |
| | | OPTION_LONG_HELP, |
| | | MSGID_LDIFSEARCH_DESCRIPTION_USAGE); |
| | | MSGID_DESCRIPTION_USAGE); |
| | | argParser.addArgument(showUsage); |
| | | argParser.setUsageArgument(showUsage); |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_LDIFSEARCH_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | System.err.println(message); |
| | | return 1; |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_LDIFSEARCH_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | System.err.println(message); |
| | |
| | | OPTION_LONG_CONFIG_CLASS, true, false, |
| | | true, OPTION_VALUE_CONFIG_CLASS, |
| | | ConfigFileHandler.class.getName(), null, |
| | | MSGID_LISTBACKENDS_DESCRIPTION_CONFIG_CLASS); |
| | | MSGID_DESCRIPTION_CONFIG_CLASS); |
| | | configClass.setHidden(true); |
| | | argParser.addArgument(configClass); |
| | | |
| | |
| | | configFile = |
| | | new StringArgument("configfile", 'f', "configFile", true, false, |
| | | true, "{configFile}", null, null, |
| | | MSGID_LISTBACKENDS_DESCRIPTION_CONFIG_FILE); |
| | | MSGID_DESCRIPTION_CONFIG_FILE); |
| | | configFile.setHidden(true); |
| | | argParser.addArgument(configFile); |
| | | |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_LISTBACKENDS_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_LISTBACKENDS_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LISTBACKENDS_SERVER_BOOTSTRAP_ERROR; |
| | | int msgID = MSGID_SERVER_BOOTSTRAP_ERROR; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_LISTBACKENDS_CANNOT_LOAD_CONFIG; |
| | | int msgID = MSGID_CANNOT_LOAD_CONFIG; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LISTBACKENDS_CANNOT_LOAD_CONFIG; |
| | | int msgID = MSGID_CANNOT_LOAD_CONFIG; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LISTBACKENDS_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_LISTBACKENDS_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LISTBACKENDS_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | int msgID = MSGID_LISTBACKENDS_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | int msgID = MSGID_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, de.getErrorMessage()); |
| | | throw new ConfigException(msgID, message, de); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LISTBACKENDS_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | int msgID = MSGID_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, |
| | | stackTraceToSingleLineString(e)); |
| | | throw new ConfigException(msgID, message, e); |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LISTBACKENDS_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | int msgID = MSGID_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, ce.getMessage()); |
| | | throw new ConfigException(msgID, message, ce); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LISTBACKENDS_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | int msgID = MSGID_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, |
| | | stackTraceToSingleLineString(e)); |
| | | throw new ConfigException(msgID, message, e); |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LISTBACKENDS_CANNOT_DETERMINE_BACKEND_ID; |
| | | int msgID = MSGID_CANNOT_DETERMINE_BACKEND_ID; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | ce.getMessage()); |
| | | throw new ConfigException(msgID, message, ce); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LISTBACKENDS_CANNOT_DETERMINE_BACKEND_ID; |
| | | int msgID = MSGID_CANNOT_DETERMINE_BACKEND_ID; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | throw new ConfigException(msgID, message, e); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LISTBACKENDS_CANNOT_DETERMINE_BASES_FOR_BACKEND; |
| | | int msgID = MSGID_CANNOT_DETERMINE_BASES_FOR_BACKEND; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | throw new ConfigException(msgID, message, e); |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | | import static org.opends.server.util.StaticUtils.wrapText; |
| | | import org.opends.server.util.args.ArgumentException; |
| | | import org.opends.server.util.args.ArgumentParser; |
| | | import org.opends.server.util.args.BooleanArgument; |
| | | import org.opends.server.util.args.StringArgument; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | |
| | | import static org.opends.server.messages.ToolMessages.*; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.config.ConfigEntry; |
| | | import static org.opends.server.loggers.Error.*; |
| | | import static org.opends.server.loggers.Error.logError; |
| | | import org.opends.server.loggers.StartupErrorLogger; |
| | | import static org.opends.server.messages.MessageHandler.getMessage; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.CoreConfigManager; |
| | | import org.opends.server.core.LockFileManager; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.backends.jeb.BackendImpl; |
| | | import org.opends.server.backends.jeb.RebuildConfig; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * This program provides a utility to rebuild the contents of the indexes |
| | | * of a Directory Server backend. This will be a process that is |
| | | * intended to run separate from Directory Server and not internally within the |
| | | * server process (e.g., via the tasks interface). |
| | | */ |
| | | public class RebuildIndex |
| | | { |
| | | /** |
| | | * Processes the command-line arguments and invokes the rebuild process. |
| | | * |
| | | * @param args The command-line arguments provided to this program. |
| | | */ |
| | | public static void main(String[] args) |
| | | { |
| | | // Define the command-line arguments that may be used with this program. |
| | | StringArgument configClass = null; |
| | | StringArgument configFile = null; |
| | | StringArgument baseDNString = null; |
| | | StringArgument indexList = null; |
| | | BooleanArgument displayUsage = null; |
| | | |
| | | |
| | | // Create the command-line argument parser for use with this program. |
| | | String toolDescription = getMessage(MSGID_REBUILDINDEX_TOOL_DESCRIPTION); |
| | | ArgumentParser argParser = |
| | | new ArgumentParser("org.opends.server.tools.RebuildIndex", |
| | | toolDescription, false); |
| | | |
| | | |
| | | // Initialize all the command-line argument types and register them with the |
| | | // parser. |
| | | try |
| | | { |
| | | configClass = |
| | | new StringArgument("configclass", 'C', "configClass", true, false, |
| | | true, "{configClass}", |
| | | ConfigFileHandler.class.getName(), null, |
| | | MSGID_DESCRIPTION_CONFIG_CLASS); |
| | | configClass.setHidden(true); |
| | | argParser.addArgument(configClass); |
| | | |
| | | |
| | | configFile = |
| | | new StringArgument("configfile", 'f', "configFile", true, false, |
| | | true, "{configFile}", null, null, |
| | | MSGID_DESCRIPTION_CONFIG_FILE); |
| | | configFile.setHidden(true); |
| | | argParser.addArgument(configFile); |
| | | |
| | | |
| | | baseDNString = |
| | | new StringArgument("basedn", 'b', "baseDN", true, false, true, |
| | | "{baseDN}", null, null, |
| | | MSGID_REBUILDINDEX_DESCRIPTION_BASE_DN); |
| | | argParser.addArgument(baseDNString); |
| | | |
| | | |
| | | indexList = |
| | | new StringArgument("index", 'i', "index", |
| | | false, true, true, |
| | | "{index}", null, null, |
| | | MSGID_REBUILDINDEX_DESCRIPTION_INDEX_NAME); |
| | | argParser.addArgument(indexList); |
| | | |
| | | |
| | | displayUsage = |
| | | new BooleanArgument("help", 'H', "help", |
| | | MSGID_DESCRIPTION_USAGE); |
| | | argParser.addArgument(displayUsage); |
| | | argParser.setUsageArgument(displayUsage); |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | |
| | | |
| | | // Parse the command-line arguments provided to this program. |
| | | try |
| | | { |
| | | argParser.parseArguments(args); |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.err.println(argParser.getUsage()); |
| | | System.exit(1); |
| | | } |
| | | |
| | | |
| | | // If we should just display usage information, then print it and exit. |
| | | if (argParser.usageDisplayed()) |
| | | { |
| | | System.exit(0); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // If no arguments were provided, then display usage information and exit. |
| | | int numArgs = args.length; |
| | | if (numArgs == 0) |
| | | { |
| | | System.out.println(argParser.getUsage()); |
| | | System.exit(1); |
| | | } |
| | | |
| | | |
| | | if (indexList.getValues().size() <= 0) |
| | | { |
| | | int msgID = MSGID_REBUILDINDEX_REQUIRES_AT_LEAST_ONE_INDEX; |
| | | String message = getMessage(msgID); |
| | | |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.out.println(argParser.getUsage()); |
| | | System.exit(1); |
| | | } |
| | | |
| | | // Perform the initial bootstrap of the Directory Server and process the |
| | | // configuration. |
| | | DirectoryServer directoryServer = DirectoryServer.getInstance(); |
| | | |
| | | try |
| | | { |
| | | DirectoryServer.bootstrapClient(); |
| | | DirectoryServer.initializeJMX(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_SERVER_BOOTSTRAP_ERROR; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | |
| | | try |
| | | { |
| | | directoryServer.initializeConfiguration(configClass.getValue(), |
| | | configFile.getValue()); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_CANNOT_LOAD_CONFIG; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CANNOT_LOAD_CONFIG; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | |
| | | |
| | | |
| | | // Initialize the Directory Server schema elements. |
| | | try |
| | | { |
| | | directoryServer.initializeSchema(); |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | |
| | | |
| | | // Initialize the Directory Server core configuration. |
| | | try |
| | | { |
| | | CoreConfigManager coreConfigManager = new CoreConfigManager(); |
| | | coreConfigManager.initializeCoreConfig(); |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | |
| | | |
| | | // Initialize the Directory Server crypto manager. |
| | | try |
| | | { |
| | | directoryServer.initializeCryptoManager(); |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | |
| | | |
| | | |
| | | // FIXME -- Install a custom logger to capture information about the state |
| | | // of the verify process. |
| | | StartupErrorLogger startupLogger = new StartupErrorLogger(); |
| | | startupLogger.initializeErrorLogger(null); |
| | | addErrorLogger(startupLogger); |
| | | |
| | | // Decode the base DN provided by the user. |
| | | DN rebuildBaseDN = null; |
| | | try |
| | | { |
| | | rebuildBaseDN = DN.decode(baseDNString.getValue()); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | int msgID = MSGID_CANNOT_DECODE_BASE_DN; |
| | | String message = getMessage(msgID, baseDNString.getValue(), |
| | | de.getErrorMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CANNOT_DECODE_BASE_DN; |
| | | String message = getMessage(msgID, baseDNString.getValue(), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | // Get information about the backends defined in the server. |
| | | Backend backend = null; |
| | | ConfigEntry configEntry = null; |
| | | DN[] baseDNArray = null; |
| | | |
| | | ArrayList<Backend> backendList = new ArrayList<Backend>(); |
| | | ArrayList<ConfigEntry> entryList = new ArrayList<ConfigEntry>(); |
| | | ArrayList<List<DN>> dnList = new ArrayList<List<DN>>(); |
| | | int code = BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | | |
| | | int numBackends = backendList.size(); |
| | | for (int i=0; i < numBackends; i++) |
| | | { |
| | | Backend b = backendList.get(i); |
| | | ConfigEntry entry = entryList.get(i); |
| | | List<DN> baseDNs = dnList.get(i); |
| | | |
| | | for (DN baseDN : baseDNs) |
| | | { |
| | | if (baseDN.equals(rebuildBaseDN)) |
| | | { |
| | | if (backend == null) |
| | | { |
| | | backend = b; |
| | | configEntry = entry; |
| | | baseDNArray = new DN[baseDNs.size()]; |
| | | baseDNs.toArray(baseDNArray); |
| | | } |
| | | else |
| | | { |
| | | int msgID = MSGID_MULTIPLE_BACKENDS_FOR_BASE; |
| | | String message = getMessage(msgID, baseDNString.getValue()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (backend == null) |
| | | { |
| | | int msgID = MSGID_NO_BACKENDS_FOR_BASE; |
| | | String message = getMessage(msgID, baseDNString.getValue()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | if (!(backend instanceof BackendImpl)) |
| | | { |
| | | int msgID = MSGID_BACKEND_NO_INDEXING_SUPPORT; |
| | | String message = getMessage(msgID); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | // Initialize the rebuild configuration. |
| | | RebuildConfig rebuildConfig = new RebuildConfig(); |
| | | rebuildConfig.setBaseDN(rebuildBaseDN); |
| | | for (String s : indexList.getValues()) |
| | | { |
| | | rebuildConfig.addRebuildIndex(s); |
| | | } |
| | | |
| | | // Acquire an exclusive lock for the backend. |
| | | //TODO: Find a way to do this with the server online. |
| | | try |
| | | { |
| | | String lockFile = LockFileManager.getBackendLockFileName(backend); |
| | | StringBuilder failureReason = new StringBuilder(); |
| | | if (! LockFileManager.acquireExclusiveLock(lockFile, failureReason)) |
| | | { |
| | | int msgID = MSGID_REBUILDINDEX_CANNOT_EXCLUSIVE_LOCK_BACKEND; |
| | | String message = getMessage(msgID, backend.getBackendID(), |
| | | String.valueOf(failureReason)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_REBUILDINDEX_CANNOT_EXCLUSIVE_LOCK_BACKEND; |
| | | String message = getMessage(msgID, backend.getBackendID(), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | return; |
| | | } |
| | | |
| | | // Launch the rebuild process. |
| | | try |
| | | { |
| | | BackendImpl jebBackend = (BackendImpl)backend; |
| | | jebBackend.rebuildBackend(rebuildConfig, configEntry, baseDNArray); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_REBUILDINDEX_ERROR_DURING_REBUILD; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | } |
| | | finally |
| | | { |
| | | // Release the shared lock on the backend. |
| | | try |
| | | { |
| | | String lockFile = LockFileManager.getBackendLockFileName(backend); |
| | | StringBuilder failureReason = new StringBuilder(); |
| | | if (! LockFileManager.releaseLock(lockFile, failureReason)) |
| | | { |
| | | int msgID = MSGID_REBUILDINDEX_CANNOT_UNLOCK_BACKEND; |
| | | String message = getMessage(msgID, backend.getBackendID(), |
| | | String.valueOf(failureReason)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_WARNING, |
| | | message, msgID); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_REBUILDINDEX_CANNOT_UNLOCK_BACKEND; |
| | | String message = getMessage(msgID, backend.getBackendID(), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_WARNING, |
| | | message, msgID); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.config.ConfigEntry; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.config.DNConfigAttribute; |
| | | import org.opends.server.config.StringConfigAttribute; |
| | | import org.opends.server.core.CoreConfigManager; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.LockFileManager; |
| | |
| | | import org.opends.server.util.args.BooleanArgument; |
| | | import org.opends.server.util.args.StringArgument; |
| | | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.Error.*; |
| | | import static org.opends.server.messages.ConfigMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.server.messages.ToolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | |
| | | OPTION_LONG_CONFIG_CLASS, true, false, |
| | | true, OPTION_VALUE_CONFIG_CLASS, |
| | | ConfigFileHandler.class.getName(), null, |
| | | MSGID_RESTOREDB_DESCRIPTION_CONFIG_CLASS); |
| | | MSGID_DESCRIPTION_CONFIG_CLASS); |
| | | configClass.setHidden(true); |
| | | argParser.addArgument(configClass); |
| | | |
| | |
| | | configFile = |
| | | new StringArgument("configfile", 'f', "configFile", true, false, |
| | | true, "{configFile}", null, null, |
| | | MSGID_RESTOREDB_DESCRIPTION_CONFIG_FILE); |
| | | MSGID_DESCRIPTION_CONFIG_FILE); |
| | | configFile.setHidden(true); |
| | | argParser.addArgument(configFile); |
| | | |
| | |
| | | |
| | | displayUsage = |
| | | new BooleanArgument("help", OPTION_SHORT_HELP, OPTION_LONG_HELP, |
| | | MSGID_RESTOREDB_DESCRIPTION_USAGE); |
| | | MSGID_DESCRIPTION_USAGE); |
| | | argParser.addArgument(displayUsage); |
| | | argParser.setUsageArgument(displayUsage); |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_SERVER_BOOTSTRAP_ERROR; |
| | | int msgID = MSGID_SERVER_BOOTSTRAP_ERROR; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_LOAD_CONFIG; |
| | | int msgID = MSGID_CANNOT_LOAD_CONFIG; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_LOAD_CONFIG; |
| | | int msgID = MSGID_CANNOT_LOAD_CONFIG; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | ArrayList<Backend> backendList = new ArrayList<Backend>(); |
| | | ArrayList<ConfigEntry> entryList = new ArrayList<ConfigEntry>(); |
| | | ArrayList<List<DN>> dnList = new ArrayList<List<DN>>(); |
| | | getBackends(backendList, entryList, dnList); |
| | | BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | | |
| | | |
| | | Backend backend = null; |
| | |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves information about the backends defined in the Directory Server |
| | | * configuration. |
| | | * |
| | | * @param backendList A list into which instantiated (but not initialized) |
| | | * backend instances will be placed. |
| | | * @param entryList A list into which the config entries associated with |
| | | * the backends will be placed. |
| | | * @param dnList A list into which the set of base DNs for each backend |
| | | * will be placed. |
| | | */ |
| | | private static void getBackends(ArrayList<Backend> backendList, |
| | | ArrayList<ConfigEntry> entryList, |
| | | ArrayList<List<DN>> dnList) |
| | | { |
| | | // Get the base entry for all backend configuration. |
| | | DN backendBaseDN = null; |
| | | try |
| | | { |
| | | backendBaseDN = DN.decode(DN_BACKEND_BASE); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, de.getErrorMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | |
| | | System.exit(1); |
| | | } |
| | | |
| | | ConfigEntry baseEntry = null; |
| | | try |
| | | { |
| | | baseEntry = DirectoryServer.getConfigEntry(backendBaseDN); |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, ce.getMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | |
| | | // Iterate through the immediate children, attempting to parse them as |
| | | // backends. |
| | | for (ConfigEntry configEntry : baseEntry.getChildren().values()) |
| | | { |
| | | // Get the backend ID attribute from the entry. If there isn't one, then |
| | | // skip the entry. |
| | | String backendID = null; |
| | | try |
| | | { |
| | | int msgID = MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_BACKEND_ID; |
| | | StringConfigAttribute idStub = |
| | | new StringConfigAttribute(ATTR_BACKEND_ID, getMessage(msgID), |
| | | true, false, true); |
| | | StringConfigAttribute idAttr = |
| | | (StringConfigAttribute) configEntry.getConfigAttribute(idStub); |
| | | if (idAttr == null) |
| | | { |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | backendID = idAttr.activeValue(); |
| | | } |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_DETERMINE_BACKEND_ID; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | ce.getMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_DETERMINE_BACKEND_ID; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | |
| | | // Get the backend class name attribute from the entry. If there isn't |
| | | // one, then just skip the entry. |
| | | String backendClassName = null; |
| | | try |
| | | { |
| | | int msgID = MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_CLASS; |
| | | StringConfigAttribute classStub = |
| | | new StringConfigAttribute(ATTR_BACKEND_CLASS, getMessage(msgID), |
| | | true, false, false); |
| | | StringConfigAttribute classAttr = |
| | | (StringConfigAttribute) configEntry.getConfigAttribute(classStub); |
| | | if (classAttr == null) |
| | | { |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | backendClassName = classAttr.activeValue(); |
| | | } |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_DETERMINE_BACKEND_CLASS; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | ce.getMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_DETERMINE_BACKEND_CLASS; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | Class backendClass = null; |
| | | try |
| | | { |
| | | backendClass = Class.forName(backendClassName); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_LOAD_BACKEND_CLASS; |
| | | String message = getMessage(msgID, backendClassName, |
| | | String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | Backend backend = null; |
| | | try |
| | | { |
| | | backend = (Backend) backendClass.newInstance(); |
| | | backend.setBackendID(backendID); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_INSTANTIATE_BACKEND_CLASS; |
| | | String message = getMessage(msgID, backendClassName, |
| | | String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | |
| | | // Get the base DN attribute from the entry. If there isn't one, then |
| | | // just skip this entry. |
| | | List<DN> baseDNs = null; |
| | | try |
| | | { |
| | | int msgID = MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_BASE_DNS; |
| | | DNConfigAttribute baseDNStub = |
| | | new DNConfigAttribute(ATTR_BACKEND_BASE_DN, getMessage(msgID), |
| | | true, true, true); |
| | | DNConfigAttribute baseDNAttr = |
| | | (DNConfigAttribute) configEntry.getConfigAttribute(baseDNStub); |
| | | if (baseDNAttr == null) |
| | | { |
| | | msgID = MSGID_RESTOREDB_NO_BASES_FOR_BACKEND; |
| | | String message = getMessage(msgID, |
| | | String.valueOf(configEntry.getDN())); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | } |
| | | else |
| | | { |
| | | baseDNs = baseDNAttr.activeValues(); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_RESTOREDB_CANNOT_DETERMINE_BASES_FOR_BACKEND; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | |
| | | backendList.add(backend); |
| | | entryList.add(configEntry); |
| | | dnList.add(baseDNs); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_STOPDS_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_STOPDS_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | import org.opends.server.backends.jeb.VerifyConfig; |
| | | import org.opends.server.config.ConfigEntry; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.config.DNConfigAttribute; |
| | | import org.opends.server.config.StringConfigAttribute; |
| | | import org.opends.server.core.CoreConfigManager; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.LockFileManager; |
| | |
| | | import java.util.List; |
| | | |
| | | import static org.opends.server.messages.ToolMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.Error.*; |
| | | import static org.opends.server.messages.ConfigMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | |
| | | OPTION_LONG_CONFIG_CLASS, true, false, |
| | | true, OPTION_VALUE_CONFIG_CLASS, |
| | | ConfigFileHandler.class.getName(), null, |
| | | MSGID_VERIFYINDEX_DESCRIPTION_CONFIG_CLASS); |
| | | MSGID_DESCRIPTION_CONFIG_CLASS); |
| | | configClass.setHidden(true); |
| | | argParser.addArgument(configClass); |
| | | |
| | |
| | | configFile = |
| | | new StringArgument("configfile", 'f', "configFile", true, false, |
| | | true, "{configFile}", null, null, |
| | | MSGID_VERIFYINDEX_DESCRIPTION_CONFIG_FILE); |
| | | MSGID_DESCRIPTION_CONFIG_FILE); |
| | | configFile.setHidden(true); |
| | | argParser.addArgument(configFile); |
| | | |
| | |
| | | |
| | | displayUsage = |
| | | new BooleanArgument("help", OPTION_SHORT_HELP, OPTION_LONG_HELP, |
| | | MSGID_VERIFYINDEX_DESCRIPTION_USAGE); |
| | | MSGID_DESCRIPTION_USAGE); |
| | | argParser.addArgument(displayUsage); |
| | | argParser.setUsageArgument(displayUsage); |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_SERVER_BOOTSTRAP_ERROR; |
| | | int msgID = MSGID_SERVER_BOOTSTRAP_ERROR; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_LOAD_CONFIG; |
| | | int msgID = MSGID_CANNOT_LOAD_CONFIG; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_LOAD_CONFIG; |
| | | int msgID = MSGID_CANNOT_LOAD_CONFIG; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_LOAD_SCHEMA; |
| | | int msgID = MSGID_CANNOT_LOAD_SCHEMA; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | String message = getMessage(msgID, ce.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | String message = getMessage(msgID, ie.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.exit(1); |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_DECODE_BASE_DN; |
| | | int msgID = MSGID_CANNOT_DECODE_BASE_DN; |
| | | String message = getMessage(msgID, baseDNString.getValue(), |
| | | de.getErrorMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_DECODE_BASE_DN; |
| | | int msgID = MSGID_CANNOT_DECODE_BASE_DN; |
| | | String message = getMessage(msgID, baseDNString.getValue(), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | |
| | | ArrayList<Backend> backendList = new ArrayList<Backend>(); |
| | | ArrayList<ConfigEntry> entryList = new ArrayList<ConfigEntry>(); |
| | | ArrayList<List<DN>> dnList = new ArrayList<List<DN>>(); |
| | | getBackends(backendList, entryList, dnList); |
| | | BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | | |
| | | int numBackends = backendList.size(); |
| | | for (int i=0; i < numBackends; i++) |
| | |
| | | } |
| | | else |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_MULTIPLE_BACKENDS_FOR_BASE; |
| | | int msgID = MSGID_MULTIPLE_BACKENDS_FOR_BASE; |
| | | String message = getMessage(msgID, baseDNString.getValue()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | |
| | | |
| | | if (backend == null) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_NO_BACKENDS_FOR_BASE; |
| | | int msgID = MSGID_NO_BACKENDS_FOR_BASE; |
| | | String message = getMessage(msgID, baseDNString.getValue()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | |
| | | |
| | | if (!(backend instanceof BackendImpl)) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_WRONG_BACKEND_TYPE; |
| | | int msgID = MSGID_BACKEND_NO_INDEXING_SUPPORT; |
| | | String message = getMessage(msgID); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | |
| | | message, msgID); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves information about the backends defined in the Directory Server |
| | | * configuration. |
| | | * |
| | | * @param backendList A list into which instantiated (but not initialized) |
| | | * backend instances will be placed. |
| | | * @param entryList A list into which the config entries associated with |
| | | * the backends will be placed. |
| | | * @param dnList A list into which the set of base DNs for each backend |
| | | * will be placed. |
| | | */ |
| | | private static void getBackends(ArrayList<Backend> backendList, |
| | | ArrayList<ConfigEntry> entryList, |
| | | ArrayList<List<DN>> dnList) |
| | | { |
| | | // Get the base entry for all backend configuration. |
| | | DN backendBaseDN = null; |
| | | try |
| | | { |
| | | backendBaseDN = DN.decode(DN_BACKEND_BASE); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, de.getErrorMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_DECODE_BACKEND_BASE_DN; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | ConfigEntry baseEntry = null; |
| | | try |
| | | { |
| | | baseEntry = DirectoryServer.getConfigEntry(backendBaseDN); |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, ce.getMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY; |
| | | String message = getMessage(msgID, DN_BACKEND_BASE, |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message, |
| | | msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | |
| | | // Iterate through the immediate children, attempting to parse them as |
| | | // backends. |
| | | for (ConfigEntry configEntry : baseEntry.getChildren().values()) |
| | | { |
| | | // Get the backend class name attribute from the entry. If there isn't |
| | | // one, then just skip this entry. |
| | | String backendClassName = null; |
| | | try |
| | | { |
| | | int msgID = MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_CLASS; |
| | | StringConfigAttribute classStub = |
| | | new StringConfigAttribute(ATTR_BACKEND_CLASS, getMessage(msgID), |
| | | true, false, false); |
| | | StringConfigAttribute classAttr = |
| | | (StringConfigAttribute) configEntry.getConfigAttribute(classStub); |
| | | if (classAttr == null) |
| | | { |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | backendClassName = classAttr.activeValue(); |
| | | } |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_DETERMINE_BACKEND_CLASS; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | ce.getMessage()); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_DETERMINE_BACKEND_CLASS; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | Class backendClass = null; |
| | | try |
| | | { |
| | | backendClass = Class.forName(backendClassName); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_LOAD_BACKEND_CLASS; |
| | | String message = getMessage(msgID, backendClassName, |
| | | String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | Backend backend = null; |
| | | try |
| | | { |
| | | backend = (Backend) backendClass.newInstance(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_INSTANTIATE_BACKEND_CLASS; |
| | | String message = getMessage(msgID, backendClassName, |
| | | String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | |
| | | // Get the base DN attribute from the entry. If there isn't one, then |
| | | // just skip this entry. |
| | | List<DN> baseDNs = null; |
| | | try |
| | | { |
| | | int msgID = MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_BASE_DNS; |
| | | DNConfigAttribute baseDNStub = |
| | | new DNConfigAttribute(ATTR_BACKEND_BASE_DN, getMessage(msgID), |
| | | true, true, true); |
| | | DNConfigAttribute baseDNAttr = |
| | | (DNConfigAttribute) configEntry.getConfigAttribute(baseDNStub); |
| | | if (baseDNAttr == null) |
| | | { |
| | | msgID = MSGID_VERIFYINDEX_NO_BASES_FOR_BACKEND; |
| | | String message = getMessage(msgID, |
| | | String.valueOf(configEntry.getDN())); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | } |
| | | else |
| | | { |
| | | baseDNs = baseDNAttr.activeValues(); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_VERIFYINDEX_CANNOT_DETERMINE_BASES_FOR_BACKEND; |
| | | String message = getMessage(msgID, String.valueOf(configEntry.getDN()), |
| | | stackTraceToSingleLineString(e)); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | System.exit(1); |
| | | } |
| | | |
| | | |
| | | backendList.add(backend); |
| | | entryList.add(configEntry); |
| | | dnList.add(baseDNs); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_WAIT4DEL_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return EXIT_CODE_INTERNAL_ERROR; |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_WAIT4DEL_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | |
| | | { |
| | | configFile = new StringArgument("configfile", 'c', "configFile", true, |
| | | false, true, "{configFile}", null, null, |
| | | MSGID_MAKELDIF_DESCRIPTION_CONFIG_FILE); |
| | | MSGID_DESCRIPTION_CONFIG_FILE); |
| | | configFile.setHidden(true); |
| | | argParser.addArgument(configFile); |
| | | |
| | |
| | | OPTION_LONG_CONFIG_CLASS, false, |
| | | false, true, |
| | | OPTION_VALUE_CONFIG_CLASS, null, null, |
| | | MSGID_MAKELDIF_DESCRIPTION_CONFIG_CLASS); |
| | | MSGID_DESCRIPTION_CONFIG_CLASS); |
| | | configClass.setHidden(true); |
| | | argParser.addArgument(configClass); |
| | | |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_MAKELDIF_CANNOT_INITIALIZE_ARGS; |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_MAKELDIF_ERROR_PARSING_ARGS; |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.err.println(argParser.getUsage()); |
| | |
| | | * privileges for a user, or to change the set of privileges |
| | | * automatically assigned to a root user. |
| | | */ |
| | | PRIVILEGE_CHANGE("privilege-change"); |
| | | PRIVILEGE_CHANGE("privilege-change"), |
| | | |
| | | |
| | | |
| | | /** |
| | | * The privilege that provides the ability to rebuild one or more |
| | | * indexes in a backend that supports indexing. |
| | | */ |
| | | INDEX_REBUILD("index-rebuild"); |
| | | |
| | | |
| | | |
| | |
| | | PRIV_MAP.put("data-sync", DATA_SYNC); |
| | | PRIV_MAP.put("update-schema", UPDATE_SCHEMA); |
| | | PRIV_MAP.put("privilege-change", PRIVILEGE_CHANGE); |
| | | PRIV_MAP.put("index-rebuild", INDEX_REBUILD); |
| | | |
| | | PRIV_NAMES.add("bypass-acl"); |
| | | PRIV_NAMES.add("modify-acl"); |
| | |
| | | PRIV_NAMES.add("data-sync"); |
| | | PRIV_NAMES.add("update-schema"); |
| | | PRIV_NAMES.add("privilege-change"); |
| | | PRIV_NAMES.add("index-rebuild"); |
| | | |
| | | DEFAULT_ROOT_PRIV_SET.add(BYPASS_ACL); |
| | | DEFAULT_ROOT_PRIV_SET.add(MODIFY_ACL); |
| | |
| | | DEFAULT_ROOT_PRIV_SET.add(PASSWORD_RESET); |
| | | DEFAULT_ROOT_PRIV_SET.add(UPDATE_SCHEMA); |
| | | DEFAULT_ROOT_PRIV_SET.add(PRIVILEGE_CHANGE); |
| | | DEFAULT_ROOT_PRIV_SET.add(INDEX_REBUILD); |
| | | } |
| | | |
| | | |
| | |
| | | replace: ds-cfg-override-severity |
| | | ds-cfg-override-severity: EXCEPTION=INFO |
| | | |
| | | dn: ds-cfg-backend-id=rebuildRoot,cn=Backends,cn=config |
| | | changetype: add |
| | | objectClass: top |
| | | objectClass: ds-cfg-backend |
| | | objectClass: ds-cfg-je-backend |
| | | ds-cfg-backend-enabled: true |
| | | ds-cfg-backend-class: org.opends.server.backends.jeb.BackendImpl |
| | | ds-cfg-backend-id: rebuildRoot |
| | | ds-cfg-backend-writability-mode: enabled |
| | | ds-cfg-backend-base-dn: dc=rebuild, dc=jeb |
| | | ds-cfg-backend-directory: db_rebuild |
| | | ds-cfg-backend-mode: 700 |
| | | ds-cfg-backend-index-entry-limit: 10 |
| | | ds-cfg-backend-subtree-delete-size-limit: 100000 |
| | | ds-cfg-backend-preload-time-limit: 0 seconds |
| | | ds-cfg-backend-import-temp-directory: importTmp |
| | | ds-cfg-backend-import-buffer-size: 256 megabytes |
| | | ds-cfg-backend-import-queue-size: 100 |
| | | ds-cfg-backend-import-pass-size: 0 |
| | | ds-cfg-backend-import-thread-count: 8 |
| | | ds-cfg-backend-entries-compressed: false |
| | | ds-cfg-backend-deadlock-retry-limit: 10 |
| | | |
| | | dn: cn=Index,ds-cfg-backend-id=rebuildRoot,cn=Backends,cn=config |
| | | changetype: add |
| | | objectClass: top |
| | | objectClass: ds-cfg-branch |
| | | cn: Index |
| | | |
| | | dn: ds-cfg-index-attribute=mail,cn=Index,ds-cfg-backend-id=rebuildRoot,cn=Backends,cn=config |
| | | changetype: add |
| | | objectClass: top |
| | | objectClass: ds-cfg-je-index |
| | | ds-cfg-index-attribute: mail |
| | | ds-cfg-index-type: presence |
| | | ds-cfg-index-type: equality |
| | | ds-cfg-index-type: substring |
| | | ds-cfg-index-type: ordering |
| | | ds-cfg-index-type: approximate |
| | | |
| | | dn: cn=JE Database,ds-cfg-backend-id=rebuildRoot,cn=Backends,cn=config |
| | | changetype: add |
| | | objectClass: top |
| | | objectClass: ds-cfg-je-database |
| | | cn: JE Database |
| | | ds-cfg-database-cache-percent: 10 |
| | | ds-cfg-database-cache-size: 0 megabytes |
| | | ds-cfg-database-txn-no-sync: false |
| | | ds-cfg-database-txn-write-no-sync: true |
| | | ds-cfg-database-run-cleaner: true |
| | | ds-cfg-database-cleaner-num-threads: 1 |
| | | ds-cfg-database-cleaner-min-utilization: 75 |
| | | ds-cfg-database-evictor-lru-only: true |
| | | ds-cfg-database-evictor-nodes-per-scan: 10 |
| | | ds-cfg-database-log-file-max: 50 megabytes |
| | | ds-cfg-database-logging-file-handler-on: true |
| | | ds-cfg-database-logging-level: CONFIG |
| | | ds-cfg-database-checkpointer-bytes-interval: 20 megabytes |
| | | ds-cfg-database-checkpointer-wakeup-interval: 30 seconds |
| | | ds-cfg-database-lock-num-lock-tables: 19 |
| | | |
| | | |
| | | dn: ds-cfg-backend-id=verifyRoot,cn=Backends,cn=config |
| | | changetype: add |
| | | objectClass: top |
| | |
| | | } |
| | | testRoot.mkdirs(); |
| | | //db_verify is second jeb backend used by the jeb verify test cases |
| | | //db_rebuild is the third jeb backend used by the jeb rebuild test cases |
| | | String[] subDirectories = { "bak", "bin", "changelogDb", "classes", |
| | | "config", "db", "db_verify", "ldif", "lib", |
| | | "locks", "logs" }; |
| | | "locks", "logs", "db_rebuild" }; |
| | | for (String s : subDirectories) |
| | | { |
| | | new File(testRoot, s).mkdir(); |
| | |
| | | "ds-cfg-index-type: equality\n" + |
| | | "ds-cfg-index-type: substring\n" + |
| | | "ds-cfg-index-type: ordering\n" + |
| | | "ds-cfg-index-type: approximate\n" + |
| | | "\n" + |
| | | "dn: ds-cfg-index-attribute=employeeNumber,cn=Index,ds-cfg-backend-id=userRoot,cn=Backends,cn=config\n" + |
| | | "objectClass: top\n" + |
| | |
| | | finalCount = Integer.valueOf(debugString.substring(finalStartPos, |
| | | finalEndPos)); |
| | | assertEquals(finalCount, 11); |
| | | |
| | | search = conn.processSearch(DN.decode("dc=test,dc=com"), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, |
| | | 0, |
| | | 0, |
| | | false, |
| | | |
| | | LDAPFilter.decode("(cn~=Aartjan)").toSearchFilter(), |
| | | attribs); |
| | | result = search.getSearchEntries(); |
| | | |
| | | debugString = |
| | | result.get(0).getAttribute("debugsearchindex").get(0).getValues().toString(); |
| | | assertTrue(!debugString.contains("NOT-INDEXED")); |
| | | finalStartPos = debugString.indexOf("final=") + 13; |
| | | finalEndPos = debugString.indexOf("]", finalStartPos); |
| | | finalCount = Integer.valueOf(debugString.substring(finalStartPos, |
| | | finalEndPos)); |
| | | assertEquals(finalCount, 1); |
| | | } |
| | | |
| | | @Test(dependsOnMethods = {"testAdd", "testSearchIndex", |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.AfterClass; |
| | | import org.testng.annotations.Test; |
| | | import static org.testng.Assert.*; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.tasks.TaskUtils; |
| | | import static org.opends.server.util.ServerConstants.OC_TOP; |
| | | import static org.opends.server.util.ServerConstants.OC_EXTENSIBLE_OBJECT; |
| | | import org.opends.server.config.ConfigEntry; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | |
| | | public class TestRebuildJob extends JebTestCase |
| | | { |
| | | private String cfgDN= |
| | | "ds-cfg-backend-id=rebuildRoot,cn=Backends,cn=config"; |
| | | private String beID="rebuildRoot"; |
| | | private static String suffix="dc=rebuild,dc=jeb"; |
| | | private static String vBranch="ou=rebuild tests," + suffix; |
| | | private String numUsersLine="define numusers= #numEntries#"; |
| | | //Attribute type in stat entry containing error count |
| | | private String errorCount="verify-error-count"; |
| | | |
| | | private DN configDN; |
| | | private DN[] baseDNs; |
| | | private ConfigEntry configEntry; |
| | | private BackendImpl be; |
| | | |
| | | @DataProvider(name = "systemIndexes") |
| | | public Object[][] systemIndexes() { |
| | | return new Object[][] { |
| | | { "id2subtree" }, |
| | | { "id2children" }, |
| | | { "dn2id" }, |
| | | { "dn2uri" } |
| | | }; |
| | | } |
| | | |
| | | @DataProvider(name = "attributeIndexes") |
| | | public Object[][] attributeIndexes() { |
| | | return new Object[][] { |
| | | { "mail" }, |
| | | { "mail.presence" }, |
| | | { "mail.substring" }, |
| | | { "mail.ordering" }, |
| | | { "mail.equality" }, |
| | | { "mail.approximate" } |
| | | }; |
| | | } |
| | | |
| | | @DataProvider(name = "badIndexes") |
| | | public Object[][] badIndexes() { |
| | | return new Object[][] { |
| | | { "id2entry" }, |
| | | { "nonindex" }, |
| | | { "mail.nonindex" } |
| | | }; |
| | | } |
| | | |
| | | private static String[] template = new String[] { |
| | | "define suffix="+suffix, |
| | | "define maildomain=example.com", |
| | | "define numusers= #numEntries#", |
| | | "", |
| | | "branch: [suffix]", |
| | | "", |
| | | "branch: " + vBranch, |
| | | "subordinateTemplate: person:[numusers]", |
| | | "", |
| | | "template: person", |
| | | "rdnAttr: uid", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | | "objectClass: organizationalPerson", |
| | | "objectClass: inetOrgPerson", |
| | | "givenName: ABOVE LIMIT", |
| | | "sn: <last>", |
| | | "cn: {givenName} {sn}", |
| | | "initials: {givenName:1}<random:chars:" + |
| | | "ABCDEFGHIJKLMNOPQRSTUVWXYZ:1>{sn:1}", |
| | | "employeeNumber: <sequential:0>", |
| | | "uid: user.{employeeNumber}", |
| | | "mail: {uid}@[maildomain]", |
| | | "userPassword: password", |
| | | "telephoneNumber: <random:telephone>", |
| | | "homePhone: <random:telephone>", |
| | | "pager: <random:telephone>", |
| | | "mobile: <random:telephone>", |
| | | "street: <random:numeric:5> <file:streets> Street", |
| | | "l: <file:cities>", |
| | | "st: <file:states>", |
| | | "postalCode: <random:numeric:5>", |
| | | "postalAddress: {cn}${street}${l}, {st} {postalCode}", |
| | | "description: This is the description for {cn}.", |
| | | ""}; |
| | | |
| | | @BeforeClass |
| | | public void setup() throws Exception { |
| | | TestCaseUtils.startServer(); |
| | | configDN = DN.decode(cfgDN); |
| | | baseDNs = new DN[] { |
| | | DN.decode(suffix) |
| | | }; |
| | | configEntry = DirectoryServer.getConfigEntry(configDN); |
| | | } |
| | | |
| | | @AfterClass |
| | | public void cleanUp() throws Exception { |
| | | TestCaseUtils.clearJEBackend(false, beID, suffix); |
| | | } |
| | | |
| | | /** |
| | | * Cleans verify backend and loads some number of entries. |
| | | * @param numEntries number of entries to load into the backend. |
| | | * @throws Exception if the entries are not loaded or created. |
| | | */ |
| | | private void cleanAndLoad(int numEntries) throws Exception { |
| | | TestCaseUtils.clearJEBackend(false, beID, suffix); |
| | | template[2]=numUsersLine; |
| | | template[2]= |
| | | template[2].replaceAll("#numEntries#", String.valueOf(numEntries)); |
| | | createLoadEntries(template, numEntries); |
| | | } |
| | | |
| | | /** |
| | | * Runs rebuild against the system indexes. |
| | | * |
| | | * @throws Exception if |
| | | */ |
| | | @Test(dataProvider = "attributeIndexes") |
| | | public void testRebuildAttributeIndexes(String index) throws Exception |
| | | { |
| | | cleanAndLoad(10); |
| | | RebuildConfig rebuildConfig = new RebuildConfig(); |
| | | rebuildConfig.setBaseDN(baseDNs[0]); |
| | | rebuildConfig.addRebuildIndex(index); |
| | | be=(BackendImpl) DirectoryServer.getBackend(beID); |
| | | be.rebuildBackend(rebuildConfig, configEntry, baseDNs); |
| | | |
| | | assertEquals(verifyBackend("mail"), 0); |
| | | |
| | | } |
| | | |
| | | @Test(dataProvider = "badIndexes", |
| | | expectedExceptions = DirectoryException.class) |
| | | public void testRebuildBadIndexes(String index) throws Exception |
| | | { |
| | | RebuildConfig rebuildConfig = new RebuildConfig(); |
| | | rebuildConfig.setBaseDN(baseDNs[0]); |
| | | rebuildConfig.addRebuildIndex(index); |
| | | be=(BackendImpl) DirectoryServer.getBackend(beID); |
| | | be.rebuildBackend(rebuildConfig, configEntry, baseDNs); |
| | | } |
| | | |
| | | @Test(dataProvider = "systemIndexes", |
| | | expectedExceptions = DirectoryException.class) |
| | | public void testRebuildSystemIndexesOnline(String index) throws Exception |
| | | { |
| | | cleanAndLoad(10); |
| | | RebuildConfig rebuildConfig = new RebuildConfig(); |
| | | rebuildConfig.setBaseDN(baseDNs[0]); |
| | | rebuildConfig.addRebuildIndex(index); |
| | | be=(BackendImpl) DirectoryServer.getBackend(beID); |
| | | be.rebuildBackend(rebuildConfig, configEntry, baseDNs); |
| | | } |
| | | |
| | | @Test(dataProvider = "systemIndexes") |
| | | public void testRebuildSystemIndexesOffline(String index) throws Exception |
| | | { |
| | | cleanAndLoad(10); |
| | | RebuildConfig rebuildConfig = new RebuildConfig(); |
| | | rebuildConfig.setBaseDN(baseDNs[0]); |
| | | rebuildConfig.addRebuildIndex(index); |
| | | be=(BackendImpl) DirectoryServer.getBackend(beID); |
| | | |
| | | TaskUtils.setBackendEnabled(configEntry, false); |
| | | |
| | | be.rebuildBackend(rebuildConfig, configEntry, baseDNs); |
| | | |
| | | //TODO: Verify dn2uri database as well. |
| | | if(!index.equalsIgnoreCase("dn2uri")) |
| | | { |
| | | assertEquals(verifyBackend(index), 0); |
| | | } |
| | | |
| | | TaskUtils.setBackendEnabled(configEntry, true); |
| | | } |
| | | |
| | | @Test |
| | | public void testRebuildDependentIndexes() throws Exception |
| | | { |
| | | cleanAndLoad(10); |
| | | RebuildConfig rebuildConfig = new RebuildConfig(); |
| | | rebuildConfig.setBaseDN(baseDNs[0]); |
| | | rebuildConfig.addRebuildIndex("dn2id"); |
| | | rebuildConfig.addRebuildIndex("id2children"); |
| | | |
| | | be=(BackendImpl) DirectoryServer.getBackend(beID); |
| | | |
| | | TaskUtils.setBackendEnabled(configEntry, false); |
| | | |
| | | be.rebuildBackend(rebuildConfig, configEntry, baseDNs); |
| | | |
| | | assertEquals(verifyBackend(null), 0); |
| | | |
| | | TaskUtils.setBackendEnabled(configEntry, true); |
| | | } |
| | | |
| | | @Test |
| | | public void testRebuildRedundentIndexes() throws Exception |
| | | { |
| | | RebuildConfig rebuildConfig = new RebuildConfig(); |
| | | rebuildConfig.addRebuildIndex("dn2id"); |
| | | rebuildConfig.addRebuildIndex("dn2id"); |
| | | rebuildConfig.addRebuildIndex("cn"); |
| | | rebuildConfig.addRebuildIndex("cn.presence"); |
| | | rebuildConfig.addRebuildIndex("uid.equality"); |
| | | rebuildConfig.addRebuildIndex("uid"); |
| | | |
| | | assertEquals(rebuildConfig.getRebuildList().size(), 3); |
| | | assertTrue(rebuildConfig.getRebuildList().contains("dn2id")); |
| | | assertTrue(rebuildConfig.getRebuildList().contains("cn")); |
| | | assertTrue(rebuildConfig.getRebuildList().contains("uid")); |
| | | } |
| | | |
| | | @Test |
| | | public void testRebuildMultipleJobs() throws Exception |
| | | { |
| | | RebuildConfig rebuildConfig = new RebuildConfig(); |
| | | RebuildConfig rebuildConfig2 = new RebuildConfig(); |
| | | rebuildConfig.setBaseDN(baseDNs[0]); |
| | | rebuildConfig2.setBaseDN(baseDNs[0]); |
| | | rebuildConfig.addRebuildIndex("dn2id"); |
| | | rebuildConfig.addRebuildIndex("id2children"); |
| | | rebuildConfig2.addRebuildIndex("dn2id"); |
| | | rebuildConfig.addRebuildIndex("cn"); |
| | | |
| | | assertNotNull(rebuildConfig.checkConflicts(rebuildConfig2)); |
| | | assertNotNull(rebuildConfig2.checkConflicts(rebuildConfig)); |
| | | |
| | | rebuildConfig = new RebuildConfig(); |
| | | rebuildConfig2 = new RebuildConfig(); |
| | | rebuildConfig.setBaseDN(baseDNs[0]); |
| | | rebuildConfig2.setBaseDN(baseDNs[0]); |
| | | rebuildConfig.addRebuildIndex("cn"); |
| | | rebuildConfig2.addRebuildIndex("cn.presence"); |
| | | rebuildConfig2.addRebuildIndex("dn2id"); |
| | | |
| | | assertNotNull(rebuildConfig.checkConflicts(rebuildConfig2)); |
| | | assertNotNull(rebuildConfig2.checkConflicts(rebuildConfig)); |
| | | } |
| | | |
| | | private long verifyBackend(String index) throws Exception |
| | | { |
| | | VerifyConfig verifyConfig = new VerifyConfig(); |
| | | verifyConfig.setBaseDN(baseDNs[0]); |
| | | if(index != null) |
| | | { |
| | | verifyConfig.addCleanIndex(index); |
| | | } |
| | | Entry statEntry=bldStatEntry(""); |
| | | be.verifyBackend(verifyConfig, configEntry, baseDNs, statEntry); |
| | | |
| | | return getStatEntryCount(statEntry, errorCount); |
| | | } |
| | | |
| | | /** |
| | | * Builds an entry suitable for using in the verify job to gather statistics about |
| | | * the verify. |
| | | * @param dn to put into the entry. |
| | | * @return a suitable entry. |
| | | * @throws DirectoryException if the cannot be created. |
| | | */ |
| | | private Entry bldStatEntry(String dn) throws DirectoryException { |
| | | DN entryDN = DN.decode(dn); |
| | | HashMap<ObjectClass, String> ocs = new HashMap<ObjectClass, String>(2); |
| | | ObjectClass topOC = DirectoryServer.getObjectClass(OC_TOP); |
| | | if (topOC == null) { |
| | | topOC = DirectoryServer.getDefaultObjectClass(OC_TOP); |
| | | } |
| | | ocs.put(topOC, OC_TOP); |
| | | ObjectClass extensibleObjectOC = DirectoryServer |
| | | .getObjectClass(OC_EXTENSIBLE_OBJECT); |
| | | if (extensibleObjectOC == null) { |
| | | extensibleObjectOC = DirectoryServer |
| | | .getDefaultObjectClass(OC_EXTENSIBLE_OBJECT); |
| | | } |
| | | ocs.put(extensibleObjectOC, OC_EXTENSIBLE_OBJECT); |
| | | return new Entry(entryDN, ocs, |
| | | new LinkedHashMap<AttributeType, List<Attribute>>(0), |
| | | new HashMap<AttributeType, List<Attribute>>(0)); |
| | | } |
| | | /** |
| | | * Gets information from the stat entry and returns that value as a Long. |
| | | * @param e entry to search. |
| | | * @param type attribute type |
| | | * @return Long |
| | | * @throws NumberFormatException if the attribute value cannot be parsed. |
| | | */ |
| | | private long getStatEntryCount(Entry e, String type) |
| | | throws NumberFormatException { |
| | | AttributeType attrType = |
| | | DirectoryServer.getAttributeType(type); |
| | | if (attrType == null) |
| | | attrType = DirectoryServer.getDefaultAttributeType(type); |
| | | List<Attribute> attrList = e.getAttribute(attrType, null); |
| | | LinkedHashSet<AttributeValue> values = |
| | | attrList.get(0).getValues(); |
| | | AttributeValue v = values.iterator().next(); |
| | | long retVal = Long.parseLong(v.getStringValue()); |
| | | return (retVal); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.tasks; |
| | | |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.AfterClass; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | import static org.testng.Assert.assertEquals; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.TestTaskListener; |
| | | import org.opends.server.backends.task.TaskState; |
| | | import org.opends.server.backends.jeb.JebTestCase; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.ObjectClass; |
| | | |
| | | import java.util.UUID; |
| | | |
| | | public class TestRebuildTask extends TasksTestCase |
| | | { |
| | | private static String suffix="dc=rebuild,dc=jeb"; |
| | | private static String vBranch="ou=rebuild tests," + suffix; |
| | | |
| | | private static String[] template = new String[] { |
| | | "define suffix="+suffix, |
| | | "define maildomain=example.com", |
| | | "define numusers= #numEntries#", |
| | | "", |
| | | "branch: [suffix]", |
| | | "", |
| | | "branch: " + vBranch, |
| | | "subordinateTemplate: person:[numusers]", |
| | | "", |
| | | "template: person", |
| | | "rdnAttr: uid", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | | "objectClass: organizationalPerson", |
| | | "objectClass: inetOrgPerson", |
| | | "givenName: ABOVE LIMIT", |
| | | "sn: <last>", |
| | | "cn: {givenName} {sn}", |
| | | "initials: {givenName:1}<random:chars:" + |
| | | "ABCDEFGHIJKLMNOPQRSTUVWXYZ:1>{sn:1}", |
| | | "employeeNumber: <sequential:0>", |
| | | "uid: user.{employeeNumber}", |
| | | "mail: {uid}@[maildomain]", |
| | | "userPassword: password", |
| | | "telephoneNumber: <random:telephone>", |
| | | "homePhone: <random:telephone>", |
| | | "pager: <random:telephone>", |
| | | "mobile: <random:telephone>", |
| | | "street: <random:numeric:5> <file:streets> Street", |
| | | "l: <file:cities>", |
| | | "st: <file:states>", |
| | | "postalCode: <random:numeric:5>", |
| | | "postalAddress: {cn}${street}${l}, {st} {postalCode}", |
| | | "description: This is the description for {cn}.", |
| | | ""}; |
| | | |
| | | @BeforeClass |
| | | public void setup() throws Exception { |
| | | TestCaseUtils.startServer(); |
| | | } |
| | | |
| | | @AfterClass |
| | | public void cleanUp() throws Exception { |
| | | } |
| | | |
| | | @DataProvider(name = "taskentry") |
| | | public Object[][] createData() throws Exception |
| | | { |
| | | return new Object[][] { |
| | | // A fairly simple, valid rebuild task. |
| | | { |
| | | TestCaseUtils.makeEntry( |
| | | "dn: ds-task-id=" + UUID.randomUUID() + |
| | | ",cn=Scheduled Tasks,cn=Tasks", |
| | | "objectclass: top", |
| | | "objectclass: ds-task", |
| | | "objectclass: ds-task-rebuild", |
| | | "ds-task-class-name: org.opends.server.tasks.RebuildTask", |
| | | "ds-task-rebuild-base-dn: " + suffix, |
| | | "ds-task-rebuild-index: mail" |
| | | ), |
| | | TaskState.COMPLETED_SUCCESSFULLY |
| | | }, |
| | | { |
| | | TestCaseUtils.makeEntry( |
| | | "dn: ds-task-id=" + UUID.randomUUID() + |
| | | ",cn=Scheduled Tasks,cn=Tasks", |
| | | "objectclass: top", |
| | | "objectclass: ds-task", |
| | | "objectclass: ds-task-rebuild", |
| | | "ds-task-class-name: org.opends.server.tasks.RebuildTask", |
| | | "ds-task-rebuild-base-dn: " + suffix, |
| | | "ds-task-rebuild-index: dn2id", |
| | | "ds-task-rebuild-index: dn2uri", |
| | | "ds-task-rebuild-index: id2children", |
| | | "ds-task-rebuild-index: id2subtree", |
| | | "ds-task-rebuild-index: mail", |
| | | "ds-task-rebuild-max-threads: 3" |
| | | ), |
| | | TaskState.COMPLETED_SUCCESSFULLY |
| | | }, |
| | | { |
| | | TestCaseUtils.makeEntry( |
| | | "dn: ds-task-id=" + UUID.randomUUID() + |
| | | ",cn=Scheduled Tasks,cn=Tasks", |
| | | "objectclass: top", |
| | | "objectclass: ds-task", |
| | | "objectclass: ds-task-rebuild", |
| | | "ds-task-class-name: org.opends.server.tasks.RebuildTask", |
| | | "ds-task-rebuild-base-dn: ou=bad," + suffix, |
| | | "ds-task-rebuild-index: dn2id", |
| | | "ds-task-rebuild-index: dn2uri" |
| | | ), |
| | | TaskState.STOPPED_BY_ERROR |
| | | }, |
| | | }; |
| | | } |
| | | |
| | | @Test(dataProvider = "taskentry", groups = "slow") |
| | | public void testRebuildTask(Entry taskEntry, TaskState expectedState) |
| | | throws Exception |
| | | { |
| | | testTask(taskEntry, expectedState, 60); |
| | | } |
| | | } |