Java Code Examples for org.jboss.as.controller.OperationContext#addStep()
The following examples show how to use
org.jboss.as.controller.OperationContext#addStep() .
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: ServerUtil.java From keycloak with Apache License 2.0 | 6 votes |
void addStepToUploadServerWar(OperationContext context) throws OperationFailedException { PathAddress deploymentAddress = deploymentAddress(deploymentName); ModelNode op = Util.createOperation(ADD, deploymentAddress); // this is required for deployment to take place op.get(ENABLED).set(true); // prevents writing this deployment out to standalone.xml op.get(PERSISTENT).set(false); // Owner attribute is valid starting with WidlFly 9. Ignored in WildFly 8 op.get("owner").set(new ModelNode().add("subsystem", KeycloakExtension.SUBSYSTEM_NAME)); if (serverWar == null) { throw new OperationFailedException("Keycloak Server WAR not found in keycloak-server-subsystem module"); } op.get(CONTENT).add(makeContentItem()); context.addStep(op, getHandler(context, deploymentAddress, ADD), OperationContext.Stage.MODEL); }
Example 2
Source File: ProfileDescribeHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override protected void processMore(OperationContext context, ModelNode operation, Resource resource, PathAddress address, Map<String, ModelNode> includeResults) throws OperationFailedException { final ModelNode profile = resource.getModel(); if (profile.hasDefined(INCLUDES)) { // Call this op for each included profile for (ModelNode include : profile.get(INCLUDES).asList()) { final String includeName = include.asString(); final ModelNode includeRsp = new ModelNode(); includeResults.put(includeName, includeRsp); final ModelNode includeAddress = address.subAddress(0, address.size() - 1).append(PathElement.pathElement(PROFILE, includeName)).toModelNode(); final ModelNode newOp = operation.clone(); newOp.get(OP_ADDR).set(includeAddress); context.addStep(includeRsp, newOp, INSTANCE, OperationContext.Stage.MODEL, true); } } }
Example 3
Source File: ReadMasterDomainModelHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { // if the calling process has already acquired a lock, don't relock. if (lock) { context.acquireControllerLock(); } final Transformers.ResourceIgnoredTransformationRegistry ignoredTransformationRegistry; final Resource resource = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS); // The host info is only null in the tests if (hostInfo == null) { ignoredTransformationRegistry = Transformers.DEFAULT; } else { final ReadMasterDomainModelUtil.RequiredConfigurationHolder rc = hostInfo.populateRequiredConfigurationHolder(resource, extensionRegistry); ignoredTransformationRegistry = ReadMasterDomainModelUtil.createHostIgnoredRegistry(hostInfo, rc); } final OperationStepHandler handler = new ReadDomainModelHandler(ignoredTransformationRegistry, transformers, lock); context.addStep(handler, OperationContext.Stage.MODEL); }
Example 4
Source File: AbstractOrderedChildResourceSyncModelTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final ModelNode syncOperation = new ModelNode(); syncOperation.get(OP).set("calculate-diff-and-sync"); syncOperation.get(OP_ADDR).setEmptyList(); syncOperation.get(DOMAIN_MODEL).set(operation.get(DOMAIN_MODEL)); Resource original = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS); final TestRepository repo = new TestRepository(); final HostControllerRegistrationHandler.OperationExecutor internalExecutor = getControllerService().getInternalExecutor(); SyncModelParameters parameters = new SyncModelParameters(new MockDomainController(), ignoredDomainResourceRegistry, hostControllerEnvironment, extensionRegistry, internalExecutor, true, Collections.<String, ProxyController>emptyMap(), repo, repo); final SyncServerGroupOperationHandler handler = new SyncServerGroupOperationHandler("slave", original, parameters); context.addStep(syncOperation, handler, OperationContext.Stage.MODEL, true); }
Example 5
Source File: AccessIdentityResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { final String securityDomain = SECURITY_DOMAIN.resolveModelAttribute(context, model).asString(); final ServiceBuilder<?> sb = context.getServiceTarget().addService(MANAGEMENT_IDENTITY_RUNTIME_CAPABILITY.getCapabilityServiceName()); final Supplier<SecurityDomain> sdSupplier = sb.requires(context.getCapabilityServiceName(RuntimeCapability.buildDynamicCapabilityName(SECURITY_DOMAIN_CAPABILITY, securityDomain), SecurityDomain.class)); sb.setInstance(new IdentityService(sdSupplier, securityIdentitySupplier)); sb.install(); //Let's verify that the IdentityService is correctly started. context.addStep((OperationContext context1, ModelNode operation1) -> { try { ServiceController<?> controller = context1.getServiceRegistry(false).getRequiredService(MANAGEMENT_IDENTITY_RUNTIME_CAPABILITY.getCapabilityServiceName()); if (controller == null || State.UP != controller.getState()) { context.setRollbackOnly(); } } catch (ServiceNotFoundException ex) { context.setRollbackOnly(); } }, OperationContext.Stage.VERIFY); }
Example 6
Source File: InterfaceCriteriaWriteHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { nameValidator.validate(operation); final String attributeName = operation.require(NAME).asString(); final ModelNode newValue = operation.hasDefined(VALUE) ? operation.get(VALUE) : new ModelNode(); final ModelNode submodel = context.readResourceForUpdate(PathAddress.EMPTY_ADDRESS).getModel(); final AttributeDefinition attributeDefinition = ATTRIBUTES.get(attributeName); if (attributeDefinition != null) { final ModelNode syntheticOp = new ModelNode(); syntheticOp.get(attributeName).set(newValue); attributeDefinition.validateAndSet(syntheticOp, submodel); } else { throw new OperationFailedException(ControllerLogger.ROOT_LOGGER.unknownAttribute(attributeName)); } if (updateRuntime) { // Require a reload context.reloadRequired(); } // Verify the model in a later step context.addStep(VERIFY_HANDLER, OperationContext.Stage.MODEL); OperationContext.RollbackHandler rollbackHandler = updateRuntime ? OperationContext.RollbackHandler.REVERT_RELOAD_REQUIRED_ROLLBACK_HANDLER : OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER; context.completeStep(rollbackHandler); }
Example 7
Source File: KeycloakSubsystemAdd.java From keycloak with Apache License 2.0 | 5 votes |
@Override protected void performBoottime(final OperationContext context, ModelNode operation, final ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) { context.addStep(new AbstractDeploymentChainStep() { @Override protected void execute(DeploymentProcessorTarget processorTarget) { processorTarget.addDeploymentProcessor(Phase.DEPENDENCIES, 0, new KeycloakDependencyProcessorAS7()); processorTarget.addDeploymentProcessor( Phase.POST_MODULE, // PHASE Phase.POST_MODULE_VALIDATOR_FACTORY - 1, // PRIORITY new KeycloakAdapterConfigDeploymentProcessor()); } }, OperationContext.Stage.RUNTIME); }
Example 8
Source File: LoggingOperations.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException { final ConfigurationPersistence configurationPersistence = getOrCreateConfigurationPersistence(context); final LogContextConfiguration logContextConfiguration = configurationPersistence.getLogContextConfiguration(); performRuntime(context, operation, model, logContextConfiguration); addCommitStep(context, configurationPersistence); final OperationStepHandler afterCommit = afterCommit(logContextConfiguration, model); if (afterCommit != null) { context.addStep(afterCommit, Stage.RUNTIME); } }
Example 9
Source File: QueryOperationHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override void doExecute(final OperationContext parentContext, ModelNode operation, FilteredData filteredData, boolean ignoreMissingResources) throws OperationFailedException { final ModelNode where = WHERE_ATT.validateOperation(operation); // Use resolveModelAttribute for OPERATOR_ATT to pull out the default value final Operator operator = Operator.valueOf(OPERATOR_ATT.resolveModelAttribute(parentContext, operation).asString()); final ModelNode select = SELECT_ATT.validateOperation(operation); ImmutableManagementResourceRegistration mrr = parentContext.getResourceRegistration(); final OperationStepHandler readResourceHandler = mrr.getOperationHandler( PathAddress.EMPTY_ADDRESS, ModelDescriptionConstants.READ_RESOURCE_OPERATION ); final ModelNode readResourceOp = new ModelNode(); readResourceOp.get(ADDRESS).set(operation.get(ADDRESS)); readResourceOp.get(OP).set(READ_RESOURCE_OPERATION); readResourceOp.get(INCLUDE_RUNTIME).set(true); // filter/reduce phase parentContext.addStep(operation, new FilterReduceHandler(where, operator, select), OperationContext.Stage.MODEL); // map phase parentContext.addStep(readResourceOp, readResourceHandler, OperationContext.Stage.MODEL); }
Example 10
Source File: ParallelExtensionAddHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { context.addStep(getParallelExtensionInitializeStep(), OperationContext.Stage.MODEL, true); for (int i = extensionAdds.size() -1; i >= 0; i--) { // Reverse order so they execute in normal order! ParsedBootOp op = extensionAdds.get(i); context.addStep(op.response, op.operation, op.handler, OperationContext.Stage.MODEL, true); } }
Example 11
Source File: BpmPlatformSubsystemAdd.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { // add deployment processors context.addStep(new AbstractDeploymentChainStep() { public void execute(DeploymentProcessorTarget processorTarget) { processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.PARSE, ProcessApplicationProcessor.PRIORITY, new ProcessApplicationProcessor()); processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.DEPENDENCIES, ModuleDependencyProcessor.PRIORITY, new ModuleDependencyProcessor()); processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.POST_MODULE, ProcessesXmlProcessor.PRIORITY, new ProcessesXmlProcessor()); processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.INSTALL, ProcessEngineStartProcessor.PRIORITY, new ProcessEngineStartProcessor()); processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.INSTALL, ProcessApplicationDeploymentProcessor.PRIORITY, new ProcessApplicationDeploymentProcessor()); } }, OperationContext.Stage.RUNTIME); // create and register the MSC container delegate. final MscRuntimeContainerDelegate processEngineService = new MscRuntimeContainerDelegate(); final ServiceController<MscRuntimeContainerDelegate> controller = context.getServiceTarget() .addService(ServiceNames.forMscRuntimeContainerDelegate(), processEngineService) .setInitialMode(Mode.ACTIVE) .install(); // discover and register bpm platform plugins BpmPlatformPlugins plugins = BpmPlatformPlugins.load(getClass().getClassLoader()); MscBpmPlatformPlugins managedPlugins = new MscBpmPlatformPlugins(plugins); ServiceController<BpmPlatformPlugins> serviceController = context.getServiceTarget() .addService(ServiceNames.forBpmPlatformPlugins(), managedPlugins) .setInitialMode(Mode.ACTIVE) .install(); }
Example 12
Source File: NativeManagementRemoveHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected void performRemove(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { final PathAddress httpAddress = context.getCurrentAddress().getParent().append(PathElement.pathElement(MANAGEMENT_INTERFACE, HTTP_INTERFACE)); context.addStep((OperationContext opContext, ModelNode op) -> { ManagementRemotingServices.isManagementResourceRemoveable(opContext, httpAddress); }, OperationContext.Stage.MODEL, false); super.performRemove(context, operation, model); }
Example 13
Source File: ServerUtil.java From keycloak with Apache License 2.0 | 5 votes |
private static void addDeploymentAction(OperationContext context, String operation, String deploymentName) { if (!context.isNormalServer()) { return; } PathAddress deploymentAddress = deploymentAddress(deploymentName); ModelNode op = Util.createOperation(operation, deploymentAddress); op.get(RUNTIME_NAME).set(deploymentName); context.addStep(op, getHandler(context, deploymentAddress, operation), OperationContext.Stage.MODEL); }
Example 14
Source File: LdapAuthorizationResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { context.removeResource(PathAddress.EMPTY_ADDRESS); ModelNode validateOp = createOperation(operation); context.addStep(validateOp, VALIDATION_INSTANCE, Stage.MODEL); }
Example 15
Source File: LdapAuthorizationResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected void updateModel(OperationContext context, ModelNode operation) throws OperationFailedException { super.updateModel(context, operation); ModelNode validateOp = createOperation(operation); context.addStep(validateOp, VALIDATION_INSTANCE, Stage.MODEL); }
Example 16
Source File: NativeManagementRemoveHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected void performRemove(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { RbacSanityCheckOperation.addOperation(context); final PathAddress httpAddress = context.getCurrentAddress().getParent().append(PathElement.pathElement(MANAGEMENT_INTERFACE, HTTP_INTERFACE)); context.addStep((OperationContext opContext, ModelNode op) -> { ManagementRemotingServices.isManagementResourceRemoveable(opContext, httpAddress); }, OperationContext.Stage.MODEL, false); super.performRemove(context, operation, model); }
Example 17
Source File: ReadAttributeHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override void doExecute(OperationContext context, ModelNode operation, FilteredData filteredData, boolean ignoreMissingResource) throws OperationFailedException { // Add a step to authorize the attribute read once we determine the value below context.addStep(operation, new AuthorizeAttributeReadHandler(filteredData), OperationContext.Stage.MODEL, true); final boolean resolve = RESOLVE.resolveModelAttribute(context, operation).asBoolean(); if( resolve && resolvable ){ context.addStep(operation, ResolveAttributeHandler.getInstance(), OperationContext.Stage.MODEL, true); } if (filteredData == null) { doExecuteInternal(context, operation); } else { try { if (overrideHandler == null) { doExecuteInternal(context, operation); } else { overrideHandler.execute(context, operation); } } catch (UnauthorizedException ue) { // Just report the failure to the filter and complete normally PathAddress pa = context.getCurrentAddress(); filteredData.addReadRestrictedAttribute(pa, operation.get(NAME).asString()); context.getResult().set(new ModelNode()); } } }
Example 18
Source File: BasicRbacTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { context.addStep((ctx, op) -> { ctx.getServiceRegistry(modify); // causes read-runtime/write-runtime auth, otherwise ignored ctx.getResult().set(new Random().nextInt()); }, OperationContext.Stage.RUNTIME); }
Example 19
Source File: DomainDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override protected void populateModel(final OperationContext context, final ModelNode operation, final Resource resource) throws OperationFailedException { super.populateModel(context, operation, resource); context.addStep(new DomainValidationHandler(), Stage.MODEL); }
Example 20
Source File: KeycloakSubsystemRemoveHandler.java From keycloak with Apache License 2.0 | 4 votes |
private void addStepToRemoveServerWar(OperationContext context, String deploymentName) { PathAddress deploymentAddress = PathAddress.pathAddress(PathElement.pathElement(DEPLOYMENT, deploymentName)); ModelNode op = Util.createOperation(REMOVE, deploymentAddress); context.addStep(op, getRemoveHandler(context, deploymentAddress), OperationContext.Stage.MODEL); }