For an entity-bean the abstract-schema-name must be a valid Java identifier.
See ejb specification 2.1 section 10.3.13
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
String abstractSchema = null;
if(descriptor instanceof EjbEntityDescriptor) {
if (((EjbEntityDescriptor)descriptor).getPersistenceType().equals(EjbEntityDescriptor.CONTAINER_PERSISTENCE)) {
if (((EjbCMPEntityDescriptor) descriptor).getCMPVersion()==EjbCMPEntityDescriptor.CMP_2_x) {
abstractSchema = ((EjbCMPEntityDescriptor)descriptor).getAbstractSchemaName();
if(abstractSchema!=null) {
boolean isJavaIdentifier=true;
boolean startChar=Character.isJavaIdentifierStart(abstractSchema.charAt(0));
if (startChar) {
for(int i=1;i<abstractSchema.length();i++)
if(!Character.isJavaIdentifierPart(abstractSchema.charAt(i))) {
isJavaIdentifier=false;
break;
}
} else {
isJavaIdentifier=false;
}
if(isJavaIdentifier) {
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.passed(smh.getLocalString
(getClass().getName() + ".passed",
"abstract-schema-name [ {0} ] within bean [ {1} ] is a valid java identifier",
new Object[] {abstractSchema, descriptor.getName()}));
}else{
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
(getClass().getName() + ".failed",
"abstract-schema-name [ {0} ] within bean [ {1} ] is not a valid java identifier",
new Object[] {abstractSchema, descriptor.getName()}));
}
}
}
}
}
if(abstractSchema==null){
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
(getClass().getName() + ".notApplicable",
"abstract-schema-name is not defined or this is not applicable for this bean"));
}
return result;