[jboss-cvs] JBossAS SVN: r87912 - projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Apr 27 23:09:13 EDT 2009


Author: ALRubinger
Date: 2009-04-27 23:09:12 -0400 (Mon, 27 Apr 2009)
New Revision: 87912

Added:
   projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionLocalBusiness.java
Modified:
   projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionBean.java
   projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionBeanBase.java
   projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionCommonBusiness.java
   projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionRemoteBusiness.java
Log:
[EJBBOOK-4] Add a local business interface to EncryptionEJB

Modified: projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionBean.java
===================================================================
--- projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionBean.java	2009-04-28 03:04:08 UTC (rev 87911)
+++ projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionBean.java	2009-04-28 03:09:12 UTC (rev 87912)
@@ -23,6 +23,7 @@
 
 import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
+import javax.ejb.Local;
 import javax.ejb.Remote;
 import javax.ejb.SessionContext;
 import javax.ejb.Stateless;
@@ -41,8 +42,9 @@
  * @version $Revision: $
  */
 @Stateless(name = EncryptionBean.EJB_NAME)
+ at Local(EncryptionLocalBusiness.class)
 @Remote(EncryptionRemoteBusiness.class)
-public class EncryptionBean extends EncryptionBeanBase implements EncryptionRemoteBusiness
+public class EncryptionBean extends EncryptionBeanBase implements EncryptionLocalBusiness, EncryptionRemoteBusiness
 {
    // ---------------------------------------------------------------------------||
    // Class Members -------------------------------------------------------------||

Modified: projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionBeanBase.java
===================================================================
--- projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionBeanBase.java	2009-04-28 03:04:08 UTC (rev 87911)
+++ projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionBeanBase.java	2009-04-28 03:09:12 UTC (rev 87912)
@@ -300,6 +300,24 @@
       return hash;
    }
 
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.examples.ch05.encryption.EncryptionCommonBusiness#getCiphersPassphrase()
+    */
+   @Override
+   public String getCiphersPassphrase()
+   {
+      return DEFAULT_PASSPHRASE;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.examples.ch05.encryption.EncryptionCommonBusiness#getMessageDigestAlgorithm()
+    */
+   @Override
+   public String getMessageDigestAlgorithm()
+   {
+      return DEFAULT_ALGORITHM_MESSAGE_DIGEST;
+   }
+
    // ---------------------------------------------------------------------------||
    // Internal Helper Methods ---------------------------------------------------||
    // ---------------------------------------------------------------------------||
@@ -405,27 +423,4 @@
       // Return
       return digest;
    }
-
-   /**
-    * Obtains the passphrase to be used in the key for
-    * the symmetric encryption/decryption ciphers
-    * 
-    * @return
-    */
-   protected String getCiphersPassphrase()
-   {
-      return DEFAULT_PASSPHRASE;
-   }
-
-   /**
-    * Returns the algorithm to be used in
-    * one-way hashing
-    *  
-    * @return
-    */
-   protected String getMessageDigestAlgorithm()
-   {
-      return DEFAULT_ALGORITHM_MESSAGE_DIGEST;
-   }
-
 }

Modified: projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionCommonBusiness.java
===================================================================
--- projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionCommonBusiness.java	2009-04-28 03:04:08 UTC (rev 87911)
+++ projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionCommonBusiness.java	2009-04-28 03:09:12 UTC (rev 87912)
@@ -78,5 +78,29 @@
     * @throws IllegalArgumentException If either the hash or input is not provided (null)
     */
    boolean compare(String hash, String input) throws IllegalArgumentException;
+   
+   /*
+    * This comment applies to all below this marker.
+    * 
+    * In real life it's a security risk to expose these internals, 
+    * but they're in place here for testing and to show 
+    * functionality described by the examples.
+    */
 
+   /**
+    * Obtains the passphrase to be used in the key for
+    * the symmetric encryption/decryption ciphers
+    * 
+    * @return
+    */
+   String getCiphersPassphrase();
+
+   /**
+    * Obtains the algorithm to be used in performing
+    * one-way hashing
+    * 
+    * @return
+    */
+   String getMessageDigestAlgorithm();
+
 }

Added: projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionLocalBusiness.java
===================================================================
--- projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionLocalBusiness.java	                        (rev 0)
+++ projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionLocalBusiness.java	2009-04-28 03:09:12 UTC (rev 87912)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.examples.ch05.encryption;
+
+/**
+ * EncryptionLocalBusiness
+ * 
+ * EJB 3.x Local Business View of the EncryptionEJB
+ *
+ * @author <a href="mailto:alr at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface EncryptionLocalBusiness extends EncryptionCommonBusiness
+{
+   // Contracts in hierarchy
+}

Modified: projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionRemoteBusiness.java
===================================================================
--- projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionRemoteBusiness.java	2009-04-28 03:04:08 UTC (rev 87911)
+++ projects/ejb-book/trunk/ch05-encryption/src/main/java/org/jboss/ejb3/examples/ch05/encryption/EncryptionRemoteBusiness.java	2009-04-28 03:09:12 UTC (rev 87912)
@@ -31,30 +31,5 @@
  */
 public interface EncryptionRemoteBusiness extends EncryptionCommonBusiness
 {
-   // ---------------------------------------------------------------------------||
-   // Contracts -----------------------------------------------------------------||
-   // ---------------------------------------------------------------------------||
-
-   /*
-    * Here we add some support in addition to methods defined by EncryptionCommonBusiness
-    * which will be specific to our EJB.  In real life it's a security risk to 
-    * expose these internals, but they're in place here for testing and to show 
-    * functionality described by the examples
-    */
-
-   /**
-    * Obtains the passphrase to be used in the key for
-    * the symmetric encryption/decryption ciphers
-    * 
-    * @return
-    */
-   String getCiphersPassphrase();
-
-   /**
-    * Obtains the algorithm to be used in performing
-    * one-way hashing
-    * 
-    * @return
-    */
-   String getMessageDigestAlgorithm();
+   // Contracts in hierarchy
 }




More information about the jboss-cvs-commits mailing list