Update of 
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-ejb/src/main/java/org/xdoclet/plugin/ejb
In directory 
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26236/plugin-ejb/src/main/java/org/xdoclet/plugin/ejb

Modified Files:
        EjbRuntime.java EjbUtils.java EjbConfig.java 
Log Message:
- EjbConfig is now a dummy plugin. Eases doc generation and simplifies 
dispersion.
- View-types for methods cannot be wider than supported by bean. They'll be 
bitwise masked.
- Updated test-cases eliminating unsuported view references.
- ...

Index: EjbRuntime.java
===================================================================
RCS file: 
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-ejb/src/main/java/org/xdoclet/plugin/ejb/EjbRuntime.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** EjbRuntime.java     26 Aug 2005 17:52:30 -0000      1.1
--- EjbRuntime.java     6 Sep 2005 01:50:00 -0000       1.2
***************
*** 27,31 ****
      protected static EjbRuntime instance;
      protected final EjbConfig config;
-     protected QDoxCapableMetadataProvider metadataProvider;
      protected EjbJarXmlPlugin ejbJarXmlPlugin;
      protected PrimaryKeyClassPlugin primaryKeyClassPlugin;
--- 27,30 ----
***************
*** 35,51 ****
      protected RemoteInterfacePlugin remoteInterfacePlugin;
  
!     protected EjbRuntime(EjbConfig config, QDoxCapableMetadataProvider 
metadataProvider) {
          // No public instantiation
          this.config = config;
-         this.metadataProvider = metadataProvider;
      }
  
