Search in sources :

Example 11 with ApplicationClientDescriptor

use of com.sun.enterprise.deployment.ApplicationClientDescriptor in project Payara by payara.

the class ACCPersistenceArchivist method open.

@Override
public Object open(Archivist main, ReadableArchive archive, RootDeploymentDescriptor descriptor) throws IOException, SAXParseException {
    if (deplLogger.isLoggable(Level.FINE)) {
        deplLogger.logp(Level.FINE, "ACCPersistencerArchivist", "readPersistenceDeploymentDescriptors", "archive = {0}", archive.getURI());
    }
    final Map<String, ReadableArchive> candidatePersistenceArchives = new HashMap<String, ReadableArchive>();
    /*
         * The descriptor had better be an ApplicationClientDescriptor!
         */
    if (!(descriptor instanceof ApplicationClientDescriptor)) {
        return null;
    }
    final ApplicationClientDescriptor acDescr = ApplicationClientDescriptor.class.cast(descriptor);
    try {
        final Manifest mf = archive.getManifest();
        final Attributes mainAttrs = mf.getMainAttributes();
        /*
             * We must scan the app client archive itself.  
             */
        URI clientURI = clientURI(archive, acDescr);
        candidatePersistenceArchives.put(clientURI.toASCIIString(), archive);
        /*
             * If this app client 
             * was deployed as part of an EAR then scan any library JARs and, if the
             * client was also deployed or launched in v2-compatibility mode, any
             * top-level JARs in the EAR.
             * 
             * Exactly how we do this depends on whether this is a deployed client
             * (which will reside in a client download directory) or a non-deployed
             * one (which will reside either as a stand-alone client or within an
             * EAR).
             */
        if (isDeployed(mainAttrs)) {
            if (!isDeployedClientAlsoStandAlone(mainAttrs)) {
                addOtherDeployedScanTargets(archive, mainAttrs, candidatePersistenceArchives);
            }
        } else if (!isStandAlone(acDescr)) {
            addOtherNondeployedScanTargets(archive, acDescr, candidatePersistenceArchives);
        }
        for (Map.Entry<String, ReadableArchive> pathToArchiveEntry : candidatePersistenceArchives.entrySet()) {
            readPersistenceDeploymentDescriptor(main, pathToArchiveEntry.getValue(), pathToArchiveEntry.getKey(), descriptor);
        }
    } finally {
        for (Map.Entry<String, ReadableArchive> pathToArchiveEntry : candidatePersistenceArchives.entrySet()) {
        // pathToArchiveEntry.getValue().close();
        }
    }
    return null;
}
Also used : HashMap(java.util.HashMap) Attributes(java.util.jar.Attributes) ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor) ReadableArchive(org.glassfish.api.deployment.archive.ReadableArchive) MultiReadableArchive(com.sun.enterprise.deployment.deploy.shared.MultiReadableArchive) Manifest(java.util.jar.Manifest) URI(java.net.URI) HashMap(java.util.HashMap) Map(java.util.Map)

Example 12 with ApplicationClientDescriptor

use of com.sun.enterprise.deployment.ApplicationClientDescriptor in project Payara by payara.

the class JavaWebStartAccessNode method getDescriptor.

// public JavaWebStartAccessNode(XMLElement element) {
// register();
// setXMLRootTag(element);
// }
/**
 * @return the descriptor instance to associate with this XMLNode
 */
@Override
public JavaWebStartAccessDescriptor getDescriptor() {
    if (descriptor == null) {
        descriptor = new JavaWebStartAccessDescriptor();
        XMLNode parentNode = getParentNode();
        if (parentNode != null && (parentNode instanceof AppClientRuntimeNode)) {
            Object parentDescriptor = parentNode.getDescriptor();
            if (parentDescriptor != null && (parentDescriptor instanceof ApplicationClientDescriptor)) {
                ApplicationClientDescriptor acDescriptor = (ApplicationClientDescriptor) parentDescriptor;
                acDescriptor.setJavaWebStartAccessDescriptor(descriptor);
            }
        }
    }
    return descriptor;
}
Also used : XMLNode(com.sun.enterprise.deployment.node.XMLNode) ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor) JavaWebStartAccessDescriptor(com.sun.enterprise.deployment.runtime.JavaWebStartAccessDescriptor)

