You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by js...@apache.org on 2006/07/23 12:05:30 UTC

svn commit: r424700 - in /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring: ./ ActiveMQConnectionFactory.java ActiveMQXAConnectionFactory.java package.html

Author: jstrachan
Date: Sun Jul 23 03:05:29 2006
New Revision: 424700

URL: http://svn.apache.org/viewvc?rev=424700&view=rev
Log:
added spring dependent connection factory implementations which autodefault the spring bean names for the clientIDPrefix property making it easier to introspect the running system. Fixes AMQ-840

Added:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java   (with props)
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java   (with props)
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/package.html   (with props)

Added: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java?rev=424700&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java (added)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java Sun Jul 23 03:05:29 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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://incubator.apache.org/activemq/jmx.html">JMX</a>.
+ * 
+ * @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;
+    }
+}

Propchange: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java?rev=424700&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java (added)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java Sun Jul 23 03:05:29 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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://incubator.apache.org/activemq/jmx.html">JMX</a>.
+ * 
+ * @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;
+    }
+}

Propchange: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/package.html
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/package.html?rev=424700&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/package.html (added)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/package.html Sun Jul 23 03:05:29 2006
@@ -0,0 +1,9 @@
+<html>
+<head>
+</head>
+<body>
+
+Helper classes for working with the JMS client and <a href="http://www.springframework.org/">Spring</a>.
+
+</body>
+</html>

Propchange: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/package.html
------------------------------------------------------------------------------
    svn:executable = *