[jboss-cvs] JBossAS SVN: r73379 - trunk/server/src/main/org/jboss/ejb.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 13 17:20:20 EDT 2008


Author: mmoyses
Date: 2008-05-13 17:20:20 -0400 (Tue, 13 May 2008)
New Revision: 73379

Modified:
   trunk/server/src/main/org/jboss/ejb/EJBPermissionMapping.java
Log:
JBAS-5521
removing unused method

Modified: trunk/server/src/main/org/jboss/ejb/EJBPermissionMapping.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/EJBPermissionMapping.java	2008-05-13 21:15:44 UTC (rev 73378)
+++ trunk/server/src/main/org/jboss/ejb/EJBPermissionMapping.java	2008-05-13 21:20:20 UTC (rev 73379)
@@ -29,10 +29,6 @@
 import javax.security.jacc.PolicyConfiguration;
 import javax.security.jacc.PolicyContextException;
 
-import org.jboss.metadata.BeanMetaData;
-import org.jboss.metadata.MethodMetaData;
-import org.jboss.metadata.SecurityRoleRefMetaData;
-import org.jboss.metadata.SessionMetaData;
 import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
 import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
 import org.jboss.metadata.ejb.spec.ExcludeListMetaData;
@@ -55,159 +51,91 @@
 {
 
    public static void createPermissions(JBossEnterpriseBeanMetaData bean, PolicyConfiguration pc)
-      throws PolicyContextException
+         throws PolicyContextException
    {
       // Process the method-permission MethodMetaData
       MethodPermissionsMetaData perms = bean.getMethodPermissions();
-      if(perms != null)
-      for(MethodPermissionMetaData perm : perms)
-      {
-         MethodsMetaData methods = perm.getMethods();
-         if(methods != null)
-         for(org.jboss.metadata.ejb.spec.MethodMetaData mmd : methods)
+      if (perms != null)
+         for (MethodPermissionMetaData perm : perms)
          {
-            String[] params = {};
-            if(mmd.getMethodParams() != null)
-               params = mmd.getMethodParams().toArray(params);
-            else
-               params = null;
-            String methodName = mmd.getMethodName();
-            if( methodName != null && methodName.equals("*") )
-               methodName = null;
-            MethodInterfaceType miType = mmd.getMethodIntf();
-            String iface = miType != null ? miType.name() : null;
-            EJBMethodPermission p = new EJBMethodPermission(mmd.getEjbName(),
-                  methodName, iface, params);
-            if( perm.getUnchecked() != null )
-            {
-               pc.addToUncheckedPolicy(p);
-            }
-            else
-            {
-               Set<String> roles = perm.getRoles();
-               Iterator riter = roles.iterator();
-               while( riter.hasNext() )
+            MethodsMetaData methods = perm.getMethods();
+            if (methods != null)
+               for (org.jboss.metadata.ejb.spec.MethodMetaData mmd : methods)
                {
-                  String role = (String) riter.next();
-                  pc.addToRole(role, p);
+                  String[] params =
+                  {};
+                  if (mmd.getMethodParams() != null)
+                     params = mmd.getMethodParams().toArray(params);
+                  else
+                     params = null;
+                  String methodName = mmd.getMethodName();
+                  if (methodName != null && methodName.equals("*"))
+                     methodName = null;
+                  MethodInterfaceType miType = mmd.getMethodIntf();
+                  String iface = miType != null ? miType.name() : null;
+                  EJBMethodPermission p = new EJBMethodPermission(mmd.getEjbName(), methodName, iface, params);
+                  if (perm.getUnchecked() != null)
+                  {
+                     pc.addToUncheckedPolicy(p);
+                  }
+                  else
+                  {
+                     Set<String> roles = perm.getRoles();
+                     Iterator riter = roles.iterator();
+                     while (riter.hasNext())
+                     {
+                        String role = (String) riter.next();
+                        pc.addToRole(role, p);
+                     }
+                  }
                }
-            }
          }
-      }
 
       // Process the exclude-list MethodMetaData
       ExcludeListMetaData excluded = bean.getExcludeList();
-      if(excluded != null)
+      if (excluded != null)
       {
          MethodsMetaData methods = excluded.getMethods();
-         if(methods != null)
-         for(org.jboss.metadata.ejb.spec.MethodMetaData mmd : methods)
-         {
-            String[] params = {};
-            if(mmd.getMethodParams() != null)
-               params = mmd.getMethodParams().toArray(params);
-            else
-               params = null;
-            String methodName = mmd.getMethodName();
-            if( methodName != null && methodName.equals("*") )
-               methodName = null;
-            MethodInterfaceType miType = mmd.getMethodIntf();
-            String iface = miType != null ? miType.name() : null;
-            EJBMethodPermission p = new EJBMethodPermission(mmd.getEjbName(),
-                  methodName, iface, params);
-            pc.addToExcludedPolicy(p);
-         }
+         if (methods != null)
+            for (org.jboss.metadata.ejb.spec.MethodMetaData mmd : methods)
+            {
+               String[] params =
+               {};
+               if (mmd.getMethodParams() != null)
+                  params = mmd.getMethodParams().toArray(params);
+               else
+                  params = null;
+               String methodName = mmd.getMethodName();
+               if (methodName != null && methodName.equals("*"))
+                  methodName = null;
+               MethodInterfaceType miType = mmd.getMethodIntf();
+               String iface = miType != null ? miType.name() : null;
+               EJBMethodPermission p = new EJBMethodPermission(mmd.getEjbName(), methodName, iface, params);
+               pc.addToExcludedPolicy(p);
+            }
       }
 
       // Process the security-role-ref SecurityRoleRefMetaData
       SecurityRoleRefsMetaData refs = bean.getSecurityRoleRefs();
-      if(refs != null)
-      for(org.jboss.metadata.javaee.spec.SecurityRoleRefMetaData ref : refs)
-      {
-         EJBRoleRefPermission p = new EJBRoleRefPermission(bean.getEjbName(), ref.getRoleName());
-         pc.addToRole(ref.getRoleLink(), p);
-      }
+      if (refs != null)
+         for (org.jboss.metadata.javaee.spec.SecurityRoleRefMetaData ref : refs)
+         {
+            EJBRoleRefPermission p = new EJBRoleRefPermission(bean.getEjbName(), ref.getRoleName());
+            pc.addToRole(ref.getRoleLink(), p);
+         }
 
       /* Special handling of stateful session bean getEJBObject due how the
       stateful session handles acquire the proxy by sending an invocation to
       the ejb container.
        */
-      if( bean.isSession() )
+      if (bean.isSession())
       {
          JBossSessionBeanMetaData smd = (JBossSessionBeanMetaData) bean;
-         if( smd.isStateful() )
+         if (smd.isStateful())
          {
-            EJBMethodPermission p = new EJBMethodPermission(bean.getEjbName(),
-                  "getEJBObject", "Home", null);
+            EJBMethodPermission p = new EJBMethodPermission(bean.getEjbName(), "getEJBObject", "Home", null);
             pc.addToUncheckedPolicy(p);
          }
       }
-   } 
-
-   public static void createPermissions(BeanMetaData bean, PolicyConfiguration pc)
-      throws PolicyContextException
-   {
-      // Process the method-permission MethodMetaData
-      Iterator iter = bean.getPermissionMethods();
-      while( iter.hasNext() )
-      {
-         MethodMetaData mmd = (MethodMetaData) iter.next();
-         String[] params = null;
-         if( mmd.isParamGiven() )
-            params = mmd.getMethodParams();
-         String methodName = mmd.getMethodName();
-         if( methodName != null && methodName.equals("*") )
-            methodName = null;
-         EJBMethodPermission p = new EJBMethodPermission(mmd.getEjbName(),
-               methodName, mmd.getInterfaceType(), params);
-         if( mmd.isUnchecked() )
-         {
-            pc.addToUncheckedPolicy(p);
-         }
-         else
-         {
-            Set roles = mmd.getRoles();
-            Iterator riter = roles.iterator();
-            while( riter.hasNext() )
-            {
-               String role = (String) riter.next();
-               pc.addToRole(role, p);
-            }
-         }
-      }
-      // Process the exclude-list MethodMetaData
-      iter = bean.getExcludedMethods();
-      while( iter.hasNext() )
-      {
-         MethodMetaData mmd = (MethodMetaData) iter.next();
-         String[] params = null;
-         if( mmd.isParamGiven() )
-            params = mmd.getMethodParams();
-         EJBMethodPermission p = new EJBMethodPermission(mmd.getEjbName(),
-               mmd.getMethodName(), mmd.getInterfaceType(), params);
-         pc.addToExcludedPolicy(p);
-      }
-      // Process the security-role-ref SecurityRoleRefMetaData
-      iter = bean.getSecurityRoleReferences();
-      while( iter.hasNext() )
-      {
-         SecurityRoleRefMetaData srrmd = (SecurityRoleRefMetaData) iter.next();
-         EJBRoleRefPermission p = new EJBRoleRefPermission(bean.getEjbName(), srrmd.getName());
-         pc.addToRole(srrmd.getLink(), p);
-      }
-      /* Special handling of stateful session bean getEJBObject due how the
-   stateful session handles acquire the proxy by sending an invocation to
-   the ejb container.
-       */
-      if( bean instanceof SessionMetaData )
-      {
-         SessionMetaData smd = (SessionMetaData) bean;
-         if( smd.isStateful() )
-         {
-            EJBMethodPermission p = new EJBMethodPermission(bean.getEjbName(),
-                  "getEJBObject", "Home", null);
-            pc.addToUncheckedPolicy(p);
-         }
-      }
-   } 
+   }
 }




More information about the jboss-cvs-commits mailing list