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;
}
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;
}
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);
}
}
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;
}
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);
}
Aggregations