| | |
| | | public void initializeBackend(ConfigEntry configEntry, DN[] baseDNs) |
| | | throws ConfigException, InitializationException |
| | | { |
| | | |
| | | |
| | | // Make sure that a configuration entry was provided. If not, then we will |
| | | // not be able to complete initialization. |
| | | if (configEntry == null) |
| | |
| | | */ |
| | | public void finalizeBackend() |
| | | { |
| | | |
| | | DirectoryServer.deregisterConfigurableComponent(this); |
| | | |
| | | for (DN baseDN : baseDNs) |
| | |
| | | */ |
| | | private boolean isSchemaConfigAttribute(Attribute attribute) |
| | | { |
| | | |
| | | AttributeType attrType = attribute.getAttributeType(); |
| | | if (attrType.hasName(ATTR_SCHEMA_ENTRY_DN.toLowerCase()) || |
| | | attrType.hasName(ATTR_BACKEND_ENABLED.toLowerCase()) || |
| | |
| | | */ |
| | | public DN[] getBaseDNs() |
| | | { |
| | | |
| | | return baseDNs; |
| | | } |
| | | |
| | |
| | | */ |
| | | public long getEntryCount() |
| | | { |
| | | |
| | | // There is always only a single entry in this backend. |
| | | return 1; |
| | | } |
| | |
| | | */ |
| | | public boolean isLocal() |
| | | { |
| | | |
| | | // For the purposes of this method, this is a local backend. |
| | | return true; |
| | | } |
| | |
| | | public Entry getEntry(DN entryDN) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // If the requested entry was one of the schema entries, then create and |
| | | // return it. |
| | | DN[] dnArray = baseDNs; |
| | |
| | | */ |
| | | public Entry getSchemaEntry(DN entryDN) |
| | | { |
| | | |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttrs = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(); |
| | | |
| | |
| | | public boolean entryExists(DN entryDN) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // The specified DN must be one of the specified schema DNs. |
| | | DN[] baseArray = baseDNs; |
| | | for (DN baseDN : baseArray) |
| | |
| | | public void addEntry(Entry entry, AddOperation addOperation) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | int msgID = MSGID_SCHEMA_ADD_NOT_SUPPORTED; |
| | | String message = getMessage(msgID, String.valueOf(entry.getDN())); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | |
| | | public void deleteEntry(DN entryDN, DeleteOperation deleteOperation) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | int msgID = MSGID_SCHEMA_DELETE_NOT_SUPPORTED; |
| | | String message = getMessage(msgID, String.valueOf(entryDN)); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | |
| | | public void replaceEntry(Entry entry, ModifyOperation modifyOperation) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // Make sure that the authenticated user has the necessary UPDATE_SCHEMA |
| | | // privilege. |
| | | ClientConnection clientConnection = modifyOperation.getClientConnection(); |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // First, see if the specified attribute type already exists. We'll check |
| | | // the OID and all of the names, which means that it's possible there could |
| | | // be more than one match (although if there is, then we'll refuse the |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // See if the specified attribute type is actually defined in the server |
| | | // schema. If not, then fail. |
| | | AttributeType removeType = schema.getAttributeType(attributeType.getOID()); |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // First, see if the specified objectclass already exists. We'll check the |
| | | // OID and all of the names, which means that it's possible there could be |
| | | // more than one match (although if there is, then we'll refuse the |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // See if the specified objectclass is actually defined in the server |
| | | // schema. If not, then fail. |
| | | ObjectClass removeClass = schema.getObjectClass(objectClass.getOID()); |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // First, see if the specified name form already exists. We'll check the |
| | | // OID and all of the names, which means that it's possible there could be |
| | | // more than one match (although if there is, then we'll refuse the |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // See if the specified name form is actually defined in the server schema. |
| | | // If not, then fail. |
| | | NameForm removeNF = schema.getNameForm(nameForm.getOID()); |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // First, see if the specified DIT content rule already exists. We'll check |
| | | // all of the names, which means that it's possible there could be more than |
| | | // one match (although if there is, then we'll refuse the operation). |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // See if the specified DIT content rule is actually defined in the server |
| | | // schema. If not, then fail. |
| | | DITContentRule removeDCR = |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // First, see if the specified DIT structure rule already exists. We'll |
| | | // check the rule ID and all of the names, which means that it's possible |
| | | // there could be more than one match (although if there is, then we'll |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // See if the specified DIT structure rule is actually defined in the server |
| | | // schema. If not, then fail. |
| | | DITStructureRule removeDSR = |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // First, see if the specified matching rule use already exists. We'll |
| | | // check all of the names, which means that it's possible that there could |
| | | // be more than one match (although if there is, then we'll refuse the |
| | |
| | | Set<String> modifiedSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // See if the specified DIT content rule is actually defined in the server |
| | | // schema. If not, then fail. |
| | | MatchingRuleUse removeMRU = |
| | |
| | | */ |
| | | private Entry createEmptySchemaEntry() |
| | | { |
| | | |
| | | LinkedHashMap<ObjectClass,String> objectClasses = |
| | | new LinkedHashMap<ObjectClass,String>(); |
| | | objectClasses.put(DirectoryServer.getTopObjectClass(), OC_TOP); |
| | |
| | | private File writeTempSchemaFile(Schema schema, String schemaFile) |
| | | throws DirectoryException, IOException, LDIFException |
| | | { |
| | | |
| | | |
| | | // Start with an empty schema entry. |
| | | Entry schemaEntry = createEmptySchemaEntry(); |
| | | |
| | |
| | | int depth) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | if (depth > 20) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_CIRCULAR_REFERENCE_AT; |
| | |
| | | int depth) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | if (depth > 20) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_CIRCULAR_REFERENCE_OC; |
| | |
| | | HashSet<DITStructureRule> addedDSRs, int depth) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | if (depth > 20) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_CIRCULAR_REFERENCE_DSR; |
| | |
| | | private void installSchemaFiles(HashMap<String,File> tempSchemaFiles) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // Create lists that will hold the three types of files we'll be dealing |
| | | // with (the temporary files that will be installed, the installed schema |
| | | // files, and the previously-installed schema files). |
| | |
| | | private void copyFile(File from, File to) |
| | | throws IOException |
| | | { |
| | | |
| | | byte[] buffer = new byte[4096]; |
| | | FileInputStream inputStream = null; |
| | | FileOutputStream outputStream = null; |
| | |
| | | */ |
| | | private void cleanUpTempSchemaFiles(HashMap<String,File> tempSchemaFiles) |
| | | { |
| | | |
| | | if ((tempSchemaFiles == null) || tempSchemaFiles.isEmpty()) |
| | | { |
| | | return; |
| | |
| | | ModifyDNOperation modifyDNOperation) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | int msgID = MSGID_SCHEMA_MODIFY_DN_NOT_SUPPORTED; |
| | | String message = getMessage(msgID, String.valueOf(currentDN)); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | |
| | | public void search(SearchOperation searchOperation) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | DN baseDN = searchOperation.getBaseDN(); |
| | | |
| | | boolean found = false; |
| | |
| | | */ |
| | | public HashSet<String> getSupportedControls() |
| | | { |
| | | |
| | | return supportedControls; |
| | | } |
| | | |
| | |
| | | */ |
| | | public HashSet<String> getSupportedFeatures() |
| | | { |
| | | |
| | | return supportedFeatures; |
| | | } |
| | | |
| | |
| | | */ |
| | | public boolean supportsLDIFExport() |
| | | { |
| | | |
| | | // We will only export the DSE entry itself. |
| | | return true; |
| | | } |
| | |
| | | LDIFExportConfig exportConfig) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // Create the LDIF writer. |
| | | LDIFWriter ldifWriter; |
| | | try |
| | |
| | | */ |
| | | public boolean supportsLDIFImport() |
| | | { |
| | | |
| | | // This backend does not support LDIF imports. |
| | | // FIXME -- Should we support them? |
| | | return false; |
| | |
| | | LDIFImportConfig importConfig) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // This backend does not support LDIF imports. |
| | | int msgID = MSGID_SCHEMA_IMPORT_NOT_SUPPORTED; |
| | | String message = getMessage(msgID); |
| | |
| | | */ |
| | | public boolean supportsBackup() |
| | | { |
| | | |
| | | // We do support an online backup mechanism for the schema. |
| | | return true; |
| | | } |
| | |
| | | public boolean supportsBackup(BackupConfig backupConfig, |
| | | StringBuilder unsupportedReason) |
| | | { |
| | | |
| | | |
| | | // We should support online backup for the schema in any form. This |
| | | // implementation does not support incremental backups, but in this case |
| | | // even if we're asked to do an incremental we'll just do a full backup |
| | |
| | | public void createBackup(ConfigEntry configEntry, BackupConfig backupConfig) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // Get the properties to use for the backup. We don't care whether or not |
| | | // it's incremental, so there's no need to get that. |
| | | String backupID = backupConfig.getBackupID(); |
| | |
| | | String backupID) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // This backend does not provide a backup/restore mechanism. |
| | | int msgID = MSGID_SCHEMA_BACKUP_AND_RESTORE_NOT_SUPPORTED; |
| | | String message = getMessage(msgID); |
| | |
| | | */ |
| | | public boolean supportsRestore() |
| | | { |
| | | |
| | | |
| | | // We will provide a restore, but only for offline operations. |
| | | return true; |
| | | } |
| | |
| | | RestoreConfig restoreConfig) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // First, make sure that the requested backup exists. |
| | | BackupDirectory backupDirectory = restoreConfig.getBackupDirectory(); |
| | | String backupPath = backupDirectory.getPath(); |
| | |
| | | */ |
| | | public DN getConfigurableComponentEntryDN() |
| | | { |
| | | |
| | | return configEntryDN; |
| | | } |
| | | |
| | |
| | | */ |
| | | public List<ConfigAttribute> getConfigurationAttributes() |
| | | { |
| | | |
| | | LinkedList<ConfigAttribute> attrList = new LinkedList<ConfigAttribute>(); |
| | | |
| | | String description = getMessage(MSGID_SCHEMA_DESCRIPTION_ENTRY_DN); |
| | |
| | | public boolean hasAcceptableConfiguration(ConfigEntry configEntry, |
| | | List<String> unacceptableReasons) |
| | | { |
| | | |
| | | |
| | | boolean configIsAcceptable = true; |
| | | |
| | | |
| | |
| | | public ConfigChangeResult applyNewConfiguration(ConfigEntry configEntry, |
| | | boolean detailedResults) |
| | | { |
| | | |
| | | |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<String> messages = new ArrayList<String>(); |
| | |
| | | */ |
| | | boolean showAllAttributes() |
| | | { |
| | | |
| | | return showAllAttributes; |
| | | } |
| | | |
| | |
| | | */ |
| | | void setShowAllAttributes(boolean showAllAttributes) |
| | | { |
| | | |
| | | this.showAllAttributes = showAllAttributes; |
| | | } |
| | | |
| | |
| | | */ |
| | | public DN getComponentEntryDN() |
| | | { |
| | | |
| | | return configEntryDN; |
| | | } |
| | | |
| | |
| | | */ |
| | | public String getClassName() |
| | | { |
| | | |
| | | return CLASS_NAME; |
| | | } |
| | | |
| | |
| | | */ |
| | | public LinkedHashMap<String,String> getAlerts() |
| | | { |
| | | |
| | | LinkedHashMap<String,String> alerts = new LinkedHashMap<String,String>(); |
| | | |
| | | alerts.put(ALERT_TYPE_CANNOT_COPY_SCHEMA_FILES, |