opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/CommandLineTool.java
@@ -11,14 +11,14 @@ * Header, with the fields enclosed by brackets [] replaced by your own identifying * information: "Portions Copyright [year] [name of copyright owner]". * * Copyright 2015 ForgeRock AS. * Copyright 2015-2016 ForgeRock AS. */ package org.forgerock.opendj.maven.doc; import java.util.List; /** * Represents a command-line tool as used in the configuration for {@see GenerateRefEntriesMojo}. * Represents a command-line tool as used in the configuration for {@link GenerateRefEntriesMojo}. * <br> * Command-line tools are associated with a script name, the Java class of the tool, * and a list of relative paths to hand-written files for trailing sections. opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexDescriptor.java
@@ -24,7 +24,7 @@ import java.util.TreeSet; import org.forgerock.opendj.ldap.schema.AttributeType; import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType;; import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType; /** * The class used to describe the index configuration (the normal index: the one opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractBrowseEntriesPanel.java
@@ -1010,7 +1010,6 @@ } } @SuppressWarnings("unchecked") final DefaultComboBoxModel<CharSequence> model = (DefaultComboBoxModel<CharSequence>) filterAttribute.getModel(); if (hasChanged(newElements, model)) { opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallCliHelper.java
@@ -17,7 +17,6 @@ package org.opends.guitools.uninstaller; import static org.forgerock.util.Utils.*; import static org.opends.admin.ads.util.ConnectionUtils.*; import static org.opends.admin.ads.util.PreferredConnection.Type.*; import static org.opends.messages.AdminToolMessages.*; import static org.opends.messages.QuickSetupMessages.*; @@ -36,8 +35,6 @@ import java.util.Set; import javax.naming.NamingException; import javax.naming.NoPermissionException; import javax.naming.ldap.InitialLdapContext; import javax.net.ssl.TrustManager; import org.forgerock.i18n.LocalizableMessage; @@ -48,7 +45,6 @@ import org.opends.admin.ads.TopologyCache; import org.opends.admin.ads.TopologyCacheException; import org.opends.admin.ads.util.ApplicationTrustManager; import org.opends.admin.ads.util.ConnectionUtils; import org.opends.admin.ads.util.ConnectionWrapper; import org.opends.admin.ads.util.PreferredConnection.Type; import org.opends.guitools.controlpanel.datamodel.ConnectionProtocolPolicy; @@ -113,8 +109,6 @@ * @param args * the ArgumentParser with the allowed arguments of the command line. * The code assumes that the arguments have already been parsed. * @param rawArguments * the arguments provided in the command line. * @return the UserData object with what the user wants to uninstall and null * if the user cancels the uninstallation. * @throws UserDataException @@ -123,7 +117,7 @@ * If there is an error processing data in non-interactive mode and * an error must be thrown (not in force on error mode). */ public UninstallUserData createUserData(UninstallerArgumentParser args, String[] rawArguments) public UninstallUserData createUserData(UninstallerArgumentParser args) throws UserDataException, ClientException { parser = args; @@ -999,10 +993,12 @@ @Override public void cancel() { // no-op } @Override public void run() { // no-op } }; application.setProgressMessageFormatter( @@ -1053,59 +1049,6 @@ } /** * Returns an InitialLdapContext using the provided parameters. We try to * guarantee that the connection is able to read the configuration. * * @param host * the host name. * @param port * the port to connect. * @param useSSL * whether to use SSL or not. * @param useStartTLS * whether to use StartTLS or not. * @param bindDn * the bind dn to be used. * @param pwd * the password. * @param connectTimeout * the timeout in milliseconds to connect to the server. * @param trustManager * the trust manager. * @return an InitialLdapContext connected. * @throws NamingException * if there was an error establishing the connection. */ private InitialLdapContext createAdministrativeContext(String host, int port, boolean useSSL, boolean useStartTLS, String bindDn, String pwd, int connectTimeout, ApplicationTrustManager trustManager) throws NamingException { InitialLdapContext ctx; String ldapUrl = ConnectionUtils.getLDAPUrl(host, port, useSSL); if (useSSL) { ctx = createLdapsContext(ldapUrl, bindDn, pwd, connectTimeout, null, trustManager, null); } else if (useStartTLS) { ctx = Utils.createStartTLSContext(ldapUrl, bindDn, pwd, connectTimeout, null, trustManager, null); } else { ctx = createLdapContext(ldapUrl, bindDn, pwd, connectTimeout, null); } if (!ConnectionUtils.connectedAsAdministrativeUser(ctx)) { throw new NoPermissionException(ERR_NOT_ADMINISTRATIVE_USER.get() .toString()); } return ctx; } /** * Updates the contents of the UninstallUserData while trying to connect to * the remote servers. It returns <CODE>true</CODE> if we could connect to the * remote servers and all the presented certificates were accepted and opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/Uninstaller.java
@@ -102,11 +102,8 @@ import static org.opends.quicksetup.util.Utils.*; import static org.opends.server.tools.ConfigureWindowsService.*; /** * This class is in charge of performing the uninstallation of Open DS. */ /** This class is in charge of performing the uninstallation of Open DS. */ public class Uninstaller extends GuiApplication implements CliApplication { private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); private ProgressStep status = UninstallProgressStep.NOT_STARTED; private boolean runStarted; @@ -155,14 +152,12 @@ logger.info(LocalizableMessage.raw("Uninstaller is created.")); } /** {@inheritDoc} */ @Override public LocalizableMessage getFrameTitle() { LocalizableMessage defaultVal = INFO_FRAME_UNINSTALL_TITLE.get(DynamicConstants.PRODUCT_NAME); return Utils.getCustomizedObject("INFO_FRAME_UNINSTALL_TITLE", defaultVal, LocalizableMessage.class); } /** {@inheritDoc} */ @Override public UserData createUserData() { UninstallUserData data = new UninstallUserData(); @@ -170,13 +165,11 @@ return data; } /** {@inheritDoc} */ @Override public WizardStep getFirstWizardStep() { return Step.CONFIRM_UNINSTALL; } /** {@inheritDoc} */ @Override public WizardStep getNextWizardStep(WizardStep step) { Step nextStep = null; @@ -190,7 +183,6 @@ return nextStep; } /** {@inheritDoc} */ @Override public WizardStep getPreviousWizardStep(WizardStep step) { Step prevStep = null; @@ -204,32 +196,27 @@ return prevStep; } /** {@inheritDoc} */ @Override public WizardStep getFinishedStep() { return Step.FINISHED; } /** {@inheritDoc} */ @Override public boolean finishOnLeft() { return false; } /** {@inheritDoc} */ @Override public boolean canGoBack(WizardStep step) { return false; } /** {@inheritDoc} */ @Override public boolean canGoForward(WizardStep step) { return false; } /** {@inheritDoc} */ @Override public boolean canFinish(WizardStep step) { return step == Step.CONFIRM_UNINSTALL; @@ -245,7 +232,6 @@ return step == Step.CONFIRM_UNINSTALL; } /** {@inheritDoc} */ @Override public void nextClicked(WizardStep cStep, QuickSetup qs) { if (cStep == PROGRESS) { @@ -257,7 +243,6 @@ } } /** {@inheritDoc} */ @Override public void closeClicked(WizardStep cStep, QuickSetup qs) { if (cStep == PROGRESS) { @@ -277,10 +262,7 @@ } } /** * Update the UserData object according to the content of the review * panel. */ /** Update the UserData object according to the content of the review panel. */ private void updateUserUninstallDataForConfirmUninstallPanel(QuickSetup qs) throws UserDataException { UninstallUserData uud = getUninstallUserData(); @@ -328,8 +310,6 @@ } } /** {@inheritDoc} */ @Override public void quitClicked(WizardStep step, QuickSetup qs) { if (step == Step.PROGRESS) { @@ -343,25 +323,21 @@ qs.quit(); } /** {@inheritDoc} */ @Override public LocalizableMessage getCloseButtonToolTip() { return INFO_CLOSE_BUTTON_UNINSTALL_TOOLTIP.get(); } /** {@inheritDoc} */ @Override public LocalizableMessage getFinishButtonToolTip() { return INFO_FINISH_BUTTON_UNINSTALL_TOOLTIP.get(); } /** {@inheritDoc} */ @Override public LocalizableMessage getFinishButtonLabel() { return INFO_FINISH_BUTTON_UNINSTALL_LABEL.get(); } /** {@inheritDoc} */ @Override public void previousClicked(WizardStep cStep, QuickSetup qs) { if (cStep == PROGRESS) { @@ -374,7 +350,6 @@ } } /** {@inheritDoc} */ @Override public void notifyListeners(Integer ratio, LocalizableMessage currentPhaseSummary, final LocalizableMessage newLogDetail) @@ -400,7 +375,6 @@ } } /** {@inheritDoc} */ @Override public boolean finishClicked(final WizardStep cStep, final QuickSetup qs) { if (cStep == Step.CONFIRM_UNINSTALL) { @@ -527,13 +501,11 @@ return false; } /** {@inheritDoc} */ @Override public void updateUserData(WizardStep step, QuickSetup qs) { // do nothing; } /** {@inheritDoc} */ @Override public void setWizardDialogState(QuickSetupDialog dlg, UserData userData, @@ -548,22 +520,19 @@ } } /** {@inheritDoc} */ @Override public UserData createUserData(Launcher launcher) throws UserDataException, ApplicationException, ClientException { parser = (UninstallerArgumentParser) launcher.getArgumentParser(); return cliHelper.createUserData(parser, launcher.getArguments()); return cliHelper.createUserData(parser); } /** {@inheritDoc} */ @Override public String getInstallationPath() { return getInstallPathFromClasspath(); } /** {@inheritDoc} */ @Override public String getInstancePath() { return getInstancePathFromInstallPath(getInstallPathFromClasspath()); @@ -581,15 +550,12 @@ return ue; } /** {@inheritDoc} */ @Override public ReturnCode getReturnCode() { return null; } /** * Initialize the different map used in this class. */ /** Initialize the different map used in this class. */ private void initMaps() { hmSummary.put(UninstallProgressStep.NOT_STARTED, getFormattedSummary(INFO_SUMMARY_UNINSTALL_NOT_STARTED.get())); @@ -714,13 +680,13 @@ totalTime += hmTime.get(UninstallProgressStep.DELETING_INSTALLATION_FILES); steps.add(UninstallProgressStep.DELETING_INSTALLATION_FILES); if (getUninstallUserData().getExternalDbsToRemove().size() > 0) { if (!getUninstallUserData().getExternalDbsToRemove().isEmpty()) { totalTime += hmTime.get( UninstallProgressStep.DELETING_EXTERNAL_DATABASE_FILES); steps.add(UninstallProgressStep.DELETING_EXTERNAL_DATABASE_FILES); } if (getUninstallUserData().getExternalLogsToRemove().size() > 0) { if (!getUninstallUserData().getExternalLogsToRemove().isEmpty()) { totalTime += hmTime.get( UninstallProgressStep.DELETING_EXTERNAL_LOG_FILES); steps.add(UninstallProgressStep.DELETING_EXTERNAL_LOG_FILES); @@ -740,9 +706,7 @@ hmRatio.put(UninstallProgressStep.FINISHED_WITH_ERROR, 100); } /** * Actually performs the uninstall in this thread. The thread is blocked. */ /** Actually performs the uninstall in this thread. The thread is blocked. */ @Override public void run() { runStarted = true; @@ -911,7 +875,6 @@ } else { notifyListeners(null); } } catch (ApplicationException ex) { logger.error(LocalizableMessage.raw("Error: "+ex, ex)); ue = ex; @@ -934,7 +897,6 @@ } } /** {@inheritDoc} */ @Override public ProgressStep getCurrentProgressStep() { return status; @@ -966,7 +928,6 @@ return hmSummary.get(step); } /** {@inheritDoc} */ @Override public boolean isFinished() { return getCurrentProgressStep() == @@ -979,19 +940,16 @@ UninstallProgressStep.FINISHED_WITH_ERROR_DELETING; } /** {@inheritDoc} */ @Override public boolean isCancellable() { return false; } /** {@inheritDoc} */ @Override public void cancel() { // do nothing; not cancellable } /** {@inheritDoc} */ @Override public void windowClosing(QuickSetupDialog dlg, WindowEvent evt) { if (dlg.getDisplayedStep() == PROGRESS || @@ -1004,13 +962,11 @@ } } /** {@inheritDoc} */ @Override public ButtonName getInitialFocusButtonName() { return ButtonName.FINISH; } /** {@inheritDoc} */ @Override public Set<? extends WizardStep> getWizardSteps() { Set<WizardStep> setSteps = new HashSet<>(); @@ -1020,7 +976,6 @@ return Collections.unmodifiableSet(setSteps); } /** {@inheritDoc} */ @Override public QuickSetupStepPanel createWizardStepPanel(WizardStep step) { if (step == Step.CONFIRM_UNINSTALL) { @@ -1159,9 +1114,7 @@ } if (rootFiles != null) { /* The following is done to have a moving progress bar when we delete * the installation files. */ // The following is done to have a moving progress bar when we delete the installation files int totalRatio = 0; ArrayList<Integer> cumulatedRatio = new ArrayList<>(); for (File f : rootFiles) { @@ -1351,10 +1304,8 @@ private boolean canDeleteClassesDir = !Utils.directoryExistsAndIsNotEmpty(classesDir.getAbsolutePath()); private File installationPath = installation.getRootDirectory(); /** {@inheritDoc} */ @Override public boolean accept(File file) { UninstallUserData userData = getUninstallUserData(); @@ -1421,7 +1372,6 @@ return isWindowsServiceEnabled.booleanValue(); } /** {@inheritDoc} */ @Override public ApplicationTrustManager getTrustManager() { @@ -2236,4 +2186,3 @@ return getUserData().getConnectTimeout(); } } opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/DataOptionsPanel.java
@@ -12,7 +12,7 @@ * information: "Portions Copyright [year] [name of copyright owner]". * * Copyright 2006-2009 Sun Microsystems, Inc. * Portions Copyright 2014-2015 ForgeRock AS. * Portions Copyright 2014-2016 ForgeRock AS. */ package org.opends.quicksetup.installer.ui; @@ -87,7 +87,7 @@ addActionListeners(); } /** {@inheritDoc} */ @Override public Object getFieldValue(FieldName fieldName) { if (fieldName == FieldName.DATA_OPTIONS) @@ -116,7 +116,7 @@ return null; } /** {@inheritDoc} */ @Override public void displayFieldInvalid(final FieldName fieldName, final boolean invalid) { final JLabel label = getLabel(fieldName); @@ -137,7 +137,7 @@ } } /** {@inheritDoc} */ @Override protected Component createInputPanel() { JPanel panel = new JPanel(new GridBagLayout()); @@ -328,19 +328,19 @@ return Utilities.createBrowseButtonPanel(getLabel(fieldName), getField(fieldName), browseButton); } /** {@inheritDoc} */ @Override protected LocalizableMessage getInstructions() { return INFO_DATA_OPTIONS_PANEL_INSTRUCTIONS.get(); } /** {@inheritDoc} */ @Override protected LocalizableMessage getTitle() { return INFO_DATA_OPTIONS_PANEL_TITLE.get(); } /** {@inheritDoc} */ @Override public void endDisplay() { if (lastFocusComponent != null) @@ -488,18 +488,21 @@ { final DocumentListener docListener = new DocumentListener() { @Override public void changedUpdate(DocumentEvent ev) { final LocalizableMessage newLabel = INFO_CREATE_BASE_ENTRY_LABEL.get((String) getFieldValue(FieldName.DIRECTORY_BASE_DN)); INFO_CREATE_BASE_ENTRY_LABEL.get(getFieldValue(FieldName.DIRECTORY_BASE_DN)); getRadioButton(NewSuffixOptions.Type.CREATE_BASE_ENTRY).setText(newLabel.toString()); } @Override public void insertUpdate(DocumentEvent ev) { changedUpdate(ev); } @Override public void removeUpdate(DocumentEvent ev) { changedUpdate(ev); @@ -514,6 +517,7 @@ { final FocusListener focusListener = new FocusListener() { @Override public void focusGained(FocusEvent e) { lastFocusComponent = e.getComponent(); @@ -527,6 +531,7 @@ } } @Override public void focusLost(FocusEvent e) { } @@ -550,6 +555,7 @@ { final ActionListener l = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { checkEnablingState(); opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackendStat.java
@@ -37,10 +37,11 @@ import org.forgerock.opendj.config.SizeUnit; import org.forgerock.opendj.config.server.ConfigException; import org.forgerock.opendj.ldap.ByteString; import org.forgerock.util.Option; import org.forgerock.util.Options; import org.forgerock.opendj.ldap.DN; import org.forgerock.opendj.server.config.server.BackendCfg; import org.forgerock.opendj.server.config.server.PluggableBackendCfg; import org.forgerock.util.Option; import org.forgerock.util.Options; import org.opends.server.api.Backend; import org.opends.server.backends.pluggable.spi.Cursor; import org.opends.server.backends.pluggable.spi.ReadOperation; @@ -52,7 +53,6 @@ import org.opends.server.core.LockFileManager; import org.opends.server.loggers.JDKLogging; import org.opends.server.tools.BackendToolUtils; import org.forgerock.opendj.ldap.DN; import org.opends.server.types.DirectoryException; import org.opends.server.types.InitializationException; import org.opends.server.types.NullOutputStream; @@ -596,7 +596,7 @@ { return listRootContainers(); } BackendImpl backend = getBackendById(subCommand.getArgument(BACKENDID_NAME)); BackendImpl<?> backend = getBackendById(subCommand.getArgument(BACKENDID_NAME)); if (backend == null) { return 1; @@ -639,16 +639,7 @@ } } private String getStartUpExceptionMessage(Exception e) { if (e instanceof ConfigException || e instanceof InitializationException) { return e.getMessage(); } return getExceptionMessage(e).toString(); } private int dumpTree(RootContainer rc, BackendImpl backend, SubCommand subCommand, boolean isBackendTree) private int dumpTree(RootContainer rc, BackendImpl<?> backend, SubCommand subCommand, boolean isBackendTree) throws ArgumentException, DirectoryException { Options options = Options.defaultOptions(); @@ -730,8 +721,8 @@ builder.appendHeading(INFO_LABEL_BACKEND_DEBUG_BACKEND_ID.get()); builder.appendHeading(INFO_LABEL_BACKEND_TOOL_STORAGE.get()); final Map<PluggableBackendCfg, BackendImpl> pluggableBackends = getPluggableBackends(); for (Map.Entry<PluggableBackendCfg, BackendImpl> backend : pluggableBackends.entrySet()) final Map<PluggableBackendCfg, BackendImpl<?>> pluggableBackends = getPluggableBackends(); for (Map.Entry<PluggableBackendCfg, BackendImpl<?>> backend : pluggableBackends.entrySet()) { builder.startRow(); builder.appendCell(backend.getValue().getBackendID()); @@ -837,7 +828,7 @@ } } private int listIndexes(RootContainer rc, BackendImpl backend, Argument baseDNArg) throws DirectoryException private int listIndexes(RootContainer rc, BackendImpl<?> backend, Argument baseDNArg) throws DirectoryException { DN base = null; if (baseDNArg.isPresent()) @@ -886,7 +877,7 @@ } } private int printEntryContainerError(BackendImpl backend, DN base) private int printEntryContainerError(BackendImpl<?> backend, DN base) { printWrappedText(err, ERR_BACKEND_DEBUG_NO_ENTRY_CONTAINERS_FOR_BASE_DN.get(base, backend.getBackendID())); return 1; @@ -905,7 +896,7 @@ } } private RootContainer getAndLockRootContainer(BackendImpl backend) private RootContainer getAndLockRootContainer(BackendImpl<?> backend) { try { @@ -983,7 +974,7 @@ } } private void releaseExclusiveLock(BackendImpl backend) private void releaseExclusiveLock(BackendImpl<?> backend) { try { @@ -1001,12 +992,12 @@ } } private BackendImpl getBackendById(Argument backendIdArg) private BackendImpl<?> getBackendById(Argument backendIdArg) { final String backendID = backendIdArg.getValue(); final Map<PluggableBackendCfg, BackendImpl> pluggableBackends = getPluggableBackends(); final Map<PluggableBackendCfg, BackendImpl<?>> pluggableBackends = getPluggableBackends(); for (Map.Entry<PluggableBackendCfg, BackendImpl> backend : pluggableBackends.entrySet()) for (Map.Entry<PluggableBackendCfg, BackendImpl<?>> backend : pluggableBackends.entrySet()) { final BackendImpl b = backend.getValue(); if (b.getBackendID().equalsIgnoreCase(backendID)) @@ -1028,7 +1019,7 @@ return null; } private int showIndexStatus(RootContainer rc, BackendImpl backend, Argument baseDNArg) throws DirectoryException private int showIndexStatus(RootContainer rc, BackendImpl<?> backend, Argument baseDNArg) throws DirectoryException { DN base = getBaseDNFromArg(baseDNArg); @@ -1194,7 +1185,7 @@ } } private int dumpStorageTree(RootContainer rc, BackendImpl backend, Argument treeNameArg, Options options) private int dumpStorageTree(RootContainer rc, BackendImpl<?> backend, Argument treeNameArg, Options options) { TreeName targetTree = getStorageTreeName(treeNameArg, rc); if (targetTree == null) @@ -1228,7 +1219,7 @@ return null; } private int dumpBackendTree(RootContainer rc, BackendImpl backend, Argument baseDNArg, Argument treeNameArg, private int dumpBackendTree(RootContainer rc, BackendImpl<?> backend, Argument baseDNArg, Argument treeNameArg, Options options) throws DirectoryException { DN base = getBaseDNFromArg(baseDNArg); @@ -1441,20 +1432,20 @@ out.format(HEXDUMP_LINE_FORMAT, indentBuilder.toString(), hexDump.toString(), asciiDump.toString()); } private static Map<PluggableBackendCfg, BackendImpl> getPluggableBackends() private static Map<PluggableBackendCfg, BackendImpl<?>> getPluggableBackends() { ArrayList<Backend> backendList = new ArrayList<>(); ArrayList<BackendCfg> entryList = new ArrayList<>(); ArrayList<List<DN>> dnList = new ArrayList<>(); List<Backend<?>> backendList = new ArrayList<>(); List<BackendCfg> entryList = new ArrayList<>(); List<List<DN>> dnList = new ArrayList<>(); BackendToolUtils.getBackends(backendList, entryList, dnList); final Map<PluggableBackendCfg, BackendImpl> pluggableBackends = new LinkedHashMap<>(); final Map<PluggableBackendCfg, BackendImpl<?>> pluggableBackends = new LinkedHashMap<>(); for (int i = 0; i < backendList.size(); i++) { Backend<?> backend = backendList.get(i); if (backend instanceof BackendImpl) { pluggableBackends.put((PluggableBackendCfg) entryList.get(i), (BackendImpl) backend); pluggableBackends.put((PluggableBackendCfg) entryList.get(i), (BackendImpl<?>) backend); } } return pluggableBackends; opendj-server-legacy/src/main/java/org/opends/server/core/AccessControlConfigManager.java
@@ -27,17 +27,17 @@ import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.config.server.ConfigException; import org.forgerock.opendj.ldap.ResultCode; import org.forgerock.util.Utils; import org.forgerock.opendj.config.ClassPropertyDefinition; import org.forgerock.opendj.config.server.ConfigChangeResult; import org.forgerock.opendj.config.server.ConfigException; import org.forgerock.opendj.config.server.ConfigurationChangeListener; import org.forgerock.opendj.ldap.DN; import org.forgerock.opendj.ldap.ResultCode; import org.forgerock.opendj.server.config.meta.AccessControlHandlerCfgDefn; import org.forgerock.opendj.server.config.server.AccessControlHandlerCfg; import org.forgerock.util.Utils; import org.opends.server.api.AccessControlHandler; import org.opends.server.api.AlertGenerator; import org.forgerock.opendj.config.server.ConfigChangeResult; import org.forgerock.opendj.ldap.DN; import org.opends.server.types.InitializationException; /** @@ -60,26 +60,20 @@ private static AccessControlConfigManager instance; /** The active access control implementation. */ private AtomicReference<AccessControlHandler> accessControlHandler; private AtomicReference<AccessControlHandler<?>> accessControlHandler; /** The current configuration. */ private AccessControlHandlerCfg currentConfiguration; private ServerContext serverContext; /** * Creates a new instance of this access control configuration * manager. */ /** Creates a new instance of this access control configuration manager. */ private AccessControlConfigManager() { this.accessControlHandler = new AtomicReference<AccessControlHandler>( new DefaultAccessControlHandler()); this.accessControlHandler = new AtomicReference<AccessControlHandler<?>>(new DefaultAccessControlHandler()); this.currentConfiguration = null; } /** * Get the single application-wide access control manager instance. * @@ -95,8 +89,6 @@ return instance; } /** * Determine if access control is enabled according to the current * configuration. @@ -109,8 +101,6 @@ return currentConfiguration.isEnabled(); } /** * Get the active access control handler. * <p> @@ -124,8 +114,6 @@ return accessControlHandler.get(); } /** * Initializes the access control sub-system. This should only be called at * Directory Server startup. If an error occurs then an exception will be @@ -162,8 +150,6 @@ updateConfiguration(accessControlConfiguration); } /** * Updates the access control configuration based on the contents of a * valid configuration entry. @@ -205,7 +191,7 @@ String oldHandlerClass = currentConfiguration.getJavaClass(); //Check if moving from not enabled to enabled state. if(!enabledOld) { AccessControlHandler oldHandler = AccessControlHandler<?> oldHandler = accessControlHandler.getAndSet(getHandler(newHandlerClass, newConfiguration, true, true)); @@ -213,9 +199,8 @@ } else { //Check if the class name is being changed. if(!newHandlerClass.equals(oldHandlerClass)) { AccessControlHandler oldHandler = accessControlHandler.getAndSet(getHandler(newHandlerClass, newConfiguration, true, true)); AccessControlHandler<?> oldHandler = accessControlHandler.getAndSet(getHandler(newHandlerClass, newConfiguration, true, true)); oldHandler.finalizeAccessControlHandler(); } else { //Some other attribute has changed, try to get a new non-initialized @@ -227,9 +212,8 @@ //Access control has been disabled, switch to the default handler and //finalize the old handler. newHandlerClass = DefaultAccessControlHandler.class.getName(); AccessControlHandler oldHandler = accessControlHandler.getAndSet(getHandler(newHandlerClass, newConfiguration, false, true)); AccessControlHandler<?> oldHandler = accessControlHandler.getAndSet(getHandler(newHandlerClass, newConfiguration, false, true)); oldHandler.finalizeAccessControlHandler(); } } @@ -289,8 +273,6 @@ return newHandler; } /** {@inheritDoc} */ @Override public boolean isConfigurationChangeAcceptable( AccessControlHandlerCfg configuration, @@ -315,9 +297,6 @@ return true; } /** {@inheritDoc} */ @Override public ConfigChangeResult applyConfigurationChange( AccessControlHandlerCfg configuration) @@ -343,27 +322,18 @@ return ccr; } /** {@inheritDoc} */ @Override public DN getComponentEntryDN() { return currentConfiguration.dn(); } /** {@inheritDoc} */ @Override public String getClassName() { return CLASS_NAME; } /** {@inheritDoc} */ @Override public LinkedHashMap<String,String> getAlerts() { @@ -377,8 +347,6 @@ return alerts; } /** * Loads the specified class, instantiates it as a AccessControlHandler, and * optionally initializes that instance. @@ -440,4 +408,3 @@ } } } opendj-server-legacy/src/main/java/org/opends/server/core/AlertHandlerConfigManager.java
@@ -22,19 +22,19 @@ import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.ldap.ResultCode; import org.forgerock.util.Utils; import org.forgerock.opendj.config.ClassPropertyDefinition; import org.forgerock.opendj.config.server.ConfigChangeResult; import org.forgerock.opendj.config.server.ConfigException; import org.forgerock.opendj.config.server.ConfigurationAddListener; import org.forgerock.opendj.config.server.ConfigurationChangeListener; import org.forgerock.opendj.config.server.ConfigurationDeleteListener; import org.forgerock.opendj.ldap.DN; import org.forgerock.opendj.ldap.ResultCode; import org.forgerock.opendj.server.config.meta.AlertHandlerCfgDefn; import org.forgerock.opendj.server.config.server.AlertHandlerCfg; import org.forgerock.opendj.server.config.server.RootCfg; import org.forgerock.util.Utils; import org.opends.server.api.AlertHandler; import org.forgerock.opendj.config.server.ConfigException; import org.forgerock.opendj.config.server.ConfigChangeResult; import org.forgerock.opendj.ldap.DN; import org.opends.server.types.InitializationException; import static org.opends.messages.ConfigMessages.*; @@ -56,7 +56,7 @@ private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); /** A mapping between the DNs of the config entries and the associated alert handlers. */ private final ConcurrentHashMap<DN,AlertHandler> alertHandlers; private final ConcurrentHashMap<DN, AlertHandler<?>> alertHandlers; private final ServerContext serverContext; @@ -102,7 +102,7 @@ String className = configuration.getJavaClass(); try { AlertHandler handler = loadHandler(className, configuration, true); AlertHandler<?> handler = loadHandler(className, configuration, true); alertHandlers.put(configuration.dn(), handler); DirectoryServer.registerAlertHandler(handler); } @@ -157,10 +157,9 @@ return ccr; } AlertHandler alertHandler = null; AlertHandler<?> alertHandler = null; // Get the name of the class and make sure we can instantiate it as an alert // handler. // Get the name of the class and make sure we can instantiate it as an alert handler String className = configuration.getJavaClass(); try { @@ -203,7 +202,7 @@ { final ConfigChangeResult ccr = new ConfigChangeResult(); AlertHandler alertHandler = alertHandlers.remove(configuration.dn()); AlertHandler<?> alertHandler = alertHandlers.remove(configuration.dn()); if (alertHandler != null) { DirectoryServer.deregisterAlertHandler(alertHandler); @@ -251,7 +250,7 @@ // Get the existing alert handler if it's already enabled. AlertHandler existingHandler = alertHandlers.get(configuration.dn()); AlertHandler<?> existingHandler = alertHandlers.get(configuration.dn()); // If the new configuration has the handler disabled, then disable it if it @@ -262,7 +261,7 @@ { DirectoryServer.deregisterAlertHandler(existingHandler); AlertHandler alertHandler = alertHandlers.remove(configuration.dn()); AlertHandler<?> alertHandler = alertHandlers.remove(configuration.dn()); if (alertHandler != null) { alertHandler.finalizeAlertHandler(); @@ -289,7 +288,7 @@ return ccr; } AlertHandler alertHandler = null; AlertHandler<?> alertHandler = null; try { alertHandler = loadHandler(className, configuration, true); @@ -327,7 +326,7 @@ * @throws InitializationException If a problem occurred while attempting to * initialize the alert handler. */ private AlertHandler loadHandler(String className, private AlertHandler<?> loadHandler(String className, AlertHandlerCfg configuration, boolean initialize) throws InitializationException @@ -366,4 +365,3 @@ } } } opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -62,7 +62,6 @@ import org.forgerock.http.routing.Router; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.LocalizedIllegalArgumentException; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.adapter.server3x.Converters; import org.forgerock.opendj.config.ConfigurationFramework; @@ -1771,19 +1770,6 @@ compressedSchema = new DefaultCompressedSchema(serverContext); } private DN toDn(String dn) throws InitializationException { try { return DN.valueOf(dn); } catch (LocalizedIllegalArgumentException e) { // This should never happen, so we'll just re-throw it. throw new InitializationException(e.getMessageObject(), e); } } /** * Retrieves the default compressed schema manager for the Directory Server. * opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyFactory.java
@@ -22,22 +22,36 @@ import static org.opends.server.util.StaticUtils.*; import java.text.SimpleDateFormat; import java.util.*; import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.SortedSet; import java.util.TimeZone; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.config.server.ConfigChangeResult; import org.forgerock.opendj.config.server.ConfigException; import org.forgerock.opendj.config.server.ConfigurationChangeListener; import org.forgerock.opendj.ldap.ByteString; import org.forgerock.opendj.ldap.DN; import org.forgerock.opendj.ldap.GeneralizedTime; import org.forgerock.opendj.ldap.ResultCode; import org.forgerock.opendj.config.server.ConfigurationChangeListener; import org.forgerock.opendj.ldap.schema.AttributeType; import org.forgerock.opendj.server.config.meta.PasswordPolicyCfgDefn.StateUpdateFailurePolicy; import org.forgerock.opendj.server.config.server.PasswordPolicyCfg; import org.opends.server.api.*; import org.forgerock.opendj.ldap.schema.AttributeType; import org.opends.server.types.*; import org.opends.server.api.AccountStatusNotificationHandler; import org.opends.server.api.AuthenticationPolicyFactory; import org.opends.server.api.PasswordGenerator; import org.opends.server.api.PasswordStorageScheme; import org.opends.server.api.PasswordValidator; import org.opends.server.types.InitializationException; import org.opends.server.util.SchemaUtils; import org.opends.server.util.SchemaUtils.PasswordType; @@ -54,11 +68,7 @@ { private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); /** * Password policy implementation. */ /** Password policy implementation. */ private static final class PasswordPolicyImpl extends PasswordPolicy implements ConfigurationChangeListener<PasswordPolicyCfg> { @@ -72,43 +82,28 @@ /** The set of account status notification handlers for this password policy. */ private Map<DN, AccountStatusNotificationHandler<?>> notificationHandlers; /** * The set of password validators that will be used with this * password policy. */ /** The set of password validators that will be used with this password policy. */ private Map<DN, PasswordValidator<?>> passwordValidators; /** * The set of default password storage schemes for this password policy. */ /** The set of default password storage schemes for this password policy. */ private List<PasswordStorageScheme<?>> defaultStorageSchemes; /** * The names of the deprecated password storage schemes for this password * policy. */ /** The names of the deprecated password storage schemes for this password policy. */ private Set<String> deprecatedStorageSchemes; /** The password generator for use with this password policy. */ private PasswordGenerator<?> passwordGenerator; /** * The the time by which all users will be required to change their * passwords. */ /** The the time by which all users will be required to change their passwords. */ private long requireChangeByTime; private final ServerContext serverContext; /** {@inheritDoc} */ @Override public void finalizeAuthenticationPolicy() { configuration.removePasswordPolicyChangeListener(this); } /** {@inheritDoc} */ @Override public ConfigChangeResult applyConfigurationChange(PasswordPolicyCfg configuration) { @@ -137,7 +132,6 @@ return ccr; } /** {@inheritDoc} */ @Override public boolean isConfigurationChangeAcceptable( PasswordPolicyCfg configuration, List<LocalizableMessage> unacceptableReasons) @@ -165,8 +159,6 @@ return true; } /** * Creates a new password policy based on the configuration contained in the * provided configuration entry. Any parameters not included in the provided @@ -190,8 +182,6 @@ updateConfiguration(configuration, true); } private void updateConfiguration(PasswordPolicyCfg configuration, boolean applyChanges) throws ConfigException, InitializationException @@ -202,11 +192,11 @@ // user password or auth password syntax. final AttributeType passwordAttribute = configuration.getPasswordAttribute(); final PasswordType passwordType = SchemaUtils.checkPasswordType(passwordAttribute); if (passwordType.equals(PasswordType.AUTH_PASSWORD)) if (PasswordType.AUTH_PASSWORD.equals(passwordType)) { authPasswordSyntax = true; } else if (passwordType.equals(PasswordType.USER_PASSWORD)) else if (PasswordType.USER_PASSWORD.equals(passwordType)) { authPasswordSyntax = false; } @@ -331,16 +321,13 @@ catch (Exception e) { logger.traceException(e); LocalizableMessage message = ERR_PWPOLICY_INVALID_LAST_LOGIN_TIME_FORMAT.get(configEntryDN, formatString); throw new ConfigException(message); throw new ConfigException(ERR_PWPOLICY_INVALID_LAST_LOGIN_TIME_FORMAT.get(configEntryDN, formatString)); } } // Get the previous last login time formats. If specified, they must all // be valid format strings. SortedSet<String> formatStrings = configuration .getPreviousLastLoginTimeFormat(); SortedSet<String> formatStrings = configuration.getPreviousLastLoginTimeFormat(); if (formatStrings != null) { for (String s : formatStrings) @@ -352,10 +339,7 @@ catch (Exception e) { logger.traceException(e); LocalizableMessage message = ERR_PWPOLICY_INVALID_PREVIOUS_LAST_LOGIN_TIME_FORMAT.get(configEntryDN, s); throw new ConfigException(message); throw new ConfigException(ERR_PWPOLICY_INVALID_PREVIOUS_LAST_LOGIN_TIME_FORMAT.get(configEntryDN, s)); } } } @@ -390,7 +374,6 @@ if (applyChanges) { this.configuration = configuration; this.authPasswordSyntax = authPasswordSyntax; this.defaultStorageSchemes = defaultStorageSchemes; this.deprecatedStorageSchemes = deprecatedStorageSchemes; this.notificationHandlers = notificationHandlers; @@ -400,74 +383,59 @@ } } /** {@inheritDoc} */ @Override public boolean isAuthPasswordSyntax() { return authPasswordSyntax; } /** {@inheritDoc} */ @Override public List<PasswordStorageScheme<?>> getDefaultPasswordStorageSchemes() { return defaultStorageSchemes; } /** {@inheritDoc} */ @Override public Set<String> getDeprecatedPasswordStorageSchemes() { return deprecatedStorageSchemes; } /** {@inheritDoc} */ @Override public DN getDN() { return configuration.dn(); } /** {@inheritDoc} */ @Override public boolean isDefaultPasswordStorageScheme(String name) { for (PasswordStorageScheme<?> s : defaultStorageSchemes) { if (authPasswordSyntax) String schemeName = authPasswordSyntax ? s.getAuthPasswordSchemeName() : s.getStorageSchemeName(); if (schemeName.equalsIgnoreCase(name)) { if (s.getAuthPasswordSchemeName().equalsIgnoreCase(name)) { return true; } } else { if (s.getStorageSchemeName().equalsIgnoreCase(name)) { return true; } return true; } } return false; } /** {@inheritDoc} */ @Override public boolean isDeprecatedPasswordStorageScheme(String name) { return deprecatedStorageSchemes.contains(toLowerCase(name)); } /** {@inheritDoc} */ @Override public Collection<PasswordValidator<?>> getPasswordValidators() { return passwordValidators.values(); } /** {@inheritDoc} */ @Override public Collection<AccountStatusNotificationHandler<?>> getAccountStatusNotificationHandlers() @@ -475,22 +443,18 @@ return notificationHandlers.values(); } /** {@inheritDoc} */ @Override public PasswordGenerator<?> getPasswordGenerator() { return passwordGenerator; } /** {@inheritDoc} */ @Override public long getRequireChangeByTime() { return requireChangeByTime; } /** * Retrieves a string representation of this password policy. * @@ -504,8 +468,6 @@ return buffer.toString(); } /** * Appends a string representation of this password policy to the provided * buffer. @@ -713,24 +675,24 @@ buffer.append(EOL); buffer.append("Last Login Time Attribute: "); if (configuration.getLastLoginTimeAttribute() == null) if (configuration.getLastLoginTimeAttribute() != null) { buffer.append("{none specified}"); buffer.append(configuration.getLastLoginTimeAttribute().getNameOrOID()); } else { buffer.append(configuration.getLastLoginTimeAttribute().getNameOrOID()); buffer.append("{none specified}"); } buffer.append(EOL); buffer.append("Last Login Time Format: "); if (configuration.getLastLoginTimeFormat() == null) if (configuration.getLastLoginTimeFormat() != null) { buffer.append("{none specified}"); buffer.append(configuration.getLastLoginTimeFormat()); } else { buffer.append(configuration.getLastLoginTimeFormat()); buffer.append("{none specified}"); } buffer.append(EOL); @@ -770,202 +732,172 @@ buffer.append(EOL); } /** {@inheritDoc} */ @Override public boolean isAllowExpiredPasswordChanges() { return configuration.isAllowExpiredPasswordChanges(); } /** {@inheritDoc} */ @Override public boolean isAllowMultiplePasswordValues() { return configuration.isAllowMultiplePasswordValues(); } /** {@inheritDoc} */ @Override public boolean isAllowPreEncodedPasswords() { return configuration.isAllowPreEncodedPasswords(); } /** {@inheritDoc} */ @Override public boolean isAllowUserPasswordChanges() { return configuration.isAllowUserPasswordChanges(); } /** {@inheritDoc} */ @Override public boolean isExpirePasswordsWithoutWarning() { return configuration.isExpirePasswordsWithoutWarning(); } /** {@inheritDoc} */ @Override public boolean isForceChangeOnAdd() { return configuration.isForceChangeOnAdd(); } /** {@inheritDoc} */ @Override public boolean isForceChangeOnReset() { return configuration.isForceChangeOnReset(); } /** {@inheritDoc} */ @Override public int getGraceLoginCount() { return configuration.getGraceLoginCount(); } /** {@inheritDoc} */ @Override public long getIdleLockoutInterval() { return configuration.getIdleLockoutInterval(); } /** {@inheritDoc} */ @Override public AttributeType getLastLoginTimeAttribute() { return configuration.getLastLoginTimeAttribute(); } /** {@inheritDoc} */ @Override public String getLastLoginTimeFormat() { return configuration.getLastLoginTimeFormat(); } /** {@inheritDoc} */ @Override public long getLockoutDuration() { return configuration.getLockoutDuration(); } /** {@inheritDoc} */ @Override public int getLockoutFailureCount() { return configuration.getLockoutFailureCount(); } /** {@inheritDoc} */ @Override public long getLockoutFailureExpirationInterval() { return configuration.getLockoutFailureExpirationInterval(); } /** {@inheritDoc} */ @Override public long getMaxPasswordAge() { return configuration.getMaxPasswordAge(); } /** {@inheritDoc} */ @Override public long getMaxPasswordResetAge() { return configuration.getMaxPasswordResetAge(); } /** {@inheritDoc} */ @Override public long getMinPasswordAge() { return configuration.getMinPasswordAge(); } /** {@inheritDoc} */ @Override public AttributeType getPasswordAttribute() { return configuration.getPasswordAttribute(); } /** {@inheritDoc} */ @Override public boolean isPasswordChangeRequiresCurrentPassword() { return configuration.isPasswordChangeRequiresCurrentPassword(); } /** {@inheritDoc} */ @Override public long getPasswordExpirationWarningInterval() { return configuration.getPasswordExpirationWarningInterval(); } /** {@inheritDoc} */ @Override public int getPasswordHistoryCount() { return configuration.getPasswordHistoryCount(); } /** {@inheritDoc} */ @Override public long getPasswordHistoryDuration() { return configuration.getPasswordHistoryDuration(); } /** {@inheritDoc} */ @Override public SortedSet<String> getPreviousLastLoginTimeFormats() { return configuration.getPreviousLastLoginTimeFormat(); } /** {@inheritDoc} */ @Override public boolean isRequireSecureAuthentication() { return configuration.isRequireSecureAuthentication(); } /** {@inheritDoc} */ @Override public boolean isRequireSecurePasswordChanges() { return configuration.isRequireSecurePasswordChanges(); } /** {@inheritDoc} */ @Override public boolean isSkipValidationForAdministrators() { return configuration.isSkipValidationForAdministrators(); } /** {@inheritDoc} */ @Override public StateUpdateFailurePolicy getStateUpdateFailurePolicy() { return configuration.getStateUpdateFailurePolicy(); } } private ServerContext serverContext; /** * Default constructor instantiated from authentication policy config manager. */ /** Default constructor instantiated from authentication policy config manager. */ public PasswordPolicyFactory() { // Nothing to do . @@ -982,7 +914,6 @@ this.serverContext = serverContext; } /** {@inheritDoc} */ @Override public PasswordPolicy createAuthenticationPolicy( final PasswordPolicyCfg configuration) throws ConfigException, @@ -993,7 +924,6 @@ return policy; } /** {@inheritDoc} */ @Override public boolean isConfigurationAcceptable( final PasswordPolicyCfg configuration, @@ -1014,5 +944,4 @@ // If we made it here, then the configuration is acceptable. return true; } } opendj-server-legacy/src/main/java/org/opends/server/extensions/BCrypt.java
@@ -436,10 +436,10 @@ * @return the decoded value of x */ private static byte char64(char x) { if ((int)x < 0 || (int)x > index_64.length) { if (x < 0 || x > index_64.length) { return -1; } return index_64[(int)x]; return index_64[x]; } /** opendj-server-legacy/src/main/java/org/opends/server/extensions/BcryptPasswordStorageScheme.java
@@ -46,7 +46,6 @@ implements ConfigurationChangeListener<BcryptPasswordStorageSchemeCfg> { private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); private static final String CLASS_NAME = BcryptPasswordStorageScheme.class.getName();; /** The current configuration for this storage scheme. */ private volatile BcryptPasswordStorageSchemeCfg config; opendj-server-legacy/src/main/java/org/opends/server/extensions/DiskSpaceMonitor.java
@@ -39,8 +39,6 @@ import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.config.server.ConfigException; import org.forgerock.opendj.ldap.DN; import org.forgerock.opendj.ldap.schema.AttributeType; import org.forgerock.opendj.ldap.schema.Syntax; import org.forgerock.opendj.server.config.server.MonitorProviderCfg; import org.opends.server.api.AlertGenerator; import org.opends.server.api.DiskSpaceMonitorHandler; @@ -48,8 +46,6 @@ import org.opends.server.api.MonitorProvider; import org.opends.server.api.ServerShutdownListener; import org.opends.server.core.DirectoryServer; import org.opends.server.types.Attribute; import org.opends.server.types.Attributes; import org.opends.server.types.InitializationException; /** @@ -130,12 +126,6 @@ this.lowThreshold = lowThreshold; } private Attribute attr(String name, Syntax syntax, Object value) { AttributeType attrType = DirectoryServer.getAttributeType(name, syntax); return Attributes.create(attrType, String.valueOf(value)); } private String getState() { switch(lastState) opendj-server-legacy/src/main/java/org/opends/server/extensions/FingerprintCertificateMapper.java
@@ -30,11 +30,12 @@ import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.config.server.ConfigChangeResult; import org.forgerock.opendj.config.server.ConfigException; import org.forgerock.opendj.config.server.ConfigurationChangeListener; import org.forgerock.opendj.ldap.ByteString; import org.forgerock.opendj.ldap.DN; import org.forgerock.opendj.ldap.ResultCode; import org.forgerock.opendj.ldap.SearchScope; import org.forgerock.opendj.config.server.ConfigurationChangeListener; import org.forgerock.opendj.ldap.schema.AttributeType; import org.forgerock.opendj.server.config.server.CertificateMapperCfg; import org.forgerock.opendj.server.config.server.FingerprintCertificateMapperCfg; import org.opends.server.api.Backend; @@ -43,12 +44,16 @@ import org.opends.server.protocols.internal.InternalClientConnection; import org.opends.server.protocols.internal.InternalSearchOperation; import org.opends.server.protocols.internal.SearchRequest; import static org.opends.server.protocols.internal.Requests.*; import org.forgerock.opendj.ldap.schema.AttributeType; import org.opends.server.types.*; import org.opends.server.types.DirectoryException; import org.opends.server.types.Entry; import org.opends.server.types.IndexType; import org.opends.server.types.InitializationException; import org.opends.server.types.SearchFilter; import org.opends.server.types.SearchResultEntry; import static org.opends.messages.ExtensionMessages.*; import static org.opends.server.protocols.internal.InternalClientConnection.*; import static org.opends.server.protocols.internal.Requests.*; import static org.opends.server.util.CollectionUtils.*; import static org.opends.server.util.StaticUtils.*; @@ -65,17 +70,10 @@ { private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); /** The DN of the configuration entry for this certificate mapper. */ private DN configEntryDN; /** The current configuration for this certificate mapper. */ private FingerprintCertificateMapperCfg currentConfig; /** The algorithm that will be used to generate the fingerprint. */ private String fingerprintAlgorithm; /** The set of attributes to return in search result entries. */ private LinkedHashSet<String> requestedAttributes; @@ -101,8 +99,6 @@ configuration.addFingerprintChangeListener(this); currentConfig = configuration; configEntryDN = configuration.dn(); // Get the algorithm that will be used to generate the fingerprint. switch (configuration.getFingerprintAlgorithm()) @@ -127,7 +123,7 @@ AttributeType t = configuration.getFingerprintAttribute(); for (DN baseDN : cfgBaseDNs) { Backend b = DirectoryServer.getBackend(baseDN); Backend<?> b = DirectoryServer.getBackend(baseDN); if (b != null && ! b.isIndexed(t, IndexType.EQUALITY)) { logger.warn(WARN_SATUACM_ATTR_UNINDEXED, configuration.dn(), @@ -350,7 +346,7 @@ AttributeType t = configuration.getFingerprintAttribute(); for (DN baseDN : cfgBaseDNs) { Backend b = DirectoryServer.getBackend(baseDN); Backend<?> b = DirectoryServer.getBackend(baseDN); if (b != null && ! b.isIndexed(t, IndexType.EQUALITY)) { LocalizableMessage message = WARN_SATUACM_ATTR_UNINDEXED.get( opendj-server-legacy/src/main/java/org/opends/server/loggers/SignatureAction.java
File was deleted opendj-server-legacy/src/main/java/org/opends/server/plugins/profiler/ProfileViewer.java
@@ -29,13 +29,13 @@ import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTree; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.DefaultTreeSelectionModel; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.opendj.io.ASN1; @@ -106,8 +106,7 @@ toolDescription, false); // Initialize all the command-line argument types and register them with the // parser. // Initialize all the command-line argument types and register them with the parser try { fileNames = @@ -150,7 +149,7 @@ } // If we should just display usage or versionn information, // If we should just display usage or version information, // then print it and exit. if (argParser.usageOrVersionDisplayed()) { @@ -475,31 +474,6 @@ } } /** * Formats the provided count, padding with leading spaces as necessary. * * @param count The count value to be formatted. * @param length The total length for the string to return. * * @return The formatted count string. */ private String formatCount(long count, int length) { StringBuilder buffer = new StringBuilder(length); buffer.append(count); while (buffer.length() < length) { buffer.insert(0, ' '); } return buffer.toString(); } /** * Indicates that a node in the tree has been selected or deselected and that * any appropriate action should be taken. opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/file/ReplicationEnvironment.java
@@ -965,14 +965,6 @@ } } private void debug(String message) { // Replication server may be null when testing String monitorInstanceName = replicationServer != null ? replicationServer.getMonitorInstanceName() : "no monitor [test]"; logger.trace("In %s, %s", monitorInstanceName, message); } private int toServerId(final String serverIdName) throws ChangelogException { try opendj-server-legacy/src/main/java/org/opends/server/tools/BackUpDB.java
@@ -21,8 +21,8 @@ import static org.opends.server.util.ServerConstants.*; import static org.opends.server.util.StaticUtils.*; import static com.forgerock.opendj.cli.ArgumentConstants.*; import static com.forgerock.opendj.cli.Utils.*; import static com.forgerock.opendj.cli.CommonArguments.*; import static com.forgerock.opendj.cli.Utils.*; import java.io.File; import java.io.OutputStream; @@ -33,12 +33,14 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.TimeZone; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.config.server.ConfigException; import org.forgerock.util.Utils; import org.forgerock.opendj.ldap.DN; import org.forgerock.opendj.server.config.server.BackendCfg; import org.forgerock.util.Utils; import org.opends.server.api.Backend; import org.opends.server.api.Backend.BackendOperation; import org.opends.server.core.DirectoryServer; @@ -54,7 +56,6 @@ import org.opends.server.tools.tasks.TaskTool; import org.opends.server.types.BackupConfig; import org.opends.server.types.BackupDirectory; import org.forgerock.opendj.ldap.DN; import org.opends.server.types.DirectoryException; import org.opends.server.types.InitializationException; import org.opends.server.types.NullOutputStream; @@ -468,15 +469,15 @@ // Get information about the backends defined in the server, and determine // whether we are backing up multiple backends or a single backend. ArrayList<Backend> backendList = new ArrayList<>(); ArrayList<BackendCfg> entryList = new ArrayList<>(); ArrayList<List<DN>> dnList = new ArrayList<>(); List<Backend<?>> backendList = new ArrayList<>(); List<BackendCfg> entryList = new ArrayList<>(); List<List<DN>> dnList = new ArrayList<>(); BackendToolUtils.getBackends(backendList, entryList, dnList); int numBackends = backendList.size(); boolean multiple; ArrayList<Backend<?>> backendsToArchive = new ArrayList<>(numBackends); HashMap<String,BackendCfg> configEntries = new HashMap<>(numBackends); List<Backend<?>> backendsToArchive = new ArrayList<>(numBackends); Map<String, BackendCfg> configEntries = new HashMap<>(numBackends); if (backUpAll.isPresent()) { for (int i=0; i < numBackends; i++) opendj-server-legacy/src/main/java/org/opends/server/tools/BackendToolUtils.java
@@ -21,16 +21,15 @@ import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.adapter.server3x.Converters; import org.forgerock.opendj.config.server.ConfigException; import org.forgerock.opendj.ldap.DN; import org.forgerock.opendj.ldap.ByteString; import org.forgerock.opendj.ldap.DN; import org.forgerock.opendj.server.config.server.BackendCfg; import org.forgerock.opendj.server.config.server.RootCfg; import org.opends.server.api.Backend; import org.opends.server.types.Entry; import org.opends.server.core.ConfigurationHandler; import org.opends.server.core.DirectoryServer; import org.opends.server.types.Attribute; import org.opends.server.types.Entry; import static org.opends.messages.ToolMessages.*; import static org.opends.server.config.ConfigConstants.*; @@ -60,7 +59,7 @@ * @return 0 if everything went fine. 1 if an error occurred. */ @SuppressWarnings({ "unchecked", "rawtypes" }) public static int getBackends(final List<Backend> backendList, final List<BackendCfg> entryList, public static int getBackends(final List<Backend<?>> backendList, final List<BackendCfg> entryList, final List<List<DN>> dnList) { try @@ -195,24 +194,6 @@ } } private static Entry getBaseEntry(final DN backendBaseDN) throws Exception { try { return DirectoryServer.getConfigEntry(backendBaseDN); } catch (final ConfigException ce) { logger.error(ERR_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY, DN_BACKEND_BASE, ce.getMessage()); throw ce; } catch (final Exception e) { logger.error(ERR_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY, DN_BACKEND_BASE, getExceptionMessage(e)); throw e; } } private static DN getBackendBaseDN() throws Exception { try opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java
@@ -20,8 +20,8 @@ import static org.opends.server.config.ConfigConstants.*; import static org.opends.server.util.StaticUtils.*; import static com.forgerock.opendj.cli.ArgumentConstants.*; import static com.forgerock.opendj.cli.Utils.*; import static com.forgerock.opendj.cli.CommonArguments.*; import static com.forgerock.opendj.cli.Utils.*; import java.io.OutputStream; import java.io.PrintStream; @@ -31,6 +31,8 @@ import java.util.Set; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.ldap.DN; import org.forgerock.opendj.ldap.schema.AttributeType; import org.forgerock.opendj.server.config.server.BackendCfg; import org.opends.server.api.Backend; import org.opends.server.api.Backend.BackendOperation; @@ -46,8 +48,6 @@ import org.opends.server.protocols.ldap.LDAPAttribute; import org.opends.server.tasks.ExportTask; import org.opends.server.tools.tasks.TaskTool; import org.forgerock.opendj.ldap.schema.AttributeType; import org.forgerock.opendj.ldap.DN; import org.opends.server.types.DirectoryException; import org.opends.server.types.ExistingFileBehavior; import org.opends.server.types.InitializationException; @@ -462,20 +462,20 @@ // through them, finding the one backend that should be used for the export, // and also finding backends with subordinate base DNs that should be // excluded from the export. Backend backend = null; Backend<?> backend = null; List<DN> baseDNList = null; List<DN> defaultIncludeBranches = null; ArrayList<DN> excludeBranches = null; ArrayList<Backend> backendList = new ArrayList<>(); ArrayList<BackendCfg> entryList = new ArrayList<>(); ArrayList<List<DN>> dnList = new ArrayList<>(); List<Backend<?>> backendList = new ArrayList<>(); List<BackendCfg> entryList = new ArrayList<>(); List<List<DN>> dnList = new ArrayList<>(); BackendToolUtils.getBackends(backendList, entryList, dnList); int numBackends = backendList.size(); for (int i=0; i < numBackends; i++) { Backend b = backendList.get(i); Backend<?> b = backendList.get(i); if (! backendID.getValue().equals(b.getBackendID())) { continue; opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
@@ -19,8 +19,8 @@ import static org.opends.messages.ToolMessages.*; import static org.opends.server.config.ConfigConstants.*; import static org.opends.server.util.StaticUtils.*; import static com.forgerock.opendj.cli.CommonArguments.*; import static com.forgerock.opendj.cli.ArgumentConstants.*; import static com.forgerock.opendj.cli.CommonArguments.*; import static com.forgerock.opendj.cli.Utils.*; import java.io.File; @@ -34,8 +34,9 @@ import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.config.server.ConfigException; import org.forgerock.opendj.ldap.DN; import org.forgerock.opendj.ldap.ResultCode; import org.forgerock.opendj.ldap.schema.AttributeType; import org.forgerock.opendj.server.config.server.BackendCfg; import org.opends.server.api.Backend; import org.opends.server.api.Backend.BackendOperation; @@ -51,8 +52,6 @@ import org.opends.server.tasks.ImportTask; import org.opends.server.tools.makeldif.TemplateFile; import org.opends.server.tools.tasks.TaskTool; import org.forgerock.opendj.ldap.schema.AttributeType; import org.forgerock.opendj.ldap.DN; import org.opends.server.types.DirectoryException; import org.opends.server.types.ExistingFileBehavior; import org.opends.server.types.InitializationException; @@ -495,7 +494,6 @@ if (initializeServer) { DirectoryServer.InitializationBuilder ib; try { new DirectoryServer.InitializationBuilder(configFile.getValue()) @@ -667,8 +665,8 @@ } } ArrayList<Backend> backendList = new ArrayList<>(); ArrayList<BackendCfg> entryList = new ArrayList<>(); ArrayList<Backend<?>> backendList = new ArrayList<>(); ArrayList<BackendCfg> entryList = new ArrayList<>(); ArrayList<List<DN>> dnList = new ArrayList<>(); int code = BackendToolUtils.getBackends(backendList, entryList, dnList); if (code != 0) @@ -978,22 +976,6 @@ return retCode; } private Object getMessage(Exception e) { try { throw e; } catch (ConfigException | InitializationException e2) { return e2.getMessage(); } catch (Exception e2) { return getExceptionMessage(e2); } } private boolean useBackend(Set<DN> includeBranches, List<DN> dnlist) { for (DN baseDN : dnlist) opendj-server-legacy/src/main/java/org/opends/server/tools/RebuildIndex.java
@@ -19,8 +19,8 @@ import static org.opends.messages.ToolMessages.*; import static org.opends.server.config.ConfigConstants.*; import static org.opends.server.util.StaticUtils.*; import static com.forgerock.opendj.cli.Utils.*; import static com.forgerock.opendj.cli.CommonArguments.*; import static com.forgerock.opendj.cli.Utils.*; import java.io.OutputStream; import java.io.PrintStream; @@ -29,9 +29,9 @@ import java.util.List; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.LocalizableMessageDescriptor.Arg1; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.config.server.ConfigException; import org.forgerock.opendj.ldap.DN; import org.forgerock.opendj.server.config.server.BackendCfg; import org.opends.server.api.Backend; import org.opends.server.api.Backend.BackendOperation; @@ -48,7 +48,6 @@ import org.opends.server.protocols.ldap.LDAPAttribute; import org.opends.server.tasks.RebuildTask; import org.opends.server.tools.tasks.TaskTool; import org.forgerock.opendj.ldap.DN; import org.opends.server.types.InitializationException; import org.opends.server.types.NullOutputStream; import org.opends.server.types.RawAttribute; @@ -283,7 +282,7 @@ { if (initializeServer) { final int init = initializeServer(out, err); final int init = initializeServer(err); if (init != 0) { return init; @@ -368,15 +367,12 @@ /** * Initializes the directory server. * * @param out * The output stream to use for standard output, or {@code null} if * standard output is not needed. * @param err * The output stream to use for standard error, or {@code null} if * standard error is not needed. * @return The result code. */ private int initializeServer(final PrintStream out, final PrintStream err) private int initializeServer(final PrintStream err) { try { @@ -392,21 +388,6 @@ } } private String toErrorMsg(Arg1<Object> errorMsg, Exception ex) { final LocalizableMessage message = getErrorMsg(ex, errorMsg); return wrapText(message, MAX_LINE_WIDTH); } private LocalizableMessage getErrorMsg(Exception ex, Arg1<Object> errorMsg) { if (ex instanceof ConfigException || ex instanceof InitializationException) { return errorMsg.get(ex.getMessage()); } return errorMsg.get(getExceptionMessage(ex)); } /** * Initializes and sets the rebuild index configuration. * @@ -526,9 +507,9 @@ */ private Backend<?> retrieveBackend(final DN selectedDN) throws ConfigException, Exception { final ArrayList<Backend> backendList = new ArrayList<>(); final ArrayList<BackendCfg> entryList = new ArrayList<>(); final ArrayList<List<DN>> dnList = new ArrayList<>(); final List<Backend<?>> backendList = new ArrayList<>(); final List<BackendCfg> entryList = new ArrayList<>(); final List<List<DN>> dnList = new ArrayList<>(); BackendToolUtils.getBackends(backendList, entryList, dnList); Backend<?> backend = null; @@ -600,7 +581,7 @@ if (initializeServer) { final int init = initializeServer(out, out); final int init = initializeServer(out); if (init != 0) { return init; opendj-server-legacy/src/main/java/org/opends/server/tools/RestoreDB.java
@@ -20,8 +20,8 @@ import static org.opends.server.config.ConfigConstants.*; import static org.opends.server.util.StaticUtils.*; import static com.forgerock.opendj.cli.ArgumentConstants.*; import static com.forgerock.opendj.cli.Utils.*; import static com.forgerock.opendj.cli.CommonArguments.*; import static com.forgerock.opendj.cli.Utils.*; import java.io.OutputStream; import java.io.PrintStream; @@ -34,6 +34,7 @@ import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.ldap.DN; import org.forgerock.opendj.server.config.server.BackendCfg; import org.opends.server.api.Backend; import org.opends.server.api.Backend.BackendOperation; @@ -50,7 +51,6 @@ import org.opends.server.tools.tasks.TaskTool; import org.opends.server.types.BackupDirectory; import org.opends.server.types.BackupInfo; import org.forgerock.opendj.ldap.DN; import org.opends.server.types.DirectoryException; import org.opends.server.types.InitializationException; import org.opends.server.types.NullOutputStream; @@ -420,17 +420,17 @@ // Get information about the backends defined in the server and determine // which to use for the restore. ArrayList<Backend> backendList = new ArrayList<>(); ArrayList<BackendCfg> entryList = new ArrayList<>(); ArrayList<List<DN>> dnList = new ArrayList<>(); List<Backend<?>> backendList = new ArrayList<>(); List<BackendCfg> entryList = new ArrayList<>(); List<List<DN>> dnList = new ArrayList<>(); BackendToolUtils.getBackends(backendList, entryList, dnList); Backend backend = null; int numBackends = backendList.size(); Backend<?> backend = null; int numBackends = backendList.size(); for (int i=0; i < numBackends; i++) { Backend b = backendList.get(i); Backend<?> b = backendList.get(i); BackendCfg e = entryList.get(i); if (e.dn().equals(configEntryDN)) { opendj-server-legacy/src/main/java/org/opends/server/tools/VerifyIndex.java
@@ -17,8 +17,8 @@ package org.opends.server.tools; import static com.forgerock.opendj.cli.ArgumentConstants.*; import static com.forgerock.opendj.cli.Utils.*; import static com.forgerock.opendj.cli.CommonArguments.*; import static com.forgerock.opendj.cli.Utils.*; import static org.opends.messages.ToolMessages.*; import static org.opends.server.util.StaticUtils.*; @@ -63,7 +63,7 @@ */ public static void main(String[] args) { int retCode = mainVerifyIndex(args, true, System.out, System.err); int retCode = mainVerifyIndex(args, true, System.err); if(retCode != 0) { System.exit(filterExitCode(retCode)); @@ -76,15 +76,11 @@ * @param args The command-line arguments provided to this * program. * @param initializeServer Indicates whether to initialize the server. * @param outStream The output stream to use for standard output, or * {@code null} if standard output is not needed. * @param errStream The output stream to use for standard error, or * {@code null} if standard error is not needed. * * @return The error code. */ public static int mainVerifyIndex(String[] args, boolean initializeServer, OutputStream outStream, OutputStream errStream) { PrintStream err = NullOutputStream.wrapOrNullStream(errStream); @@ -219,9 +215,9 @@ // Get information about the backends defined in the server. Iterate // through them, finding the one backend to be verified. ArrayList<Backend> backendList = new ArrayList<>(); ArrayList<BackendCfg> entryList = new ArrayList<>(); ArrayList<List<DN>> dnList = new ArrayList<>(); List<Backend<?>> backendList = new ArrayList<>(); List<BackendCfg> entryList = new ArrayList<>(); List<List<DN>> dnList = new ArrayList<>(); BackendToolUtils.getBackends(backendList, entryList, dnList); Backend<?> backend = null; opendj-server-legacy/src/main/java/org/opends/server/types/AttributeParser.java
@@ -11,7 +11,7 @@ * Header, with the fields enclosed by brackets [] replaced by your own identifying * information: "Portions Copyright [year] [name of copyright owner]". * * Copyright 2012-2015 ForgeRock AS. * Copyright 2012-2016 ForgeRock AS. */ package org.opends.server.types; @@ -461,9 +461,8 @@ public AttributeParser requireValue() throws NoSuchElementException { if (isEmpty(attribute)) { throw new NoSuchElementException(); } else { return this; } return this; } /** @@ -476,15 +475,10 @@ * @return This attribute parser. */ public AttributeParser usingSchema(final Schema schema) { // Avoid modifying the null instance: a schema will not be needed // anyway. // Avoid modifying the null instance: a schema will not be needed anyway if (this != NULL_INSTANCE) { this.schema = schema; } return this; } private Schema getSchema() { return schema == null ? Schema.getDefaultSchema() : schema; } } opendj-server-legacy/src/main/java/org/opends/server/util/BackupManager.java
@@ -12,7 +12,7 @@ * information: "Portions Copyright [year] [name of copyright owner]". * * Copyright 2006-2009 Sun Microsystems, Inc. * Portions Copyright 2013-2015 ForgeRock AS. * Portions Copyright 2013-2016 ForgeRock AS. */ package org.opends.server.util; @@ -643,11 +643,6 @@ return backupInfo; } String getBackupID() { return backupID; } CryptoEngine getCryptoEngine() { return cryptoEngine; opendj-server-legacy/src/test/java/org/opends/server/tools/ArgumentParserToolsTestCase.java
@@ -36,6 +36,7 @@ * This class tests that help reference message is prompted for all tools when * no arguments are provided or if they failed to be parsed. */ @SuppressWarnings("javadoc") public class ArgumentParserToolsTestCase extends ToolsTestCase { private static final boolean ERRORS_ON_STDOUT = false; @@ -222,7 +223,6 @@ @Test(dataProvider = "invalidArgs") public void testVerifyIndex(final String[] args) { assertToolFailsWithUsage(VerifyIndex.mainVerifyIndex(args, false, outStream, errStream)); assertToolFailsWithUsage(VerifyIndex.mainVerifyIndex(args, false, errStream)); } } opendj-server-legacy/src/test/java/org/opends/server/tools/VerifyIndexTestCase.java
@@ -81,7 +81,6 @@ "-f",configFilePath, "-b", "o=airius.com", "-i", "description" }; assertEquals(VerifyIndex.mainVerifyIndex(args, false, null, null), 1); assertEquals(VerifyIndex.mainVerifyIndex(args, false, null), 1); } }