issrg.pba.management
Class Utility

java.lang.Object
  extended by issrg.pba.management.Utility

public final class Utility
extends java.lang.Object

general methods.

Version:
0.1.2008.01.23
Author:
mfb4@kent.ac.uk

Method Summary
static void clear(char[] characterArray)
          Takes a character array and clear out all the characters.
static java.util.Map<java.lang.String,java.lang.String> commandLineProperties(java.lang.String[] args)
          Places the command line arguments into a map.
static java.io.FileInputStream getFileInputStream(java.lang.String fileName)
          Finds a file and returns an open input stream to it.
static java.lang.String[] getProviders(java.lang.String engine, java.lang.String service)
          get an array of provider names for a given engine service.
static java.lang.String[] getServices(java.lang.String engine)
          Gets an array of services for a given service engine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFileInputStream

public static java.io.FileInputStream getFileInputStream(java.lang.String fileName)
                                                  throws java.io.FileNotFoundException
Finds a file and returns an open input stream to it. If the file does not exist then return null.

Parameters:
fileName - name of the file to open
Returns:
an input stream to the file
Throws:
java.io.FileNotFoundException - if the fileName was not found
Since:
0.1.2008.01.23

clear

public static void clear(char[] characterArray)
Takes a character array and clear out all the characters. Arrays are passed by reference, so the passed in array is changed once this method has returned.

It is meant to clear passwords down.

Parameters:
characterArray - containing the password
Since:
0.1.2008.02.09

commandLineProperties

public static java.util.Map<java.lang.String,java.lang.String> commandLineProperties(java.lang.String[] args)
Places the command line arguments into a map. This method takes an array of strings, it assumes that any string that begins with a "-" is a name and the following string is its value. (unless the following string is also a name) in which case the name has not value "" .

Parameters:
args - command line arguments
Returns:
name value pair of properties
Since:
0.4.2008.04.01

getServices

public static java.lang.String[] getServices(java.lang.String engine)
Gets an array of services for a given service engine. e.g. "KeyStore"

Parameters:
engine - the engine (type of service)
Returns:
a list of services for the given engine
Since:
0.4.2008.04.02

getProviders

public static java.lang.String[] getProviders(java.lang.String engine,
                                              java.lang.String service)
get an array of provider names for a given engine service. e.g. "KeyStore" "PKCS12" .

Parameters:
engine - or type of service
service - the particular service
Returns:
a list of providers of the given service
Since:
0.4.2008.04.02