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-serv26802/src/main/java/org/xdoclet/plugin/ejb

Modified Files:
        EjbUtils.java 
Log Message:
Replace Sun's ejb dependency with geromino-ejb due to licence restriction. 
Formatting with Jalopy.

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.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** EjbUtils.java       5 Dec 2003 01:55:12 -0000       1.3
--- EjbUtils.java       28 Apr 2005 07:22:23 -0000      1.4
***************
*** 1,12 ****
  package org.xdoclet.plugin.ejb;
  
  import org.apache.commons.collections.CollectionUtils;
  import org.apache.commons.collections.Predicate;
  import com.thoughtworks.qdox.model.JavaClass;
  import com.thoughtworks.qdox.model.JavaMethod;
  
- import java.util.Collection;
- import java.util.Arrays;
- 
  /**
   * This class holds common functionality used by all EJB plugin.
--- 1,18 ----
+ /*
+  * Copyright (c) 2003
+  * XDoclet Team
+  * All rights reserved.
+  */
  package org.xdoclet.plugin.ejb;
  
+ import java.util.Arrays;
+ import java.util.Collection;
+ 
  import org.apache.commons.collections.CollectionUtils;
  import org.apache.commons.collections.Predicate;
+ 
  import com.thoughtworks.qdox.model.JavaClass;
  import com.thoughtworks.qdox.model.JavaMethod;
  
  /**
   * This class holds common functionality used by all EJB plugin.
***************
*** 18,40 ****
   */
  public class EjbUtils {
- 
      public EjbUtils() throws ClassNotFoundException {
! // Try to load one of the javax.ejb classes so the user can
! // get an early warning if she has forgotten to stick it on the classpath
          getClass().getClassLoader().loadClass("javax.ejb.EntityBean");
      }
  
-     public boolean shouldGenerate(Object metadata) {
-         JavaClass javaClass = (JavaClass) metadata;
-         boolean isEjb = javaClass.isA("javax.ejb.EntityBean");
-         boolean ignore = 
"false".equals(javaClass.getNamedParameter("ejb.bean", "generate"));
-         return isEjb && !ignore;
-     }
- 
      public String getEjbName(JavaClass clazz) {
          String result = clazz.getNamedParameter("ejb.bean", "name");
          if (result == null) {
              result = clazz.getName();
          }
          return result;
      }
--- 24,40 ----
   */
  public class EjbUtils {
      public EjbUtils() throws ClassNotFoundException {
!         // Try to load one of the javax.ejb classes so the user can
!         // get an early warning if she has forgotten to stick it on the 
classpath
          getClass().getClassLoader().loadClass("javax.ejb.EntityBean");
      }
  
      public String getEjbName(JavaClass clazz) {
          String result = clazz.getNamedParameter("ejb.bean", "name");
+ 
          if (result == null) {
              result = clazz.getName();
          }
+ 
          return result;
      }
***************
*** 45,70 ****
       */
      public Collection getInterfaceMethods(final JavaClass clazz, final String 
desiredViewType) {
!         if (clazz == null || desiredViewType == null) throw new Error();
!         return CollectionUtils.select(Arrays.asList(clazz.getMethods()), new 
Predicate() {
!             public boolean evaluate(Object object) {
!                 JavaMethod method = (JavaMethod) object;
!                 String viewType = 
method.getNamedParameter("ejb.interface-method", "view-type");
!                 if (viewType == null) {
!                     viewType = clazz.getNamedParameter("ejb.bean", 
"view-type");
!                 }
  
!                 if (viewType != null) {
!                     boolean isLocal = "local".equals(viewType) || 
"both".equals(viewType);
!                     boolean isRemote = "remote".equals(viewType) || 
"both".equals(viewType);
!                     if (desiredViewType.equals("local")) {
!                         return isLocal;
                      }
!                     if (desiredViewType.equals("remote")) {
!                         return isRemote;
                      }
                  }
!                 return false;
!             }
!         });
      }
! }
--- 45,85 ----
       */
      public Collection getInterfaceMethods(final JavaClass clazz, final String 
desiredViewType) {
!         if (clazz == null || desiredViewType == null) {
!             throw new Error();
!         }
  
!         return CollectionUtils.select(Arrays.asList(clazz.getMethods()),
!             new Predicate() {
!                 public boolean evaluate(Object object) {
!                     JavaMethod method = (JavaMethod) object;
!                     String viewType = 
method.getNamedParameter("ejb.interface-method", "view-type");
! 
!                     if (viewType == null) {
!                         viewType = clazz.getNamedParameter("ejb.bean", 
"view-type");
                      }
! 
!                     if (viewType != null) {
!                         boolean isLocal = "local".equals(viewType) || 
"both".equals(viewType);
!                         boolean isRemote = "remote".equals(viewType) || 
"both".equals(viewType);
! 
!                         if (desiredViewType.equals("local")) {
!                             return isLocal;
!                         }
! 
!                         if (desiredViewType.equals("remote")) {
!                             return isRemote;
!                         }
                      }
+ 
+                     return false;
                  }
!             });
      }
! 
!     public boolean shouldGenerate(Object metadata) {
!         JavaClass javaClass = (JavaClass) metadata;
!         boolean isEjb = javaClass.isA("javax.ejb.EntityBean");
!         boolean ignore = 
"false".equals(javaClass.getNamedParameter("ejb.bean", "generate"));
!         return isEjb && !ignore;
!     }
! }
\ No newline at end of file



-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
xdoclet-plugins-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xdoclet-plugins-commits

Reply via email to