Author: dblevins
Date: Sat Oct 10 07:51:57 2009
New Revision: 823810

URL: http://svn.apache.org/viewvc?rev=823810&view=rev
Log:
Looks big but is a simple rename from codec->cipher, encode->encrypt, 
decode->decrypt

Added:
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/Cipher.java
      - copied, changed from r823805, 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/Codec.java
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PasswordCipher.java
      - copied, changed from r823801, 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PasswordCodec.java
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PlainTextPasswordCipher.java
      - copied, changed from r823801, 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PlainTextPasswordCodec.java
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/StaticDESPasswordCipher.java
      - copied, changed from r823801, 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/StaticDESPasswordCodec.java
    
openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.cli/cipher
      - copied, changed from r823801, 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.cli/codec
    
openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.resource.jdbc.PasswordCipher/
      - copied from r823801, 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.resource.jdbc.PasswordCodec/
Removed:
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/Codec.java
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PasswordCodec.java
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PlainTextPasswordCodec.java
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/StaticDESPasswordCodec.java
    
openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.cli/codec
    
openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.resource.jdbc.PasswordCodec/
Modified:
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/BasicDataSource.java
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/BasicDataSourceUtil.java
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/BasicManagedDataSource.java
    
openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.resource.jdbc.PasswordCipher/PlainText
    
openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.resource.jdbc.PasswordCipher/Static3DES
    
openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/Messages.properties
    
openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/PasswordCodecTest.java

Copied: 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/Cipher.java
 (from r823805, 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/Codec.java)
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/Cipher.java?p2=openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/Cipher.java&p1=openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/Codec.java&r1=823805&r2=823810&rev=823810&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/Codec.java
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/Cipher.java
 Sat Oct 10 07:51:57 2009
@@ -28,17 +28,17 @@
 import org.apache.commons.cli.PosixParser;
 import org.apache.openejb.cli.SystemExitException;
 import org.apache.openejb.resource.jdbc.BasicDataSourceUtil;
-import org.apache.openejb.resource.jdbc.PasswordCodec;
+import org.apache.openejb.resource.jdbc.PasswordCipher;
 import org.apache.openejb.util.Messages;
 
 /**
- * Command line tool on top of the {...@link PasswordCodec} interface. 
Basically,
- * it allows end user to encode/decode a string (ie. a password) using a codec
+ * Command line tool on top of the {...@link 
org.apache.openejb.resource.jdbc.PasswordCipher} interface. Basically,
+ * it allows end user to encrypt/decrypt a string (ie. a password) using a 
cipher
  * implementation.
  */