!     public static synchronized void init(EjbConfig config, 
QDoxCapableMetadataProvider metadataProvider) {
!         if (config == null || metadataProvider == null) {
              throw new Error("NullPointerException");
          }
  
          if (instance == null) {
!             instance = new EjbRuntime(config, metadataProvider);
          }
  
--- 34,49 ----
      protected RemoteInterfacePlugin remoteInterfacePlugin;
  
!     protected EjbRuntime(EjbConfig config) {
          // No public instantiation
          this.config = config;
      }
  
!     public static synchronized void init(EjbConfig config) {
!         if (config == null) {
              throw new Error("NullPointerException");
          }
  
          if (instance == null) {
!             instance = new EjbRuntime(config);
          }
  
***************
*** 70,74 ****
      protected synchronized LocalInterfacePlugin _getLocalInterfacePlugin() 
throws ClassNotFoundException {
          if (this.localInterfacePlugin == null) {
!             this.localInterfacePlugin = new LocalInterfacePlugin(null, 
metadataProvider, null, config);
          }
          return this.localInterfacePlugin;
--- 68,72 ----
      protected synchronized LocalInterfacePlugin _getLocalInterfacePlugin() 
throws ClassNotFoundException {
          if (this.localInterfacePlugin == null) {
!             this.localInterfacePlugin = new LocalInterfacePlugin(null, 
config.getMetadataProvider(), null, config);
          }
          return this.localInterfacePlugin;
***************
*** 77,81 ****
      protected synchronized RemoteHomeInterfacePlugin 
_getRemoteHomeInterfacePlugin() throws ClassNotFoundException {
          if (this.remoteHomeInterfacePlugin == null) {
!             this.remoteHomeInterfacePlugin = new 
RemoteHomeInterfacePlugin(null, metadataProvider, null, config);
          }
          return this.remoteHomeInterfacePlugin;
--- 75,79 ----
      protected synchronized RemoteHomeInterfacePlugin 
_getRemoteHomeInterfacePlugin() throws ClassNotFoundException {
          if (this.remoteHomeInterfacePlugin == null) {
!             this.remoteHomeInterfacePlugin = new 
RemoteHomeInterfacePlugin(null, config.getMetadataProvider(), null, config);
          }
          return this.remoteHomeInterfacePlugin;
***************
*** 84,88 ****
      protected synchronized RemoteInterfacePlugin _getRemoteInterfacePlugin() 
throws ClassNotFoundException {
          if (this.remoteInterfacePlugin == null) {
!             this.remoteInterfacePlugin = new RemoteInterfacePlugin(null, 
metadataProvider, null, config);
          }
          return this.remoteInterfacePlugin;
--- 82,86 ----
      protected synchronized RemoteInterfacePlugin _getRemoteInterfacePlugin() 
throws ClassNotFoundException {
          if (this.remoteInterfacePlugin == null) {
!             this.remoteInterfacePlugin = new RemoteInterfacePlugin(null, 
config.getMetadataProvider(), null, config);
          }
          return this.remoteInterfacePlugin;
***************
*** 96,100 ****
      protected synchronized EjbJarXmlPlugin _getEjbJarXmlPlugin() throws 
ClassNotFoundException {
          if (this.ejbJarXmlPlugin == null) {
!             this.ejbJarXmlPlugin = new EjbJarXmlPlugin(null, 
metadataProvider, null, config);
          }
  
--- 94,98 ----
      protected synchronized EjbJarXmlPlugin _getEjbJarXmlPlugin() throws 
ClassNotFoundException {
          if (this.ejbJarXmlPlugin == null) {
!             this.ejbJarXmlPlugin = new EjbJarXmlPlugin(null, 
config.getMetadataProvider(), null, config);
          }
  
***************
*** 109,113 ****
      protected synchronized PrimaryKeyClassPlugin _getPrimaryKeyClassPlugin() 
throws ClassNotFoundException {
          if (this.primaryKeyClassPlugin == null) {
!             this.primaryKeyClassPlugin = new PrimaryKeyClassPlugin(null, 
metadataProvider, null, config);
          }
          return this.primaryKeyClassPlugin;
--- 107,111 ----
      protected synchronized PrimaryKeyClassPlugin _getPrimaryKeyClassPlugin() 
throws ClassNotFoundException {
          if (this.primaryKeyClassPlugin == null) {
!             this.primaryKeyClassPlugin = new PrimaryKeyClassPlugin(null, 
config.getMetadataProvider(), null, config);
          }
          return this.primaryKeyClassPlugin;
***************
*** 122,126 ****
          throws ClassNotFoundException {
          if (this.localHomeInterfacePlugin == null) {
!             this.localHomeInterfacePlugin = new 
LocalHomeInterfacePlugin(null, metadataProvider, null, config);
          }
  
--- 120,124 ----
          throws ClassNotFoundException {
          if (this.localHomeInterfacePlugin == null) {
!             this.localHomeInterfacePlugin = new 
LocalHomeInterfacePlugin(null, config.getMetadataProvider(), null, config);
          }
  

Index: EjbUtils.java
===================================================================
RCS file: 
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-ejb/src/main/java/org/xdoclet/plugin/ejb/EjbUtils.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** EjbUtils.java       30 Aug 2005 00:34:33 -0000      1.7
--- EjbUtils.java       6 Sep 2005 01:50:00 -0000       1.8
***************
*** 39,42 ****
--- 39,43 ----
  import org.xdoclet.plugin.ejb.qtags.EjbResourceEnvRefTag;
  import org.xdoclet.plugin.ejb.qtags.EjbResourceRefTag;
+ import org.xdoclet.plugin.ejb.qtags.EjbTransactionTag;
  import org.xdoclet.plugin.ejb.qtags.parameter.RoleList;
  
***************
*** 178,183 ****
       */
      public Collection getInterfaceMethods(final JavaClass clazz, final int 
anyMethodTypeFlag,
!         final String desiredViewType) {
!         if (clazz == null || desiredViewType == null) {
              throw new Error();
          }
--- 179,184 ----
       */
      public Collection getInterfaceMethods(final JavaClass clazz, final int 
anyMethodTypeFlag,
!         final int desiredViewType) {
!         if (clazz == null) {
              throw new Error();
          }
***************
*** 188,227 ****
                      JavaMethod method = (JavaMethod) object;
  
                      if ((getMethodType(method) & anyMethodTypeFlag) == 0) {
                          return false;
                      }
  
                      int vType = getViewType(method, clazz);
!                     int desiredVType = getViewType(desiredViewType);
!                     return hasFlag(vType, desiredVType);
                  }
              });
      }
  
-     public boolean isInterfaceMethod(JavaMethod method) {
-         return getMethodType(method) > 0;
-     }
- 
      public int getMethodType(JavaMethod method) {
          int retVal = 0;
  
          if (method.getTagByName("ejb.interface-method") != null) {
!             retVal |= IFACE_METHOD_COMPONENT;
!         }
! 
!         if (method.getName().equals("ejbCreate") && 
(method.getTagByName("ejb.create-method") != null)) {
!             retVal |= IFACE_METHOD_CREATE;
!         }
! 
!         if (method.getName().startsWith("ejbHome") && 
(method.getTagByName("ejb.home-method") != null)) {
!             retVal |= IFACE_METHOD_HOME;
!         }
! 
!         if (method.getName().equals("ejbRemove")) {
!             retVal |= IFACE_METHOD_REMOVE;
!         }
! 
!         if (method.getName().startsWith("ejbFind")) {
!             retVal |= IFACE_METHOD_FINDER;
          }
  
--- 189,223 ----
                      JavaMethod method = (JavaMethod) object;
  
+ System.out.println(method.getName() + "-STEP1");                    
+ System.out.println(method.getName() + 
"-getMethodType(method)"+getMethodType(method));                    
+ System.out.println(method.getName() + 
"-anyMethodTypeFlag="+anyMethodTypeFlag);                    
                      if ((getMethodType(method) & anyMethodTypeFlag) == 0) {
                          return false;
                      }
+                     
+ System.out.println(method.getName() + "-STEP2");                    
  
                      int vType = getViewType(method, clazz);
! System.out.println(method.getName() + "-vType="+vType);                    
! //                    int desiredVType = getViewType(desiredViewType);
! //System.out.println(method.getName() + "-desiredVType="+desiredVType);       
             
!                     return hasFlag(vType, desiredViewType);
                  }
              });
      }
  
      public int getMethodType(JavaMethod method) {
          int retVal = 0;
  
          if (method.getTagByName("ejb.interface-method") != null) {
!             retVal = IFACE_METHOD_COMPONENT;
!         } else if (method.getName().equals("ejbCreate") && 
(method.getTagByName("ejb.create-method") != null)) {
!             retVal = IFACE_METHOD_CREATE;
!         } else if (method.getName().startsWith("ejbHome") && 
(method.getTagByName("ejb.home-method") != null)) {
!             retVal = IFACE_METHOD_HOME;
!         } else if (method.getName().equals("ejbRemove")) {
!             retVal = IFACE_METHOD_REMOVE;
!         } else if (method.getName().startsWith("ejbFind")) {
!             retVal = IFACE_METHOD_FINDER;
          }
  
***************
*** 437,442 ****
  
      public int getViewType(JavaMethod method, JavaClass javaClass) {
!         String viewType = method.getNamedParameter("ejb.interface-method", 
"view-type");
!         return (viewType != null) ? getViewType(viewType) : 
getViewType(javaClass);
      }
  
--- 433,489 ----
  
      public int getViewType(JavaMethod method, JavaClass javaClass) {
!         // We should mask method view type with bean's view type
!         // ie, A method cannot have a view type not supported by the bean
!         int beanViewType = getViewType(javaClass);
!         int retVal = 0;
!         int filterMask = beanViewType;
!         String viewType = null;
!         int methodType = getMethodType(method);
! 
!         switch (methodType) {
!             case IFACE_METHOD_COMPONENT:
!                 viewType = method.getNamedParameter("ejb.interface-method", 
"view-type");
!                 retVal = (viewType != null) ? getViewType(viewType) : 
beanViewType;
! 
!                 // If it's a interface method it can only live in 
business-interfaces
!                 // Let's remove home interfaces if inherited
!                 filterMask &= ~(REMOTE_HOME | LOCAL_HOME);
!                 break;
! 
!             case IFACE_METHOD_CREATE:
!                 viewType = method.getNamedParameter("ejb.create-method", 
"view-type");
!                 retVal = (viewType != null) ? getViewType(viewType) : 
beanViewType;
! 
!                 // If it's a create method, it can live only in 
home-interfaces
!                 // Let's set mask to guarantee only homes
!                 filterMask &= (REMOTE_HOME | LOCAL_HOME);
!                 break;
! 
!             case IFACE_METHOD_HOME:
!                 viewType = method.getNamedParameter("ejb.home-method", 
"view-type");
!                 retVal = (viewType != null) ? getViewType(viewType) : 
beanViewType;
! 
!                 // If it's a home method, it can live only in home-interfaces
!                 // Let's set mask to guarantee only homes
!                 filterMask &= (REMOTE_HOME | LOCAL_HOME);
!                 break;
! 
!             case IFACE_METHOD_REMOVE:
!             case IFACE_METHOD_FINDER:
! 
!                 // TODO: remove methods are only in home interfaces ? Or can 
be in business ?
!                 // TODO: finder methods are only in home interfaces ? Or can 
be in business ?
!                 retVal = (REMOTE_HOME | LOCAL_HOME);
!                 break;
! 
!             default:
!                 // By default a method will not be included, so will not have 
a view type
!                 break;
!         }
! 
!         // Let's mask by bitwise filter
!         retVal &= filterMask;
! 
!         return retVal;
      }
  
***************
*** 929,933 ****
  
      private boolean isEjbRefType(String viewType, JavaClass refClass, int 
desiredView) {
!         int beanType = (viewType != null) ? getViewType(viewType) : 
getViewType(refClass);
          return hasFlag(beanType, desiredView);
      }
--- 976,981 ----
  
      private boolean isEjbRefType(String viewType, JavaClass refClass, int 
desiredView) {
! //        int beanType = (viewType != null) ? getViewType(viewType) : 
getViewType(refClass);
!         int beanType = (viewType != null) ? getViewType(viewType) & 
getViewType(refClass) : getViewType(refClass);
          return hasFlag(beanType, desiredView);
      }
***************
*** 987,991 ****
                      int methodType = getMethodType(methods[i]);
  
!                     if (!hasFlag(methodType, IFACE_METHOD_CREATE) && 
!hasFlag(methodType, IFACE_METHOD_COMPONENT)) {
                          throw 
getErrorWithTagLocation(methods[i].getTagByName("ejb.permission"),
                              "Can't mark a method permission on a non 
interface or create method");
--- 1035,1039 ----
                      int methodType = getMethodType(methods[i]);
  
!                     if ((methodType != IFACE_METHOD_CREATE) && (methodType != 
IFACE_METHOD_COMPONENT)) {
                          throw 
getErrorWithTagLocation(methods[i].getTagByName("ejb.permission"),
                              "Can't mark a method permission on a non 
interface or create method");
***************
*** 1378,1382 ****
          EjbVersion version = config.getVersion();
          Collection retLst = new ArrayList();
!         DocletTag[] tags = javaClass.getTagsByName("ejb.permission");
  
          if (!isEJB(javaClass)) {
--- 1426,1430 ----
          EjbVersion version = config.getVersion();
          Collection retLst = new ArrayList();
!         DocletTag[] tags;
  
          if (!isEJB(javaClass)) {
***************
*** 1385,1388 ****
--- 1433,1438 ----
  
          // Let dig into class level ejb.permission tags
+         tags = javaClass.getTagsByName("ejb.permission");
+ 
          for (int i = 0; i < tags.length; i++) {
              EjbPermissionTag permTag = (EjbPermissionTag) tags[i];
***************
*** 1400,1404 ****
  
              if (permType == 0) {
!                 throw getErrorWithTagLocation(permTag, "Couldn't resolve a 
compatible interface type reference");
              }
  
--- 1450,1454 ----
  
              if (permType == 0) {
!                 throw getErrorWithTagLocation(permTag, "Couldn't resolve a 
compatible interface type reference. Maybe bean/view-type/version doesn't 
support it!");
              }
  
***************
*** 1434,1438 ****
                  int methodType = getMethodType(method);
  
!                 if (!hasFlag(methodType, IFACE_METHOD_CREATE) && 
!hasFlag(methodType, IFACE_METHOD_COMPONENT)) {
                      throw getErrorWithTagLocation(permTag,
                          "Can't mark a method permission on a non interface or 
create method");
--- 1484,1488 ----
                  int methodType = getMethodType(method);
  
!                 if ((methodType != IFACE_METHOD_CREATE) && (methodType != 
IFACE_METHOD_COMPONENT)) {
                      throw getErrorWithTagLocation(permTag,
                          "Can't mark a method permission on a non interface or 
create method");
***************
*** 1452,1456 ****
  
                  if (permType == 0) {
!                     throw getErrorWithTagLocation(permTag, "Couldn't resolve 
a compatible interface type reference");
                  }
  
--- 1502,1506 ----
  
                  if (permType == 0) {
!                     throw getErrorWithTagLocation(permTag, "Couldn't resolve 
a compatible interface type reference.  Maybe bean/view-type/version doesn't 
support it!");
                  }
  
***************
*** 1472,1476 ****
  
                  // Lets expand by permission for interface type
!                 retLst.addAll(MethodPermission.unroll(permType, 
permTag.getRoleNames(), method));
              }
          }
--- 1522,1526 ----
  
                  // Lets expand by permission for interface type
!                 retLst.addAll(MethodPermission.unroll(permType, method, 
permTag.getRoleNames()));
              }
          }
***************
*** 1482,1486 ****
              for (int i = 0; i < tags.length; i++) {
                  EjbFinderTag finderTag = (EjbFinderTag) tags[i];
!                 int permType = getViewType(finderTag.getViewType()) & 
(REMOTE_HOME| LOCAL_HOME);
  
                  // -------------------------------------------------------
--- 1532,1536 ----
              for (int i = 0; i < tags.length; i++) {
                  EjbFinderTag finderTag = (EjbFinderTag) tags[i];
!                 int permType = getViewType(finderTag.getViewType()) & 
(REMOTE_HOME | LOCAL_HOME);
  
                  // -------------------------------------------------------
***************
*** 1493,1497 ****
  
                  if (permType == 0) {
!                     throw getErrorWithTagLocation(finderTag, "Couldn't 
resolve a compatible interface type reference");
                  }
  
--- 1543,1547 ----
  
                  if (permType == 0) {
!                     throw getErrorWithTagLocation(finderTag, "Couldn't 
resolve a compatible interface type reference. Maybe bean/view-type/version 
doesn't support it!");
                  }
  
***************
*** 1513,1518 ****
  
                  // Lets expand by permission for interface type
!                 retLst.addAll(MethodPermission.unroll(permType, 
finderTag.getRoleNames(),
!                         getMethodBySignature(finderTag.getSignature())));
              }
          }
--- 1563,1568 ----
  
                  // Lets expand by permission for interface type
!                 retLst.addAll(MethodPermission.unroll(permType, 
getMethodBySignature(finderTag.getSignature()),
!                         finderTag.getRoleNames()));
              }
          }
***************
*** 1535,1539 ****
                  // "findByPrimaryKey"
                  if (canContinue) {
!                     int permType = getViewType(javaClass) & (REMOTE_HOME| 
LOCAL_HOME);
  
                      // -------------------------------------------------------
--- 1585,1589 ----
                  // "findByPrimaryKey"
                  if (canContinue) {
!                     int permType = getViewType(javaClass) & (REMOTE_HOME | 
LOCAL_HOME);
  
                      // -------------------------------------------------------
***************
*** 1546,1550 ****
  
                      if (permType == 0) {
!                         throw getErrorWithTagLocation(pkTag, "Couldn't 
resolve a compatible interface type reference");
                      }
  
--- 1596,1600 ----
  
                      if (permType == 0) {
!                         throw getErrorWithTagLocation(pkTag, "Couldn't 
resolve a compatible interface type reference. Maybe bean/view-type/version 
doesn't support it!");
                      }
  
***************
*** 1556,1561 ****
                      // Method signature should maybe be unrolled by permType, 
but it's not really relevant
                      // the return type, soo..
!                     retLst.addAll(MethodPermission.unroll(permType, 
pkTag.getRoleNames(),
!                             getMethodBySignature(methodSignature)));
                  }
              }
--- 1606,1611 ----
                      // Method signature should maybe be unrolled by permType, 
but it's not really relevant
                      // the return type, soo..
!                     retLst.addAll(MethodPermission.unroll(permType, 
getMethodBySignature(methodSignature),
!                             pkTag.getRoleNames()));
                  }
              }
***************
*** 1565,1582 ****
      }
  
!     public static class MethodPermission {
!         private String ifaceType;
!         private String[] roles;
!         private JavaMethod method;
  
          // class level - applies to all methods
!         public MethodPermission(String ifaceType, String[] roles) {
!             this(ifaceType, roles, null);
          }
  
          // method level - applies to given method (null to all methods)
!         public MethodPermission(String ifaceType, String[] roles, JavaMethod 
method) {
              this.ifaceType = ifaceType;
-             this.roles = roles;
              this.method = method;
          }
--- 1615,1691 ----
      }
  
!     public Collection getContainerTransaction(JavaClass javaClass) {
!         Collection retLst = new ArrayList();
!         DocletTag[] tags;
! 
!         if (!isEJB(javaClass)) {
!             throw new Error();
!         }
! 
!         // Let dig into class level ejb.transaction tags
!         tags = javaClass.getTagsByName("ejb.transaction");
! 
!         for (int i = 0; i < tags.length; i++) {
!             EjbTransactionTag transTag = (EjbTransactionTag) tags[i];
!             int permType = getViewType(javaClass);
! 
!             // -------------------------------------------------------
!             // Let's "bitwise and" to get only the specied masks
!             // that are compatible with the bean
!             // HUMM: Is this valid ?
!             if (permType == 0) {
!                 throw getErrorWithTagLocation(transTag, "Couldn't resolve a 
compatible interface type reference. Maybe bean/view-type/version doesn't 
support it!");
!             }
! 
!             // Lets expand by permission for interface type
!             retLst.addAll(ContainerTransaction.unroll(permType, 
transTag.getType()));
!         }
! 
!         // Now let's dig into method level ejb.transaction tags
!         JavaMethod[] methods = javaClass.getMethods();
!         JavaMethod method;
! 
!         for (int j = 0; j < methods.length; j++) {
!             tags = (method = methods[j]).getTagsByName("ejb.transaction");
! 
!             for (int k = 0; k < tags.length; k++) {
!                 EjbTransactionTag transTag = (EjbTransactionTag) tags[k];
!                 int methodType = getMethodType(method);
! 
!                 if ((methodType != IFACE_METHOD_CREATE) && (methodType != 
IFACE_METHOD_COMPONENT)) {
!                     throw getErrorWithTagLocation(transTag,
!                         "Can't mark a method transaction on a non interface 
or create method");
!                 }
! 
!                 int permType = getViewType(method, javaClass);
! 
!                 // -------------------------------------------------------
!                 // Let's "bitwise and" to get only the specied masks
!                 // that are compatible with the bean
!                 // HUMM: Is this valid ?
!                 if (permType == 0) {
!                     throw getErrorWithTagLocation(transTag, "Couldn't resolve 
a compatible interface type reference. Maybe bean/view-type/version doesn't 
support it!");
!                 }
! 
!                 // Lets expand by permission for interface type
!                 retLst.addAll(ContainerTransaction.unroll(permType, method, 
transTag.getType()));
!             }
!         }
! 
!         return retLst;
!     }
! 
!     public static class Permission {
!         private final String ifaceType;
!         private final JavaMethod method;
  
          // class level - applies to all methods
!         public Permission(String ifaceType) {
!             this(ifaceType, null);
          }
  
          // method level - applies to given method (null to all methods)
!         public Permission(String ifaceType, JavaMethod method) {
              this.ifaceType = ifaceType;
              this.method = method;
          }
***************
*** 1589,1592 ****
--- 1698,1765 ----
              return this.method;
          }
+     }
+ 
+     public static class ContainerTransaction extends Permission {
+         private final String transType;
+ 
+         // class level - applies to all methods
+         public ContainerTransaction(String ifaceType, String transType) {
+             this(ifaceType, null, transType);
+         }
+ 
+         // method level - applies to given method (null to all methods)
+         public ContainerTransaction(String ifaceType, JavaMethod method, 
String transType) {
+             super(ifaceType, method);
+             this.transType = transType;
+         }
+ 
+         public String getTransType() {
+             return this.transType;
+         }
+ 
+         public static Collection unroll(int permType, String transType) {
+             return unroll(permType, null, transType);
+         }
+ 
+         public static Collection unroll(int permType, JavaMethod method, 
String transType) {
+             Collection retLst = new ArrayList();
+ 
+             if (hasFlag(permType, REMOTE)) {
+                 retLst.add(new ContainerTransaction(REMOTE_INTERFACE, method, 
transType));
+             }
+ 
+             if (hasFlag(permType, REMOTE_HOME)) {
+                 retLst.add(new ContainerTransaction(REMOTE_HOME_INTERFACE, 
method, transType));
+             }
+ 
+             if (hasFlag(permType, LOCAL)) {
+                 retLst.add(new ContainerTransaction(LOCAL_INTERFACE, method, 
transType));
+             }
+ 
+             if (hasFlag(permType, LOCAL_HOME)) {
+                 retLst.add(new ContainerTransaction(LOCAL_HOME_INTERFACE, 
method, transType));
+             }
+ 
+             if (hasFlag(permType, SERVICE_END_POINT)) {
+                 retLst.add(new 
ContainerTransaction(SERVICE_END_POINT_INTERFACE, method, transType));
+             }
+ 
+             return retLst;
+         }
+     }
+ 
+     public static class MethodPermission extends Permission {
+         private final String[] roles;
+ 
+         // class level - applies to all methods
+         public MethodPermission(String ifaceType, String[] roles) {
+             this(ifaceType, null, roles);
+         }
+ 
+         // method level - applies to given method (null to all methods)
+         public MethodPermission(String ifaceType, JavaMethod method, String[] 
roles) {
+             super(ifaceType, method);
+             this.roles = roles;
+         }
  
          public String[] getRoles() {
***************
*** 1595,1622 ****
  
          public static Collection unroll(int permType, String[] roles) {
!             return unroll(permType, roles, null);
          }
  
!         public static Collection unroll(int permType, String[] roles, 
JavaMethod method) {
              Collection retLst = new ArrayList();
  
              if (hasFlag(permType, REMOTE)) {
!                 retLst.add(new MethodPermission(REMOTE_INTERFACE, roles, 
method));
              }
  
              if (hasFlag(permType, REMOTE_HOME)) {
!                 retLst.add(new MethodPermission(REMOTE_HOME_INTERFACE, roles, 
method));
              }
  
              if (hasFlag(permType, LOCAL)) {
!                 retLst.add(new MethodPermission(LOCAL_INTERFACE, roles, 
method));
              }
  
              if (hasFlag(permType, LOCAL_HOME)) {
!                 retLst.add(new MethodPermission(LOCAL_HOME_INTERFACE, roles, 
method));
              }
  
              if (hasFlag(permType, SERVICE_END_POINT)) {
!                 retLst.add(new MethodPermission(SERVICE_END_POINT_INTERFACE, 
roles, method));
              }
  
--- 1768,1795 ----
  
          public static Collection unroll(int permType, String[] roles) {
!             return unroll(permType, null, roles);
          }
  
!         public static Collection unroll(int permType, JavaMethod method, 
String[] roles) {
              Collection retLst = new ArrayList();
  
              if (hasFlag(permType, REMOTE)) {
!                 retLst.add(new MethodPermission(REMOTE_INTERFACE, method, 
roles));
              }
  
              if (hasFlag(permType, REMOTE_HOME)) {
!                 retLst.add(new MethodPermission(REMOTE_HOME_INTERFACE, 
method, roles));
              }
  
              if (hasFlag(permType, LOCAL)) {
!                 retLst.add(new MethodPermission(LOCAL_INTERFACE, method, 
roles));
              }
  
              if (hasFlag(permType, LOCAL_HOME)) {
!                 retLst.add(new MethodPermission(LOCAL_HOME_INTERFACE, method, 
roles));
              }
  
              if (hasFlag(permType, SERVICE_END_POINT)) {
!                 retLst.add(new MethodPermission(SERVICE_END_POINT_INTERFACE, 
method, roles));
              }
  

Index: EjbConfig.java
===================================================================
RCS file: 
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-ejb/src/main/java/org/xdoclet/plugin/ejb/EjbConfig.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** EjbConfig.java      26 Aug 2005 17:52:30 -0000      1.1
--- EjbConfig.java      6 Sep 2005 01:50:00 -0000       1.2
***************
*** 8,21 ****
  import java.util.regex.Pattern;
  
  /**
!  * Configuration object common to EJB plugins
   *
   * @author Diogo Quintela
   * @version $Revision$
   */
! public class EjbConfig {
      private EjbVersion version = EjbVersion.get(EjbVersion.EJB_2_1);
      private String ejbreplaceregex = "Bean|EJB|Ejb";
  
      /**
       * Sets the version for generated config file
--- 8,40 ----
  import java.util.regex.Pattern;
  
+ import org.generama.QDoxCapableMetadataProvider;
+ import org.generama.WriterMapper;
+ 
+ import org.generama.defaults.QDoxPlugin;
+ 
  /**
!  * Configuration object common to EJB plugins<br>
!  * This is a plugin just to enable all plugin documentation<br>
!  * This plugin doesn't generate anything
   *
   * @author Diogo Quintela
   * @version $Revision$
   */
! public class EjbConfig extends QDoxPlugin {
      private EjbVersion version = EjbVersion.get(EjbVersion.EJB_2_1);
      private String ejbreplaceregex = "Bean|EJB|Ejb";
  
+     public EjbConfig(QDoxCapableMetadataProvider metadataProvider, 
WriterMapper writerMapper) {
+         super(null, metadataProvider, writerMapper);
+ 
+         // Force multioutput path
+         // This and shouldGenerate always returning false, 
+         // doesn't generate nothing 
+         super.setMultioutput(true);
+         
+         // Initiate runtime
+         EjbRuntime.init(this);
+     }
+ 
      /**
       * Sets the version for generated config file
***************
*** 51,56 ****
--- 70,96 ----
              throw new NullPointerException();
          }
+ 
          Pattern.compile(ejbreplaceregex);
          this.ejbreplaceregex = ejbreplaceregex;
      }
+ 
+     /**
+      * Don't let multioutput be changed
+      */
+     public void setMultioutput(boolean multioutput) {
+         throw new RuntimeException("Can't set multioutput for plugin");
+     }
+ 
+     /**
+      * Never generate anything
+      */
+     public boolean shouldGenerate(Object metadata) {
+         return false;
+     }
+     
+     // Extend visibility
+     public QDoxCapableMetadataProvider getMetadataProvider() {
+         return super.getMetadataProvider();
+     }
+     
  }
\ No newline at end of file



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
xdoclet-plugins-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xdoclet-plugins-commits

Reply via email to