org.jboss.as.controller.descriptions.ModelDescriptionConstants Java Examples
The following examples show how to use
org.jboss.as.controller.descriptions.ModelDescriptionConstants.
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: OrderedChildResourceExtension.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
private ModelNode parseChild(XMLExtendedStreamReader reader) throws XMLStreamException { ModelNode add = null; int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); final String attribute = reader.getAttributeLocalName(i); switch (attribute) { case "name": { add = Util.createAddOperation(PathAddress.pathAddress( PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, SUBSYSTEM_NAME), PathElement.pathElement("child", value))); break; } default: { throw ParseUtils.unexpectedAttribute(reader, i); } } } if (add == null) { throw ParseUtils.missingRequired(reader, Collections.singleton("child")); } // Require no content ParseUtils.requireNoContent(reader); return add; }
Example #2
Source File: HostInfo.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override public boolean isOperationExcluded(PathAddress address, String operationName) { if (address.size() > 0) { final PathElement element = address.getElement(0); final String type = element.getKey(); final String name = element.getValue(); final boolean domainExcluding = ignoreUnaffectedConfig && !hostDeclaredIgnoreUnaffected && requiredConfigurationHolder != null; switch (type) { case ModelDescriptionConstants.EXTENSION: return domainIgnoredExtensions != null && domainIgnoredExtensions.contains(element.getValue()); case PROFILE: return domainExcluding && ((CLONE.equals(operationName) && address.size() == 1) || !requiredConfigurationHolder.getProfiles().contains(name)); case SERVER_GROUP: return domainExcluding && !requiredConfigurationHolder.getServerGroups().contains(name); case SOCKET_BINDING_GROUP: return domainExcluding && ((CLONE.equals(operationName) && address.size() == 1) || !requiredConfigurationHolder.getSocketBindings().contains(name)); } } return false; }
Example #3
Source File: ReadMasterDomainModelUtil.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
private void describe(final PathAddress base, final Resource resource, List<ModelNode> nodes, boolean isRuntimeChange) { if (resource.isProxy() || resource.isRuntime()) { return; // ignore runtime and proxies } else if (base.size() >= 1 && base.getElement(0).getKey().equals(ModelDescriptionConstants.HOST)) { return; // ignore hosts } if (base.size() == 1) { newRootResources.add(base.getLastElement()); } final ModelNode description = new ModelNode(); description.get(DOMAIN_RESOURCE_ADDRESS).set(base.toModelNode()); description.get(DOMAIN_RESOURCE_MODEL).set(resource.getModel()); Set<String> orderedChildren = resource.getOrderedChildTypes(); if (orderedChildren.size() > 0) { ModelNode orderedChildTypes = description.get(DOMAIN_RESOURCE_PROPERTIES, ORDERED_CHILD_TYPES_PROPERTY); for (String type : orderedChildren) { orderedChildTypes.add(type); } } nodes.add(description); for (final String childType : resource.getChildTypes()) { for (final Resource.ResourceEntry entry : resource.getChildren(childType)) { describe(base.append(entry.getPathElement()), entry, nodes, isRuntimeChange); } } }
Example #4
Source File: AttributeDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
/** * Finds a value in the given {@code operationObject} whose key matches this attribute's {@link #getName() name}, * validates it using this attribute's {@link #getValidator() validator}, and, stores it under this attribute's name in the given {@code model}. * * @param operationObject model node of type {@link ModelType#OBJECT}, typically representing an operation request * @param model model node in which the value should be stored * * @throws OperationFailedException if the value is not valid */ public final void validateAndSet(ModelNode operationObject, final ModelNode model) throws OperationFailedException { if (operationObject.hasDefined(name) && deprecationData != null && deprecationData.isNotificationUseful()) { ControllerLogger.DEPRECATED_LOGGER.attributeDeprecated(getName(), PathAddress.pathAddress(operationObject.get(ModelDescriptionConstants.OP_ADDR)).toCLIStyleString()); } // AS7-6224 -- convert expression strings to ModelType.EXPRESSION *before* correcting ModelNode newValue = convertParameterExpressions(operationObject.get(name)); final ModelNode correctedValue = correctValue(newValue, model.get(name)); if (!correctedValue.equals(operationObject.get(name))) { operationObject.get(name).set(correctedValue); } ModelNode node = validateOperation(operationObject, true); if (node.getType() == ModelType.EXPRESSION && (referenceRecorder != null || flags.contains(AttributeAccess.Flag.EXPRESSIONS_DEPRECATED))) { ControllerLogger.DEPRECATED_LOGGER.attributeExpressionDeprecated(getName(), PathAddress.pathAddress(operationObject.get(ModelDescriptionConstants.OP_ADDR)).toCLIStyleString()); } model.get(name).set(node); }
Example #5
Source File: ReadResourceHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void validate(ModelNode operation) throws OperationFailedException { super.validate(operation); for (AttributeDefinition def : DEFINITION.getParameters()) { def.validateOperation(operation); } if (operation.hasDefined(ModelDescriptionConstants.ATTRIBUTES_ONLY)) { if (operation.hasDefined(ModelDescriptionConstants.RECURSIVE)) { throw ControllerLogger.ROOT_LOGGER.cannotHaveBothParameters(ModelDescriptionConstants.ATTRIBUTES_ONLY, ModelDescriptionConstants.RECURSIVE); } if (operation.hasDefined(ModelDescriptionConstants.RECURSIVE_DEPTH)) { throw ControllerLogger.ROOT_LOGGER.cannotHaveBothParameters(ModelDescriptionConstants.ATTRIBUTES_ONLY, ModelDescriptionConstants.RECURSIVE_DEPTH); } } if( operation.hasDefined(ModelDescriptionConstants.RESOLVE_EXPRESSIONS)){ if(operation.get(ModelDescriptionConstants.RESOLVE_EXPRESSIONS).asBoolean(false) && !resolvable){ throw ControllerLogger.ROOT_LOGGER.unableToResolveExpressions(); } } }
Example #6
Source File: SnapshotDeleteHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { AuthorizationResult authorizationResult = context.authorize(operation); if (authorizationResult.getDecision() == AuthorizationResult.Decision.DENY) { throw ControllerLogger.ROOT_LOGGER.unauthorized(operation.get(OP).asString(), context.getCurrentAddress(), authorizationResult.getExplanation()); } String name = operation.require(ModelDescriptionConstants.NAME).asString(); try { persister.deleteSnapshot(name); } catch (Exception e) { throw new OperationFailedException(e); } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); }
Example #7
Source File: TransformationTargetImpl.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override public OperationTransformer resolveTransformer(TransformationContext context, final PathAddress address, final String operationName) { if(address.size() == 0) { // TODO use registry registry to register this operations. if(ModelDescriptionConstants.COMPOSITE.equals(operationName)) { return new CompositeOperationTransformer(); } } if (operationIgnoredRegistry.isOperationExcluded(address, operationName)) { ControllerLogger.MGMT_OP_LOGGER.tracef("Excluding operation %s to %s", operationName, address); return OperationTransformer.DISCARD; } if (version.getMajor() < 3 && ModelDescriptionConstants.QUERY.equals(operationName)) { // TODO use transformer inheritance and register this normally return QueryOperationHandler.TRANSFORMER; } final OperationTransformerRegistry.OperationTransformerEntry entry = registry.resolveOperationTransformer(address, operationName, placeholderResolver); return entry.getTransformer(); }
Example #8
Source File: HTTPSManagementInterfaceTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
/** * Change security realm and reload server if different security realm is requested. * * In case desired realm is already set do nothing. * * @param securityRealmName * @throws Exception */ private static void changeSecurityRealmForHttpMngmntInterface(String securityRealmName) throws Exception { try (ModelControllerClient client = getNativeModelControllerClient()) { String originSecurityRealm = ""; ModelNode operation = createOpNode("core-service=management/management-interface=http-interface", READ_ATTRIBUTE_OPERATION); operation.get(NAME).set("security-realm"); final ModelNode result = client.execute(operation); if (SUCCESS.equals(result.get(OUTCOME).asString())) { originSecurityRealm = result.get(RESULT).asString(); } if (!originSecurityRealm.equals(securityRealmName)) { operation = createOpNode("core-service=management/management-interface=http-interface", ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION); operation.get(NAME).set("security-realm"); operation.get(VALUE).set(securityRealmName); CoreUtils.applyUpdate(operation, client); reloadServer(); } } }
Example #9
Source File: DomainRootTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Test public void testEmptyRoot() throws Exception { KernelServices kernelServices = createEmptyRoot(); ModelNode model = kernelServices.readWholeModel(false, true); assertAttribute(model, ModelDescriptionConstants.NAMESPACES, new ModelNode().setEmptyList()); assertAttribute(model, ModelDescriptionConstants.SCHEMA_LOCATIONS, new ModelNode().setEmptyList()); assertAttribute(model, ModelDescriptionConstants.NAME, new ModelNode("Unnamed Domain")); assertAttribute(model, ModelDescriptionConstants.PRODUCT_NAME, null); assertAttribute(model, ModelDescriptionConstants.PRODUCT_VERSION, null); assertAttribute(model, ModelDescriptionConstants.MANAGEMENT_MAJOR_VERSION, new ModelNode(Version.MANAGEMENT_MAJOR_VERSION)); assertAttribute(model, ModelDescriptionConstants.MANAGEMENT_MINOR_VERSION, new ModelNode(Version.MANAGEMENT_MINOR_VERSION)); assertAttribute(model, ModelDescriptionConstants.MANAGEMENT_MICRO_VERSION, new ModelNode(Version.MANAGEMENT_MICRO_VERSION)); assertAttribute(model, ServerDescriptionConstants.PROCESS_TYPE, new ModelNode("Domain Controller")); assertAttribute(model, ServerDescriptionConstants.LAUNCH_TYPE, new ModelNode("DOMAIN")); //These two cannot work in tests - placeholder assertAttribute(model, ModelDescriptionConstants.RELEASE_VERSION, new ModelNode("Unknown")); assertAttribute(model, ModelDescriptionConstants.RELEASE_CODENAME, new ModelNode("")); //Try changing namespaces, schema-locations and name }
Example #10
Source File: ManagedDMRContentResource.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override public synchronized void writeModel(ModelNode newModel) { if (parent == null) { throw ManagedDMRContentLogger.ROOT_LOGGER.nullParent(); } ModelNode content = newModel.get(ModelDescriptionConstants.CONTENT); try { byte[] hash = parent.storeManagedContent(pathElement.getValue(), content); newModel.get(ModelDescriptionConstants.HASH).set(hash); this.model = null; // force reload } catch (IOException e) { throw new ContentStorageException(e); } }
Example #11
Source File: ReadResourceHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
private void addReadAttributeStep(OperationContext context, PathAddress address, boolean defaults, boolean resolve, boolean includeUndefinedMetricValues, FilteredData localFilteredData, ImmutableManagementResourceRegistration registry, AttributeDefinition.NameAndGroup attributeKey, Map<AttributeDefinition.NameAndGroup, GlobalOperationHandlers.AvailableResponse> responseMap) { // See if there was an override registered for the standard :read-attribute handling (unlikely!!!) OperationStepHandler overrideHandler = registry.getOperationHandler(PathAddress.EMPTY_ADDRESS, READ_ATTRIBUTE_OPERATION); if (overrideHandler != null && (overrideHandler == ReadAttributeHandler.INSTANCE || overrideHandler == ReadAttributeHandler.RESOLVE_INSTANCE)) { // not an override overrideHandler = null; } OperationStepHandler readAttributeHandler = new ReadAttributeHandler(localFilteredData, overrideHandler, (resolve && resolvable)); final ModelNode attributeOperation = Util.getReadAttributeOperation(address, attributeKey.getName()); attributeOperation.get(ModelDescriptionConstants.INCLUDE_DEFAULTS).set(defaults); attributeOperation.get(ModelDescriptionConstants.RESOLVE_EXPRESSIONS).set(resolve); attributeOperation.get(ModelDescriptionConstants.INCLUDE_UNDEFINED_METRIC_VALUES).set(includeUndefinedMetricValues); final ModelNode attrResponse = new ModelNode(); GlobalOperationHandlers.AvailableResponse availableResponse = new GlobalOperationHandlers.AvailableResponse(attrResponse); responseMap.put(attributeKey, availableResponse); GlobalOperationHandlers.AvailableResponseWrapper wrapper = new GlobalOperationHandlers.AvailableResponseWrapper(readAttributeHandler, availableResponse); context.addStep(attrResponse, attributeOperation, wrapper, OperationContext.Stage.MODEL, true); }
Example #12
Source File: RemotingSubsystem11Parser.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
static ModelNode getConnectionAddOperation(final String connectionName, final String outboundSocketBindingRef, final ModelNode userName, final String securityRealm, PathAddress address) { Assert.checkNotNullParam("connectionName", connectionName); Assert.checkNotEmptyParam("connectionName", connectionName); Assert.checkNotNullParam("outboundSocketBindingRef", outboundSocketBindingRef); Assert.checkNotEmptyParam("outboundSocketBindingRef", outboundSocketBindingRef); final ModelNode addOperation = new ModelNode(); addOperation.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD); // /subsystem=remoting/local-outbound-connection=<connection-name> addOperation.get(ModelDescriptionConstants.OP_ADDR).set(address.toModelNode()); // set the other params addOperation.get(CommonAttributes.OUTBOUND_SOCKET_BINDING_REF).set(outboundSocketBindingRef); // optional connection creation options if (userName != null) { addOperation.get(CommonAttributes.USERNAME).set(userName); } if (securityRealm != null) { addOperation.get(CommonAttributes.SECURITY_REALM).set(securityRealm); } return addOperation; }
Example #13
Source File: NativeApiUtilsForPatching.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * returns a list of currently installed patches, containing their IDs */ public static List<String> getInstalledPatches(ModelControllerClient client) throws IOException { final ModelNode patchOperation = new ModelNode(); patchOperation.get(ModelDescriptionConstants.OP_ADDR).add("core-service", "patching"); patchOperation.get(ModelDescriptionConstants.OP).set("read-resource"); patchOperation.get("include-runtime").set(true); ModelNode ret = client.execute(patchOperation); List<ModelNode> list = ret.get("result").get("patches").asList(); List<String> patchesListString = new ArrayList<String>(); for (ModelNode n : list) { patchesListString.add(n.asString()); } return patchesListString; }
Example #14
Source File: ServerRequireRestartTask.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * Transform the operation into something the proxy controller understands. * * @param identity the server identity * @return the transformed operation */ private static ModelNode createOperation(ServerIdentity identity) { // The server address final ModelNode address = new ModelNode(); address.add(ModelDescriptionConstants.HOST, identity.getHostName()); address.add(ModelDescriptionConstants.RUNNING_SERVER, identity.getServerName()); // final ModelNode operation = OPERATION.clone(); operation.get(ModelDescriptionConstants.OP_ADDR).set(address); return operation; }
Example #15
Source File: GlobalOperationsAliasesTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Test public void testSquatterReadResourceDescription() throws Exception { ModelNode operation = createOperation(READ_RESOURCE_DESCRIPTION_OPERATION); operation.get(RECURSIVE).set(true); ModelNode result = executeForResult(operation); checkRootNodeDescription(result, true, false, false); assertFalse(result.get(OPERATIONS).isDefined()); operation = createOperation(READ_RESOURCE_DESCRIPTION_OPERATION, "profile", "profileD"); operation.get(RECURSIVE).set(true); result = executeForResult(operation); checkProfileNodeDescription(result, true, false, false); operation = createOperation(READ_RESOURCE_DESCRIPTION_OPERATION, "profile", "profileD", "subsystem", "subsystem3"); operation.get(RECURSIVE).set(true); result = executeForResult(operation); checkRecursiveSubsystem3Description(result, false, false, false); operation = createOperation(READ_RESOURCE_DESCRIPTION_OPERATION, "profile", "profileD", "subsystem", "subsystem3"); operation.get(RECURSIVE).set(true); operation.get(ModelDescriptionConstants.INCLUDE_ALIASES).set(true); result = executeForResult(operation); checkRecursiveSubsystem3Description(result, true, false, false); operation = createOperation(READ_RESOURCE_DESCRIPTION_OPERATION, "profile", "profileD"); operation.get(ModelDescriptionConstants.INCLUDE_ALIASES).set(true); result = executeForResult(operation); checkProfileNodeDescriptionWithAliases(result, false, false, false); }
Example #16
Source File: LdapAuthenticationResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
public LdapAuthenticationResourceDefinition() { super(new Parameters(PathElement.pathElement(ModelDescriptionConstants.AUTHENTICATION, ModelDescriptionConstants.LDAP), ControllerResolver.getDeprecatedResolver(SecurityRealmResourceDefinition.DEPRECATED_PARENT_CATEGORY, "core.management.security-realm.authentication.ldap")) .setAddHandler(new LdapAuthenticationAddHandler()) .setRemoveHandler(new SecurityRealmChildRemoveHandler(true)) .setAddRestartLevel(OperationEntry.Flag.RESTART_ALL_SERVICES) .setRemoveRestartLevel(OperationEntry.Flag.RESTART_ALL_SERVICES) .setDeprecatedSince(ModelVersion.create(1, 7))); }
Example #17
Source File: AuditLogXml_Legacy.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private void parseFileAuditLogHandler(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list) throws XMLStreamException { final ModelNode add = Util.createAddOperation(); list.add(add); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); if (!isNoNamespaceAttribute(reader, i)) { throw unexpectedAttribute(reader, i); } final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case NAME: { add.get(OP_ADDR).set(address).add(ModelDescriptionConstants.FILE_HANDLER, value); break; } case MAX_FAILURE_COUNT: { FileAuditLogHandlerResourceDefinition.MAX_FAILURE_COUNT.parseAndSetParameter(value, add, reader); break; } case FORMATTER:{ FileAuditLogHandlerResourceDefinition.FORMATTER.parseAndSetParameter(value, add, reader); break; } case PATH: { FileAuditLogHandlerResourceDefinition.PATH.parseAndSetParameter(value, add, reader); break; } case RELATIVE_TO: { FileAuditLogHandlerResourceDefinition.RELATIVE_TO.parseAndSetParameter(value, add, reader); break; } default: { throw unexpectedAttribute(reader, i); } } } requireNoContent(reader); }
Example #18
Source File: SSLMasterSlaveOneWayTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private static void addLocalAuthentication(DomainClient client) throws Exception { ModelNode operation = createOpNode("host=master/core-service=management/security-realm=" + MASTER_MANAGEMENT_REALM + "/authentication=local", ModelDescriptionConstants.ADD); operation.get("default-user").set("$local"); operation.get("skip-group-loading").set("true"); CoreUtils.applyUpdate(operation, client); }
Example #19
Source File: ManagementAuthenticationUsersTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private void authenticationUsersCredentialReferenceStoreAliasTest(String storeName, String username, String pwd) throws Exception { ModelNode op = new ModelNode(); op.get(OP).set(ModelDescriptionConstants.ADD); op.get(OP_ADDR).add(CORE_SERVICE, MANAGEMENT).add(SECURITY_REALM, "ManagementRealm") .add(ModelDescriptionConstants.AUTHENTICATION, ModelDescriptionConstants.USERS) .add(ModelDescriptionConstants.USER, username); op.get("credential-reference").set(prepareCredentialReference(storeName, username)); getClient().execute(new OperationBuilder(op).build()); reload(); processWhoamiOperationSuccess(USERNAME_2, pwd); }
Example #20
Source File: JmxAuditLogHandlerReferenceResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private boolean lookForHandlerForHc(OperationContext context, String name) { final Resource root = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS); for (ResourceEntry entry : root.getChildren(ModelDescriptionConstants.HOST)) { if (entry.getModel().isDefined()) { return lookForHandler(PathAddress.pathAddress(ModelDescriptionConstants.HOST, entry.getName()), root, name); } } return false; }
Example #21
Source File: ServerGroupScopedRoleResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void registerOperations(ManagementResourceRegistration resourceRegistration) { registerAddOperation(resourceRegistration, addHandler); OperationDefinition removeDef = new SimpleOperationDefinitionBuilder(ModelDescriptionConstants.REMOVE, getResourceDescriptionResolver()) .build(); resourceRegistration.registerOperationHandler(removeDef, removeHandler); }
Example #22
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 5 votes |
private void readDeployment(XMLExtendedStreamReader reader, List<ModelNode> resourcesToAdd) throws XMLStreamException { String name = readNameAttribute(reader); ModelNode addSecureDeployment = new ModelNode(); addSecureDeployment.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD); PathAddress addr = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, KeycloakExtension.SUBSYSTEM_NAME), PathElement.pathElement(SecureDeploymentDefinition.TAG_NAME, name)); addSecureDeployment.get(ModelDescriptionConstants.OP_ADDR).set(addr.toModelNode()); List<ModelNode> credentialsToAdd = new ArrayList<>(); while (reader.hasNext() && nextTag(reader) != END_ELEMENT) { String tagName = reader.getLocalName(); if (tagName.equals(CredentialDefinition.TAG_NAME)) { readCredential(reader, addr, credentialsToAdd); continue; } SimpleAttributeDefinition def = SecureDeploymentDefinition.lookup(tagName); if (def == null) throw new XMLStreamException("Unknown secure-deployment tag " + tagName); def.parseAndSetParameter(reader.getElementText(), addSecureDeployment, reader); } /** * TODO need to check realm-ref first. if (!SharedAttributeDefinitons.validateTruststoreSetIfRequired(addSecureDeployment)) { //TODO: externalize the message throw new XMLStreamException("truststore and truststore-password must be set if ssl-required is not none and disable-trust-manager is false."); } */ // Must add credentials after the deployment is added. resourcesToAdd.add(addSecureDeployment); resourcesToAdd.addAll(credentialsToAdd); }
Example #23
Source File: ReadAttributeHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void validate(ModelNode operation) throws OperationFailedException { super.validate(operation); if( operation.hasDefined(ModelDescriptionConstants.RESOLVE_EXPRESSIONS)){ if(operation.get(ModelDescriptionConstants.RESOLVE_EXPRESSIONS).asBoolean(false) && !resolvable){ throw ControllerLogger.ROOT_LOGGER.unableToResolveExpressions(); } } }
Example #24
Source File: ElementProviderAttributeReadHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected void execute(final OperationContext context, final ModelNode operation, final InstalledIdentity installedIdentity) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)); final PathElement element = address.getLastElement(); final String name = element.getValue(); PatchableTarget target = getProvider(name, installedIdentity); final ModelNode result = context.getResult(); handle(result, target); context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); }
Example #25
Source File: CamelRootResource.java From wildfly-camel with Apache License 2.0 | 5 votes |
@Override protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException { String operationName = operation.require(ModelDescriptionConstants.OP).asString(); if (ModelDescriptionConstants.READ_ATTRIBUTE_OPERATION.equals(operationName)) { handleReadAttributeOperation(context, operation); } }
Example #26
Source File: ManagementOpTimeoutTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
protected void checkResponseHeadersForProcessState(CLIOpResult result, String requiredState) { assertNotNull("No response headers!", result.getFromResponse(ModelDescriptionConstants.RESPONSE_HEADERS)); Map responseHeaders = (Map) result.getFromResponse(ModelDescriptionConstants.RESPONSE_HEADERS); Object processState = responseHeaders.get("process-state"); assertNotNull("No process state in response-headers!", processState); assertTrue("Process state is of wrong type!", processState instanceof String); assertEquals("Wrong content of process-state header", requiredState, (String) processState); }
Example #27
Source File: JvmResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
protected JvmResourceDefinition(boolean server) { super(new Parameters(PathElement.pathElement(ModelDescriptionConstants.JVM), new StandardResourceDescriptionResolver(ModelDescriptionConstants.JVM, HostEnvironmentResourceDefinition.class.getPackage().getName() + ".LocalDescriptions", HostEnvironmentResourceDefinition.class.getClassLoader(), true, false)) .setAddHandler(new JVMAddHandler(JvmAttributes.getAttributes(server))) .setRemoveHandler(JVMRemoveHandler.INSTANCE) .setMaxOccurs(server ? 1 : Integer.MAX_VALUE) .setMinOccurs(0)); this.server = server; }
Example #28
Source File: SSLServerIdentityResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
public SSLServerIdentityResourceDefinition() { super(new Parameters(PathElement.pathElement(ModelDescriptionConstants.SERVER_IDENTITY, ModelDescriptionConstants.SSL), ControllerResolver.getDeprecatedResolver(SecurityRealmResourceDefinition.DEPRECATED_PARENT_CATEGORY, "core.management.security-realm.server-identity.ssl")) .setAddHandler(new SecurityRealmChildAddHandler(false, false, ATTRIBUTE_DEFINITIONS)) .setAddRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES) .setRemoveHandler(new SecurityRealmChildRemoveHandler(false)) .setRemoveRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES) .setDeprecatedSince(ModelVersion.create(1, 7))); }
Example #29
Source File: BufferPoolMXBeanResource.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override ResourceEntry getChildEntry(String name) { if (getChildrenNames().contains(name)) { return new LeafPlatformMBeanResource(PathElement.pathElement(ModelDescriptionConstants.NAME, name)); } return null; }
Example #30
Source File: ApplicationClassificationConfigResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private Map<PathAddress, AccessConstraintUtilization> getAccessConstraintUtilizations() { boolean core = ModelDescriptionConstants.CORE.equals(configType); AccessConstraintKey key = new AccessConstraintKey(ModelDescriptionConstants.APPLICATION_CLASSIFICATION, core, core? null : configType, getPathElement().getValue()); return registry.getAccessConstraintUtilizations(key); }