use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class EndpointDeployService method install.
public static DeploymentUnit install(final ServiceTarget serviceTarget, final String context, final ClassLoader loader, final String hostName, final Map<String, String> urlPatternToClassName, JBossWebMetaData jbwmd, WebservicesMetaData wsmd, JBossWebservicesMetaData jbwsmd, Map<Class<?>, Object> deploymentAttachments) {
final DeploymentUnit unit = EndpointPublisherHelper.doPrepareStep(context, loader, urlPatternToClassName, jbwmd, wsmd, jbwsmd);
if (deploymentAttachments != null) {
Deployment dep = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY);
for (Entry<Class<?>, Object> e : deploymentAttachments.entrySet()) {
dep.addAttachment(e.getKey(), e.getValue());
}
}
final EndpointDeployService service = new EndpointDeployService(context, unit);
final ServiceBuilder<DeploymentUnit> builder = serviceTarget.addService(service.getName(), service);
builder.addDependency(DependencyType.REQUIRED, WSServices.CONFIG_SERVICE);
builder.setInitialMode(Mode.ACTIVE);
builder.install();
return unit;
}
use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class ModClusterUndertowDeploymentProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
// Add mod_cluster-undertow integration service (jboss.modcluster.undertow) as a web deployment dependency
deploymentUnit.addToAttachmentList(Attachments.WEB_DEPENDENCIES, UndertowEventHandlerAdapterBuilder.SERVICE_NAME);
// Request count wrapping
if (isMetricEnabled(RequestCountLoadMetric.class)) {
deploymentUnit.addToAttachmentList(UndertowAttachments.UNDERTOW_INITIAL_HANDLER_CHAIN_WRAPPERS, new HandlerWrapper() {
@Override
public HttpHandler wrap(final HttpHandler handler) {
return new RequestCountHttpHandler(handler);
}
});
}
// Bytes Sent wrapping
if (isMetricEnabled(SendTrafficLoadMetric.class)) {
deploymentUnit.addToAttachmentList(UndertowAttachments.UNDERTOW_INITIAL_HANDLER_CHAIN_WRAPPERS, new HandlerWrapper() {
@Override
public HttpHandler wrap(final HttpHandler handler) {
return new BytesSentHttpHandler(handler);
}
});
}
// Bytes Received wrapping
if (isMetricEnabled(ReceiveTrafficLoadMetric.class)) {
deploymentUnit.addToAttachmentList(UndertowAttachments.UNDERTOW_INITIAL_HANDLER_CHAIN_WRAPPERS, new HandlerWrapper() {
@Override
public HttpHandler wrap(final HttpHandler handler) {
return new BytesReceivedHttpHandler(handler);
}
});
}
// Busyness thread setup actions
if (isMetricEnabled(BusyConnectorsLoadMetric.class)) {
deploymentUnit.addToAttachmentList(UndertowAttachments.UNDERTOW_OUTER_HANDLER_CHAIN_WRAPPERS, new HandlerWrapper() {
@Override
public HttpHandler wrap(final HttpHandler handler) {
return new RunningRequestsHttpHandler(handler);
}
});
}
}
use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class DefaultJMSConnectionFactoryBindingProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (DeploymentTypeMarker.isType(EAR, deploymentUnit)) {
return;
}
final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
if (moduleDescription == null) {
return;
}
final String defaultJMSConnectionFactory = moduleDescription.getDefaultResourceJndiNames().getJmsConnectionFactory();
if (defaultJMSConnectionFactory == null) {
return;
}
final LookupInjectionSource injectionSource = new LookupInjectionSource(defaultJMSConnectionFactory);
if (DeploymentTypeMarker.isType(WAR, deploymentUnit)) {
moduleDescription.getBindingConfigurations().add(new BindingConfiguration(MODULE_DEFAULT_JMS_CONNECTION_FACTORY, injectionSource));
} else {
if (DeploymentTypeMarker.isType(APPLICATION_CLIENT, deploymentUnit)) {
moduleDescription.getBindingConfigurations().add(new BindingConfiguration(COMP_DEFAULT_JMS_CONNECTION_FACTORY, injectionSource));
}
for (ComponentDescription componentDescription : moduleDescription.getComponentDescriptions()) {
if (componentDescription.getNamingMode() == ComponentNamingMode.CREATE) {
componentDescription.getBindingConfigurations().add(new BindingConfiguration(COMP_DEFAULT_JMS_CONNECTION_FACTORY, injectionSource));
}
}
}
}
use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class FederationDependencyProcessor method getFederationService.
private ServiceName getFederationService(DeploymentPhaseContext phaseContext) {
DeploymentUnit deployment = phaseContext.getDeploymentUnit();
ServiceRegistry serviceRegistry = phaseContext.getServiceRegistry();
// We assume the mgmt ops that trigger IdentityProviderAddHandler or ServiceProviderAddHandler
// run before the OperationStepHandler that triggers deploy. If not, that's a user mistake.
// Since those handlers run first, we can count on MSC having services *registered* even
// though we cannot count on them being *started*.
ServiceController<?> service = serviceRegistry.getService(IdentityProviderService.createServiceName(deployment.getName()));
if (service == null) {
service = serviceRegistry.getService(ServiceProviderService.createServiceName(deployment.getName()));
} else {
IdentityProviderService identityProviderService = (IdentityProviderService) service.getService();
IDPConfiguration idpType = identityProviderService.getValue().getConfiguration();
if (idpType.isExternal()) {
return null;
}
}
if (service == null) {
return null;
}
return service.getName();
}
use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class FederationDeploymentProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
PicketLinkFederationService federationService = deploymentUnit.getAttachment(FederationDependencyProcessor.DEPLOYMENT_ATTACHMENT_KEY);
if (federationService != null) {
ROOT_LOGGER.federationConfiguringDeployment(deploymentUnit.getName());
federationService.configure(deploymentUnit);
}
}
Aggregations