User: pathoss
Date: 02/05/12 06:53:27
Modified: modules/ejb/src/xdoclet/modules/ejb Tag:
MODULE_REFACTORING_BRANCH
AbstractEjbCodeGeneratorSubTask.java
EjbDocletTask.java EjbTagsHandler.java
Log:
Refactored. Fixed compilation errors and warnings.
Revision Changes Path
No revision
No revision
1.1.2.3 +6 -5
xdoclet/modules/ejb/src/xdoclet/modules/ejb/Attic/AbstractEjbCodeGeneratorSubTask.java
Index: AbstractEjbCodeGeneratorSubTask.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/Attic/AbstractEjbCodeGeneratorSubTask.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -w -r1.1.2.2 -r1.1.2.3
--- AbstractEjbCodeGeneratorSubTask.java 27 Apr 2002 13:53:36 -0000 1.1.2.2
+++ AbstractEjbCodeGeneratorSubTask.java 12 May 2002 13:53:27 -0000 1.1.2.3
@@ -11,7 +11,8 @@
*
* @author Ara Abrahamian ([EMAIL PROTECTED])
* @created Nov 29, 2001
- * @version $Revision: 1.1.2.2 $
+ * @version $Revision: 1.1.2.3 $
*/
-public abstract class AbstractEjbCodeGeneratorSubTask extends TemplateSubTask {
+public abstract class AbstractEjbCodeGeneratorSubTask extends TemplateSubTask
+{
}
1.1.2.5 +143 -151
xdoclet/modules/ejb/src/xdoclet/modules/ejb/Attic/EjbDocletTask.java
Index: EjbDocletTask.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/Attic/EjbDocletTask.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -w -r1.1.2.4 -r1.1.2.5
--- EjbDocletTask.java 28 Apr 2002 22:25:21 -0000 1.1.2.4
+++ EjbDocletTask.java 12 May 2002 13:53:27 -0000 1.1.2.5
@@ -4,26 +4,27 @@
*/
package xdoclet.modules.ejb;
-import xdoclet.DocletContext;
-import xdoclet.DocletTask;
-import xdoclet.SubTask;
-import xdoclet.tagshandler.PackageTagsHandler;
-import xdoclet.util.Log;
+import java.io.Serializable;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
-import java.util.ArrayList;
-import java.io.Serializable;
+import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.types.FileSet;
-import org.apache.tools.ant.BuildException;
+
+import xdoclet.DocletContext;
+import xdoclet.DocletTask;
+import xdoclet.SubTask;
+import xdoclet.tagshandler.PackageTagsHandler;
+import xdoclet.util.LogUtil;
/**
* A task that executes various EJB-specific sub-tasks.
*
* @author Ara Abrahamian ([EMAIL PROTECTED])
* @created April 30, 2001
- * @version $Revision: 1.1.2.4 $
+ * @version $Revision: 1.1.2.5 $
*/
public class EjbDocletTask extends DocletTask
{
@@ -31,15 +32,12 @@
* efault is ejb2.0
*/
private String ejbspec = EjbSpecVersion.EJB_2_0;
- // list of suffix strings used when calculating a default bean name from a
class
+
/**
- * @todo-javadoc Describe the field
+ * List of suffix strings used when calculating a default bean name from a
class.
*/
private String ejbClassNameSuffix = "Bean,EJB,Ejb";
- /**
- * @todo-javadoc Describe the field
- */
private ArrayList packageSubstitutions = new ArrayList();
/**
@@ -116,8 +114,7 @@
*/
protected DocletContext getContext()
{
- if( context != null )
- {
+ if (context != null) {
return context;
}
@@ -147,13 +144,8 @@
*/
public static class EjbSpecVersion extends
org.apache.tools.ant.types.EnumeratedAttribute
{
- /**
- * @todo-javadoc Describe the field
- */
public final static String EJB_1_1 = "1.1";
- /**
- * @todo-javadoc Describe the field
- */
+
public final static String EJB_2_0 = "2.0";
/**
1.1.2.4 +975 -1093
xdoclet/modules/ejb/src/xdoclet/modules/ejb/Attic/EjbTagsHandler.java
Index: EjbTagsHandler.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/Attic/EjbTagsHandler.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -w -r1.1.2.3 -r1.1.2.4
--- EjbTagsHandler.java 28 Apr 2002 22:25:21 -0000 1.1.2.3
+++ EjbTagsHandler.java 12 May 2002 13:53:27 -0000 1.1.2.4
@@ -4,53 +4,50 @@
*/
package xdoclet.modules.ejb;
-import xjavadoc.XJavaDoc;
+import java.util.ArrayList;
+
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import org.apache.commons.logging.Log;
import xjavadoc.XClass;
import xjavadoc.XDoc;
-import xjavadoc.XTag;
-import xjavadoc.XJavaDocException;
-import org.apache.log4j.Category;
+import xjavadoc.XJavaDoc;
+import xjavadoc.XJavaDocException;
+import xjavadoc.XTag;
import xdoclet.DocletContext;
import xdoclet.DocletSupport;
+import xdoclet.SubTask;
import xdoclet.XDocletException;
import xdoclet.XDocletTagSupport;
-import xdoclet.SubTask;
-import xdoclet.tagshandler.TypeTagsHandler;
-import xdoclet.tagshandler.ClassTagsHandler;
-import xdoclet.tagshandler.PackageTagsHandler;
-
-import xdoclet.util.Log;
-import xdoclet.util.Translator;
-import xdoclet.util.TypeConversionUtil;
-
-import java.util.Properties;
-import java.util.StringTokenizer;
-import java.util.ArrayList;
+import xdoclet.modules.ejb.*;
import xdoclet.modules.ejb.entity.*;
-import xdoclet.modules.ejb.*;
-import xdoclet.modules.ejb.mdb.MdbTagsHandler;
+import xdoclet.modules.ejb.home.HomeInterfaceSubTask;
+import xdoclet.modules.ejb.home.LocalHomeInterfaceSubTask;
import xdoclet.modules.ejb.intf.LocalInterfaceSubTask;
import xdoclet.modules.ejb.intf.RemoteInterfaceSubTask;
-import xdoclet.modules.ejb.home.LocalHomeInterfaceSubTask;
-import xdoclet.modules.ejb.home.HomeInterfaceSubTask;
+import xdoclet.modules.ejb.mdb.MdbTagsHandler;
import xdoclet.modules.ejb.session.SessionSubTask;
import xdoclet.modules.ejb.session.SessionTagsHandler;
+import xdoclet.tagshandler.ClassTagsHandler;
+import xdoclet.tagshandler.PackageTagsHandler;
+import xdoclet.tagshandler.TypeTagsHandler;
+
+import xdoclet.util.LogUtil;
+import xdoclet.util.Translator;
+import xdoclet.util.TypeConversionUtil;
/**
- * @xdoclet:taghandler namespace="Ejb"
- *
* @author Ara Abrahamian ([EMAIL PROTECTED])
* @created Oct 15, 2001
- * @version $Revision: 1.1.2.3 $
+ * @xdoclet:taghandler namespace="Ejb"
+ * @version $Revision: 1.1.2.4 $
*/
public class EjbTagsHandler extends XDocletTagSupport
{
- /**
- * @todo-javadoc Describe the field
- */
protected final static String LOCAL_SUFFIX = "Local";
/**
@@ -58,63 +55,52 @@
*
* @param clazz Describe what the parameter does
* @return The AConcreteEJBean value
- * @exception xdoclet.XDocletException Describe the exception
- * @todo-javadoc Write javadocs for method parameter
- * @todo-javadoc Write javadocs for exception
+ * @exception XDocletException
*/
public static boolean isAConcreteEJBean( XClass clazz ) throws XDocletException
{
- Category cat = Log.getCategory( EjbTagsHandler.class,
"ifIsAConcreteEJBean" );
+ Log log = LogUtil.getLog(EjbTagsHandler.class, "ifIsAConcreteEJBean");
- XTag bean_tag = clazz.doc().tag( "ejb:bean" );
+ XTag beanTag = clazz.doc().tag("ejb:bean");
- if( bean_tag != null )
- {
- String generate_str = bean_tag.attributeValue( "generate" );
+ if (beanTag != null) {
+ String generate_str = beanTag.attributeValue("generate");
- if( generate_str != null )
- {
+ if (generate_str != null) {
boolean generate = TypeConversionUtil.stringToBoolean(
generate_str, true );
//generate="true" specifically
- if( generate == true )
- {
+ if (generate == true) {
return true;
}
- else
- {
+ else {
//generate="false" specifically
return false;
}
}
//ejb:beam name specified, so it's a concrete ejb
- if( bean_tag.attributeValue( "name" ) != null )
- {
+ if (beanTag.attributeValue("name") != null) {
return true;
}
}
- //now try to guess because it wasn't specifically specified whether it
should be generated or not
-
+ // now try to guess because it wasn't specifically specified whether
+ // it should be generated or not
SubTask subtask = getSubTaskClassForClass( clazz );
- if( clazz.isAbstract() == true )
- {
- if( hasANonDocletGeneratedSubClass( clazz ) == true )
- {
+ if (clazz.isAbstract() == true) {
+ if (hasANonDocletGeneratedSubClass(clazz) == true) {
return false;
}
//an abstract mdb/etc?
- if( subtask == null )
- {
+ if (subtask == null) {
return false;
}
//if <entitycmp/bmp/session/> is on, then do the best to guess
correctly
- if( DocletContext.getInstance().isSubTaskDefined(
subtask.getSubTaskName() ) == true )
- {
+ if
(DocletContext.getInstance().isSubTaskDefined(subtask.getSubTaskName()) == true) {
/*
* This piece of code is commented out because I found
it overkill to check all those cases
*
@@ -143,87 +129,78 @@
//none of the above guesses worked, assume it's
concrete!
return true;
}
- else
- {
+ else {
//if <entitycmp/bmp/session/> is off, so if class is
abstract then the bean is abstract except for entity cmp beans in ejb2 cmp2
- if( CmpTagsHandler.isEntityCmp( clazz ) &&
CmpTagsHandler.isUsingCmp2Impl( clazz ) )
- {
+ if (CmpTagsHandler.isEntityCmp(clazz) &&
CmpTagsHandler.isUsingCmp2Impl(clazz)) {
return true;
}
return false;
}
}
- else
- {
+ else {
//if <entitycmp/bmp/> is on, then it's an error or not specify
the class abstract, except for <session/> that non-abstract is also legal
- if( subtask != null &&
DocletContext.getInstance().isSubTaskDefined( subtask.getSubTaskName() ) )
- {
- if( subtask.getSubTaskName().equals(
SessionSubTask.SUBTASK_NAME ) )
- {
+ if (subtask != null &&
DocletContext.getInstance().isSubTaskDefined(subtask.getSubTaskName())) {
+ if (subtask.getSubTaskName().equals(SessionSubTask.SUBTASK_NAME)) {
return true;
}
- String cur_class_name =
ClassTagsHandler.getFullClassNameFor( clazz );
+ String currentClassName = clazz.qualifiedName();
throw new XDocletException( Translator.getString(
"xdoclet.ejb.Messages", "class_not_abstract",
- new String[]{cur_class_name,
SessionSubTask.SUBTASK_NAME} ) );
+ new String[]{currentClassName, SessionSubTask.SUBTASK_NAME}));
}
- else
- {
+ else {
return true;
}
}
}
/**
- * Returns the EJB name of the clazz by seaching for ejb:bean's name parameter.
- * If that is not found, it uses the class' name minus any suffix from the list
- * in the 'ejbClassNameSuffix' config parameter ("Bean,EJB,Ejb" by default).
+ * Returns the EJB name of the clazz by seaching for ejb:bean's name
+ * parameter. If that is not found, it uses the class' name minus any suffix
+ * from the list in the 'ejbClassNameSuffix' config parameter
+ * ("Bean,EJB,Ejb" by default).
*
* @param clazz The EJB bean class for which we want the EJB
* name
* @return The EjbName value
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
* @see #ejbName(java.util.Properties)
*/
public static String getEjbNameFor( XClass clazz ) throws XDocletException
{
- XTag bean_tag = clazz.doc().tag( "ejb:bean" );
- String param_val = null;
+ XTag beanTag = clazz.doc().tag("ejb:bean");
+ String paramValue = null;
- if( bean_tag != null )
- {
- param_val = bean_tag.attributeValue( "name" );
+ if (beanTag != null) {
+ paramValue = beanTag.attributeValue("name");
}
- if( param_val == null )
- {
- String clazz_name = clazz.qualifiedName();
+ if (paramValue == null) {
+ String className = clazz.qualifiedName();
- clazz_name.replace( '.', '/' );
+ className.replace('.', '/');
// remove any suffix from ejbClassNameSuffix list
String suffixlist = ( String )
getDocletContext().getConfigParam( "ejbClassNameSuffix" );
StringTokenizer st = new StringTokenizer( suffixlist, "," );
- while( st.hasMoreTokens() )
- {
+ while (st.hasMoreTokens()) {
String suffix = st.nextToken();
- if( clazz_name.endsWith( suffix ) )
- {
- int index = clazz_name.lastIndexOf( suffix );
+ if (className.endsWith(suffix)) {
+ int index = className.lastIndexOf(suffix);
- clazz_name = clazz_name.substring( 0, index );
+ className = className.substring(0, index);
break;
}
}
- return clazz_name;
+ return className;
}
- return param_val;
+ return paramValue;
}
/**
@@ -231,25 +208,23 @@
*
* @param clazz the class we want its short EJB name
* @return The shortEjbName value
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
* @see #shortEjbName()
*/
public static String getShortEjbNameFor( XClass clazz ) throws XDocletException
{
- Category cat = Log.getCategory( EjbTagsHandler.class, "shortEjbName" );
+ Log log = LogUtil.getLog(EjbTagsHandler.class, "shortEjbName");
// Find the last part of the name
StringTokenizer ejbNameTokens = new StringTokenizer( getEjbNameFor(
clazz ), ":./\\-" );
String name;
- do
- {
+ do {
name = ejbNameTokens.nextToken();
}while ( ejbNameTokens.hasMoreTokens() );
- if( cat.isDebugEnabled() )
- {
- cat.debug( "Name=" + name );
+ if (log.isDebugEnabled()) {
+ log.debug("Name=" + name);
}
return name;
@@ -258,7 +233,7 @@
/**
* @param clazz Description of Parameter
* @return a unique id for clazz
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
*/
public static String getEjbIdFor( XClass clazz ) throws XDocletException
{
@@ -281,9 +256,7 @@
*
* @param clazz Describe what the parameter does
* @return The LocalEjb value
- * @exception xdoclet.XDocletException Describe the exception
- * @todo-javadoc Write javadocs for method parameter
- * @todo-javadoc Write javadocs for exception
+ * @exception XDocletException
*/
public static boolean isLocalEjb( XClass clazz ) throws XDocletException
{
@@ -298,8 +271,7 @@
false
);
- if( value == null )
- {
+ if (value == null) {
//default is both if ejb2, remote if ejb1.1
if( getEjbSpec().equals( "2.0" ) )
return true;
@@ -315,9 +287,7 @@
*
* @param clazz Describe what the parameter does
* @return The RemoteEjb value
- * @exception xdoclet.XDocletException Describe the exception
- * @todo-javadoc Write javadocs for method parameter
- * @todo-javadoc Write javadocs for exception
+ * @exception XDocletException
*/
public static boolean isRemoteEjb( XClass clazz ) throws XDocletException
{
@@ -332,8 +302,7 @@
false
);
- if( value == null )
- {
+ if (value == null) {
//default is both if ejb2, remote if ejb1.1
return true;
}
@@ -342,12 +311,12 @@
}
/**
- * Returns true if clazz is only a local EJB by looking at ejb:bean's view-type
- * parameter.
+ * Returns true if clazz is only a local EJB by looking at ejb:bean's
+ * view-type parameter.
*
* @param clazz Description of Parameter
* @return The OnlyLocalEjb value
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
*/
public static boolean isOnlyLocalEjb( XClass clazz ) throws XDocletException
{
@@ -360,7 +329,7 @@
*
* @param clazz Description of Parameter
* @return The OnlyRemoteEjb value
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
*/
public static boolean isOnlyRemoteEjb( XClass clazz ) throws XDocletException
{
@@ -368,47 +337,41 @@
}
/**
- * Returns modified package name for a package name. If package name ends with
- * one of the toReplace Strings, then it's substituted by the replaceWith
- * String. If package_pattern not null then it's roughly used.
+ * Returns modified package name for a package name. If package name ends
+ * with one of the toReplace Strings, then it's substituted by the
+ * replaceWith String. If package_pattern not null then it's roughly used.
*
* @param packageName The name of the package name the new package
* name will be derived from
* @param package_pattern The package pattern to use. Can be null
* @param for_subtask
* @return Description of the Returned Value
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
*/
protected static String choosePackage( String packageName, String
package_pattern, String for_subtask ) throws XDocletException
{
- Category cat = Log.getCategory( EjbTagsHandler.class, "choosePackage"
);
+ Log log = LogUtil.getLog(EjbTagsHandler.class, "choosePackage");
ArrayList package_substitutions =
PackageTagsHandler.getPackageSubstitutions( for_subtask );
- if( cat.isDebugEnabled() )
- {
- cat.debug( "Package name=" + packageName + " - Pattern=" +
package_pattern );
+ if (log.isDebugEnabled()) {
+ log.debug("Package name=" + packageName + " - Pattern=" +
package_pattern);
}
- if( package_pattern != null )
- {
+ if (package_pattern != null) {
// later we may do some parametric {0} fancy stuff here
return package_pattern;
}
- else
- {
- for( int i = 0; i < package_substitutions.size(); i++ )
- {
+ else {
+ for (int i = 0; i < package_substitutions.size(); i++) {
PackageTagsHandler.PackageSubstitution ps = (
PackageTagsHandler.PackageSubstitution ) package_substitutions.get( i );
StringTokenizer st = new StringTokenizer(
ps.getPackages(), ",", false );
- while( st.hasMoreTokens() )
- {
+ while (st.hasMoreTokens()) {
String packages = st.nextToken();
String suffix = "." + packages;
- if( packageName.endsWith( suffix ) )
- {
+ if (packageName.endsWith(suffix)) {
packageName = packageName.substring(
0, packageName.length() - suffix.length() ) + "." + ps.getSubstituteWith();
break;
}
@@ -416,9 +379,8 @@
}
}
- if( cat.isDebugEnabled() )
- {
- cat.debug( "Package name=" + packageName );
+ if (log.isDebugEnabled()) {
+ log.debug("Package name=" + packageName);
}
return packageName;
@@ -429,26 +391,20 @@
*
* @param clazz Describe what the parameter does
* @return The SubTaskClassForClass value
- * @exception xdoclet.XDocletException Describe the exception
- * @todo-javadoc Write javadocs for method parameter
- * @todo-javadoc Write javadocs for exception
+ * @exception XDocletException
*/
private static SubTask getSubTaskClassForClass( XClass clazz ) throws
XDocletException
{
- if( CmpTagsHandler.isEntityCmp( clazz ) )
- {
+ if (CmpTagsHandler.isEntityCmp(clazz)) {
return DocletContext.getInstance().getSubTaskBy(
EntityCmpSubTask.SUBTASK_NAME );
}
- else if( BmpTagsHandler.isEntityBmp( clazz ) )
- {
+ else if (BmpTagsHandler.isEntityBmp(clazz)) {
return DocletContext.getInstance().getSubTaskBy(
EntityBmpSubTask.SUBTASK_NAME );
}
- else if( SessionTagsHandler.isSession( clazz ) )
- {
+ else if (SessionTagsHandler.isSession(clazz)) {
return DocletContext.getInstance().getSubTaskBy(
SessionSubTask.SUBTASK_NAME );
}
- else
- {
+ else {
return null;
}
}
@@ -456,38 +412,30 @@
/**
* Describe what the method does
*
- * @param cur_clazz Describe what the parameter does
+ * @param currentClass Describe what the parameter does
* @return Describe the return value
- * @exception xdoclet.XDocletException Describe the exception
- * @todo-javadoc Write javadocs for method
- * @todo-javadoc Write javadocs for method parameter
- * @todo-javadoc Write javadocs for return value
- * @todo-javadoc Write javadocs for exception
+ * @exception XDocletException
*/
- private static boolean hasANonDocletGeneratedSubClass( XClass cur_clazz )
throws XDocletException
- {
- try
+ private static boolean hasANonDocletGeneratedSubClass(XClass currentClass)
throws XDocletException
{
+ try {
//check if it's abstract and has a non-xdoclet-generated
derived class
- String full_class_name = ClassTagsHandler.getFullClassNameFor(
cur_clazz );
+ String fullClassName = currentClass.qualifiedName();
XClass[] classes = XJavaDoc.getInstance().sourceClasses();
- for( int i = 0; i < classes.length; i++ )
- {
+ for (int i = 0; i < classes.length; i++) {
XClass clazz = classes[i];
- if( full_class_name.equals(
ClassTagsHandler.getFullClassNameFor( clazz ) ) == false &&
+ if (fullClassName.equals(clazz.qualifiedName()) == false &&
!clazz.doc().hasTag( "xdoclet-generated" ) &&
- TypeTagsHandler.isOfType( clazz,
full_class_name, TypeTagsHandler.TYPE_HIERARCHY ) )
- {
+ TypeTagsHandler.isOfType(clazz, fullClassName,
TypeTagsHandler.TYPE_HIERARCHY)) {
return true;
}
}
return false;
}
- catch( XJavaDocException e )
- {
+ catch (XJavaDocException e) {
throw new XDocletException( e, e.getMessage() );
}
}
@@ -497,7 +445,7 @@
*
* @param attributes The attributes of the template tag
* @return The name of current EJB bean.
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
* @see #getEjbNameFor(xjavadoc.XClass)
* @doc:tag type="content"
* @doc:param name="prefixWithEjbSlash" optional="true"
@@ -510,12 +458,10 @@
boolean prefix_with_ejbslash = TypeConversionUtil.stringToBoolean(
prefix_with_ejbslash_str, false );
String ejb_name = getEjbNameFor( getCurrentClass() );
- if( prefix_with_ejbslash == true )
- {
+ if (prefix_with_ejbslash == true) {
return prefixWithEjbSlash( ejb_name );
}
- else
- {
+ else {
return ejb_name;
}
}
@@ -524,7 +470,7 @@
* Returns the name of EJB ref.
*
* @return The name of current EJB bean.
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
* @doc:tag type="content"
*/
public String ejbRefName() throws XDocletException
@@ -533,18 +479,15 @@
String ref_name = getCurrentClassTag().attributeValue( "ref-name" );
- if( ref_name != null )
- {
+ if (ref_name != null) {
ejb_ref_name = ref_name;
}
- else
- {
+ else {
ejb_ref_name = getEjbNameFor( getCurrentClass() );
String type = getCurrentClassTag().attributeValue( "view-type"
);
- if( type != null && type.equals( "local" ) && isLocalEjb(
getCurrentClass() ) && isRemoteEjb( getCurrentClass() ) )
- {
+ if (type != null && type.equals("local") &&
isLocalEjb(getCurrentClass()) && isRemoteEjb(getCurrentClass())) {
ejb_ref_name = ejb_ref_name + LOCAL_SUFFIX;
}
}
@@ -556,7 +499,7 @@
* Returns the name of EJB ref.
*
* @return The name of current EJB bean.
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
* @doc:tag type="content"
*/
public String ejbExternalRefName() throws XDocletException
@@ -564,12 +507,10 @@
String ejb_ref_name = null;
String ref_name = getCurrentClassTag().attributeValue( "ref-name" );
- if( ref_name != null )
- {
+ if (ref_name != null) {
ejb_ref_name = ref_name;
}
- else
- {
+ else {
ejb_ref_name = getCurrentClassTag().attributeValue( "ejb-name"
);
}
@@ -577,11 +518,11 @@
}
/**
- * Returns the symbolic name of the current class. For an EJBean it's the value
- * of ejb:bean's name parameter.
+ * Returns the symbolic name of the current class. For an EJBean it's the
+ * value of ejb:bean's name parameter.
*
* @return The symbolic name of the current class
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
* @see #shortEjbName()
* @doc:tag type="content"
*/
@@ -595,7 +536,7 @@
* "foo/bar/MyBean" ->"MyBean"
*
* @return Description of the Returned Value
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
* @see #getShortEjbNameFor(xjavadoc.XClass)
* @doc:tag type="content"
*/
@@ -605,11 +546,11 @@
}
/**
- * Evaluates the body block for each EJBean derived from one of the three EJB
- * types: EntityBean, SessionBean or MessageDrivenBean.
+ * Evaluates the body block for each EJBean derived from one of the three
+ * EJB types: EntityBean, SessionBean or MessageDrivenBean.
*
* @param template The body of the block tag
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
* @see
src.xdoclet.modules.ejb.entity.EntityTagsHandler#isEntity(xjavadoc.XClass)
* @see
src.xdoclet.modules.ejb.session.SessionTagsHandler#isSession(xjavadoc.XClass)
* @see
src.xdoclet.modules.ejb.mdb.MdbTagsHandler#isMessageDriven(xjavadoc.XClass)
@@ -617,47 +558,41 @@
*/
public void forAllBeans( String template ) throws XDocletException
{
- try
- {
+ try {
XClass[] classes = XJavaDoc.getInstance().sourceClasses();
- for( int i = 0; i < classes.length; i++ )
- {
+ for (int i = 0; i < classes.length; i++) {
setCurrentClass( classes[i] );
- if( DocletSupport.isDocletGenerated( getCurrentClass()
) )
- {
+ if (DocletSupport.isDocletGenerated(getCurrentClass())) {
continue;
}
if( EntityTagsHandler.isEntity( getCurrentClass() ) ||
SessionTagsHandler.isSession( getCurrentClass() ) ||
- MdbTagsHandler.isMessageDriven(
getCurrentClass() ) )
- {
+ MdbTagsHandler.isMessageDriven(getCurrentClass())) {
generate( template );
}
}
}
- catch( XJavaDocException e )
- {
+ catch (XJavaDocException e) {
throw new XDocletException( e, e.getMessage() );
}
}
/**
* Evaluates the body block if current bean is a concrete bean meaning the
- * generate parameter of ejb:bean is either not specified or equals to "true",
- * otherwise the bean is just an abstract base class bean not meant to be used
- * as a EJBean but serve as the base for other EJBeans.
+ * generate parameter of ejb:bean is either not specified or equals to
+ * "true", otherwise the bean is just an abstract base class bean not meant
+ * to be used as a EJBean but serve as the base for other EJBeans.
*
* @param template The body of the block tag
* @param attributes The attributes of the template tag
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
* @doc:tag type="block"
*/
public void ifIsAConcreteEJBean( String template, Properties attributes )
throws XDocletException
{
- if( isAConcreteEJBean( getCurrentClass() ) == true )
- {
+ if (isAConcreteEJBean(getCurrentClass()) == true) {
generate( template );
}
}
@@ -666,7 +601,7 @@
* Returns Bean type : "Entity", "Session" or "Message Driven".
*
* @return "Entity", "Session" or "Message Driven".
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
* @see
src.xdoclet.modules.ejb.entity.EntityTagsHandler#isEntity(xjavadoc.XClass)
* @see
src.xdoclet.modules.ejb.session.SessionTagsHandler#isSession(xjavadoc.XClass)
* @see
src.xdoclet.modules.ejb.mdb.MdbTagsHandler#isMessageDriven(xjavadoc.XClass)
@@ -674,31 +609,27 @@
*/
public String beanType() throws XDocletException
{
- if( EntityTagsHandler.isEntity( getCurrentClass() ) )
- {
+ if (EntityTagsHandler.isEntity(getCurrentClass())) {
return "Entity";
}
- else if( SessionTagsHandler.isSession( getCurrentClass() ) )
- {
+ else if (SessionTagsHandler.isSession(getCurrentClass())) {
return "Session";
}
- else if( MdbTagsHandler.isMessageDriven( getCurrentClass() ) )
- {
+ else if (MdbTagsHandler.isMessageDriven(getCurrentClass())) {
return "Message Driven";
}
- else
- {
+ else {
return "Unknown";
}
}
/**
- * Returns the full-qualified name of the current class's concrete class. This
- * is the class that is generated and is derived from current class.
+ * Returns the full-qualified name of the current class's concrete class.
+ * This is the class that is generated and is derived from current class.
*
- * @return The full-qualified name of the current class's
- * concrete class
- * @exception xdoclet.XDocletException Description of Exception
+ * @return The full-qualified name of the current
+ * class's concrete class
+ * @exception XDocletException
* @see
src.xdoclet.modules.ejb.session.SessionTagsHandler#sessionClass()
* @see
src.xdoclet.modules.ejb.entity.BmpTagsHandler#entityBmpClass()
* @see
src.xdoclet.modules.ejb.entity.CmpTagsHandler#entityCmpClass()
@@ -707,45 +638,34 @@
*/
public String concreteFullClassName() throws XDocletException
{
- if( SessionTagsHandler.isSession( getCurrentClass() ) )
- {
- if( DocletContext.getInstance().isSubTaskDefined(
SessionSubTask.SUBTASK_NAME ) )
- {
+ if (SessionTagsHandler.isSession(getCurrentClass())) {
+ if
(DocletContext.getInstance().isSubTaskDefined(SessionSubTask.SUBTASK_NAME)) {
return SessionTagsHandler.getSessionClassFor(
getCurrentClass() );
}
- else
- {
+ else {
return getCurrentClass().qualifiedName();
}
}
- else if( BmpTagsHandler.isEntityBmp( getCurrentClass() ) )
- {
- if( DocletContext.getInstance().isSubTaskDefined(
EntityBmpSubTask.SUBTASK_NAME ) )
- {
+ else if (BmpTagsHandler.isEntityBmp(getCurrentClass())) {
+ if
(DocletContext.getInstance().isSubTaskDefined(EntityBmpSubTask.SUBTASK_NAME)) {
return BmpTagsHandler.getEntityBmpClassFor(
getCurrentClass() );
}
- else
- {
+ else {
return getCurrentClass().qualifiedName();
}
}
- else if( CmpTagsHandler.isEntityCmp( getCurrentClass() ) )
- {
- if( DocletContext.getInstance().isSubTaskDefined(
EntityCmpSubTask.SUBTASK_NAME ) )
- {
+ else if (CmpTagsHandler.isEntityCmp(getCurrentClass())) {
+ if
(DocletContext.getInstance().isSubTaskDefined(EntityCmpSubTask.SUBTASK_NAME)) {
return CmpTagsHandler.getEntityCmpClassFor(
getCurrentClass() );
}
- else
- {
+ else {
return getCurrentClass().qualifiedName();
}
}
- else if( MdbTagsHandler.isMessageDriven( getCurrentClass() ) )
- {
+ else if (MdbTagsHandler.isMessageDriven(getCurrentClass())) {
return MdbTagsHandler.getMessageDrivenClassFor(
getCurrentClass() );
}
- else
- {
+ else {
return null;
}
}
@@ -754,7 +674,7 @@
* Returns unique id for current ejb.
*
* @return Description of the Returned Value
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
* @doc:tag type="content"
*/
public String id() throws XDocletException
@@ -764,60 +684,57 @@
/**
* @param template Description of Parameter
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
*/
public void ifLocalEjb( String template ) throws XDocletException
{
- if( isLocalEjb( getCurrentClass() ) )
- {
+ if (isLocalEjb(getCurrentClass())) {
generate( template );
}
}
/**
* @param template Description of Parameter
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
*/
public void ifRemoteEjb( String template ) throws XDocletException
{
- if( isRemoteEjb( getCurrentClass() ) )
- {
+ if (isRemoteEjb(getCurrentClass())) {
generate( template );
}
}
/**
* @param template
- * @exception xdoclet.XDocletException
+ * @exception XDocletException
* @doc: tag type="body"
*/
public void ifNotLocalEjb( String template ) throws XDocletException
{
- if( !isLocalEjb( getCurrentClass() ) )
- {
+ if (!isLocalEjb(getCurrentClass())) {
generate( template );
}
}
/**
* @param template
- * @exception xdoclet.XDocletException
+ * @exception XDocletException
* @doc:tag type="body"
*/
public void ifNotRemoteEjb( String template ) throws XDocletException
{
- if( !isRemoteEjb( getCurrentClass() ) )
- {
+ if (!isRemoteEjb(getCurrentClass())) {
generate( template );
}
}
/**
- * Returns true of clazz is an EJB (derived from an EJB type), false otherwise.
+ * Returns true of clazz is an EJB (derived from an EJB type), false
+ * otherwise.
*
* @param clazz Description of Parameter
* @return The Ejb value
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
*/
protected boolean isEjb( XClass clazz ) throws XDocletException
{
@@ -829,9 +746,10 @@
* value
*
* @param clazz the class
- * @param type type value used for view-type of remote/local
+ * @param type type value used for view-type of
+ * remote/local
* @return dependent class name for the class and type
- * @exception xdoclet.XDocletException
+ * @exception XDocletException
*/
protected String getDependentClassFor( XClass clazz, String type ) throws
XDocletException
{
@@ -846,31 +764,25 @@
protected String getDependentClassTagName()
{
//it's too much dependency, we should find a better way
- if( getDocletContext().getActiveSubTask().getSubTaskName().equals(
DataObjectSubTask.SUBTASK_NAME ) )
- {
+ if
(getDocletContext().getActiveSubTask().getSubTaskName().equals(DataObjectSubTask.SUBTASK_NAME))
{
return "ejb:data-object";
}
else if(
getDocletContext().getActiveSubTask().getSubTaskName().equals(
EntityBmpSubTask.SUBTASK_NAME ) ||
- getDocletContext().getActiveSubTask().getSubTaskName().equals(
EntityBmpSubTask.SUBTASK_NAME ) )
- {
+
getDocletContext().getActiveSubTask().getSubTaskName().equals(EntityBmpSubTask.SUBTASK_NAME))
{
return "ejb:bean";
}
else if(
getDocletContext().getActiveSubTask().getSubTaskName().equals(
RemoteInterfaceSubTask.SUBTASK_NAME ) ||
- getDocletContext().getActiveSubTask().getSubTaskName().equals(
LocalInterfaceSubTask.SUBTASK_NAME ) )
- {
+
getDocletContext().getActiveSubTask().getSubTaskName().equals(LocalInterfaceSubTask.SUBTASK_NAME))
{
return "ejb:interface";
}
else if(
getDocletContext().getActiveSubTask().getSubTaskName().equals(
HomeInterfaceSubTask.SUBTASK_NAME ) ||
- getDocletContext().getActiveSubTask().getSubTaskName().equals(
LocalHomeInterfaceSubTask.SUBTASK_NAME ) )
- {
+
getDocletContext().getActiveSubTask().getSubTaskName().equals(LocalHomeInterfaceSubTask.SUBTASK_NAME))
{
return "ejb:interface";
}
- else if(
getDocletContext().getActiveSubTask().getSubTaskName().equals(
EntityPkSubTask.SUBTASK_NAME ) )
- {
+ else if
(getDocletContext().getActiveSubTask().getSubTaskName().equals(EntityPkSubTask.SUBTASK_NAME))
{
return "ejb:pk";
}
- else
- {
+ else {
return null;
}
}
@@ -880,29 +792,24 @@
*
* @param ejb_name Describe what the parameter does
* @return Describe the return value
- * @todo-javadoc Write javadocs for method
- * @todo-javadoc Write javadocs for method parameter
- * @todo-javadoc Write javadocs for return value
*/
protected String prefixWithEjbSlash( String ejb_name )
{
- if( ejb_name.startsWith( "ejb/" ) )
- {
+ if (ejb_name.startsWith("ejb/")) {
return ejb_name;
}
- else
- {
+ else {
return "ejb/" + ejb_name;
}
}
/**
- * Returns true if class/method denoted by doc has ejb:transaction tag, false
- * otherwise.
+ * Returns true if class/method denoted by doc has ejb:transaction tag,
+ * false otherwise.
*
* @param doc Description of Parameter
* @return Description of the Returned Value
- * @exception xdoclet.XDocletException Description of Exception
+ * @exception XDocletException
*/
protected boolean hasTransaction( XDoc doc ) throws XDocletException
{
@@ -913,29 +820,28 @@
* Returns the name of the class pk/etc class extends.
*
* @param clazz the class
- * @param tag_name name of the tag (ejb:bean for example, used
- * for getting generate parameter)
+ * @param tag_name name of the tag (ejb:bean for example,
+ * used for getting generate parameter)
* @param type type value used for view type of
* remote/local
* @param extends_param_name extends parameter name (is "extends" for
* ejb:bean but is "local-extends" for local)
- * @param default_base_class_name default base class name, returned when not
- * deriving from another base class
- * @return correct value for the extends statement of a
- * generated class
- * @exception xdoclet.XDocletException
+ * @param default_base_class_name default base class name, returned when
+ * not deriving from another base class
+ * @return correct value for the extends statement
+ * of a generated class
+ * @exception XDocletException
*/
protected String extendsFromFor( XClass clazz, String tag_name, String type,
String extends_param_name, String default_base_class_name ) throws XDocletException
{
- Category cat = Log.getCategory( EjbTagsHandler.class, "extendsFromFor"
);
+ Log log = LogUtil.getLog(EjbTagsHandler.class, "extendsFromFor");
//see ejb:pk/etc generate="?" in superclass
XClass superclass = clazz.superclass();
boolean super_generate;
- if( superclass.doc().hasTag( tag_name ) )
- {
+ if (superclass.doc().hasTag(tag_name)) {
String super_generate_str = getTagValue(
FOR_CLASS,
superclass.doc(),
@@ -949,22 +855,19 @@
super_generate = TypeConversionUtil.stringToBoolean(
super_generate_str, true );
}
- else
- {
+ else {
// Two Cases : PersonBean and BaseEntityBean
super_generate = false;
XClass[] interfaces = clazz.superclass().interfaces();
- for( int i = 0; i < interfaces.length; i++ )
- {
+ for (int i = 0; i < interfaces.length; i++) {
XClass intf = interfaces[i];
//if superclass is not javax.ejb.EntityBean then we
have a superclass which is itself deriving from javax.ejb.EntityBean
if( intf.qualifiedName().equals(
"javax.ejb.EntityBean" ) ||
intf.qualifiedName().equals(
"javax.ejb.SessionBean" ) ||
- intf.qualifiedName().equals(
"javax.ejb.MessageDrivenBean" ) )
- {
+ intf.qualifiedName().equals("javax.ejb.MessageDrivenBean")) {
//it derives from javax.ejb.*Bean and no
superclass for pk/etc class is explicitly defined
super_generate = true;
}
@@ -987,41 +890,33 @@
);
//if explicitly specified
- if( extends_value != null )
- {
+ if (extends_value != null) {
return extends_value;
}
- else
- {
+ else {
//now try to guess
//if we are deriving from another ejb bean then derive from
that bean's pk class too
//(if generate="true" for superclass's pk/etc class)
// java.lang.Object (the only that have no superclass)
- if( superclass.superclass() == null )
- {
+ if (superclass.superclass() == null) {
return default_base_class_name;
}
//if a superclass with generate="true"
- else if( super_generate == true )
- {
+ else if (super_generate == true) {
String class_name = getDependentClassFor( superclass,
type );
- if( cat.isDebugEnabled() )
- {
- cat.debug( "DCF = " + class_name + " " +
superclass.superclass() );
+ if (log.isDebugEnabled()) {
+ log.debug("DCF = " + class_name + " " +
superclass.superclass());
}
- if( class_name != null )
- {
+ if (class_name != null) {
return class_name;
}
- else
- {
+ else {
return default_base_class_name;
}
}
- else
- {
+ else {
//so we have a superclass with pk-generate="false",
look at superclass of that superclass!
return extendsFromFor( superclass, tag_name, type,
extends_param_name, default_base_class_name );
}
@@ -1034,33 +929,25 @@
* @param clazz Describe what the parameter does
* @param tag_name Describe what the parameter does
* @return Describe the return value
- * @exception xdoclet.XDocletException Describe the exception
- * @todo-javadoc Write javadocs for method
- * @todo-javadoc Write javadocs for method parameter
- * @todo-javadoc Write javadocs for method parameter
- * @todo-javadoc Write javadocs for return value
- * @todo-javadoc Write javadocs for exception
+ * @exception XDocletException
*/
protected boolean shouldTraverseSuperclassForDependentClass( XClass clazz,
String tag_name ) throws XDocletException
{
- Category cat = Log.getCategory( EjbTagsHandler.class,
"shouldTraverseSuperclassForDependentClass" );
+ Log log = LogUtil.getLog(EjbTagsHandler.class,
"shouldTraverseSuperclassForDependentClass");
- if( clazz.qualifiedName().equals( "java.lang.Object" ) )
- {
- cat.debug( "clazz = java.lang.Object" );
+ if (clazz.qualifiedName().equals("java.lang.Object")) {
+ log.debug("clazz = java.lang.Object");
return true;
}
- if( !TypeTagsHandler.isOfType( clazz,
"javax.ejb.EntityBean,javax.ejb.SessionBean", TypeTagsHandler.TYPE_HIERARCHY ) )
- {
- cat.debug( clazz.qualifiedName() + " is _not_ of type
javax.ejb.EntityBean,javax.ejb.SessionBean" );
+ if (!TypeTagsHandler.isOfType(clazz,
"javax.ejb.EntityBean,javax.ejb.SessionBean", TypeTagsHandler.TYPE_HIERARCHY)) {
+ log.debug(clazz.qualifiedName() + " is _not_ of type
javax.ejb.EntityBean,javax.ejb.SessionBean");
return true;
}
- else
- {
- cat.debug( clazz.qualifiedName() + " _is_ of type
javax.ejb.EntityBean,javax.ejb.SessionBean" );
+ else {
+ log.debug(clazz.qualifiedName() + " _is_ of type
javax.ejb.EntityBean,javax.ejb.SessionBean");
}
//see ejb:bean generate="?" in superclass
@@ -1076,17 +963,15 @@
);
boolean bean_generate = TypeConversionUtil.stringToBoolean(
bean_generate_str, true );
- if( bean_generate == false )
- {
- cat.debug( "bean_generate == false" );
+ if (bean_generate == false) {
+ log.debug("bean_generate == false");
return true;
}
boolean generate = false;
- if( tag_name != null )
- {
+ if (tag_name != null) {
//see ejb:pk/etc generate="?" in superclass
String generate_str = getTagValue(
FOR_CLASS,
@@ -1102,18 +987,15 @@
generate = TypeConversionUtil.stringToBoolean( generate_str,
true );
}
- if( generate == false )
- {
- cat.debug( "generate == false" );
+ if (generate == false) {
+ log.debug("generate == false");
return true;
}
- else
- {
- cat.debug( "generate == true" );
+ else {
+ log.debug("generate == true");
return false;
}
}
-
}
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel