use of org.glassfish.internal.api.JAXRPCCodeGenFacade 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 org.glassfish.internal.api.JAXRPCCodeGenFacade 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;
}
}
Aggregations