org.jboss.as.controller.registry.Resource.registerChild()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(77)

本文整理了Java中org.jboss.as.controller.registry.Resource.registerChild方法的一些代码示例,展示了Resource.registerChild的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.registerChild方法的具体详情如下:
包路径:org.jboss.as.controller.registry.Resource
类名称:Resource
方法名:registerChild

Resource.registerChild介绍

[英]Register a child resource
[中]注册子资源

代码示例

代码示例来源:origin: wildfly/wildfly

/**
 * @param address
 * @param resource
 * @see org.jboss.as.controller.registry.Resource#registerChild(org.jboss.as.controller.PathElement,
 *      org.jboss.as.controller.registry.Resource)
 */
public void registerChild(PathElement address, Resource resource) {
  delegate.registerChild(address, resource);
}

代码示例来源:origin: wildfly/wildfly

@Override
public void registerChild(PathElement address, Resource resource) {
  assert resource instanceof LogStoreRuntimeResource;
  delegate.registerChild(address, resource);
}

代码示例来源:origin: wildfly/wildfly

@Override
public void registerChild(PathElement address, Resource resource) {
  assert resource instanceof IronJacamarRuntimeResource;
  delegate.registerChild(address, resource);
}

代码示例来源:origin: wildfly/wildfly

@Override
public void registerChild(final PathElement address, final Resource resource) {
  final String type = address.getKey();
  if (BALANCER.equals(type)) {
    throw UndertowLogger.ROOT_LOGGER.cannotRegisterResourceOfType(type);
  }
  delegate.registerChild(address, resource);
}

代码示例来源:origin: wildfly/wildfly

@Override
public void registerChild(PathElement address, int index, Resource resource) {
  final String type = address.getKey();
  if (BALANCER.equals(type)) {
    throw UndertowLogger.ROOT_LOGGER.cannotRegisterResourceOfType(type);
  }
  delegate.registerChild(address, index, resource);
}

代码示例来源:origin: wildfly/wildfly

@Override
public void registerChild(final PathElement address, final Resource resource) {
  final String type = address.getKey();
  if (BatchJobExecutionResourceDefinition.EXECUTION.equals(type)) {
    throw BatchLogger.LOGGER.cannotRemoveResourceOfType(type);
  }
  delegate.registerChild(address, resource);
}

代码示例来源: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

public void timerCreated(String id) {
  PathElement address = PathElement.pathElement(EJB3SubsystemModel.TIMER, id);
  this.delegate.registerChild(address, Resource.Factory.create());
}

代码示例来源:origin: wildfly/wildfly

private void addParticipants(final Resource parent, Set<ObjectInstance> participants, MBeanServer mbs)
    throws IntrospectionException, InstanceNotFoundException, IOException, ReflectionException {
  int i = 1;
  for (ObjectInstance participant : participants) {
    final Resource resource = new LogStoreResource.LogStoreRuntimeResource(participant.getObjectName());
    final ModelNode model = resource.getModel();
    Map<String, String> pAttributes = getMBeanValues(mbs,  participant.getObjectName(),
        LogStoreConstants.PARTICIPANT_JMX_NAMES);
    String pAddress = pAttributes.get(JNDI_PROPNAME);
    if (pAddress == null || pAddress.length() == 0) {
      pAttributes.put(JNDI_PROPNAME, String.valueOf(i++));
      pAddress = pAttributes.get(JNDI_PROPNAME);
    }
    addAttributes(model, LogStoreConstants.MODEL_TO_JMX_PARTICIPANT_NAMES, pAttributes);
    // model.get(LogStoreConstants.JMX_ON_ATTRIBUTE).set(participant.getObjectName().getCanonicalName());
    final PathElement element = PathElement.pathElement(LogStoreConstants.PARTICIPANTS, pAddress);
    parent.registerChild(element, resource);
  }
}

代码示例来源:origin: wildfly/wildfly

private void addConfigProperties(final Resource parent, String name, String value) {
  final Resource config = new IronJacamarResource.IronJacamarRuntimeResource();
  final ModelNode model = config.getModel();
  model.get(Constants.CONFIG_PROPERTY_VALUE.getName()).set(value);
  final PathElement element = PathElement.pathElement(Constants.CONFIG_PROPERTIES.getName(), name);
  parent.registerChild(element, config);
}

代码示例来源:origin: wildfly/wildfly

private void addTransactions(final Resource parent, Set<ObjectInstance> transactions, MBeanServer mbs)
    throws IntrospectionException, InstanceNotFoundException, IOException,
    ReflectionException, MalformedObjectNameException {
  for (ObjectInstance oi : transactions) {
    String transactionId = oi.getObjectName().getCanonicalName();
    if (!transactionId.contains("puid") && transactionId.contains("itype")) {
      final Resource transaction = new LogStoreResource.LogStoreRuntimeResource(oi.getObjectName());
      final ModelNode model = transaction.getModel();
      Map<String, String> tAttributes = getMBeanValues(
          mbs,  oi.getObjectName(), LogStoreConstants.TXN_JMX_NAMES);
      String txnId = tAttributes.get("Id");
      addAttributes(model, LogStoreConstants.MODEL_TO_JMX_TXN_NAMES, tAttributes);
      // model.get(LogStoreConstants.JMX_ON_ATTRIBUTE).set(transactionId);
      String participantQuery =  transactionId + ",puid=*";
      Set<ObjectInstance> participants = mbs.queryMBeans(new ObjectName(participantQuery), null);
      addParticipants(transaction, participants, mbs);
      final PathElement element = PathElement.pathElement(LogStoreConstants.TRANSACTIONS, txnId);
      parent.registerChild(element, transaction);
    }
  }
}

