FileDocCategorySizeDatePackage
PersistenceUnitCheckMgrImpl.javaAPI DocGlassfish v2 API6224Fri May 04 22:33:26 BST 2007com.sun.enterprise.tools.verifier.persistence

PersistenceUnitCheckMgrImpl

public class PersistenceUnitCheckMgrImpl extends CheckMgr
This class is responsible for checking a PU represented by a {@link PersistenceUnitDescriptor}
author
Sanjeeb.Sahoo@Sun.COM

Fields Summary
private String
moduleName
private com.sun.enterprise.util.LocalStringManagerImpl
smh
Constructors Summary
public PersistenceUnitCheckMgrImpl(FrameworkContext frameworkContext, Context context)

    

     
                
        this.frameworkContext = frameworkContext;
        this.context = context;
    
Methods Summary
protected voidcheck(com.sun.enterprise.deployment.Descriptor descriptor)

        PersistenceUnitDescriptor pu =
                PersistenceUnitDescriptor.class.cast(descriptor);
        RootDeploymentDescriptor rootDD = pu.getParent().getParent();
        if(rootDD.isApplication()) {
            moduleName = Result.APP;
        } else {
            ModuleDescriptor mdesc =
                    BundleDescriptor.class.cast(rootDD).getModuleDescriptor();
            final ModuleType moduleType = mdesc.getModuleType();
            if(moduleType == ModuleType.EJB) {
                moduleName = Result.EJB;
            } else if (moduleType == ModuleType.WAR) {
                moduleName = Result.WEB;
            } else if (moduleType == ModuleType.CAR) {
                moduleName = Result.APPCLIENT;
            } else {
                throw new RuntimeException(
                        smh.getLocalString(getClass().getName()+".exception", // NOI18N
                                "Unknown module type : {0}", // NOI18N
                                new Object[] {moduleType}));
            }
        }
        super.check(descriptor);
    
protected java.lang.StringgetAbstractArchiveUri(com.sun.enterprise.deployment.Descriptor descriptor)
This method returns the path to the module.

param
descriptor is a PersistenceUnitDescriptor
return
the path to the module

        String archBase = context.getAbstractArchive().getArchiveUri();
        RootDeploymentDescriptor rootDD =
                PersistenceUnitDescriptor.class.cast(descriptor).getParent().getParent();
        if(rootDD.isApplication()) {
            return archBase;
        } else {
            ModuleDescriptor mdesc =
                    BundleDescriptor.class.cast(rootDD).getModuleDescriptor();
            if(mdesc.isStandalone()) {
                return archBase;
            } else {
                return archBase + File.separator +
                        FileUtils.makeFriendlyFileName(mdesc.getArchiveUri());
            }
        }
    
protected com.sun.enterprise.tools.verifier.tests.ComponentNameConstructorgetComponentNameConstructor(com.sun.enterprise.deployment.Descriptor descriptor)

        return new ComponentNameConstructor(
                PersistenceUnitDescriptor.class.cast(descriptor));
    
protected java.lang.StringgetSchemaVersion(com.sun.enterprise.deployment.Descriptor descriptor)

        // A PU inherits its schema version from its parent.
        return PersistenceUnitDescriptor.class.cast(descriptor).getParent().
                getSpecVersion();
    
protected java.lang.StringgetSunONETestsListFileName()

        return null;
    
protected java.lang.StringgetTestsListFileName()

        return "TestNamesPersistence.xml"; // NOI18N
    
protected voidsetModuleName(Result r)

        r.setModuleName(moduleName);
    
protected voidsetRuntimeDDPresent(java.lang.String uri)
We override here because there is nothing like sun-persistence.xml.

param
uri

        isDDPresent = false;