| | |
| | | import org.opends.server.util.DynamicConstants; |
| | | import org.opends.server.util.LDIFException; |
| | | import org.opends.server.util.LDIFWriter; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.Debug.*; |
| | | import static org.opends.server.loggers.Error.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugCought; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.server.messages.BackendMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | |
| | | implements ConfigurableComponent, AlertGenerator |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | * The fully-qualified name of this class. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.backends.SchemaBackend"; |
| | |
| | | { |
| | | super(); |
| | | |
| | | assert debugConstructor(CLASS_NAME); |
| | | |
| | | |
| | | // Perform all initialization in initializeBackend. |
| | |
| | | public void initializeBackend(ConfigEntry configEntry, DN[] baseDNs) |
| | | throws ConfigException, InitializationException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "initializeBackend", |
| | | String.valueOf(configEntry)); |
| | | |
| | | |
| | | // Make sure that a configuration entry was provided. If not, then we will |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "applyNewConfiguration", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_SCHEMA_CANNOT_DETERMINE_SHOW_ALL; |
| | | String message = getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "initializeBackend", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_BACKEND_CANNOT_REGISTER_BASEDN; |
| | | String message = getMessage(msgID, baseDNs[i].toString(), |
| | |
| | | */ |
| | | public void finalizeBackend() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "finalizeBackend"); |
| | | |
| | | DirectoryServer.deregisterConfigurableComponent(this); |
| | | |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "finalizeBackend", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | private boolean isSchemaConfigAttribute(Attribute attribute) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "isConfigAttribute", |
| | | String.valueOf(attribute)); |
| | | |
| | | AttributeType attrType = attribute.getAttributeType(); |
| | | if (attrType.hasName(ATTR_SCHEMA_ENTRY_DN.toLowerCase()) || |
| | |
| | | */ |
| | | public DN[] getBaseDNs() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getBaseDNs"); |
| | | |
| | | return baseDNs; |
| | | } |
| | |
| | | */ |
| | | public long getEntryCount() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getEntryCount"); |
| | | |
| | | // There is always only a single entry in this backend. |
| | | return 1; |
| | |
| | | */ |
| | | public boolean isLocal() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "isLocal"); |
| | | |
| | | // For the purposes of this method, this is a local backend. |
| | | return true; |
| | |
| | | public Entry getEntry(DN entryDN) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getEntry", String.valueOf(entryDN)); |
| | | |
| | | |
| | | // If the requested entry was one of the schema entries, then create and |
| | |
| | | */ |
| | | public Entry getSchemaEntry(DN entryDN) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getSchemaEntry", String.valueOf(entryDN)); |
| | | |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttrs = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(); |
| | |
| | | public boolean entryExists(DN entryDN) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "entryExists", String.valueOf(entryDN)); |
| | | |
| | | |
| | | // The specified DN must be one of the specified schema DNs. |
| | |
| | | public void addEntry(Entry entry, AddOperation addOperation) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "addEntry", String.valueOf(entry), |
| | | String.valueOf(addOperation)); |
| | | |
| | | int msgID = MSGID_SCHEMA_ADD_NOT_SUPPORTED; |
| | | String message = getMessage(msgID, String.valueOf(entry.getDN())); |
| | |
| | | public void deleteEntry(DN entryDN, DeleteOperation deleteOperation) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "deleteEntry", String.valueOf(entryDN), |
| | | String.valueOf(deleteOperation)); |
| | | |
| | | int msgID = MSGID_SCHEMA_DELETE_NOT_SUPPORTED; |
| | | String message = getMessage(msgID, String.valueOf(entryDN)); |
| | |
| | | public void replaceEntry(Entry entry, ModifyOperation modifyOperation) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "replaceEntry", String.valueOf(entry), |
| | | String.valueOf(modifyOperation)); |
| | | |
| | | |
| | | // Make sure that the authenticated user has the necessary UPDATE_SCHEMA |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "replaceEntry", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_CANNOT_DECODE_ATTRTYPE; |
| | | String message = getMessage(msgID, v.getStringValue(), |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "replaceEntry", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_CANNOT_DECODE_OBJECTCLASS; |
| | | String message = getMessage(msgID, v.getStringValue(), |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "replaceEntry", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_CANNOT_DECODE_NAME_FORM; |
| | | String message = getMessage(msgID, v.getStringValue(), |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "replaceEntry", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_CANNOT_DECODE_DCR; |
| | | String message = getMessage(msgID, v.getStringValue(), |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "replaceEntry", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_CANNOT_DECODE_DSR; |
| | | String message = getMessage(msgID, v.getStringValue(), |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "replaceEntry", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_CANNOT_DECODE_MR_USE; |
| | | String message = getMessage(msgID, v.getStringValue(), |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "replaceEntry", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_CANNOT_DECODE_ATTRTYPE; |
| | | String message = getMessage(msgID, v.getStringValue(), |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "replaceEntry", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_CANNOT_DECODE_OBJECTCLASS; |
| | | String message = getMessage(msgID, v.getStringValue(), |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "replaceEntry", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_CANNOT_DECODE_NAME_FORM; |
| | | String message = getMessage(msgID, v.getStringValue(), |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "replaceEntry", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_CANNOT_DECODE_DCR; |
| | | String message = getMessage(msgID, v.getStringValue(), |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "replaceEntry", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_CANNOT_DECODE_DSR; |
| | | String message = getMessage(msgID, v.getStringValue(), |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "replaceEntry", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_CANNOT_DECODE_MR_USE; |
| | | String message = getMessage(msgID, v.getStringValue(), |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "replaceEntry", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | throw de; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "replaceEntry", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_CANNOT_WRITE_NEW_SCHEMA; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "addAttributeType", |
| | | String.valueOf(attributeType), String.valueOf(schema), |
| | | String.valueOf(modifiedSchemaFiles)); |
| | | |
| | | |
| | | // First, see if the specified attribute type already exists. We'll check |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "removeAttributeType", |
| | | String.valueOf(attributeType), String.valueOf(schema), |
| | | String.valueOf(modifications), |
| | | String.valueOf(currentPosition), |
| | | String.valueOf(modifiedSchemaFiles)); |
| | | |
| | | |
| | | // See if the specified attribute type is actually defined in the server |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "removeAttributeType", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_CANNOT_DECODE_ATTRTYPE; |
| | | String message = getMessage(msgID, v.getStringValue(), |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "addObjectClass", String.valueOf(objectClass), |
| | | String.valueOf(schema), |
| | | String.valueOf(modifiedSchemaFiles)); |
| | | |
| | | |
| | | // First, see if the specified objectclass already exists. We'll check the |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "removeObjectClass", |
| | | String.valueOf(objectClass), String.valueOf(schema), |
| | | String.valueOf(modifications), |
| | | String.valueOf(currentPosition), |
| | | String.valueOf(modifiedSchemaFiles)); |
| | | |
| | | |
| | | // See if the specified objectclass is actually defined in the server |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "removeObjectClass", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_CANNOT_DECODE_OBJECTCLASS; |
| | | String message = getMessage(msgID, v.getStringValue(), |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "addNameForm", String.valueOf(nameForm), |
| | | String.valueOf(schema), |
| | | String.valueOf(modifiedSchemaFiles)); |
| | | |
| | | |
| | | // First, see if the specified name form already exists. We'll check the |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "removeNameForm", |
| | | String.valueOf(nameForm), String.valueOf(schema), |
| | | String.valueOf(modifications), |
| | | String.valueOf(currentPosition), |
| | | String.valueOf(modifiedSchemaFiles)); |
| | | |
| | | |
| | | // See if the specified name form is actually defined in the server schema. |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "removeNameForm", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_CANNOT_DECODE_NAME_FORM; |
| | | String message = getMessage(msgID, v.getStringValue(), |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "addDITContentRule", |
| | | String.valueOf(ditContentRule), String.valueOf(schema), |
| | | String.valueOf(modifiedSchemaFiles)); |
| | | |
| | | |
| | | // First, see if the specified DIT content rule already exists. We'll check |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "removeDITContentRule", |
| | | String.valueOf(ditContentRule), String.valueOf(schema), |
| | | String.valueOf(modifications), |
| | | String.valueOf(currentPosition), |
| | | String.valueOf(modifiedSchemaFiles)); |
| | | |
| | | |
| | | // See if the specified DIT content rule is actually defined in the server |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "addDITStructureRule", |
| | | String.valueOf(ditStructureRule), String.valueOf(schema), |
| | | String.valueOf(modifiedSchemaFiles)); |
| | | |
| | | |
| | | // First, see if the specified DIT structure rule already exists. We'll |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "removeDITStructureRule", |
| | | String.valueOf(ditStructureRule), String.valueOf(schema), |
| | | String.valueOf(modifications), |
| | | String.valueOf(currentPosition), |
| | | String.valueOf(modifiedSchemaFiles)); |
| | | |
| | | |
| | | // See if the specified DIT structure rule is actually defined in the server |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "removeDITStructureRule", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_CANNOT_DECODE_DSR; |
| | | String message = getMessage(msgID, v.getStringValue(), |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "addMatchingRuleUse", |
| | | String.valueOf(matchingRuleUse), String.valueOf(schema), |
| | | String.valueOf(modifiedSchemaFiles)); |
| | | |
| | | |
| | | // First, see if the specified matching rule use already exists. We'll |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "removeMatchingRuleUse", |
| | | String.valueOf(matchingRuleUse), String.valueOf(schema), |
| | | String.valueOf(modifications), |
| | | String.valueOf(currentPosition), |
| | | String.valueOf(modifiedSchemaFiles)); |
| | | |
| | | |
| | | // See if the specified DIT content rule is actually defined in the server |
| | |
| | | */ |
| | | private Entry createEmptySchemaEntry() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "createEmptySchemaEntry"); |
| | | |
| | | LinkedHashMap<ObjectClass,String> objectClasses = |
| | | new LinkedHashMap<ObjectClass,String>(); |
| | |
| | | private File writeTempSchemaFile(Schema schema, String schemaFile) |
| | | throws DirectoryException, IOException, LDIFException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "writeTempSchemaFile", String.valueOf(schema), |
| | | String.valueOf(schemaFile)); |
| | | |
| | | |
| | | // Start with an empty schema entry. |
| | |
| | | int depth) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "addAttrTypeToSchemaFile", |
| | | String.valueOf(schema), String.valueOf(schemaFile), |
| | | String.valueOf(attributeType), String.valueOf(values), |
| | | String.valueOf(addedTypes), String.valueOf(depth)); |
| | | |
| | | if (depth > 20) |
| | | { |
| | |
| | | int depth) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "addObjectClassToSchemaFile", |
| | | String.valueOf(schema), String.valueOf(schemaFile), |
| | | String.valueOf(objectClass), String.valueOf(values), |
| | | String.valueOf(addedClasses), String.valueOf(depth)); |
| | | |
| | | if (depth > 20) |
| | | { |
| | |
| | | HashSet<DITStructureRule> addedDSRs, int depth) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "addDITStructureRuleToSchemaFile", |
| | | String.valueOf(schema), String.valueOf(schemaFile), |
| | | String.valueOf(ditStructureRule), String.valueOf(values), |
| | | String.valueOf(addedDSRs), String.valueOf(depth)); |
| | | |
| | | if (depth > 20) |
| | | { |
| | |
| | | private void installSchemaFiles(HashMap<String,File> tempSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "installSchemaFiles", |
| | | String.valueOf(tempSchemaFiles)); |
| | | |
| | | |
| | | // Create lists that will hold the three types of files we'll be dealing |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "installSchemaFiles", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | boolean allCleaned = true; |
| | | for (File f : origFileList) |
| | |
| | | } |
| | | catch (Exception e2) |
| | | { |
| | | assert debugException(CLASS_NAME, "installSchemaFiles", e2); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e2); |
| | | } |
| | | |
| | | allCleaned = false; |
| | | } |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "installSchemaFiles", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | for (File f : installedFileList) |
| | | { |
| | |
| | | } |
| | | catch (Exception e2) |
| | | { |
| | | assert debugException(CLASS_NAME, "installSchemaFiles", e2); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e2); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | catch (Exception e2) |
| | | { |
| | | assert debugException(CLASS_NAME, "installSchemaFiles", e2); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e2); |
| | | } |
| | | |
| | | allRestored = false; |
| | | } |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "installSchemaFiles", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "installSchemaFiles", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | private void copyFile(File from, File to) |
| | | throws IOException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "copyFile", String.valueOf(from), |
| | | String.valueOf(to)); |
| | | |
| | | byte[] buffer = new byte[4096]; |
| | | FileInputStream inputStream = null; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "copyFile", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | private void cleanUpTempSchemaFiles(HashMap<String,File> tempSchemaFiles) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "cleanUpTempSchemaFiles", |
| | | String.valueOf(tempSchemaFiles)); |
| | | |
| | | if ((tempSchemaFiles == null) || tempSchemaFiles.isEmpty()) |
| | | { |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "cleanUpTempSchemaFiles", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | ModifyDNOperation modifyDNOperation) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "renameEntry", String.valueOf(currentDN), |
| | | String.valueOf(entry), String.valueOf(modifyDNOperation)); |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_DN_NOT_SUPPORTED; |
| | | String message = getMessage(msgID, String.valueOf(currentDN)); |
| | |
| | | public void search(SearchOperation searchOperation) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "search", String.valueOf(searchOperation)); |
| | | |
| | | DN baseDN = searchOperation.getBaseDN(); |
| | | |
| | |
| | | */ |
| | | public HashSet<String> getSupportedControls() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getSupportedControls"); |
| | | |
| | | return supportedControls; |
| | | } |
| | |
| | | */ |
| | | public HashSet<String> getSupportedFeatures() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getSupportedFeatures"); |
| | | |
| | | return supportedFeatures; |
| | | } |
| | |
| | | */ |
| | | public boolean supportsLDIFExport() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "supportsLDIFExport"); |
| | | |
| | | // We will only export the DSE entry itself. |
| | | return true; |
| | |
| | | LDIFExportConfig exportConfig) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "exportLDIF", String.valueOf(exportConfig)); |
| | | |
| | | |
| | | // Create the LDIF writer. |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "exportLDIF", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_UNABLE_TO_CREATE_LDIF_WRITER; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "exportLDIF", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_UNABLE_TO_EXPORT_BASE; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "exportLDIF", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | public boolean supportsLDIFImport() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "supportsLDIFImport"); |
| | | |
| | | // This backend does not support LDIF imports. |
| | | // FIXME -- Should we support them? |
| | |
| | | LDIFImportConfig importConfig) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "importLDIF", String.valueOf(importConfig)); |
| | | |
| | | |
| | | // This backend does not support LDIF imports. |
| | |
| | | */ |
| | | public boolean supportsBackup() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "supportsBackup"); |
| | | |
| | | // We do support an online backup mechanism for the schema. |
| | | return true; |
| | |
| | | public boolean supportsBackup(BackupConfig backupConfig, |
| | | StringBuilder unsupportedReason) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "supportsBackup"); |
| | | |
| | | |
| | | // We should support online backup for the schema in any form. This |
| | |
| | | public void createBackup(ConfigEntry configEntry, BackupConfig backupConfig) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "createBackup", |
| | | String.valueOf(configEntry), |
| | | String.valueOf(backupConfig)); |
| | | |
| | | |
| | | // Get the properties to use for the backup. We don't care whether or not |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "createBackup", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_BACKUP_CANNOT_GET_MAC; |
| | | String message = getMessage(msgID, macAlgorithm, |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "createBackup", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_BACKUP_CANNOT_GET_DIGEST; |
| | | String message = getMessage(msgID, digestAlgorithm, |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "createBackup", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_BACKUP_CANNOT_CREATE_ARCHIVE_FILE; |
| | | String message = getMessage(msgID, String.valueOf(filename), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "createBackup", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_BACKUP_CANNOT_GET_CIPHER; |
| | | String message = getMessage(msgID, cipherAlgorithm, |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "createBackup", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_SCHEMA_BACKUP_CANNOT_LIST_SCHEMA_FILES; |
| | | message = getMessage(msgID, schemaDirPath, |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "createBackup", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | try |
| | | { |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "createBackup", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_SCHEMA_BACKUP_CANNOT_CLOSE_ZIP_STREAM; |
| | | message = getMessage(msgID, filename, backupDirectory.getPath(), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "createBackup", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_SCHEMA_BACKUP_CANNOT_UPDATE_BACKUP_DESCRIPTOR; |
| | | message = getMessage(msgID, backupDirectory.getDescriptorPath(), |
| | |
| | | String backupID) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "removeBackup", |
| | | String.valueOf(backupDirectory), |
| | | String.valueOf(backupID)); |
| | | |
| | | |
| | | // This backend does not provide a backup/restore mechanism. |
| | |
| | | */ |
| | | public boolean supportsRestore() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "supportsRestore"); |
| | | |
| | | |
| | | // We will provide a restore, but only for offline operations. |
| | |
| | | RestoreConfig restoreConfig) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "restoreBackup", String.valueOf(configEntry), |
| | | String.valueOf(restoreConfig)); |
| | | |
| | | |
| | | // First, make sure that the requested backup exists. |
| | |
| | | */ |
| | | public DN getConfigurableComponentEntryDN() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getConfigurableComponentEntryDN"); |
| | | |
| | | return configEntryDN; |
| | | } |
| | |
| | | */ |
| | | public List<ConfigAttribute> getConfigurationAttributes() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getConfigurationAttributes"); |
| | | |
| | | LinkedList<ConfigAttribute> attrList = new LinkedList<ConfigAttribute>(); |
| | | |
| | |
| | | public boolean hasAcceptableConfiguration(ConfigEntry configEntry, |
| | | List<String> unacceptableReasons) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "hasAcceptableConfiguration", |
| | | String.valueOf(configEntry), "java.util.List<String>"); |
| | | |
| | | |
| | | boolean configIsAcceptable = true; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "initializeBackend", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_CANNOT_DETERMINE_BASE_DN; |
| | | String message = getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "initializeBackend", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_SCHEMA_CANNOT_DETERMINE_SHOW_ALL; |
| | | String message = getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | public ConfigChangeResult applyNewConfiguration(ConfigEntry configEntry, |
| | | boolean detailedResults) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "applyNewConfiguration", |
| | | String.valueOf(configEntry), |
| | | String.valueOf(detailedResults)); |
| | | |
| | | |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "applyNewConfiguration", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_SCHEMA_CANNOT_DETERMINE_BASE_DN; |
| | | messages.add(getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "applyNewConfiguration", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_SCHEMA_CANNOT_DETERMINE_SHOW_ALL; |
| | | messages.add(getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "applyNewConfiguration", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_SCHEMA_CANNOT_DEREGISTER_BASE_DN; |
| | | messages.add(getMessage(msgID, String.valueOf(dn), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "applyNewConfiguration", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_SCHEMA_CANNOT_REGISTER_BASE_DN; |
| | | messages.add(getMessage(msgID, String.valueOf(dn), |
| | |
| | | */ |
| | | boolean showAllAttributes() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "showAllAttributes"); |
| | | |
| | | return showAllAttributes; |
| | | } |
| | |
| | | */ |
| | | void setShowAllAttributes(boolean showAllAttributes) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setShowAllAttributes", |
| | | String.valueOf(showAllAttributes)); |
| | | |
| | | this.showAllAttributes = showAllAttributes; |
| | | } |
| | |
| | | */ |
| | | public DN getComponentEntryDN() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getComponentEntryDN"); |
| | | |
| | | return configEntryDN; |
| | | } |
| | |
| | | */ |
| | | public String getClassName() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getClassName"); |
| | | |
| | | return CLASS_NAME; |
| | | } |
| | |
| | | */ |
| | | public LinkedHashMap<String,String> getAlerts() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getAlerts"); |
| | | |
| | | LinkedHashMap<String,String> alerts = new LinkedHashMap<String,String>(); |
| | | |