@Override protected PathAddress getParentAddress(PathAddress address) { return address.getParent(); } }
protected StoreServiceConfigurator(PathAddress address, Class<B> builderClass) { super(PERSISTENCE, address); this.builderClass = builderClass; this.async = new ServiceSupplierDependency<>(CacheComponent.STORE_WRITE.getServiceName(address.getParent())); }
JDBCStoreServiceConfigurator(PathAddress address) { super(address, JdbcStringBasedStoreConfigurationBuilder.class); PathAddress cacheAddress = address.getParent(); PathAddress containerAddress = cacheAddress.getParent(); this.table = new ServiceSupplierDependency<>(CacheComponent.STRING_TABLE.getServiceName(cacheAddress)); this.module = new ServiceSupplierDependency<>(CacheContainerComponent.MODULE.getServiceName(containerAddress)); }
@SuppressWarnings("deprecation") @Override public ModelNode transformOperation(ModelNode operation) { PathAddress address = Operations.getPathAddress(operation); String protocol = address.getLastElement().getValue(); PathAddress stackAddress = address.getParent(); ModelNode legacyOperation = Util.createOperation("remove-protocol", stackAddress); legacyOperation.get(AbstractProtocolResourceDefinition.DeprecatedAttribute.TYPE.getName()).set(protocol); return legacyOperation; } };
@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 DiscardPolicy checkResource(TransformationContext context, PathAddress address) { Resource resource = context.readResourceFromRoot(address.getParent()); if (resource.hasChildren(ProxyConfigurationResourceDefinition.WILDCARD_PATH.getKey()) && resource.getChildren(ProxyConfigurationResourceDefinition.WILDCARD_PATH.getKey()).size() > 1) { return DiscardPolicy.REJECT_AND_WARN; } return DiscardPolicy.NEVER; } }
@Override public DiscardPolicy checkResource(TransformationContext context, PathAddress address) { // If this was an auto-generated channel, discard it @SuppressWarnings("deprecation") ModelNode defaultStack = context.readResourceFromRoot(address.getParent()).getModel().get(JGroupsSubsystemResourceDefinition.Attribute.DEFAULT_STACK.getName()); return context.readResourceFromRoot(address).getModel().get(ChannelResourceDefinition.Attribute.STACK.getName()).equals(defaultStack) ? DiscardPolicy.SILENT : DiscardPolicy.NEVER; } };
@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); } } }
@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 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 void execute(OperationContext context, ModelNode operation) { operationDeprecated(context, operation); PathAddress protocolAddress = context.getCurrentAddress().getParent(); String key = context.getCurrentAddressValue(); String value = Operations.getAttributeValue(operation).asString(); ModelNode putOperation = Operations.createMapPutOperation(protocolAddress, AbstractProtocolResourceDefinition.Attribute.PROPERTIES, key, value); context.addStep(putOperation, MapOperations.MAP_PUT_HANDLER, context.getCurrentStage()); } };
@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 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); PathAddress protocolAddress = context.getCurrentAddress().getParent(); String key = context.getCurrentAddressValue(); ModelNode getOperation = Operations.createMapGetOperation(protocolAddress, AbstractProtocolResourceDefinition.Attribute.PROPERTIES, key); context.addStep(getOperation, MapOperations.MAP_GET_HANDLER, context.getCurrentStage()); } };
@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; } }
@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 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 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; } }