FileDocCategorySizeDatePackage
PUTransactionType.javaAPI DocGlassfish v2 API4793Fri May 04 22:33:28 BST 2007com.sun.enterprise.tools.verifier.tests.appclient

PUTransactionType

public class PUTransactionType extends com.sun.enterprise.tools.verifier.tests.VerifierTest implements com.sun.enterprise.tools.verifier.tests.VerifierCheck
Assertions : 1) A persistence unit with JTA transaction type is not supported in application client. 2) Reference to a PU whose transaction type is JTA is not supported in application client.
author
bshankar@sun.com

Fields Summary
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(com.sun.enterprise.deployment.Descriptor descriptor)

        ApplicationClientDescriptor appClient = (ApplicationClientDescriptor) descriptor;
        Result result = getInitializedResult();
        addErrorDetails(result, getVerifierContext().getComponentNameConstructor());
        result.setStatus(Result.PASSED); // default status is PASSED
        
        for(PersistenceUnitsDescriptor pus : appClient.getPersistenceUnitsDescriptors()) {
            for(PersistenceUnitDescriptor nextPU : pus.getPersistenceUnitDescriptors()) {
                if("JTA".equals(nextPU.getTransactionType())) {
                    result.failed(smh.getLocalString(getClass().getName() + ".puName",
                            "Found a persistence unit by name [ {0} ] in persistence unit root [ {1} ] with JTA transaction type.",
                            new Object[]{nextPU.getName(), nextPU.getPuRoot()}));
                }
            }
        }
        
        for(EntityManagerFactoryReferenceDescriptor emfRef : appClient.getEntityManagerFactoryReferenceDescriptors()) {
            String unitName = emfRef.getUnitName();
            PersistenceUnitDescriptor nextPU = appClient.findReferencedPU(unitName);
            if(nextPU == null) continue;
            if("JTA".equals(nextPU.getTransactionType())) {
                result.failed(smh.getLocalString(getClass().getName() + ".puRefName",
                        "Found a reference to a persistence unit by name [ {0} ] in persistence unit root [ {1} ] with JTA transaction type.",
                        new Object[]{nextPU.getName(), nextPU.getPuRoot()}));
            }
        }
        
        return result;