Search in sources :

Example 1 with ParseDD

use of com.sun.enterprise.tools.verifier.tests.dd.ParseDD in project Payara by payara.

the class AppClientCheckMgrImpl method check.

/**
 * Check method introduced for WebServices integration
 *
 * @param descriptor appclient descriptor
 */
public void check(Descriptor descriptor) throws Exception {
    // run persistence tests first.
    checkPersistenceUnits(ApplicationClientDescriptor.class.cast(descriptor));
    // An ApplicationClient can have WebService References
    checkWebServicesClient(descriptor);
    if (verifierFrameworkContext.isPartition() && !verifierFrameworkContext.isAppClient())
        return;
    // run the ParseDD test
    if (getSchemaVersion(descriptor).compareTo("1.4") < 0) {
        // NOI18N
        AppClientDeploymentDescriptorFile ddf = new AppClientDeploymentDescriptorFile();
        File file = new File(getAbstractArchiveUri(descriptor), ddf.getDeploymentDescriptorPath());
        FileInputStream is = new FileInputStream(file);
        try {
            if (is != null) {
                Result result = new ParseDD().validateAppClientDescriptor(is);
                result.setComponentName(getArchiveUri(descriptor));
                setModuleName(result);
                verifierFrameworkContext.getResultManager().add(result);
            }
        } finally {
            try {
                if (is != null)
                    is.close();
            } catch (Exception e) {
            }
        }
    }
    super.check(descriptor);
}
Also used : ParseDD(com.sun.enterprise.tools.verifier.tests.dd.ParseDD) ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor) AppClientDeploymentDescriptorFile(com.sun.enterprise.deployment.io.AppClientDeploymentDescriptorFile) AppClientDeploymentDescriptorFile(com.sun.enterprise.deployment.io.AppClientDeploymentDescriptorFile) File(java.io.File) FileInputStream(java.io.FileInputStream) Result(com.sun.enterprise.tools.verifier.Result)

Example 2 with ParseDD

use of com.sun.enterprise.tools.verifier.tests.dd.ParseDD in project Payara by payara.

the class ConnectorCheckMgrImpl method check.

public void check(Descriptor descriptor) throws Exception {
    // run the ParseDD test
    if (getSchemaVersion(descriptor).compareTo("1.5") < 0) {
        // NOI18N
        ConnectorDeploymentDescriptorFile ddf = new ConnectorDeploymentDescriptorFile();
        File file = new File(new File(URI.create(getAbstractArchiveUri(descriptor))), ddf.getDeploymentDescriptorPath());
        FileInputStream is = new FileInputStream(file);
        try {
            if (is != null) {
                Result result = new ParseDD().validateConnectorDescriptor(is);
                result.setComponentName(getArchiveUri(descriptor));
                setModuleName(result);
                verifierFrameworkContext.getResultManager().add(result);
            }
        } finally {
            try {
                if (is != null)
                    is.close();
            } catch (Exception e) {
            }
        }
    }
    super.check(descriptor);
}
Also used : ConnectorDeploymentDescriptorFile(com.sun.enterprise.deployment.io.ConnectorDeploymentDescriptorFile) ParseDD(com.sun.enterprise.tools.verifier.tests.dd.ParseDD) File(java.io.File) ConnectorDeploymentDescriptorFile(com.sun.enterprise.deployment.io.ConnectorDeploymentDescriptorFile) FileInputStream(java.io.FileInputStream) Result(com.sun.enterprise.tools.verifier.Result)

Example 3 with ParseDD

use of com.sun.enterprise.tools.verifier.tests.dd.ParseDD in project Payara by payara.

the class WebCheckMgrImpl method check.

/**
 * Check method introduced for WebServices integration
 *
 * @param descriptor Web descriptor
 */
public void check(Descriptor descriptor) throws Exception {
    // run persistence tests first.
    checkPersistenceUnits(WebBundleDescriptor.class.cast(descriptor));
    // a WebBundleDescriptor can have an WebServicesDescriptor
    checkWebServices(descriptor);
    // a WebBundleDescriptor can have  WebService References
    checkWebServicesClient(descriptor);
    if (verifierFrameworkContext.isPartition() && !verifierFrameworkContext.isWeb())
        return;
    // create document obj for all tld's defined in the war
    createTaglibDescriptors(descriptor);
    createFacesConfigDescriptor(descriptor);
    // run the ParseDD test
    if (getSchemaVersion(descriptor).compareTo("2.4") < 0) {
        // NOI18N
        WebDeploymentDescriptorFile ddf = new WebDeploymentDescriptorFile();
        File file = new File(getAbstractArchiveUri(descriptor), ddf.getDeploymentDescriptorPath());
        FileInputStream is = new FileInputStream(file);
        try {
            if (is != null) {
                Result result = new ParseDD().validateWebDescriptor(is);
                result.setComponentName(getArchiveUri(descriptor));
                setModuleName(result);
                verifierFrameworkContext.getResultManager().add(result);
                is.close();
            }
        } finally {
            try {
                if (is != null)
                    is.close();
            } catch (Exception e) {
            }
        }
    }
    super.check(descriptor);
}
Also used : WebDeploymentDescriptorFile(org.glassfish.web.deployment.io.WebDeploymentDescriptorFile) ParseDD(com.sun.enterprise.tools.verifier.tests.dd.ParseDD) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) File(java.io.File) WebDeploymentDescriptorFile(org.glassfish.web.deployment.io.WebDeploymentDescriptorFile) FileInputStream(java.io.FileInputStream) IOException(java.io.IOException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) SAXException(org.xml.sax.SAXException)

