use of org.jboss.msc.service.ServiceRegistry in project teiid by teiid.
the class TransportRemove method performRuntime.
@Override
protected void performRuntime(OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException {
final ModelNode address = operation.require(OP_ADDR);
final PathAddress pathAddress = PathAddress.pathAddress(address);
String transportName = pathAddress.getLastElement().getValue();
final ServiceRegistry serviceRegistry = context.getServiceRegistry(true);
ServiceName serviceName = TeiidServiceNames.transportServiceName(transportName);
final ServiceController<?> controller = serviceRegistry.getService(serviceName);
if (controller != null) {
TransportService transport = TransportService.class.cast(controller.getValue());
if (transport.isLocal()) {
final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(LocalServerConnection.jndiNameForRuntime(transportName));
context.removeService(bindInfo.getBinderServiceName());
// $NON-NLS-1$
context.removeService(TeiidServiceNames.localTransportServiceName(transportName).append("reference-factory"));
}
context.removeService(serviceName);
}
}
use of org.jboss.msc.service.ServiceRegistry in project teiid by teiid.
the class TranslatorDeployer method undeploy.
@Override
public void undeploy(final DeploymentUnit context) {
if (!TeiidAttachments.isTranslator(context)) {
return;
}
VDBTranslatorMetaData metadata = context.getAttachment(TeiidAttachments.TRANSLATOR_METADATA);
if (metadata == null) {
return;
}
final ServiceRegistry registry = context.getServiceRegistry();
final ServiceName serviceName = TeiidServiceNames.translatorServiceName(metadata.getName());
final ServiceController<?> controller = registry.getService(serviceName);
if (controller != null) {
controller.setMode(Mode.REMOVE);
}
}
use of org.jboss.msc.service.ServiceRegistry in project teiid by teiid.
the class TranslatorRemove method performRuntime.
@Override
protected void performRuntime(OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException {
final ModelNode address = operation.require(OP_ADDR);
final PathAddress pathAddress = PathAddress.pathAddress(address);
String translatorName = pathAddress.getLastElement().getValue();
final ServiceRegistry registry = context.getServiceRegistry(true);
final ServiceName serviceName = TeiidServiceNames.translatorServiceName(translatorName);
final ServiceController<?> controller = registry.getService(serviceName);
if (controller != null) {
context.removeService(serviceName);
}
}
use of org.jboss.msc.service.ServiceRegistry in project wildfly by wildfly.
the class EJBDefaultDistinctNameWriteHandler method updateDefaultDistinctName.
void updateDefaultDistinctName(final OperationContext context, final ModelNode model) throws OperationFailedException {
final ModelNode defaultDistinctName = this.attributeDefinition.resolveModelAttribute(context, model);
final ServiceRegistry registry = context.getServiceRegistry(true);
final ServiceController<?> existingDefaultLocalEJBReceiverServiceController = registry.getService(DefaultDistinctNameService.SERVICE_NAME);
DefaultDistinctNameService service = (DefaultDistinctNameService) existingDefaultLocalEJBReceiverServiceController.getValue();
if (!defaultDistinctName.isDefined()) {
service.setDefaultDistinctName(null);
} else {
service.setDefaultDistinctName(defaultDistinctName.asString());
}
}
use of org.jboss.msc.service.ServiceRegistry in project wildfly by wildfly.
the class EnableGracefulTxnShutdownWriteHandler method applyModelToRuntime.
private void applyModelToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode model) throws OperationFailedException {
String name = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue();
ServiceRegistry registry = context.getServiceRegistry(true);
EJBSuspendHandlerService service = (EJBSuspendHandlerService) registry.getRequiredService(EJBSuspendHandlerService.SERVICE_NAME).getValue();
if (service != null && this.gracefulTxnShutdownAttribute.getName().equals(attributeName)) {
boolean enableGracefulTxnShutdown = this.gracefulTxnShutdownAttribute.resolveModelAttribute(context, model).asBoolean();
service.enableGracefulTxnShutdown(enableGracefulTxnShutdown);
}
}
Aggregations