-public class Codec {
+public class Cipher {
 
-    private static Messages messages = new Messages(Codec.class);
+    private static Messages messages = new Messages(Cipher.class);
 
     public static void main(String[] args) throws SystemExitException {
 
@@ -46,10 +46,10 @@
 
         // create the Options
         Options options = new Options();
-        options.addOption(option("h", "help", "cmd.codec.opt.help"));
-        options.addOption(option("i", "codec", "i", "cmd.codec.opt.impl"));
-        options.addOption(option("d", "decode", "cmd.codec.opt.decode"));
-        options.addOption(option("e", "encode", "cmd.codec.opt.encode"));
+        options.addOption(option("h", "help", "cmd.cipher.opt.help"));
+        options.addOption(option("c", "cipher", "c", "cmd.cipher.opt.impl"));
+        options.addOption(option("d", "decrypt", "cmd.cipher.opt.decrypt"));
+        options.addOption(option("e", "encrypt", "cmd.cipher.opt.encrypt"));
 
         CommandLine line;
         try {
@@ -65,34 +65,34 @@
             return;
         }
 
-        if (!line.hasOption("codec")) {
-            System.out.println("Must specify the PasswordCodec implementation 
to use.");
+        if (!line.hasOption("cipher")) {
+            System.out.println("Must specify the PasswordCipher implementation 
to use.");
             help(options);
             return;
         }
 
         if (line.getArgList().size() != 1) {
-            System.out.println("Must specify either a plain text to encode, 
either a ciphered value to decode.");
+            System.out.println("Must specify either a plain text to encrypt, 
either a ciphered value to decrypt.");
             help(options);
             return;
         }
 
         try {
-            PasswordCodec codec = 
BasicDataSourceUtil.getPasswordCodec(line.getOptionValue("codec"));
+            PasswordCipher cipher = 
BasicDataSourceUtil.getPasswordCipher(line.getOptionValue("cipher"));
 
-            if (line.hasOption("decode")) {
+            if (line.hasOption("decrypt")) {
                 String pwdArg = (String) line.getArgList().get(0);
-                char[] encodedPassword = pwdArg.toCharArray();
-                System.out.println("The plain text value for " + pwdArg + " is 
" + codec.decode(encodedPassword));
+                char[] encryptdPassword = pwdArg.toCharArray();
+                System.out.println("The plain text value for " + pwdArg + " is 
" + cipher.decrypt(encryptdPassword));
 
-            } else { // if option neither encode/decode is specified, we assume
-                     // it is encode.
+            } else { // if option neither encrypt/decrypt is specified, we 
assume
+                     // it is encrypt.
                 String plainPassword = (String) line.getArgList().get(0);
-                System.out.println("The encode value for " + plainPassword + " 
is " + new String(codec.encode(plainPassword)));
+                System.out.println("The encrypt value for " + plainPassword + 
" is " + new String(cipher.encrypt(plainPassword)));
             }
 
         } catch (SQLException e) {
-            System.out.println("Could not load password codec implementation 
class. Check your classpath.");
+            System.out.println("Could not load password cipher implementation 
class. Check your classpath.");
             throw new SystemExitException(-1);
         }
 
@@ -100,7 +100,7 @@
 
     private static void help(Options options) {
         HelpFormatter formatter = new HelpFormatter();
-        formatter.printHelp("codec [options] <value>", "\n" + 
i18n("cmd.codec.description"), options, "\n");
+        formatter.printHelp("cipher [options] <value>", "\n" + 
i18n("cmd.cipher.description"), options, "\n");
     }
 
     private static Option option(String shortOpt, String longOpt, String 
description) {

Modified: 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/BasicDataSource.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/BasicDataSource.java?rev=823810&r1=823809&r2=823810&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/BasicDataSource.java
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/BasicDataSource.java
 Sat Oct 10 07:51:57 2009
@@ -23,7 +23,6 @@
 
 import javax.sql.DataSource;
 
-import org.apache.commons.dbcp.SQLNestedException;
 import org.apache.openejb.loader.SystemInstance;
 
 public class BasicDataSource extends org.apache.commons.dbcp.BasicDataSource {
@@ -33,9 +32,9 @@
      * ciphered value.
      * 
      * <em>The default is no codec.</em>. In other words, it means password is
-     * not ciphered. The {...@link PlainTextPasswordCodec} can also be used.
+     * not ciphered. The {...@link PlainTextPasswordCipher} can also be used.
      */
-    private String passwordCodecClass = null;
+    private String passwordCipher = null;
 
     /**
      * Returns the password codec class name to use to retrieve plain text
@@ -43,20 +42,20 @@
      * 
      * @return the password codec class
      */
-    public synchronized String getPasswordCodecClass() {
-        return this.passwordCodecClass;
+    public synchronized String getPasswordCipher() {
+        return this.passwordCipher;
     }
 
     /**
      * <p>
-     * Sets the {...@link #passwordCodecClass}.
+     * Sets the {...@link #passwordCipher}.
      * </p>
      * 
-     * @param passwordCodecClass
+     * @param passwordCipher
      *            password codec value
      */
-    public synchronized void setPasswordCodecClass(String passwordCodecClass) {
-        this.passwordCodecClass = passwordCodecClass;
+    public synchronized void setPasswordCipher(String passwordCipher) {
+        this.passwordCipher = passwordCipher;
     }
     
 
@@ -96,9 +95,9 @@
         }
         
         // check password codec if available
-        if (null != passwordCodecClass) {
-            PasswordCodec codec = 
BasicDataSourceUtil.getPasswordCodec(passwordCodecClass);
-            String plainPwd = codec.decode(password.toCharArray());
+        if (null != passwordCipher) {
+            PasswordCipher cipher = 
BasicDataSourceUtil.getPasswordCipher(passwordCipher);
+            String plainPwd = cipher.decrypt(password.toCharArray());
 
             // override previous password value
             super.setPassword(plainPwd);
@@ -130,5 +129,5 @@
             }
         }
     }
-    
+
 }

Modified: 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/BasicDataSourceUtil.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/BasicDataSourceUtil.java?rev=823810&r1=823809&r2=823810&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/BasicDataSourceUtil.java
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/BasicDataSourceUtil.java
 Sat Oct 10 07:51:57 2009
@@ -84,7 +84,7 @@
     }
     
     /**
-     * Create a {...@link PasswordCodec} instance from the
+     * Create a {...@link PasswordCipher} instance from the
      * {...@link #passwordCodecClass}.
      * 
      * @param passwordCodecClass the password codec to look for
@@ -93,7 +93,7 @@
      * @throws SQLException
      *             if the driver can not be found.
      */
-    public static PasswordCodec getPasswordCodec(String passwordCodecClass) 
throws SQLException {
+    public static PasswordCipher getPasswordCipher(String passwordCodecClass) 
throws SQLException {
         // Load the password codec class
         Class pwdCodec = null;
 
@@ -101,7 +101,7 @@
         ResourceFinder finder = new ResourceFinder("META-INF/");
         Map<String, Class> impls;
         try {
-            impls = finder.mapAllImplementations(PasswordCodec.class);
+            impls = finder.mapAllImplementations(PasswordCipher.class);
             
         } catch (Throwable t) {
             String message = 
@@ -128,15 +128,15 @@
         }
 
         // Create an instance
-        PasswordCodec codec = null;
+        PasswordCipher cipher = null;
         try {
-            codec = (PasswordCodec) pwdCodec.newInstance();
+            cipher = (PasswordCipher) pwdCodec.newInstance();
 
         } catch (Throwable t) {
             String message = "Cannot create password codec instance";
             throw new SQLNestedException(message, t);
         }
 
-        return codec;
+        return cipher;
     }
 }

Modified: 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/BasicManagedDataSource.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/BasicManagedDataSource.java?rev=823810&r1=823809&r2=823810&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/BasicManagedDataSource.java
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/BasicManagedDataSource.java
 Sat Oct 10 07:51:57 2009
@@ -32,9 +32,9 @@
      * ciphered value.
      * 
      * <em>The default is no codec.</em>. In other words, it means password is
-     * not ciphered. The {...@link PlainTextPasswordCodec} can also be used.
+     * not ciphered. The {...@link PlainTextPasswordCipher} can also be used.
      */
-    private String passwordCodecClass = null;
+    private String passwordCipher = null;
 
     /**
      * Returns the password codec class name to use to retrieve plain text
@@ -42,20 +42,20 @@
      * 
      * @return the password codec class
      */
-    public synchronized String getPasswordCodecClass() {
-        return this.passwordCodecClass;
+    public synchronized String getPasswordCipher() {
+        return this.passwordCipher;
     }
 
     /**
      * <p>
-     * Sets the {...@link #passwordCodecClass}.
+     * Sets the {...@link #passwordCipher}.
      * </p>
      * 
-     * @param passwordCodecClass
+     * @param passwordCipher
      *            password codec value
      */
-    public synchronized void setPasswordCodecClass(String passwordCodecClass) {
-        this.passwordCodecClass = passwordCodecClass;
+    public synchronized void setPasswordCipher(String passwordCipher) {
+        this.passwordCipher = passwordCipher;
     }
     
     public synchronized String getUserName() {
@@ -94,9 +94,9 @@
         }
         
         // check password codec if available
-        if (null != passwordCodecClass) {
-            PasswordCodec codec = 
BasicDataSourceUtil.getPasswordCodec(passwordCodecClass);
-            String plainPwd = codec.decode(password.toCharArray());
+        if (null != passwordCipher) {
+            PasswordCipher cipher = 
BasicDataSourceUtil.getPasswordCipher(passwordCipher);
+            String plainPwd = cipher.decrypt(password.toCharArray());
 
             // override previous password value
             super.setPassword(plainPwd);
@@ -132,5 +132,5 @@
 
     protected void wrapTransactionManager() {
     }
-    
+
 }

Copied: 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PasswordCipher.java
 (from r823801, 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PasswordCodec.java)
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PasswordCipher.java?p2=openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PasswordCipher.java&p1=openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PasswordCodec.java&r1=823801&r2=823810&rev=823810&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PasswordCodec.java
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PasswordCipher.java
 Sat Oct 10 07:51:57 2009
@@ -18,18 +18,18 @@
 package org.apache.openejb.resource.jdbc;
 
 /**
- * Implementations of {...@link PasswordCodec} allow to encode and decode 
passwords
+ * Implementations of {...@link PasswordCipher} allow to encode and decode 
passwords
  * used to connect to a database.
  * <p/>
  * Several implementations may exist, as several encryption algorithms may be
  * supported. One-way encryption algorithm (hash) can't be used as we need to
- * give a plain password to the database. {...@link #encode(String)} method is 
not
+ * give a plain password to the database. {...@link #encrypt(String)} method 
is not
  * mandatory as we don't need to encode a password, but it's useful to get the
  * encrypted value for a given plain text password. In the case you have
  * implemented both methods, you can use the PasswordCodec command line tool to
  * encode/decode a password.
  */
-public interface PasswordCodec {
+public interface PasswordCipher {
 
     /**
      * Encodes a given plain text password and returns the encoded password.
@@ -38,16 +38,16 @@
      *            The password to encode. May not be <code>null</code>, nor 
empty.
      * @return The encoded password.
      */
-    public char[] encode(String plainPassword);
+    public char[] encrypt(String plainPassword);
 
     /**
      * Decodes an encoded password and returns a plain text password.
      * 
-     * @param encodedPassword
+     * @param encryptedPassword
      *            The ciphered password to decode. May not be 
<code>null</code>,
      *            nor empty.
      * @return The plain text password.
      */
-    public String decode(char[] encodedPassword);
+    public String decrypt(char[] encryptedPassword);
 
 }

Copied: 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PlainTextPasswordCipher.java
 (from r823801, 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PlainTextPasswordCodec.java)
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PlainTextPasswordCipher.java?p2=openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PlainTextPasswordCipher.java&p1=openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PlainTextPasswordCodec.java&r1=823801&r2=823810&rev=823810&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PlainTextPasswordCodec.java
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/PlainTextPasswordCipher.java
 Sat Oct 10 07:51:57 2009
@@ -18,25 +18,25 @@
 package org.apache.openejb.resource.jdbc;
 
 /**
- * This {...@link PlainTextPasswordCodec} is an {...@link PasswordCodec}
+ * This {...@link PlainTextPasswordCipher} is an {...@link PasswordCipher}
  * implementation that does not use any encryption/decryption algorithm at all.
  */
-public class PlainTextPasswordCodec implements PasswordCodec {
+public class PlainTextPasswordCipher implements PasswordCipher {
 
     /**
-     * Returns the <code>encodedPassword</code> as plain text string.
+     * Returns the <code>encryptedPassword</code> as plain text string.
      * 
-     * @param encodedPassword
+     * @param encryptedPassword
      *            the encoded password
      * @return String the decoded password
      * 
-     * @see PasswordCodec#decode(char[])
+     * @see PasswordCipher#decrypt(char[])
      */
-    public String decode(char[] encodedPassword) {
-        if (null == encodedPassword) {
+    public String decrypt(char[] encryptedPassword) {
+        if (null == encryptedPassword) {
             throw new IllegalArgumentException("encodedPassword cannot be 
null.");
         }
-        return new String(encodedPassword);
+        return new String(encryptedPassword);
     }
 
     /**
@@ -46,9 +46,9 @@
      *            the plain-text password
      * @return the plain-text password as character array
      * 
-     * @see PasswordCodec#encode(java.lang.String)
+     * @see PasswordCipher#encrypt(java.lang.String)
      */
-    public char[] encode(String plainPassword) {
+    public char[] encrypt(String plainPassword) {
         if (null == plainPassword) {
             throw new IllegalArgumentException("plainPassword cannot be 
null.");
         }

Copied: 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/StaticDESPasswordCipher.java
 (from r823801, 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/StaticDESPasswordCodec.java)
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/StaticDESPasswordCipher.java?p2=openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/StaticDESPasswordCipher.java&p1=openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/StaticDESPasswordCodec.java&r1=823801&r2=823810&rev=823810&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/StaticDESPasswordCodec.java
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/StaticDESPasswordCipher.java
 Sat Oct 10 07:51:57 2009
@@ -23,10 +23,10 @@
 import org.apache.openejb.util.Base64;
 
 /**
- * This {...@link PasswordCodec} implementation uses a the Triple-DES 
encryption
+ * This {...@link PasswordCipher} implementation uses a the Triple-DES 
encryption
  * algorithm.
  */
-public class StaticDESPasswordCodec implements PasswordCodec {
+public class StaticDESPasswordCipher implements PasswordCipher {
 
     private static final byte[] _3desData = { 
             (byte) 0x76, (byte) 0x6F, (byte) 0xBA, (byte) 0x39, (byte) 0x31, 
@@ -43,11 +43,11 @@
     private static final String TRANSFORMATION = new String("DESede");
 
     /**
-     * @see PasswordCodec#encode(java.lang.String)
+     * @see PasswordCipher#encrypt(java.lang.String)
      * @throws RuntimeException
      *             in any case of error.
      */
-    public char[] encode(String plainPassword) {
+    public char[] encrypt(String plainPassword) {
         if ((null == plainPassword) || plainPassword.length() == 0) {
             throw new IllegalArgumentException("plainPassword cannot be null 
nor empty.");
         }
@@ -69,11 +69,11 @@
     }
 
     /**
-     * @see PasswordCodec#decode(char[])
+     * @see PasswordCipher#decrypt(char[])
      * @throws RuntimeException
      *             in any case of error.
      */
-    public String decode(char[] encodedPassword) {
+    public String decrypt(char[] encodedPassword) {
         if ((null == encodedPassword) || encodedPassword.length == 0) {
             throw new IllegalArgumentException("encodedPassword cannot be null 
nor empty.");
         }

Copied: 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.cli/cipher
 (from r823801, 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.cli/codec)
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.cli/cipher?p2=openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.cli/cipher&p1=openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.cli/codec&r1=823801&r2=823810&rev=823810&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.cli/codec
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.cli/cipher
 Sat Oct 10 07:51:57 2009
@@ -13,8 +13,8 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 #
-main.class = org.apache.openejb.config.Codec
-name = codec
-description = Encode/Decode using the PasswordCodec.
+main.class = org.apache.openejb.config.Cipher
+name = cipher
+description = Encrypt a database password and print it to stdout.
 
 

Modified: 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.resource.jdbc.PasswordCipher/PlainText
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.resource.jdbc.PasswordCipher/PlainText?rev=823810&r1=823801&r2=823810&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.resource.jdbc.PasswordCipher/PlainText
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.resource.jdbc.PasswordCipher/PlainText
 Sat Oct 10 07:51:57 2009
@@ -1 +1 @@
-org.apache.openejb.resource.jdbc.PlainTextPasswordCodec
+org.apache.openejb.resource.jdbc.PlainTextPasswordCipher

Modified: 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.resource.jdbc.PasswordCipher/Static3DES
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.resource.jdbc.PasswordCipher/Static3DES?rev=823810&r1=823801&r2=823810&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.resource.jdbc.PasswordCipher/Static3DES
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.resource.jdbc.PasswordCipher/Static3DES
 Sat Oct 10 07:51:57 2009
@@ -1 +1 @@
-org.apache.openejb.resource.jdbc.StaticDESPasswordCodec
+org.apache.openejb.resource.jdbc.StaticDESPasswordCipher

Modified: 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/Messages.properties
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/Messages.properties?rev=823810&r1=823809&r2=823810&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/Messages.properties
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/Messages.properties
 Sat Oct 10 07:51:57 2009
@@ -17,21 +17,21 @@
 #
 # $Rev$ $Date$
 #
-# codec
-# formatter.printHelp("codec [options] <value>", 
"\n"+i18n("cmd.codec.description"), options, "\n");
-cmd.codec.description = Uses a password codec implementation to encode/decode 
a value.
+# cipher
+# formatter.printHelp("cipher [options] <value>", 
"\n"+i18n("cmd.cipher.description"), options, "\n");
+cmd.cipher.description = Uses a password cipher implementation to 
encrypt/decrypt a value.
 
-#options.addOption(option("h", "help", "cmd.codec.opt.help"));
-cmd.codec.opt.help = Lists these options and exits.
+#options.addOption(option("h", "help", "cmd.cipher.opt.help"));
+cmd.cipher.opt.help = Lists these options and exits.
 
-#options.addOption(option("i", "codec", "cmd.codec.opt.impl"));
-cmd.codec.opt.impl = Specifies the password codec implementation to use.
+#options.addOption(option("i", "cipher", "cmd.cipher.opt.impl"));
+cmd.cipher.opt.impl = Specifies the password cipher implementation to use.
 
-#options.addOption(option("d", "decode", "cmd.codec.opt.decode"));
-cmd.codec.opt.decode = Switches command line tool to decode.
+#options.addOption(option("d", "decrypt", "cmd.cipher.opt.decrypt"));
+cmd.cipher.opt.decrypt = Switches command line tool to decrypt.
 
-#options.addOption(option("e", "encode", "cmd.codec.opt.encode"));
-cmd.codec.opt.encode = Switches command line tool to encode (default).
+#options.addOption(option("e", "encrypt", "cmd.cipher.opt.encrypt"));
+cmd.cipher.opt.encrypt = Switches command line tool to encrypt (default).
 
 # Undeploy
 #formatter.printHelp("undeploy [options] <moduleId> [<moduleId>...]", "\n"+ 
Undeploy.i18n("cmd.deploy.description"), options, "\n");

Modified: 
openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/PasswordCodecTest.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/PasswordCodecTest.java?rev=823810&r1=823809&r2=823810&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/PasswordCodecTest.java
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/PasswordCodecTest.java
 Sat Oct 10 07:51:57 2009
@@ -19,8 +19,6 @@
 
 import java.sql.SQLException;
 
-import javax.persistence.Basic;
-
 import junit.framework.TestCase;
 
 public class PasswordCodecTest extends TestCase {
@@ -28,25 +26,25 @@
        private static final String PLAIN_PWD = "david"; 
        
     public void testPlainCodec() {
-       PasswordCodec codec = new PlainTextPasswordCodec();
-       assertEquals(PLAIN_PWD, new String(codec.encode(PLAIN_PWD)));
-       assertEquals(PLAIN_PWD, codec.decode(PLAIN_PWD.toCharArray()));
+       PasswordCipher cipher = new PlainTextPasswordCipher();
+       assertEquals(PLAIN_PWD, new String(cipher.encrypt(PLAIN_PWD)));
+       assertEquals(PLAIN_PWD, cipher.decrypt(PLAIN_PWD.toCharArray()));
     }
        
        public void testStaticDesCodec() {
-               PasswordCodec codec = new StaticDESPasswordCodec();
-               char[] tmp = codec.encode(PLAIN_PWD);
-               assertEquals(PLAIN_PWD, codec.decode(tmp));
+               PasswordCipher cipher = new StaticDESPasswordCipher();
+               char[] tmp = cipher.encrypt(PLAIN_PWD);
+               assertEquals(PLAIN_PWD, cipher.decrypt(tmp));
     }
        
        public void testGetDataSourcePlugin() throws Exception {
         // all current known plugins
-        assertPluginClass("PlainText", PlainTextPasswordCodec.class);
-        assertPluginClass("Static3DES", StaticDESPasswordCodec.class);
+        assertPluginClass("PlainText", PlainTextPasswordCipher.class);
+        assertPluginClass("Static3DES", StaticDESPasswordCipher.class);
 
         // null
         try {
-            BasicDataSourceUtil.getPasswordCodec(null);
+            BasicDataSourceUtil.getPasswordCipher(null);
             fail("Should throw an exception when no codec is found.");
         } catch (Exception e) {
             // OK
@@ -54,18 +52,18 @@
 
         // empty string
         try {
-            BasicDataSourceUtil.getPasswordCodec("");
+            BasicDataSourceUtil.getPasswordCipher("");
             fail("Should throw an exception when no codec is found.");
         } catch (Exception e) {
             // OK
         }
         
         // try the FQN of the target codec
-        
assertNotNull(BasicDataSourceUtil.getPasswordCodec(PlainTextPasswordCodec.class.getName()));
+        
assertNotNull(BasicDataSourceUtil.getPasswordCipher(PlainTextPasswordCipher.class.getName()));
     }
 
-    private void assertPluginClass(String pluginName, Class<? extends 
PasswordCodec> pluginClass) throws SQLException {
-        PasswordCodec plugin = 
BasicDataSourceUtil.getPasswordCodec(pluginName);
+    private void assertPluginClass(String pluginName, Class<? extends 
PasswordCipher> pluginClass) throws SQLException {
+        PasswordCipher plugin = 
BasicDataSourceUtil.getPasswordCipher(pluginName);
         assertNotNull(plugin);
         assertSame(pluginClass, plugin.getClass());
     }


Reply via email to