/** * @param element * @return * @see org.jboss.as.controller.registry.Resource#hasChild(org.jboss.as.controller.PathElement) */ public boolean hasChild(PathElement element) { return delegate.hasChild(element); }
/** * @return contextual discard policy if any resource attributes are undefined and has no children; {@link DiscardPolicy#SILENT} otherwise. */ @Override public DiscardPolicy checkResource(TransformationContext context, PathAddress address) { Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS); ImmutableManagementResourceRegistration registration = context.getResourceRegistration(PathAddress.EMPTY_ADDRESS); ModelNode model = resource.getModel(); if (model.isDefined()) { for (String attribute : registration.getAttributeNames(PathAddress.EMPTY_ADDRESS)) { if (model.hasDefined(attribute)) { return this.policy; } } } for (PathElement path : registration.getChildAddresses(PathAddress.EMPTY_ADDRESS)) { if (path.isWildcard() ? resource.hasChildren(path.getKey()) : resource.hasChild(path)) { return this.policy; } } return DiscardPolicy.SILENT; } }
@Override public boolean hasChild(PathElement element) { return delegate.hasChild(element); }
addRequiredChildren(context, this.descriptor.getRequiredChildren(), (Resource parent, PathElement path) -> parent.hasChild(path)); addRequiredChildren(context, this.descriptor.getRequiredSingletonChildren(), (Resource parent, PathElement path) -> parent.hasChildren(path.getKey()));
@Override public boolean hasChild(PathElement element) { return delegate.hasChild(element); }
public static void removeStatisticsResources(Resource datasourceResource) { synchronized (JDBC_STATISTICS) { if (datasourceResource.hasChild(JDBC_STATISTICS)) { datasourceResource.removeChild(JDBC_STATISTICS); } if (datasourceResource.hasChild(POOL_STATISTICS)) { datasourceResource.removeChild(POOL_STATISTICS); } } }
@Override public boolean hasChild(final PathElement element) { if (BALANCER.equals(element.getKey())) { return getChildrenNames(BALANCER).contains(element.getValue()); } return delegate.hasChild(element); }
public static void registerStatisticsResources(Resource datasourceResource) { synchronized (JDBC_STATISTICS) { if (!datasourceResource.hasChild(JDBC_STATISTICS)) { datasourceResource.registerChild(JDBC_STATISTICS, new PlaceholderResource.PlaceholderResourceEntry(JDBC_STATISTICS)); } if (!datasourceResource.hasChild(POOL_STATISTICS)) { datasourceResource.registerChild(POOL_STATISTICS, new PlaceholderResource.PlaceholderResourceEntry(POOL_STATISTICS)); } } }
@Override public boolean hasChild(final PathElement element) { if (BatchJobExecutionResourceDefinition.EXECUTION.equals(element.getKey())) { return hasJobExecution(element.getValue()); } return delegate.hasChild(element); }
@Override public void transformResource(ResourceTransformationContext context, PathAddress address, Resource resource) throws OperationFailedException { if (resource.hasChild(SimpleLoadProviderResourceDefinition.PATH)) { ModelNode model = resource.getModel(); ModelNode simpleModel = Resource.Tools.readModel(resource.removeChild(SimpleLoadProviderResourceDefinition.PATH)); model.get(DeprecatedAttribute.SIMPLE_LOAD_PROVIDER.getName()).set(simpleModel.get(SimpleLoadProviderResourceDefinition.Attribute.FACTOR.getName())); } context.addTransformedResource(PathAddress.EMPTY_ADDRESS, resource).processChildren(resource); } });
static Resource getOrCreate(final Resource parent, final PathAddress address) { Resource current = parent; for (final PathElement element : address) { synchronized (current) { if (current.hasChild(element)) { current = current.requireChild(element); } else { final Resource resource = Resource.Factory.create(); current.registerChild(element, resource); current = resource; } } } return current; }
private static boolean removeInCurrentStep(Resource resource) { for (String childType : resource.getChildTypes()) { for (Resource.ResourceEntry entry : resource.getChildren(childType)) { if (!entry.isRuntime() && resource.hasChild(entry.getPathElement())) { return false; } } } return true; }
.addService(ConnectorServices.WORKMANAGER_SERVICE.append(name), wmService); if (resource.hasChild(PathElement.pathElement(Element.LONG_RUNNING_THREADS.getLocalName()))) { builder.addDependency(ThreadsServices.EXECUTOR.append(WORKMANAGER_LONG_RUNNING).append(name), Executor.class, wmService.getExecutorLongInjector()); if (!resource.hasChild(peLocaldWm)) resource.registerChild(peLocaldWm, wmResource);
@Override public TransformedOperation transformOperation(final TransformationContext context, final PathAddress address, final ModelNode operation) throws OperationFailedException { Resource original = context.readResourceFromRoot(address); String defaultDataStore = original.getModel().get(TimerServiceResourceDefinition.DEFAULT_DATA_STORE.getName()).asString(); boolean hasFileDataStore = original.hasChild(PathElement.pathElement(EJB3SubsystemModel.FILE_DATA_STORE_PATH.getKey(), defaultDataStore)); if (original.getChildren(EJB3SubsystemModel.FILE_DATA_STORE).size() > 1 || !hasFileDataStore) { return new TransformedOperation(operation, new OperationRejectionPolicy() { @Override public boolean rejectOperation(ModelNode preparedResult) { return true; } @Override public String getFailureDescription() { return context.getLogger().getRejectedResourceWarning(address, operation); } }, OperationResultTransformer.ORIGINAL_RESULT); } operation.get(TimerServiceResourceDefinition.THREAD_POOL_NAME.getName()).set(original.getModel().get(TimerServiceResourceDefinition.THREAD_POOL_NAME.getName())); return new TransformedOperation(operation, OperationResultTransformer.ORIGINAL_RESULT); }
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.statisticsEnabled = StackResourceDefinition.Attribute.STATISTICS_ENABLED.resolveModelAttribute(context, model).asBoolean(); Resource resource = context.readResourceFromRoot(this.address, false); Iterator<Resource.ResourceEntry> transports = resource.getChildren(TransportResourceDefinition.WILDCARD_PATH.getKey()).iterator(); if (!transports.hasNext()) { throw JGroupsLogger.ROOT_LOGGER.transportNotDefined(this.getName()); } this.transport = new ServiceSupplierDependency<>(new SingletonProtocolServiceNameProvider(this.address, transports.next().getPathElement())); Set<Resource.ResourceEntry> entries = resource.getChildren(ProtocolResourceDefinition.WILDCARD_PATH.getKey()); this.protocols = new ArrayList<>(entries.size()); for (Resource.ResourceEntry entry : entries) { this.protocols.add(new ServiceSupplierDependency<>(new ProtocolServiceNameProvider(this.address, entry.getPathElement()))); } this.relay = resource.hasChild(RelayResourceDefinition.PATH) ? new ServiceSupplierDependency<>(new SingletonProtocolServiceNameProvider(this.address, RelayResourceDefinition.PATH)) : null; this.socketBindingManager = new ServiceSupplierDependency<>(CommonRequirement.SOCKET_BINDING_MANAGER.getServiceName(context)); return this; }
PathElement ejbPath = PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, "ejb3"); Resource ejbResource = safeGetResource(context, ejbPath); if (ejbResource != null && ejbResource.hasChild(PathElement.pathElement("service", "remote"))) {
if (context.readResourceFromRoot(address.getParent(),false).hasChild(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, "infinispan"))) {
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { boolean rcPresent = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS, false).hasChild(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, RequestControllerExtension.SUBSYSTEM_NAME));
if (context.readResourceFromRoot(parentAddress, false).hasChild(path)) {
if (stackResource.hasChild(RelayResourceDefinition.PATH)) { registration.registerSubModel(this.createProtocolResourceDefinition(RelayConfiguration.PROTOCOL_NAME, RELAY2.class)); resource.registerChild(ProtocolResourceDefinition.pathElement(RelayConfiguration.PROTOCOL_NAME), PlaceholderResource.INSTANCE);