You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2009/06/10 18:49:24 UTC
svn commit: r783418 - in /activemq/sandbox/activemq-flow:
activemq-broker/src/main/java/org/apache/activemq/broker/
activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/
activemq-broker/src/main/java/org/apache/activemq/usage/ activem...
Author: chirino
Date: Wed Jun 10 16:49:23 2009
New Revision: 783418
URL: http://svn.apache.org/viewvc?rev=783418&view=rev
Log:
porting over some of the spring supports bits into the spring module also stubing some of the 5.x broker apis in preparating to port test cases over.
Added:
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerFactory.java (with props)
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerFactoryHandler.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerPlugin.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerRegistry.java (with props)
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/Connection.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnector.java (with props)
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/PolicyMap.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/VMPendingQueueMessageStoragePolicy.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/VMPendingSubscriberMessageStoragePolicy.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/usage/
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/usage/DefaultUsageCapacity.java
- copied unchanged from r783335, activemq/sandbox/activemq-flow/activemq-openwire/src/main/java/org/apache/activemq/usage/DefaultUsageCapacity.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/usage/MemoryUsage.java
- copied unchanged from r783335, activemq/sandbox/activemq-flow/activemq-openwire/src/main/java/org/apache/activemq/usage/MemoryUsage.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/usage/StoreUsage.java (with props)
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/usage/SystemUsage.java (with props)
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/usage/Usage.java
- copied unchanged from r783335, activemq/sandbox/activemq-flow/activemq-openwire/src/main/java/org/apache/activemq/usage/Usage.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/usage/UsageCapacity.java
- copied unchanged from r783335, activemq/sandbox/activemq-flow/activemq-openwire/src/main/java/org/apache/activemq/usage/UsageCapacity.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/usage/UsageListener.java
- copied unchanged from r783335, activemq/sandbox/activemq-flow/activemq-openwire/src/main/java/org/apache/activemq/usage/UsageListener.java
activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/
activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/
activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/
activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/
activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java
activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactoryFactoryBean.java
activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java
activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/SpringSslContext.java
activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/package.html (with props)
activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/xbean/
- copied from r783395, activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/
activemq/sandbox/activemq-flow/activemq-spring/src/test/java/org/
activemq/sandbox/activemq-flow/activemq-spring/src/test/java/org/apache/
activemq/sandbox/activemq-flow/activemq-spring/src/test/java/org/apache/activemq/
activemq/sandbox/activemq-flow/activemq-spring/src/test/java/org/apache/activemq/spring/
- copied from r783310, activemq/trunk/activemq-core/src/test/java/org/apache/activemq/spring/
Modified:
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
activemq/sandbox/activemq-flow/activemq-spring/ (props changed)
activemq/sandbox/activemq-flow/activemq-spring/pom.xml
activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java
activemq/sandbox/activemq-flow/activemq-spring/src/test/java/org/apache/activemq/spring/SpringTestSupport.java
Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerFactory.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerFactory.java?rev=783418&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerFactory.java (added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerFactory.java Wed Jun 10 16:49:23 2009
@@ -0,0 +1,101 @@
+/**
+ * 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.
+ */
+package org.apache.activemq.broker;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.apache.activemq.util.FactoryFinder;
+import org.apache.activemq.util.IOExceptionSupport;
+
+/**
+ * A helper class to create a fully configured broker service using a URI. The
+ * list of currently supported URI syntaxes is described <a
+ * href="http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html">here</a>
+ *
+ * @version $Revision$
+ */
+public final class BrokerFactory {
+
+ private static final FactoryFinder BROKER_FACTORY_HANDLER_FINDER = new FactoryFinder("META-INF/services/org/apache/activemq/broker/");
+
+ private BrokerFactory() {
+ }
+
+ public static BrokerFactoryHandler createBrokerFactoryHandler(String type) throws IOException {
+ try {
+ return (BrokerFactoryHandler)BROKER_FACTORY_HANDLER_FINDER.newInstance(type);
+ } catch (Throwable e) {
+ throw IOExceptionSupport.create("Could not load " + type + " factory:" + e, e);
+ }
+ }
+
+ /**
+ * Creates a broker from a URI configuration
+ *
+ * @param brokerURI the URI scheme to configure the broker
+ * @throws Exception
+ */
+ public static BrokerService createBroker(URI brokerURI) throws Exception {
+ return createBroker(brokerURI, false);
+ }
+
+ /**
+ * Creates a broker from a URI configuration
+ *
+ * @param brokerURI the URI scheme to configure the broker
+ * @param startBroker whether or not the broker should have its
+ * {@link BrokerService#start()} method called after
+ * construction
+ * @throws Exception
+ */
+ public static BrokerService createBroker(URI brokerURI, boolean startBroker) throws Exception {
+ if (brokerURI.getScheme() == null) {
+ throw new IllegalArgumentException("Invalid broker URI, no scheme specified: " + brokerURI);
+ }
+ BrokerFactoryHandler handler = createBrokerFactoryHandler(brokerURI.getScheme());
+ BrokerService broker = handler.createBroker(brokerURI);
+ if (startBroker) {
+ broker.start();
+ }
+ return broker;
+ }
+
+ /**
+ * Creates a broker from a URI configuration
+ *
+ * @param brokerURI the URI scheme to configure the broker
+ * @throws Exception
+ */
+ public static BrokerService createBroker(String brokerURI) throws Exception {
+ return createBroker(new URI(brokerURI));
+ }
+
+ /**
+ * Creates a broker from a URI configuration
+ *
+ * @param brokerURI the URI scheme to configure the broker
+ * @param startBroker whether or not the broker should have its
+ * {@link BrokerService#start()} method called after
+ * construction
+ * @throws Exception
+ */
+ public static BrokerService createBroker(String brokerURI, boolean startBroker) throws Exception {
+ return createBroker(new URI(brokerURI), startBroker);
+ }
+
+}
Propchange: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerFactory.java
------------------------------------------------------------------------------
svn:executable = *
Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerFactoryHandler.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerFactoryHandler.java?rev=783418&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerFactoryHandler.java (added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerFactoryHandler.java Wed Jun 10 16:49:23 2009
@@ -0,0 +1,28 @@
+/**
+ * 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.
+ */
+package org.apache.activemq.broker;
+
+import java.net.URI;
+
+/**
+ * Represents the interface used to create a broker from a URI scheme.
+ *
+ * @version $Revision: 564271 $
+*/
+public interface BrokerFactoryHandler {
+ BrokerService createBroker(URI brokerURI) throws Exception;
+}
Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerPlugin.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerPlugin.java?rev=783418&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerPlugin.java (added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerPlugin.java Wed Jun 10 16:49:23 2009
@@ -0,0 +1,32 @@
+/**
+ * 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.
+ */
+package org.apache.activemq.broker;
+
+/**
+ * Represents a plugin into a Broker
+ *
+ * @version $Revision: 564271 $
+ */
+public interface BrokerPlugin {
+
+ /**
+ * Installs the plugin into the interceptor chain of the broker, returning the new
+ * intercepted broker to use.
+ */
+ Broker installPlugin(Broker broker) throws Exception;
+
+}
Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerRegistry.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerRegistry.java?rev=783418&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerRegistry.java (added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerRegistry.java Wed Jun 10 16:49:23 2009
@@ -0,0 +1,100 @@
+/**
+ * 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.
+ */
+package org.apache.activemq.broker;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @version $Revision: 1.3 $
+ */
+public class BrokerRegistry {
+
+ private static final Log LOG = LogFactory.getLog(BrokerRegistry.class);
+ private static final BrokerRegistry INSTANCE = new BrokerRegistry();
+
+ private final Object mutex = new Object();
+ private final Map<String, BrokerService> brokers = new HashMap<String, BrokerService>();
+
+ public static BrokerRegistry getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * @param brokerName
+ * @return the BrokerService
+ */
+ public BrokerService lookup(String brokerName) {
+ BrokerService result = null;
+ synchronized (mutex) {
+ result = brokers.get(brokerName);
+ if (result == null && brokerName != null && brokerName.equals(BrokerService.DEFAULT_BROKER_NAME)) {
+ result = findFirst();
+ if (result != null) {
+ LOG.warn("Broker localhost not started so using " + result.getBrokerName() + " instead");
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Returns the first registered broker found
+ *
+ * @return the first BrokerService
+ */
+ public BrokerService findFirst() {
+ synchronized (mutex) {
+ Iterator<BrokerService> iter = brokers.values().iterator();
+ while (iter.hasNext()) {
+ return iter.next();
+ }
+ return null;
+ }
+ }
+
+ /**
+ * @param brokerName
+ * @param broker
+ */
+ public void bind(String brokerName, BrokerService broker) {
+ synchronized (mutex) {
+ brokers.put(brokerName, broker);
+ mutex.notifyAll();
+ }
+ }
+
+ /**
+ * @param brokerName
+ */
+ public void unbind(String brokerName) {
+ synchronized (mutex) {
+ brokers.remove(brokerName);
+ }
+ }
+
+ /**
+ * @return the mutex used
+ */
+ public Object getRegistryMutext() {
+ return mutex;
+ }
+}
Propchange: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerRegistry.java
------------------------------------------------------------------------------
svn:executable = *
Modified: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=783418&r1=783417&r2=783418&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java (original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java Wed Jun 10 16:49:23 2009
@@ -17,12 +17,18 @@
package org.apache.activemq.broker;
import java.net.URI;
+import java.util.List;
+import org.apache.activemq.Service;
import org.apache.activemq.broker.region.RegionBroker;
+import org.apache.activemq.usage.SystemUsage;
-public class BrokerService {
+public class BrokerService implements Service {
- public Object getVmConnectorURI() {
+ public static final String DEFAULT_PORT = "61616";
+ public static final String DEFAULT_BROKER_NAME = "localhost";
+
+ public Object getVmConnectorURI() {
// TODO Auto-generated method stub
return null;
}
@@ -61,4 +67,69 @@
return null;
}
+ public void start() throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void stop() throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setPersistent(boolean b) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public TransportConnector addConnector(String uri) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setUseJmx(boolean b) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public <T> void setDestinations(T[] activeMQDestinations) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addConnector(org.apache.activemq.broker.TransportConnector connector) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public List<TransportConnector> getTransportConnectors() {
+ return null;
+ }
+
+ public void setDestinationPolicy(org.apache.activemq.broker.region.policy.PolicyMap policyMap) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public SystemUsage getSystemUsage() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T> T getAdminView() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void addShutdownHook(Runnable runnable) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean isStarted() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
}
Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/Connection.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/Connection.java?rev=783418&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/Connection.java (added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/Connection.java Wed Jun 10 16:49:23 2009
@@ -0,0 +1,5 @@
+package org.apache.activemq.broker;
+
+public class Connection {
+
+}
Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnector.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnector.java?rev=783418&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnector.java (added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnector.java Wed Jun 10 16:49:23 2009
@@ -0,0 +1,49 @@
+/**
+ * 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.
+ */
+package org.apache.activemq.broker;
+
+import java.io.IOException;
+
+import org.apache.activemq.transport.Transport;
+import org.apache.activemq.transport.TransportServer;
+
+
+/**
+ * @org.apache.xbean.XBean
+ * @version $Revision: 1.6 $
+ */
+public class TransportConnector {
+
+ public TransportConnector(TransportServer server) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public TransportServer getServer() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ protected Connection createConnection(Transport transport) throws IOException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getConnectUri() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
Propchange: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnector.java
------------------------------------------------------------------------------
svn:executable = *
Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java?rev=783418&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java (added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java Wed Jun 10 16:49:23 2009
@@ -0,0 +1,21 @@
+package org.apache.activemq.broker.region.policy;
+
+
+public class PolicyEntry {
+
+ public void setMemoryLimit(int i) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setPendingSubscriberPolicy(VMPendingSubscriberMessageStoragePolicy pendingSubscriberMessageStoragePolicy) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setPendingQueuePolicy(VMPendingQueueMessageStoragePolicy pendingQueueMessageStoragePolicy) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/PolicyMap.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/PolicyMap.java?rev=783418&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/PolicyMap.java (added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/PolicyMap.java Wed Jun 10 16:49:23 2009
@@ -0,0 +1,10 @@
+package org.apache.activemq.broker.region.policy;
+
+public class PolicyMap {
+
+ public void setDefaultEntry(PolicyEntry policy) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/VMPendingQueueMessageStoragePolicy.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/VMPendingQueueMessageStoragePolicy.java?rev=783418&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/VMPendingQueueMessageStoragePolicy.java (added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/VMPendingQueueMessageStoragePolicy.java Wed Jun 10 16:49:23 2009
@@ -0,0 +1,5 @@
+package org.apache.activemq.broker.region.policy;
+
+public class VMPendingQueueMessageStoragePolicy {
+
+}
Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/VMPendingSubscriberMessageStoragePolicy.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/VMPendingSubscriberMessageStoragePolicy.java?rev=783418&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/VMPendingSubscriberMessageStoragePolicy.java (added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/VMPendingSubscriberMessageStoragePolicy.java Wed Jun 10 16:49:23 2009
@@ -0,0 +1,5 @@
+package org.apache.activemq.broker.region.policy;
+
+public class VMPendingSubscriberMessageStoragePolicy {
+
+}
Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/usage/StoreUsage.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/usage/StoreUsage.java?rev=783418&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/usage/StoreUsage.java (added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/usage/StoreUsage.java Wed Jun 10 16:49:23 2009
@@ -0,0 +1,48 @@
+/**
+ * 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.
+ */
+package org.apache.activemq.usage;
+
+
+/**
+ * Used to keep track of how much of something is being used so that a
+ * productive working set usage can be controlled. Main use case is manage
+ * memory usage.
+ *
+ * @org.apache.xbean.XBean
+ * @version $Revision: 1.3 $
+ */
+public class StoreUsage extends Usage<StoreUsage> {
+
+
+ public StoreUsage() {
+ super(null, null, 1.0f);
+ }
+
+ public StoreUsage(String name) {
+ super(null, name, 1.0f);
+ }
+
+ public StoreUsage(StoreUsage parent, String name) {
+ super(parent, name, 1.0f);
+ }
+
+ protected long retrieveUsage() {
+ return 0;
+ }
+
+
+}
Propchange: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/usage/StoreUsage.java
------------------------------------------------------------------------------
svn:executable = *
Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/usage/SystemUsage.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/usage/SystemUsage.java?rev=783418&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/usage/SystemUsage.java (added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/usage/SystemUsage.java Wed Jun 10 16:49:23 2009
@@ -0,0 +1,200 @@
+/**
+ * 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.
+ */
+package org.apache.activemq.usage;
+
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import org.apache.activemq.Service;
+//import org.apache.activemq.kaha.Store;
+//import org.apache.activemq.store.PersistenceAdapter;
+
+/**
+ * Holder for Usage instances for memory, store and temp files Main use case is
+ * manage memory usage.
+ *
+ * @org.apache.xbean.XBean
+ * @version $Revision: 1.3 $
+ */
+public class SystemUsage implements Service {
+
+ private SystemUsage parent;
+ private String name;
+ private MemoryUsage memoryUsage;
+// private StoreUsage storeUsage;
+// private TempUsage tempUsage;
+
+ /**
+ * True if someone called setSendFailIfNoSpace() on this particular usage
+ * manager
+ */
+ private boolean sendFailIfNoSpaceExplicitySet;
+ private boolean sendFailIfNoSpace;
+ private List<SystemUsage> children = new CopyOnWriteArrayList<SystemUsage>();
+
+ public SystemUsage() {
+ this("default");
+ }
+
+ public SystemUsage(String name) {
+ this.parent = null;
+ this.name = name;
+ this.memoryUsage = new MemoryUsage(name + ":memory");
+// this.storeUsage = new StoreUsage(name + ":store", adapter);
+// this.tempUsage = new TempUsage(name + ":temp", tempStore);
+ }
+
+ public SystemUsage(SystemUsage parent, String name) {
+ this.parent = parent;
+ this.name = name;
+ this.memoryUsage = new MemoryUsage(parent.memoryUsage, name + ":memory");
+// this.storeUsage = new StoreUsage(parent.storeUsage, name + ":store");
+// this.tempUsage = new TempUsage(parent.tempUsage, name + ":temp");
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return the memoryUsage
+ */
+ public MemoryUsage getMemoryUsage() {
+ return this.memoryUsage;
+ }
+
+// /**
+// * @return the storeUsage
+// */
+// public StoreUsage getStoreUsage() {
+// return this.storeUsage;
+// }
+//
+// /**
+// * @return the tempDiskUsage
+// */
+// public TempUsage getTempUsage() {
+// return this.tempUsage;
+// }
+
+ public String toString() {
+ return "UsageManager(" + getName() + ")";
+ }
+
+ public void start() {
+ if (parent != null) {
+ parent.addChild(this);
+ }
+ this.memoryUsage.start();
+// this.storeUsage.start();
+// this.tempUsage.start();
+ }
+
+ public void stop() {
+ if (parent != null) {
+ parent.removeChild(this);
+ }
+ this.memoryUsage.stop();
+// this.storeUsage.stop();
+// this.tempUsage.stop();
+ }
+
+ /**
+ * Sets whether or not a send() should fail if there is no space free. The
+ * default value is false which means to block the send() method until space
+ * becomes available
+ */
+ public void setSendFailIfNoSpace(boolean failProducerIfNoSpace) {
+ sendFailIfNoSpaceExplicitySet = true;
+ this.sendFailIfNoSpace = failProducerIfNoSpace;
+ }
+
+ public boolean isSendFailIfNoSpace() {
+ if (sendFailIfNoSpaceExplicitySet || parent == null) {
+ return sendFailIfNoSpace;
+ } else {
+ return parent.isSendFailIfNoSpace();
+ }
+ }
+
+ private void addChild(SystemUsage child) {
+ children.add(child);
+ }
+
+ private void removeChild(SystemUsage child) {
+ children.remove(child);
+ }
+
+ public SystemUsage getParent() {
+ return parent;
+ }
+
+ public void setParent(SystemUsage parent) {
+ this.parent = parent;
+ }
+
+ public boolean isSendFailIfNoSpaceExplicitySet() {
+ return sendFailIfNoSpaceExplicitySet;
+ }
+
+ public void setSendFailIfNoSpaceExplicitySet(boolean sendFailIfNoSpaceExplicitySet) {
+ this.sendFailIfNoSpaceExplicitySet = sendFailIfNoSpaceExplicitySet;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ this.memoryUsage.setName(name + ":memory");
+// this.storeUsage.setName(name + ":store");
+// this.tempUsage.setName(name + ":temp");
+ }
+
+ public void setMemoryUsage(MemoryUsage memoryUsage) {
+ if (memoryUsage.getName() == null) {
+ memoryUsage.setName(this.memoryUsage.getName());
+ }
+ if (parent != null) {
+ memoryUsage.setParent(parent.memoryUsage);
+ }
+ this.memoryUsage = memoryUsage;
+ }
+
+// public void setStoreUsage(StoreUsage storeUsage) {
+// if (storeUsage.getStore() == null) {
+// storeUsage.setStore(this.storeUsage.getStore());
+// }
+// if (storeUsage.getName() == null) {
+// storeUsage.setName(this.storeUsage.getName());
+// }
+// if (parent != null) {
+// storeUsage.setParent(parent.storeUsage);
+// }
+// this.storeUsage = storeUsage;
+//
+// }
+//
+// public void setTempUsage(TempUsage tempDiskUsage) {
+// if (tempDiskUsage.getStore() == null) {
+// tempDiskUsage.setStore(this.tempUsage.getStore());
+// }
+// if (tempDiskUsage.getName() == null) {
+// tempDiskUsage.setName(this.tempUsage.getName());
+// }
+// if (parent != null) {
+// tempDiskUsage.setParent(parent.tempUsage);
+// }
+// this.tempUsage = tempDiskUsage;
+// }
+}
Propchange: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/usage/SystemUsage.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: activemq/sandbox/activemq-flow/activemq-spring/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jun 10 16:49:23 2009
@@ -0,0 +1,9 @@
+.project
+.classpath
+.settings
+.wtpmodules
+*.iml
+junit*.properties
+eclipse-classes
+target
+
Modified: activemq/sandbox/activemq-flow/activemq-spring/pom.xml
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-spring/pom.xml?rev=783418&r1=783417&r2=783418&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-spring/pom.xml (original)
+++ activemq/sandbox/activemq-flow/activemq-spring/pom.xml Wed Jun 10 16:49:23 2009
@@ -36,11 +36,28 @@
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-client</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-spring</artifactId>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jms</artifactId>
+ <optional>true</optional>
</dependency>
Added: activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java?rev=783418&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java (added)
+++ activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java Wed Jun 10 16:49:23 2009
@@ -0,0 +1,58 @@
+/**
+ * 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.
+ */
+package org.apache.activemq.spring;
+
+import org.springframework.beans.factory.BeanNameAware;
+import org.springframework.beans.factory.InitializingBean;
+
+/**
+ * A <a href="http://www.springframework.org/">Spring</a> enhanced connection
+ * factory which will automatically use the Spring bean name as the clientIDPrefix property
+ * so that connections created have client IDs related to your Spring.xml file for
+ * easier comprehension from <a href="http://activemq.apache.org/jmx.html">JMX</a>.
+ *
+ * @org.apache.xbean.XBean element="connectionFactory"
+ *
+ * @version $Revision: $
+ */
+public class ActiveMQConnectionFactory extends org.apache.activemq.ActiveMQConnectionFactory implements InitializingBean, BeanNameAware {
+
+ private String beanName;
+ private boolean useBeanNameAsClientIdPrefix;
+
+ public void afterPropertiesSet() throws Exception {
+ if (isUseBeanNameAsClientIdPrefix() && getClientIDPrefix() == null) {
+ setClientIDPrefix(getBeanName());
+ }
+ }
+
+ public String getBeanName() {
+ return beanName;
+ }
+
+ public void setBeanName(String beanName) {
+ this.beanName = beanName;
+ }
+
+ public boolean isUseBeanNameAsClientIdPrefix() {
+ return useBeanNameAsClientIdPrefix;
+ }
+
+ public void setUseBeanNameAsClientIdPrefix(boolean useBeanNameAsClientIdPrefix) {
+ this.useBeanNameAsClientIdPrefix = useBeanNameAsClientIdPrefix;
+ }
+}
Added: activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactoryFactoryBean.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactoryFactoryBean.java?rev=783418&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactoryFactoryBean.java (added)
+++ activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactoryFactoryBean.java Wed Jun 10 16:49:23 2009
@@ -0,0 +1,170 @@
+/**
+ *
+ * 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.
+ */
+package org.apache.activemq.spring;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.beans.factory.FactoryBean;
+
+/**
+ * A helper class for creating a failover configured {@link ActiveMQConnectionFactory}
+ * which supports one or more TCP based hostname/ports which can all be configured in a
+ * consistent way without too much URL hacking.
+ *
+ * @version $Revision: 1.1 $
+ */
+public class ActiveMQConnectionFactoryFactoryBean implements FactoryBean {
+ private List<String> tcpHostAndPorts = new ArrayList<String>();
+
+ // tcp properties
+ private Long maxInactivityDuration;
+ private String tcpProperties;
+
+ // failover properties
+ private Long maxReconnectDelay;
+ private String failoverProperties;
+
+ public Object getObject() throws Exception {
+ ActiveMQConnectionFactory answer = new ActiveMQConnectionFactory();
+ String brokerURL = getBrokerURL();
+ answer.setBrokerURL(brokerURL);
+ return answer;
+ }
+
+ public String getBrokerURL() {
+ StringBuffer buffer = new StringBuffer("failover:(");
+ int counter = 0;
+ for (String tcpHostAndPort : tcpHostAndPorts) {
+ if (counter++ > 0) {
+ buffer.append(",");
+ }
+ buffer.append(createTcpHostAndPortUrl(tcpHostAndPort));
+ }
+ buffer.append(")");
+
+ List<String> parameters = new ArrayList<String>();
+ if (maxReconnectDelay != null) {
+ parameters.add("maxReconnectDelay=" + maxReconnectDelay);
+ }
+ if (notEmpty(failoverProperties)) {
+ parameters.add(failoverProperties);
+ }
+ buffer.append(asQueryString(parameters));
+ return buffer.toString();
+ }
+
+ public Class getObjectType() {
+ return ActiveMQConnectionFactory.class;
+ }
+
+ public boolean isSingleton() {
+ return true;
+ }
+
+ // Properties
+ //-------------------------------------------------------------------------
+
+ public List<String> getTcpHostAndPorts() {
+ return tcpHostAndPorts;
+ }
+
+ public void setTcpHostAndPorts(List<String> tcpHostAndPorts) {
+ this.tcpHostAndPorts = tcpHostAndPorts;
+ }
+
+ public void setTcpHostAndPort(String tcpHostAndPort) {
+ tcpHostAndPorts = new ArrayList<String>();
+ tcpHostAndPorts.add(tcpHostAndPort);
+ }
+
+ public Long getMaxInactivityDuration() {
+ return maxInactivityDuration;
+ }
+
+ public void setMaxInactivityDuration(Long maxInactivityDuration) {
+ this.maxInactivityDuration = maxInactivityDuration;
+ }
+
+ public String getTcpProperties() {
+ return tcpProperties;
+ }
+
+ public void setTcpProperties(String tcpProperties) {
+ this.tcpProperties = tcpProperties;
+ }
+
+ public Long getMaxReconnectDelay() {
+ return maxReconnectDelay;
+ }
+
+ public void setMaxReconnectDelay(Long maxReconnectDelay) {
+ this.maxReconnectDelay = maxReconnectDelay;
+ }
+
+ public String getFailoverProperties() {
+ return failoverProperties;
+ }
+
+ public void setFailoverProperties(String failoverProperties) {
+ this.failoverProperties = failoverProperties;
+ }
+
+ // Implementation methods
+ //-------------------------------------------------------------------------
+
+ /**
+ * Turns a list of query string key=value strings into a query URL string
+ * of the form "?a=x&b=y"
+ */
+ protected String asQueryString(List<String> parameters) {
+ int size = parameters.size();
+ if (size < 1) {
+ return "";
+ }
+ else {
+ StringBuffer buffer = new StringBuffer("?");
+ buffer.append(parameters.get(0));
+ for (int i = 1; i < size; i++) {
+ buffer.append("&");
+ buffer.append(parameters.get(i));
+ }
+ return buffer.toString();
+ }
+ }
+
+ /**
+ * Allows us to add any TCP specific URI configurations
+ */
+ protected String createTcpHostAndPortUrl(String tcpHostAndPort) {
+ List<String> parameters = new ArrayList<String>();
+ if (maxInactivityDuration != null) {
+ parameters.add("wireFormat.maxInactivityDuration=" + maxInactivityDuration);
+ }
+ if (notEmpty(tcpProperties)) {
+ parameters.add(tcpProperties);
+ }
+ return tcpHostAndPort + asQueryString(parameters);
+ }
+
+
+ protected boolean notEmpty(String text) {
+ return text != null && text.length() > 0;
+ }
+
+}
Added: activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java?rev=783418&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java (added)
+++ activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java Wed Jun 10 16:49:23 2009
@@ -0,0 +1,58 @@
+/**
+ * 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.
+ */
+package org.apache.activemq.spring;
+
+import org.springframework.beans.factory.BeanNameAware;
+import org.springframework.beans.factory.InitializingBean;
+
+/**
+ * A <a href="http://www.springframework.org/">Spring</a> enhanced XA connection
+ * factory which will automatically use the Spring bean name as the clientIDPrefix property
+ * so that connections created have client IDs related to your Spring.xml file for
+ * easier comprehension from <a href="http://activemq.apache.org/jmx.html">JMX</a>.
+ *
+ * @org.apache.xbean.XBean element="xaConnectionFactory"
+ *
+ * @version $Revision: $
+ */
+public class ActiveMQXAConnectionFactory extends org.apache.activemq.ActiveMQXAConnectionFactory implements InitializingBean, BeanNameAware {
+
+ private String beanName;
+ private boolean useBeanNameAsClientIdPrefix;
+
+ public void afterPropertiesSet() throws Exception {
+ if (isUseBeanNameAsClientIdPrefix() && getClientIDPrefix() == null) {
+ setClientIDPrefix(getBeanName());
+ }
+ }
+
+ public String getBeanName() {
+ return beanName;
+ }
+
+ public void setBeanName(String beanName) {
+ this.beanName = beanName;
+ }
+
+ public boolean isUseBeanNameAsClientIdPrefix() {
+ return useBeanNameAsClientIdPrefix;
+ }
+
+ public void setUseBeanNameAsClientIdPrefix(boolean useBeanNameAsClientIdPrefix) {
+ this.useBeanNameAsClientIdPrefix = useBeanNameAsClientIdPrefix;
+ }
+}
Added: activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/SpringSslContext.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/SpringSslContext.java?rev=783418&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/SpringSslContext.java (added)
+++ activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/SpringSslContext.java Wed Jun 10 16:49:23 2009
@@ -0,0 +1,194 @@
+/**
+ * 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.
+ */
+package org.apache.activemq.spring;
+
+import java.io.InputStream;
+import java.security.KeyStore;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.TrustManagerFactory;
+
+import org.apache.activemq.broker.SslContext;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.core.io.Resource;
+
+/**
+ * Extends the SslContext so that it's easier to configure from spring.
+ *
+ * @org.apache.xbean.XBean element="sslContext"
+ *
+ * @version $Revision: 656319 $
+ */
+public class SpringSslContext extends SslContext implements InitializingBean {
+
+ private String keyStoreType="jks";
+ private String trustStoreType="jks";
+
+ private String secureRandomAlgorithm="SHA1PRNG";
+ private String keyStoreAlgorithm=KeyManagerFactory.getDefaultAlgorithm();
+ private String trustStoreAlgorithm=TrustManagerFactory.getDefaultAlgorithm();
+
+ private Resource keyStore;
+ private Resource trustStore;
+
+ private String keyStorePassword;
+ private String trustStorePassword;
+
+ public void afterPropertiesSet() throws Exception {
+ keyManagers.addAll(createKeyManagers());
+ trustManagers.addAll(createTrustManagers());
+ if( secureRandom == null ) {
+ secureRandom = createSecureRandom();
+ }
+ }
+
+ private SecureRandom createSecureRandom() throws NoSuchAlgorithmException {
+ return SecureRandom.getInstance(secureRandomAlgorithm);
+ }
+
+ private Collection<TrustManager> createTrustManagers() throws Exception {
+ KeyStore ks = createTrustManagerKeyStore();
+ if( ks ==null ) {
+ return new ArrayList<TrustManager>(0);
+ }
+
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance(trustStoreAlgorithm);
+ tmf.init(ks);
+ return Arrays.asList(tmf.getTrustManagers());
+ }
+
+ private Collection<KeyManager> createKeyManagers() throws Exception {
+ KeyStore ks = createKeyManagerKeyStore();
+ if( ks ==null ) {
+ return new ArrayList<KeyManager>(0);
+ }
+
+ KeyManagerFactory tmf = KeyManagerFactory.getInstance(keyStoreAlgorithm);
+ tmf.init(ks, keyStorePassword==null? null : keyStorePassword.toCharArray());
+ return Arrays.asList(tmf.getKeyManagers());
+ }
+
+ private KeyStore createTrustManagerKeyStore() throws Exception {
+ if( trustStore ==null ) {
+ return null;
+ }
+
+ KeyStore ks = KeyStore.getInstance(trustStoreType);
+ InputStream is=trustStore.getInputStream();
+ try {
+ ks.load(is, trustStorePassword==null? null : trustStorePassword.toCharArray());
+ } finally {
+ is.close();
+ }
+ return ks;
+ }
+
+ private KeyStore createKeyManagerKeyStore() throws Exception {
+ if( keyStore ==null ) {
+ return null;
+ }
+
+ KeyStore ks = KeyStore.getInstance(keyStoreType);
+ InputStream is=keyStore.getInputStream();
+ try {
+ ks.load(is, keyStorePassword==null? null : keyStorePassword.toCharArray());
+ } finally {
+ is.close();
+ }
+ return ks;
+ }
+
+ public String getTrustStoreType() {
+ return trustStoreType;
+ }
+
+ public String getKeyStoreType() {
+ return keyStoreType;
+ }
+
+ public Resource getKeyStore() {
+ return keyStore;
+ }
+
+ public void setKeyStore(Resource keyResource) {
+ this.keyStore = keyResource;
+ }
+
+ public Resource getTrustStore() {
+ return trustStore;
+ }
+
+ public void setTrustStore(Resource trustResource) {
+ this.trustStore = trustResource;
+ }
+
+ public String getKeyStoreAlgorithm() {
+ return keyStoreAlgorithm;
+ }
+
+ public void setKeyStoreAlgorithm(String keyAlgorithm) {
+ this.keyStoreAlgorithm = keyAlgorithm;
+ }
+
+ public String getTrustStoreAlgorithm() {
+ return trustStoreAlgorithm;
+ }
+
+ public void setTrustStoreAlgorithm(String trustAlgorithm) {
+ this.trustStoreAlgorithm = trustAlgorithm;
+ }
+
+ public String getKeyStorePassword() {
+ return keyStorePassword;
+ }
+
+ public void setKeyStorePassword(String keyPassword) {
+ this.keyStorePassword = keyPassword;
+ }
+
+ public String getTrustStorePassword() {
+ return trustStorePassword;
+ }
+
+ public void setTrustStorePassword(String trustPassword) {
+ this.trustStorePassword = trustPassword;
+ }
+
+ public void setKeyStoreType(String keyType) {
+ this.keyStoreType = keyType;
+ }
+
+ public void setTrustStoreType(String trustType) {
+ this.trustStoreType = trustType;
+ }
+
+ public String getSecureRandomAlgorithm() {
+ return secureRandomAlgorithm;
+ }
+
+ public void setSecureRandomAlgorithm(String secureRandomAlgorithm) {
+ this.secureRandomAlgorithm = secureRandomAlgorithm;
+ }
+
+}
Added: activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/package.html
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/package.html?rev=783418&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/package.html (added)
+++ activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/package.html Wed Jun 10 16:49:23 2009
@@ -0,0 +1,25 @@
+<!--
+ 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.
+-->
+<html>
+<head>
+</head>
+<body>
+
+Helper classes for working with the JMS client and <a href="http://www.springframework.org/">Spring</a>.
+
+</body>
+</html>
Propchange: activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/spring/package.html
------------------------------------------------------------------------------
svn:executable = *
Modified: activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java?rev=783418&r1=783395&r2=783418&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java (original)
+++ activemq/sandbox/activemq-flow/activemq-spring/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java Wed Jun 10 16:49:23 2009
@@ -66,14 +66,15 @@
}
}
- private void ensureSystemUsageHasStore() throws IOException {
- SystemUsage usage = getSystemUsage();
- if (usage.getStoreUsage().getStore() == null) {
- usage.getStoreUsage().setStore(getPersistenceAdapter());
- }
- if (usage.getTempUsage().getStore() == null) {
- usage.getTempUsage().setStore(getTempDataStore());
- }
+ private void ensureSystemUsageHasStore() throws IOException {
+// TODO:
+// SystemUsage usage = getSystemUsage();
+// if (usage.getStoreUsage().getStore() == null) {
+// usage.getStoreUsage().setStore(getPersistenceAdapter());
+// }
+// if (usage.getTempUsage().getStore() == null) {
+// usage.getTempUsage().setStore(getTempDataStore());
+// }
}
public void destroy() throws Exception {
Modified: activemq/sandbox/activemq-flow/activemq-spring/src/test/java/org/apache/activemq/spring/SpringTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-spring/src/test/java/org/apache/activemq/spring/SpringTestSupport.java?rev=783418&r1=783310&r2=783418&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-spring/src/test/java/org/apache/activemq/spring/SpringTestSupport.java (original)
+++ activemq/sandbox/activemq-flow/activemq-spring/src/test/java/org/apache/activemq/spring/SpringTestSupport.java Wed Jun 10 16:49:23 2009
@@ -20,7 +20,7 @@
import java.util.List;
import junit.framework.TestCase;
-import org.apache.activemq.test.JmsTopicSendReceiveTest;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.support.AbstractApplicationContext;