Java Code Examples for org.jboss.as.controller.RunningMode#ADMIN_ONLY

The following examples show how to use org.jboss.as.controller.RunningMode#ADMIN_ONLY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DeploymentHandlerUtil.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public static byte[] addFromHash(ContentRepository contentRepository, ModelNode contentItemNode, String deploymentName, PathAddress address, OperationContext context) throws OperationFailedException {
    byte[] hash = contentItemNode.require(CONTENT_HASH.getName()).asBytes();
    ContentReference reference = ModelContentReference.fromModelAddress(address, hash);
    if (!contentRepository.syncContent(reference)) {
        if (context.isBooting()) {
            if (context.getRunningMode() == RunningMode.ADMIN_ONLY) {
                // The deployment content is missing, which would be a fatal boot error if we were going to actually
                // install services. In ADMIN-ONLY mode we allow it to give the admin a chance to correct the problem
                ServerLogger.ROOT_LOGGER.reportAdminOnlyMissingDeploymentContent(reference.getHexHash(), deploymentName);
            } else {
                throw ServerLogger.ROOT_LOGGER.noSuchDeploymentContentAtBoot(reference.getHexHash(), deploymentName);
            }
        } else {
            throw ServerLogger.ROOT_LOGGER.noSuchDeploymentContent(reference.getHexHash());
        }
    }
    return hash;
}
 
Example 2
Source File: CoreModelTestDelegate.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public KernelServicesBuilderImpl(TestModelType type) {
    this.type = type;
    this.processType = type == TestModelType.HOST || type == TestModelType.DOMAIN ? ProcessType.HOST_CONTROLLER : ProcessType.STANDALONE_SERVER;
    runningModeControl = type == TestModelType.HOST ? new HostRunningModeControl(RunningMode.ADMIN_ONLY, RestartMode.HC_ONLY) : new RunningModeControl(RunningMode.ADMIN_ONLY);
    extensionRegistry = new ExtensionRegistry(processType, runningModeControl, null, null, null, RuntimeHostControllerInfoAccessor.SERVER);
    testParser = TestParser.create(extensionRegistry, xmlMapper, type);
}
 
Example 3
Source File: CoreManagementSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected AdditionalInitialization createAdditionalInitialization() {
    return new AdditionalInitialization() {

        @Override
        protected ProcessType getProcessType() {
            return ProcessType.HOST_CONTROLLER;
        }

        @Override
        protected RunningMode getRunningMode() {
            return RunningMode.ADMIN_ONLY;
        }
    };
}
 
Example 4
Source File: DomainModelControllerService.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerRemoteHost(final String hostName, final ManagementChannelHandler handler, final Transformers transformers,
                               final Long remoteConnectionId, final boolean registerProxyController) 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());
    }

    final SlaveHostPinger pinger = remoteConnectionId == null ? null : new SlaveHostPinger(hostName, handler, pingScheduler, remoteConnectionId);
    final String address = handler.getRemoteAddress().getHostAddress();
    slaveHostRegistrations.registerHost(hostName, pinger, address);

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

        modelNodeRegistration.registerProxyController(pe, hostControllerClient);
        hostProxies.put(hostName, hostControllerClient);
    }
}
 
Example 5
Source File: ChildFirstClassLoaderKernelServicesFactory.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static KernelServices create(String mainSubsystemName, String extensionClassName, AdditionalInitialization additionalInit, ModelTestOperationValidatorFilter validateOpsFilter,
        List<ModelNode> bootOperations, ModelVersion legacyModelVersion, boolean persistXml) throws Exception {
    Extension extension = (Extension) Class.forName(extensionClassName).newInstance();

    ExtensionRegistry extensionRegistry = new ExtensionRegistry(ProcessType.DOMAIN_SERVER, new RunningModeControl(RunningMode.ADMIN_ONLY));
    ModelTestParser testParser = new TestParser(mainSubsystemName, extensionRegistry);

    //TODO this should get serialized properly
    if (additionalInit == null) {
        additionalInit = AdditionalInitialization.MANAGEMENT;
    }
    return AbstractKernelServicesImpl.create(null, mainSubsystemName, additionalInit, validateOpsFilter,
            extensionRegistry, bootOperations, testParser, extension, legacyModelVersion, false, persistXml);
}
 
Example 6
Source File: AbstractLegacyExtension.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void initializeParsers(ExtensionParsingContext context) {

    if (context.getProcessType() == ProcessType.DOMAIN_SERVER) {
        // Do nothing. This allows the extension=cmp:add op that's really targeted
        // to legacy servers to work
        return;
    } else if (context.getProcessType() == ProcessType.STANDALONE_SERVER && context.getRunningMode() != RunningMode.ADMIN_ONLY) {
        throw new UnsupportedOperationException(ControllerLogger.ROOT_LOGGER.unsupportedLegacyExtension(extensionName));
    }

    initializeLegacyParsers(context);
}
 
Example 7
Source File: ThreadsSubsystemParsingTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected AdditionalInitialization createAdditionalInitialization() {
    return new AdditionalInitialization() {

        @Override
        protected ProcessType getProcessType() {
            return ProcessType.HOST_CONTROLLER;
        }

        @Override
        protected RunningMode getRunningMode() {
            return RunningMode.ADMIN_ONLY;
        }
    };
}
 
Example 8
Source File: HostXml_9.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private boolean isRequireDiscoveryOptions(AdminOnlyDomainConfigPolicy adminOnlyPolicy) {
    return !isCachedDc &&
            (runningMode != RunningMode.ADMIN_ONLY || adminOnlyPolicy == AdminOnlyDomainConfigPolicy.FETCH_FROM_MASTER);
}
 
