@Override
 public void registerRunningServer(ProxyController serverControllerClient) {
   PathAddress pa = serverControllerClient.getProxyNodeAddress();
   PathElement pe = pa.getElement(1);
   if (modelNodeRegistration.getProxyController(pa) != null) {
     throw new IllegalArgumentException(
         "There is already a registered server named '" + pe.getValue() + "'");
   }
   Logger.getLogger("org.jboss.host.controller").info("Registering server " + pe.getValue());
   ManagementResourceRegistration hostRegistration =
       modelNodeRegistration.getSubModel(PathAddress.pathAddress(PathElement.pathElement(HOST)));
   hostRegistration.registerProxyController(pe, serverControllerClient);
   serverProxies.put(pe.getValue(), serverControllerClient);
 }
  @Override
  public void registerRemoteHost(
      final String hostName,
      final ManagementChannelHandler handler,
      final Transformers transformers,
      Long remoteConnectionId,
      DomainControllerRuntimeIgnoreTransformationEntry runtimeIgnoreTransformation)
      throws SlaveRegistrationException {
    if (!hostControllerInfo.isMasterDomainController()) {
      throw SlaveRegistrationException.forHostIsNotMaster();
    }

    if (runningModeControl.getRunningMode() == RunningMode.ADMIN_ONLY) {
      throw SlaveRegistrationException.forMasterInAdminOnlyMode(
          runningModeControl.getRunningMode());
    }

    final PathElement pe = PathElement.pathElement(ModelDescriptionConstants.HOST, hostName);
    final PathAddress addr = PathAddress.pathAddress(pe);
    ProxyController existingController = modelNodeRegistration.getProxyController(addr);

    if (existingController != null || hostControllerInfo.getLocalHostName().equals(pe.getValue())) {
      throw SlaveRegistrationException.forHostAlreadyExists(pe.getValue());
    }

    SlaveHostPinger pinger =
        remoteConnectionId == null
            ? null
            : new SlaveHostPinger(hostName, handler, pingScheduler, remoteConnectionId);
    hostRegistrationMap.put(hostName, new HostRegistration(remoteConnectionId, handler, pinger));

    // Create the proxy controller
    final TransformingProxyController hostControllerClient =
        TransformingProxyController.Factory.create(
            handler, transformers, addr, ProxyOperationAddressTranslator.HOST);

    modelNodeRegistration.registerProxyController(pe, hostControllerClient);
    runtimeIgnoreTransformationRegistry.registerHost(hostName, runtimeIgnoreTransformation);
    hostProxies.put(hostName, hostControllerClient);
    //        if (pinger != null) {
    //            pinger.schedulePing(SlaveHostPinger.STD_TIMEOUT, SlaveHostPinger.STD_INTERVAL);
    //        }
  }
 @Override
 public void registerRunningServer(final ProxyController serverControllerClient) {
   PathAddress pa = serverControllerClient.getProxyNodeAddress();
   PathElement pe = pa.getElement(1);
   if (modelNodeRegistration.getProxyController(pa) != null) {
     throw MESSAGES.serverNameAlreadyRegistered(pe.getValue());
   }
   ROOT_LOGGER.registeringServer(pe.getValue());
   // Register the proxy
   final ManagementResourceRegistration hostRegistration =
       modelNodeRegistration.getSubModel(
           PathAddress.pathAddress(
               PathElement.pathElement(HOST, hostControllerInfo.getLocalHostName())));
   hostRegistration.registerProxyController(pe, serverControllerClient);
   // Register local operation overrides
   final ManagementResourceRegistration serverRegistration =
       hostRegistration.getSubModel(PathAddress.EMPTY_ADDRESS.append(pe));
   ServerConfigResourceDefinition.registerServerLifecycleOperations(
       serverRegistration, serverInventory);
   serverProxies.put(pe.getValue(), serverControllerClient);
 }
  @Override
  public void registerRemoteHost(ProxyController hostControllerClient)
      throws SlaveRegistrationException {
    if (!hostControllerInfo.isMasterDomainController()) {
      throw SlaveRegistrationException.forHostIsNotMaster();
    }

    if (runningModeControl.getRunningMode() == RunningMode.ADMIN_ONLY) {
      throw SlaveRegistrationException.forMasterInAdminOnlyMode(
          runningModeControl.getRunningMode());
    }
    PathAddress pa = hostControllerClient.getProxyNodeAddress();
    PathElement pe = pa.getElement(0);
    ProxyController existingController = modelNodeRegistration.getProxyController(pa);

    if (existingController != null || hostControllerInfo.getLocalHostName().equals(pe.getValue())) {
      throw SlaveRegistrationException.forHostAlreadyExists(pe.getValue());
    }
    modelNodeRegistration.registerProxyController(pe, hostControllerClient);
    hostProxies.put(pe.getValue(), hostControllerClient);

    Logger.getLogger("org.jboss.domain").info("Registered remote slave host " + pe.getValue());
  }
Пример #5
0
 @Override
 public void registerProxyController(PathElement address, ProxyController proxyController) {
   deployments.registerProxyController(address, proxyController);
   subdeployments.registerProxyController(address, proxyController);
 }