public class EncryptData
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private static int |
ACTION_DECRYPT |
private static int |
ACTION_ENCRYPT |
protected int |
ivAction
The type code for the data to process.
|
protected java.io.PrintStream |
ivLog
The stream where processing status messages are logged.
|
protected int |
ivType
The type code for the data to process.
|
private static long |
serialVersionUID
The class' serialization version id.
|
private static int |
TYPE_CREDITCARD |
private static int |
TYPE_PASSWORD |
Constructor and Description |
---|
EncryptData(java.lang.String type,
java.lang.String action,
java.io.PrintStream log)
Constructs a new encrypt data instance.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
columnToString(java.sql.ResultSet rs,
java.lang.String colname)
Returns a
String object from the given result set of database
records for the specified column name. |
void |
execute()
Controls the processing for the request parameters.
|
static void |
main(java.lang.String[] args)
The main entry point for when the class is started from a command line.
|
protected void |
processCreditCards(JDBCConnectionInfo cninf)
Process credit card data.
|
protected void |
processPasswords(JDBCConnectionInfo cninf)
Process password data.
|
private static final long serialVersionUID
private static final int TYPE_PASSWORD
private static final int TYPE_CREDITCARD
private static final int ACTION_ENCRYPT
private static final int ACTION_DECRYPT
protected int ivType
protected int ivAction
protected java.io.PrintStream ivLog
public EncryptData(java.lang.String type, java.lang.String action, java.io.PrintStream log)
type
- (String) The type code for the data to process.action
- (String) The action code for the data to process.log
- (PrintStream) The stream where processing status messages
are logged.public void execute()
protected void processCreditCards(JDBCConnectionInfo cninf) throws java.lang.Exception
cninf
- (JDBCConnectionInfo) The JDBC connection to use.java.lang.Exception
protected void processPasswords(JDBCConnectionInfo cninf) throws java.lang.Exception
cninf
- (JDBCConnectionInfo) The JDBC connection to use.java.lang.Exception
protected java.lang.String columnToString(java.sql.ResultSet rs, java.lang.String colname) throws java.sql.SQLException
String
object from the given result set of database
records for the specified column name.rs
- (ResultSet) The result set containing the database record
from which a column's string value is to be retrieved.colname
- (String) The name of the column from which a string
is to be retrieved and returned.String
.
A null column value is returned as an empty string.java.sql.SQLException
- if an error occurs while processing the
result set.public static void main(java.lang.String[] args)
args
- (String[]) A string array of startup parameters where
args[0] must be either "password" or "creditcard" and args[1]
must be either "encypt" or "decrypt".