User: user57
Date: 01/07/30 23:14:06
Modified: src/main/org/jboss/test/security/ejb Tag: jboss_buildmagic
EntityBeanImpl.java RunAsMDB.java
Log:
o updated from HEAD
Revision Changes Path
No revision
No revision
1.4.2.1 +2 -24
jbosstest/src/main/org/jboss/test/security/ejb/EntityBeanImpl.java
Index: EntityBeanImpl.java
===================================================================
RCS file:
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/security/ejb/EntityBeanImpl.java,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- EntityBeanImpl.java 2001/07/14 16:02:43 1.4
+++ EntityBeanImpl.java 2001/07/31 06:14:06 1.4.2.1
@@ -17,7 +17,7 @@
using the echo method.
@author [EMAIL PROTECTED]
-@version $Revision: 1.4 $
+@version $Revision: 1.4.2.1 $
*/
public class EntityBeanImpl implements EntityBean
{
@@ -73,32 +73,10 @@
if( securityMgr == null )
throw new EJBException("Failed to find security mgr under:
java:comp/env/security/security-domain");
System.out.println("Found SecurityManager: "+securityMgr);
- /* I'm using this runtime introspection to determin if the security
- manager supports a getActiveSubject() method because the
- org.jboss.security.SubjectSecurityManager interface is not part of
- the standard client jars which are used to build the jbosstest suite.
- Not legal EJB code, but this is test code.
- */
- Class securityMgrClass = securityMgr.getClass();
- Class[] parameterTypes = {};
- Method getActiveSubject =
securityMgrClass.getDeclaredMethod("getActiveSubject", parameterTypes);
- Object[] args = {};
- Subject activeSubject = (Subject) getActiveSubject.invoke(securityMgr,
args);
+ Subject activeSubject = (Subject)
ctx.lookup("java:comp/env/security/subject");
System.out.println("ActiveSubject: "+activeSubject);
if( activeSubject == null )
throw new EJBException("No ActiveSubject found");
- }
- catch(NoSuchMethodException e)
- {
- // Ok, not a SubjectSecurityManager
- }
- catch(InvocationTargetException e)
- {
- // Ok, not a SubjectSecurityManager
- }
- catch(IllegalAccessException e)
- {
- // Ok, not a SubjectSecurityManager
}
catch(NamingException e)
{
1.2.2.1 +77 -77 jbosstest/src/main/org/jboss/test/security/ejb/RunAsMDB.java
Index: RunAsMDB.java
===================================================================
RCS file:
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/security/ejb/RunAsMDB.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- RunAsMDB.java 2001/07/09 20:20:48 1.2
+++ RunAsMDB.java 2001/07/31 06:14:06 1.2.2.1
@@ -1,77 +1,77 @@
-/*
- * jBoss, the OpenSource EJB server
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.test.security.ejb;
-
-import javax.ejb.MessageDrivenBean;
-import javax.ejb.MessageDrivenContext;
-import javax.ejb.EJBException;
-import javax.jms.Destination;
-import javax.jms.MessageListener;
-import javax.jms.Message;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.jboss.test.security.interfaces.Entity;
-import org.jboss.test.security.interfaces.EntityHome;
-
-/** An MDB that takes the string from the msg passed to onMessage
- and invokes the echo(String) method on an internal Entity using
- the InternalRole assigned in the MDB descriptor run-as element.
-
- @author [EMAIL PROTECTED]
- @version $Revision: 1.2 $
- */
-public class RunAsMDB implements MessageDrivenBean, MessageListener
-{
- private MessageDrivenContext ctx = null;
- private InitialContext iniCtx;
-
- public RunAsMDB()
- {
- }
-
- public void setMessageDrivenContext(MessageDrivenContext ctx)
- throws EJBException
- {
- this.ctx = ctx;
- try
- {
- iniCtx = new InitialContext();
- }
- catch(NamingException e)
- {
- throw new EJBException(e);
- }
- }
-
- public void ejbCreate()
- {
- }
-
- public void ejbRemove()
- {
- ctx = null;
- }
-
- public void onMessage(Message message)
- {
- try
- {
- String arg = message.getStringProperty("arg");
- EntityHome home = (EntityHome) iniCtx.lookup("java:comp/env/ejb/Entity");
- Entity bean = home.findByPrimaryKey(arg);
- String echo = bean.echo(arg);
- System.out.println("RunAsMDB echo("+arg+") -> "+echo);
- Destination replyTo = message.getJMSReplyTo();
- // Need to send a reply...
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
- }
-}
+/*
+ * jBoss, the OpenSource EJB server
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.test.security.ejb;
+
+import javax.ejb.MessageDrivenBean;
+import javax.ejb.MessageDrivenContext;
+import javax.ejb.EJBException;
+import javax.jms.Destination;
+import javax.jms.MessageListener;
+import javax.jms.Message;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.test.security.interfaces.Entity;
+import org.jboss.test.security.interfaces.EntityHome;
+
+/** An MDB that takes the string from the msg passed to onMessage
+ and invokes the echo(String) method on an internal Entity using
+ the InternalRole assigned in the MDB descriptor run-as element.
+
+ @author [EMAIL PROTECTED]
+ @version $Revision: 1.2.2.1 $
+ */
+public class RunAsMDB implements MessageDrivenBean, MessageListener
+{
+ private MessageDrivenContext ctx = null;
+ private InitialContext iniCtx;
+
+ public RunAsMDB()
+ {
+ }
+
+ public void setMessageDrivenContext(MessageDrivenContext ctx)
+ throws EJBException
+ {
+ this.ctx = ctx;
+ try
+ {
+ iniCtx = new InitialContext();
+ }
+ catch(NamingException e)
+ {
+ throw new EJBException(e);
+ }
+ }
+
+ public void ejbCreate()
+ {
+ }
+
+ public void ejbRemove()
+ {
+ ctx = null;
+ }
+
+ public void onMessage(Message message)
+ {
+ try
+ {
+ String arg = message.getStringProperty("arg");
+ EntityHome home = (EntityHome) iniCtx.lookup("java:comp/env/ejb/Entity");
+ Entity bean = home.findByPrimaryKey(arg);
+ String echo = bean.echo(arg);
+ System.out.println("RunAsMDB echo("+arg+") -> "+echo);
+ Destination replyTo = message.getJMSReplyTo();
+ // Need to send a reply...
+ }
+ catch(Throwable e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development