Moved the amp-store related command to the activemq-amqp-store module. Hand to introduce dynamic Command discovery to get this working and remove the compile time dependency on activemq-spring from the activemq-console module.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1407178 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2012-11-08 17:35:58 +00:00
parent 5f9b11cd95
commit 60646c955b
50 changed files with 327 additions and 285 deletions

View File

@ -42,96 +42,29 @@
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>activeio-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.activemq.protobuf</groupId>
<artifactId>activemq-protobuf</artifactId>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.fusesource.mqtt-client</groupId>
<artifactId>mqtt-client</artifactId>
</dependency>
<!-- =============================== -->
<!-- Optional Dependencies -->
<!-- =============================== -->
<!-- needed for the amq-store tools -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
<groupId>${project.groupId}</groupId>
<artifactId>activemq-console</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-jaas</artifactId>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.0.1B_spec</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-j2ee-management_1.1_spec</artifactId>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-annotation_1.0_spec</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jacc_1.1_spec</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
<optional>true</optional>
</dependency>
<!-- for XML parsing -->
<dependency>
<groupId>org.apache.xbean</groupId>
<artifactId>xbean-spring</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
</dependency>
<!-- not really a dependency at all - just added optionally to get the generator working -->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-openwire-generator</artifactId>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.josql</artifactId>
<optional>true</optional>
</dependency>
@ -148,101 +81,11 @@
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
<resource>
<directory>${project.basedir}/src/main/filtered-resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only.
It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.activemq.protobuf</groupId>
<artifactId>activemq-protobuf</artifactId>
<versionRange>[0.0.0,)</versionRange>
<goals>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>always</forkMode>
<argLine>${surefire.argLine}</argLine>
<runOrder>alphabetical</runOrder>
<systemProperties>
<property>
<name>org.apache.activemq.default.directory.prefix</name>
<value>target/</value>
</property>
<!-- Uncomment the following if you want to configure custom logging (using src/test/resources/log4j.properties)
while running mvn:test
Note: if you want to see log messages on the console window remove
"redirectTestOutputToFile" from the parent pom
-->
<!--
<property>
<name>log4j.configuration</name>
<value>file:target/test-classes/log4j.properties</value>
</property>
-->
</systemProperties>
<includes>
<include>**/*Test.*</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.activemq.protobuf</groupId>
<artifactId>activemq-protobuf</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>

View File

@ -26,6 +26,16 @@ public class AMQJournalToolCommand implements Command {
private CommandContext context;
@Override
public String getName() {
return "journal-audit";
}
@Override
public String getOneLineDescription() {
return "Allows you to view records stored in the persistent journal.";
}
public void execute(List<String> tokens) throws Exception {
AMQJournalTool consumerTool = new AMQJournalTool();
String args[] = new String[tokens.size()];

View File

@ -26,6 +26,16 @@ public class AMQJournalToolCommand implements Command {
private CommandContext context;
@Override
public String getName() {
return "journal-audit";
}
@Override
public String getOneLineDescription() {
return "Allows you to view records stored in the persistent journal.";
}
public void execute(List<String> tokens) throws Exception {
AMQJournalTool consumerTool = new AMQJournalTool();
String args[] = new String[tokens.size()];

View File

@ -0,0 +1,17 @@
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
org.apache.activemq.console.command.store.amq.AMQJournalToolCommand

View File

@ -98,4 +98,20 @@ public final class BrokerFactory {
return createBroker(new URI(brokerURI), startBroker);
}
private static final ThreadLocal<Boolean> START_DEFAULT = new ThreadLocal<Boolean>();
public static void setStartDefault(boolean startDefault) {
START_DEFAULT.set(startDefault);
}
public static void resetStartDefault() {
START_DEFAULT.remove();
}
public static boolean getStartDefault() {
Boolean value = START_DEFAULT.get();
if( value==null ) {
return true;
}
return value.booleanValue();
}
}

View File

@ -47,14 +47,14 @@
<dependencies>
<!-- activemq related dependencies -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>activemq-spring</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>activemq-amq-store</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>${project.groupId}</groupId>-->
<!--<artifactId>activemq-spring</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>${project.groupId}</groupId>-->
<!--<artifactId>activemq-amq-store</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>activemq-kahadb-store</artifactId>

View File

@ -30,6 +30,7 @@ import org.apache.activemq.command.ActiveMQTopic;
import org.apache.activemq.console.util.AmqMessagesUtil;
public class AmqBrowseCommand extends AbstractAmqCommand {
public static final String QUEUE_PREFIX = "queue:";
public static final String TOPIC_PREFIX = "topic:";
@ -88,6 +89,16 @@ public class AmqBrowseCommand extends AbstractAmqCommand {
private final Set<String> groupViews = new HashSet<String>(10);
private final Set queryViews = new HashSet(10);
@Override
public String getName() {
return "browse";
}
@Override
public String getOneLineDescription() {
return "Display selected messages in a specified destination.";
}
/**
* Execute the browse command, which allows you to browse the messages in a
* given JMS destination

View File

@ -79,6 +79,16 @@ public class BrowseCommand extends AbstractJmxCommand {
private final Set<String> groupViews = new HashSet<String>(10);
private final Set queryViews = new HashSet(10);
@Override
public String getName() {
return "browse";
}
@Override
public String getOneLineDescription() {
return "Used to browse a destination";
}
/**
* Execute the browse command, which allows you to browse the messages in a
* given JMS destination

View File

@ -40,7 +40,17 @@ public class BstatCommand extends QueryCommand {
" activemq-admin bstat localhost",
" - Display a summary of statistics for the broker 'localhost'"
};
@Override
public String getName() {
return "bstat";
}
@Override
public String getOneLineDescription() {
return "Performs a predefined query that displays useful statistics regarding the specified broker";
}
/**
* Performs a predefiend query option
* @param tokens - command arguments

View File

@ -22,7 +22,11 @@ import java.util.List;
import org.apache.activemq.console.CommandContext;
public interface Command {
String getName();
String getOneLineDescription();
void setCommandContext( CommandContext context );
/**

View File

@ -67,6 +67,16 @@ public class CreateCommand extends AbstractCommand {
protected File amqHome;
protected File targetAmqBase;
@Override
public String getName() {
return "create";
}
@Override
public String getOneLineDescription() {
return "Creates a runnable broker instance in the specified path.";
}
protected void runTask(List<String> tokens) throws Exception {
context.print("Running create broker task...");
amqHome = new File(System.getProperty("activemq.home"));

View File

@ -34,6 +34,16 @@ public class DecryptCommand extends EncryptCommand {
""
};
@Override
public String getName() {
return "decrypt";
}
@Override
public String getOneLineDescription() {
return "Decrypts given text";
}
@Override
protected void runTask(List<String> tokens) throws Exception {
if (password == null || input == null) {

View File

@ -38,6 +38,16 @@ public class EncryptCommand extends AbstractCommand {
String input;
String password;
@Override
public String getName() {
return "encrypt";
}
@Override
public String getOneLineDescription() {
return "Encrypts given text";
}
@Override
protected void printHelp() {
context.printHelp(helpFile);

View File

@ -39,6 +39,16 @@ public class ListCommand extends AbstractJmxCommand {
""
};
@Override
public String getName() {
return "list";
}
@Override
public String getOneLineDescription() {
return "Lists all available brokers in the specified JMX context";
}
/**
* List all running brokers registered in the specified JMX context
* @param tokens - command arguments

View File

@ -70,6 +70,16 @@ public class PurgeCommand extends AbstractJmxCommand {
private final List<String> queryAddObjects = new ArrayList<String>(10);
private final List<String> querySubObjects = new ArrayList<String>(10);
@Override
public String getName() {
return "purge";
}
@Override
public String getOneLineDescription() {
return "Delete selected destination's messages that matches the message selector";
}
/**
* Execute the purge command, which allows you to purge the messages in a
* given JMS destination

View File

@ -98,6 +98,16 @@ public class QueryCommand extends AbstractJmxCommand {
private final List<String> querySubObjects = new ArrayList<String>(10);
private final Set queryViews = new HashSet(10);
@Override
public String getName() {
return "query";
}
@Override
public String getOneLineDescription() {
return "Display selected broker component's attributes and statistics.";
}
/**
* Queries the mbeans registered in the specified JMX context
*

View File

@ -16,15 +16,12 @@
*/
package org.apache.activemq.console.command;
import org.apache.activemq.console.CommandContext;
import org.apache.activemq.console.formatter.CommandShellOutputFormatter;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.activemq.console.CommandContext;
import org.apache.activemq.console.command.store.amq.AMQJournalToolCommand;
import org.apache.activemq.console.formatter.CommandShellOutputFormatter;
import java.util.*;
public class ShellCommand extends AbstractCommand {
@ -37,36 +34,52 @@ public class ShellCommand extends AbstractCommand {
public ShellCommand(boolean interactive) {
this.interactive = interactive;
this.helpFile = new String[] {
interactive ? "Usage: [task] [task-options] [task data]" : "Usage: Main [--extdir <dir>] [task] [task-options] [task data]",
"",
"Tasks:",
" start - Creates and starts a broker using a configuration file, or a broker URI.",
" create - Creates a runnable broker instance in the specified path",
" stop - Stops a running broker specified by the broker name.",
" list - Lists all available brokers in the specified JMX context.",
" query - Display selected broker component's attributes and statistics.",
" browse - Display selected messages in a specified destination.",
" journal-audit - Allows you to view records stored in the persistent journal.",
" export - Exports a stopped brokers data files to an archive file",
" purge - Delete selected destination's messages that matches the message selector",
" encrypt - Encrypts given text",
" decrypt - Decrypts given text",
"",
"Task Options (Options specific to each task):",
" --extdir <dir> - Add the jar files in the directory to the classpath.",
" --version - Display the version information.",
" -h,-?,--help - Display this help information. To display task specific help, use " + (interactive ? "" : "Main ") + "[task] -h,-?,--help",
"",
"Task Data:",
" - Information needed by each specific task.",
"",
"JMX system property options:",
" -Dactivemq.jmx.url=<jmx service uri> (default is: 'service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi')",
" -Dactivemq.jmx.user=<user name>",
" -Dactivemq.jmx.password=<password>",
""
};
ArrayList<String> help = new ArrayList<String>();
help.addAll(Arrays.asList(new String[] {
interactive ? "Usage: [task] [task-options] [task data]" : "Usage: Main [--extdir <dir>] [task] [task-options] [task data]",
"",
"Tasks:"}));
ArrayList<Command> commands = getCommands();
Collections.sort(commands, new Comparator<Command>() {
@Override
public int compare(Command command, Command command1) {
return command.getName().compareTo(command1.getName());
}
});
for( Command command: commands) {
help.add(String.format(" %-24s - %s", command.getName(), command.getOneLineDescription()));
}
help.addAll(Arrays.asList(new String[] {
"",
"Task Options (Options specific to each task):",
" --extdir <dir> - Add the jar files in the directory to the classpath.",
" --version - Display the version information.",
" -h,-?,--help - Display this help information. To display task specific help, use " + (interactive ? "" : "Main ") + "[task] -h,-?,--help",
"",
"Task Data:",
" - Information needed by each specific task.",
"",
"JMX system property options:",
" -Dactivemq.jmx.url=<jmx service uri> (default is: 'service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi')",
" -Dactivemq.jmx.user=<user name>",
" -Dactivemq.jmx.password=<password>",
""
}));
this.helpFile = help.toArray(new String[help.size()]);
}
@Override
public String getName() {
return "shell";
}
@Override
public String getOneLineDescription() {
return "Runs the activemq sub shell";
}
/**
@ -116,36 +129,22 @@ public class ShellCommand extends AbstractCommand {
if (tokens.size() > 0) {
Command command=null;
String taskToken = (String)tokens.remove(0);
if (taskToken.equals("start")) {
command = new StartCommand();
} else if (taskToken.equals("create")) {
command = new CreateCommand();
} else if (taskToken.equals("stop")) {
command = new ShutdownCommand();
} else if (taskToken.equals("list")) {
command = new ListCommand();
} else if (taskToken.equals("query")) {
command = new QueryCommand();
} else if (taskToken.equals("bstat")) {
command = new BstatCommand();
} else if (taskToken.equals("browse")) {
command = new AmqBrowseCommand();
} else if (taskToken.equals("purge")) {
command = new PurgeCommand();
} else if (taskToken.equals("journal-audit")) {
command = new AMQJournalToolCommand();
} else if (taskToken.equals("encrypt")) {
command = new EncryptCommand();
} else if (taskToken.equals("decrypt")) {
command = new DecryptCommand();
} else if (taskToken.equals("export")) {
command = new StoreExportCommand();
} else if (taskToken.equals("help")) {
printHelp();
} else {
printHelp();
for( Command c: getCommands() ) {
if( taskToken.equals(c.getName()) ) {
command = c;
break;
}
}
if( command == null ) {
if (taskToken.equals("help")) {
printHelp();
} else {
printHelp();
}
}
if( command!=null ) {
command.setCommandContext(context);
command.execute(tokens);
@ -156,6 +155,15 @@ public class ShellCommand extends AbstractCommand {
}
ArrayList<Command> getCommands() {
ServiceLoader<Command> loader = ServiceLoader.load(Command.class);
ArrayList<Command> rc = new ArrayList<Command>();
for( Command command: loader ) {
rc.add(command);
}
return rc;
}
/**
* Print the help messages for the browse command
*/

View File

@ -52,6 +52,16 @@ public class ShutdownCommand extends AbstractJmxCommand {
private boolean isStopAllBrokers;
@Override
public String getName() {
return "stop";
}
@Override
public String getOneLineDescription() {
return "Stops a running broker specified by the broker name.";
}
/**
* Shuts down the specified broker or brokers
*

View File

@ -61,6 +61,16 @@ public class StartCommand extends AbstractCommand {
private URI configURI;
private List<BrokerService> brokers = new ArrayList<BrokerService>(5);
@Override
public String getName() {
return "start";
}
@Override
public String getOneLineDescription() {
return "Creates and starts a broker using a configuration file, or a broker URI.";
}
/**
* The default task to start a broker or a group of brokers
*

View File

@ -32,6 +32,16 @@ import javax.management.ObjectName;
*/
public class StopGracefullyCommand extends ShutdownCommand {
@Override
public String getName() {
return "stop-gracefully";
}
@Override
public String getOneLineDescription() {
return "Stops a running broker gracefully.";
}
protected String connectorName, queueName;
protected long timeout;
protected long pollInterval;

View File

@ -35,6 +35,16 @@ public class StoreExportCommand implements Command {
this.context = context;
}
@Override
public String getName() {
return "export";
}
@Override
public String getOneLineDescription() {
return "Exports a stopped brokers data files to an archive file";
}
@Override
public void execute(List<String> tokens) throws Exception {
StoreExporter exporter = new StoreExporter();

View File

@ -24,7 +24,6 @@ import org.apache.activemq.console.command.store.proto.QueueEntryPB;
import org.apache.activemq.console.command.store.proto.QueuePB;
import org.apache.activemq.openwire.OpenWireFormat;
import org.apache.activemq.store.*;
import org.apache.activemq.xbean.XBeanBrokerFactory;
import org.codehaus.jackson.map.ObjectMapper;
import org.fusesource.hawtbuf.AsciiBuffer;
import org.fusesource.hawtbuf.DataByteArrayOutputStream;
@ -70,9 +69,9 @@ public class StoreExporter {
throw new Exception("required --file option missing");
}
System.out.println("Loading: " + config);
XBeanBrokerFactory.setStartDefault(false); // to avoid the broker auto-starting..
BrokerFactory.setStartDefault(false); // to avoid the broker auto-starting..
BrokerService broker = BrokerFactory.createBroker(config);
XBeanBrokerFactory.resetStartDefault();
BrokerFactory.resetStartDefault();
PersistenceAdapter store = broker.getPersistenceAdapter();
System.out.println("Starting: " + store);
store.start();

View File

@ -0,0 +1,27 @@
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
org.apache.activemq.console.command.CreateCommand
org.apache.activemq.console.command.StartCommand
org.apache.activemq.console.command.ShutdownCommand
org.apache.activemq.console.command.ListCommand
org.apache.activemq.console.command.AmqBrowseCommand
org.apache.activemq.console.command.QueryCommand
org.apache.activemq.console.command.BstatCommand
org.apache.activemq.console.command.EncryptCommand
org.apache.activemq.console.command.DecryptCommand
org.apache.activemq.console.command.StoreExportCommand
org.apache.activemq.console.command.PurgeCommand

View File

@ -52,7 +52,7 @@ public class TestAMQ3410 extends TestCase {
}
protected AbstractApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("activemq.xml");
return new ClassPathXmlApplicationContext("org/apache/activemq/console/command/activemq.xml");
}
protected void tearDown() throws Exception {

View File

@ -51,7 +51,7 @@ public class TestAMQ3411 extends TestCase {
}
protected AbstractApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("activemq.xml");
return new ClassPathXmlApplicationContext("org/apache/activemq/console/command/activemq.xml");
}
protected void tearDown() throws Exception {

View File

@ -118,7 +118,7 @@ public class TestPurgeCommand extends TestCase {
}
protected AbstractApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("activemq.xml");
return new ClassPathXmlApplicationContext("org/apache/activemq/console/command/activemq.xml");
}
protected void tearDown() throws Exception {

View File

@ -6,9 +6,9 @@
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -24,10 +24,10 @@
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
<!-- Default configuration -->
<broker id="default" useJmx="false" xmlns="http://activemq.apache.org/schema/core">
<persistenceFactory>
<journalPersistenceAdapterFactory journalLogFiles="2" dataDirectory="target/foo"/>
</persistenceFactory>
@ -35,10 +35,10 @@
<transportConnectors>
<transportConnector uri="tcp://localhost:61616" />
</transportConnectors>
</broker>
<bean id="localbroker" class="org.apache.activemq.broker.BrokerService"
<bean id="localbroker" class="org.apache.activemq.broker.BrokerService"
init-method="start">
<property name="brokerName" value = "localbroker"/>
<property name="persistent" value = "false"/>
@ -48,7 +48,7 @@
</list>
</property>
</bean>
<!-- JMS ConnectionFactory to use local broker -->
<bean id="localFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
@ -57,21 +57,21 @@
<!-- Example of broker configuration that uses new logging options and dynamic management of logging
<broker useJmx="true" xmlns="http://activemq.apache.org/schema/core" persistent="false" deleteAllMessagesOnStartup="true">
<transportConnectors>
<transportConnector uri="tcp://localhost:61616?trace=true&amp;logWriterName=custom&amp;dynamicManagement=true&amp;startLogging=true"/>
</transportConnectors>
<persistenceAdapter>
<memoryPersistenceAdapter/>
</persistenceAdapter>
</broker>
End of example-->
<!-- Note: the jmxPort=portnumber option on transportConnectors should only be used on clients.
On brokers, there is a default port (usually 1099) -->
</beans>
<!-- END SNIPPET: xbean -->

View File

@ -177,14 +177,6 @@
<artifactId>jettison</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.josql</artifactId>
</dependency>
<!--
TODO: Not needed, but OSGi bundle on the way: https://issues.apache.org/jira/browse/SMX4-1238
<dependency>

View File

@ -41,7 +41,6 @@ import org.springframework.core.io.Resource;
*/
public class XBeanBrokerFactory implements BrokerFactoryHandler {
private static final transient Logger LOG = LoggerFactory.getLogger(XBeanBrokerFactory.class);
private static final ThreadLocal<Boolean> START_DEFAULT = new ThreadLocal<Boolean>();
static {
PropertyEditorManager.registerEditor(URI.class, URIEditor.class);
@ -111,19 +110,4 @@ public class XBeanBrokerFactory implements BrokerFactoryHandler {
}
}
public static void setStartDefault(boolean startDefault) {
START_DEFAULT.set(startDefault);
}
public static void resetStartDefault() {
START_DEFAULT.remove();
}
public static boolean getStartDefault() {
Boolean value = START_DEFAULT.get();
if( value==null ) {
return true;
}
return value.booleanValue();
}
}

View File

@ -21,6 +21,7 @@ import java.io.IOException;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.apache.activemq.broker.BrokerFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.usage.SystemUsage;
import org.springframework.beans.CachedIntrospectionResults;
@ -44,7 +45,7 @@ public class XBeanBrokerService extends BrokerService {
private boolean start;
public XBeanBrokerService() {
start = XBeanBrokerFactory.getStartDefault();
start = BrokerFactory.getStartDefault();
}
/**