Search in sources :

Example 1 with ApplicationClientDescriptor

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

the class ActiveJmsResourceAdapter method getJMSDestination.

/*
     * Get JMS destination resource from application
     */
private JMSDestinationDefinitionDescriptor getJMSDestination(String logicalDestination, Application application) {
    if (application == null) {
        return null;
    }
    JMSDestinationDefinitionDescriptor destination = getJMSDestination(logicalDestination, application.getResourceDescriptors(JavaEEResourceType.JMSDD));
    if (isValidDestination(destination)) {
        return destination;
    }
    Set<WebBundleDescriptor> webBundleDescriptors = application.getBundleDescriptors(WebBundleDescriptor.class);
    for (WebBundleDescriptor webBundleDescriptor : webBundleDescriptors) {
        destination = getJMSDestination(logicalDestination, webBundleDescriptor.getResourceDescriptors(JavaEEResourceType.JMSDD));
        if (isValidDestination(destination)) {
            return destination;
        }
    }
    Set<EjbBundleDescriptor> ejbBundleDescriptors = application.getBundleDescriptors(EjbBundleDescriptor.class);
    for (EjbBundleDescriptor ejbBundleDescriptor : ejbBundleDescriptors) {
        destination = getJMSDestination(logicalDestination, ejbBundleDescriptor);
        if (isValidDestination(destination)) {
            return destination;
        }
    }
    Set<ApplicationClientDescriptor> appClientDescriptors = application.getBundleDescriptors(ApplicationClientDescriptor.class);
    for (ApplicationClientDescriptor appClientDescriptor : appClientDescriptors) {
        destination = getJMSDestination(logicalDestination, appClientDescriptor.getResourceDescriptors(JavaEEResourceType.JMSDD));
        if (isValidDestination(destination)) {
            return destination;
        }
    }
    return null;
}
Also used : JMSDestinationDefinitionDescriptor(com.sun.enterprise.deployment.JMSDestinationDefinitionDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor)

Example 2 with ApplicationClientDescriptor

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

the class ClassFileAppClientInfo method massageDescriptor.

@Override
protected void massageDescriptor() throws IOException, AnnotationProcessorException {
    ApplicationClientDescriptor appClient = getDescriptor();
    appClient.setMainClassName(classFileFromCommandLine);
    appClient.getModuleDescriptor().setStandalone(true);
    FileArchive fa = new FileArchive();
    fa.open(new File(classFileFromCommandLine).toURI());
    new AppClientArchivist().processAnnotations(appClient, fa);
}
Also used : FileArchive(com.sun.enterprise.deploy.shared.FileArchive) ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor) AppClientArchivist(com.sun.enterprise.deployment.archivist.AppClientArchivist) File(java.io.File)

Example 3 with ApplicationClientDescriptor

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

the class AppClientDeployer method load.

@Override
public AppClientServerApplication load(AppClientContainerStarter containerStarter, DeploymentContext dc) {
    // if the populated DOL object does not container appclient
    // descriptor, this is an indication that appclient deployer
    // should not handle this module
    ApplicationClientDescriptor appclientDesc = dc.getModuleMetaData(ApplicationClientDescriptor.class);
    if (appclientDesc == null) {
        return null;
    }
    appclientDesc.setClassLoader(dc.getClassLoader());
    AppClientDeployerHelper helper = null;
    try {
        helper = getSavedHelperOrCreateHelper(dc);
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
    // helper.addGroupFacadeToEARDownloads();
    final AppClientServerApplication newACServerApp = newACServerApp(dc, helper);
    appClientApps.add(newACServerApp);
    return newACServerApp;
}
Also used : ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor) IOException(java.io.IOException)

Example 4 with ApplicationClientDescriptor

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

the class AppClientContainer method completePreparation.

/**
 * Gets the ACC ready so the main class can run.
 * This can be followed, immediately or after some time, by either an
 * invocation of {@link #launch(java.lang.String[])  or
 * by the JVM invoking the client's main method (as would happen during
 * a <code>java -jar theClient.jar</code> launch.
 *
 * @throws java.lang.Exception
 */
