KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > dyade > aaa > admin > script > Script


1 /*
2  * Copyright (C) 2001 - 2004 ScalAgent Distributed Technologies
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17  * USA.
18  *
19  * Initial developer(s): ScalAgent Distributed Technologies
20  * Contributor(s):
21  */

22 package fr.dyade.aaa.admin.script;
23
24 import java.lang.*;
25 import java.io.*;
26 import java.util.*;
27 import fr.dyade.aaa.admin.cmd.*;
28 import fr.dyade.aaa.agent.conf.*;
29
30 /**
31  * Script contains an AdminCmd vector. Each commands permits to
32  * create/remove domain, network, server and set/unset property or
33  * jvm argument in A3CMLConfig (configuration).
34  *
35  * @see fr.dyade.aaa.agent.AgentAdmin
36  * @see AdminCmd
37  * @see A3CMLConfig
38  */

39 public class Script implements Serializable, Cloneable JavaDoc {
40   /** AdminCmd Vector */
41   private Vector commands = null;
42   /** create new configuration */
43   public boolean newConfig = false;
44
45  /**
46   * Script
47   *
48   * @see AgentAdmin
49   */

50   public Script() {
51     commands = new Vector();
52   }
53
54   public void add(AdminCmd cmd) {
55     commands.addElement(cmd);
56   }
57
58   public boolean remove(AdminCmd cmd) {
59     return commands.removeElement(cmd);
60   }
61
62   public boolean contains(AdminCmd cmd) {
63     return commands.contains(cmd);
64   }
65
66   public boolean isEmpty() {
67     return commands.isEmpty();
68   }
69
70   public Enumeration elements() {
71     return commands.elements();
72   }
73
74   public int size() {
75     return commands.size();
76   }
77
78   public Object JavaDoc elementAt(int i)
79     throws ArrayIndexOutOfBoundsException JavaDoc {
80     return commands.elementAt(i);
81   }
82
83   public Object JavaDoc firstElement()
84     throws NoSuchElementException {
85     return commands.firstElement();
86   }
87
88   public String JavaDoc toString() {
89     return commands.toString();
90   }
91
92   public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
93     Script clone = (Script)super.clone();
94     clone.commands = (Vector)commands.clone();
95     clone.newConfig = newConfig;
96     return clone;
97   }
98 }
99
Popular Tags