代码示例来源: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

public void execute(Resource parentResource, AS7MetadataRepository mdr, String name) {
  // Get the iron-jacamar resource
  final IronJacamarResource ironJacamarResource = new IronJacamarResource();
  // Replace the current model with an updated one
  final Resource storeModel = getIronJacamarResource(mdr, name);
  ironJacamarResource.update(storeModel);
  PathElement ijPe = PathElement.pathElement(Constants.IRONJACAMAR_NAME, Constants.IRONJACAMAR_NAME);
  if (parentResource.getChild(ijPe) == null) {
    parentResource.registerChild(ijPe, ironJacamarResource);
  }
}

代码示例来源:origin: wildfly/wildfly

resource.registerChild(peLocaldWm, wmResource);

代码示例来源:origin: wildfly/wildfly

@Override
  protected void initializeExtraSubystemsAndModel(ExtensionRegistry registry, Resource root, ManagementResourceRegistration registration, RuntimeCapabilityRegistry capabilityRegistry) {
    new JGroupsExtension().initialize(registry.getExtensionContext("jgroups", registration, ExtensionRegistryType.MASTER));

    Resource subsystem = Resource.Factory.create();
    // Need to use explicit names here due to signature change ("NoSuchMethodError: org.jboss.as.clustering.jgroups.subsystem.JGroupsSubsystemResourceDefinition$Attribute.getName()Ljava/lang/String;")
    subsystem.getModel().get("default-stack").set("tcp");
    subsystem.getModel().get("default-channel").set("maximal-channel");
    root.registerChild(JGroupsSubsystemResourceDefinition.PATH, subsystem);

    Resource channel = Resource.Factory.create();
    subsystem.registerChild(ChannelResourceDefinition.pathElement("maximal-channel"), channel);

    Resource stack = Resource.Factory.create();
    subsystem.registerChild(StackResourceDefinition.pathElement("tcp"), stack);

    Resource transport = Resource.Factory.create();
    stack.registerChild(TransportResourceDefinition.pathElement("TCP"), transport);

    super.initializeExtraSubystemsAndModel(registry, root, registration, capabilityRegistry);
  }
}

代码示例来源:origin: wildfly/wildfly

subModel.get(Constants.WM_SECURITY_MAPPING_TO.getName()).set(entry.getKey());
      final PathElement element = PathElement.pathElement(Constants.WM_SECURITY_MAPPING_GROUPS.getName(), WM_SECURITY_MAPPING_GROUP.getName());
      ijResourceAdapter.registerChild(element, mapping);
      subModel.get(Constants.WM_SECURITY_MAPPING_TO.getName()).set(entry.getKey());
      final PathElement element = PathElement.pathElement(Constants.WM_SECURITY_MAPPING_USERS.getName(), WM_SECURITY_MAPPING_USER.getName());
      ijResourceAdapter.registerChild(element, mapping);
ijResourceAdapter.registerChild( PathElement.pathElement(Constants.STATISTICS_NAME, "local"), statsResource);
parent.registerChild(element, ijResourceAdapter);

代码示例来源:origin: wildfly/wildfly

private void addAdminObject(final Resource parent, AdminObject adminObject) {
  final Resource adminObjectResource = new IronJacamarResource.IronJacamarRuntimeResource();
  final ModelNode model = adminObjectResource.getModel();
  setAttribute(model, CLASS_NAME, adminObject.getClassName());
  setAttribute(model, JNDINAME, adminObject.getJndiName());
  setAttribute(model, USE_JAVA_CONTEXT, adminObject.isUseJavaContext());
  setAttribute(model, ENABLED, adminObject.isEnabled());
  if (adminObject.getConfigProperties() != null) {
    for (Map.Entry<String, String> config : adminObject.getConfigProperties().entrySet()) {
      addConfigProperties(adminObjectResource, config.getKey(), config.getValue());
    }
  }
  final PathElement element = PathElement.pathElement(Constants.ADMIN_OBJECTS_NAME, adminObject.getJndiName());
  parent.registerChild(element, adminObjectResource);
}

代码示例来源:origin: wildfly/wildfly

resource.registerChild(peAO, aoResource);

代码示例来源:origin: wildfly/wildfly

Class<? extends Protocol> transportClass = findProtocolClass(context, name, moduleName);
registration.registerSubModel(this.createProtocolResourceDefinition(name, transportClass));
resource.registerChild(ProtocolResourceDefinition.pathElement(name), PlaceholderResource.INSTANCE);
Class<? extends Protocol> protocolClass = findProtocolClass(context, name, moduleName);
registration.registerSubModel(this.createProtocolResourceDefinition(name, protocolClass));
resource.registerChild(ProtocolResourceDefinition.pathElement(name), PlaceholderResource.INSTANCE);
resource.registerChild(ProtocolResourceDefinition.pathElement(RelayConfiguration.PROTOCOL_NAME), PlaceholderResource.INSTANCE);

代码示例来源:origin: wildfly/wildfly

resource.registerChild(peStats, statsResource);

相关文章