private LocalHostControllerInfoImpl createLocalHostControllerInfo(HostControllerEnvironment env) { return new LocalHostControllerInfoImpl(null, env); }
@Override public String getHostName() { return hostControllerInfo.getLocalHostName(); } };
private void installDiscoveryService(final ServiceTarget serviceTarget, List<DiscoveryOption> discoveryOptions) { List<DomainControllerManagementInterface> interfaces = new ArrayList<>(); if (hostControllerInfo.getNativeManagementInterface() != null && !hostControllerInfo.getNativeManagementInterface().isEmpty() && hostControllerInfo.getNativeManagementPort() > 0) { interfaces.add(new DomainControllerManagementInterface(hostControllerInfo.getNativeManagementPort(), hostControllerInfo.getNativeManagementInterface(), REMOTE)); } if (hostControllerInfo.getHttpManagementSecureInterface() != null && !hostControllerInfo.getHttpManagementSecureInterface().isEmpty() && hostControllerInfo.getHttpManagementSecurePort() > 0) { interfaces.add(new DomainControllerManagementInterface(hostControllerInfo.getHttpManagementSecurePort(), hostControllerInfo.getHttpManagementSecureInterface(), REMOTE_HTTPS)); } if (hostControllerInfo.getHttpManagementInterface() != null && !hostControllerInfo.getHttpManagementInterface().isEmpty() && hostControllerInfo.getHttpManagementPort() > 0) { interfaces.add(new DomainControllerManagementInterface(hostControllerInfo.getHttpManagementPort(), hostControllerInfo.getHttpManagementInterface(), REMOTE_HTTP)); } DiscoveryService.install(serviceTarget, discoveryOptions, interfaces, hostControllerInfo.isMasterDomainController()); }
static void clearHostControllerInfo(LocalHostControllerInfoImpl hostControllerInfo) { hostControllerInfo.setHttpManagementInterface(null); hostControllerInfo.setHttpManagementPort(0); hostControllerInfo.setHttpManagementSecureInterface(null); hostControllerInfo.setHttpManagementSecurePort(0); } }
static void clearHostControllerInfo(LocalHostControllerInfoImpl hostControllerInfo) { hostControllerInfo.setHttpManagementInterface(null); hostControllerInfo.setHttpManagementPort(0); hostControllerInfo.setHttpManagementSecurePort(0); hostControllerInfo.setHttpManagementSecurityRealm(null); }
@Override void initializeRemoteDomain(OperationContext context, ModelNode remoteDC) throws OperationFailedException { hostControllerInfo.setMasterDomainController(false); ModelNode protocolNode = DomainControllerWriteAttributeHandler.PROTOCOL.resolveModelAttribute(context, remoteDC); ModelNode hostNode = DomainControllerWriteAttributeHandler.HOST.resolveModelAttribute(context, remoteDC); String protocol = protocolNode.asString(); StaticDiscovery staticDiscoveryOption = new StaticDiscovery(protocol, host, port); hostControllerInfo.addRemoteDomainControllerDiscoveryOption(staticDiscoveryOption); hostControllerInfo.setRemoteDomainControllerUsername(usernameNode.asString()); if (hostControllerInfo.isBackupDc()) { // started up with --backup, ignore-unused-configuration not set hostControllerInfo.setRemoteDomainControllerIgnoreUnaffectedConfiguration(false); } else { hostControllerInfo.setRemoteDomainControllerIgnoreUnaffectedConfiguration(true); hostControllerInfo.setRemoteDomainControllerIgnoreUnaffectedConfiguration(ignoreUnusedConfiguration.asBoolean()); hostControllerInfo.setAdminOnlyDomainConfigPolicy(domainConfigPolicy); overallConfigPersister.initializeDomainConfigurationPersister(true);
String interfaceName = hostControllerInfo.getHttpManagementInterface(); int port = hostControllerInfo.getHttpManagementPort(); String secureInterfaceName = hostControllerInfo.getHttpManagementSecureInterface(); int securePort = hostControllerInfo.getHttpManagementSecurePort(); if (context.getRunningMode() == RunningMode.ADMIN_ONLY) { consoleMode = ConsoleMode.ADMIN_ONLY; } else if (!hostControllerInfo.isMasterDomainController()) { consoleMode = ConsoleMode.SLAVE_HC; NativeManagementServices.installRemotingServicesIfNotInstalled(serviceTarget, hostControllerInfo.getLocalHostName(), context.getServiceRegistry(true), onDemand); final String httpConnectorName; if (port > -1 || securePort < 0) {
extensionRegistry, hostControllerInfo.getNativeManagementInterface(), hostControllerInfo.getNativeManagementPort()); if (!hostControllerInfo.isMasterDomainController() && !environment.isUseCachedDc()) { serverInventory = getFuture(inventoryFuture); if (hostControllerInfo.getRemoteDomainControllerHost() != null) { Future<MasterDomainControllerClient> clientFuture = RemoteDomainConnectionService.install(serviceTarget, getValue(), extensionRegistry, hostControllerInfo, environment.getProductConfig(), hostControllerInfo.getRemoteDomainControllerSecurityRealm(), remoteFileRepository, ignoredRegistry);
@Override protected List<ServiceName> installServices(OperationContext context, NativeInterfaceCommonPolicy commonPolicy, ModelNode model) throws OperationFailedException { populateHostControllerInfo(hostControllerInfo, context, model); final ServiceTarget serviceTarget = context.getServiceTarget(); final boolean onDemand = context.isBooting(); NativeManagementServices.installRemotingServicesIfNotInstalled(serviceTarget, hostControllerInfo.getLocalHostName(), context.getServiceRegistry(false), onDemand); OptionMap options = createConnectorOptions(commonPolicy); final ServiceName nativeManagementInterfaceBinding = context.getCapabilityServiceName("org.wildfly.network.interface", hostControllerInfo.getNativeManagementInterface(), NetworkInterfaceBinding.class); final String securityRealm = commonPolicy.getSecurityRealm(); final String saslAuthenticationFactory = commonPolicy.getSaslAuthenticationFactory(); if (saslAuthenticationFactory == null && securityRealm == null) { ROOT_LOGGER.nativeManagementInterfaceIsUnsecured(); } ServiceName securityRealmName = securityRealm != null ? SecurityRealm.ServiceUtil.createServiceName(securityRealm) : null; ServiceName saslAuthenticationFactoryName = saslAuthenticationFactory != null ? context.getCapabilityServiceName( SASL_AUTHENTICATION_FACTORY_CAPABILITY, saslAuthenticationFactory, SaslAuthenticationFactory.class) : null; String sslContext = commonPolicy.getSSLContext(); ServiceName sslContextName = sslContext != null ? context.getCapabilityServiceName(SSL_CONTEXT_CAPABILITY, sslContext, SSLContext.class) : null; NativeManagementServices.installManagementWorkerService(serviceTarget, context.getServiceRegistry(false)); ManagementRemotingServices.installDomainConnectorServices(context, serviceTarget, ManagementRemotingServices.MANAGEMENT_ENDPOINT, nativeManagementInterfaceBinding, hostControllerInfo.getNativeManagementPort(), options, securityRealmName, saslAuthenticationFactoryName, sslContextName); return Arrays.asList(REMOTING_BASE.append("server", MANAGEMENT_CONNECTOR), nativeManagementInterfaceBinding); }
List<DiscoveryOption> discoveryOptions = hostControllerInfo.getRemoteDomainControllerDiscoveryOptions(); if (hostControllerInfo.isMasterDomainController() && (discoveryOptions != null)) { boolean useLocalDomainXml = hostControllerInfo.isMasterDomainController(); boolean isCachedDc = environment.isUseCachedDc(); useLocalDomainXml = true; switch (hostControllerInfo.getAdminOnlyDomainConfigPolicy()) { case ALLOW_NO_CONFIG: break; default: throw new IllegalStateException(hostControllerInfo.getAdminOnlyDomainConfigPolicy().toString()); if (!hostControllerInfo.isMasterDomainController() && isCachedDc) { ROOT_LOGGER.usingCachedDC(CommandLineConstants.CACHED_DC, ConfigurationPersisterFactory.CACHED_DOMAIN_XML); final String hostName = hostControllerInfo.getLocalHostName(); slaveHostRegistrations.registerHost(hostName, null, "local"); if (ok && hostControllerInfo.getAdminOnlyDomainConfigPolicy() != AdminOnlyDomainConfigPolicy.ALLOW_NO_CONFIG) { final ModelNode validate = new ModelNode(); validate.get(OP).set("validate");
protected void initializeDomain(OperationContext context, ModelNode remoteDC) throws OperationFailedException { hostControllerInfo.setMasterDomainController(false); hostControllerInfo.setRemoteDomainControllerHost(HOST.resolveModelAttribute(context, remoteDC).asString()); hostControllerInfo.setRemoteDomainControllerPort(PORT.resolveModelAttribute(context, remoteDC).asInt()); ModelNode usernameNode = USERNAME.resolveModelAttribute(context, remoteDC); if (usernameNode.isDefined()) { hostControllerInfo.setRemoteDomainControllerUsername(usernameNode.asString()); } overallConfigPersister.initializeDomainConfigurationPersister(true); domainController.initializeSlaveDomainRegistry(rootRegistration, overallConfigPersister.getDomainPersister(), contentRepository, fileRepository, hostControllerInfo, extensionRegistry, ignoredDomainResourceRegistry, pathManager); } }
@Override public void registerRemoteHost(final String hostName, final ManagementChannelHandler handler, final Transformers transformers, Long remoteConnectionId) throws SlaveRegistrationException { if (!hostControllerInfo.isMasterDomainController()) { throw SlaveRegistrationException.forHostIsNotMaster(); ProxyController existingController = modelNodeRegistration.getProxyController(addr); if (existingController != null || hostControllerInfo.getLocalHostName().equals(pe.getValue())){ throw SlaveRegistrationException.forHostAlreadyExists(pe.getValue());
public boolean isMasterHc() { return hostControllerInfo.isMasterDomainController(); } };
@Override void initializeLocalDomain(final String localHostNameOverride) { hostControllerInfo.setMasterDomainController(true); if (localHostNameOverride != null) { hostControllerInfo.setLocalHostName(localHostNameOverride); } if (localHostNameOverride == null) { // for adding a host later, we don't use the domain persister overallConfigPersister.initializeDomainConfigurationPersister(false); } domainController.initializeMasterDomainRegistry(rootRegistration, localHostNameOverride == null ? overallConfigPersister.getDomainPersister() : null, contentRepository, localFileRepository, extensionRegistry, pathManager); }
extensionRegistry, hostControllerInfo, hostControllerInfo.getAuthenticationContext(), hostControllerInfo.getRemoteDomainControllerSecurityRealm(), remoteFileRepository, contentRepository,
protected void initializeDomain() { hostControllerInfo.setMasterDomainController(true); overallConfigPersister.initializeDomainConfigurationPersister(false); domainController.initializeMasterDomainRegistry(rootRegistration, overallConfigPersister.getDomainPersister(), contentRepository, fileRepository, extensionRegistry, pathManager); } }
static void clearHostControllerInfo(LocalHostControllerInfoImpl hostControllerInfo) { hostControllerInfo.setHttpManagementInterface(null); hostControllerInfo.setHttpManagementPort(0); hostControllerInfo.setHttpManagementSecureInterface(null); hostControllerInfo.setHttpManagementSecurePort(0); } }
@Override void initializeRemoteDomain(OperationContext context, ModelNode remoteDC) throws OperationFailedException { hostControllerInfo.setMasterDomainController(false); ModelNode protocolNode = DomainControllerWriteAttributeHandler.PROTOCOL.resolveModelAttribute(context, remoteDC); ModelNode hostNode = DomainControllerWriteAttributeHandler.HOST.resolveModelAttribute(context, remoteDC); String protocol = protocolNode.asString(); StaticDiscovery staticDiscoveryOption = new StaticDiscovery(protocol, host, port); hostControllerInfo.addRemoteDomainControllerDiscoveryOption(staticDiscoveryOption); hostControllerInfo.setRemoteDomainControllerUsername(usernameNode.asString()); if (hostControllerInfo.isBackupDc()) { // started up with --backup, ignore-unused-configuration not set hostControllerInfo.setRemoteDomainControllerIgnoreUnaffectedConfiguration(false); } else { hostControllerInfo.setRemoteDomainControllerIgnoreUnaffectedConfiguration(true); hostControllerInfo.setRemoteDomainControllerIgnoreUnaffectedConfiguration(ignoreUnusedConfiguration.asBoolean()); hostControllerInfo.setAdminOnlyDomainConfigPolicy(domainConfigPolicy); overallConfigPersister.initializeDomainConfigurationPersister(true);
String interfaceName = hostControllerInfo.getHttpManagementInterface(); int port = hostControllerInfo.getHttpManagementPort(); String secureInterfaceName = hostControllerInfo.getHttpManagementSecureInterface(); int securePort = hostControllerInfo.getHttpManagementSecurePort(); if (context.getRunningMode() == RunningMode.ADMIN_ONLY) { consoleMode = ConsoleMode.ADMIN_ONLY; } else if (!hostControllerInfo.isMasterDomainController()) { consoleMode = ConsoleMode.SLAVE_HC; NativeManagementServices.installRemotingServicesIfNotInstalled(serviceTarget, hostControllerInfo.getLocalHostName(), context.getServiceRegistry(true), onDemand); final String httpConnectorName; if (port > -1 || securePort < 0) {
static void populateHostControllerInfo(final LocalHostControllerInfoImpl hostControllerInfo, final OperationContext context, final ModelNode model) throws OperationFailedException { hostControllerInfo.setHttpManagementInterface(HttpManagementResourceDefinition.INTERFACE.resolveModelAttribute(context, model).asString()); final ModelNode portNode = HttpManagementResourceDefinition.HTTP_PORT.resolveModelAttribute(context, model); hostControllerInfo.setHttpManagementPort(portNode.isDefined() ? portNode.asInt() : -1); final ModelNode securePortNode = HttpManagementResourceDefinition.HTTPS_PORT.resolveModelAttribute(context, model); hostControllerInfo.setHttpManagementSecurePort(securePortNode.isDefined() ? securePortNode.asInt() : -1); final ModelNode realmNode = HttpManagementResourceDefinition.SECURITY_REALM.resolveModelAttribute(context, model); hostControllerInfo.setHttpManagementSecurityRealm(realmNode.isDefined() ? realmNode.asString() : null); }