Example 13 with ApplicationClientDescriptor

use of com.sun.enterprise.deployment.ApplicationClientDescriptor in project Payara by payara.

the class Verifier method verifyArchive.

private void verifyArchive() {
    if (!getApplication().isVirtual()) {
        // don't run app tests for standalone module
        runVerifier(new ApplicationVerifier(verifierFrameworkContext));
    }
    for (Iterator itr = getApplication().getBundleDescriptors(EjbBundleDescriptor.class).iterator(); itr.hasNext(); ) {
        EjbBundleDescriptor ejbd = (EjbBundleDescriptor) itr.next();
        runVerifier(new EjbVerifier(verifierFrameworkContext, ejbd));
    }
    for (Iterator itr = getApplication().getBundleDescriptors(WebBundleDescriptor.class).iterator(); itr.hasNext(); ) {
        WebBundleDescriptor webd = (WebBundleDescriptor) itr.next();
        runVerifier(new WebVerifier(verifierFrameworkContext, webd));
    }
    for (Iterator itr = getApplication().getBundleDescriptors(ApplicationClientDescriptor.class).iterator(); itr.hasNext(); ) {
        ApplicationClientDescriptor appClientDescriptor = (ApplicationClientDescriptor) itr.next();
        runVerifier(new AppClientVerifier(verifierFrameworkContext, appClientDescriptor));
    }
    for (Iterator itr = getApplication().getBundleDescriptors(ConnectorDescriptor.class).iterator(); itr.hasNext(); ) {
        ConnectorDescriptor cond = (ConnectorDescriptor) itr.next();
        runVerifier(new ConnectorVerifier(verifierFrameworkContext, cond));
    }
}
Also used : ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor) AppClientVerifier(com.sun.enterprise.tools.verifier.appclient.AppClientVerifier) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) WebVerifier(com.sun.enterprise.tools.verifier.web.WebVerifier) ApplicationVerifier(com.sun.enterprise.tools.verifier.app.ApplicationVerifier) Iterator(java.util.Iterator) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) EjbVerifier(com.sun.enterprise.tools.verifier.ejb.EjbVerifier) ConnectorVerifier(com.sun.enterprise.tools.verifier.connector.ConnectorVerifier) ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor)

Example 14 with ApplicationClientDescriptor

use of com.sun.enterprise.deployment.ApplicationClientDescriptor in project Payara by payara.

the class PUTransactionType method check.

public Result check(Descriptor descriptor) {
    ApplicationClientDescriptor appClient = (ApplicationClientDescriptor) descriptor;
    Result result = getInitializedResult();
    addErrorDetails(result, getVerifierContext().getComponentNameConstructor());
    // default status is PASSED
    result.setStatus(Result.PASSED);
    for (PersistenceUnitsDescriptor pus : appClient.getExtensionsDescriptors(PersistenceUnitsDescriptor.class)) {
        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;
}
Also used : ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor) PersistenceUnitsDescriptor(com.sun.enterprise.deployment.PersistenceUnitsDescriptor) EntityManagerFactoryReferenceDescriptor(com.sun.enterprise.deployment.EntityManagerFactoryReferenceDescriptor) Result(com.sun.enterprise.tools.verifier.Result) PersistenceUnitDescriptor(com.sun.enterprise.deployment.PersistenceUnitDescriptor)

Example 15 with ApplicationClientDescriptor

use of com.sun.enterprise.deployment.ApplicationClientDescriptor in project Payara by payara.

the class TokenHelper method buildTokens.

