Search in sources :

Example 6 with ApplicationClientDescriptor

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

the class NestedAppClientInfo method getAppClient.

/**
 *Reports which app client embedded in the application archive is the
 *one the user has selected using either the main class or display name
 *arguments from the command line.
 *@return the app client descriptor for the user-selected app client
 */
@Override
protected ApplicationClientDescriptor getAppClient(Archivist archivist) {
    if (selectedAppClientDescriptor != null) {
        return selectedAppClientDescriptor;
    }
    Application app = Application.class.cast(archivist.getDescriptor());
    /*
         *There could be one or more app clients embedded in the enterprise app
         *in the archive.  Choose which one to run based on the user's 
         *command-line input.
         */
    Set<ApplicationClientDescriptor> embeddedAppClients = (Set<ApplicationClientDescriptor>) app.getBundleDescriptors(ApplicationClientDescriptor.class);
    /*
         *Make sure the application module contains at least one app client.
         */
    if (embeddedAppClients.size() == 0) {
        throw new IllegalArgumentException(getLocalString("appclient.noEmbeddedAppClients", "The specified application module does not contain any app clients"));
    }
    /*
         *If there is exactly one app client in the ear, then that's the app
         *client to use.
         */
    if (embeddedAppClients.size() == 1) {
        selectedAppClientDescriptor = useFirstEmbeddedAppClient(embeddedAppClients, mainClassFromCommandLine);
    } else {
        selectedAppClientDescriptor = chooseFromEmbeddedAppClients(embeddedAppClients, mainClassFromCommandLine, displayNameFromCommandLine);
        /*
             *Make sure that we've selected an app client.
             */
        if (selectedAppClientDescriptor == null) {
            if (mainClassFromCommandLine != null) {
                throw new IllegalArgumentException(getLocalString("appclient.noMatchingClientUsingMainClass", "Could not locate an embedded app client matching the main class name {0}", mainClassFromCommandLine));
            } else {
                throw new IllegalArgumentException(getLocalString("appclient.noMatchingClientUsingDisplayName", "Could not locate an embedded app client matching the display name {0}", displayNameFromCommandLine));
            }
        }
    }
    return selectedAppClientDescriptor;
}
Also used : Set(java.util.Set) ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor) Application(com.sun.enterprise.deployment.Application)

Example 7 with ApplicationClientDescriptor

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

the class StandAloneAppClientInfo method fixupWSDLEntries.

/**
 *Adjusts the web services WSDL entries corresponding to where they
 *actually reside.
 */
protected void fixupWSDLEntries() throws URISyntaxException, MalformedURLException, IOException, AnnotationProcessorException {
    ApplicationClientDescriptor ac = getAppClient();
    URI uri = (new File(getAppClientRoot(appClientArchive, ac))).toURI();
    File moduleFile = new File(uri);
    for (Iterator itr = ac.getServiceReferenceDescriptors().iterator(); itr.hasNext(); ) {
        ServiceReferenceDescriptor serviceRef = (ServiceReferenceDescriptor) itr.next();
        if (serviceRef.getWsdlFileUri() != null) {
            // In case WebServiceRef does not specify wsdlLocation, we get
            // wsdlLocation from @WebClient in wsimport generated source;
            // If wsimport was given a local WSDL file, then WsdlURI will
            // be an absolute path - in that case it should not be prefixed
            // with modileFileDir
            String wsdlURI = serviceRef.getWsdlFileUri();
            File wsdlFile = new File(wsdlURI);
            if (wsdlFile.isAbsolute()) {
                serviceRef.setWsdlFileUrl(wsdlFile.toURI().toURL());
            } else {
                // This is the case where WsdlFileUri is a relative path
                // (hence relative to the root of this module or wsimport
                // was executed with WSDL in HTTP URL form
                serviceRef.setWsdlFileUrl(getEntryAsUrl(moduleFile, serviceRef.getWsdlFileUri()));
            }
        }
    }
}
Also used : Iterator(java.util.Iterator) ServiceReferenceDescriptor(com.sun.enterprise.deployment.ServiceReferenceDescriptor) ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor) URI(java.net.URI) File(java.io.File)

Example 8 with ApplicationClientDescriptor

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

the class DOLUtils method getComponentEnvId.

/**
 * Generate a unique id name for each J2EE component.
 * @param env
 * @return
 */
