FileDocCategorySizeDatePackage
MappingFileNotFound.javaAPI DocGlassfish v2 API3498Fri May 04 22:34:08 BST 2007com.sun.enterprise.tools.verifier.tests.persistence

MappingFileNotFound

public class MappingFileNotFound extends com.sun.enterprise.tools.verifier.tests.VerifierTest implements com.sun.enterprise.tools.verifier.tests.VerifierCheck
Mapping files specified using element in persistence.xml should be resource-loadable from the application classpath.
author
bshankar@sun.com

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

        Result result = getInitializedResult();
        result.setStatus(Result.PASSED);
        addErrorDetails(result, getVerifierContext().getComponentNameConstructor());
        
        PersistenceUnitDescriptor pu = PersistenceUnitDescriptor.class.cast(descriptor);
        List<String> mappingFileNames = new ArrayList<String>(pu.getMappingFiles());
        for (String mappingFileName : mappingFileNames) {
            if(getVerifierContext().getClassLoader().getResource(mappingFileName) == null) {
                result.failed(smh.getLocalString(
                        getClass().getName() + "failed",
                        "Mapping file [ {0} ] specified in persistence.xml does not exist in the application.",
                        new Object[]{mappingFileName}));
            }
        }
        return result;