CommonMethodDesc.java

00001 
00026 package org.objectweb.jonas_ejb.deployment.api;
00027 
00028 import java.security.PermissionCollection;
00029 import java.security.Permissions;
00030 import java.util.List;
00031 import java.util.Iterator;
00032 import javax.security.jacc.EJBMethodPermission;
00033 
00034 import org.objectweb.jonas_ejb.deployment.xml.Method;
00035 import org.objectweb.jonas_ejb.deployment.xml.MethodParams;
00036 
00042 public class CommonMethodDesc {
00043 
00047     private PermissionCollection ejbMethodPermissions = null;
00048 
00049 
00054     public CommonMethodDesc(List list) {
00055         this.ejbMethodPermissions = new Permissions();
00056         generateEJBMethodPermissions(list);
00057     }
00058 
00059 
00064     protected void generateEJBMethodPermissions(List methodList) {
00065         Iterator it = methodList.iterator();
00066 
00067         // Manage permissions
00068         while (it.hasNext()) {
00069             Method method = (Method) it.next();
00070             MethodParams methodParams = method.getMethodParams();
00071             String[] methodParamsArray = null;
00072             if (methodParams != null) {
00073 
00074                 List methodParamsList = method.getMethodParams().getMethodParamList();
00075                 String[] methodParamSize = new String[methodParamsList.size()];
00076                 methodParamsArray = (String[]) methodParamsList.toArray(methodParamSize);
00077             }
00078 
00079             // * or null value means that permission pertains to all methods
00080             String methodName = method.getMethodName();
00081             if (methodName.equals("*")) {
00082                 methodName = null;
00083             }
00084 
00085 
00086             EJBMethodPermission ejbMethodPermission =
00087                 new EJBMethodPermission(method.getEjbName(),
00088                                         methodName,
00089                                         method.getMethodIntf(),
00090                                         methodParamsArray);
00091             // Add the permission
00092             ejbMethodPermissions.add(ejbMethodPermission);
00093         }
00094     }
00095 
00100     public PermissionCollection getEJBMethodPermissions() {
00101         return ejbMethodPermissions;
00102     }
00103 }

Generated on Tue Feb 15 15:05:44 2005 for JOnAS by  doxygen 1.3.9.1