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-serv1564/plugin-ejb/src/main/java/org/xdoclet/plugin/ejb
Modified Files:
EjbUtils.java EjbConfig.java
Log Message:
- Finished ejb-jar.xml generation (for now) - time to move on
- Update qtags docs inserting <br> to generate a cleaner doc base
- Updated test-cases
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.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** EjbUtils.java 6 Sep 2005 09:25:54 -0000 1.9
--- EjbUtils.java 7 Sep 2005 01:13:08 -0000 1.10
***************
*** 100,103 ****
--- 100,104 ----
public static final String LOCAL_HOME_INTERFACE = "LocalHome";
public static final String SERVICE_END_POINT_INTERFACE =
"ServiceEndpoint";
+
/**
* Maps primitive types to their wrapper classes
***************
*** 130,141 ****
String typeIdentifier = "[a-zA-Z_][a-zA-Z0-9_]+";
String typeDimension = "\\[" + spaces + "\\]";
-
- // String typeDimension = "\\[\\]";
String typeDimensions = "(?:" + spaces + typeDimension + ")*";
-
- // String typeDimensions = "(?:" + typeDimension + ")*";
String typeDefination = "(?:" + typeIdentifier + "(?:\\." +
typeIdentifier + ")*" + typeDimensions + ")";
-
- // String typeDefination = "(?:" + typeIdentifier + "(?:\\." +
typeIdentifier + ")*" + typeDimensions + ")";
String paramWithName = "(" + typeDefination + ")" + space + spaces +
"(" + typeIdentifier + ")" + "(" +
typeDimensions + ")";
--- 131,136 ----
***************
*** 147,151 ****
spaces + "\\((" + paramsDefinition + ")\\)" + spaces;
! // Let's define the pattern's
methodPattern = Pattern.compile(methodDefination);
paramPattern = Pattern.compile(paramDefinition);
--- 142,146 ----
spaces + "\\((" + paramsDefinition + ")\\)" + spaces;
! // Let's define the patterns
methodPattern = Pattern.compile(methodDefination);
paramPattern = Pattern.compile(paramDefinition);
***************
*** 157,164 ****
public EjbUtils() throws ClassNotFoundException {
// Try to load one of the javax.ejb classes so the user can
// get an early warning if he has forgotten to stick it on the
classpath
getClass().getClassLoader().loadClass("javax.ejb.EnterpriseBean");
- this.config = EjbRuntime.getConfig();
}
--- 152,164 ----
public EjbUtils() throws ClassNotFoundException {
+ this(EjbRuntime.getConfig());
+ }
+
+ public EjbUtils(EjbConfig config) throws ClassNotFoundException {
+ this.config = config;
+
// Try to load one of the javax.ejb classes so the user can
// get an early warning if he has forgotten to stick it on the
classpath
getClass().getClassLoader().loadClass("javax.ejb.EnterpriseBean");
}
***************
*** 178,183 ****
* @return Collection of [EMAIL PROTECTED]
com.thoughtworks.qdox.model.JavaMethod}
*/
! public Collection getInterfaceMethods(final JavaClass clazz, final int
anyMethodTypeFlag,
! final int desiredViewType) {
if (clazz == null) {
throw new Error();
--- 178,182 ----
* @return Collection of [EMAIL PROTECTED]
com.thoughtworks.qdox.model.JavaMethod}
*/
! public Collection getInterfaceMethods(final JavaClass clazz, final int
anyMethodTypeFlag, final int desiredViewType) {
if (clazz == null) {
throw new Error();
***************
*** 192,196 ****
return false;
}
!
int vType = getViewType(method, clazz);
return hasFlag(vType, desiredViewType);
--- 191,195 ----
return false;
}
!
int vType = getViewType(method, clazz);
return hasFlag(vType, desiredViewType);
***************
*** 221,224 ****
--- 220,251 ----
}
+ public Collection getCMPBeans(Collection metadata) {
+ return getBeans(metadata, BEAN_CMP);
+ }
+
+ public Collection getBMPBeans(Collection metadata) {
+ return getBeans(metadata, BEAN_BMP);
+ }
+
+ public Collection getEntityBeans(Collection metadata) {
+ return getBeans(metadata, BEAN_ENTITY);
+ }
+
+ public Collection getSessionBeans(Collection metadata) {
+ return getBeans(metadata, BEAN_SESSION);
+ }
+
+ public Collection getMessageDrivenBeans(Collection metadata) {
+ return getBeans(metadata, BEAN_MESSAGE_DRIVEN);
+ }
+
+ public Collection getStateFullBeans(Collection metadata) {
+ return getBeans(metadata, BEAN_STATE_FULL);
+ }
+
+ public Collection getStateLessBeans(Collection metadata) {
+ return getBeans(metadata, BEAN_STATE_LESS);
+ }
+
public Collection getBeans(final Collection metadata, final int beanType)
{
return CollectionUtils.select(metadata,
***************
*** 470,473 ****
--- 497,501 ----
default:
+
// By default a method will not be included, so will not have
a view type
break;
***************
*** 476,480 ****
// Let's mask by bitwise filter
retVal &= filterMask;
-
return retVal;
}
--- 504,507 ----
***************
*** 968,972 ****
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);
--- 995,999 ----
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);
***************
*** 1036,1044 ****
}
! // get roles from finders
!
roleTags.addAll(Arrays.asList(javaClass.getTagsByName("ejb.finder")));
! // and from pk field ( if any )
! roleTags.addAll(Arrays.asList(javaClass.getTagsByName("ejb.pk")));
// and from extra security roles
--- 1063,1073 ----
}
! if (isEntityBean(javaClass)) {
! // get roles from finders
!
roleTags.addAll(Arrays.asList(javaClass.getTagsByName("ejb.finder")));
! // and from pk field ( if any )
!
roleTags.addAll(Arrays.asList(javaClass.getTagsByName("ejb.pk")));
! }
// and from extra security roles
***************
*** 1442,1446 ****
if (permType == 0) {
! throw getErrorWithTagLocation(permTag, "Couldn't resolve a
compatible interface type reference. Maybe bean/view-type/version doesn't
support it!");
}
--- 1471,1476 ----
if (permType == 0) {
! throw getErrorWithTagLocation(permTag,
! "Couldn't resolve a compatible interface type reference.
Maybe bean/view-type/version doesn't support it!");
}
***************
*** 1494,1498 ****
if (permType == 0) {
! throw getErrorWithTagLocation(permTag, "Couldn't resolve
a compatible interface type reference. Maybe bean/view-type/version doesn't
support it!");
}
--- 1524,1529 ----
if (permType == 0) {
! throw getErrorWithTagLocation(permTag,
! "Couldn't resolve a compatible interface type
reference. Maybe bean/view-type/version doesn't support it!");
}
***************
*** 1518,1522 ****
}
! if (isEntityBean(javaClass) || isSessionBean(javaClass)) {
tags = javaClass.getTagsByName("ejb.finder");
--- 1549,1553 ----
}
! if (isEntityBean(javaClass)) {
tags = javaClass.getTagsByName("ejb.finder");
***************
*** 1535,1539 ****
if (permType == 0) {
! throw getErrorWithTagLocation(finderTag, "Couldn't
resolve a compatible interface type reference. Maybe bean/view-type/version
doesn't support it!");
}
--- 1566,1571 ----
if (permType == 0) {
! throw getErrorWithTagLocation(finderTag,
! "Couldn't resolve a compatible interface type
reference. Maybe bean/view-type/version doesn't support it!");
}
***************
*** 1558,1564 ****
finderTag.getRoleNames()));
}
- }
- if (isEntityBean(javaClass)) {
EjbPkTag pkTag = (EjbPkTag) javaClass.getTagByName("ejb.pk");
--- 1590,1594 ----
***************
*** 1588,1592 ****
if (permType == 0) {
! throw getErrorWithTagLocation(pkTag, "Couldn't
resolve a compatible interface type reference. Maybe bean/view-type/version
doesn't support it!");
}
--- 1618,1623 ----
if (permType == 0) {
! throw getErrorWithTagLocation(pkTag,
! "Couldn't resolve a compatible interface type
reference. Maybe bean/view-type/version doesn't support it!");
}
***************
*** 1627,1631 ****
// 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!");
}
--- 1658,1663 ----
// 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!");
}
***************
*** 1657,1661 ****
// 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!");
}
--- 1689,1694 ----
// 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!");
}
***************
*** 1665,1668 ****
--- 1698,1735 ----
}
+ if (isEntityBean(javaClass)) {
+ tags = javaClass.getTagsByName("ejb.finder");
+
+ // Let dig into class level ejb.finder tags
+ for (int i = 0; i < tags.length; i++) {
+ EjbFinderTag finderTag = (EjbFinderTag) tags[i];
+
+ if (finderTag.getTransactionType() == null) {
+ // We are processing method transactions.
+ // So the optional element must be present
+ continue;
+ }
+
+ int permType = getViewType(finderTag.getViewType()) &
(REMOTE_HOME | LOCAL_HOME);
+
+ // -------------------------------------------------------
+ // Let's "bitwise and" to get only the specied masks
+ // that are compatible with the bean
+ // HUMM: Is this valid ?
+ if (finderTag.getMethodIntf() != null) {
+ permType &= getInterfaceType(finderTag.getMethodIntf());
+ }
+
+ if (permType == 0) {
+ throw getErrorWithTagLocation(finderTag,
+ "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,
getMethodBySignature(finderTag.getSignature()),
+ finderTag.getTransactionType()));
+ }
+ }
+
return retLst;
}
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.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** EjbConfig.java 6 Sep 2005 01:50:00 -0000 1.2
--- EjbConfig.java 7 Sep 2005 01:13:08 -0000 1.3
***************
*** 22,26 ****
*/
public class EjbConfig extends QDoxPlugin {
! private EjbVersion version = EjbVersion.get(EjbVersion.EJB_2_1);
private String ejbreplaceregex = "Bean|EJB|Ejb";
--- 22,26 ----
*/
public class EjbConfig extends QDoxPlugin {
! private EjbVersion version = EjbVersion.get(EjbVersion.EJB_2_0);
private String ejbreplaceregex = "Bean|EJB|Ejb";
***************
*** 89,93 ****
}
! // Extend visibility
public QDoxCapableMetadataProvider getMetadataProvider() {
return super.getMetadataProvider();
--- 89,93 ----
}
! // Increase visibility
public QDoxCapableMetadataProvider getMetadataProvider() {
return super.getMetadataProvider();
-------------------------------------------------------
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