mirror of https://github.com/apache/activemq.git
AMQ-3665: Moved code for creating VelocityContext into its own method createVelocityContext().
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1234781 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4ddd9019c8
commit
95355ae6e3
|
@ -88,6 +88,30 @@ public class AMQJournalTool {
|
|||
consumerTool.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new VelocityContext that is pre-populated with the JVMs
|
||||
* system properties.
|
||||
*
|
||||
* @return - the VelocityContext that got created.
|
||||
*/
|
||||
protected VelocityContext createVelocityContext() {
|
||||
VelocityContext ctx = new VelocityContext();
|
||||
List keys = Arrays.asList(ctx.getKeys());
|
||||
|
||||
for (Iterator iterator = System.getProperties().entrySet()
|
||||
.iterator(); iterator.hasNext();) {
|
||||
Map.Entry kv = (Map.Entry) iterator.next();
|
||||
String name = (String) kv.getKey();
|
||||
String value = (String) kv.getValue();
|
||||
|
||||
if (!keys.contains(name)) {
|
||||
ctx.put(name, value);
|
||||
}
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
|
||||
|
||||
public void execute() throws Exception {
|
||||
|
||||
if( help ) {
|
||||
|
@ -120,27 +144,13 @@ public class AMQJournalTool {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
context = new VelocityContext();
|
||||
List keys = Arrays.asList(context.getKeys());
|
||||
|
||||
for (Iterator iterator = System.getProperties().entrySet()
|
||||
.iterator(); iterator.hasNext();) {
|
||||
Map.Entry kv = (Map.Entry) iterator.next();
|
||||
String name = (String) kv.getKey();
|
||||
String value = (String) kv.getValue();
|
||||
|
||||
if (!keys.contains(name)) {
|
||||
context.put(name, value);
|
||||
}
|
||||
}
|
||||
context = createVelocityContext();
|
||||
|
||||
velocity = new VelocityEngine();
|
||||
velocity.setProperty(Velocity.RESOURCE_LOADER, "all");
|
||||
velocity.setProperty("all.resource.loader.class", CustomResourceLoader.class.getName());
|
||||
velocity.init();
|
||||
|
||||
|
||||
resources.put("message", messageFormat);
|
||||
resources.put("topicAck", topicAckFormat);
|
||||
resources.put("queueAck", queueAckFormat);
|
||||
|
@ -189,7 +199,6 @@ public class AMQJournalTool {
|
|||
|
||||
private void process(Entry entry) throws Exception {
|
||||
|
||||
Location location = entry.getLocation();
|
||||
DataStructure record = entry.getRecord();
|
||||
|
||||
switch (record.getDataStructureType()) {
|
||||
|
|
Loading…
Reference in New Issue