Search in sources :

Example 1 with BundleDescriptor

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

the class GlassFishInjectionProvider method getBundle.

private BundleDescriptor getBundle() {
    JndiNameEnvironment componentEnvironment = compEnvManager.getCurrentJndiNameEnvironment();
    BundleDescriptor bundle = null;
    if (componentEnvironment instanceof BundleDescriptor) {
        bundle = (BundleDescriptor) componentEnvironment;
    }
    if (bundle == null) {
        throw new IllegalStateException("Invalid context for managed bean creation");
    }
    return bundle;
}
Also used : BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) JndiNameEnvironment(com.sun.enterprise.deployment.JndiNameEnvironment)

Example 2 with BundleDescriptor

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

the class IASEjbCMPEntityDescriptor method getUniqueName.

public String getUniqueName() {
    if (uniqueName == null) {
        BundleDescriptor bundle = getEjbBundleDescriptor();
        Application application = bundle.getApplication();
        // Add ejb name and application name.
        StringBuffer rc = new StringBuffer().append(getName()).append(NAME_CONCATENATOR).append(application.getRegistrationName());
        // If it's not just a module, add a module name.
        if (!application.isVirtual()) {
            rc.append(NAME_CONCATENATOR).append(bundle.getModuleDescriptor().getArchiveUri());
        }
        uniqueName = getBaseName(getEjbClassName()) + getUniqueNumber(rc.toString());
    }
    return uniqueName;
}
Also used : BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) Application(com.sun.enterprise.deployment.Application)

Example 3 with BundleDescriptor

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

the class JavaEEDeployer method prepare.

/**
 * Prepares the application bits for running in the application server.
 * For certain cases, this is generating non portable
 * artifacts and other application specific tasks.
 * Failure to prepare should throw an exception which will cause the overall
 * deployment to fail.
 *
 * @param dc deployment context
 * @return true if the prepare phase was successful
 */
public boolean prepare(DeploymentContext dc) {
    try {
        ((ExtendedDeploymentContext) dc).prepareScratchDirs();
        // In jaxrpc it was required to run
        // Wscompile to generate the artifacts for clients too.
        // service-ref element can be in client in web.xml,  application-client.xml, sun-ejb-jar.xml
        // Fix for issue 16015
        BundleDescriptor bundleDesc = dc.getModuleMetaData(BundleDescriptor.class);
        if (bundleDesc.hasWebServiceClients()) {
            JAXRPCCodeGenFacade jaxrpcCodeGenFacade = jaxrpcCodeGenFacadeProvider.get();
            if (jaxrpcCodeGenFacade != null) {
                jaxrpcCodeGenFacade.run(habitat, dc, getModuleClassPath(dc), true);
            }
        }
        if (!dc.getCommandParameters(OpsParams.class).origin.isArtifactsPresent()) {
            // only generate artifacts when there is no artifacts present
            generateArtifacts(dc);
        }
        return true;
    } catch (Exception ex) {
        // re-throw all the exceptions as runtime exceptions
        throw new RuntimeException(ex.getMessage(), ex);
    }
}
Also used : BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) JAXRPCCodeGenFacade(org.glassfish.internal.api.JAXRPCCodeGenFacade) ExtendedDeploymentContext(org.glassfish.internal.deployment.ExtendedDeploymentContext) IOException(java.io.IOException) DeploymentException(org.glassfish.deployment.common.DeploymentException)

Example 4 with BundleDescriptor

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

the class ListSubComponentsCommand method getSubModuleListForEar.

private Collection<ModuleDescriptor<BundleDescriptor>> getSubModuleListForEar(com.sun.enterprise.deployment.Application application, String type) {
    Collection<ModuleDescriptor<BundleDescriptor>> modules = new ArrayList<ModuleDescriptor<BundleDescriptor>>();
    if (type == null) {
        modules = application.getModules();
    } else if (type.equals("servlets")) {
        modules = application.getModuleDescriptorsByType(DOLUtils.warType());
    } else if (type.equals("ejbs")) {
        modules = application.getModuleDescriptorsByType(DOLUtils.ejbType());
        // ejb in war case
        Collection<ModuleDescriptor<BundleDescriptor>> webModules = application.getModuleDescriptorsByType(DOLUtils.warType());
        for (ModuleDescriptor webModule : webModules) {
            if (webModule.getDescriptor().getExtensionsDescriptors(EjbBundleDescriptor.class).size() > 0) {
                modules.add(webModule);
            }
        }
    }
    return modules;
}
Also used : ModuleDescriptor(org.glassfish.deployment.common.ModuleDescriptor) BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) ArrayList(java.util.ArrayList)

Example 5 with BundleDescriptor

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

the class ClusterReaderHelper method getWebModules.

/**
 * Returns the web module readers for a set of application refs.
 *
 * @param   _configCtx      Current Config context
 * @param   refs            Application ref(s) from cluster or stand alone
 *                          instance
 * @param   target          Name of the cluster or stand alone instance
 *
 * @return  WebModuleReader[]   Array of the corresponding web module
 *                              reader(s).
 *
 * @throws  LbReaderException   In case of any error(s).
 */