Example 9
Source File: JmxAuditLogHandlerReferenceResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private static boolean isNotAdminOnlyServer(OperationContext context) {
    return !(!context.getProcessType().isHostController() && context.getRunningMode() == RunningMode.ADMIN_ONLY);
}
 
Example 10
Source File: AdditionalInitialization.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
protected RunningMode getRunningMode() {
    return RunningMode.ADMIN_ONLY;
}
 
Example 11
Source File: AdditionalInitialization.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
protected RunningMode getRunningMode() {
    return RunningMode.ADMIN_ONLY;
}
 
Example 12
Source File: HttpManagementAddHandler.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
protected boolean requiresRuntime(OperationContext context) {
    return super.requiresRuntime(context)
            && (context.getProcessType() != ProcessType.EMBEDDED_SERVER || context.getRunningMode() != RunningMode.ADMIN_ONLY);
}
 
Example 13
Source File: HostXml_5.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private boolean isRequireDiscoveryOptions(AdminOnlyDomainConfigPolicy adminOnlyPolicy) {
    return !isCachedDc &&
            (runningMode != RunningMode.ADMIN_ONLY || adminOnlyPolicy == AdminOnlyDomainConfigPolicy.FETCH_FROM_MASTER);
}
 
Example 14
Source File: HostXml_14.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private boolean isRequireDiscoveryOptions(AdminOnlyDomainConfigPolicy adminOnlyPolicy) {
    return !isCachedDc &&
            (runningMode != RunningMode.ADMIN_ONLY || adminOnlyPolicy == AdminOnlyDomainConfigPolicy.FETCH_FROM_MASTER);
}
 
Example 15
Source File: HostXml_11.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private boolean isRequireDiscoveryOptions(AdminOnlyDomainConfigPolicy adminOnlyPolicy) {
    return !isCachedDc &&
            (runningMode != RunningMode.ADMIN_ONLY || adminOnlyPolicy == AdminOnlyDomainConfigPolicy.FETCH_FROM_MASTER);
}
 
Example 16
Source File: HostXml_8.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private boolean isRequireDiscoveryOptions(AdminOnlyDomainConfigPolicy adminOnlyPolicy) {
    return !isCachedDc &&
            (runningMode != RunningMode.ADMIN_ONLY || adminOnlyPolicy == AdminOnlyDomainConfigPolicy.FETCH_FROM_MASTER);
}
 
Example 17
Source File: DomainModelControllerService.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private DomainConnectResult connectToDomainMaster(ServiceTarget serviceTarget, RunningMode currentRunningMode,
                                                  boolean usingCachedDC, boolean adminOnly) {
    Future<MasterDomainControllerClient> clientFuture = RemoteDomainConnectionService.install(serviceTarget,
            getValue(),
            extensionRegistry,
            hostControllerInfo,
            hostControllerInfo.getAuthenticationContext(),
            hostControllerInfo.getRemoteDomainControllerSecurityRealm(),
            remoteFileRepository,
            contentRepository,
            ignoredRegistry,
            new DomainModelControllerService.InternalExecutor(),
            this,
            environment,
            getExecutorService(),
            currentRunningMode,
            serverProxies,
            domainConfigAvailable);
    masterDomainControllerClient = getFuture(clientFuture);
    //Registers us with the master and gets down the master copy of the domain model to our DC
    // if --cached-dc is used and the DC is unavailable, we'll use a cached copy of the domain config
    // (if available), and poll for reconnection to the DC. Once the DC becomes available again, the domain
    // config will be re-synchronized.
    try {
        masterDomainControllerClient.register();
        return DomainConnectResult.CONNECTED;
    } catch (Exception e) {
        //We could not connect to the host
        ROOT_LOGGER.cannotConnectToMaster(e);
        if (!usingCachedDC) {
            if (currentRunningMode == RunningMode.ADMIN_ONLY) {
                ROOT_LOGGER.fetchConfigFromDomainMasterFailed(currentRunningMode,
                        ModelDescriptionConstants.ADMIN_ONLY_POLICY,
                        AdminOnlyDomainConfigPolicy.REQUIRE_LOCAL_CONFIG,
                        CommandLineConstants.CACHED_DC);

            }
            SystemExiter.abort(ExitCodes.HOST_CONTROLLER_ABORT_EXIT_CODE);
            // If we got here, the Exiter didn't really exit. Must be embedded.
            // Inform the caller so it knows not to proceed with boot.
            return DomainConnectResult.ABORT;
        } else if (!adminOnly) {
            // Register a service that will try again once we reach RUNNING state
            DeferredDomainConnectService.install(serviceTarget, masterDomainControllerClient);
        }
        return DomainConnectResult.FAILED;
    }
}
 
Example 18
Source File: LegacyConfigurationChangeResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
protected boolean requiresRuntime(OperationContext context) {
    return context.getProcessType() != ProcessType.EMBEDDED_HOST_CONTROLLER
            && (context.getProcessType() != ProcessType.EMBEDDED_SERVER
            && context.getRunningMode() != RunningMode.ADMIN_ONLY);
}
 
Example 19
Source File: LegacyConfigurationChangeResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
protected boolean requiresRuntime(OperationContext context) {
    return context.getProcessType() != ProcessType.EMBEDDED_HOST_CONTROLLER
            && (context.getProcessType() != ProcessType.EMBEDDED_SERVER
            && context.getRunningMode() != RunningMode.ADMIN_ONLY);
}
 
Example 20
Source File: AccessIdentityResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
protected boolean requiresRuntime(OperationContext context) {
    return (context.getProcessType() != ProcessType.EMBEDDED_SERVER
            || context.getRunningMode() != RunningMode.ADMIN_ONLY)
            && (context.getProcessType() != ProcessType.EMBEDDED_HOST_CONTROLLER);
}