KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > upgrade > common > arguments > ArgumentHandler


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 package com.sun.enterprise.tools.upgrade.common.arguments;
25
26 import java.util.Vector JavaDoc;
27 import java.util.logging.*;
28 import com.sun.enterprise.tools.upgrade.common.CommonInfoModel;
29 import com.sun.enterprise.tools.upgrade.logging.*;
30 import com.sun.enterprise.tools.upgrade.common.UpgradeUtils;
31 import java.util.Map JavaDoc;
32 import com.sun.enterprise.util.i18n.StringManager;
33
34 /**
35  *
36  * @author Hans Hrasna
37  */

38 public abstract class ArgumentHandler {
39     protected Logger _logger = LogService.getLogger(LogService.UPGRADE_LOGGER);
40     protected CommonInfoModel commonInfo;
41     protected Vector JavaDoc parameters;
42     protected StringManager sm;
43     protected UpgradeUtils utils;
44     protected Map JavaDoc interactiveMap;
45     
46     /** Creates a new instance of ArgumentHandler */
47     public ArgumentHandler(ParsedArgument pa) {
48         commonInfo = pa.getCommonInfo();
49         parameters = pa.getParameters();
50         sm = StringManager.getManager(LogService.UPGRADE_CLI_LOGGER);
51         utils = UpgradeUtils.getUpgradeUtils(commonInfo);
52         interactiveMap = pa.getInteractiveMap();
53     }
54     
55     protected void helpUsage(){
56         
57         System.out.println(sm.getString("enterprise.tools.upgrade.cli.usage"));
58         
59         if(commonInfo.isUpgradeJKStoNSS() || commonInfo.isUpgradeNSStoJKS()) {
60             System.out.println(sm.getString("enterprise.tools.upgrade.cli.convert_certs"));
61             System.out.println();
62             return;
63         }
64         
65         if(commonInfo.isUpgradeNSStoNSS()) {
66             System.out.println(sm.getString("enterprise.tools.upgrade.cli.NSS_certs"));
67             System.out.println();
68             return;
69         }
70         
71         if(commonInfo.isUpgradeJKStoJKS()) {
72             System.out.println(sm.getString("enterprise.tools.upgrade.cli.JKS_certs"));
73             System.out.println();
74             return;
75         }
76         System.out.println(sm.getString("enterprise.tools.upgrade.cli.convert_certs"));
77         System.out.println();
78     }
79     
80     protected void helpUsage(String JavaDoc msg) {
81         System.out.println(msg);
82         System.out.println();
83         helpUsage();
84     }
85 }
86
Popular Tags