Java Code Examples for org.jboss.as.controller.ProcessType#EMBEDDED_HOST_CONTROLLER

The following examples show how to use org.jboss.as.controller.ProcessType#EMBEDDED_HOST_CONTROLLER . 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: DomainModelControllerService.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private Future<ServerInventory> installServerInventory(final ServiceTarget serviceTarget) {
    if (hostControllerInfo.getHttpManagementSecureInterface() != null && !hostControllerInfo.getHttpManagementSecureInterface().isEmpty()
            && hostControllerInfo.getHttpManagementSecurePort() > 0) {
        return ServerInventoryService.install(serviceTarget, this, runningModeControl, environment, extensionRegistry,
                hostControllerInfo.getHttpManagementSecureInterface(), hostControllerInfo.getHttpManagementSecurePort(), REMOTE_HTTPS.toString());
    }
    if (hostControllerInfo.getNativeManagementInterface() != null && !hostControllerInfo.getNativeManagementInterface().isEmpty()
            && hostControllerInfo.getNativeManagementPort() > 0) {
        return ServerInventoryService.install(serviceTarget, this, runningModeControl, environment, extensionRegistry,
                hostControllerInfo.getNativeManagementInterface(), hostControllerInfo.getNativeManagementPort(), REMOTE.toString());
    }
    if (processType == ProcessType.EMBEDDED_HOST_CONTROLLER) {
        return getPlaceHolderInventory();
    }
    return ServerInventoryService.install(serviceTarget, this, runningModeControl, environment, extensionRegistry,
            hostControllerInfo.getHttpManagementInterface(), hostControllerInfo.getHttpManagementPort(), REMOTE_HTTP.toString());
}
 
Example 2
Source File: HostControllerConfigurationPersister.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public List<ModelNode> load() throws ConfigurationPersistenceException {
    // TODO investigate replacing all this with something more like BackupXmlConfigurationPersister.isSuppressLoad
    if (environment.getProcessType() == ProcessType.EMBEDDED_HOST_CONTROLLER) {
        final ConfigurationFile configurationFile = environment.getHostConfigurationFile();
        final File bootFile = configurationFile.getBootFile();
        final ConfigurationFile.InteractionPolicy policy = configurationFile.getInteractionPolicy();
        final HostRunningModeControl runningModeControl = environment.getRunningModeControl();

        if (bootFile.exists() && bootFile.length() == 0) { // empty config, by definition
            return new ArrayList<>();
        }

        if (policy == ConfigurationFile.InteractionPolicy.NEW && (bootFile.exists() && bootFile.length() != 0)) {
            throw HostControllerLogger.ROOT_LOGGER.cannotOverwriteHostXmlWithEmpty(bootFile.getName());
        }

        // if we started with new / discard but now we're reloading, ignore it. Otherwise on a reload, we have no way to drop the --empty-host-config
        // if we're loading a 0 byte file, treat this the same as booting with an emoty config
        if (bootFile.length() == 0 || (!runningModeControl.isReloaded() && (policy == ConfigurationFile.InteractionPolicy.NEW || policy == ConfigurationFile.InteractionPolicy.DISCARD))) {
            return new ArrayList<>();
        }
    }
    return hostPersister.load();
}
 
Example 3
Source File: HostProcessReloadHandler.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {

    //WFCORE-938 embedded HC reload requires --admin-only=true to be provided explicitly until we support it.
    if (processType == ProcessType.EMBEDDED_HOST_CONTROLLER) {
        final boolean adminOnly = ADMIN_ONLY.resolveModelAttribute(context, operation).asBoolean(false);
        if (!adminOnly) {
            throw HostControllerLogger.ROOT_LOGGER.embeddedHostControllerRestartMustProvideAdminOnlyTrue();
        }
    }
    super.execute(context, operation);
}
 
Example 4
Source File: RemotingConnectorAdd.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_HOST_CONTROLLER);
}
 
Example 5
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);
}
 
Example 6
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 7
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 8
Source File: DomainModelControllerService.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private synchronized ServerInventory getServerInventory() {
    if (processType == ProcessType.EMBEDDED_HOST_CONTROLLER) {
        return getServerInventory(true);
    }
    return getServerInventory(false);
}
 
Example 9
Source File: HttpManagementRemoveHandler.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);
}
 
Example 10
Source File: NativeManagementAddHandler.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_HOST_CONTROLLER);
}
 
Example 11
Source File: NativeManagementRemoveHandler.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);
}
 
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_HOST_CONTROLLER);
}
 
