activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r656319 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/ main/java/org/apache/activemq/spring/ main/java/org/apache/activemq/transport/tcp/ main/resources/ main/resources/META-INF/services/org/apache/xbean/sprin...
Date Wed, 14 May 2008 15:32:55 GMT
Author: chirino
Date: Wed May 14 08:32:54 2008
New Revision: 656319

URL: http://svn.apache.org/viewvc?rev=656319&view=rev
Log:
fix for AMQ-1724

Added:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/SslContext.java
  (with props)
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/SpringSslContext.java
  (with props)
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslContextBrokerServiceTest.java
  (with props)
    activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/transport/tcp/
    activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/transport/tcp/activemq-ssl.xml
  (with props)
Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java
    activemq/trunk/activemq-core/src/main/resources/META-INF/services/org/apache/xbean/spring/http/activemq.apache.org/schema/core
    activemq/trunk/activemq-core/src/main/resources/activemq.xsd
    activemq/trunk/activemq-core/src/main/resources/activemq.xsd.html
    activemq/trunk/activemq-core/src/main/resources/activemq.xsd.wiki

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=656319&r1=656318&r2=656319&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Wed May 14 08:32:54 2008
@@ -21,6 +21,8 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.UnknownHostException;
+import java.security.KeyManagementException;
+import java.security.SecureRandom;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -34,6 +36,8 @@
 import javax.management.MBeanServer;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.TrustManager;
 
 import org.apache.activemq.ActiveMQConnectionMetaData;
 import org.apache.activemq.Service;
@@ -79,6 +83,7 @@
 import org.apache.activemq.thread.TaskRunnerFactory;
 import org.apache.activemq.transport.TransportFactory;
 import org.apache.activemq.transport.TransportServer;
+import org.apache.activemq.transport.tcp.SslTransportFactory;
 import org.apache.activemq.transport.vm.VMTransportFactory;
 import org.apache.activemq.usage.SystemUsage;
 import org.apache.activemq.util.IOExceptionSupport;
@@ -172,7 +177,8 @@
     private int timeBeforePurgeTempDestinations = 5000;
     private List<Runnable> shutdownHooks= new ArrayList<Runnable>();
     private boolean systemExitOnShutdown;
-    private int systemExitOnShutdownExitCode;    
+    private int systemExitOnShutdownExitCode;
+    private SslContext sslContext = new SslContext();
     
     static {
         String localHostName = "localhost";
@@ -1952,5 +1958,21 @@
     public void setSystemExitOnShutdown(boolean systemExitOnShutdown) {
         this.systemExitOnShutdown = systemExitOnShutdown;
     }
-    
+
+    public int getSystemExitOnShutdownExitCode() {
+        return systemExitOnShutdownExitCode;
+    }
+
+    public void setSystemExitOnShutdownExitCode(int systemExitOnShutdownExitCode) {
+        this.systemExitOnShutdownExitCode = systemExitOnShutdownExitCode;
+    }
+
+    public SslContext getSslContext() {
+        return sslContext;
+    }
+
+    public void setSslContext(SslContext sslContext) {
+        this.sslContext = sslContext;
+    }
+
 }
\ No newline at end of file

