use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.
the class ModClusterSubsystemXMLReader_1_0 method readElement.
/**
* {@inheritDoc}
*/
@Override
public void readElement(XMLExtendedStreamReader reader, List<ModelNode> list) throws XMLStreamException {
ParseUtils.requireNoAttributes(reader);
PathAddress address = PathAddress.pathAddress(ModClusterSubsystemResourceDefinition.PATH);
final ModelNode subsystem = new ModelNode();
subsystem.get(OP).set(ADD);
subsystem.get(OP_ADDR).set(address.toModelNode());
list.add(subsystem);
// Reads it
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
final Element element = Element.forName(reader.getLocalName());
switch(element) {
case MOD_CLUSTER_CONFIG:
parseModClusterConfig(reader, list, address);
break;
default:
{
throw unexpectedElement(reader);
}
}
}
}
use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.
the class SecurityDomainAdd method performRuntime.
@Override
protected void performRuntime(OperationContext context, ModelNode operation, final ModelNode model) {
PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR));
final String securityDomain = address.getLastElement().getValue();
// This needs to run after all child resources so that they can detect a fresh state
context.addStep(new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
final Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS);
launchServices(context, securityDomain, Resource.Tools.readModel(resource));
// Rollback handled by the parent step
context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER);
}
}, OperationContext.Stage.RUNTIME);
}
use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.
the class SecuritySubsystemParser method parseAuthorization.
private void parseAuthorization(List<ModelNode> list, PathAddress parentAddress, XMLExtendedStreamReader reader) throws XMLStreamException {
requireNoAttributes(reader);
PathAddress address = parentAddress.append(AUTHORIZATION, CLASSIC);
ModelNode op = Util.createAddOperation(address);
list.add(op);
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
final Element element = Element.forName(reader.getLocalName());
switch(element) {
case POLICY_MODULE:
{
EnumSet<Attribute> required = EnumSet.of(Attribute.CODE, Attribute.FLAG);
EnumSet<Attribute> notAllowed = EnumSet.of(Attribute.TYPE, Attribute.LOGIN_MODULE_STACK_REF);
parseCommonModule(reader, address, POLICY_MODULE, required, notAllowed, list);
break;
}
default:
{
throw unexpectedElement(reader);
}
}
}
}
use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.
the class EEConcurrentManagementTestCase method testManagedScheduledExecutorServiceManagement.
@Test
public void testManagedScheduledExecutorServiceManagement() throws Exception {
final PathAddress pathAddress = EE_SUBSYSTEM_PATH_ADDRESS.append(EESubsystemModel.MANAGED_SCHEDULED_EXECUTOR_SERVICE, RESOURCE_NAME);
// add
final ModelNode addOperation = Util.createAddOperation(pathAddress);
final String jndiName = "java:jboss/ee/concurrency/scheduledexecutor/" + RESOURCE_NAME;
addOperation.get(ManagedScheduledExecutorServiceResourceDefinition.JNDI_NAME).set(jndiName);
addOperation.get(ManagedScheduledExecutorServiceResourceDefinition.CORE_THREADS).set(2);
final ModelNode addResult = managementClient.getControllerClient().execute(addOperation);
Assert.assertFalse(addResult.get(FAILURE_DESCRIPTION).toString(), addResult.get(FAILURE_DESCRIPTION).isDefined());
try {
// lookup
Assert.assertNotNull(new InitialContext().lookup(jndiName));
} finally {
// remove
final ModelNode removeOperation = Util.createRemoveOperation(pathAddress);
removeOperation.get(OPERATION_HEADERS, ALLOW_RESOURCE_SERVICE_RESTART).set(true);
final ModelNode removeResult = managementClient.getControllerClient().execute(removeOperation);
Assert.assertFalse(removeResult.get(FAILURE_DESCRIPTION).toString(), removeResult.get(FAILURE_DESCRIPTION).isDefined());
try {
new InitialContext().lookup(jndiName);
Assert.fail();
} catch (NameNotFoundException e) {
// expected
}
}
}
use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.
the class EEConcurrentManagementTestCase method testManagedExecutorServiceManagement.
@Test
public void testManagedExecutorServiceManagement() throws Exception {
final PathAddress pathAddress = EE_SUBSYSTEM_PATH_ADDRESS.append(EESubsystemModel.MANAGED_EXECUTOR_SERVICE, RESOURCE_NAME);
// add
final ModelNode addOperation = Util.createAddOperation(pathAddress);
final String jndiName = "java:jboss/ee/concurrency/executor/" + RESOURCE_NAME;
addOperation.get(ManagedExecutorServiceResourceDefinition.JNDI_NAME).set(jndiName);
addOperation.get(ManagedExecutorServiceResourceDefinition.CORE_THREADS).set(2);
final ModelNode addResult = managementClient.getControllerClient().execute(addOperation);
Assert.assertFalse(addResult.get(FAILURE_DESCRIPTION).toString(), addResult.get(FAILURE_DESCRIPTION).isDefined());
try {
// lookup
Assert.assertNotNull(new InitialContext().lookup(jndiName));
} finally {
// remove
final ModelNode removeOperation = Util.createRemoveOperation(pathAddress);
removeOperation.get(OPERATION_HEADERS, ALLOW_RESOURCE_SERVICE_RESTART).set(true);
final ModelNode removeResult = managementClient.getControllerClient().execute(removeOperation);
Assert.assertFalse(removeResult.get(FAILURE_DESCRIPTION).toString(), removeResult.get(FAILURE_DESCRIPTION).isDefined());
try {
new InitialContext().lookup(jndiName);
Assert.fail();
} catch (NameNotFoundException e) {
// expected
}
}
}
Aggregations