KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > diagnostics > CLIOptions


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 package com.sun.enterprise.diagnostics;
24
25 import java.util.Map JavaDoc;
26 import java.util.Date JavaDoc;
27
28
29 /**
30  * Represents CLI options and operand provided by the user
31  * at the time of report generation
32  * @author Manisha Umbarje
33  */

34 public class CLIOptions {
35
36     private static final String JavaDoc OUTPUT_FILE ="outputfile";
37     private static final String JavaDoc FILE ="file";
38     private static final String JavaDoc CUSTOMER_INPUT ="input";
39     private static final String JavaDoc BUG_IDS = "bugids";
40     private static final String JavaDoc LOG_START_DATE = "logstartdate";
41     private static final String JavaDoc LOG_END_DATE = "logenddate";
42     private static final String JavaDoc TARGET_DIR = "targetdir";
43     //private static final String LOCAL_FLAG = "local";
44
private static final String JavaDoc TARGET ="target";
45     private static final String JavaDoc USER = "user";
46     private static final String JavaDoc PASSWD = "passwd";
47     private static final String JavaDoc LOCAL_FLAG = "local";
48     private Date JavaDoc startDate ;
49     private Date JavaDoc endDate;
50     private String JavaDoc customerInput;
51     private String JavaDoc customerInputFile;
52     private String JavaDoc bugIds;
53     private String JavaDoc destReportFile;
54     //private boolean local;
55
private String JavaDoc reportDir;
56     private String JavaDoc targetDir;
57     private String JavaDoc targetName;
58     private String JavaDoc targetType;
59     private String JavaDoc user;
60     private String JavaDoc passwd;
61     private boolean local;
62     
63     private Map JavaDoc map;
64     public CLIOptions(Map JavaDoc options) {
65         
66         this((Date JavaDoc)options.get(LOG_START_DATE),
67             (Date JavaDoc)options.get(LOG_END_DATE),
68             (String JavaDoc)options.get(FILE),
69             (String JavaDoc)options.get(CUSTOMER_INPUT),
70             (String JavaDoc)options.get(BUG_IDS),
71             (String JavaDoc)options.get(OUTPUT_FILE),
72             (String JavaDoc)options.get(TARGET_DIR),
73             (String JavaDoc)options.get(TARGET),
74             (String JavaDoc)options.get(USER),
75             (String JavaDoc)options.get(PASSWD),
76             Boolean.valueOf((String JavaDoc)options.get(LOCAL_FLAG)).booleanValue());
77             this.map = options;
78         
79             
80     }
81
82     public CLIOptions(Date JavaDoc startDate, Date JavaDoc endDate, String JavaDoc file,
83             String JavaDoc customerInput, String JavaDoc bugIds, String JavaDoc destReportFile,
84             String JavaDoc targetDir,String JavaDoc targetName, String JavaDoc user, String JavaDoc passwd,
85             boolean local) {
86     this.startDate = startDate;
87     this.endDate = endDate;
88     this.targetName = targetName;
89     this.targetDir = targetDir;
90     this.destReportFile = destReportFile;
91     this.local = local;
92         this.customerInputFile = file;
93         this.customerInput = customerInput;
94         this.bugIds = bugIds;
95         this.user = user;
96         this.passwd = passwd;
97     }
98
99     /**
100      * Begin Date from which server.log contents need to be copied
101      */

102     public Date JavaDoc getStartDate() {
103     return startDate;
104     }
105
106     /**
107      * End Date to which server.log entries need to be collected
108      */

109     public Date JavaDoc getEndDate() {
110     return endDate;
111     }
112
113     /**
114      * Returns true if command is being run in local mode
115      */

116     public boolean isLocal() {
117     return local;
118     }
119
120     /**
121      * Returns value of CLI option - targetDir if command is being
122      * run in local mode
123      */

124     public String JavaDoc getTargetDir() {
125     return targetDir;
126     }
127
128     /**
129      * Returns targetName
130      */

131     public String JavaDoc getTargetName() {
132     return targetName;
133     }
134
135     
136     /**
137      * Returns name of generated report in compressed format
138      */

139     public String JavaDoc getReportFile() {
140     return destReportFile;
141     }
142   
143     /**
144      * Returns name of customer input file
145      * @return customer supplied text file
146      */

147     public String JavaDoc getCustomerInputFile() {
148         return customerInputFile;
149     }
150     
151     /**
152      * Returns customer input entered by user in admin GUI
153      * @return customer supplied text
154      */

155     public String JavaDoc getCustomerInput() {
156         return customerInput;
157     }
158
159
160     /**
161      * Returns bugids provided by the customer
162      * @return bugids entered by customer
163      */

164     public String JavaDoc getBugIds() {
165         return bugIds;
166     }
167     
168     /**
169      * Returns user
170      */

171     public String JavaDoc getUser() {
172         return user;
173     }
174     
175     /**
176      * Returns passwd
177      */

178     public String JavaDoc getPasswd() {
179         return passwd;
180     }
181     
182     public String JavaDoc toString() {
183         return getTargetDir() + "," + getTargetName() + "," +
184                 getCustomerInputFile() + "," + getBugIds() +
185                 "," + getStartDate() +
186                 "," + getEndDate() + "," + getReportFile();
187                 
188     }
189     
190     public Map JavaDoc getMap() {
191         return map;
192     }
193 }
194
Popular Tags