001    /*
002     * CDDL HEADER START
003     *
004     * The contents of this file are subject to the terms of the
005     * Common Development and Distribution License, Version 1.0 only
006     * (the "License").  You may not use this file except in compliance
007     * with the License.
008     *
009     * You can obtain a copy of the license at
010     * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011     * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012     * See the License for the specific language governing permissions
013     * and limitations under the License.
014     *
015     * When distributing Covered Code, include this CDDL HEADER in each
016     * file and include the License file at
017     * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
018     * add the following below this CDDL HEADER, with the fields enclosed
019     * by brackets "[]" replaced with your own identifying information:
020     *      Portions Copyright [yyyy] [name of copyright owner]
021     *
022     * CDDL HEADER END
023     *
024     *
025     *      Copyright 2006-2008 Sun Microsystems, Inc.
026     */
027     package org.opends.server.admin.client.cli;
028    
029    import java.io.OutputStream;
030    import java.util.Set;
031    
032    import org.opends.admin.ads.ADSContextException;
033    import org.opends.server.util.args.ArgumentException;
034    import org.opends.server.util.args.BooleanArgument;
035    import org.opends.server.util.args.SubCommand;
036    
037    /**
038     * This Interface defines method that a group of subcommand shoud implement.
039     */
040    public interface DsFrameworkCliSubCommandGroup
041    {
042    
043      /**
044       * Initialize subcommand related to server group management.
045       *
046       * @param argParser
047       *          The parser in which we should be registered.
048       * @param verboseArg
049       *          The verbose Argument.
050       * @throws ArgumentException
051       *           If there is a problem with any of the parameters used
052       *           to create this argument.
053       */
054      public void initializeCliGroup(DsFrameworkCliParser argParser,
055          BooleanArgument verboseArg) throws ArgumentException;
056    
057      /**
058       * Indicates if the provided suncommand is part of this group.
059       *
060       * @param subCmd
061       *          The actual subcommand with input parameter.
062       * @return True if the provided suncommand is part of this group.
063       */
064      public boolean isSubCommand(SubCommand subCmd);
065    
066      /**
067       * Handle the subcommand.
068       * @param subCmd
069       *          The actual subcommand with input parameter
070       * @param  outStream         The output stream to use for standard output.
071       * @param  errStream         The output stream to use for standard error.
072       * @return the return code
073       * @throws ADSContextException
074       *           If there is a problem with when trying to perform the
075       *           operation.
076       * @throws ArgumentException
077       *           If there is a problem with any of the parameters used
078       *           to execute this subcommand.
079       */
080      public DsFrameworkCliReturnCode performSubCommand(SubCommand subCmd,
081          OutputStream outStream, OutputStream errStream)
082          throws ADSContextException, ArgumentException;
083    
084      /**
085       * Get the subcommands list.
086       * @return the subcommand list.
087       */
088      public Set<SubCommand> getSubCommands();
089    
090      /**
091       * Indicates whether this subcommand group should be hidden from the usage
092       * information.
093       *
094       * @return <CODE>true</CODE> if this subcommand group should be hidden
095       *         from the usage information, or <CODE>false</CODE> if
096       *         not.
097       */
098      public boolean isHidden();
099    
100      /**
101       * Indicates subcommand group name.
102       *
103       * @return the subcommand group name
104       */
105      public String getGroupName();
106    
107    }