KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mr > core > cmc > CommandDescriptor


1 /*
2  * Copyright 2002 by
3  * <a HREF="http://www.coridan.com">Coridan</a>
4  * <a HREF="mailto: support@coridan.com ">support@coridan.com</a>
5  *
6  * The contents of this file are subject to the Mozilla Public License Version
7  * 1.1 (the "License"); you may not use this file except in compliance with the
8  * License. You may obtain a copy of the License at
9  * http://www.mozilla.org/MPL/
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the
14  * License.
15  *
16  * The Original Code is "MantaRay" (TM).
17  *
18  * The Initial Developer of the Original Code is Amir Shevat.
19  * Portions created by the Initial Developer are Copyright (C) 2006
20  * Coridan Inc. All Rights Reserved.
21  *
22  * Contributor(s): all the names of the contributors are added in the source
23  * code where applicable.
24  *
25  * Alternatively, the contents of this file may be used under the terms of the
26  * LGPL license (the "GNU LESSER GENERAL PUBLIC LICENSE"), in which case the
27  * provisions of LGPL are applicable instead of those above. If you wish to
28  * allow use of your version of this file only under the terms of the LGPL
29  * License and not to allow others to use your version of this file under
30  * the MPL, indicate your decision by deleting the provisions above and
31  * replace them with the notice and other provisions required by the LGPL.
32  * If you do not delete the provisions above, a recipient may use your version
33  * of this file under either the MPL or the GNU LESSER GENERAL PUBLIC LICENSE.
34  
35  *
36  * This library is free software; you can redistribute it and/or modify it
37  * under the terms of the MPL as stated above or under the terms of the GNU
38  * Lesser General Public License as published by the Free Software Foundation;
39  * either version 2.1 of the License, or any later version.
40  *
41  * This library is distributed in the hope that it will be useful, but WITHOUT
42  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
43  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
44  * License for more details.
45  */

46 /*
47  * Created on Dec 25, 2003
48  *
49  * a mask of the command that can be sent via socket to a remote console
50  */

51 package org.mr.core.cmc;
52
53 import java.io.Serializable JavaDoc;
54
55 /**
56  * @author Amir Shevat
57  * CommandDescriptor - a mask of the command that can be sent via socket to a remote console
58  *
59  */

60 public class CommandDescriptor implements Serializable JavaDoc{
61     
62     private String JavaDoc name;
63     private String JavaDoc description;
64     private int numberOfArguments;
65     private String JavaDoc[] argumentsDescription;
66     private String JavaDoc registerName;
67
68     public CommandDescriptor(CMCCommand command){
69         this.name = command.getName();
70         this.registerName = command.getRegisterName();
71         this.description = command.getDescription();
72         this.numberOfArguments =command.getNumberOfArguments();
73         this.argumentsDescription = command.getArgumentsDescription();
74     }
75     
76
77     /**
78      * @return Returns the argumentsDescription.
79      */

80     public String JavaDoc[] getArgumentsDescription() {
81         return argumentsDescription;
82     }
83
84     /**
85      * @return Returns the description.
86      */

87     public String JavaDoc getDescription() {
88         return description;
89     }
90
91     /**
92      * @return Returns the name.
93      */

94     public String JavaDoc getName() {
95         return name;
96     }
97
98     /**
99      * @return Returns the numberOfArguments.
100      */

101     public int getNumberOfArguments() {
102         return numberOfArguments;
103     }
104     
105     /**
106      * @return Returns the registerName.
107      */

108     public String JavaDoc getRegisterName() {
109         return registerName;
110     }
111     
112     public String JavaDoc toString(){
113         StringBuffer JavaDoc buff = new StringBuffer JavaDoc();
114         buff.append("\r\nManagnemt command: ");
115         buff.append(getRegisterName());
116         buff.append("\r\nName: ");
117         buff.append(getName());
118         buff.append("\r\nDescription: ");
119         buff.append(getDescription());
120         buff.append("\r\nNumber Of Arguments: ");
121         buff.append(getNumberOfArguments());
122         
123         for(int count =0 ; count < getNumberOfArguments(); count++){
124             buff.append("\r\nArguments number "+(count+1)+" Description: ");
125             buff.append(getArgumentsDescription()[count]);
126         }
127         buff.append("\r\n");
128         return buff.toString();
129     }
130
131     
132
133 }
134
Popular Tags