OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [tools/] [gnu/] [classpath/] [tools/] [keytool/] [IdentityDBCmd.java] - Blame information for rev 779

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 779 jeremybenn
/* IdentityDBCmd.java -- The identitydb command handler of the keytool
2
   Copyright (C) 2006 Free Software Foundation, Inc.
3
 
4
This file is part of GNU Classpath.
5
 
6
GNU Classpath is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
9
any later version.
10
 
11
GNU Classpath is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GNU Classpath; see the file COPYING.  If not, write to the
18
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
02110-1301 USA.
20
 
21
Linking this library statically or dynamically with other modules is
22
making a combined work based on this library.  Thus, the terms and
23
conditions of the GNU General Public License cover the whole
24
combination.
25
 
26
As a special exception, the copyright holders of this library give you
27
permission to link this library with independent modules to produce an
28
executable, regardless of the license terms of these independent
29
modules, and to copy and distribute the resulting executable under
30
terms of your choice, provided that you also meet, for each linked
31
independent module, the terms and conditions of the license of that
32
module.  An independent module is a module which is not derived from
33
or based on this library.  If you modify this library, you may extend
34
this exception to your version of the library, but you are not
35
obligated to do so.  If you do not wish to do so, delete this
36
exception statement from your version. */
37
 
38
 
39
package gnu.classpath.tools.keytool;
40
 
41
import gnu.classpath.Configuration;
42
import gnu.classpath.tools.common.ClasspathToolParser;
43
import gnu.classpath.tools.getopt.Option;
44
import gnu.classpath.tools.getopt.OptionException;
45
import gnu.classpath.tools.getopt.OptionGroup;
46
import gnu.classpath.tools.getopt.Parser;
47
 
48
import java.util.logging.Logger;
49
 
50
/**
51
 * <b>NOT IMPLEMENTED YET</b>
52
 * <p>
53
 * The <b>-identitydb</b> keytool command handler is used to read the JDK 1.1.x-
54
 * style identity database and add its entries to the key store. If a key store
55
 * does not exist, it is created.
56
 * <p>
57
 * Possible options for this command are:
58
 * <p>
59
 * <dl>
60
 *      <dt>-file FILE_NAME</dt>
61
 *      <dd>The fully qualified path of the identity file to import. If this
62
 *      option is omitted, the tool will process STDIN.
63
 *      <p></dd>
64
 *
65
 *      <dt>-storetype STORE_TYPE</dt>
66
 *      <dd>Use this option to specify the type of the key store to use. The
67
 *      default value, if this option is omitted, is that of the property
68
 *      <code>keystore.type</code> in the security properties file, which is
69
 *      obtained by invoking the {@link java.security.KeyStore#getDefaultType()}
70
 *      static method.
71
 *      <p></dd>
72
 *
73
 *      <dt>-keystore URL</dt>
74
 *      <dd>Use this option to specify the location of the key store to use.
75
 *      The default value is a file {@link java.net.URL} referencing the file
76
 *      named <code>.keystore</code> located in the path returned by the call to
77
 *      {@link java.lang.System#getProperty(String)} using <code>user.home</code>
78
 *      as argument.
79
 *      <p>
80
 *      If a URL was specified, but was found to be malformed --e.g. missing
81
 *      protocol element-- the tool will attempt to use the URL value as a file-
82
 *      name (with absolute or relative path-name) of a key store --as if the
83
 *      protocol was <code>file:</code>.
84
 *      <p></dd>
85
 *
86
 *      <dt>-storepass PASSWORD</dt>
87
 *      <dd>Use this option to specify the password protecting the key store. If
88
 *      this option is omitted from the command line, you will be prompted to
89
 *      provide a password.
90
 *      <p></dd>
91
 *
92
 *      <dt>-provider PROVIDER_CLASS_NAME</dt>
93
 *      <dd>A fully qualified class name of a Security Provider to add to the
94
 *      current list of Security Providers already installed in the JVM in-use.
95
 *      If a provider class is specified with this option, and was successfully
96
 *      added to the runtime --i.e. it was not already installed-- then the tool
97
 *      will attempt to removed this Security Provider before exiting.
98
 *      <p></dd>
99
 *
100
 *      <dt>-v</dt>
101
 *      <dd>Use this option to enable more verbose output.</dd>
102
 * </dl>
103
 */
