Search in sources :

Example 96 with EjbEntityDescriptor

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;
}
Also used : EjbEntityDescriptor(org.glassfish.ejb.deployment.descriptor.EjbEntityDescriptor) EjbSessionDescriptor(org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor)

Example 97 with EjbEntityDescriptor

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;
}
Also used : EjbEntityDescriptor(org.glassfish.ejb.deployment.descriptor.EjbEntityDescriptor) Collection(java.util.Collection) EjbSessionDescriptor(org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor) MethodPermission(com.sun.enterprise.deployment.MethodPermission)

Example 98 with EjbEntityDescriptor

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;
}
Also used : EjbEntityDescriptor(org.glassfish.ejb.deployment.descriptor.EjbEntityDescriptor) EjbSessionDescriptor(org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor)

Example 99 with EjbEntityDescriptor

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;
}
Also used : EjbEntityDescriptor(org.glassfish.ejb.deployment.descriptor.EjbEntityDescriptor) ComponentNameConstructor(com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor) Result(com.sun.enterprise.tools.verifier.Result)

Example 100 with EjbEntityDescriptor

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);
}
Also used : EjbEntityDescriptor(org.glassfish.ejb.deployment.descriptor.EjbEntityDescriptor)

Aggregations

EjbEntityDescriptor (org.glassfish.ejb.deployment.descriptor.EjbEntityDescriptor)101 Result (com.sun.enterprise.tools.verifier.Result)88 ComponentNameConstructor (com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor)87 VerifierTestContext (com.sun.enterprise.tools.verifier.VerifierTestContext)49 Method (java.lang.reflect.Method)42 EjbSessionDescriptor (org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor)18 EjbCMPEntityDescriptor (org.glassfish.ejb.deployment.descriptor.EjbCMPEntityDescriptor)15 EjbSessionDescriptor (com.sun.enterprise.deployment.EjbSessionDescriptor)12 Iterator (java.util.Iterator)12 Field (java.lang.reflect.Field)10 FieldDescriptor (org.glassfish.ejb.deployment.descriptor.FieldDescriptor)9 Set (java.util.Set)8 MethodDescriptor (com.sun.enterprise.deployment.MethodDescriptor)7 EjbDescriptor (org.glassfish.ejb.deployment.descriptor.EjbDescriptor)7 Vector (java.util.Vector)5 Descriptor (org.glassfish.deployment.common.Descriptor)3 ContainerTransaction (org.glassfish.ejb.deployment.descriptor.ContainerTransaction)3 EjbBundleDescriptorImpl (org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl)3 IASEjbExtraDescriptors (org.glassfish.ejb.deployment.descriptor.runtime.IASEjbExtraDescriptors)3 EjbMessageBeanDescriptor (com.sun.enterprise.deployment.EjbMessageBeanDescriptor)2