/** * Returns the address of the specified operation * @param operation an operation * @return a path address */ public static PathAddress getPathAddress(ModelNode operation) { return PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)); }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) { final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR)); final String name = address.getLastElement().getValue(); context.removeService(RemotingProfileService.BASE_SERVICE_NAME.append(name)); }
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final String parameterName = operation.require(NAME).asString(); final ModelNode submodel = context.readResource(PathAddress.EMPTY_ADDRESS, false).getModel(); final ModelNode currentValue = submodel.hasDefined(parameterName) ? submodel.get(parameterName).clone() : new ModelNode(); context.getResult().set(currentValue); } }
@Override protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException { ModelNode opAddr = operation.require(OP_ADDR); PathAddress address = PathAddress.pathAddress(opAddr); final String securityDomain = address.getLastElement().getValue(); String principal = null; if (operation.hasDefined(Constants.PRINCIPAL_ARGUMENT)) principal = operation.get(Constants.PRINCIPAL_ARGUMENT).asString(); ServiceController<SecurityDomainContext> controller = getSecurityDomainService(context, securityDomain); if (controller != null) { // FIXME this is nasty. waitForService(controller); SecurityDomainContext sdc = controller.getValue(); @SuppressWarnings("unchecked") CacheableManager<?, Principal> manager = (CacheableManager<?, Principal>) sdc.getAuthenticationManager(); if (principal != null) manager.flushCache(new SimplePrincipal(principal)); else manager.flushCache(); } else { throw SecurityLogger.ROOT_LOGGER.noAuthenticationCacheAvailable(securityDomain); } // Can't rollback context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); } }
@Override protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException { String opName = operation.require(ModelDescriptionConstants.OP).asString(); PathAddress address = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)); final T dataSource = getDataSourceConfig(address); if (ModelDescriptionConstants.READ_ATTRIBUTE_OPERATION.equals(opName)) { final String attributeName = operation.require(ModelDescriptionConstants.NAME).asString(); executeReadAttribute(attributeName, context, dataSource, address); } else { throw unknownOperation(opName); } }
} catch (InstanceNotFoundException e) { final PathAddress address = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)); final PathElement element = address.getLastElement();
private static ServiceName componentServiceName(final OperationContext context, final ModelNode operation) { final PathAddress address = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)); final String parent; final String module; int i = 2; if (address.getElement(1).getKey().equals(ModelDescriptionConstants.SUBDEPLOYMENT)) { parent = resolveRuntimeName(context,address.getElement(0)); module = address.getElement(1).getValue(); i++; } else { parent = null; module = resolveRuntimeName(context,address.getElement(0)); } final String component = address.getElement(i).getValue(); final ServiceName deploymentUnitServiceName; if (parent == null) { deploymentUnitServiceName = Services.deploymentUnitName(module); } else { deploymentUnitServiceName = Services.deploymentUnitName(parent, module); } // Hmm, don't like the START bit return BasicComponent.serviceNameOf(deploymentUnitServiceName, component).append("START"); }
protected void writeRemote(final XMLExtendedStreamWriter writer, final ModelNode model) throws XMLStreamException { // only write if non-default value? if (model.hasDefined(EJB3SubsystemModel.CLIENT_MAPPINGS_CLUSTER_NAME)) { writer.writeAttribute(EJB3SubsystemXMLAttribute.CLIENT_MAPPINGS_CLUSTER_NAME.getLocalName(), model.require(EJB3SubsystemModel.CLIENT_MAPPINGS_CLUSTER_NAME).asString()); } writer.writeAttribute(EJB3SubsystemXMLAttribute.CONNECTOR_REF.getLocalName(), model.require(EJB3SubsystemModel.CONNECTOR_REF).asString()); writer.writeAttribute(EJB3SubsystemXMLAttribute.THREAD_POOL_NAME.getLocalName(), model.require(EJB3SubsystemModel.THREAD_POOL_NAME).asString()); EJB3RemoteResourceDefinition.EXECUTE_IN_WORKER.marshallAsAttribute(model, writer); // write out any channel creation options if (model.hasDefined(CHANNEL_CREATION_OPTIONS)) { writeChannelCreationOptions(writer, model.get(CHANNEL_CREATION_OPTIONS)); } }
protected void populateModel(ModelNode operation, ModelNode model) throws OperationFailedException { final ModelNode address = operation.require(OP_ADDR); final String driverName = PathAddress.pathAddress(address).getLastElement().getValue(); for (AttributeDefinition attribute : Constants.JDBC_DRIVER_ATTRIBUTES) { // https://issues.jboss.org/browse/WFLY-9324 skip validation on driver-name if (!attribute.getName().equals(DRIVER_NAME_NAME)) { attribute.validateAndSet(operation, model); } } model.get(DRIVER_NAME.getName()).set(driverName);//this shouldn't be here anymore }
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final ModelNode address = operation.require(OP_ADDR); final String idName = PathAddress.pathAddress(address).getLastElement().getValue(); ModelNode model = context.readResource(PathAddress.EMPTY_ADDRESS).getModel(); final String archiveOrModuleName; if (!model.hasDefined(ARCHIVE.getName()) && !model.hasDefined(MODULE.getName())) { throw ConnectorLogger.ROOT_LOGGER.archiveOrModuleRequired(); if (model.get(ARCHIVE.getName()).isDefined()) { archiveOrModuleName = model.get(ARCHIVE.getName()).asString(); } else { archiveOrModuleName = model.get(MODULE.getName()).asString();
@Override protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException { String opName = operation.require(ModelDescriptionConstants.OP).asString(); boolean forWrite = isForWrite(opName); PathAddress address = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)); final ServiceName serviceName = getComponentConfiguration(context,address); T component = getComponent(serviceName, address, context, forWrite); if (ModelDescriptionConstants.READ_ATTRIBUTE_OPERATION.equals(opName)) { final String attributeName = operation.require(ModelDescriptionConstants.NAME).asString(); executeReadAttribute(attributeName, context, component, address); } else if (ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION.equals(opName)) { final String attributeName = operation.require(ModelDescriptionConstants.NAME).asString(); executeWriteAttribute(attributeName, context, operation, component, address); } else { executeAgainstComponent(context, operation, component, opName, address); } }
T getComponent(OperationContext context, ModelNode operation) throws OperationFailedException{ PathAddress address = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)); final ServiceName serviceName = getComponentConfiguration(context,address); T component = getComponent(serviceName, address, context, false); return component; }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { nameValidator.validate(operation); final String attributeName = operation.require(NAME).asString(); // Don't require VALUE. Let the validator decide if it's bothered by an undefined value ModelNode newValue = operation.hasDefined(VALUE) ? operation.get(VALUE) : new ModelNode(); final ModelNode resolvedValue = newValue.resolve(); switch (attributeName) { case ModelDescriptionConstants.STATISTICS_ENABLED: { stats.setEnabled(resolvedValue.asBoolean()); break; } } }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { String datasourceName = PathAddress.pathAddress(operation.require(OP_ADDR)).getLastElement().getValue(); ServiceName datasourceServiceName = AbstractDataSourceDefinition.DATA_SOURCE_CAPABILITY.getCapabilityServiceName(datasourceName); context.removeService(datasourceServiceName); } }
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final ModelNode opAddr = operation.require(OP_ADDR); final String idName = PathAddress.pathAddress(opAddr).getLastElement().getValue(); final boolean isModule; if (!model.hasDefined(ARCHIVE.getName()) && !model.hasDefined(MODULE.getName())) { throw ConnectorLogger.ROOT_LOGGER.archiveOrModuleRequired(); if (model.get(ARCHIVE.getName()).isDefined()) { isModule = false; archiveOrModuleName = model.get(ARCHIVE.getName()).asString(); } else { isModule = true; archiveOrModuleName = model.get(MODULE.getName()).asString(); if (model.hasDefined(RESOURCEADAPTERS_NAME)) { for (ModelNode raNode : model.get(RESOURCEADAPTERS_NAME).asList()) { ModelNode raCompensatingNode = raNode.clone();
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { operationDeprecated(context, operation); PathAddress address = translateProxyPath(context); String type = operation.require(LoadMetricResourceDefinition.Attribute.TYPE.getName()).asString(); PathAddress metricPath = PathAddress.pathAddress(DynamicLoadProviderResourceDefinition.LEGACY_PATH, LoadMetricResourceDefinition.pathElement(type)); PathAddress metricPathAddress = address.append(metricPath); ModelNode metricOperation = Util.createRemoveOperation(metricPathAddress); OperationEntry removeOperationEntry = context.getResourceRegistration().getOperationEntry(PathAddress.pathAddress(metricPath), ModelDescriptionConstants.REMOVE); context.addStep(metricOperation, removeOperationEntry.getOperationHandler(), OperationContext.Stage.MODEL, true); } };
@Override protected void recoverServices(final OperationContext context, final ModelNode operation, final ModelNode profileNode) throws OperationFailedException { try { final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR)); RemotingProfileAdd.INSTANCE.installServices(context, address, profileNode); } catch (OperationFailedException e) { throw ControllerLogger.ROOT_LOGGER.failedToRecoverServices(e); } }