diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-03-24 02:27:47 -0500 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-03-26 11:43:54 -0500 |
commit | 621d9e5c413e561293d7484b93882d985b3fe15f (patch) | |
tree | 638f3d75761c121d9a8fb50b52a12a6686c5ac5c /base/silent/src/com/netscape/pkisilent/PKISilent.java | |
parent | 40d3643b8d91886bf210aa27f711731c81a11e49 (diff) | |
download | pki-621d9e5c413e561293d7484b93882d985b3fe15f.tar.gz pki-621d9e5c413e561293d7484b93882d985b3fe15f.tar.xz pki-621d9e5c413e561293d7484b93882d985b3fe15f.zip |
Removed unnecessary pki folder.
Previously the source code was located inside a pki folder.
This folder was created during svn migration and is no longer
needed. This folder has now been removed and the contents have
been moved up one level.
Ticket #131
Diffstat (limited to 'base/silent/src/com/netscape/pkisilent/PKISilent.java')
-rw-r--r-- | base/silent/src/com/netscape/pkisilent/PKISilent.java | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/base/silent/src/com/netscape/pkisilent/PKISilent.java b/base/silent/src/com/netscape/pkisilent/PKISilent.java new file mode 100644 index 000000000..f90832481 --- /dev/null +++ b/base/silent/src/com/netscape/pkisilent/PKISilent.java @@ -0,0 +1,59 @@ +package com.netscape.pkisilent; + +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.HashMap; + +public class PKISilent { + private static void usage() { + System.out.print("usage: java " + PKISilent.class.getCanonicalName()); + boolean first = true; + for (Class<?> c : classes) { + if (first) { + System.out.println(" [ "); + } else { + System.out.println(" | "); + } + first = false; + System.out.print(" " + c.getSimpleName()); + } + System.out.println(" ] "); + } + + static Class<?>[] classes = { ConfigureCA.class, ConfigureDRM.class, + ConfigureOCSP.class, ConfigureRA.class, ConfigureSubCA.class, + ConfigureTKS.class, ConfigureTPS.class, }; + + public static final void main(String[] args) { + HashMap<String, Method> classMap = new HashMap<String, Method>(); + for (Class<?> c : classes) { + try { + classMap.put(c.getSimpleName(), + c.getMethod("main", String[].class)); + } catch (Exception e) { + // The set of classes listed above is guaranteed to have a + // method 'main' + e.printStackTrace(); + } + } + if (args.length == 0) { + usage(); + System.exit(-1); + } + Method mainMethod = classMap.get(args[0]); + if (mainMethod == null) { + usage(); + System.exit(-1); + } + String[] innerArgs = {}; + if (args.length > 1) { + innerArgs = Arrays.copyOfRange(args, 1, args.length); + } + + try { + mainMethod.invoke(null, (Object) innerArgs); + } catch (Exception e) { + // exception is guaranteed to have the static main method + } + } +} |