public static WebModuleReader[] getWebModules(Domain domain, ApplicationRegistry appRegistry, List<ApplicationRef> refs, String target) {
    List<WebModuleReader> list = new ArrayList<WebModuleReader>();
    Set<String> contextRoots = new HashSet<String>();
    Iterator<ApplicationRef> refAppsIter = refs.iterator();
    HashMap<String, ApplicationRef> refferedApps = new HashMap<String, ApplicationRef>();
    while (refAppsIter.hasNext()) {
        ApplicationRef appRef = refAppsIter.next();
        refferedApps.put(appRef.getRef(), appRef);
    }
    Applications applications = domain.getApplications();
    Set<Application> apps = new HashSet<Application>();
    apps.addAll(applications.getApplicationsWithSnifferType("web"));
    apps.addAll(applications.getApplicationsWithSnifferType("webservices"));
    Iterator<Application> appsIter = apps.iterator();
    while (appsIter.hasNext()) {
        Application app = appsIter.next();
        String appName = app.getName();
        if (!refferedApps.containsKey(appName)) {
            continue;
        }
        ApplicationInfo appInfo = appRegistry.get(appName);
        if (appInfo == null) {
            String msg = LbLogUtil.getStringManager().getString("UnableToGetAppInfo", appName);
            LbLogUtil.getLogger().log(Level.WARNING, msg);
            continue;
        }
        com.sun.enterprise.deployment.Application depApp = appInfo.getMetaData(com.sun.enterprise.deployment.Application.class);
        Iterator<BundleDescriptor> bundleDescriptorIter = depApp.getBundleDescriptors().iterator();
        while (bundleDescriptorIter.hasNext()) {
            BundleDescriptor bundleDescriptor = bundleDescriptorIter.next();
            try {
                if (bundleDescriptor instanceof WebBundleDescriptor) {
                    WebModuleReader wmr = new WebModuleReaderImpl(appName, refferedApps.get(appName), app, (WebBundleDescriptor) bundleDescriptor);
                    if (!contextRoots.contains(wmr.getContextRoot())) {
                        contextRoots.add(wmr.getContextRoot());
                        list.add(wmr);
                    }
                } else if (bundleDescriptor instanceof EjbBundleDescriptor) {
                    EjbBundleDescriptor ejbBundleDescriptor = (EjbBundleDescriptor) bundleDescriptor;
                    if (!ejbBundleDescriptor.hasWebServices()) {
                        continue;
                    }
                    Iterator<WebServiceEndpoint> wsIter = ejbBundleDescriptor.getWebServices().getEndpoints().iterator();
                    while (wsIter.hasNext()) {
                        WebServiceEndpointReaderImpl wsr = new WebServiceEndpointReaderImpl(appName, refferedApps.get(appName), app, wsIter.next());
                        if (!contextRoots.contains(wsr.getContextRoot())) {
                            contextRoots.add(wsr.getContextRoot());
                            list.add(wsr);
                        }
                    }
                }
            } catch (LbReaderException ex) {
                String msg = LbLogUtil.getStringManager().getString("UnableToGetContextRoot", appName, ex.getMessage());
                LbLogUtil.getLogger().log(Level.WARNING, msg);
                if (LbLogUtil.getLogger().isLoggable(Level.FINE)) {
                    LbLogUtil.getLogger().log(Level.FINE, "Exception when getting context root for application", ex);
                }
            }
        }
    }
    contextRoots.clear();
    // returns the web module reader as array
    WebModuleReader[] webModules = new WebModuleReader[list.size()];
    return (WebModuleReader[]) list.toArray(webModules);
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ApplicationInfo(org.glassfish.internal.data.ApplicationInfo) ApplicationRef(com.sun.enterprise.config.serverbeans.ApplicationRef) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) Iterator(java.util.Iterator) LbReaderException(org.glassfish.loadbalancer.admin.cli.reader.api.LbReaderException) HashSet(java.util.HashSet) WebModuleReader(org.glassfish.loadbalancer.admin.cli.reader.api.WebModuleReader) Applications(com.sun.enterprise.config.serverbeans.Applications) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) Application(com.sun.enterprise.config.serverbeans.Application)

Aggregations

BundleDescriptor (com.sun.enterprise.deployment.BundleDescriptor)51 EjbBundleDescriptor (com.sun.enterprise.deployment.EjbBundleDescriptor)24 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)24 Application (com.sun.enterprise.deployment.Application)17 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)10 ModuleDescriptor (org.glassfish.deployment.common.ModuleDescriptor)9 ManagedBeanDescriptor (com.sun.enterprise.deployment.ManagedBeanDescriptor)8 JndiNameEnvironment (com.sun.enterprise.deployment.JndiNameEnvironment)7 WeldBootstrap (org.jboss.weld.bootstrap.WeldBootstrap)7 BeanDeploymentArchive (org.jboss.weld.bootstrap.spi.BeanDeploymentArchive)7 JCDIService (com.sun.enterprise.container.common.spi.JCDIService)6 ApplicationInfo (org.glassfish.internal.data.ApplicationInfo)6 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)5 RootDeploymentDescriptor (org.glassfish.deployment.common.RootDeploymentDescriptor)5 InterceptorInvoker (com.sun.enterprise.container.common.spi.InterceptorInvoker)4 HashSet (java.util.HashSet)4 JavaEEInterceptorBuilder (com.sun.enterprise.container.common.spi.JavaEEInterceptorBuilder)3 File (java.io.File)3 IOException (java.io.IOException)3