EjbClassExposedpublic class EjbClassExposed extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest Enterprise Java Bean class exposed test.
The class must not be exposed through remote or local interfaces. |
Fields Summary |
---|
Result | result | ComponentNameConstructor | compName |
Methods Summary |
---|
public Result | check(EjbDescriptor descriptor)Enterprise Java Bean class exposed test.
result = getInitializedResult();
compName = getVerifierContext().getComponentNameConstructor();
if (descriptor instanceof EjbSessionDescriptor ||
descriptor instanceof EjbEntityDescriptor) {
if (descriptor.getRemoteClassName() != null &&
!((descriptor.getRemoteClassName()).equals("")))
commonToBothInterfaces(descriptor.getRemoteClassName(),descriptor);
if (descriptor.getLocalClassName() != null &&
!((descriptor.getLocalClassName()).equals("")))
commonToBothInterfaces(descriptor.getLocalClassName(),descriptor);
}
if(result.getStatus() != Result.FAILED) {
addGoodDetails(result, compName);
result.passed(smh.getLocalString(
getClass().getName() + ".passed",
"Ejb Bean Class [{0}] is valid.",
new Object[] {descriptor.getEjbClassName()}));
}
return result;
| private void | commonToBothInterfaces(java.lang.String remote, EjbDescriptor descriptor)This method is responsible for the logic of the test. It is called for
both local and remote interfaces.
try {
Class c = Class.forName(remote,
false,
getVerifierContext().getClassLoader());
for (Method method : c.getDeclaredMethods()) {
String ejbClassName = descriptor.getEjbClassName();
if(((method.getReturnType()).getName()).equals(ejbClassName)) {
addErrorDetails(result, compName);
result.failed(smh.getLocalString(
getClass().getName() + ".failed",
"Error: Ejb Bean Class [{0}] is exposed through interface [{1}]",
new Object[] {ejbClassName, remote}));
}
}
}catch (ClassNotFoundException e) {
addErrorDetails(result, compName);
result.failed(smh.getLocalString(
getClass().getName() + ".failedException",
"Error: interface class [{0}] not found",
new Object[] {remote}));
}
|
|