Java Code Examples for org.jboss.dmr.ModelNode#get()
The following examples show how to use
org.jboss.dmr.ModelNode#get() .
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: JdrArquillianTest.java From thorntail with Apache License 2.0 | 6 votes |
@Test @RunAsClient public void testClient() throws Exception { ModelControllerClient client = ModelControllerClient.Factory.create( "localhost", 9990 ); ModelNode response = client.execute( Operations.createOperation("generate-jdr-report", Operations.createAddress("subsystem", "jdr") ) ); assertThat(response.get("outcome").asString()).isEqualTo("success"); ModelNode result = response.get("result"); String reportLocation = result.get("report-location").asString(); assertThat(reportLocation).endsWith(".zip"); }
Example 2
Source File: DataSourceAddCompositeHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
protected ModelNode buildRequestWithoutHeaders(CommandContext ctx) throws CommandFormatException { final ModelNode req = super.buildRequestWithoutHeaders(ctx); final ModelNode steps = req.get(Util.STEPS); final ModelNode conPropsNode = conProps.toModelNode(ctx); if(conPropsNode != null) { final List<Property> propsList = conPropsNode.asPropertyList(); for(Property prop : propsList) { final ModelNode address = this.buildOperationAddress(ctx); address.add(CONNECTION_PROPERTIES, prop.getName()); final ModelNode addProp = new ModelNode(); addProp.get(Util.ADDRESS).set(address); addProp.get(Util.OPERATION).set(Util.ADD); addProp.get(Util.VALUE).set(prop.getValue()); steps.add(addProp); } } return req; }
Example 3
Source File: SyslogAuditLogProtocolResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
public static void createServerAddOperations(final List<ModelNode> addOps, final PathAddress protocolAddress, final ModelNode protocol) { addOps.add(createProtocolAddOperation(protocolAddress, protocol)); final SyslogAuditLogHandler.Transport transport = SyslogAuditLogHandler.Transport.valueOf(protocolAddress.getLastElement().getValue().toUpperCase(Locale.ENGLISH)); if (transport == SyslogAuditLogHandler.Transport.TLS){ if (protocol.hasDefined(AUTHENTICATION)){ final ModelNode auth = protocol.get(AUTHENTICATION); if (auth.hasDefined(TRUSTSTORE)){ addOps.add(createKeystoreAddOperation(protocolAddress.append(AUTHENTICATION, TRUSTSTORE), protocol.get(AUTHENTICATION, TRUSTSTORE))); } if (auth.hasDefined(CLIENT_CERT_STORE)){ addOps.add(createKeystoreAddOperation(protocolAddress.append(AUTHENTICATION, CLIENT_CERT_STORE), protocol.get(AUTHENTICATION, CLIENT_CERT_STORE))); } } } }
Example 4
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 6 votes |
void writePrincipalNameMapping(XMLExtendedStreamWriter writer, ModelNode model) throws XMLStreamException { ModelNode policy = model.get(Constants.Model.PRINCIPAL_NAME_MAPPING_POLICY); ModelNode mappingAttribute = model.get(Constants.Model.PRINCIPAL_NAME_MAPPING_ATTRIBUTE_NAME); if (!policy.isDefined() && !mappingAttribute.isDefined()) { return; } writer.writeStartElement(Constants.XML.PRINCIPAL_NAME_MAPPING); if (policy.isDefined()) { writer.writeAttribute(Constants.XML.PRINCIPAL_NAME_MAPPING_POLICY, policy.asString()); } if (mappingAttribute.isDefined()) { writer.writeAttribute(Constants.XML.PRINCIPAL_NAME_MAPPING_ATTRIBUTE_NAME, mappingAttribute.asString()); } writer.writeEndElement(); }
Example 5
Source File: DefaultDeploymentOperations.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override public Map<String, Boolean> getDeploymentsStatus() { final ModelNode op = Util.getEmptyOperation(READ_CHILDREN_RESOURCES_OPERATION, new ModelNode()); op.get(CHILD_TYPE).set(DEPLOYMENT); ModelNode response = privilegedExecution().execute(controllerClient::execute, op); // Ensure the operation succeeded before we use the result if(response.get(OUTCOME).isDefined() && !SUCCESS.equals(response.get(OUTCOME).asString())) throw ROOT_LOGGER.deployModelOperationFailed(response.get(FAILURE_DESCRIPTION).asString()); final ModelNode result = response.get(RESULT); final Map<String, Boolean> deployments = new HashMap<String, Boolean>(); if (result.isDefined()) { for (Property property : result.asPropertyList()) { deployments.put(property.getName(), property.getValue().get(ENABLED).asBoolean(false)); } } return deployments; }
Example 6
Source File: AbstractLoggingProfilesTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Test public void testDeploymentConfigurationResource() throws Exception { try { deploy(RUNTIME_NAME1, PROFILE1); // Get the resulting model final ModelNode loggingConfiguration = readDeploymentResource(RUNTIME_NAME1, "profile-" + PROFILE1); Assert.assertTrue("No logging subsystem resource found on the deployment", loggingConfiguration.isDefined()); // Check the handler exists on the configuration final ModelNode handler = loggingConfiguration.get("handler", "DUMMY1"); Assert.assertTrue("The DUMMY1 handler was not found effective configuration", handler.isDefined()); Assert.assertEquals("The level should be ERROR", "ERROR", handler.get("level").asString()); } finally { undeploy(RUNTIME_NAME1); } }
Example 7
Source File: PatchingHistory.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private static void fillHistoryIn(ModelNode result, Entry entry) throws PatchingException { ModelNode history = new ModelNode(); history.get(Constants.PATCH_ID).set(entry.getPatchId()); history.get(Constants.TYPE).set(entry.getType().getName()); final ModelNode appliedAtNode = history.get(Constants.APPLIED_AT); if(entry.getAppliedAt() != null) { appliedAtNode.set(entry.getAppliedAt()); } history.get(Constants.AGED_OUT).set(entry.isAgedOut()); result.add(history); }
Example 8
Source File: ManagedServerOperationsFactory.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private void addManagementAuthorization(ModelNodeList updates) { ModelNode domainConfig = domainModel.get(CORE_SERVICE, MANAGEMENT, ACCESS, AUTHORIZATION); if (domainConfig.isDefined()) { ModelNode baseAddress = new ModelNode(); baseAddress.add(CORE_SERVICE, MANAGEMENT); baseAddress.add(ACCESS, AUTHORIZATION); if (domainConfig.hasDefined(PROVIDER)) { ModelNode providerOp = Util.getWriteAttributeOperation(baseAddress, PROVIDER, domainConfig.get(PROVIDER)); updates.add(providerOp); } addRoleMappings(domainConfig, baseAddress, updates); convertSimpleResources(domainConfig, SERVER_GROUP_SCOPED_ROLE, baseAddress, updates); convertSimpleResources(domainConfig, HOST_SCOPED_ROLE, baseAddress, updates); if (domainConfig.hasDefined(CONSTRAINT)) { ModelNode constraints = domainConfig.get(CONSTRAINT); if (constraints.hasDefined(APPLICATION_CLASSIFICATION)) { convertApplicationClassificationConstraints(constraints.get(APPLICATION_CLASSIFICATION), baseAddress, updates); } if (constraints.hasDefined(SENSITIVITY_CLASSIFICATION)) { convertSensitivityClassificationConstraints(constraints.get(SENSITIVITY_CLASSIFICATION), baseAddress, updates); } if (constraints.hasDefined(VAULT_EXPRESSION)) { ModelNode address = baseAddress.clone().add(CONSTRAINT, VAULT_EXPRESSION); ModelNode ve = constraints.get(VAULT_EXPRESSION); // No add for this one; need to write attributes for (AttributeDefinition ad : SensitivityResourceDefinition.getWritableVaultAttributeDefinitions()) { String attr = ad.getName(); if (ve.hasDefined(attr)) { updates.add(Util.getWriteAttributeOperation(address, attr, ve.get(attr))); } } } } } }
Example 9
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 5 votes |
void writeCertificate(XMLExtendedStreamWriter writer, ModelNode model) throws XMLStreamException { ModelNode value = model.get(Constants.Model.CERTIFICATE_ALIAS); if (!value.isDefined()) { return; } writer.writeStartElement(Constants.XML.CERTIFICATE); SimpleAttributeDefinition attr = KeyStoreCertificateDefinition.CERTIFICATE_ALIAS; attr.getAttributeMarshaller().marshallAsAttribute(attr, model, false, writer); writer.writeEndElement(); }
Example 10
Source File: QueryOperationHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public ModelNode transformResult(ModelNode response) { ControllerLogger.MGMT_OP_LOGGER.tracef("Transforming response %s", response); ModelNode transformedResponse; if (response.hasDefined(RESULT)) { transformedResponse = response.clone(); if (multiTarget) { ModelNode transformedResults = transformedResponse.get(RESULT); for (int i = 0; i < transformedResults.asInt(); i++) { ModelNode item = transformedResults.get(i); transformResponseItem(item); if (!item.hasDefined(RESULT)) { // An undefined result means this one was filtered // If "query" had actually run on the remote slave, this // would not be in response, so we remove it now transformedResults.remove(i); i--; ControllerLogger.MGMT_OP_LOGGER.tracef("Removed response item %s", item); } } } else { transformResponseItem(transformedResponse); } ControllerLogger.MGMT_OP_LOGGER.tracef("Transformed response is %s", transformedResponse); } else { // no transformation is needed transformedResponse = response; } return transformedResponse; }
Example 11
Source File: ManagementReadsTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Test public void testServerReadResource() throws IOException { DomainClient domainClient = domainMasterLifecycleUtil.getDomainClient(); final ModelNode serverOp = new ModelNode(); serverOp.get(OP).set(READ_RESOURCE_OPERATION); ModelNode address = serverOp.get(OP_ADDR); address.add(HOST, "master"); address.add(SERVER, "main-one"); serverOp.get(RECURSIVE).set(true); serverOp.get(INCLUDE_RUNTIME).set(true); serverOp.get(PROXIES).set(false); ModelNode response = domainClient.execute(serverOp); validateResponse(response); // TODO make some more assertions about result content ModelNode result = response.get(RESULT); Assert.assertTrue(result.isDefined()); Assert.assertTrue(result.hasDefined(PROFILE_NAME)); address.setEmptyList(); address.add(HOST, "slave"); address.add(SERVER, "main-three"); response = domainClient.execute(serverOp); validateResponse(response); // TODO make some more assertions about result content result = response.get(RESULT); Assert.assertTrue(result.isDefined()); Assert.assertTrue(result.hasDefined(PROFILE_NAME)); }
Example 12
Source File: HandlersAttributeMarshaller.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void marshallAsElement(final AttributeDefinition attribute, final ModelNode resourceModel, final boolean marshallDefault, final XMLStreamWriter writer) throws XMLStreamException { if (isMarshallable(attribute, resourceModel, marshallDefault)) { writer.writeStartElement(attribute.getXmlName()); final ModelNode handlers = resourceModel.get(attribute.getName()); for (ModelNode handler : handlers.asList()) { if (handler.isDefined()) { writer.writeStartElement(valueType.getXmlName()); writer.writeAttribute(CommonAttributes.HANDLER_NAME.getXmlName(), handler.asString()); writer.writeEndElement(); } } writer.writeEndElement(); } }
Example 13
Source File: ManagementReadsTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private static void validateDomainLifecycleOps(ModelNode response) { ModelNode operations = response.get(RESULT, OPERATIONS); validateOperation(operations, RELOAD_SERVERS, null, BLOCKING, START_MODE); validateOperation(operations, RESTART_SERVERS, null, BLOCKING, START_MODE); validateOperation(operations, RESUME_SERVERS, null); validateOperation(operations, START_SERVERS, null, BLOCKING, START_MODE); validateOperation(operations, STOP_SERVERS, null, BLOCKING, TIMEOUT, SUSPEND_TIMEOUT); validateOperation(operations, SUSPEND_SERVERS, null, TIMEOUT, SUSPEND_TIMEOUT); }
Example 14
Source File: ServerDeploymentPlanResultFuture.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private ServerDeploymentPlanResult getResultFromNode(ModelNode planResultNode) { UUID planId = plan.getId(); Map<UUID, ServerDeploymentActionResult> actionResults = new HashMap<UUID, ServerDeploymentActionResult>(); List<DeploymentActionImpl> actions = plan.getDeploymentActionImpls(); for (int i = 0; i < actions.size(); i++) { DeploymentActionImpl action = actions.get(i); UUID actionId = action.getId(); ModelNode actionResultNode = planResultNode.get("step-" + (i + 1)); actionResults.put(actionId, getActionResult(actionId, actionResultNode)); } return new DeploymentPlanResultImpl(planId, actionResults); }
Example 15
Source File: HostXml_Legacy.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
/** * @return true if discovery options are required, i.e. no host and port set and the admin policy requires a config. */ private boolean parseRemoteDomainControllerAttributes_2_0(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list) throws XMLStreamException { final ModelNode update = new ModelNode(); update.get(OP_ADDR).set(address); update.get(OP).set(RemoteDomainControllerAddHandler.OPERATION_NAME); // Handle attributes AdminOnlyDomainConfigPolicy adminOnlyPolicy = AdminOnlyDomainConfigPolicy.DEFAULT; boolean requireDiscoveryOptions = false; 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); } else { final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case HOST: { DomainControllerWriteAttributeHandler.HOST.parseAndSetParameter(value, update, reader); break; } case PORT: { DomainControllerWriteAttributeHandler.PORT.parseAndSetParameter(value, update, reader); break; } case SECURITY_REALM: { DomainControllerWriteAttributeHandler.SECURITY_REALM.parseAndSetParameter(value, update, reader); break; } case USERNAME: { DomainControllerWriteAttributeHandler.USERNAME.parseAndSetParameter(value, update, reader); break; } case IGNORE_UNUSED_CONFIG: { DomainControllerWriteAttributeHandler.IGNORE_UNUSED_CONFIG.parseAndSetParameter(value, update, reader); break; } case ADMIN_ONLY_POLICY: { DomainControllerWriteAttributeHandler.ADMIN_ONLY_POLICY.parseAndSetParameter(value, update, reader); ModelNode nodeValue = update.get(DomainControllerWriteAttributeHandler.ADMIN_ONLY_POLICY.getName()); if (nodeValue.getType() != ModelType.EXPRESSION) { adminOnlyPolicy = AdminOnlyDomainConfigPolicy.getPolicy(nodeValue.asString()); } break; } default: throw unexpectedAttribute(reader, i); } } } if (!update.hasDefined(DomainControllerWriteAttributeHandler.HOST.getName())) { requireDiscoveryOptions = isRequireDiscoveryOptions(adminOnlyPolicy); } if (!update.hasDefined(DomainControllerWriteAttributeHandler.PORT.getName())) { requireDiscoveryOptions = requireDiscoveryOptions || isRequireDiscoveryOptions(adminOnlyPolicy); } list.add(update); return requireDiscoveryOptions; }
Example 16
Source File: ModelTestUtils.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
public static ModelNode getSubModel(ModelNode model, PathElement pathElement) { return model.get(pathElement.getKey(), pathElement.getValue()); }
Example 17
Source File: HostXml_10.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
private void parseHttpManagementInterfaceAttributes(XMLExtendedStreamReader reader, ModelNode addOp) throws XMLStreamException { 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); } else { final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case HTTP_AUTHENTICATION_FACTORY: { HttpManagementResourceDefinition.HTTP_AUTHENTICATION_FACTORY.parseAndSetParameter(value, addOp, reader); break; } case SASL_PROTOCOL: { HttpManagementResourceDefinition.SASL_PROTOCOL.parseAndSetParameter(value, addOp, reader); break; } case SECURITY_REALM: { HttpManagementResourceDefinition.SECURITY_REALM.parseAndSetParameter(value, addOp, reader); break; } case SERVER_NAME: { HttpManagementResourceDefinition.SERVER_NAME.parseAndSetParameter(value, addOp, reader); break; } case SSL_CONTEXT: { HttpManagementResourceDefinition.SSL_CONTEXT.parseAndSetParameter(value, addOp, reader); break; } case CONSOLE_ENABLED: { HttpManagementResourceDefinition.CONSOLE_ENABLED.parseAndSetParameter(value, addOp, reader); break; } case HTTP_UPGRADE_ENABLED: { ModelNode httpUpgrade = addOp.get(HTTP_UPGRADE); HttpManagementResourceDefinition.ENABLED.parseAndSetParameter(value, httpUpgrade, reader); break; } case ALLOWED_ORIGINS: { HttpManagementResourceDefinition.ALLOWED_ORIGINS.getParser().parseAndSetParameter(HttpManagementResourceDefinition.ALLOWED_ORIGINS, value, addOp, reader); break; } default: throw unexpectedAttribute(reader, i); } } } }
Example 18
Source File: GlobalOperationsAliasesTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Test public void testReadResourceDescriptionAliasMultitargetAddress() throws Exception { final PathAddress parentAddress = PathAddress.pathAddress(PROFILE, "profileE") .append(SUBSYSTEM, "subsystem7") .append("type", "*"); //This maps to /profile=profileE/subsystem=subsystem7/type=*/squatter=one, but the alias should be used final PathAddress squatterAlias = parentAddress.append("squatter-alias", "ONE"); ModelNode result = executeForResult(createOperation(READ_RESOURCE_DESCRIPTION_OPERATION, squatterAlias)); checkRrdAddress(squatterAlias, result); //This maps to /profile=profileE/subsystem=subsystem7/type=*/wildcard=*, but the alias should be used final PathAddress wildCardAlias = parentAddress.append("wildcard-alias", "*"); result = executeForResult(createOperation(READ_RESOURCE_DESCRIPTION_OPERATION, wildCardAlias)); checkRrdAddress(wildCardAlias, result); //Now do the same with a composite with a mixture of real and alias addresses final PathAddress squatterReal = parentAddress.append("squatter", "one"); final PathAddress wildcardReal = parentAddress.append("wildcard"); ModelNode composite = Util.createEmptyOperation(COMPOSITE, PathAddress.EMPTY_ADDRESS); ModelNode steps = composite.get(STEPS); final ModelNode[] ops = new ModelNode[]{ createOperation(READ_RESOURCE_DESCRIPTION_OPERATION, squatterAlias), createOperation(READ_RESOURCE_DESCRIPTION_OPERATION, squatterReal), createOperation(READ_RESOURCE_DESCRIPTION_OPERATION, wildCardAlias), createOperation(READ_RESOURCE_OPERATION, squatterAlias), createOperation(READ_RESOURCE_DESCRIPTION_OPERATION, wildcardReal)}; for (ModelNode op : ops) { steps.add(op.clone()); } result = executeForResult(composite); Assert.assertEquals(ops.length, result.keys().size()); for (int i = 0; i < ops.length; i++) { ModelNode stepResult = result.get("step-" + (i + 1)); Assert.assertTrue(stepResult.isDefined()); Assert.assertEquals(SUCCESS, stepResult.get(OUTCOME).asString()); if (ops[i].get(OP).asString().equals(READ_RESOURCE_DESCRIPTION_OPERATION)) { checkRrdAddress(PathAddress.pathAddress(ops[i].get(OP_ADDR)), stepResult.get(RESULT)); } } }
Example 19
Source File: IdentityOperationsTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Test public void testAddAttribute() throws Exception { KernelServices services = createKernelServicesBuilder(null) .setSubsystemXmlResource("identity-management.xml") .build(); String principalName = "plainUser"; PathAddress realmAddress = getSecurityRealmAddress("FileSystemRealm"); ModelNode operation = createAddIdentityOperation(realmAddress, principalName); ModelNode result = services.executeOperation(operation); assertSuccessful(result); operation = createAddAttributeOperation(realmAddress, principalName, "firstName", "John"); result = services.executeOperation(operation); assertSuccessful(result); operation = createAddAttributeOperation(realmAddress, principalName, "lastName", "Smith"); result = services.executeOperation(operation); assertSuccessful(result); operation = createAddAttributeOperation(realmAddress, principalName, RoleDecoder.KEY_ROLES, "Admin", "Manager", "Employee"); result = services.executeOperation(operation); assertSuccessful(result); operation = createReadIdentityOperation(realmAddress, principalName); result = services.executeOperation(operation); assertSuccessful(result); ModelNode resultNode = result.get(RESULT); ModelNode attributesNode = resultNode.get(ATTRIBUTES); assertTrue(attributesNode.isDefined()); assertAttributeValue(attributesNode, "firstName", "John"); assertAttributeValue(attributesNode, "lastName", "Smith"); assertAttributeValue(attributesNode, RoleDecoder.KEY_ROLES, "Admin", "Manager", "Employee"); operation = createAddAttributeOperation(realmAddress, principalName, "lastName", "Silva"); result = services.executeOperation(operation); assertSuccessful(result); operation = createReadIdentityOperation(realmAddress, principalName); result = services.executeOperation(operation); assertSuccessful(result); resultNode = result.get(RESULT); attributesNode = resultNode.get(ATTRIBUTES); assertTrue(attributesNode.isDefined()); assertAttributeValue(attributesNode, "lastName", "Smith", "Silva"); }
Example 20
Source File: AbstractSyslogReconnectionTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
protected void setupServer() throws Exception { //setup application server for TCP syslog PathAddress tcpSyslogAddress = PathAddress.pathAddress() .append(SUBSYSTEM, "logging") .append("custom-handler", SYSLOG_TCP_HANDLER_NAME); ModelNode tcpSyslogHandler = Util.createAddOperation(tcpSyslogAddress); tcpSyslogHandler.get("class").set("org.jboss.logmanager.handlers.SyslogHandler"); tcpSyslogHandler.get("module").set("org.jboss.logmanager"); tcpSyslogHandler.get("formatter").set("%-5p [%c] (%t) %s%E%n"); tcpSyslogHandler.get("encoding").set("ISO-8859-1"); tcpSyslogHandler.get("enabled").set("true"); ModelNode tcpSyslogProperties = tcpSyslogHandler.get("properties"); tcpSyslogProperties.get("appName").set("Wildfly"); tcpSyslogProperties.get("facility").set("LOCAL_USE_5"); tcpSyslogProperties.get("serverHostname").set(host); tcpSyslogProperties.get("hostname").set("-"); tcpSyslogProperties.get("port").set(SYSLOG_TCP_PORT); tcpSyslogProperties.get("syslogType").set("RFC5424"); tcpSyslogProperties.get("protocol").set("TCP"); tcpSyslogProperties.get("messageDelimiter").set("-"); tcpSyslogProperties.get("useMessageDelimiter").set("true"); executeOperation(tcpSyslogHandler); //setup application server for UDP syslog PathAddress udpSyslogAddress = PathAddress.pathAddress() .append(SUBSYSTEM, "logging") .append("syslog-handler", SYSLOG_UDP_HANDLER_NAME); ModelNode udpSyslogHandler = Util.createAddOperation(udpSyslogAddress); udpSyslogHandler.get("enabled").set("true"); udpSyslogHandler.get("app-name").set("Wildfly"); udpSyslogHandler.get("facility").set("LOCAL_USE_5"); udpSyslogHandler.get("server-address").set(host); udpSyslogHandler.get("hostname").set("-"); udpSyslogHandler.get("port").set(SYSLOG_UDP_PORT); udpSyslogHandler.get("syslog-format").set("RFC5424"); executeOperation(udpSyslogHandler); // add logging category PathAddress categoryLoggerAddress = PathAddress.pathAddress() .append(SUBSYSTEM, "logging") .append("logger", LoggingServiceActivator.class.getPackage().getName()); ModelNode registerTcpSyslogHandler = Util.createAddOperation(categoryLoggerAddress); registerTcpSyslogHandler.get("level").set("INFO"); registerTcpSyslogHandler.get("handlers").add(SYSLOG_TCP_HANDLER_NAME); registerTcpSyslogHandler.get("handlers").add(SYSLOG_UDP_HANDLER_NAME); executeOperation(registerTcpSyslogHandler); }