本文整理了Java中org.jboss.as.controller.registry.Resource.hasChild
方法的一些代码示例,展示了Resource.hasChild
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.hasChild
方法的具体详情如下:
包路径:org.jboss.as.controller.registry.Resource
类名称:Resource
方法名:hasChild
[英]Determine whether this resource has a child with the given address. In case the PathElement has a wildcard as value, it will determine whether this resource has any resources of a given type.
[中]确定此资源是否有具有给定地址的子级。如果PathElement有一个通配符作为值,它将确定该资源是否有任何给定类型的资源。
代码示例来源:origin: wildfly/wildfly
/**
* @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);
}
代码示例来源:origin: wildfly/wildfly
/**
* @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;
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public boolean hasChild(PathElement element) {
return delegate.hasChild(element);
}
代码示例来源:origin: wildfly/wildfly
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()));
代码示例来源:origin: wildfly/wildfly
@Override
public boolean hasChild(PathElement element) {
return delegate.hasChild(element);
}
代码示例来源:origin: wildfly/wildfly
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);
}
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public boolean hasChild(final PathElement element) {
if (BALANCER.equals(element.getKey())) {
return getChildrenNames(BALANCER).contains(element.getValue());
}
return delegate.hasChild(element);
}
代码示例来源:origin: wildfly/wildfly
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));
}
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public boolean hasChild(final PathElement element) {
if (BatchJobExecutionResourceDefinition.EXECUTION.equals(element.getKey())) {
return hasJobExecution(element.getValue());
}
return delegate.hasChild(element);
}
代码示例来源:origin: wildfly/wildfly
@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);
}
});
代码示例来源:origin: wildfly/wildfly
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;
}
代码示例来源:origin: wildfly/wildfly
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;
}
代码示例来源:origin: wildfly/wildfly
.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);
代码示例来源:origin: wildfly/wildfly
@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);
}
代码示例来源:origin: wildfly/wildfly
@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;
}
代码示例来源:origin: wildfly/wildfly
PathElement ejbPath = PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, "ejb3");
Resource ejbResource = safeGetResource(context, ejbPath);
if (ejbResource != null && ejbResource.hasChild(PathElement.pathElement("service", "remote"))) {
代码示例来源:origin: wildfly/wildfly
if (context.readResourceFromRoot(address.getParent(),false).hasChild(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, "infinispan"))) {
代码示例来源:origin: wildfly/wildfly
@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));
代码示例来源:origin: wildfly/wildfly
if (context.readResourceFromRoot(parentAddress, false).hasChild(path)) {
代码示例来源:origin: wildfly/wildfly
if (stackResource.hasChild(RelayResourceDefinition.PATH)) {
registration.registerSubModel(this.createProtocolResourceDefinition(RelayConfiguration.PROTOCOL_NAME, RELAY2.class));
resource.registerChild(ProtocolResourceDefinition.pathElement(RelayConfiguration.PROTOCOL_NAME), PlaceholderResource.INSTANCE);
内容来源于网络,如有侵权,请联系作者删除!