Define primary key class which must be legal Value Type in RMI-IIOP test.
Enterprise Bean's primary key class
The Bean provider must specify a primary key class in the deployment
descriptor. The primary key class must be a legal Value Type in RMI-IIOP.
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if (descriptor instanceof EjbEntityDescriptor) {
boolean isLegalRMIIIOPValueType = false;
boolean oneFailed = false;
// retrieve the EJB primary key class
String primaryKeyType = ((EjbEntityDescriptor)descriptor).getPrimaryKeyClassName();
if (!primaryKeyType.equals("")) {
try {
Context context = getVerifierContext();
ClassLoader jcl = context.getClassLoader();
Class c = Class.forName(((EjbEntityDescriptor)descriptor).getPrimaryKeyClassName(), false, getVerifierContext().getClassLoader());
if (RmiIIOPUtils.isValidRmiIIOPValueType(c)) {
// this is the right primary key class
isLegalRMIIIOPValueType = true;
} // return valid
if (isLegalRMIIIOPValueType) {
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addGoodDetails(smh.getLocalString
(getClass().getName() + ".debug1",
"For EJB primary key class [ {0} ]",
new Object[] {primaryKeyType}));
result.addGoodDetails(smh.getLocalString
(getClass().getName() + ".passed",
"A primary key class which must be legal Value Type in RMI-IIOP was defined in the deployment descriptor."));
} else if (!isLegalRMIIIOPValueType) {
oneFailed = true;
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addErrorDetails(smh.getLocalString
(getClass().getName() + ".debug1",
"For EJB primary key class [ {0} ]",
new Object[] {primaryKeyType}));
result.addErrorDetails(smh.getLocalString
(getClass().getName() + ".failed",
"Error: A primary key class which must be legal Value Type in RMI-IIOP was not defined in the deployment descriptor."));
}
} catch (ClassNotFoundException e) {
Verifier.debug(e);
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
(getClass().getName() + ".failedException",
"Error: [ {0} ] class not found.",
new Object[] {primaryKeyType}));
oneFailed = true;
}
} else {
oneFailed = true;
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addErrorDetails(smh.getLocalString
(getClass().getName() + ".debug1",
"For EJB primary key class [ {0} ]",
new Object[] {primaryKeyType}));
result.addErrorDetails(smh.getLocalString
(getClass().getName() + ".failed1",
"Error: A primary key class was not defined in the deployment descriptor."));
}
if (oneFailed) {
result.setStatus(result.FAILED);
} else {
result.setStatus(result.PASSED);
}
return result;
} else {
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
(getClass().getName() + ".notApplicable",
"[ {0} ] expected {1} bean, but called with {2} bean.",
new Object[] {getClass(),"Entity","Session"}));
return result;
}