use of org.jboss.as.server.deployment.DeploymentResourceSupport in project wildfly by wildfly.
the class DsXmlDeploymentInstallProcessor method installManagementModel.
private void installManagementModel(final DataSource ds, final DeploymentUnit deploymentUnit, final PathAddress addr) {
XMLDataSourceRuntimeHandler.INSTANCE.registerDataSource(addr, ds);
final DeploymentResourceSupport deploymentResourceSupport = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT);
deploymentResourceSupport.getDeploymentSubModel(DataSourcesExtension.SUBSYSTEM_NAME, addr.getLastElement());
if (ds.getConnectionProperties() != null) {
for (final Map.Entry<String, String> prop : ds.getConnectionProperties().entrySet()) {
PathAddress registration = PathAddress.pathAddress(addr.getLastElement(), PathElement.pathElement(CONNECTION_PROPERTIES, prop.getKey()));
deploymentResourceSupport.getDeploymentSubModel(DataSourcesExtension.SUBSYSTEM_NAME, registration);
}
}
}
use of org.jboss.as.server.deployment.DeploymentResourceSupport in project wildfly by wildfly.
the class EjbManagementDeploymentUnitProcessor method installManagementResource.
private void installManagementResource(ComponentConfiguration configuration, DeploymentUnit deploymentUnit) {
final EJBComponentType type = EJBComponentType.getComponentType(configuration);
PathAddress addr = getComponentAddress(type, configuration, deploymentUnit);
final AbstractEJBComponentRuntimeHandler<?> handler = type.getRuntimeHandler();
handler.registerComponent(addr, configuration.getComponentDescription().getStartServiceName());
deploymentUnit.addToAttachmentList(EjbDeploymentAttachmentKeys.MANAGED_COMPONENTS, new InstalledComponent(type, addr));
final DeploymentResourceSupport deploymentResourceSupport = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT);
deploymentResourceSupport.getDeploymentSubModel(EJB3Extension.SUBSYSTEM_NAME, addr.getLastElement());
final EJBComponentDescription description = (EJBComponentDescription) configuration.getComponentDescription();
if (description.isTimerServiceRequired()) {
final PathAddress timerServiceAddress = PathAddress.pathAddress(addr.getLastElement(), EJB3SubsystemModel.TIMER_SERVICE_PATH);
final TimerServiceResource timerServiceResource = ((TimerServiceImpl) description.getTimerService()).getResource();
deploymentResourceSupport.registerDeploymentSubResource(EJB3Extension.SUBSYSTEM_NAME, timerServiceAddress, timerServiceResource);
}
}
use of org.jboss.as.server.deployment.DeploymentResourceSupport in project wildfly by wildfly.
the class UndertowJSRWebSocketDeploymentProcessor method addManagementWebsocket.
void addManagementWebsocket(final DeploymentUnit unit, Class endpoint, String path) {
try {
final DeploymentResourceSupport deploymentResourceSupport = unit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT);
//websockets don't have the concept of a name, however the path much be unique
final ModelNode node = deploymentResourceSupport.getDeploymentSubModel(UndertowExtension.SUBSYSTEM_NAME, PathElement.pathElement("websocket", path));
node.get("endpoint-class").set(endpoint.getName());
node.get("path").set(path);
} catch (Exception e) {
UndertowLogger.ROOT_LOGGER.failedToRegisterWebsocket(endpoint, path, e);
}
}
use of org.jboss.as.server.deployment.DeploymentResourceSupport in project wildfly by wildfly.
the class ModelDeploymentAspect method start.
@Override
public void start(final Deployment dep) {
final DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
if (unit instanceof WSEndpointDeploymentUnit)
return;
final DeploymentResourceSupport deploymentResourceSupport = unit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT);
for (final Endpoint endpoint : dep.getService().getEndpoints()) {
final ModelNode endpointModel;
try {
endpointModel = deploymentResourceSupport.getDeploymentSubModel(WSExtension.SUBSYSTEM_NAME, PathElement.pathElement(ENDPOINT, URLEncoder.encode(getId(endpoint), "UTF-8")));
} catch (final UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
endpointModel.get(ENDPOINT_NAME).set(getName(endpoint));
endpointModel.get(ENDPOINT_CONTEXT).set(getContext(endpoint));
endpointModel.get(ENDPOINT_CLASS).set(endpoint.getTargetBeanName());
endpointModel.get(ENDPOINT_TYPE).set(endpoint.getType().toString());
endpointModel.get(ENDPOINT_WSDL).set(endpoint.getAddress() + "?wsdl");
}
}
use of org.jboss.as.server.deployment.DeploymentResourceSupport in project wildfly by wildfly.
the class JMSConnectionFactoryDefinitionInjectionSource method startedPooledConnectionFactory.
private void startedPooledConnectionFactory(ResolutionContext context, String name, ServiceBuilder<?> serviceBuilder, ServiceTarget serviceTarget, DeploymentUnit deploymentUnit, Injector<ManagedReferenceFactory> injector) throws DeploymentUnitProcessingException, OperationFailedException {
Map<String, String> props = new HashMap<>(properties);
List<String> connectors = getConnectors(props);
clearUnknownProperties(properties);
ModelNode model = new ModelNode();
for (String connector : connectors) {
model.get(CONNECTORS).add(connector);
}
for (Map.Entry<String, String> entry : properties.entrySet()) {
model.get(entry.getKey()).set(entry.getValue());
}
model.get(MIN_POOL_SIZE.getName()).set(minPoolSize);
model.get(MAX_POOL_SIZE.getName()).set(maxPoolSize);
if (user != null && !user.isEmpty()) {
model.get(ConnectionFactoryAttributes.Pooled.USER.getName()).set(user);
}
if (password != null && !password.isEmpty()) {
model.get(ConnectionFactoryAttributes.Pooled.PASSWORD.getName()).set(password);
}
if (clientId != null && !clientId.isEmpty()) {
model.get(CommonAttributes.CLIENT_ID.getName()).set(clientId);
}
final String discoveryGroupName = properties.containsKey(DISCOVERY_GROUP.getName()) ? properties.get(DISCOVERY_GROUP.getName()) : null;
if (discoveryGroupName != null) {
model.get(DISCOVERY_GROUP.getName()).set(discoveryGroupName);
}
final String jgroupsChannelName = properties.containsKey(JGROUPS_CHANNEL.getName()) ? properties.get(JGROUPS_CHANNEL.getName()) : null;
if (jgroupsChannelName != null) {
model.get(JGROUPS_CHANNEL.getName()).set(jgroupsChannelName);
}
final String managedConnectionPoolClassName = properties.containsKey(MANAGED_CONNECTION_POOL.getName()) ? properties.get(MANAGED_CONNECTION_POOL.getName()) : null;
if (managedConnectionPoolClassName != null) {
model.get(MANAGED_CONNECTION_POOL.getName()).set(managedConnectionPoolClassName);
}
final Boolean enlistmentTrace = properties.containsKey(ENLISTMENT_TRACE.getName()) ? Boolean.valueOf(properties.get(ENLISTMENT_TRACE.getName())) : null;
List<PooledConnectionFactoryConfigProperties> adapterParams = getAdapterParams(model);
String txSupport = transactional ? XA_TX : NO_TX;
final String serverName = getActiveMQServerName(properties);
final String pcfName = uniqueName(context, name);
final ContextNames.BindInfo bindInfo = ContextNames.bindInfoForEnvEntry(context.getApplicationName(), context.getModuleName(), context.getComponentName(), !context.isCompUsesModule(), name);
PooledConnectionFactoryService.installService(serviceTarget, pcfName, serverName, connectors, discoveryGroupName, jgroupsChannelName, adapterParams, bindInfo, txSupport, minPoolSize, maxPoolSize, managedConnectionPoolClassName, enlistmentTrace, true);
final ServiceName referenceFactoryServiceName = ConnectionFactoryReferenceFactoryService.SERVICE_NAME_BASE.append(bindInfo.getBinderServiceName());
serviceBuilder.addDependency(referenceFactoryServiceName, ManagedReferenceFactory.class, injector);
//create the management registration
String managementName = managementName(context, name);
final PathElement serverElement = PathElement.pathElement(SERVER, serverName);
final DeploymentResourceSupport deploymentResourceSupport = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT);
deploymentResourceSupport.getDeploymentSubModel(MessagingExtension.SUBSYSTEM_NAME, serverElement);
final PathElement pcfPath = PathElement.pathElement(POOLED_CONNECTION_FACTORY, managementName);
PathAddress registration = PathAddress.pathAddress(serverElement, pcfPath);
MessagingXmlInstallDeploymentUnitProcessor.createDeploymentSubModel(registration, deploymentUnit);
PooledConnectionFactoryConfigurationRuntimeHandler.INSTANCE.registerResource(serverName, managementName, model);
}
Aggregations