Example 4 with ParseDD

use of com.sun.enterprise.tools.verifier.tests.dd.ParseDD in project Payara by payara.

the class EjbCheckMgrImpl method check.

/**
 * Check Ejb for spec. conformance
 *
 * @param descriptor Ejb descriptor
 */
public void check(Descriptor descriptor) throws Exception {
    // run persistence tests first.
    checkPersistenceUnits(EjbBundleDescriptorImpl.class.cast(descriptor));
    // an EjbBundleDescriptor can have an WebServicesDescriptor
    checkWebServices(descriptor);
    // an EjbBundleDescriptor can have  WebService References
    checkWebServicesClient(descriptor);
    if (verifierFrameworkContext.isPartition() && !verifierFrameworkContext.isEjb())
        return;
    EjbBundleDescriptorImpl bundleDescriptor = (EjbBundleDescriptorImpl) descriptor;
    setDescClassLoader(bundleDescriptor);
    // an ejb-ref is unresolved etc.
    try {
        EjbBundleValidator validator = new EjbBundleValidator();
        validator.accept(bundleDescriptor);
    } catch (Exception e) {
    }
    // initialize JDOC if bundle has CMP's
    if (bundleDescriptor.containsCMPEntity()) {
        try {
            // See bug #6274161. We now pass an additional boolean
            // to indicate whether we are in portable or AS mode.
            jdc.init(bundleDescriptor, context.getClassLoader(), getAbstractArchiveUri(bundleDescriptor), verifierFrameworkContext.isPortabilityMode());
        } catch (Throwable ex) {
            context.setJDOException(ex);
        }
    }
    // set the JDO Codegenerator into the context
    context.setJDOCodeGenerator(jdc);
    // run the ParseDD test
    if (bundleDescriptor.getSpecVersion().compareTo("2.1") < 0) {
        // NOI18N
        EjbDeploymentDescriptorFile ddf = new EjbDeploymentDescriptorFile();
        File file = new File(getAbstractArchiveUri(bundleDescriptor), ddf.getDeploymentDescriptorPath());
        FileInputStream is = new FileInputStream(file);
        try {
            if (is != null) {
                Result result = new ParseDD().validateEJBDescriptor(is);
                result.setComponentName(new File(bundleDescriptor.getModuleDescriptor().getArchiveUri()).getName());
                setModuleName(result);
                verifierFrameworkContext.getResultManager().add(result);
            }
        } finally {
            try {
                if (is != null) {
                    is.close();
                }
            } catch (Exception e) {
            }
        }
    }
    for (Iterator itr = bundleDescriptor.getEjbs().iterator(); itr.hasNext(); ) {
        EjbDescriptor ejbDescriptor = (EjbDescriptor) itr.next();
        super.check(ejbDescriptor);
    }
    if (bundleDescriptor.containsCMPEntity() && context.getJDOException() == null) {
        jdc.cleanup();
        context.setJDOCodeGenerator(null);
    }
}
Also used : EjbDeploymentDescriptorFile(org.glassfish.ejb.deployment.io.EjbDeploymentDescriptorFile) ParseDD(com.sun.enterprise.tools.verifier.tests.dd.ParseDD) Iterator(java.util.Iterator) EjbBundleValidator(org.glassfish.ejb.deployment.util.EjbBundleValidator) EjbDeploymentDescriptorFile(org.glassfish.ejb.deployment.io.EjbDeploymentDescriptorFile) File(java.io.File) FileInputStream(java.io.FileInputStream) EjbDescriptor(org.glassfish.ejb.deployment.descriptor.EjbDescriptor) EjbBundleDescriptorImpl(org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl) Result(com.sun.enterprise.tools.verifier.Result)

Aggregations

ParseDD (com.sun.enterprise.tools.verifier.tests.dd.ParseDD)4 File (java.io.File)4 FileInputStream (java.io.FileInputStream)4 Result (com.sun.enterprise.tools.verifier.Result)3 ApplicationClientDescriptor (com.sun.enterprise.deployment.ApplicationClientDescriptor)1 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)1 AppClientDeploymentDescriptorFile (com.sun.enterprise.deployment.io.AppClientDeploymentDescriptorFile)1 ConnectorDeploymentDescriptorFile (com.sun.enterprise.deployment.io.ConnectorDeploymentDescriptorFile)1 IOException (java.io.IOException)1 Iterator (java.util.Iterator)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 EjbBundleDescriptorImpl (org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl)1 EjbDescriptor (org.glassfish.ejb.deployment.descriptor.EjbDescriptor)1 EjbDeploymentDescriptorFile (org.glassfish.ejb.deployment.io.EjbDeploymentDescriptorFile)1 EjbBundleValidator (org.glassfish.ejb.deployment.util.EjbBundleValidator)1 WebDeploymentDescriptorFile (org.glassfish.web.deployment.io.WebDeploymentDescriptorFile)1 SAXException (org.xml.sax.SAXException)1