use of org.glassfish.webservices.deployment.WebServicesDeploymentMBean in project Payara by payara.
the class WebServicesDeployer method prepare.
/**
* Prepares the application bits for running in the application server.
* For certain cases, this is exploding the jar file to a format the
* ContractProvider instance is expecting, 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
*/
@Override
public boolean prepare(DeploymentContext dc) {
try {
Application app = dc.getModuleMetaData(Application.class);
if (app == null) {
// hopefully the DOL gave a good message of the failure...
logger.log(Level.SEVERE, LogUtils.FAILED_LOADING_DD);
return false;
}
BundleDescriptor bundle = DOLUtils.getCurrentBundleForContext(dc);
String moduleCP = getModuleClassPath(dc);
final List<URL> moduleCPUrls = ASClassLoaderUtil.getURLsFromClasspath(moduleCP, File.pathSeparator, null);
final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
URLClassLoader newCl = AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>() {
@Override
public URLClassLoader run() {
return new URLClassLoader(ASClassLoaderUtil.convertURLListToArray(moduleCPUrls), oldCl);
}
});
Thread.currentThread().setContextClassLoader(newCl);
WebServicesDescriptor wsDesc = bundle.getWebServices();
for (WebService ws : wsDesc.getWebServices()) {
if ((new WsUtil()).isJAXWSbasedService(ws)) {
setupJaxWSServiceForDeployment(dc, ws);
} else {
JAXRPCCodeGenFacade facade = habitat.getService(JAXRPCCodeGenFacade.class);
if (facade != null) {
facade.run(habitat, dc, moduleCP, false);
} else {
throw new DeploymentException(rb.getString(LogUtils.JAXRPC_CODEGEN_FAIL));
}
}
}
doWebServicesDeployment(app, dc);
Thread.currentThread().setContextClassLoader(oldCl);
WebServicesContainer container = habitat.getService(WebServicesContainer.class);
WebServicesDeploymentMBean bean = container.getDeploymentBean();
WebServiceDeploymentNotifier notifier = getDeploymentNotifier();
bean.deploy(wsDesc, notifier);
return true;
} catch (Exception ex) {
RuntimeException re = new RuntimeException(ex.getMessage());
re.initCause(ex);
throw re;
}
}
use of org.glassfish.webservices.deployment.WebServicesDeploymentMBean in project Payara by payara.
the class ListWebServicesCommand method execute.
@Override
public void execute(AdminCommandContext context) {
ActionReport report = context.getActionReport();
report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
WebServicesContainer container = containerProvider.get();
if (container == null) {
return;
}
WebServicesDeploymentMBean bean = container.getDeploymentBean();
if (appName != null && moduleName != null && endpointName != null) {
Map<String, Map<String, Map<String, DeployedEndpointData>>> endpoints = bean.getEndpoint(appName, moduleName, endpointName);
fillEndpoints(report, endpoints);
} else if (appName != null && moduleName != null) {
Map<String, Map<String, Map<String, DeployedEndpointData>>> endpoints = bean.getEndpoints(appName, moduleName);
fillEndpoints(report, endpoints);
} else if (appName != null) {
Map<String, Map<String, Map<String, DeployedEndpointData>>> endpoints = bean.getEndpoints(appName);
fillEndpoints(report, endpoints);
} else {
Map<String, Map<String, Map<String, DeployedEndpointData>>> endpoints = bean.getEndpoints();
fillEndpoints(report, endpoints);
}
}
use of org.glassfish.webservices.deployment.WebServicesDeploymentMBean in project Payara by payara.
the class WebServicesDeployer method clean.
@Override
public void clean(DeploymentContext dc) {
super.clean(dc);
WebServicesContainer container = habitat.getService(WebServicesContainer.class);
WebServicesDeploymentMBean bean = container.getDeploymentBean();
UndeployCommandParameters params = dc.getCommandParameters(UndeployCommandParameters.class);
if (params != null) {
bean.undeploy(params.name);
}
}
Aggregations