mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Violette Roche-Montane
05.47.2014 112a28c7b49479582403c93562c19096094b9e47
Checkpoint for OPENDJ-1343 Migrate dsconfig
- Minor code cleanup.
- Removed warnings.
7 files modified
51 ■■■■ changed files
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/CreateSubCommandHandler.java 2 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DSConfig.java 4 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DeleteSubCommandHandler.java 2 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/GetPropSubCommandHandler.java 3 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/ListSubCommandHandler.java 2 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/SetPropSubCommandHandler.java 2 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/SubCommandHandler.java 36 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/CreateSubCommandHandler.java
@@ -1057,6 +1057,8 @@
            } else {
                throw new ClientException(ReturnCode.NO_SUCH_OBJECT, msg);
            }
        } catch (ErrorResultException e) {
            throw new ClientException(ReturnCode.OTHER, LocalizableMessage.raw(e.getLocalizedMessage()));
        }
        if (result.isQuit()) {
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DSConfig.java
@@ -62,7 +62,6 @@
import java.util.TreeSet;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.ConfigurationFramework;
import org.forgerock.opendj.config.InstantiableRelationDefinition;
import org.forgerock.opendj.config.RelationDefinition;
@@ -95,9 +94,6 @@
 */
public final class DSConfig extends ConsoleApplication {
    /** The logger. */
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    /** The name of this tool. */
    final static String DSCONFIGTOOLNAME = "dsconfig";
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DeleteSubCommandHandler.java
@@ -233,6 +233,8 @@
            } else {
                return MenuResult.success(0);
            }
        } catch (ErrorResultException e) {
            throw new ClientException(ReturnCode.OTHER, LocalizableMessage.raw(e.getLocalizedMessage()));
        }
        if (result.isQuit()) {
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/GetPropSubCommandHandler.java
@@ -59,6 +59,7 @@
import org.forgerock.opendj.config.client.ManagedObjectDecodingException;
import org.forgerock.opendj.config.client.ManagementContext;
import org.forgerock.opendj.ldap.AuthorizationException;
import org.forgerock.opendj.ldap.ErrorResultException;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ReturnCode;
@@ -244,6 +245,8 @@
        } catch (ManagedObjectNotFoundException e) {
            LocalizableMessage msg = ERR_DSCFG_ERROR_GET_CHILD_MONFE.get(ufn);
            throw new ClientException(ReturnCode.NO_SUCH_OBJECT, msg);
        } catch (ErrorResultException e) {
            throw new ClientException(ReturnCode.OTHER, LocalizableMessage.raw(e.getLocalizedMessage()));
        }
        if (result.isQuit()) {
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/ListSubCommandHandler.java
@@ -239,6 +239,8 @@
            } else {
                throw new ClientException(ReturnCode.NO_SUCH_OBJECT, msg);
            }
        } catch (ErrorResultException e) {
            throw new ClientException(ReturnCode.OTHER, LocalizableMessage.raw(e.getLocalizedMessage()));
        }
        if (result.isQuit()) {
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/SetPropSubCommandHandler.java
@@ -661,6 +661,8 @@
            } else {
                throw except;
            }
        } catch (ErrorResultException e) {
            throw new ClientException(ReturnCode.OTHER, LocalizableMessage.raw(e.getLocalizedMessage()));
        }
        if (result.isQuit()) {
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/SubCommandHandler.java
@@ -110,16 +110,12 @@
        private ErrorResultException ere;
        /**
         * Any CLI exception that was caught when attempting to find the managed object.
         */
        /** Any CLI exception that was caught when attempting to find the managed object. */
        private ClientException clie;
        private ConcurrentModificationException cme;
        /**
         * Any operation exception that was caught when attempting to find the managed object.
         */
        /** Any operation exception that was caught when attempting to find the managed object. */
        private DefinitionDecodingException dde;
        private ManagedObjectDecodingException mode;
@@ -386,11 +382,13 @@
         * @throws AuthorizationException
         *             If the server refuses to retrieve the managed object because the client does not have the correct
         *             privileges.
         * @throws ErrorResultException
         *             If any other error occurs.
         */
        public MenuResult<ManagedObject<?>> find(ConsoleApplication app, ManagementContext context,
                ManagedObjectPath<?, ?> path, List<String> args) throws ClientException, AuthorizationException,
                ConcurrentModificationException, DefinitionDecodingException, ManagedObjectDecodingException,
                ManagedObjectNotFoundException {
                ManagedObjectNotFoundException, ErrorResultException {
            this.result = MenuResult.<ManagedObject<?>> success(context.getRootConfigurationManagedObject());
            this.app = app;
            this.args = args;
@@ -419,6 +417,8 @@
                throw mode;
            } else if (monfe != null) {
                throw monfe;
            } else if (ere != null) {
                throw ere;
            } else {
                // User requested termination interactively.
                return result;
@@ -826,13 +826,13 @@
     *             privileges.
     * @throws ClientException
     *             If one of the naming arguments referenced a managed object of the wrong type.
     * @throws ClientException
     *             If the management context could not be created.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    protected final MenuResult<ManagedObject<?>> getManagedObject(ConsoleApplication app, ManagementContext context,
            ManagedObjectPath<?, ?> path, List<String> args) throws ClientException, AuthorizationException,
            DefinitionDecodingException, ManagedObjectDecodingException, ConcurrentModificationException,
            ManagedObjectNotFoundException {
            ManagedObjectNotFoundException, ErrorResultException {
        ManagedObjectFinder finder = new ManagedObjectFinder();
        return finder.find(app, context, path, args);
    }
@@ -851,9 +851,8 @@
    protected final List<String> getNamingArgValues(ConsoleApplication app, List<StringArgument> namingArgs)
            throws ArgumentException {
        ArrayList<String> values = new ArrayList<String>(namingArgs.size());
        for (StringArgument arg : namingArgs) {
            String value = arg.getValue();
        for (final StringArgument arg : namingArgs) {
            final String value = arg.getValue();
            if (value == null && !app.isInteractive()) {
                throw ArgumentExceptionFactory.missingMandatoryNonInteractiveArgument(arg);
            } else {
@@ -871,9 +870,8 @@
    protected final Set<String> getPropertyNames() {
        if (propertyArgument != null) {
            return new LinkedHashSet<String>(propertyArgument.getValues());
        } else {
            return Collections.emptySet();
        }
        return Collections.emptySet();
    }
    /**
@@ -885,7 +883,7 @@
     */
    protected final SizeUnit getSizeUnit() throws ArgumentException {
        if (unitSizeArgument != null) {
            String value = unitSizeArgument.getValue();
            final String value = unitSizeArgument.getValue();
            if (value != null) {
                try {
@@ -909,7 +907,7 @@
     */
    protected final DurationUnit getTimeUnit() throws ArgumentException {
        if (unitTimeArgument != null) {
            String value = unitTimeArgument.getValue();
            final String value = unitTimeArgument.getValue();
            if (value != null) {
                try {
@@ -932,9 +930,8 @@
    protected final boolean isRecordMode() {
        if (recordModeArgument != null) {
            return recordModeArgument.isPresent();
        } else {
            return false;
        }
        return false;
    }
    /**
@@ -1264,7 +1261,6 @@
            }
            if (c instanceof ManagedObjectDefinition) {
                @SuppressWarnings("unchecked")
                ManagedObjectDefinition<? extends C, ? extends S> mod
                    = (ManagedObjectDefinition<? extends C, ? extends S>) c;
                map.put(getShortTypeName(d, mod), mod);