本文整理汇总了Java中org.jboss.as.controller.registry.Resource.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java Resource.getChildren方法的具体用法?Java Resource.getChildren怎么用?Java Resource.getChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.as.controller.registry.Resource
的用法示例。
在下文中一共展示了Resource.getChildren方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doIterate
import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
private void doIterate(final Resource current, final PathAddress address) {
boolean handleChildren = false;
ObjectName resourceObjectName = action.onAddress(address);
if (resourceObjectName != null &&
(accessControlUtil == null || accessControlUtil.getResourceAccess(address, false).isAccessibleResource())) {
handleChildren = action.onResource(resourceObjectName);
}
if (handleChildren) {
for (String type : current.getChildTypes()) {
if (current.hasChildren(type)) {
for (ResourceEntry entry : current.getChildren(type)) {
final PathElement pathElement = entry.getPathElement();
final PathAddress childAddress = address.append(pathElement);
doIterate(entry, childAddress);
}
}
}
}
}
示例2: validateRuntimeNames
import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
static void validateRuntimeNames(String deploymentName, OperationContext context, PathAddress address) throws OperationFailedException {
ModelNode deployment = context.readResource(PathAddress.EMPTY_ADDRESS).getModel();
if (ENABLED.resolveModelAttribute(context, deployment).asBoolean()) {
Resource root = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS);
ModelNode domainDeployment = root.getChild(PathElement.pathElement(DEPLOYMENT, deploymentName)).getModel();
String runtimeName = getRuntimeName(deploymentName, deployment, domainDeployment);
PathAddress sgAddress = address.subAddress(0, address.size() - 1);
Resource serverGroup = root.navigate(sgAddress);
for (Resource.ResourceEntry re : serverGroup.getChildren(DEPLOYMENT)) {
String reName = re.getName();
if (!deploymentName.equals(reName)) {
ModelNode otherDepl = re.getModel();
if (ENABLED.resolveModelAttribute(context, otherDepl).asBoolean()) {
domainDeployment = root.getChild(PathElement.pathElement(DEPLOYMENT, reName)).getModel();
String otherRuntimeName = getRuntimeName(reName, otherDepl, domainDeployment);
if (runtimeName.equals(otherRuntimeName)) {
throw DomainControllerLogger.ROOT_LOGGER.runtimeNameMustBeUnique(reName, runtimeName, sgAddress.getLastElement().getValue());
}
}
}
}
}
}
示例3: describe
import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
private void describe(final PathAddress base, final Resource resource, List<ModelNode> nodes, boolean isRuntimeChange) {
if (resource.isProxy() || resource.isRuntime()) {
return; // ignore runtime and proxies
} else if (base.size() >= 1 && base.getElement(0).getKey().equals(ModelDescriptionConstants.HOST)) {
return; // ignore hosts
}
if (base.size() == 1) {
newRootResources.add(base.getLastElement());
}
final ModelNode description = new ModelNode();
description.get(DOMAIN_RESOURCE_ADDRESS).set(base.toModelNode());
description.get(DOMAIN_RESOURCE_MODEL).set(resource.getModel());
Set<String> orderedChildren = resource.getOrderedChildTypes();
if (orderedChildren.size() > 0) {
ModelNode orderedChildTypes = description.get(DOMAIN_RESOURCE_PROPERTIES, ORDERED_CHILD_TYPES_PROPERTY);
for (String type : orderedChildren) {
orderedChildTypes.add(type);
}
}
nodes.add(description);
for (final String childType : resource.getChildTypes()) {
for (final Resource.ResourceEntry entry : resource.getChildren(childType)) {
describe(base.append(entry.getPathElement()), entry, nodes, isRuntimeChange);
}
}
}
示例4: processHostModel
import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
static void processHostModel(final RequiredConfigurationHolder holder, final Resource domain, final Resource hostModel, ExtensionRegistry extensionRegistry) {
final Set<String> serverGroups = holder.serverGroups;
for (final Resource.ResourceEntry entry : hostModel.getChildren(SERVER_CONFIG)) {
final ModelNode model = entry.getModel();
final String serverGroup = model.get(GROUP).asString();
if (!serverGroups.contains(serverGroup)) {
serverGroups.add(serverGroup);
}
if (model.hasDefined(SOCKET_BINDING_GROUP)) {
final String socketBindingGroup = model.get(SOCKET_BINDING_GROUP).asString();
processSocketBindingGroup(domain, socketBindingGroup, holder);
}
// Always process the server group, since it may be different between the current vs. original model
processServerGroup(holder, serverGroup, domain, extensionRegistry);
}
}
示例5: execute
import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
final PathAddress address = context.getCurrentAddress();
final String connectorName = address.getLastElement().getValue();
PathAddress parentAddress = address.getParent();
Resource parent = context.readResourceFromRoot(parentAddress, false);
Resource resource = context.readResourceFromRoot(address, false);
ModelNode resourceRef = resource.getModel().get(CommonAttributes.CONNECTOR_REF);
boolean listenerAlreadyExists = false;
for(Resource.ResourceEntry child: parent.getChildren(CommonAttributes.HTTP_CONNECTOR)) {
if(!connectorName.equals(child.getName())) {
Resource childResource = context.readResourceFromRoot(PathAddress.pathAddress(parentAddress, child.getPathElement()), false);
if(childResource.getModel().get(CommonAttributes.CONNECTOR_REF).equals(resourceRef)) {
listenerAlreadyExists = true;
break;
}
}
}
if(listenerAlreadyExists) {
throw ControllerLogger.ROOT_LOGGER.alreadyDefinedAttribute(CommonAttributes.HTTP_CONNECTOR, resourceRef.asString(), CommonAttributes.CONNECTOR_REF);
}
}
示例6: addAllAddresses
import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
private void addAllAddresses(ImmutableManagementResourceRegistration mrr, PathAddress current, Resource resource, Set<PathAddress> addresses) {
addresses.add(current);
for (String name : getNonIgnoredChildTypes(mrr)) {
for (ResourceEntry entry : resource.getChildren(name)) {
if (!entry.isProxy() && !entry.isRuntime()) {
addAllAddresses(mrr.getSubModel(PathAddress.pathAddress(entry.getPathElement())), current.append(entry.getPathElement()), entry, addresses);
}
}
}
}
示例7: readModelRecursively
import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
private ModelNode readModelRecursively(Resource resource) {
ModelNode model = new ModelNode();
model.set(resource.getModel().clone());
for (String type : resource.getChildTypes()) {
for (ResourceEntry entry : resource.getChildren(type)) {
model.get(type, entry.getName()).set(readModelRecursively(entry));
}
}
return model;
}
示例8: checkNoOtherProtocol
import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
private void checkNoOtherProtocol(OperationContext context, ModelNode operation) throws OperationFailedException {
PathAddress opAddr = PathAddress.pathAddress(operation.require(OP_ADDR));
PathAddress addr = opAddr.subAddress(0, opAddr.size() - 1);
Resource resource = context.readResourceFromRoot(addr);
Set<ResourceEntry> existing = resource.getChildren(PROTOCOL);
if (existing.size() > 1) {
for (ResourceEntry entry : existing) {
PathElement mine = addr.getLastElement();
if (!entry.getPathElement().equals(mine)) {
throw DomainManagementLogger.ROOT_LOGGER.sysLogProtocolAlreadyConfigured(addr.append(mine));
}
}
}
}
示例9: installService
import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
public static final SyslogAuditLogHandlerService installService(OperationContext context, ServiceName serviceName, final Resource handlerResource) throws OperationFailedException {
SyslogAuditLogHandlerService service = new SyslogAuditLogHandlerService();
ServiceBuilder<SyslogAuditLogHandlerService> serviceBuilder = context.getServiceTarget().addService(serviceName, service);
final Set<ResourceEntry> protocols = handlerResource.getChildren(PROTOCOL);
if (protocols.isEmpty()) {
//We already check in SyslogAuditLogProtocolResourceDefinition that there is only one protocol
throw DomainManagementLogger.ROOT_LOGGER.noSyslogProtocol();
}
final ResourceEntry protocol = protocols.iterator().next();
final SyslogAuditLogHandler.Transport transport = SyslogAuditLogHandler.Transport.valueOf(protocol.getPathElement().getValue().toUpperCase(Locale.ENGLISH));
if (transport == SyslogAuditLogHandler.Transport.TLS) {
final Set<ResourceEntry> tlsStores = protocol.getChildren(AUTHENTICATION);
for (ResourceEntry storeEntry : tlsStores) {
final ModelNode storeModel = storeEntry.getModel();
String type = storeEntry.getPathElement().getValue();
if (type.equals(CLIENT_CERT_STORE)) {
if (storeModel.hasDefined(TlsKeyStore.KEY_PASSWORD_CREDENTIAL_REFERENCE.getName())) {
service.tlsClientCertStoreKeyCredentialSourceSupplier
.inject(CredentialReference.getCredentialSourceSupplier(context, TlsKeyStore.KEY_PASSWORD_CREDENTIAL_REFERENCE, storeModel, serviceBuilder));
}
if (storeModel.hasDefined(TlsKeyStore.KEYSTORE_PASSWORD_CREDENTIAL_REFERENCE.getName())) {
service.tlsClientCertStoreCredentialSourceSupplier
.inject(CredentialReference.getCredentialSourceSupplier(context, TlsKeyStore.KEYSTORE_PASSWORD_CREDENTIAL_REFERENCE, storeModel, serviceBuilder));
}
} else if (type.equals(TRUSTSTORE)) {
if (storeModel.hasDefined(TlsKeyStore.KEYSTORE_PASSWORD_CREDENTIAL_REFERENCE.getName())) {
service.tlsTrustStoreSupplier
.inject(CredentialReference.getCredentialSourceSupplier(context, TlsKeyStore.KEYSTORE_PASSWORD_CREDENTIAL_REFERENCE, storeModel, serviceBuilder));
}
}
}
}
serviceBuilder.install();
return service;
}
示例10: checkFormatterNotReferenced
import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
private void checkFormatterNotReferenced(String name, Resource auditLog, String...handlerTypes) throws OperationFailedException {
for (String handlerType : handlerTypes) {
for (ResourceEntry entry : auditLog.getChildren(handlerType)) {
ModelNode auditLogModel = entry.getModel();
if (auditLogModel.get(FORMATTER).asString().equals(name)) {
throw DomainManagementLogger.ROOT_LOGGER.cannotRemoveReferencedFormatter(entry.getPathElement());
}
}
}
}
示例11: processChildren
import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Override
public void processChildren(final Resource resource) throws OperationFailedException {
final Set<String> types = resource.getChildTypes();
for (final String type : types) {
for (final Resource.ResourceEntry child : resource.getChildren(type)) {
processChild(child.getPathElement(), child);
}
}
}
示例12: ignoreExtension
import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
private boolean ignoreExtension(final Resource domainResource, final Collection<ServerConfigInfo> serverConfigs, final String name) {
//Should these be the subsystems on the master, as we have it at present, or the ones from the slave?
Map<String, SubsystemInformation> subsystems = extensionRegistry.getAvailableSubsystems(name);
for (String subsystem : subsystems.keySet()) {
for (ResourceEntry profileEntry : domainResource.getChildren(PROFILE)) {
if (profileEntry.hasChild(PathElement.pathElement(SUBSYSTEM, subsystem))) {
if (!ignoreProfile(domainResource, serverConfigs, profileEntry.getName())) {
return false;
}
}
}
}
return true;
}
示例13: getServerConfigsOnSlave
import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
/**
* For use on a slave HC to get all the server groups used by the host
*
* @param hostResource the host resource
* @return the server configs on this host
*/
public Set<ServerConfigInfo> getServerConfigsOnSlave(Resource hostResource){
Set<ServerConfigInfo> groups = new HashSet<>();
for (ResourceEntry entry : hostResource.getChildren(SERVER_CONFIG)) {
groups.add(new ServerConfigInfoImpl(entry.getModel()));
}
return groups;
}
示例14: readResourceFromRoot
import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Override
Resource readResourceFromRoot(ManagementModel managementModel, PathAddress address, boolean recursive) {
//
// TODO double check authorization checks for this!
//
Resource model = managementModel.getRootResource();
final Iterator<PathElement> iterator = address.iterator();
while(iterator.hasNext()) {
final PathElement element = iterator.next();
// Allow wildcard navigation for the last element
if(element.isWildcard() && ! iterator.hasNext()) {
final Set<Resource.ResourceEntry> children = model.getChildren(element.getKey());
if(children.isEmpty()) {
final PathAddress parent = address.subAddress(0, address.size() -1);
final Set<String> childrenTypes = managementModel.getRootResourceRegistration().getChildNames(parent);
if(! childrenTypes.contains(element.getKey())) {
throw ControllerLogger.ROOT_LOGGER.managementResourceNotFound(address);
}
// Return an empty model
return Resource.Factory.create();
}
model = Resource.Factory.create();
for(final Resource.ResourceEntry entry : children) {
model.registerChild(entry.getPathElement(), entry);
}
} else {
model = requireChild(model, element, address);
}
}
if(recursive) {
return model.clone();
} else {
return model.shallowCopy();
}
}
示例15: checkProfileIncludes
import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
private Set<String> checkProfileIncludes(Resource domain, Set<String> missingProfiles) throws OperationFailedException {
ProfileIncludeValidator validator = new ProfileIncludeValidator();
for (ResourceEntry entry : domain.getChildren(PROFILE)) {
validator.processResource(entry);
}
validator.validate(missingProfiles);
return validator.resourceIncludes.keySet();
}