private Properties buildTokens() {
    final Properties t = new Properties();
    t.setProperty("app.codebase.path", appCodebasePath());
    t.setProperty("main.jnlp.path", mainJNLP());
    t.setProperty("system.context.root", systemContextRoot());
    t.setProperty("agent.jar", agentJar());
    t.setProperty("system.jnlp", systemJNLP());
    // t.setProperty("client.facade.jnlp.path", clientFacadeJNLP());
    t.setProperty("client.jnlp.path", clientJNLP());
    t.setProperty(JavaWebStartInfo.APP_LIBRARY_EXTENSION_PROPERTY_NAME, appLibraryExtensions());
    t.setProperty("anchor.subpath", anchorSubpath());
    t.setProperty("dyn", dyn());
    t.setProperty("client.facade.jar.path", clientFacadeJARPath());
    t.setProperty("client.security", "<all-permissions/>");
    final ApplicationClientDescriptor acDesc = dHelper.appClientDesc();
    /*
         * Set the JNLP information title to the app client module's display name,
         * if one is present.
         */
    String displayName = acDesc.getDisplayName();
    String jnlpInformationTitle = (displayName != null && displayName.length() > 0) ? displayName : localStrings.get("jws.information.title.prefix") + " " + dHelper.appName();
    t.setProperty("appclient.main.information.title", jnlpInformationTitle);
    t.setProperty("appclient.client.information.title", jnlpInformationTitle);
    /*
         * Set the one-line description the same as the title for now.
         */
    t.setProperty("appclient.main.information.description.one-line", jnlpInformationTitle);
    t.setProperty("appclient.client.information.description.one-line", jnlpInformationTitle);
    /*
         *Set the short description to the description from the descriptor, if any.
         */
    String description = acDesc.getDescription();
    String jnlpInformationShortDescription = (description != null && description.length() > 0) ? description : jnlpInformationTitle;
    t.setProperty("appclient.main.information.description.short", jnlpInformationShortDescription);
    t.setProperty("appclient.client.information.description.short", jnlpInformationShortDescription);
    t.setProperty("appclient.vendor", vendorInfo.getVendor());
    /*
         * Construct the icon elements, if the user specified any in the
         * optional descriptor element.
         */
    t.setProperty("appclient.main.information.images", iconElements(vendorInfo));
    /*
         * For clients in an EAR there will be an EAR-level generated group facade
         * JAR to include in the downloaded files.
         */
    final URI groupFacadeUserURI = dHelper.groupFacadeUserURI(dHelper.dc());
    t.setProperty(GROUP_JAR_ELEMENT_PROPERTY_NAME, (groupFacadeUserURI == null ? "" : "<jar href=\"" + groupFacadeUserURI.toASCIIString() + "\"/>"));
    setSystemJNLPTokens(t);
    return t;
}
Also used : ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor) Properties(java.util.Properties) URI(java.net.URI)

Aggregations

ApplicationClientDescriptor (com.sun.enterprise.deployment.ApplicationClientDescriptor)21 EjbBundleDescriptor (com.sun.enterprise.deployment.EjbBundleDescriptor)5 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)5 Application (com.sun.enterprise.deployment.Application)4 URI (java.net.URI)4 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)3 ManagedBeanDescriptor (com.sun.enterprise.deployment.ManagedBeanDescriptor)3 AppClientArchivist (com.sun.enterprise.deployment.archivist.AppClientArchivist)3 File (java.io.File)3 Iterator (java.util.Iterator)3 ReadableArchive (org.glassfish.api.deployment.archive.ReadableArchive)3 RootDeploymentDescriptor (org.glassfish.deployment.common.RootDeploymentDescriptor)3 FileArchive (com.sun.enterprise.deploy.shared.FileArchive)2 ConnectorDescriptor (com.sun.enterprise.deployment.ConnectorDescriptor)2 PersistenceUnitDescriptor (com.sun.enterprise.deployment.PersistenceUnitDescriptor)2 MultiReadableArchive (com.sun.enterprise.deployment.deploy.shared.MultiReadableArchive)2 Set (java.util.Set)2 Attributes (java.util.jar.Attributes)2 Manifest (java.util.jar.Manifest)2 ModuleDescriptor (org.glassfish.deployment.common.ModuleDescriptor)2