@Override protected void recordCapabilitiesAndRequirements(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { super.recordCapabilitiesAndRequirements(context, operation, resource); KnownDeploymentsApi knownDeployments = new KnownDeploymentsApi(); context.registerCapability(RuntimeCapability.Builder .of(CAPABILITY_APPLICATION_SECURITY_DOMAIN_KNOWN_DEPLOYMENTS, true, knownDeployments).build() .fromBaseCapability(context.getCurrentAddressValue())); context.attach(KNOWN_DEPLOYMENTS_KEY, knownDeployments); }
@Override public <T> T attach(final AttachmentKey<T> key, final T value) { return primaryContext.attach(key, value); }
/** * * @param context * @param operation */ static void attachAliasAddress(OperationContext context, ModelNode operation) { if (operation.get(OP).asString().equals(READ_RESOURCE_DESCRIPTION_OPERATION)) { context.attach(ALIAS_ORIGINAL_ADDRESS, PathAddress.pathAddress(operation.get(OP_ADDR))); } }
public static synchronized void addToDontPropagateToServersAttachment(OperationContext context, ModelNode op) { Set<ModelNode> ops = context.getAttachment(DONT_PROPAGATE_TO_SERVERS_ATTACHMENT); if (ops == null) { ops = new HashSet<ModelNode>(); context.attach(DONT_PROPAGATE_TO_SERVERS_ATTACHMENT, ops); } ops.add(op); }
private Integer incrementAttachedCounter(OperationContext context, OperationContext.AttachmentKey<Integer> key) { Integer value = context.getAttachment(key); if (value == null) { value = 0; } value = value + 1; context.attach(key, value); return value; }
@Override public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { context.acquireControllerLock(); context.attach(PathAddressFilter.KEY, DEFAULT_FILTER); context.attach(OrderedChildTypesAttachment.KEY, orderedChildTypesAttachment); context.addStep(operation, GenericModelDescribeOperationHandler.INSTANCE, OperationContext.Stage.MODEL, true); }
/** * * @param context * @param operation */ static void attachAliasAddress(OperationContext context, ModelNode operation) { if (operation.get(OP).asString().equals(READ_RESOURCE_DESCRIPTION_OPERATION)) { context.attach(ALIAS_ORIGINAL_ADDRESS, PathAddress.pathAddress(operation.get(OP_ADDR))); } }
private Integer decrementAttachedCounter(OperationContext context, OperationContext.AttachmentKey<Integer> key) { Integer value = context.getAttachment(key); if (value == null) { return null; } value = value - 1; context.attach(key, value); return value; }
@Override public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { context.acquireControllerLock(); context.attach(PathAddressFilter.KEY, DEFAULT_FILTER); context.attach(OrderedChildTypesAttachment.KEY, orderedChildTypesAttachment); context.addStep(operation, GenericModelDescribeOperationHandler.INSTANCE, OperationContext.Stage.MODEL, true); }
@Override public void operationPrepared(ModelController.OperationTransaction transaction, final ModelNode preparedResult, OperationContext context) { transaction.commit(); if (context == null || !reload) { // TODO deal with shutdown as well, the handlers for which have some // subtleties that need thought sendResponse(preparedResult); } else { context.attach(EarlyResponseSendListener.ATTACHMENT_KEY, new EarlyResponseSendListener() { @Override public void sendEarlyResponse(OperationContext.ResultAction resultAction) { sendResponse(preparedResult); } }); } }
private static ModelNode getOriginalDomainModel(OperationContext context) { ModelNode model = context.getAttachment(ORIGINAL_DOMAIN_MODEL_ATTACHMENT); if (model == null) { model = Resource.Tools.readModel(context.getOriginalRootResource()); context.attach(ORIGINAL_DOMAIN_MODEL_ATTACHMENT, model); } return model; }
private static ModelNode getOriginalDomainModel(OperationContext context) { ModelNode model = context.getAttachment(ORIGINAL_DOMAIN_MODEL_ATTACHMENT); if (model == null) { model = Resource.Tools.readModel(context.getOriginalRootResource()); context.attach(ORIGINAL_DOMAIN_MODEL_ATTACHMENT, model); } return model; }
private static ModelNode getDomainModel(OperationContext context) { ModelNode model = context.getAttachment(DOMAIN_MODEL_ATTACHMENT); if (model == null) { model = Resource.Tools.readModel(context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS, true)); context.attach(DOMAIN_MODEL_ATTACHMENT, model); } return model; }
private static ModelNode getDomainModel(OperationContext context) { ModelNode model = context.getAttachment(DOMAIN_MODEL_ATTACHMENT); if (model == null) { model = Resource.Tools.readModel(context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS, true)); context.attach(DOMAIN_MODEL_ATTACHMENT, model); } return model; }
public static byte[] storeEmptyContentAndTransformOperation(OperationContext context, ModelNode operation, ContentRepository contentRepository) throws OperationFailedException { final byte[] hash = storeEmptyDeploymentContent(context, contentRepository); // Clear the contents and update with the hash final ModelNode slave = operation.clone(); slave.remove(EMPTY.getName()); ModelNode contentItemNode = new ModelNode(); contentItemNode.get(CONTENT_HASH.getName()).set(hash); contentItemNode.get(CONTENT_ARCHIVE.getName()).set(false); slave.get(CONTENT).setEmptyList().add(contentItemNode); // Add the domain op transformer List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS); if (transformers == null) { context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>()); } transformers.add(new CompositeOperationAwareTransmuter(slave)); return hash; }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { if (context.isResourceServiceRestartAllowed()) { registerAuthConfigFactory(null); SecurityPropertyService securityPropertyService = uninstallSecurityPropertyService(context); if (securityPropertyService != null) { context.attach(SECURITY_PROPERTY_SERVICE_KEY, securityPropertyService); } context.removeService(ProviderRegistrationService.SERVICE_NAME); } else { context.reloadRequired(); } }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final AuthorizationResult authResult = context.authorize(operation, DESCRIBE_EFFECTS); authResult.failIfDenied(operation, context.getCurrentAddress()); // WFCORE-1353. If this op is being used as part of a server launch, pass that info // to any subsystem describe handlers. if (SERVER_LAUNCH.resolveModelAttribute(context, operation).asBoolean()) { context.attach(GenericSubsystemDescribeHandler.SERVER_LAUNCH_KEY, Boolean.TRUE); } super.execute(context, operation); }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final AuthorizationResult authResult = context.authorize(operation, DESCRIBE_EFFECTS); authResult.failIfDenied(operation, context.getCurrentAddress()); // WFCORE-1353. If this op is being used as part of a server launch, pass that info // to any subsystem describe handlers. if (SERVER_LAUNCH.resolveModelAttribute(context, operation).asBoolean()) { context.attach(GenericSubsystemDescribeHandler.SERVER_LAUNCH_KEY, Boolean.TRUE); } super.execute(context, operation); }
@Override protected void recordCapabilitiesAndRequirements(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { super.recordCapabilitiesAndRequirements(context, operation, resource); KnownDeploymentsApi knownDeployments = new KnownDeploymentsApi(); context.registerCapability(RuntimeCapability.Builder .of(CAPABILITY_APPLICATION_SECURITY_DOMAIN_KNOWN_DEPLOYMENTS, true, knownDeployments).build() .fromBaseCapability(context.getCurrentAddressValue())); context.attach(KNOWN_DEPLOYMENTS_KEY, knownDeployments); }
@Override protected void recordCapabilitiesAndRequirements(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { super.recordCapabilitiesAndRequirements(context, operation, resource); KnownDeploymentsApi knownDeployments = new KnownDeploymentsApi(); context.registerCapability(RuntimeCapability.Builder .of(CAPABILITY_APPLICATION_SECURITY_DOMAIN_KNOWN_DEPLOYMENTS, true, knownDeployments).build() .fromBaseCapability(context.getCurrentAddressValue())); context.attach(KNOWN_DEPLOYMENTS_KEY, knownDeployments); }