c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift/*
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * CDDL HEADER START
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift *
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * The contents of this file are subject to the terms of the
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * Common Development and Distribution License, Version 1.0 only
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * (the "License"). You may not use this file except in compliance
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * with the License.
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift *
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * or http://forgerock.org/license/CDDLv1.0.html.
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * See the License for the specific language governing permissions
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * and limitations under the License.
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift *
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * When distributing Covered Code, include this CDDL HEADER in each
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * file and include the License file at legal-notices/CDDLv1_0.txt.
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * If applicable, add the following below this CDDL HEADER, with the
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * fields enclosed by brackets "[]" replaced with your own identifying
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * information:
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * Portions Copyright [yyyy] [name of copyright owner]
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift *
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * CDDL HEADER END
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift *
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift *
bfa899a5853c6b460d624beec6110b193c039451jcambon * Copyright 2007-2009 Sun Microsystems, Inc.
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift */
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swiftpackage org.opends.server.tools.dsconfig;
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swiftimport org.opends.server.admin.client.ManagementContext;
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swiftimport org.opends.server.tools.ClientException;
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swiftimport org.opends.server.util.args.ArgumentException;
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swiftimport org.opends.server.util.args.SubCommandArgumentParser;
2824667843ac381238615f814a4ab354267b4f81jvergaraimport org.opends.server.util.cli.CommandBuilder;
950dae14045dfafef39e115efea5af8a78779bc9matthew_swiftimport org.opends.server.util.cli.ConsoleApplication;
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift/**
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * A factory for retrieving the management context which should be
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * used by the dsconfig application.
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * <p>
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * Factory implementations are responsible for registering their
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * required global options during initialization.
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift */
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swiftpublic interface ManagementContextFactory {
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift /**
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * Gets the management context which sub-commands should use in
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * order to manage the directory server. Implementations can use the
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * application instance for retrieving passwords interactively.
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift *
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * @param app
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * The application instance.
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * @return Returns the management context which sub-commands should
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * use in order to manage the directory server.
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * @throws ArgumentException
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * If a management context related argument could not be
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * parsed successfully.
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * @throws ClientException
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * If the management context could not be created.
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift */
49f497cfbd8165bbec0080a46c450e2672fd47e3matthew_swift ManagementContext getManagementContext(ConsoleApplication app)
49f497cfbd8165bbec0080a46c450e2672fd47e3matthew_swift throws ArgumentException, ClientException;
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift
2a562454b39c04d03b1c8f9441cb849ae1dc513blutoff /**
2a562454b39c04d03b1c8f9441cb849ae1dc513blutoff * Closes this management context.
2a562454b39c04d03b1c8f9441cb849ae1dc513blutoff */
2a562454b39c04d03b1c8f9441cb849ae1dc513blutoff void close();
2a562454b39c04d03b1c8f9441cb849ae1dc513blutoff
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift /**
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * Initializes this management context factory using the provided
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * parser. The management context factory can register global
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * options with the parser if required.
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift *
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * @param parser
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * The application sub-command argument parser.
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * @throws ArgumentException
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * If the factory failed to register its required global
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * options.
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift */
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift void registerGlobalArguments(SubCommandArgumentParser parser)
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift throws ArgumentException;
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift /**
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift * Set the raw arguments (used for default value setting).
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift *
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift * @param args raw arguments.
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift */
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift public void setRawArguments(String[] args);
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift
62ecec3a82a8b838ee76c1f6610902d8fd7015cbmatthew_swift
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift /**
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * Validates any global arguments passed to the application.
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * Implementations of this method should check that the values
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * passed to their global arguments are valid and are not
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * incompatible with each other.
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift *
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * @throws ArgumentException
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift * If the global arguments are invalid for some reason.
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift */
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift void validateGlobalArguments() throws ArgumentException;
2824667843ac381238615f814a4ab354267b4f81jvergara
2824667843ac381238615f814a4ab354267b4f81jvergara /**
2824667843ac381238615f814a4ab354267b4f81jvergara * Returns the command builder that provides the equivalent arguments in
2824667843ac381238615f814a4ab354267b4f81jvergara * interactive mode to get the management context.
2824667843ac381238615f814a4ab354267b4f81jvergara * @return the command builder that provides the equivalent arguments in
2824667843ac381238615f814a4ab354267b4f81jvergara * interactive mode to get the management context.
2824667843ac381238615f814a4ab354267b4f81jvergara */
2824667843ac381238615f814a4ab354267b4f81jvergara CommandBuilder getContextCommandBuilder();
c7adcf7755f9492075a6cc9ad913a0c5a3d2d46cmatthew_swift}