use of org.jboss.wsf.spi.deployment.Deployment in project wildfly by wildfly.
the class AbstractSecurityMetaDataAccessorEJB method getEjbSecurityMetaData.
/**
* Gets Jakarta Enterprise Beans security meta data if associated with Jakarta Enterprise Beans endpoint.
*
* @param endpoint EJB webservice endpoint
* @return EJB security meta data or null
*/
private EJBSecurityMetaData getEjbSecurityMetaData(final Endpoint endpoint) {
final String ejbName = endpoint.getShortName();
final Deployment dep = endpoint.getService().getDeployment();
final EJBArchiveMetaData ejbArchiveMD = WSHelper.getOptionalAttachment(dep, EJBArchiveMetaData.class);
final EJBMetaData ejbMD = ejbArchiveMD != null ? ejbArchiveMD.getBeanByEjbName(ejbName) : null;
return ejbMD != null ? ejbMD.getSecurityMetaData() : null;
}
use of org.jboss.wsf.spi.deployment.Deployment in project wildfly by wildfly.
the class EndpointPublisherImpl method doPublish.
/**
* Publish the webapp for the WS deployment unit
*
* @param target
* @param unit
* @return
* @throws Exception
*/
protected Context doPublish(ServiceTarget target, DeploymentUnit unit) throws Exception {
final Deployment deployment = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY);
final List<Endpoint> endpoints = deployment.getService().getEndpoints();
// otherwise we need to explicitly wait for the endpoint services to be started before creating the webapp.
if (!runningInService) {
final ServiceRegistry registry = unit.getServiceRegistry();
final CountDownLatch latch = new CountDownLatch(endpoints.size());
final LifecycleListener listener = new LifecycleListener() {
@Override
public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) {
if (event == LifecycleEvent.UP) {
latch.countDown();
controller.removeListener(this);
}
}
};
ServiceName serviceName;
for (Endpoint ep : endpoints) {
serviceName = EndpointService.getServiceName(unit, ep.getShortName());
registry.getRequiredService(serviceName).addListener(listener);
}
latch.await();
}
// TODO simplify and use findChild later in destroy()/stopWebApp()
deployment.addAttachment(WebDeploymentController.class, startWebApp(host, unit));
return new Context(unit.getAttachment(WSAttachmentKeys.JBOSSWEB_METADATA_KEY).getContextRoot(), endpoints);
}
use of org.jboss.wsf.spi.deployment.Deployment in project wildfly by wildfly.
the class AspectDeploymentProcessor method undeploy.
@Override
public void undeploy(final DeploymentUnit unit) {
if (isWebServiceDeployment(unit)) {
final Deployment dep = ASHelper.getRequiredAttachment(unit, WSAttachmentKeys.DEPLOYMENT_KEY);
WSLogger.ROOT_LOGGER.tracef("%s stop: %s", aspect, unit.getName());
ClassLoader origClassLoader = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(aspect.getLoader());
aspect.stop(dep);
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(origClassLoader);
}
}
}
use of org.jboss.wsf.spi.deployment.Deployment in project wildfly by wildfly.
the class EndpointService method getServiceNamesFromDeploymentUnit.
static List<ServiceName> getServiceNamesFromDeploymentUnit(final DeploymentUnit unit) {
final List<ServiceName> endpointServiceNames = new ArrayList<>();
Deployment deployment = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY);
for (Endpoint ep : deployment.getService().getEndpoints()) {
endpointServiceNames.add(EndpointService.getServiceName(unit, ep.getShortName()));
}
return endpointServiceNames;
}
use of org.jboss.wsf.spi.deployment.Deployment in project wildfly by wildfly.
the class EndpointPublisherImpl method doDeploy.
/**
* Triggers the WS deployment aspects, which process the deployment and
* install the endpoint services.
*
* @param target
* @param unit
*/
protected void doDeploy(ServiceTarget target, DeploymentUnit unit) {
List<DeploymentAspect> aspects = getDeploymentAspects();
ClassLoader origClassLoader = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
Deployment dep = null;
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader());
dep = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY);
dep.addAttachment(ServiceTarget.class, target);
DeploymentAspectManager dam = new DeploymentAspectManagerImpl();
dam.setDeploymentAspects(aspects);
dam.deploy(dep);
} finally {
if (dep != null) {
dep.removeAttachment(ServiceTarget.class);
}
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(origClassLoader);
}
}
Aggregations