public static String getComponentEnvId(JndiNameEnvironment env) {
    String id = null;
    if (env instanceof EjbDescriptor) {
        // EJB component
        EjbDescriptor ejbEnv = (EjbDescriptor) env;
        // Make jndi name flat so it won't result in the creation of
        // a bunch of sub-contexts.
        String flattedJndiName = ejbEnv.getJndiName().replace('/', '.');
        EjbBundleDescriptor ejbBundle = ejbEnv.getEjbBundleDescriptor();
        Descriptor d = ejbBundle.getModuleDescriptor().getDescriptor();
        // as the web bundle, because they share the same JNDI namespace
        if (d instanceof WebBundleDescriptor) {
            // copy of code below
            WebBundleDescriptor webEnv = (WebBundleDescriptor) d;
            id = webEnv.getApplication().getName() + ID_SEPARATOR + webEnv.getContextRoot();
            if (deplLogger.isLoggable(Level.FINER)) {
                deplLogger.log(Level.FINER, CONVERT_EJB_TO_WEB_ID, id);
            }
        } else {
            id = ejbEnv.getApplication().getName() + ID_SEPARATOR + ejbBundle.getModuleDescriptor().getArchiveUri() + ID_SEPARATOR + ejbEnv.getName() + ID_SEPARATOR + flattedJndiName + ejbEnv.getUniqueId();
        }
    } else if (env instanceof WebBundleDescriptor) {
        WebBundleDescriptor webEnv = (WebBundleDescriptor) env;
        id = webEnv.getApplication().getName() + ID_SEPARATOR + webEnv.getContextRoot();
    } else if (env instanceof ApplicationClientDescriptor) {
        ApplicationClientDescriptor appEnv = (ApplicationClientDescriptor) env;
        id = "client" + ID_SEPARATOR + appEnv.getName() + ID_SEPARATOR + appEnv.getMainClassName();
    } else if (env instanceof ManagedBeanDescriptor) {
        id = ((ManagedBeanDescriptor) env).getGlobalJndiName();
    } else if (env instanceof EjbBundleDescriptor) {
        EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor) env;
        id = "__ejbBundle__" + ID_SEPARATOR + ejbBundle.getApplication().getName() + ID_SEPARATOR + ejbBundle.getModuleName();
    }
    return id;
}
Also used : EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) ModuleDescriptor(org.glassfish.deployment.common.ModuleDescriptor) ActiveDescriptor(org.glassfish.hk2.api.ActiveDescriptor) BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor) Descriptor(org.glassfish.deployment.common.Descriptor) ManagedBeanDescriptor(com.sun.enterprise.deployment.ManagedBeanDescriptor) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) RootDeploymentDescriptor(org.glassfish.deployment.common.RootDeploymentDescriptor) ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor) ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor) ManagedBeanDescriptor(com.sun.enterprise.deployment.ManagedBeanDescriptor) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor)

Example 9 with ApplicationClientDescriptor

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

the class DOLUtils method getModuleName.

public static String getModuleName(JndiNameEnvironment env) {
    String moduleName = null;
    if (env instanceof EjbDescriptor) {
        // EJB component
        EjbDescriptor ejbEnv = (EjbDescriptor) env;
        EjbBundleDescriptor ejbBundle = ejbEnv.getEjbBundleDescriptor();
        moduleName = ejbBundle.getModuleDescriptor().getModuleName();
    } else if (env instanceof EjbBundleDescriptor) {
        EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor) env;
        moduleName = ejbBundle.getModuleDescriptor().getModuleName();
    } else if (env instanceof WebBundleDescriptor) {
        WebBundleDescriptor webEnv = (WebBundleDescriptor) env;
        moduleName = webEnv.getModuleName();
    } else if (env instanceof ApplicationClientDescriptor) {
        ApplicationClientDescriptor appEnv = (ApplicationClientDescriptor) env;
        moduleName = appEnv.getModuleName();
    } else if (env instanceof ManagedBeanDescriptor) {
        ManagedBeanDescriptor mb = (ManagedBeanDescriptor) env;
        moduleName = mb.getBundle().getModuleName();
    } else {
        throw new IllegalArgumentException("IllegalJndiNameEnvironment : env");
    }
    return moduleName;
}
Also used : EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor) ManagedBeanDescriptor(com.sun.enterprise.deployment.ManagedBeanDescriptor) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor)

Example 10 with ApplicationClientDescriptor

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

the class DOLUtils method getApplicationFromEnv.

/**
 * @param env
 * @return
 */
public static Application getApplicationFromEnv(JndiNameEnvironment env) {
    Application app = null;
    if (env instanceof EjbDescriptor) {
        // EJB component
        EjbDescriptor ejbEnv = (EjbDescriptor) env;
        app = ejbEnv.getApplication();
    } else if (env instanceof EjbBundleDescriptor) {
        EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor) env;
        app = ejbBundle.getApplication();
    } else if (env instanceof WebBundleDescriptor) {
        WebBundleDescriptor webEnv = (WebBundleDescriptor) env;
        app = webEnv.getApplication();
    } else if (env instanceof ApplicationClientDescriptor) {
        ApplicationClientDescriptor appEnv = (ApplicationClientDescriptor) env;
        app = appEnv.getApplication();
    } else if (env instanceof ManagedBeanDescriptor) {
        ManagedBeanDescriptor mb = (ManagedBeanDescriptor) env;
        app = mb.getBundle().getApplication();
    } else if (env instanceof Application) {
        app = ((Application) env);
    } else {
        throw new IllegalArgumentException("IllegalJndiNameEnvironment : env");
    }
    return app;
}
Also used : EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor) ManagedBeanDescriptor(com.sun.enterprise.deployment.ManagedBeanDescriptor) Application(com.sun.enterprise.deployment.Application) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor)

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