|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.ca.pki.util.StaticUtil
This class provides utility functions as static methods.
| Field Summary | |
static boolean |
debugFlag
will be set to true if the app is started with -DDEBUG=yes |
static java.lang.String[] |
revocationReasons
|
| Constructor Summary | |
StaticUtil()
|
|
| Method Summary | |
static java.lang.String |
bytes2Hex(byte[] in)
Converts 'in' to a hexadecimal character string. |
static java.lang.String |
bytes2Hex(byte[] in,
int offset,
int len)
Converts 'len' bytes to a hexadecimal character string. |
static java.lang.String |
bytes2HexSplit(byte[] in,
int wordlength)
|
static java.lang.String |
bytes2HexSplit(byte[] in,
int wordlength,
int linelength)
|
static void |
center(java.awt.Component centerMe,
java.awt.Component positioner)
This positions a component to the center of another component. |
static java.lang.String |
checkDate(java.lang.String dateString)
Check if a date is in correct MM/dd/yyyy format |
static void |
checkDirectory(java.lang.String directoryPath)
Checks for the existence of a directory; if it doesn't already exist creates it |
static int |
checkDrive(char drive)
check if a drive is ready (windows specific code) return 0 if success |
static java.lang.String |
chooseFileToLoad(java.awt.Component parent,
java.lang.String title)
Show file chooser to get a file location for data loading. |
static java.lang.String |
chooseFileToLoad(java.awt.Component parent,
java.lang.String title,
java.lang.String[] filter,
java.lang.String fileType)
Show file chooser to get a file location for data loading. |
static java.lang.String |
chooseFileToSave(java.awt.Component parent,
java.lang.String title)
Show file chooser to get a file location for saving data. |
static java.lang.String |
chooseFileToSave(java.awt.Component parent,
java.lang.String title,
java.lang.String[] filter,
java.lang.String fileType)
Show file chooser to get a file location for saving data. |
static void |
configLogger(Logger logger,
java.util.Properties props,
java.lang.String logSuffix)
Method copied from RAServer: used to configure our customised Log4J writer |
static java.util.Date |
getDate(java.lang.String value)
Parses a date field, accept both "MM/dd/yyyy" or "now +/- years" format |
static java.awt.Frame |
getFrame(java.awt.Component c)
Return the parent frame of the component c. |
static java.lang.String |
getGeneralizedTime(java.util.Date adate)
|
static java.awt.Window |
getWindow(java.awt.Component c)
Return the parent window of the component c. |
static byte[] |
hex2Bytes(java.lang.String in)
Converts a hexadecimal character string to a byte array. |
static boolean |
isSameDay(java.util.Date date1,
java.util.Date date2)
Checks if two (yyyy,MM,dd) dates are the same |
static boolean |
isToday(java.util.Date date)
Checks a date if it is today's date by matching yyyy, MM, dd |
static java.util.Properties |
loadProperties(java.lang.String filename)
Loads properties from a file |
static void |
logAndDialog(Logger logger,
Priority logLevel,
java.lang.String message,
java.awt.Frame parentFrame,
int dialogType)
Write a log item and also pop an error dialog |
static boolean |
okToWriteFile(java.awt.Frame parent,
java.lang.String fileName)
|
static java.lang.String |
parseDate(java.lang.String value)
Parses a "MM/dd/yyyy" or "now +/- years" date field, returns a date string in format "MM/dd/yyyy" |
static boolean |
pkiConfigured()
Checks the value of the property 'Configuration' in %pkihome%\path_properties.config If the configuration has run successfully, this will be >0; if not pki still needs to be configured. |
static void |
printDebug(java.lang.String message)
will be set to true if the app is started with -DDEBUG=yes |
static int |
reasonCode(java.lang.String reason)
Returns revocation code from reason text |
static java.lang.String |
reasonText(int code)
Returns revocation text from reason code |
static java.lang.String |
removeCommas(java.lang.String inputDN)
Replace all commas (i.e. ',') enclosed in quotes (for example OU="CA, Glen Iris") by '~' so that the entry can be created in the publishing directory |
static java.lang.String |
replace(java.lang.String source,
java.lang.String oldPattern,
java.lang.String newPattern)
Replace all the appreances of oldPattern in a source string by newPattern. |
static void |
setBounds(java.awt.Component me,
int width,
int height,
java.awt.Component parent)
Locate component at the middle of the parent frame. |
static void |
setDefaultFont(java.awt.Font afont)
Set default system font. |
static void |
setLookAndFeel()
|
static void |
setLookAndFeelC(java.awt.Component comp)
|
static void |
storeProperties(java.lang.String filename,
java.util.Properties check,
java.lang.String header)
|
static java.util.Date |
toGMT(java.util.Date localTime)
convert a local time to GMT |
static java.lang.String |
toGMTDateString(java.lang.String dateString)
convert a local time to GMT date string which can be understood by OpenSSLWrap make it accurate to seconds if the given date is today's date |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String[] revocationReasons
public static boolean debugFlag
| Constructor Detail |
public StaticUtil()
| Method Detail |
public static java.awt.Frame getFrame(java.awt.Component c)
public static java.awt.Window getWindow(java.awt.Component c)
public static void setBounds(java.awt.Component me,
int width,
int height,
java.awt.Component parent)
me - the component we are setting bounds for.width - the preferred width of this component.parent - the parent component.public static void setLookAndFeelC(java.awt.Component comp)
public static void setLookAndFeel()
public static void setDefaultFont(java.awt.Font afont)
public static boolean pkiConfigured()
public static java.lang.String chooseFileToSave(java.awt.Component parent,
java.lang.String title)
public static java.lang.String chooseFileToSave(java.awt.Component parent,
java.lang.String title,
java.lang.String[] filter,
java.lang.String fileType)
public static java.lang.String chooseFileToLoad(java.awt.Component parent,
java.lang.String title)
public static java.lang.String chooseFileToLoad(java.awt.Component parent,
java.lang.String title,
java.lang.String[] filter,
java.lang.String fileType)
public static void center(java.awt.Component centerMe,
java.awt.Component positioner)
positioner - the component used as the reference center.public static java.util.Properties loadProperties(java.lang.String filename)
public static void storeProperties(java.lang.String filename,
java.util.Properties check,
java.lang.String header)
public static void checkDirectory(java.lang.String directoryPath)
public static java.lang.String bytes2Hex(byte[] in)
public static java.lang.String bytes2Hex(byte[] in,
int offset,
int len)
public static java.lang.String bytes2HexSplit(byte[] in,
int wordlength)
public static java.lang.String bytes2HexSplit(byte[] in,
int wordlength,
int linelength)
public static byte[] hex2Bytes(java.lang.String in)
public static int checkDrive(char drive)
public static boolean okToWriteFile(java.awt.Frame parent,
java.lang.String fileName)
public static int reasonCode(java.lang.String reason)
reason - revocation reason in text format, should be one of the revocationReasons
public static java.lang.String reasonText(int code)
code - revocation reason code, should be from 0 to 7public static java.util.Date toGMT(java.util.Date localTime)
public static java.lang.String toGMTDateString(java.lang.String dateString)
public static boolean isToday(java.util.Date date)
public static boolean isSameDay(java.util.Date date1,
java.util.Date date2)
public static java.util.Date getDate(java.lang.String value)
public static java.lang.String checkDate(java.lang.String dateString)
throws java.lang.Exception
java.lang.Exceptionpublic static java.lang.String parseDate(java.lang.String value)
public static java.lang.String replace(java.lang.String source,
java.lang.String oldPattern,
java.lang.String newPattern)
public static java.lang.String removeCommas(java.lang.String inputDN)
public static java.lang.String getGeneralizedTime(java.util.Date adate)
public static void printDebug(java.lang.String message)
public static void configLogger(Logger logger,
java.util.Properties props,
java.lang.String logSuffix)
logger - the logger object to be configuredprops - a Properties object that store information as where to write
log info to, which log level is used, and if there is a key for signing log entrieslogSuffix - an application might have multiple log files, the props object
only stores the location of the principle log file, other log file names can be
specified by appending this suffix to the principle log file.
public static void logAndDialog(Logger logger,
Priority logLevel,
java.lang.String message,
java.awt.Frame parentFrame,
int dialogType)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||