geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r740811 - in /geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment: EjbDeploymentBuilder.java SecurityBuilder.java
Date Wed, 04 Feb 2009 17:51:21 GMT
Author: djencks
Date: Wed Feb  4 17:51:21 2009
New Revision: 740811

URL: http://svn.apache.org/viewvc?rev=740811&view=rev
Log:
GERONIMO-4526 make (timer initiated) internal ejbTimeout calls unchecked

Modified:
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/SecurityBuilder.java

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java?rev=740811&r1=740810&r2=740811&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
Wed Feb  4 17:51:21 2009
@@ -61,12 +61,11 @@
 import org.apache.openejb.jee.EnterpriseBean;
 import org.apache.openejb.jee.EntityBean;
 import org.apache.openejb.jee.MessageDrivenBean;
+import org.apache.openejb.jee.MethodPermission;
 import org.apache.openejb.jee.RemoteBean;
 import org.apache.openejb.jee.SecurityIdentity;
 import org.apache.openejb.jee.SessionBean;
 import org.apache.openejb.jee.SessionType;
-import org.apache.openejb.jee.AssemblyDescriptor;
-import org.apache.openejb.jee.MethodPermission;
 import org.apache.openejb.jee.oejb3.EjbDeployment;
 import org.apache.xbean.finder.ClassFinder;
 import org.apache.xmlbeans.XmlObject;
@@ -253,6 +252,8 @@
                             ejbModule.getClassLoader());
                 }
 
+                securityBuilder.addEjbTimeout(remoteBean, ejbModule, allPermissions);
+
                 String defaultRole = securityConfiguration.getDefaultRole();
                 securityBuilder.addComponentPermissions(defaultRole,
                         allPermissions,

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/SecurityBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/SecurityBuilder.java?rev=740811&r1=740810&r2=740811&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/SecurityBuilder.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/SecurityBuilder.java
Wed Feb  4 17:51:21 2009
@@ -20,15 +20,17 @@
 import java.security.Permission;
 import java.security.PermissionCollection;
 import java.security.Permissions;
-import java.util.List;
-import java.util.Map;
-import java.util.Collection;
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import java.util.Set;
-import java.util.HashSet;
-import java.util.Collections;
 
+import javax.ejb.TimedObject;
+import javax.ejb.Timer;
 import javax.security.jacc.EJBMethodPermission;
 import javax.security.jacc.EJBRoleRefPermission;
 
@@ -36,9 +38,13 @@
 import org.apache.geronimo.security.jacc.ComponentPermissions;
 import org.apache.openejb.jee.AssemblyDescriptor;
 import org.apache.openejb.jee.ExcludeList;
+import org.apache.openejb.jee.MessageDrivenBean;
 import org.apache.openejb.jee.Method;
 import org.apache.openejb.jee.MethodPermission;
+import org.apache.openejb.jee.NamedMethod;
+import org.apache.openejb.jee.RemoteBean;
 import org.apache.openejb.jee.SecurityRoleRef;
+import org.apache.openejb.jee.SessionBean;
 
 public class SecurityBuilder {
     /**
@@ -272,4 +278,26 @@
 
         return result;
     }
+
+    public void addEjbTimeout(RemoteBean remoteBean, EjbModule ejbModule, Collection<Permission>
permissions) throws DeploymentException {
+        NamedMethod timeout = null;
+        if (remoteBean instanceof SessionBean) {
+            timeout = ((SessionBean) remoteBean).getTimeoutMethod();
+        } else if (remoteBean instanceof MessageDrivenBean) {
+            timeout = ((MessageDrivenBean) remoteBean).getTimeoutMethod();
+        }
+        if (timeout != null) {
+            permissions.add(new EJBMethodPermission(remoteBean.getEjbName(), timeout.getMethodName(),
null, new String[]{Timer.class.getName()}));
+        } else {
+            try {
+                Class ejbClass = ejbModule.getClassLoader().loadClass(remoteBean.getEjbClass());
+                if (TimedObject.class.isAssignableFrom(ejbClass)) {
+                    permissions.add(new EJBMethodPermission(remoteBean.getEjbName(), "ejbTimeout",
null, new String[]{Timer.class.getName()}));
+                }
+            } catch (ClassNotFoundException e) {
+                throw new DeploymentException("Could not figure out timer method", e);
+            }
+        }
+    }
+    
 }



Mime
View raw message