private void completePreparation(final Instrumentation inst) throws NamingException, IOException, InstantiationException, IllegalAccessException, InjectionException, ClassNotFoundException, SAXParseException, NoSuchMethodException, UserError {
    if (state != State.INSTANTIATED) {
        throw new IllegalStateException();
    }
    /*
         * Attach any names defined in the app client.  Validate the descriptor
         * first, then use it to bind names in the app client.  This order is
         * important - for example, to set up message destination refs correctly.
         */
    client.validateDescriptor();
    final ApplicationClientDescriptor desc = client.getDescriptor(classLoader);
    componentId = componentEnvManager.bindToComponentNamespace(desc);
    /*
         * Arrange for cleanup now instead of during launch() because in some use cases
         * the JVM will invoke the client's main method itself and launch will
         * be skipped.
         */
    cleanup = Cleanup.arrangeForShutdownCleanup(logger, habitat, desc);
    /*
         * Allow pre-destroy handling to work on the main class during clean-up.
         */
    cleanup.setInjectionManager(injectionManager, clientMainClassSetting.clientMainClass);
    /*
         * If this app client contains persistence unit refs, then initialize
         * the PU handling.  
         */
    Collection<? extends PersistenceUnitDescriptor> referencedPUs = desc.findReferencedPUs();
    if (referencedPUs != null && !referencedPUs.isEmpty()) {
        ProviderContainerContractInfoImpl pcci = new ProviderContainerContractInfoImpl((ACCClassLoader) getClassLoader(), inst, client.getAnchorDir(), connectorRuntime);
        for (PersistenceUnitDescriptor puDesc : referencedPUs) {
            PersistenceUnitLoader pul = new PersistenceUnitLoader(puDesc, pcci);
            desc.addEntityManagerFactory(puDesc.getName(), pul.getEMF());
        }
        cleanup.setEMFs(pcci.emfs());
    }
    cleanup.setConnectorRuntime(connectorRuntime);
    prepareURLStreamHandling();
    // This is required for us to enable interrupt jaxws service
    // creation calls
    System.setProperty("javax.xml.ws.spi.Provider", "com.sun.enterprise.webservice.spi.ProviderImpl");
    // InjectionManager's injectClass will be called from getMainMethod
    // Load any managed beans
    ManagedBeanManager managedBeanManager = habitat.getService(ManagedBeanManager.class);
    managedBeanManager.loadManagedBeans(desc.getApplication());
    cleanup.setManagedBeanManager(managedBeanManager);
    /**
     * We don't really need the main method here but we do need the side-effects.
     */
    getMainMethod();
    state = State.PREPARED;
}
Also used : ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor) PersistenceUnitLoader(org.glassfish.persistence.jpa.PersistenceUnitLoader) PersistenceUnitDescriptor(com.sun.enterprise.deployment.PersistenceUnitDescriptor) ManagedBeanManager(com.sun.enterprise.container.common.spi.ManagedBeanManager)

Example 5 with ApplicationClientDescriptor

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

the class NestedAppClientInfo method useFirstEmbeddedAppClient.

private ApplicationClientDescriptor useFirstEmbeddedAppClient(Set<ApplicationClientDescriptor> embeddedAppClients, String mainClassNameFromCommandLine) {
    ApplicationClientDescriptor result = null;
    /*
         *If the size is 1 then there is sure to be a non-null .next.
         *Still, may as well be sure.
         */
    Iterator<ApplicationClientDescriptor> it = embeddedAppClients.iterator();
    if (!it.hasNext()) {
        throw new IllegalStateException(getLocalString("appclient.unexpectedEndOfEmbeddedClients", "The application module seems to contain one app client but the iterator reported no more elements prematurely"));
    }
    result = embeddedAppClients.iterator().next();
    /*
         *If, in addition, the user specified a main class on the command
         *line, then use the user's class name as the main class name, rather
         *than the class specified by the Main-Class attribute in the
         *app client archive.  This allows the user to override the Main-Class
         *setting in the app client's manifest.
         */
    if (mainClassNameFromCommandLine != null) {
        result.setMainClassName(mainClassNameFromCommandLine);
    }
    return result;
}
Also used : ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor)

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