Permalink
Browse files

[AS7-4756] Support expressions in messaging paths

  • Loading branch information...
1 parent a47d5b5 commit b87f0b6d1cade8422e6d3614827e5c42ed2ef1f7 @jmesnil jmesnil committed with kabir Jun 4, 2012
View
6 messaging/src/main/java/org/jboss/as/messaging/CommonAttributes.java
@@ -34,6 +34,7 @@
import static org.hornetq.core.config.impl.ConfigurationImpl.DEFAULT_MEMORY_WARNING_THRESHOLD;
import static org.hornetq.core.config.impl.ConfigurationImpl.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE;
import static org.hornetq.core.config.impl.ConfigurationImpl.DEFAULT_THREAD_POOL_MAX_SIZE;
+import static org.jboss.as.controller.SimpleAttributeDefinitionBuilder.create;
import static org.jboss.as.controller.client.helpers.MeasurementUnit.MILLISECONDS;
import static org.jboss.as.controller.client.helpers.MeasurementUnit.PERCENTAGE;
import static org.jboss.as.controller.registry.AttributeAccess.Flag.RESTART_ALL_SERVICES;
@@ -444,7 +445,10 @@
.setAllowNull(true)
.build();
- SimpleAttributeDefinition PATH = new SimpleAttributeDefinition("path", ModelType.STRING, false);
+ SimpleAttributeDefinition PATH = create("path", ModelType.STRING)
+ .setAllowExpression(true)
+ .setAllowNull(true)
+ .build();
SimpleAttributeDefinition PERF_BLAST_PAGES = new SimpleAttributeDefinition("perf-blast-pages",
new ModelNode().set(ConfigurationImpl.DEFAULT_JOURNAL_PERF_BLAST_PAGES), ModelType.INT, true,
View
10 messaging/src/main/java/org/jboss/as/messaging/HornetQServerAdd.java
@@ -207,13 +207,13 @@ public void execute(OperationContext context, ModelNode operation) throws Operat
// Create path services
- String bindingsPath = getPath(DEFAULT_BINDINGS_DIR, model.get(PATH, BINDINGS_DIRECTORY));
+ String bindingsPath = getPath(DEFAULT_BINDINGS_DIR, CommonAttributes.PATH.resolveModelAttribute(context, model.get(PATH, BINDINGS_DIRECTORY)));
String bindingsRelativeToPath = getRelativeToPath(model.get(PATH, BINDINGS_DIRECTORY));
- String journalPath = getPath(DEFAULT_JOURNAL_DIR, model.get(PATH, JOURNAL_DIRECTORY));
+ String journalPath = getPath(DEFAULT_JOURNAL_DIR, CommonAttributes.PATH.resolveModelAttribute(context, model.get(PATH, JOURNAL_DIRECTORY)));
String journalRelativeToPath = getRelativeToPath(model.get(PATH, JOURNAL_DIRECTORY));
- String largeMessagePath = getPath(DEFAULT_LARGE_MESSAGE_DIR, model.get(PATH, LARGE_MESSAGES_DIRECTORY));
+ String largeMessagePath = getPath(DEFAULT_LARGE_MESSAGE_DIR, CommonAttributes.PATH.resolveModelAttribute(context, model.get(PATH, LARGE_MESSAGES_DIRECTORY)));
String largeMessageRelativeToPath = getRelativeToPath(model.get(PATH, LARGE_MESSAGES_DIRECTORY));
- String pagingPath = getPath(DEFAULT_PAGING_DIR, model.get(PATH, PAGING_DIRECTORY));
+ String pagingPath = getPath(DEFAULT_PAGING_DIR, CommonAttributes.PATH.resolveModelAttribute(context, model.get(PATH, PAGING_DIRECTORY)));
String pagingRelativeToPath = getRelativeToPath(model.get(PATH, PAGING_DIRECTORY));
// Create the HornetQ Service
@@ -456,7 +456,7 @@ static void processSecuritySettings(final OperationContext context, final Config
* @return the path
*/
static String getPath(final String name, final ModelNode path) {
- return path.hasDefined(PATH) ? path.get(PATH).asString() : DEFAULT_PATH + name;
+ return path.isDefined() ? path.asString() : DEFAULT_PATH + name;
}
/**
View
2 messaging/src/test/resources/org/jboss/as/messaging/test/subsystem_1_2.xml
@@ -19,7 +19,7 @@
<page-max-concurrent-io>10</page-max-concurrent-io>
<paging-directory path="test" relative-to="test" />
<bindings-directory path="test" relative-to="test" />
- <journal-directory path="test" relative-to="test" />
+ <journal-directory path="${my.journal.dir}" relative-to="test" />
<large-messages-directory path="test" relative-to="test" />
<connectors>
<connector name="myconnector">

0 comments on commit b87f0b6

Please sign in to comment.