Added: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/SslContext.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/SslContext.java?rev=656319&view=auto
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/SslContext.java
(added)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/SslContext.java
Wed May 14 08:32:54 2008
@@ -0,0 +1,76 @@
+/**
+ * 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.security.SecureRandom;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.TrustManager;
+
+/**
+ * A holder of SSL configuration.
+ */
+public class SslContext {
+    
+    protected List<KeyManager> keyManagers = new ArrayList<KeyManager>();
+    protected List<TrustManager> trustManagers = new ArrayList<TrustManager>();
+    protected SecureRandom secureRandom;
+    
+    public KeyManager[] getKeyManagersAsArray() {
+        KeyManager rc[] = new KeyManager[keyManagers.size()];
+        return keyManagers.toArray(rc);
+    }
+    public TrustManager[] getTrustManagersAsArray() {
+        TrustManager rc[] = new TrustManager[trustManagers.size()];
+        return trustManagers.toArray(rc);
+    }
+    
+    public void addKeyManager(KeyManager km) {
+        keyManagers.add(km);
+    }
+    public boolean removeKeyManager(KeyManager km) {
+        return keyManagers.remove(km);
+    }
+    public void addTrustManager(TrustManager tm) {
+        trustManagers.add(tm);
+    }
+    public boolean removeTrustManager(TrustManager tm) {
+        return trustManagers.remove(tm);
+    }
+    
+    public List<KeyManager> getKeyManagers() {
+        return keyManagers;
+    }
+    public void setKeyManagers(List<KeyManager> keyManagers) {
+        this.keyManagers = keyManagers;
+    }
+    public List<TrustManager> getTrustManagers() {
+        return trustManagers;
+    }
+    public void setTrustManagers(List<TrustManager> trustManagers) {
+        this.trustManagers = trustManagers;
+    }
+    public SecureRandom getSecureRandom() {
+        return secureRandom;
+    }
+    public void setSecureRandom(SecureRandom secureRandom) {
+        this.secureRandom = secureRandom;
+    }
+        
+}

Propchange: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/SslContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/SslContext.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/SpringSslContext.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/SpringSslContext.java?rev=656319&view=auto
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/SpringSslContext.java
(added)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/SpringSslContext.java
Wed May 14 08:32:54 2008
@@ -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$
+ */
+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;
+    }
+
+}

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

Propchange: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/SpringSslContext.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java?rev=656319&r1=656318&r2=656319&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java
Wed May 14 08:32:54 2008
@@ -34,6 +34,9 @@
 import javax.net.ssl.SSLSocketFactory;
 import javax.net.ssl.TrustManager;
 
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.BrokerServiceAware;
+import org.apache.activemq.broker.SslContext;
 import org.apache.activemq.openwire.OpenWireFormat;
 import org.apache.activemq.transport.InactivityMonitor;
 import org.apache.activemq.transport.Transport;
@@ -57,7 +60,7 @@
  * @author David Martin Clavo david(dot)martin(dot)clavo(at)gmail.com (logging improvement
modifications)
  * @version $Revision$
  */
-public class SslTransportFactory extends TcpTransportFactory {
+public class SslTransportFactory extends TcpTransportFactory implements BrokerServiceAware
{
     // The log this uses.,
     private static final Log LOG = LogFactory.getLog(SslTransportFactory.class);
 
@@ -162,6 +165,17 @@
         }
         sslContext.init(km, tm, random);
     }