Example 13
Source File: HostResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void registerOperations(ManagementResourceRegistration hostRegistration) {
    super.registerOperations(hostRegistration);
    hostRegistration.registerOperationHandler(NamespaceAddHandler.DEFINITION, NamespaceAddHandler.INSTANCE);
    hostRegistration.registerOperationHandler(NamespaceRemoveHandler.DEFINITION, NamespaceRemoveHandler.INSTANCE);
    hostRegistration.registerOperationHandler(SchemaLocationAddHandler.DEFINITION, SchemaLocationAddHandler.INSTANCE);
    hostRegistration.registerOperationHandler(SchemaLocationRemoveHandler.DEFINITION, SchemaLocationRemoveHandler.INSTANCE);

    hostRegistration.registerOperationHandler(GlobalInstallationReportHandler.DEFINITION, GlobalInstallationReportHandler.INSTANCE, false);
    hostRegistration.registerOperationHandler(InstallationReportHandler.DEFINITION, InstallationReportHandler.createOperation(environment), false);

    hostRegistration.registerOperationHandler(ReadConfigAsFeaturesOperationHandler.DEFINITION, new ReadConfigAsFeaturesOperationHandler(), true);

    hostRegistration.registerOperationHandler(ValidateAddressOperationHandler.DEFINITION, ValidateAddressOperationHandler.INSTANCE);

    hostRegistration.registerOperationHandler(ResolveExpressionHandler.DEFINITION, ResolveExpressionHandler.INSTANCE);
    hostRegistration.registerOperationHandler(ResolveExpressionOnHostHandler.DEFINITION, ResolveExpressionOnHostHandler.INSTANCE);
    hostRegistration.registerOperationHandler(SpecifiedInterfaceResolveHandler.DEFINITION, SpecifiedInterfaceResolveHandler.INSTANCE);
    hostRegistration.registerOperationHandler(CleanObsoleteContentHandler.DEFINITION, CleanObsoleteContentHandler.createOperation(contentRepository));
    hostRegistration.registerOperationHandler(WriteConfigHandler.DEFINITION, WriteConfigHandler.INSTANCE);

    XmlMarshallingHandler xmh = new HostXmlMarshallingHandler(configurationPersister.getHostPersister(), hostControllerInfo);
    hostRegistration.registerOperationHandler(XmlMarshallingHandler.DEFINITION, xmh);


    StartServersHandler ssh = new StartServersHandler(environment, serverInventory, runningModeControl);
    hostRegistration.registerOperationHandler(StartServersHandler.DEFINITION, ssh);

    if (environment.getProcessType() != ProcessType.EMBEDDED_HOST_CONTROLLER) {
        HostShutdownHandler hsh = new HostShutdownHandler(domainController, serverInventory);
        hostRegistration.registerOperationHandler(HostShutdownHandler.DEFINITION, hsh);
    }

    HostProcessReloadHandler reloadHandler = new HostProcessReloadHandler(HostControllerService.HC_SERVICE_NAME,
            runningModeControl, processState, environment, hostControllerInfo);
    hostRegistration.registerOperationHandler(HostProcessReloadHandler.getDefinition(hostControllerInfo), reloadHandler);


    DomainServerLifecycleHandlers.initializeServerInventory(serverInventory);

    DomainServerLifecycleHandlers.registerHostHandlers(hostRegistration);

    ValidateOperationHandler validateOperationHandler = hostControllerInfo.isMasterDomainController() ? ValidateOperationHandler.INSTANCE : ValidateOperationHandler.SLAVE_HC_INSTANCE;
    hostRegistration.registerOperationHandler(ValidateOperationHandler.DEFINITION_HIDDEN, validateOperationHandler);


    SnapshotDeleteHandler snapshotDelete = new SnapshotDeleteHandler(configurationPersister.getHostPersister());
    hostRegistration.registerOperationHandler(SnapshotDeleteHandler.DEFINITION, snapshotDelete);
    SnapshotListHandler snapshotList = new SnapshotListHandler(configurationPersister.getHostPersister());
    hostRegistration.registerOperationHandler(SnapshotListHandler.DEFINITION, snapshotList);
    SnapshotTakeHandler snapshotTake = new SnapshotTakeHandler(configurationPersister.getHostPersister());
    hostRegistration.registerOperationHandler(SnapshotTakeHandler.DEFINITION, snapshotTake);

    ignoredRegistry.registerResources(hostRegistration);

}