@Override public void removeServices(OperationContext context, ModelNode model) throws OperationFailedException { PathAddress address = context.getCurrentAddress(); for (Capability capability : EnumSet.allOf(Capability.class)) { context.removeService(capability.getServiceName(address)); } } }
@Override public void execute(OperationContext context, ModelNode operation) { operationDeprecated(context, operation); context.createResource(PathAddress.EMPTY_ADDRESS); String name = context.getCurrentAddressValue(); String value = operation.get(VALUE.getName()).asString(); PathAddress storeAddress = context.getCurrentAddress().getParent(); ModelNode putOperation = Operations.createMapPutOperation(storeAddress, StoreResourceDefinition.Attribute.PROPERTIES, name, value); context.addStep(putOperation, MapOperations.MAP_PUT_HANDLER, context.getCurrentStage()); } };
@Override protected void recordCapabilitiesAndRequirements(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { super.recordCapabilitiesAndRequirements(context, operation, resource); String ourCap = HOST_CAPABILITY.getDynamicName(context.getCurrentAddress()); String serverCap = SERVER_CAPABILITY.getDynamicName(context.getCurrentAddress().getParent()); context.registerAdditionalCapabilityRequirement(serverCap, ourCap, null); }
@Override public void execute(OperationContext context, ModelNode operation) { operationDeprecated(context, operation); context.removeResource(PathAddress.EMPTY_ADDRESS); String name = context.getCurrentAddressValue(); PathAddress protocolAddress = context.getCurrentAddress().getParent(); ModelNode putOperation = Operations.createMapRemoveOperation(protocolAddress, AbstractProtocolResourceDefinition.Attribute.PROPERTIES, name); context.addStep(putOperation, MapOperations.MAP_REMOVE_HANDLER, context.getCurrentStage()); } };
@Override public void execute(OperationContext context, ModelNode legacyOperation) { String value = legacyOperation.get(ALIAS.getName()).asString(); ModelNode operation = Operations.createListAddOperation(context.getCurrentAddress(), Attribute.ALIASES, value); context.addStep(operation, ListOperations.LIST_ADD_HANDLER, context.getCurrentStage()); } };
@Override public void execute(OperationContext context, ModelNode operation) { operationDeprecated(context, operation); context.removeResource(PathAddress.EMPTY_ADDRESS); String name = context.getCurrentAddressValue(); PathAddress storeAddress = context.getCurrentAddress().getParent(); ModelNode putOperation = Operations.createMapRemoveOperation(storeAddress, StoreResourceDefinition.Attribute.PROPERTIES, name); context.addStep(putOperation, MapOperations.MAP_REMOVE_HANDLER, context.getCurrentStage()); } };
@Override public void removeServices(OperationContext context, ModelNode model) throws OperationFailedException { context.removeService(this.factory.createServiceConfigurator(context.getCurrentAddress()).getServiceName()); } }
@Override public void installServices(OperationContext context, ModelNode model) throws OperationFailedException { super.installServices(context, model); PathAddress address = context.getCurrentAddress(); String name = context.getCurrentAddressValue(); ServiceTarget target = context.getServiceTarget(); new ModuleServiceConfigurator(RemoteCacheContainerComponent.MODULE.getServiceName(address), MODULE).configure(context, model).build(target).setInitialMode(ServiceController.Mode.PASSIVE).install(); ServiceConfigurator containerBuilder = new RemoteCacheContainerServiceConfigurator(address).configure(context, model); containerBuilder.build(target).install(); new BinderServiceConfigurator(InfinispanBindingFactory.createRemoteCacheContainerBinding(name), containerBuilder.getServiceName()).build(target).install(); }
private static String getRuntimeName(final OperationContext context, final PathElement element) { final ModelNode deploymentModel = context.readResourceFromRoot(PathAddress.pathAddress(element), false).getModel(); if (!deploymentModel.hasDefined(ModelDescriptionConstants.RUNTIME_NAME)) { throw BatchLogger.LOGGER.couldNotFindDeploymentName(context.getCurrentAddress().toString()); } return deploymentModel.get(ModelDescriptionConstants.RUNTIME_NAME).asString(); } }
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { // Log that this is deprecated ConnectorLogger.ROOT_LOGGER.legacyDisableEnableOperation(operation.get(OP).asString()); // Just delegate to write-attribute. ModelNode writeAttributeOp = getWriteAttributeOperation(context.getCurrentAddress(), Constants.ENABLED.getName(), enabled); OperationStepHandler writeHandler = context.getResourceRegistration().getOperationHandler(PathAddress.EMPTY_ADDRESS, WRITE_ATTRIBUTE_OPERATION); // set the addFirst param to 'true' so the write-attribute runs before any other steps already registered; // i.e. in the logically equivalent spot in the sequence to this step context.addStep(writeAttributeOp, writeHandler, OperationContext.Stage.MODEL, true); } }
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.siteName = SITE.resolveModelAttribute(context, model).asString(); PathAddress address = context.getCurrentAddress(); Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS); Set<Resource.ResourceEntry> entries = resource.getChildren(RemoteSiteResourceDefinition.WILDCARD_PATH.getKey()); this.sites = new ArrayList<>(entries.size()); for (Resource.ResourceEntry entry : entries) { this.sites.add(new ServiceSupplierDependency<>(new RemoteSiteServiceNameProvider(address, entry.getPathElement()))); } return super.configure(context, model); }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { PathAddress address = context.getCurrentAddress(); Resource parentResource = context.readResourceFromRoot(address.getParent(), false); if (!this.present.test(parentResource, address.getLastElement())) { context.getResourceRegistration().getOperationHandler(PathAddress.EMPTY_ADDRESS, ModelDescriptionConstants.ADD).execute(context, operation); } } }
private void recordCapabilitiesAndRequirements(OperationContext context, Resource resource) throws OperationFailedException { context.deregisterCapability(MailServerDefinition.SERVER_CAPABILITY.getDynamicName(context.getCurrentAddress())); ModelNode model = resource.getModel(); for (AttributeDefinition ad : attributes) { if (ad != null && (model.hasDefined(ad.getName()) || ad.hasCapabilityRequirements())) { ad.removeCapabilityRequirements(context, resource, model.get(ad.getName())); } } }
@Override public void execute(OperationContext context, ModelNode operation) { operationDeprecated(context, operation); PathAddress address = context.getCurrentAddress(); String protocol = operation.require(AbstractProtocolResourceDefinition.DeprecatedAttribute.TYPE.getName()).asString(); PathElement protocolPath = ProtocolResourceDefinition.pathElement(protocol); PathAddress protocolAddress = address.append(protocolPath); ModelNode removeOperation = Util.createRemoveOperation(protocolAddress); context.addStep(removeOperation, context.getResourceRegistration().getOperationHandler(PathAddress.pathAddress(protocolPath), ModelDescriptionConstants.REMOVE), context.getCurrentStage()); } };
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) { final PathAddress hostAddress = context.getCurrentAddress().getParent(); final PathAddress serverAddress = hostAddress.getParent(); final String hostName = hostAddress.getLastElement().getValue(); final String serverName = serverAddress.getLastElement().getValue(); final ServiceName serviceName = UndertowService.accessLogServiceName(serverName, hostName); context.removeService(serviceName); }
@Override public ModelNode execute(OperationContext context, Metric<Cache<?, ?>> metric) throws OperationFailedException { PathAddress cacheAddress = context.getCurrentAddress().getParent(); String containerName = cacheAddress.getParent().getLastElement().getValue(); String cacheName = cacheAddress.getLastElement().getValue(); Cache<?, ?> cache = new PassiveServiceSupplier<Cache<?, ?>>(context.getServiceRegistry(true), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName)).get(); return (cache != null) ? metric.execute(cache) : null; } }
@Override public ModelNode execute(OperationContext context, ModelNode operation, Operation<AdvancedCache<?, ?>> executable) throws OperationFailedException { PathAddress address = context.getCurrentAddress(); PathAddress cacheAddress = address.getParent(); String cacheName = cacheAddress.getLastElement().getValue(); String containerName = cacheAddress.getParent().getLastElement().getValue(); Cache<?, ?> cache = new PassiveServiceSupplier<Cache<?, ?>>(context.getServiceRegistry(true), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName)).get(); return (cache != null) ? executable.execute(context, operation, cache.getAdvancedCache()) : null; } }
@Override public ModelNode execute(OperationContext context, Metric<AdvancedCache<?, ?>> metric) throws OperationFailedException { PathAddress cacheAddress = context.getCurrentAddress().getParent(); String containerName = cacheAddress.getParent().getLastElement().getValue(); String cacheName = cacheAddress.getLastElement().getValue(); Cache<?, ?> cache = new PassiveServiceSupplier<Cache<?, ?>>(context.getServiceRegistry(true), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName)).get(); return (cache != null) ? metric.execute(cache.getAdvancedCache()) : null; } }
@Override public ModelNode execute(OperationContext context, Metric<RpcManagerImpl> metric) throws OperationFailedException { PathAddress address = context.getCurrentAddress(); String containerName = address.getParent().getLastElement().getValue(); String cacheName = address.getLastElement().getValue(); Cache<?, ?> cache = new PassiveServiceSupplier<Cache<?, ?>>(context.getServiceRegistry(true), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName)).get(); return (cache != null) ? metric.execute((RpcManagerImpl) cache.getAdvancedCache().getRpcManager()) : null; } }
@Override public ModelNode execute(OperationContext context, Metric<DefaultLockManager> metric) throws OperationFailedException { PathAddress cacheAddress = context.getCurrentAddress().getParent(); String containerName = cacheAddress.getParent().getLastElement().getValue(); String cacheName = cacheAddress.getLastElement().getValue(); Cache<?, ?> cache = new PassiveServiceSupplier<Cache<?, ?>>(context.getServiceRegistry(true), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName)).get(); return (cache != null) ? metric.execute((DefaultLockManager) cache.getAdvancedCache().getLockManager()) : null; } }