/* * The contents of this file are subject to the terms of the Common Development and * Distribution License (the License). You may not use this file except in compliance with the * License. * * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the * specific language governing permission and limitations under the License. * * When distributing Covered Software, include this CDDL Header Notice in each file and include * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL * Header, with the fields enclosed by brackets [] replaced by your own identifying * information: "Portions Copyright [year] [name of copyright owner]". * * Copyright 2009 Sun Microsystems, Inc. * Portions Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.config.dsconfig; import static com.forgerock.opendj.dsconfig.DsconfigMessages.*; import static com.forgerock.opendj.cli.ArgumentConstants.LIST_TABLE_SEPARATOR; import java.io.PrintStream; import java.util.Collection; import java.util.LinkedList; import java.util.List; import java.util.Set; import java.util.SortedSet; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.opendj.config.AbsoluteInheritedDefaultBehaviorProvider; import org.forgerock.opendj.config.AliasDefaultBehaviorProvider; import org.forgerock.opendj.config.DefaultBehaviorProviderVisitor; import org.forgerock.opendj.config.DefinedDefaultBehaviorProvider; import org.forgerock.opendj.config.DefinitionDecodingException; import org.forgerock.opendj.config.InstantiableRelationDefinition; import org.forgerock.opendj.config.ManagedObjectDefinition; import org.forgerock.opendj.config.ManagedObjectNotFoundException; import org.forgerock.opendj.config.ManagedObjectPath; import org.forgerock.opendj.config.OptionalRelationDefinition; import org.forgerock.opendj.config.PropertyDefinition; import org.forgerock.opendj.config.RelationDefinition; import org.forgerock.opendj.config.RelativeInheritedDefaultBehaviorProvider; import org.forgerock.opendj.config.SetRelationDefinition; import org.forgerock.opendj.config.SingletonRelationDefinition; import org.forgerock.opendj.config.UndefinedDefaultBehaviorProvider; import org.forgerock.opendj.config.client.ConcurrentModificationException; import org.forgerock.opendj.config.client.ManagedObject; 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.LdapException; import com.forgerock.opendj.cli.ArgumentException; import com.forgerock.opendj.cli.ReturnCode; import com.forgerock.opendj.cli.StringArgument; import com.forgerock.opendj.cli.SubCommand; import com.forgerock.opendj.cli.SubCommandArgumentParser; import com.forgerock.opendj.cli.ClientException; import com.forgerock.opendj.cli.ConsoleApplication; import com.forgerock.opendj.cli.MenuResult; import com.forgerock.opendj.cli.TableBuilder; import com.forgerock.opendj.cli.TablePrinter; import com.forgerock.opendj.cli.TextTablePrinter; /** * A sub-command handler which is used to retrieve the properties of a managed object. *
* This sub-command implements the various get-xxx-prop sub-commands.
*/
final class GetPropSubCommandHandler extends SubCommandHandler {
/**
* Creates a new get-xxx-prop sub-command for an instantiable relation.
*
* @param parser
* The sub-command argument parser.
* @param path
* The parent managed object path.
* @param r
* The instantiable relation.
* @return Returns the new get-xxx-prop sub-command.
* @throws ArgumentException
* If the sub-command could not be created successfully.
*/
public static GetPropSubCommandHandler create(SubCommandArgumentParser parser, ManagedObjectPath, ?> path,
InstantiableRelationDefinition, ?> r) throws ArgumentException {
return new GetPropSubCommandHandler(parser, path.child(r, "DUMMY"), r);
}
/**
* Creates a new get-xxx-prop sub-command for an optional relation.
*
* @param parser
* The sub-command argument parser.
* @param path
* The parent managed object path.
* @param r
* The optional relation.
* @return Returns the new get-xxx-prop sub-command.
* @throws ArgumentException
* If the sub-command could not be created successfully.
*/
public static GetPropSubCommandHandler create(SubCommandArgumentParser parser, ManagedObjectPath, ?> path,
OptionalRelationDefinition, ?> r) throws ArgumentException {
return new GetPropSubCommandHandler(parser, path.child(r), r);
}
/**
* Creates a new get-xxx-prop sub-command for a set relation.
*
* @param parser
* The sub-command argument parser.
* @param path
* The parent managed object path.
* @param r
* The set relation.
* @return Returns the new get-xxx-prop sub-command.
* @throws ArgumentException
* If the sub-command could not be created successfully.
*/
public static GetPropSubCommandHandler create(SubCommandArgumentParser parser, ManagedObjectPath, ?> path,
SetRelationDefinition, ?> r) throws ArgumentException {
return new GetPropSubCommandHandler(parser, path.child(r), r);
}
/**
* Creates a new get-xxx-prop sub-command for a singleton relation.
*
* @param parser
* The sub-command argument parser.
* @param path
* The parent managed object path.
* @param r
* The singleton relation.
* @return Returns the new get-xxx-prop sub-command.
* @throws ArgumentException
* If the sub-command could not be created successfully.
*/
public static GetPropSubCommandHandler create(SubCommandArgumentParser parser, ManagedObjectPath, ?> path,
SingletonRelationDefinition, ?> r) throws ArgumentException {
return new GetPropSubCommandHandler(parser, path.child(r), r);
}
/** The sub-commands naming arguments. */
private final List