+    
+    public void setBrokerService(BrokerService brokerService) {
+        SslContext c = brokerService.getSslContext();
+        if( sslContext == null && c!=null ) {            
+            try {
+                setKeyAndTrustManagers(c.getKeyManagersAsArray(), c.getTrustManagersAsArray(),
c.getSecureRandom());
+            } catch (KeyManagementException e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
 
     /**
      * Creates a new SSL ServerSocketFactory. The given factory will use

Modified: activemq/trunk/activemq-core/src/main/resources/META-INF/services/org/apache/xbean/spring/http/activemq.apache.org/schema/core
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/resources/META-INF/services/org/apache/xbean/spring/http/activemq.apache.org/schema/core?rev=656319&r1=656318&r2=656319&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/resources/META-INF/services/org/apache/xbean/spring/http/activemq.apache.org/schema/core
(original)
+++ activemq/trunk/activemq-core/src/main/resources/META-INF/services/org/apache/xbean/spring/http/activemq.apache.org/schema/core
Wed May 14 08:32:54 2008
@@ -210,6 +210,8 @@
 
 simpleMessageGroupMapFactory = org.apache.activemq.broker.region.group.SimpleMessageGroupMapFactory
 
+sslContext = org.apache.activemq.spring.SpringSslContext
+
 statements = org.apache.activemq.store.jdbc.Statements
 
 storeCursor = org.apache.activemq.broker.region.policy.StorePendingQueueMessageStoragePolicy

Modified: activemq/trunk/activemq-core/src/main/resources/activemq.xsd
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/resources/activemq.xsd?rev=656319&r1=656318&r2=656319&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/resources/activemq.xsd (original)
+++ activemq/trunk/activemq-core/src/main/resources/activemq.xsd Wed May 14 08:32:54 2008
@@ -650,6 +650,14 @@
             </xs:choice>
           </xs:complexType>
         </xs:element>
+        <xs:element name='sslContext' minOccurs='0' maxOccurs='1'>
+          <xs:complexType>
+            <xs:choice minOccurs='0' maxOccurs='1'>
+              <xs:element ref='tns:sslContext'/>
+              <xs:any namespace='##other'/>
+            </xs:choice>
+          </xs:complexType>
+        </xs:element>
         <xs:element name='systemUsage' minOccurs='0' maxOccurs='1'>
           <xs:complexType>
             <xs:choice minOccurs='0' maxOccurs='1'>
@@ -806,6 +814,7 @@
       <xs:attribute name='regionBroker' type='xs:string'/>
       <xs:attribute name='shutdownOnMasterFailure' type='xs:boolean'/>
       <xs:attribute name='splitSystemUsageForProducersConsumers' type='xs:boolean'/>
+      <xs:attribute name='sslContext' type='xs:string'/>
       <xs:attribute name='start' type='xs:boolean'>
         <xs:annotation>
           <xs:documentation><![CDATA[
@@ -816,6 +825,8 @@
         </xs:annotation>
       </xs:attribute>
       <xs:attribute name='supportFailOver' type='xs:boolean'/>
+      <xs:attribute name='systemExitOnShutdown' type='xs:boolean'/>
+      <xs:attribute name='systemExitOnShutdownExitCode' type='xs:integer'/>
       <xs:attribute name='systemUsage' type='xs:string'/>
       <xs:attribute name='taskRunnerFactory' type='xs:string'/>
       <xs:attribute name='taskRunnerPriority' type='xs:integer'/>
@@ -858,6 +869,7 @@
           ]]></xs:documentation>
         </xs:annotation>
       </xs:attribute>
+      <xs:attribute name='useTempMirroredQueues' type='xs:boolean'/>
       <xs:attribute name='useVirtualTopics' type='xs:boolean'>
         <xs:annotation>
           <xs:documentation><![CDATA[
@@ -4602,6 +4614,48 @@
   </xs:element>
 
 
+  <!-- element for type: org.apache.activemq.spring.SpringSslContext -->
+  <xs:element name='sslContext'>
+    <xs:annotation>
+      <xs:documentation><![CDATA[
+        Extends the SslContext so that it's easier to configure from spring.
+      ]]></xs:documentation>
+    </xs:annotation>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='keyManagers' minOccurs='0' maxOccurs='1'>
+          <xs:complexType>
+            <xs:sequence minOccurs='0' maxOccurs='unbounded'><xs:any namespace='##other'/></xs:sequence>
+          </xs:complexType>
+        </xs:element>
+        <xs:element name='secureRandom' minOccurs='0' maxOccurs='1'>
+          <xs:complexType>
+            <xs:sequence minOccurs='0' maxOccurs='1'><xs:any namespace='##other'/></xs:sequence>
+          </xs:complexType>
+        </xs:element>
+        <xs:element name='trustManagers' minOccurs='0' maxOccurs='1'>
+          <xs:complexType>
+            <xs:sequence minOccurs='0' maxOccurs='unbounded'><xs:any namespace='##other'/></xs:sequence>
+          </xs:complexType>
+        </xs:element>
+        <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
+      </xs:sequence>
+      <xs:attribute name='keyStore' type='xs:string'/>
+      <xs:attribute name='keyStoreAlgorithm' type='xs:string'/>
+      <xs:attribute name='keyStorePassword' type='xs:string'/>
+      <xs:attribute name='keyStoreType' type='xs:string'/>
+      <xs:attribute name='secureRandom' type='xs:string'/>
+      <xs:attribute name='secureRandomAlgorithm' type='xs:string'/>
+      <xs:attribute name='trustStore' type='xs:string'/>
+      <xs:attribute name='trustStoreAlgorithm' type='xs:string'/>
+      <xs:attribute name='trustStorePassword' type='xs:string'/>
+      <xs:attribute name='trustStoreType' type='xs:string'/>
+      <xs:attribute name='id' type='xs:ID'/>
+      <xs:anyAttribute namespace='##other' processContents='lax'/>
+    </xs:complexType>
+  </xs:element>
+
+
   <!-- element for type: org.apache.activemq.store.jdbc.Statements -->
   <xs:element name='statements'>
     <xs:complexType>
@@ -5132,6 +5186,11 @@
           </xs:complexType>
         </xs:element>
         <xs:element name='brokerService' minOccurs='0' maxOccurs='1'>
+          <xs:annotation>
+            <xs:documentation><![CDATA[
+              This is called by the BrokerService right before it starts the transport.
+            ]]></xs:documentation>
+          </xs:annotation>
           <xs:complexType>
             <xs:choice minOccurs='0' maxOccurs='1'>
               <xs:element ref='tns:broker'/>
@@ -5168,7 +5227,14 @@
         <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
       </xs:sequence>
       <xs:attribute name='brokerInfo' type='xs:string'/>
-      <xs:attribute name='brokerService' type='xs:string'/>
+      <xs:attribute name='brokerName' type='xs:string'/>
+      <xs:attribute name='brokerService' type='xs:string'>
+        <xs:annotation>
+          <xs:documentation><![CDATA[
+            This is called by the BrokerService right before it starts the transport.
+          ]]></xs:documentation>
+        </xs:annotation>
+      </xs:attribute>
       <xs:attribute name='connectUri' type='xs:string'/>
       <xs:attribute name='disableAsyncDispatch' type='xs:boolean'/>
       <xs:attribute name='discoveryAgent' type='xs:string'/>

Modified: activemq/trunk/activemq-core/src/main/resources/activemq.xsd.html
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/resources/activemq.xsd.html?rev=656319&r1=656318&r2=656319&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/resources/activemq.xsd.html (original)
+++ activemq/trunk/activemq-core/src/main/resources/activemq.xsd.html Wed May 14 08:32:54
2008
@@ -221,6 +221,7 @@
   <tr><td><a href='#simpleJmsMessageConvertor'>simpleJmsMessageConvertor</a></td><td>Converts
Message from one JMS to another</td><td>org.apache.activemq.network.jms.SimpleJmsMessageConvertor</td></tr>
   <tr><td><a href='#simpleMessageGroupMapFactory'>simpleMessageGroupMapFactory</a></td><td>A
factory to create instances of {@link SimpleMessageGroupMap} when implementing the
 <a href="http://activemq.apache.org/message-groups.html">Message Groups</a> functionality.</td><td>org.apache.activemq.broker.region.group.SimpleMessageGroupMapFactory</td></tr>
+  <tr><td><a href='#sslContext'>sslContext</a></td><td>Extends
the SslContext so that it's easier to configure from spring.</td><td>org.apache.activemq.spring.SpringSslContext</td></tr>
   <tr><td><a href='#statements'>statements</a></td><td></td><td>org.apache.activemq.store.jdbc.Statements</td></tr>
   <tr><td><a href='#storeCursor'>storeCursor</a></td><td>Pending
messages</td><td>org.apache.activemq.broker.region.policy.StorePendingQueueMessageStoragePolicy</td></tr>
   <tr><td><a href='#storeDurableSubscriberCursor'>storeDurableSubscriberCursor</a></td><td>Pending
messages for a durable</td><td>org.apache.activemq.broker.region.policy.StorePendingDurableSubscriberMessageStoragePolicy</td></tr>
@@ -414,6 +415,7 @@
 Normally you would want the broker to start up along with the ApplicationContext but sometimes
when working
 with JUnit tests you may wish to start and stop the broker explicitly yourself.</td></tr>
   <tr><td>supportFailOver</td><td>xs:boolean</td><td></td></tr>
+  <tr><td>systemExitOnShutdown</td><td>xs:boolean</td><td></td></tr>
   <tr><td>taskRunnerPriority</td><td>xs:integer</td><td></td></tr>
   <tr><td>timeBeforePurgeTempDestinations</td><td>xs:integer</td><td></td></tr>
   <tr><td>tmpDataDirectory</td><td>xs:string</td><td></td></tr>
@@ -429,6 +431,7 @@
   <tr><td>useShutdownHook</td><td>xs:boolean</td><td>Sets
whether or not we should use a shutdown handler to close down the
 broker cleanly if the JVM is terminated. It is recommended you leave this
 enabled.</td></tr>
+  <tr><td>useTempMirroredQueues</td><td>xs:boolean</td><td></td></tr>
   <tr><td>useVirtualTopics</td><td>xs:boolean</td><td>Sets
whether or not <a
 href="http://activemq.apache.org/virtual-destinations.html">Virtual
 Topics</a> should be supported by default if they have not been
@@ -465,6 +468,7 @@
   <tr><td>regionBroker</td><td><a href='#loggingBrokerPlugin'>loggingBrokerPlugin</a>
| <a href='#multicastTraceBrokerPlugin'>multicastTraceBrokerPlugin</a> | <a
href='#timeStampingBrokerPlugin'>timeStampingBrokerPlugin</a> | <a href='#udpTraceBrokerPlugin'>udpTraceBrokerPlugin</a></td><td></td></tr>
   <tr><td>services</td><td>(<a href='#broker'>broker</a>
| <a href='#commandAgent'>commandAgent</a> | <a href='#forwardingBridge'>forwardingBridge</a>
| <a href='#inboundQueueBridge'>inboundQueueBridge</a> | <a href='#inboundTopicBridge'>inboundTopicBridge</a>
| <a href='#jmsQueueConnector'>jmsQueueConnector</a> | <a href='#jmsTopicConnector'>jmsTopicConnector</a>
| <a href='#ldapNetworkConnector'>ldapNetworkConnector</a> | <a href='#managementContext'>managementContext</a>
| <a href='#masterConnector'>masterConnector</a> | <a href='#memoryUsage'>memoryUsage</a>
| <a href='#multicastNetworkConnector'>multicastNetworkConnector</a> | <a href='#networkConnector'>networkConnector</a>
| <a href='#outboundQueueBridge'>outboundQueueBridge</a> | <a href='#outboundTopicBridge'>outboundTopicBridge</a>
| <a href='#proxyConnector'>proxyConnector</a> | <a href='#storeUsage'>storeUsage</a>
| <a href='#systemUsage'>systemUsage</a> | <a href='#tempUsage'>tempUsage</a>)*</td><td>Sets
the ser
 vices associated with this broker such as a
 {@link MasterConnector}</td></tr>
+  <tr><td>sslContext</td><td><a href='#sslContext'>sslContext</a></td><td></td></tr>
   <tr><td>systemUsage</td><td><a href='#systemUsage'>systemUsage</a></td><td></td></tr>
   <tr><td>taskRunnerFactory</td><td>&lt;spring:bean/&gt;</td><td></td></tr>
   <tr><td>tempDataStore</td><td>&lt;spring:bean/&gt;</td><td></td></tr>
@@ -1425,6 +1429,25 @@
   <tr><td>connection</td><td>&lt;spring:bean/&gt;</td><td></td></tr>
 </table>
 <h2>Element: <a name='simpleMessageGroupMapFactory'>simpleMessageGroupMapFactory</a></h2>
+<h2>Element: <a name='sslContext'>sslContext</a></h2>
+<table>
+  <tr><th>Attribute</th><th>Type</th><th>Description</th>
+  <tr><td>keyStore</td><td>xs:string</td><td></td></tr>
+  <tr><td>keyStoreAlgorithm</td><td>xs:string</td><td></td></tr>
+  <tr><td>keyStorePassword</td><td>xs:string</td><td></td></tr>
+  <tr><td>keyStoreType</td><td>xs:string</td><td></td></tr>
+  <tr><td>secureRandomAlgorithm</td><td>xs:string</td><td></td></tr>
+  <tr><td>trustStore</td><td>xs:string</td><td></td></tr>
+  <tr><td>trustStoreAlgorithm</td><td>xs:string</td><td></td></tr>
+  <tr><td>trustStorePassword</td><td>xs:string</td><td></td></tr>
+  <tr><td>trustStoreType</td><td>xs:string</td><td></td></tr>
+</table>
+<table>
+  <tr><th>Element</th><th>Type</th><th>Description</th>
+  <tr><td>keyManagers</td><td>(&lt;spring:bean/&gt;)*</td><td></td></tr>
+  <tr><td>secureRandom</td><td>&lt;spring:bean/&gt;</td><td></td></tr>
+  <tr><td>trustManagers</td><td>(&lt;spring:bean/&gt;)*</td><td></td></tr>
+</table>
 <h2>Element: <a name='statements'>statements</a></h2>
 <table>
   <tr><th>Attribute</th><th>Type</th><th>Description</th>
@@ -1585,6 +1608,7 @@
 <h2>Element: <a name='transportConnector'>transportConnector</a></h2>
 <table>
   <tr><th>Attribute</th><th>Type</th><th>Description</th>
+  <tr><td>brokerName</td><td>xs:string</td><td></td></tr>
   <tr><td>connectUri</td><td>xs:string</td><td></td></tr>
   <tr><td>disableAsyncDispatch</td><td>xs:boolean</td><td></td></tr>
   <tr><td>discoveryUri</td><td>xs:string</td><td></td></tr>
@@ -1598,7 +1622,7 @@
 <table>
   <tr><th>Element</th><th>Type</th><th>Description</th>
   <tr><td>brokerInfo</td><td>&lt;spring:bean/&gt;</td><td></td></tr>
-  <tr><td>brokerService</td><td><a href='#broker'>broker</a></td><td></td></tr>
+  <tr><td>brokerService</td><td><a href='#broker'>broker</a></td><td>This
is called by the BrokerService right before it starts the transport.</td></tr>
   <tr><td>discoveryAgent</td><td>&lt;spring:bean/&gt;</td><td></td></tr>
   <tr><td>messageAuthorizationPolicy</td><td>&lt;spring:bean/&gt;</td><td>Sets
the policy used to decide if the current connection is authorized to
 consume a given message</td></tr>

Modified: activemq/trunk/activemq-core/src/main/resources/activemq.xsd.wiki
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/resources/activemq.xsd.wiki?rev=656319&r1=656318&r2=656319&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/resources/activemq.xsd.wiki (original)
+++ activemq/trunk/activemq-core/src/main/resources/activemq.xsd.wiki Wed May 14 08:32:54
2008
@@ -28,6 +28,10 @@
 connectors, network connectors and a bunch of properties which can be used to
 configure the broker as its lazily created.{html} |
 
+{anchor:org.apache.activemq.broker.SslContext-types}
+h4. The _[org.apache.activemq.broker.SslContext|#org.apache.activemq.broker.SslContext-types]_
Type Implementations
+    | _[<sslContext>|#sslContext-element]_ | {html}Extends the SslContext so that it's
easier to configure from spring.{html} |
+
 {anchor:org.apache.activemq.usage.TempUsage-types}
 h4. The _[org.apache.activemq.usage.TempUsage|#org.apache.activemq.usage.TempUsage-types]_
Type Implementations
     | _[<tempUsage>|#tempUsage-element]_ | {html}Used to keep track of how much of
something is being used so that a
@@ -666,10 +670,12 @@
 {@link MasterConnector}{html} |
     | shutdownOnMasterFailure | _boolean_ | {html}{html} |
     | splitSystemUsageForProducersConsumers | _boolean_ | {html}{html} |
+    | sslContext | _[org.apache.activemq.broker.SslContext|#org.apache.activemq.broker.SslContext-types]_
| {html}{html} |
     | start | _boolean_ | {html}Sets whether or not the broker is started along with the
ApplicationContext it is defined within.
 Normally you would want the broker to start up along with the ApplicationContext but sometimes
when working
 with JUnit tests you may wish to start and stop the broker explicitly yourself.{html} |
     | supportFailOver | _boolean_ | {html}{html} |
+    | systemExitOnShutdown | _boolean_ | {html}{html} |
     | systemUsage | _[org.apache.activemq.usage.SystemUsage|#org.apache.activemq.usage.SystemUsage-types]_
| {html}{html} |
     | taskRunnerFactory | _org.apache.activemq.thread.TaskRunnerFactory_ | {html}{html} |
     | taskRunnerPriority | _int_ | {html}{html} |
@@ -691,6 +697,7 @@
     | useShutdownHook | _boolean_ | {html}Sets whether or not we should use a shutdown handler
to close down the
 broker cleanly if the JVM is terminated. It is recommended you leave this
 enabled.{html} |
+    | useTempMirroredQueues | _boolean_ | {html}{html} |
     | useVirtualTopics | _boolean_ | {html}Sets whether or not <a
 href="http://activemq.apache.org/virtual-destinations.html">Virtual
 Topics</a> should be supported by default if they have not been
@@ -1760,6 +1767,24 @@
     {html}A factory to create instances of {@link SimpleMessageGroupMap} when implementing
the
 <a href="http://activemq.apache.org/message-groups.html">Message Groups</a> functionality.{html}
 
+{anchor:sslContext-element}
+h3. The _[<sslContext>|#sslContext-element]_ Element
+    {html}Extends the SslContext so that it's easier to configure from spring.{html}
+h4. Properties
+    || Property Name || Type || Description ||
+    | keyManagers | (_java.lang.Object_)\* | {html}{html} |
+    | keyStore | _org.springframework.core.io.Resource_ | {html}{html} |
+    | keyStoreAlgorithm | _java.lang.String_ | {html}{html} |
+    | keyStorePassword | _java.lang.String_ | {html}{html} |
+    | keyStoreType | _java.lang.String_ | {html}{html} |
+    | secureRandom | _java.security.SecureRandom_ | {html}{html} |
+    | secureRandomAlgorithm | _java.lang.String_ | {html}{html} |
+    | trustManagers | (_java.lang.Object_)\* | {html}{html} |
+    | trustStore | _org.springframework.core.io.Resource_ | {html}{html} |
+    | trustStoreAlgorithm | _java.lang.String_ | {html}{html} |
+    | trustStorePassword | _java.lang.String_ | {html}{html} |
+    | trustStoreType | _java.lang.String_ | {html}{html} |
+
 {anchor:statements-element}
 h3. The _[<statements>|#statements-element]_ Element
     {html}{html}
@@ -1952,7 +1977,8 @@
 h4. Properties
     || Property Name || Type || Description ||
     | brokerInfo | _org.apache.activemq.command.BrokerInfo_ | {html}{html} |
-    | brokerService | _[org.apache.activemq.broker.BrokerService|#org.apache.activemq.broker.BrokerService-types]_
| {html}{html} |
+    | brokerName | _java.lang.String_ | {html}{html} |
+    | brokerService | _[org.apache.activemq.broker.BrokerService|#org.apache.activemq.broker.BrokerService-types]_
| {html}This is called by the BrokerService right before it starts the transport.{html} |
     | connectUri | _java.net.URI_ | {html}{html} |
     | disableAsyncDispatch | _boolean_ | {html}{html} |
     | discoveryAgent | _org.apache.activemq.transport.discovery.DiscoveryAgent_ | {html}{html}
|
@@ -2303,6 +2329,7 @@
     | _[<simpleJmsMessageConvertor>|#simpleJmsMessageConvertor-element]_ | {html}Converts
Message from one JMS to another{html} |
     | _[<simpleMessageGroupMapFactory>|#simpleMessageGroupMapFactory-element]_ | {html}A
factory to create instances of {@link SimpleMessageGroupMap} when implementing the
 <a href="http://activemq.apache.org/message-groups.html">Message Groups</a> functionality.{html}
|
+    | _[<sslContext>|#sslContext-element]_ | {html}Extends the SslContext so that it's
easier to configure from spring.{html} |
     | _[<statements>|#statements-element]_ | {html}{html} |
     | _[<storeCursor>|#storeCursor-element]_ | {html}Pending messages{html} |
     | _[<storeDurableSubscriberCursor>|#storeDurableSubscriberCursor-element]_ | {html}Pending
messages for a durable{html} |

Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslContextBrokerServiceTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslContextBrokerServiceTest.java?rev=656319&view=auto
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslContextBrokerServiceTest.java
(added)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslContextBrokerServiceTest.java
Wed May 14 08:32:54 2008
@@ -0,0 +1,69 @@
+/**
+ * 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.transport.tcp;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Map;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.textui.TestRunner;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.TransportConnector;
+import org.apache.activemq.transport.TransportBrokerTestSupport;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * 
+ */
+public class SslContextBrokerServiceTest extends TestCase {
+
+    
+    private ClassPathXmlApplicationContext context;
+    private BrokerService broker;
+    private TransportConnector connector;
+
+
+    public void testConfiguration() throws URISyntaxException {
+
+        assertNotNull(broker);
+        assertNotNull(connector);
+        
+        assertEquals(new URI("ssl://localhost:61616"), connector.getUri());
+        
+        assertNotNull(broker.getSslContext());
+        assertFalse(broker.getSslContext().getKeyManagers().isEmpty());
+        assertFalse(broker.getSslContext().getTrustManagers().isEmpty());
+        
+    }
+
+    protected void setUp() throws Exception {
+        Thread.currentThread().setContextClassLoader(SslContextBrokerServiceTest.class.getClassLoader());
+        context = new ClassPathXmlApplicationContext("org/apache/activemq/transport/tcp/activemq-ssl.xml");
+        Map beansOfType = context.getBeansOfType(BrokerService.class);
+        broker = (BrokerService)beansOfType.values().iterator().next();
+        connector = broker.getTransportConnectors().get(0); 
+    }
+    
+    @Override
+    protected void tearDown() throws Exception {
+
+        context.destroy();
+    }
+
+}

Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslContextBrokerServiceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslContextBrokerServiceTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/transport/tcp/activemq-ssl.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/transport/tcp/activemq-ssl.xml?rev=656319&view=auto
==============================================================================
--- activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/transport/tcp/activemq-ssl.xml
(added)
+++ activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/transport/tcp/activemq-ssl.xml
Wed May 14 08:32:54 2008
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+
+<!-- START SNIPPET: spring -->
+<beans 
+  xmlns="http://www.springframework.org/schema/beans" 
+  xmlns:amq="http://activemq.apache.org/schema/core"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
+  
+  <!--  lets create an embedded ActiveMQ Broker -->
+  <amq:broker useJmx="false" persistent="false">
+
+    <amq:sslContext>
+      <amq:sslContext 
+      		keyStore="server.keystore" keyStorePassword="password"
+      		trustStore="client.keystore" trustStorePassword="password"/>
+    </amq:sslContext>
+    
+    <amq:transportConnectors>
+      <amq:transportConnector uri="ssl://localhost:61616" />
+    </amq:transportConnectors>
+    
+  </amq:broker>
+  
+</beans>
+
+<!-- END SNIPPET: spring -->

Propchange: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/transport/tcp/activemq-ssl.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/transport/tcp/activemq-ssl.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/transport/tcp/activemq-ssl.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/transport/tcp/activemq-ssl.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message