*/
if (!descriptor.getMethodContainerTransactions().isEmpty()) {
for (Enumeration ee = descriptor.getMethodContainerTransactions().keys(); ee.hasMoreElements();) {
lookForIt = false;
MethodDescriptor methodDescriptor = (MethodDescriptor) ee.nextElement();
/*** Fixed the bug: 4883730. ejbClassSymbol is null when method-intf is not
* defined in the xml, since it is an optional field. Removed the earlier
* checks. A null method-intf indicates that the method is supposed to be
* in both Local & Home interfaces. ***/
/*
String methodIntf = null;
try {
methodIntf = methodDescriptor.getEjbClassSymbol();
} catch ( Exception ex ) {}
if ( methodIntf == null ) { //|| methodIntf.equals("")
//probably a wildcard was there
wildCardWasPresent = true;
continue;
}
//allMethods = true;
// end of workaround
*/
// here we have to check that each method descriptor
// corresponds to a or some methods on the home interface
// according to the six styles
// style 1)
if (methodDescriptor.getName().equals(MethodDescriptor.ALL_METHODS)) {
// if getEjbClassName() is Remote -> CARRY ON
// if Home - PASS
if (methodDescriptor.getEjbClassSymbol() == null) {
lookForIt = true;
} else if (methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_HOME)) {
lookForIt = true;
// if empty String PASS
} else if (methodDescriptor.getEjbClassSymbol().equals("")) {
lookForIt = true;
} else if (methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_REMOTE)) {
lookForIt = false;
// else (Bogus)
} else {
// carry on & don't look for
// container transaction
lookForIt = false;
}
} else if (methodDescriptor.getParameterClassNames() == null) {
// if (getEjbClassSybol() is Home or is the empty String AND if methods[i].getName().equals(methodDescriptor.getName())
if (((methodDescriptor.getEjbClassSymbol() == null) ||
methodDescriptor.getEjbClassSymbol().equals("") ||
methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_HOME)||
methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_LOCALHOME)) &&
(methods[i].getName().equals(methodDescriptor.getName()))) {
// PASS
lookForIt = true;
} else {
// carry on
lookForIt = false;
}
} else {
// if (getEjbClassSybol() is Home or is the empty String AND if methods[i].getName().equals(methodDescriptor.getName()) AND
// the parameters of the method[i] are the same as the parameters of the method descriptor )
if (((methodDescriptor.getEjbClassSymbol() == null) ||
methodDescriptor.getEjbClassSymbol().equals("") ||
methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_HOME)||
methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_LOCALHOME)) &&
(methods[i].getName().equals(methodDescriptor.getName())) &&
(MethodUtils.stringArrayEquals(methodDescriptor.getParameterClassNames(), (new MethodDescriptor(methods[i], methodIntf)).getParameterClassNames()))) {
// PASS
lookForIt = true;
} else {
// CARRY ON
lookForIt = false;
}
}
if (lookForIt) {
containerTransaction =
(ContainerTransaction) descriptor.getMethodContainerTransactions().get(methodDescriptor);
if (containerTransaction != null) {
String transactionAttribute =
containerTransaction.getTransactionAttribute();
// danny is doing this in the DOL, but is it possible to not have
// any value for containerTransaction.getTransactionAttribute()
// in the DOL? if it is possible to have blank value for this,
// then this check is needed here, otherwise we are done and we
// don't need this check here
if (ContainerTransaction.NOT_SUPPORTED.equals(transactionAttribute)
|| ContainerTransaction.SUPPORTS.equals(transactionAttribute)
|| ContainerTransaction.REQUIRED.equals(transactionAttribute)
|| ContainerTransaction.REQUIRES_NEW.equals(transactionAttribute)
|| ContainerTransaction.MANDATORY.equals(transactionAttribute)
|| ContainerTransaction.NEVER.equals(transactionAttribute)
|| (!transactionAttribute.equals(""))) {
// if "*" ignore, test N/A
if (!methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_HOME)&&
!methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_LOCALHOME)) {
result.addGoodDetails(smh.getLocalString
(getClass().getName() + ".passed",
"Valid: TransactionAttribute [ {0} ] for method [ {1} ] is not defined for home interface [ {2} ]",
new Object[] {transactionAttribute, methods[i].getName(),home}));
} else {
oneFailed = true;
addErrorDetails(result, compName);
result.addErrorDetails(smh.getLocalString
(getClass().getName() + ".failed",
"Error: TransactionAttribute [ {0} ] for method [ {1} ] is not valid. Transaction attributes must not be specified for all methods of session bean home interface [ {2} ].",
new Object[] {transactionAttribute, methods[i].getName(),home}));
resolved = false;
}
} else {
addGoodDetails(result, compName);
result.addGoodDetails(smh.getLocalString
(getClass().getName() + ".passed",
"Valid: TransactionAttribute [ {0} ] for method [ {1} ] is not defined for home interface [ {2} ]",
new Object[] {transactionAttribute, methods[i].getName(),home}));
}
} else {
addGoodDetails(result, compName);
result.addGoodDetails(smh.getLocalString
(getClass().getName() + ".passedException",
"Valid: TransactionAttribute is null for method [ {0} ]",
new Object[] {methodDescriptor.getName()}));
}
}
}
// before you go on to the next method,
// did you resolve the last one okay?