KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > cli > framework > ICommandEnvironment


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * $Id: ICommandEnvironment.java,v 1.3 2005/12/25 03:47:00 tcfujii Exp $
26  */

27
28 package com.sun.enterprise.cli.framework;
29
30 import java.util.HashMap JavaDoc;
31
32 /**
33     All the <strong> Subcommands </strong> operate in an Environment which
34     itself is set by some other Subcommands. This way, some Subcommands
35     <strong> create </strong> an Environment and others <strong> use this
36     environment. This interface represents such an Environment that provides
37     data required by SubCommands to execute successfully. Any Subcommand can
38     override the data set in an Environment (in which it is executed)
39     by parsing the arguments supplied on its own command line. Potentially
40     there can be multiple Environments. An Environment consists of a
41     variable set of Named Options. The Subcommands that create Environment,
42     modify this set whenever they are executed. Thus any Option in an
43     Environment represents an Environment Setting.
44  */

45 public interface ICommandEnvironment
46 {
47     /**
48        Adds Environment.
49        Environment have unique names. Successive calls to this method
50        with same name would result in replacement of the environment.
51     */

52     public void setEnvironment(String JavaDoc name, String JavaDoc value);
53
54
55     /**
56        Removes an environment. Does nothing if environment does not exist.
57        returns null if environment could not be removed.
58     */

59     public Object JavaDoc removeEnvironment( String JavaDoc name );
60
61     /**
62     Returns an iterator over collection of Option objects.
63     */

64     public HashMap JavaDoc getEnvironments();
65
66     /**
67      * returns the envrionment value by the given key
68      */

69     public Object JavaDoc getEnvironmentValue(String JavaDoc key);
70
71
72     /**
73     Returns a string format of the list of options in the environment.
74     */

75     public String JavaDoc toString();
76
77     /**
78     Returns the number of environments
79     */

80     public int getNumEnvironments();
81
82 }
83
Popular Tags