Package com.sun.enterprise.deployment

Examples of com.sun.enterprise.deployment.PersistenceUnitDescriptor


    }

    // This method is called when parser has parsed one <persistence-unit>
    @Override
    public void addDescriptor(Object descriptor) {
        final PersistenceUnitDescriptor pud = PersistenceUnitDescriptor.class.cast(descriptor);
        getDescriptor().addPersistenceUnitDescriptor(pud);
    }
View Full Code Here


            assert(attributes.getLength() == 2);
            assert(attributes.getIndex(PersistenceTagNames.PROPERTY_NAME) !=
                    -1);
            assert(attributes.getIndex(PersistenceTagNames.PROPERTY_VALUE) !=
                    -1);
            PersistenceUnitDescriptor persistenceUnitDescriptor = (PersistenceUnitDescriptor) getDescriptor();
            String propName = attributes.getValue(
                    PersistenceTagNames.PROPERTY_NAME);
            String propValue = attributes.getValue(
                    PersistenceTagNames.PROPERTY_VALUE);
            persistenceUnitDescriptor.addProperty(propName, propValue);
            return;
        }
        super.startElement(element, attributes);
    }
View Full Code Here

        this.frameworkContext = frameworkContext;
        this.context = context;
    }

    @Override protected void check(Descriptor descriptor) throws Exception {
        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();
View Full Code Here

* @author Sanjeeb.Sahoo@Sun.COM
*/
public class DefaultProviderVerification extends VerifierTest
        implements VerifierCheck {
    public Result check(Descriptor descriptor) {
        PersistenceUnitDescriptor pu =
                PersistenceUnitDescriptor.class.cast(descriptor);
        Result result = getInitializedResult();
        result.setStatus(Result.PASSED);
        PersistenceProvider provider;
        final String appLocation =
                getVerifierContext().getAbstractArchive().getArchiveUri();
        final InstrumentableClassLoader cl =
                InstrumentableClassLoader.class.cast(pu.getClassLoader());
        PersistenceUnitInfo pi = new AVKPersistenceUnitInfoImpl(pu, appLocation, cl);
        logger.fine("PersistenceInfo for PU is :\n" + pi);
        Properties props = new Properties();
        // This property is set to indicate that TopLink should only
        // validate the descriptors etc. and not try to login to database.
View Full Code Here

public class ClassNotFound extends VerifierTest implements VerifierCheck {
    public Result check(Descriptor descriptor) {
        Result result = getInitializedResult();
        addErrorDetails(result, getVerifierContext().getComponentNameConstructor());
        result.setStatus(Result.PASSED);
        final PersistenceUnitDescriptor pu = PersistenceUnitDescriptor.class.cast(descriptor);
        for(String className : pu.getClasses()) {
            try {
                Class.forName(className, false, getVerifierContext().getClassLoader());
            } catch (ClassNotFoundException e) {
                result.failed(smh.getLocalString(getClass().getName() + "failed1",
                        "Class [ {0} ] could not be loaded", new Object[]{className}));
View Full Code Here

*
* @author Sanjeeb.Sahoo@Sun.COM
*/
public class DuplicatePUNameTest extends VerifierTest implements VerifierCheck {
    public Result check(Descriptor descriptor) {
        PersistenceUnitDescriptor pu = PersistenceUnitDescriptor.class.cast(
                descriptor);
        Result result = getInitializedResult();
        addErrorDetails(result, getVerifierContext().getComponentNameConstructor());
        result.setStatus(Result.PASSED); // default status is PASSED
        int count = 0;
        for(PersistenceUnitDescriptor nextPU : getPUsInSameScope(pu)) {
            result.addErrorDetails(smh.getLocalString(getClass().getName() + "puName",
                    "Found a persistence unit by name [ {0} ] in persistence unit root [ {1} ]",
                    new Object[]{nextPU.getName(), nextPU.getPuRoot()}));
                    if (nextPU.getName().equals(pu.getName())) count++;
        }
        if (count != 1) {
            result.failed(smh.getLocalString(getClass().getName() + "failed",
                    "There are [ {0} ] number of persistence units by name [ {1} ]",
                    new Object[]{count, pu.getName()}));
        }
        return result;
    }
View Full Code Here

    public Result check(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.",
View Full Code Here

    public Result check(Descriptor descriptor) {
        Result result = getInitializedResult();
        result.setStatus(Result.PASSED);
        addErrorDetails(result,
                getVerifierContext().getComponentNameConstructor());
        PersistenceUnitDescriptor pu = PersistenceUnitDescriptor.class.cast(
                descriptor);
        File absolutePURootFile = getAbsolutePuRootFile(pu);
        logger.fine("Absolute PU Root: " + absolutePURootFile);
        String absolutePuRoot = absolutePURootFile.getAbsolutePath();
        List<String> jarFileNames = new ArrayList<String>(pu.getJarFiles());
        for (String jarFileName : jarFileNames) {
            // ASSUMPTION:
            // Because of the way deployment changes names of directories etc.
            // it is very difficult to back calculate path names. So,
            // the following code assumes user is specifying valid URIs.
View Full Code Here

            }
        }
       
        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;
    }
View Full Code Here

* @author Sanjeeb.Sahoo@Sun.COM
*/
public class DefaultProviderVerification extends VerifierTest
        implements VerifierCheck {
    public Result check(Descriptor descriptor) {
        PersistenceUnitDescriptor pu =
                PersistenceUnitDescriptor.class.cast(descriptor);
        Result result = getInitializedResult();
        result.setStatus(Result.PASSED);
        PersistenceProvider provider;
        final String appLocation =
                getVerifierContext().getAbstractArchive().getURI().getPath();
        final InstrumentableClassLoader cl =
                InstrumentableClassLoader.class.cast(pu.getParent().getClassLoader());
        PersistenceUnitInfo pi = new AVKPersistenceUnitInfoImpl(pu, appLocation, cl);
        logger.fine("PersistenceInfo for PU is :\n" + pi);
        Properties props = new Properties();
        // This property is set to indicate that TopLink should only
        // validate the descriptors etc. and not try to login to database.
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.PersistenceUnitDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.