use of org.glassfish.ejb.deployment.descriptor.EjbEntityDescriptor in project Payara by payara.
the class ExcludeListMethodsExist method check.
/**
* Methods used in exclude-list element of the deployment descriptor
* must be methods defined in the enterprise bean's remote and/or home
* interface.
*
* @param descriptor the Enterprise Java Bean deployment descriptor
* @return <code>Result</code> the results for this assertion
*/
public Result check(EjbDescriptor descriptor) {
result = getInitializedResult();
compName = getVerifierContext().getComponentNameConstructor();
if ((descriptor instanceof EjbSessionDescriptor) || (descriptor instanceof EjbEntityDescriptor)) {
Set<MethodDescriptor> permissionedMethods = descriptor.getExcludedMethodDescriptors();
if (permissionedMethods != null && permissionedMethods.size() > 0) {
for (MethodDescriptor methodDescriptor : permissionedMethods) checkMethodStyles(methodDescriptor, descriptor);
}
}
if (result.getStatus() != Result.FAILED) {
addGoodDetails(result, compName);
result.passed(smh.getLocalString(getClass().getName() + ".passed", "Valid exclude list method(s) found."));
}
return result;
}
use of org.glassfish.ejb.deployment.descriptor.EjbEntityDescriptor in project Payara by payara.
the class MethodPermissionMethodExists method check.
/**
* Methods used in method permission element of the deployment descriptor
* must be methods defined in the enterprise bean's remote and/or home
* interface.
*
* @param descriptor the Enterprise Java Bean deployment descriptor
* @return <code>Result</code> the results for this assertion
*/
public Result check(EjbDescriptor descriptor) {
result = getInitializedResult();
compName = getVerifierContext().getComponentNameConstructor();
if ((descriptor instanceof EjbSessionDescriptor) || (descriptor instanceof EjbEntityDescriptor)) {
Map<MethodPermission, Collection<MethodDescriptor>> permissionedMethods = descriptor.getMethodPermissionsFromDD();
if (permissionedMethods != null) {
for (MethodPermission methodPermission : permissionedMethods.keySet()) for (MethodDescriptor methodDescriptor : permissionedMethods.get(methodPermission)) checkMethodStyles(methodDescriptor, descriptor);
}
}
if (result.getStatus() != Result.FAILED) {
addGoodDetails(result, compName);
result.passed(smh.getLocalString(getClass().getName() + ".passed", "Valid method permission method(s) found."));
}
return result;
}
use of org.glassfish.ejb.deployment.descriptor.EjbEntityDescriptor in project Payara by payara.
the class UncheckedMethodsExist method check.
/**
* Methods used in unchecked element of the deployment descriptor
* must be methods defined in the enterprise bean's component and/or home
* interface.
*
* @param descriptor the Enterprise Java Bean deployment descriptor
* @return <code>Result</code> the results for this assertion
*/
public Result check(EjbDescriptor descriptor) {
result = getInitializedResult();
compName = getVerifierContext().getComponentNameConstructor();
if ((descriptor instanceof EjbSessionDescriptor) || (descriptor instanceof EjbEntityDescriptor)) {
Set<MethodDescriptor> permissionedMethods = descriptor.getUncheckedMethodDescriptors();
if (permissionedMethods != null && permissionedMethods.size() > 0) {
for (MethodDescriptor methodDescriptor : permissionedMethods) checkMethodStyles(methodDescriptor, descriptor);
}
}
if (result.getStatus() != Result.FAILED) {
addGoodDetails(result, compName);
result.passed(smh.getLocalString(getClass().getName() + ".passed", "Valid unchecked method(s) found."));
}
return result;
}
use of org.glassfish.ejb.deployment.descriptor.EjbEntityDescriptor in project Payara by payara.
the class AbstractSchemaNameIsValidJavaIdentifier method check.
/**
* For an entity-bean the abstract-schema-name must be a valid Java identifier.
* See ejb specification 2.1 section 10.3.13
* @param descriptor the Enterprise Java Bean deployment descriptor
* @return <code>Result</code> the results for this assertion
*/
public Result check(EjbDescriptor descriptor) {
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;
}
use of org.glassfish.ejb.deployment.descriptor.EjbEntityDescriptor in project Payara by payara.
the class ActiveTxCache method preInitialize.
@Override
protected void preInitialize(EjbDescriptor desc, ClassLoader loader) {
EjbEntityDescriptor ed = (EjbEntityDescriptor) desc;
isReentrant = ed.isReentrant();
if (ed.getPersistenceType().equals(EjbEntityDescriptor.BEAN_PERSISTENCE)) {
isContainerManagedPers = false;
} else {
isContainerManagedPers = true;
}
_logger.log(Level.FINE, "[EntityContainer] preInitialize==>isContainerManagedPers: " + isContainerManagedPers);
}
Aggregations