104
class IdentityDBCmd extends Command
105
{
106
  private static final Logger log = Logger.getLogger(IdentityDBCmd.class.getName());
107
  protected String _idbFileName;
108
  protected String _ksType;
109
  protected String _ksURL;
110
  protected String _ksPassword;
111
  protected String _providerClassName;
112
 
113
  // default 0-arguments constructor
114
 
115
  // public setters -----------------------------------------------------------
116
 
117
  /** @param pathName the fully qualified path name of the file to process. */
118
  public void setFile(String pathName)
119
  {
120
    this._idbFileName = pathName;
121
  }
122
 
123
  /** @param type the key-store type to use. */
124
  public void setStoretype(String type)
125
  {
126
    this._ksType = type;
127
  }
128
 
129
  /** @param url the key-store URL to use. */
130
  public void setKeystore(String url)
131
  {
132
    this._ksURL = url;
133
  }
134
 
135
  /** @param password the key-store password to use. */
136
  public void setStorepass(String password)
137
  {
138
    this._ksPassword = password;
139
  }
140
 
141
  /** @param className a security provider fully qualified class name to use. */
142
  public void setProvider(String className)
143
  {
144
    this._providerClassName = className;
145
  }
146
 
147
  // life-cycle methods -------------------------------------------------------
148
 
149
  void setup() throws Exception
150
  {
151
    setInputStreamParam(_idbFileName);
152
    setKeyStoreParams(true, _providerClassName, _ksType, _ksPassword, _ksURL);
153
    if (Configuration.DEBUG)
154
      {
155
        log.fine("-identitydb handler will use the following options:"); //$NON-NLS-1$
156
        log.fine("  -file=" + _idbFileName); //$NON-NLS-1$
157
        log.fine("  -storetype=" + storeType); //$NON-NLS-1$
158
        log.fine("  -keystore=" + storeURL); //$NON-NLS-1$
159
        log.fine("  -provider=" + provider); //$NON-NLS-1$
160
        log.fine("  -v=" + verbose); //$NON-NLS-1$
161
      }
162
  }
163
 
164
  // own methods --------------------------------------------------------------
165
 
166
  Parser getParser()
167
  {
168
    if (Configuration.DEBUG)
169
      log.entering(this.getClass().getName(), "getParser"); //$NON-NLS-1$
170
    Parser result = new ClasspathToolParser(Main.IDENTITYDB_CMD, true);
171
    result.setHeader(Messages.getString("IdentityDBCmd.7")); //$NON-NLS-1$
172
    result.setFooter(Messages.getString("IdentityDBCmd.8")); //$NON-NLS-1$
173
    OptionGroup options = new OptionGroup(Messages.getString("IdentityDBCmd.9")); //$NON-NLS-1$
174
    options.add(new Option(Main.FILE_OPT,
175
                           Messages.getString("IdentityDBCmd.10"), //$NON-NLS-1$
176
                           Messages.getString("IdentityDBCmd.11")) //$NON-NLS-1$
177
    {
178
      public void parsed(String argument) throws OptionException
179
      {
180
        _idbFileName = argument;
181
      }
182
    });
183
    options.add(new Option(Main.STORETYPE_OPT,
184
                           Messages.getString("IdentityDBCmd.12"), //$NON-NLS-1$
185
                           Messages.getString("IdentityDBCmd.13")) //$NON-NLS-1$
186
    {
187
      public void parsed(String argument) throws OptionException
188
      {
189
        _ksType = argument;
190
      }
191
    });
192
    options.add(new Option(Main.KEYSTORE_OPT,
193
                           Messages.getString("IdentityDBCmd.14"), //$NON-NLS-1$
194
                           Messages.getString("IdentityDBCmd.15")) //$NON-NLS-1$
195
    {
196
      public void parsed(String argument) throws OptionException
197
      {
198
        _ksURL = argument;
199
      }
200
    });
201
    options.add(new Option(Main.STOREPASS_OPT,
202
                           Messages.getString("IdentityDBCmd.16"), //$NON-NLS-1$
203
                           Messages.getString("IdentityDBCmd.17")) //$NON-NLS-1$
204
    {
205
      public void parsed(String argument) throws OptionException
206
      {
207
        _ksPassword = argument;
208
      }
209
    });
210
    options.add(new Option(Main.PROVIDER_OPT,
211
                           Messages.getString("IdentityDBCmd.18"), //$NON-NLS-1$
212
                           Messages.getString("IdentityDBCmd.19")) //$NON-NLS-1$
213
    {
214
      public void parsed(String argument) throws OptionException
215
      {
216
        _providerClassName = argument;
217
      }
218
    });
219
    options.add(new Option(Main.VERBOSE_OPT,
220
                           Messages.getString("IdentityDBCmd.20")) //$NON-NLS-1$
221
    {
222
      public void parsed(String argument) throws OptionException
223
      {
224
        verbose = true;
225
      }
226
    });
227
    result.add(options);
228
    if (Configuration.DEBUG)
229
      log.exiting(this.getClass().getName(), "getParser", result); //$NON-NLS-1$
230
    return result;
231
  }
232
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.