JBoss hornetq SVN: r8885 - in trunk: src/config and 6 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-02-17 17:13:31 -0500 (Wed, 17 Feb 2010)
New Revision: 8885
Added:
trunk/src/config/jboss-6/
trunk/src/config/jboss-6/clustered/
trunk/src/config/jboss-6/clustered/hornetq-configuration.xml
trunk/src/config/jboss-6/clustered/hornetq-jboss-beans.xml
trunk/src/config/jboss-6/clustered/hornetq-jms.xml
trunk/src/config/jboss-6/clustered/jms-ds.xml
trunk/src/config/jboss-6/clustered/login-config.xml
trunk/src/config/jboss-6/non-clustered/
trunk/src/config/jboss-6/non-clustered/hornetq-configuration.xml
trunk/src/config/jboss-6/non-clustered/hornetq-jboss-beans.xml
trunk/src/config/jboss-6/non-clustered/hornetq-jms.xml
trunk/src/config/jboss-6/non-clustered/jms-ds.xml
trunk/src/config/jboss-6/non-clustered/login-config.xml
Modified:
trunk/build-hornetq.xml
trunk/src/main/org/hornetq/api/core/management/AddressControl.java
trunk/src/main/org/hornetq/core/management/impl/AddressControlImpl.java
trunk/src/main/org/hornetq/ra/inflow/HornetQActivationSpec.java
Log:
Integration with AS6 work
Modified: trunk/build-hornetq.xml
===================================================================
--- trunk/build-hornetq.xml 2010-02-17 15:32:21 UTC (rev 8884)
+++ trunk/build-hornetq.xml 2010-02-17 22:13:31 UTC (rev 8885)
@@ -804,6 +804,9 @@
<include name="ra.xml"/>
<exclude name="**/build.xml"/>
</fileset>
+ <fileset dir="${src.config.dir}">
+ <include name="jboss-6/**"/>
+ </fileset>
<fileset dir="${native.bin.dir}">
<include name="**/*.so"/>
</fileset>
Added: trunk/src/config/jboss-6/clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/jboss-6/clustered/hornetq-configuration.xml (rev 0)
+++ trunk/src/config/jboss-6/clustered/hornetq-configuration.xml 2010-02-17 22:13:31 UTC (rev 8885)
@@ -0,0 +1,89 @@
+<configuration xmlns="urn:hornetq"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
+
+ <clustered>true</clustered>
+
+ <log-delegate-factory-class-name>org.hornetq.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name>
+
+ <bindings-directory>${jboss.server.data.dir}/hornetq/bindings</bindings-directory>
+
+ <journal-directory>${jboss.server.data.dir}/hornetq/journal</journal-directory>
+
+ <large-messages-directory>${jboss.server.data.dir}/hornetq/largemessages</large-messages-directory>
+
+ <paging-directory>${jboss.server.data.dir}/hornetq/paging</paging-directory>
+
+ <connectors>
+ <connector name="netty">
+ <factory-class>org.hornetq.integration.transports.netty.NettyConnectorFactory</factory-class>
+ <param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
+ <param key="port" value="${hornetq.remoting.netty.port:5445}"/>
+ </connector>
+
+ <connector name="in-vm">
+ <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
+ </connector>
+
+ </connectors>
+
+ <acceptors>
+ <acceptor name="netty">
+ <factory-class>org.hornetq.integration.transports.netty.NettyAcceptorFactory</factory-class>
+ <param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
+ <param key="port" value="${hornetq.remoting.netty.port:5445}"/>
+ </acceptor>
+
+ <acceptor name="in-vm">
+ <factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
+ <param key="server-id" value="0"/>
+ </acceptor>
+
+ </acceptors>
+
+ <broadcast-groups>
+ <broadcast-group name="bg-group1">
+ <group-address>231.7.7.7</group-address>
+ <group-port>9876</group-port>
+ <broadcast-period>5000</broadcast-period>
+ <connector-ref connector-name="netty"/>
+ </broadcast-group>
+ </broadcast-groups>
+
+ <discovery-groups>
+ <discovery-group name="dg-group1">
+ <group-address>231.7.7.7</group-address>
+ <group-port>9876</group-port>
+ <refresh-timeout>10000</refresh-timeout>
+ </discovery-group>
+ </discovery-groups>
+
+ <cluster-connections>
+ <cluster-connection name="my-cluster">
+ <address>jms</address>
+ <discovery-group-ref discovery-group-name="dg-group1"/>
+ </cluster-connection>
+ </cluster-connections>
+
+ <security-settings>
+ <security-setting match="#">
+ <permission type="createTempQueue" roles="guest"/>
+ <permission type="deleteTempQueue" roles="guest"/>
+ <permission type="consume" roles="guest"/>
+ <permission type="send" roles="guest"/>
+ </security-setting>
+ </security-settings>
+
+ <address-settings>
+ <!--default for catch all-->
+ <address-setting match="#">
+ <dead-letter-address>jms.queue.DLQ</dead-letter-address>
+ <expiry-address>jms.queue.ExpiryQueue</expiry-address>
+ <redelivery-delay>0</redelivery-delay>
+ <max-size-bytes>-1</max-size-bytes>
+ <page-size-bytes>10485760</page-size-bytes>
+ <message-counter-history-day-limit>10</message-counter-history-day-limit>
+ </address-setting>
+ </address-settings>
+
+</configuration>
Added: trunk/src/config/jboss-6/clustered/hornetq-jboss-beans.xml
===================================================================
--- trunk/src/config/jboss-6/clustered/hornetq-jboss-beans.xml (rev 0)
+++ trunk/src/config/jboss-6/clustered/hornetq-jboss-beans.xml 2010-02-17 22:13:31 UTC (rev 8885)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!-- MBean server -->
+ <bean name="MBeanServer" class="javax.management.MBeanServer">
+ <constructor factoryClass="org.jboss.mx.util.MBeanServerLocator"
+ factoryMethod="locateJBoss"/>
+ </bean>
+
+ <!-- The core configuration -->
+ <bean name="Configuration" class="org.hornetq.core.config.impl.FileConfiguration"/>
+
+ <!-- The security manager -->
+ <bean name="HornetQSecurityManager" class="org.hornetq.integration.jboss.security.JBossASSecurityManager">
+ <depends>JBossSecurityJNDIContextEstablishment</depends>
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ </bean>
+
+ <!-- The core server -->
+ <bean name="HornetQServer" class="org.hornetq.core.server.impl.HornetQServerImpl">
+ <constructor>
+ <parameter>
+ <inject bean="Configuration"/>
+ </parameter>
+ <parameter>
+ <inject bean="MBeanServer"/>
+ </parameter>
+ <parameter>
+ <inject bean="HornetQSecurityManager"/>
+ </parameter>
+ </constructor>
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ </bean>
+
+ <!-- The JMS server -->
+ <bean name="JMSServerManager" class="org.hornetq.jms.server.impl.JMSServerManagerImpl">
+ <constructor>
+ <parameter>
+ <inject bean="HornetQServer"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+</deployment>
Added: trunk/src/config/jboss-6/clustered/hornetq-jms.xml
===================================================================
--- trunk/src/config/jboss-6/clustered/hornetq-jms.xml (rev 0)
+++ trunk/src/config/jboss-6/clustered/hornetq-jms.xml 2010-02-17 22:13:31 UTC (rev 8885)
@@ -0,0 +1,33 @@
+<configuration xmlns="urn:hornetq"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
+
+ <connection-factory name="NettyConnectionFactory">
+ <connectors>
+ <connector-ref connector-name="netty"/>
+ </connectors>
+ <entries>
+ <entry name="/ConnectionFactory"/>
+ <entry name="/XAConnectionFactory"/>
+ </entries>
+ </connection-factory>
+
+ <connection-factory name="InVMConnectionFactory">
+ <connectors>
+ <connector-ref connector-name="in-vm"/>
+ </connectors>
+ <entries>
+ <entry name="java:/ConnectionFactory"/>
+ <entry name="java:/XAConnectionFactory"/>
+ </entries>
+ </connection-factory>
+
+ <queue name="DLQ">
+ <entry name="/queue/DLQ"/>
+ </queue>
+
+ <queue name="ExpiryQueue">
+ <entry name="/queue/ExpiryQueue"/>
+ </queue>
+
+</configuration>
\ No newline at end of file
Added: trunk/src/config/jboss-6/clustered/jms-ds.xml
===================================================================
--- trunk/src/config/jboss-6/clustered/jms-ds.xml (rev 0)
+++ trunk/src/config/jboss-6/clustered/jms-ds.xml 2010-02-17 22:13:31 UTC (rev 8885)
@@ -0,0 +1,26 @@
+<connection-factories>
+ <!--
+ JMS Stuff
+ -->
+
+ <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="hornetq:service=JMSProviderLoader,name=JMSProvider">
+ <attribute name="ProviderName">DefaultJMSProvider</attribute>
+ <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
+ <attribute name="FactoryRef">java:/XAConnectionFactory</attribute>
+ <attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>
+ <attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>
+ </mbean>
+ <!--
+ JMS XA Resource adapter, use this to get transacted JMS in beans
+ -->
+ <tx-connection-factory>
+ <jndi-name>JmsXA</jndi-name>
+ <xa-transaction/>
+ <rar-name>jms-ra.rar</rar-name>
+ <connection-definition>org.hornetq.ra.HornetQRAConnectionFactory</connection-definition>
+ <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
+ <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
+ <max-pool-size>20</max-pool-size>
+ <security-domain-and-application>JmsXARealm</security-domain-and-application>
+ </tx-connection-factory>
+</connection-factories>
\ No newline at end of file
Added: trunk/src/config/jboss-6/clustered/login-config.xml
===================================================================
--- trunk/src/config/jboss-6/clustered/login-config.xml (rev 0)
+++ trunk/src/config/jboss-6/clustered/login-config.xml 2010-02-17 22:13:31 UTC (rev 8885)
@@ -0,0 +1,146 @@
+<?xml version='1.0'?>
+
+<!-- The XML based JAAS login configuration read by the
+org.jboss.security.auth.login.XMLLoginConfig mbean. Add
+an application-policy element for each security domain.
+
+The outline of the application-policy is:
+<application-policy name="security-domain-name">
+ <authentication>
+ <login-module code="login.module1.class.name" flag="control_flag">
+ <module-option name = "option1-name">option1-value</module-option>
+ <module-option name = "option2-name">option2-value</module-option>
+ ...
+ </login-module>
+
+ <login-module code="login.module2.class.name" flag="control_flag">
+ ...
+ </login-module>
+ ...
+ </authentication>
+</application-policy>
+
+$Id: login-config.xml 76444 2008-07-29 23:50:53Z sguilhen(a)redhat.com $
+$Revision: 76444 $
+-->
+
+<policy>
+ <!-- Used by clients within the application server VM such as
+ mbeans and servlets that access EJBs.
+ -->
+ <application-policy name="client-login">
+ <authentication>
+ <login-module code="org.jboss.security.ClientLoginModule"
+ flag="required">
+ <!-- Any existing security context will be restored on logout -->
+ <module-option name="restore-login-identity">true</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+ <!-- Security domains for testing new jca framework -->
+ <application-policy name="HsqlDbRealm">
+ <authentication>
+ <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule"
+ flag="required">
+ <module-option name="principal">sa</module-option>
+ <module-option name="userName">sa</module-option>
+ <module-option name="password"></module-option>
+ <module-option name="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=DefaultDS</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+ <application-policy name="JmsXARealm">
+ <authentication>
+ <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule"
+ flag="required">
+ <module-option name="principal">guest</module-option>
+ <module-option name="userName">guest</module-option>
+ <module-option name="password">guest</module-option>
+ <module-option name="managedConnectionFactoryName">jboss.jca:service=TxCM,name=JmsXA</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+ <!-- A template configuration for HornetQ. This
+ defaults to the UsersRolesLoginModule the same as other and should be
+ changed to a stronger authentication mechanism as required.
+ -->
+<application-policy name="hornetq">
+ <authentication>
+ <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
+ flag="required">
+ <module-option name = "unauthenticatedIdentity">guest</module-option>
+ <module-option name="usersProperties">props/hornetq-users.properties</module-option>
+ <module-option name="rolesProperties">props/hornetq-roles.properties</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+ <!-- A template configuration for the jmx-console web application. This
+ defaults to the UsersRolesLoginModule the same as other and should be
+ changed to a stronger authentication mechanism as required.
+ -->
+ <application-policy name="jmx-console">
+ <authentication>
+ <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
+ flag="required">
+ <module-option name="usersProperties">props/jmx-console-users.properties</module-option>
+ <module-option name="rolesProperties">props/jmx-console-roles.properties</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+ <!-- A template configuration for the web-console web application. This
+ defaults to the UsersRolesLoginModule the same as other and should be
+ changed to a stronger authentication mechanism as required.
+ -->
+ <application-policy name="web-console">
+ <authentication>
+ <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
+ flag="required">
+ <module-option name="usersProperties">web-console-users.properties</module-option>
+ <module-option name="rolesProperties">web-console-roles.properties</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+ <!--
+ A template configuration for the JBossWS security domain.
+ This defaults to the UsersRolesLoginModule the same as other and should be
+ changed to a stronger authentication mechanism as required.
+ -->
+ <application-policy name="JBossWS">
+ <authentication>
+ <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
+ flag="required">
+ <module-option name="usersProperties">props/jbossws-users.properties</module-option>
+ <module-option name="rolesProperties">props/jbossws-roles.properties</module-option>
+ <module-option name="unauthenticatedIdentity">anonymous</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+ <!-- The default login configuration used by any security domain that
+ does not have a application-policy entry with a matching name
+ -->
+ <application-policy name="other">
+ <!-- A simple server login module, which can be used when the number
+ of users is relatively small. It uses two properties files:
+ users.properties, which holds users (key) and their password (value).
+ roles.properties, which holds users (key) and a comma-separated list of
+ their roles (value).
+ The unauthenticatedIdentity property defines the name of the principal
+ that will be used when a null username and password are presented as is
+ the case for an unuathenticated web client or MDB. If you want to
+ allow such users to be authenticated add the property, e.g.,
+ unauthenticatedIdentity="nobody"
+ -->
+ <authentication>
+ <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
+ flag="required"/>
+ </authentication>
+ </application-policy>
+
+</policy>
Added: trunk/src/config/jboss-6/non-clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/jboss-6/non-clustered/hornetq-configuration.xml (rev 0)
+++ trunk/src/config/jboss-6/non-clustered/hornetq-configuration.xml 2010-02-17 22:13:31 UTC (rev 8885)
@@ -0,0 +1,63 @@
+<configuration xmlns="urn:hornetq"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
+
+ <log-delegate-factory-class-name>org.hornetq.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name>
+
+ <bindings-directory>${jboss.server.data.dir}/hornetq/bindings</bindings-directory>
+
+ <journal-directory>${jboss.server.data.dir}/hornetq/journal</journal-directory>
+
+ <large-messages-directory>${jboss.server.data.dir}/hornetq/largemessages</large-messages-directory>
+
+ <paging-directory>${jboss.server.data.dir}/hornetq/paging</paging-directory>
+
+ <connectors>
+ <connector name="netty">
+ <factory-class>org.hornetq.integration.transports.netty.NettyConnectorFactory</factory-class>
+ <param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
+ <param key="port" value="${hornetq.remoting.netty.port:5445}"/>
+ </connector>
+
+ <connector name="in-vm">
+ <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
+ </connector>
+
+ </connectors>
+
+ <acceptors>
+ <acceptor name="netty">
+ <factory-class>org.hornetq.integration.transports.netty.NettyAcceptorFactory</factory-class>
+ <param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
+ <param key="port" value="${hornetq.remoting.netty.port:5445}"/>
+ </acceptor>
+
+ <acceptor name="in-vm">
+ <factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
+ <param key="server-id" value="0"/>
+ </acceptor>
+
+ </acceptors>
+
+ <security-settings>
+ <security-setting match="#">
+ <permission type="createTempQueue" roles="guest"/>
+ <permission type="deleteTempQueue" roles="guest"/>
+ <permission type="consume" roles="guest"/>
+ <permission type="send" roles="guest"/>
+ </security-setting>
+ </security-settings>
+
+ <address-settings>
+ <!--default for catch all-->
+ <address-setting match="#">
+ <dead-letter-address>jms.queue.DLQ</dead-letter-address>
+ <expiry-address>jms.queue.ExpiryQueue</expiry-address>
+ <redelivery-delay>0</redelivery-delay>
+ <max-size-bytes>-1</max-size-bytes>
+ <page-size-bytes>10485760</page-size-bytes>
+ <message-counter-history-day-limit>10</message-counter-history-day-limit>
+ </address-setting>
+ </address-settings>
+
+</configuration>
Added: trunk/src/config/jboss-6/non-clustered/hornetq-jboss-beans.xml
===================================================================
--- trunk/src/config/jboss-6/non-clustered/hornetq-jboss-beans.xml (rev 0)
+++ trunk/src/config/jboss-6/non-clustered/hornetq-jboss-beans.xml 2010-02-17 22:13:31 UTC (rev 8885)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!-- MBean server -->
+ <bean name="MBeanServer" class="javax.management.MBeanServer">
+ <constructor factoryClass="org.jboss.mx.util.MBeanServerLocator"
+ factoryMethod="locateJBoss"/>
+ </bean>
+
+ <!-- The core configuration -->
+ <bean name="Configuration" class="org.hornetq.core.config.impl.FileConfiguration"/>
+
+ <!-- The security manager -->
+ <bean name="HornetQSecurityManager" class="org.hornetq.integration.jboss.security.JBossASSecurityManager">
+ <depends>JBossSecurityJNDIContextEstablishment</depends>
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ </bean>
+
+ <!-- The core server -->
+ <bean name="HornetQServer" class="org.hornetq.core.server.impl.HornetQServerImpl">
+ <constructor>
+ <parameter>
+ <inject bean="Configuration"/>
+ </parameter>
+ <parameter>
+ <inject bean="MBeanServer"/>
+ </parameter>
+ <parameter>
+ <inject bean="HornetQSecurityManager"/>
+ </parameter>
+ </constructor>
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ </bean>
+
+ <!-- The JMS server -->
+ <bean name="JMSServerManager" class="org.hornetq.jms.server.impl.JMSServerManagerImpl">
+ <constructor>
+ <parameter>
+ <inject bean="HornetQServer"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+</deployment>
\ No newline at end of file
Added: trunk/src/config/jboss-6/non-clustered/hornetq-jms.xml
===================================================================
--- trunk/src/config/jboss-6/non-clustered/hornetq-jms.xml (rev 0)
+++ trunk/src/config/jboss-6/non-clustered/hornetq-jms.xml 2010-02-17 22:13:31 UTC (rev 8885)
@@ -0,0 +1,33 @@
+<configuration xmlns="urn:hornetq"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
+
+ <connection-factory name="NettyConnectionFactory">
+ <connectors>
+ <connector-ref connector-name="netty"/>
+ </connectors>
+ <entries>
+ <entry name="/ConnectionFactory"/>
+ <entry name="/XAConnectionFactory"/>
+ </entries>
+ </connection-factory>
+
+ <connection-factory name="InVMConnectionFactory">
+ <connectors>
+ <connector-ref connector-name="in-vm"/>
+ </connectors>
+ <entries>
+ <entry name="java:/ConnectionFactory"/>
+ <entry name="java:/XAConnectionFactory"/>
+ </entries>
+ </connection-factory>
+
+ <queue name="DLQ">
+ <entry name="/queue/DLQ"/>
+ </queue>
+
+ <queue name="ExpiryQueue">
+ <entry name="/queue/ExpiryQueue"/>
+ </queue>
+
+</configuration>
\ No newline at end of file
Added: trunk/src/config/jboss-6/non-clustered/jms-ds.xml
===================================================================
--- trunk/src/config/jboss-6/non-clustered/jms-ds.xml (rev 0)
+++ trunk/src/config/jboss-6/non-clustered/jms-ds.xml 2010-02-17 22:13:31 UTC (rev 8885)
@@ -0,0 +1,26 @@
+<connection-factories>
+ <!--
+ JMS Stuff
+ -->
+
+ <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="hornetq:service=JMSProviderLoader,name=JMSProvider">
+ <attribute name="ProviderName">DefaultJMSProvider</attribute>
+ <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
+ <attribute name="FactoryRef">java:/XAConnectionFactory</attribute>
+ <attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>
+ <attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>
+ </mbean>
+ <!--
+ JMS XA Resource adapter, use this to get transacted JMS in beans
+ -->
+ <tx-connection-factory>
+ <jndi-name>JmsXA</jndi-name>
+ <xa-transaction/>
+ <rar-name>jms-ra.rar</rar-name>
+ <connection-definition>org.hornetq.ra.HornetQRAConnectionFactory</connection-definition>
+ <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
+ <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
+ <max-pool-size>20</max-pool-size>
+ <security-domain-and-application>JmsXARealm</security-domain-and-application>
+ </tx-connection-factory>
+</connection-factories>
\ No newline at end of file
Added: trunk/src/config/jboss-6/non-clustered/login-config.xml
===================================================================
--- trunk/src/config/jboss-6/non-clustered/login-config.xml (rev 0)
+++ trunk/src/config/jboss-6/non-clustered/login-config.xml 2010-02-17 22:13:31 UTC (rev 8885)
@@ -0,0 +1,146 @@
+<?xml version='1.0'?>
+
+<!-- The XML based JAAS login configuration read by the
+org.jboss.security.auth.login.XMLLoginConfig mbean. Add
+an application-policy element for each security domain.
+
+The outline of the application-policy is:
+<application-policy name="security-domain-name">
+ <authentication>
+ <login-module code="login.module1.class.name" flag="control_flag">
+ <module-option name = "option1-name">option1-value</module-option>
+ <module-option name = "option2-name">option2-value</module-option>
+ ...
+ </login-module>
+
+ <login-module code="login.module2.class.name" flag="control_flag">
+ ...
+ </login-module>
+ ...
+ </authentication>
+</application-policy>
+
+$Id: login-config.xml 76444 2008-07-29 23:50:53Z sguilhen(a)redhat.com $
+$Revision: 76444 $
+-->
+
+<policy>
+ <!-- Used by clients within the application server VM such as
+ mbeans and servlets that access EJBs.
+ -->
+ <application-policy name="client-login">
+ <authentication>
+ <login-module code="org.jboss.security.ClientLoginModule"
+ flag="required">
+ <!-- Any existing security context will be restored on logout -->
+ <module-option name="restore-login-identity">true</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+ <!-- Security domains for testing new jca framework -->
+ <application-policy name="HsqlDbRealm">
+ <authentication>
+ <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule"
+ flag="required">
+ <module-option name="principal">sa</module-option>
+ <module-option name="userName">sa</module-option>
+ <module-option name="password"></module-option>
+ <module-option name="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=DefaultDS</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+ <application-policy name="JmsXARealm">
+ <authentication>
+ <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule"
+ flag="required">
+ <module-option name="principal">guest</module-option>
+ <module-option name="userName">guest</module-option>
+ <module-option name="password">guest</module-option>
+ <module-option name="managedConnectionFactoryName">jboss.jca:service=TxCM,name=JmsXA</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+ <!-- A template configuration for hornetq. This
+ defaults to the UsersRolesLoginModule the same as other and should be
+ changed to a stronger authentication mechanism as required.
+ -->
+<application-policy name="hornetq">
+ <authentication>
+ <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
+ flag="required">
+ <module-option name = "unauthenticatedIdentity">guest</module-option>
+ <module-option name="usersProperties">props/hornetq-users.properties</module-option>
+ <module-option name="rolesProperties">props/hornetq-roles.properties</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+ <!-- A template configuration for the jmx-console web application. This
+ defaults to the UsersRolesLoginModule the same as other and should be
+ changed to a stronger authentication mechanism as required.
+ -->
+ <application-policy name="jmx-console">
+ <authentication>
+ <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
+ flag="required">
+ <module-option name="usersProperties">props/jmx-console-users.properties</module-option>
+ <module-option name="rolesProperties">props/jmx-console-roles.properties</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+ <!-- A template configuration for the web-console web application. This
+ defaults to the UsersRolesLoginModule the same as other and should be
+ changed to a stronger authentication mechanism as required.
+ -->
+ <application-policy name="web-console">
+ <authentication>
+ <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
+ flag="required">
+ <module-option name="usersProperties">web-console-users.properties</module-option>
+ <module-option name="rolesProperties">web-console-roles.properties</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+ <!--
+ A template configuration for the JBossWS security domain.
+ This defaults to the UsersRolesLoginModule the same as other and should be
+ changed to a stronger authentication mechanism as required.
+ -->
+ <application-policy name="JBossWS">
+ <authentication>
+ <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
+ flag="required">
+ <module-option name="usersProperties">props/jbossws-users.properties</module-option>
+ <module-option name="rolesProperties">props/jbossws-roles.properties</module-option>
+ <module-option name="unauthenticatedIdentity">anonymous</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+ <!-- The default login configuration used by any security domain that
+ does not have a application-policy entry with a matching name
+ -->
+ <application-policy name="other">
+ <!-- A simple server login module, which can be used when the number
+ of users is relatively small. It uses two properties files:
+ users.properties, which holds users (key) and their password (value).
+ roles.properties, which holds users (key) and a comma-separated list of
+ their roles (value).
+ The unauthenticatedIdentity property defines the name of the principal
+ that will be used when a null username and password are presented as is
+ the case for an unuathenticated web client or MDB. If you want to
+ allow such users to be authenticated add the property, e.g.,
+ unauthenticatedIdentity="nobody"
+ -->
+ <authentication>
+ <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
+ flag="required"/>
+ </authentication>
+ </application-policy>
+
+</policy>
Modified: trunk/src/main/org/hornetq/api/core/management/AddressControl.java
===================================================================
--- trunk/src/main/org/hornetq/api/core/management/AddressControl.java 2010-02-17 15:32:21 UTC (rev 8884)
+++ trunk/src/main/org/hornetq/api/core/management/AddressControl.java 2010-02-17 22:13:31 UTC (rev 8885)
@@ -58,40 +58,4 @@
// Operations ----------------------------------------------------
- /**
- * Adds a role to this address.
- *
- * @param name name of the role
- * @param send can the user send to this address?
- * @param consume can the user consume from a queue bound to this address?
- * @param createDurableQueue can the user create a durable queue bound to this address?
- * @param deleteDurableQueue can the user delete a durable queue bound to this address?
- * @param createNonDurableQueue can the user create a non-durable queue bound to this address?
- * @param deleteNonDurableQueue can the user delete a non-durable queue bound to this address?
- * @param manage can the user send management messages to this address?
- * @throws Exception if an exception occurred while adding the role
- */
- @Operation(desc = "Add a Role to this address")
- void addRole(@Parameter(name = "name", desc = "Name of the role to add") String name,
- @Parameter(name = "send", desc = "Can the user send to this address?") boolean send,
- @Parameter(name = "consume", desc = "Can the user consume from this address?") boolean consume,
- @Parameter(name = "createDurableQueue", desc = "Can the user create a durable queue?") boolean createDurableQueue,
- @Parameter(name = "deleteDurableQueue", desc = "Can the user delete a durable queue?") boolean deleteDurableQueue,
- @Parameter(name = "createNonDurableQueue", desc = "Can the user create a temp queue?") boolean createNonDurableQueue,
- @Parameter(name = "deleteNonDurableQueue", desc = "Can the user delete a temp queue?") boolean deleteNonDurableQueue,
- @Parameter(name = "manage", desc = "Can the user send management messages?") boolean manage) throws Exception;
-
- /**
- * Removes the role corresponding to the specified name from this address.
- *
- * @throws Exception if an exception occurred while removing the role
- */
- @Operation(desc = "Remove a Role from this address")
- void removeRole(@Parameter(name = "name", desc = "Name of the role to remove") String name) throws Exception;
-
- /**
- * This method will remove any matching associated with this address. This will basically reset the security for this address.
- */
- @Operation(desc = "Reset the security configuration for this address by using default values")
- void resetSecurity();
}
Modified: trunk/src/main/org/hornetq/core/management/impl/AddressControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/AddressControlImpl.java 2010-02-17 15:32:21 UTC (rev 8884)
+++ trunk/src/main/org/hornetq/core/management/impl/AddressControlImpl.java 2010-02-17 22:13:31 UTC (rev 8885)
@@ -13,8 +13,6 @@
package org.hornetq.core.management.impl;
-import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
import javax.management.MBeanOperationInfo;
@@ -181,89 +179,6 @@
}
}
- public synchronized void addRole(final String name,
- final boolean send,
- final boolean consume,
- final boolean createDurableQueue,
- final boolean deleteDurableQueue,
- final boolean createNonDurableQueue,
- final boolean deleteNonDurableQueue,
- final boolean manage) throws Exception
- {
- clearIO();
- try
- {
- Set<Role> roles = securityRepository.getMatch(address.toString());
- HashSet<Role> newroles = new HashSet<Role>();
- newroles.addAll(roles);
-
- Role newRole = new Role(name,
- send,
- consume,
- createDurableQueue,
- deleteDurableQueue,
- createNonDurableQueue,
- deleteNonDurableQueue,
- manage);
- boolean added = newroles.add(newRole);
- if (!added)
- {
- throw new IllegalArgumentException("Role " + name + " already exists");
- }
- securityRepository.addMatch(address.toString(), newroles);
- }
- finally
- {
- blockOnIO();
- }
- }
-
- public synchronized void removeRole(final String role) throws Exception
- {
- clearIO();
- try
- {
- Set<Role> roles = securityRepository.getMatch(address.toString());
-
- HashSet<Role> newroles = new HashSet<Role>();
- newroles.addAll(roles);
-
- Iterator<Role> it = newroles.iterator();
- boolean removed = false;
- while (it.hasNext())
- {
- Role r = it.next();
- if (r.getName().equals(role))
- {
- it.remove();
- removed = true;
- break;
- }
- }
- if (!removed)
- {
- throw new IllegalArgumentException("Role " + role + " does not exist");
- }
-
- securityRepository.removeMatch(address.toString());
-
- securityRepository.addMatch(address.toString(), newroles);
- }
- finally
- {
- blockOnIO();
- }
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.api.core.management.AddressControl#resetSecurity()
- */
- public void resetSecurity()
- {
- securityRepository.removeMatch(address.toString());
- }
-
-
@Override
MBeanOperationInfo[] fillMBeanOperationInfo()
{
Modified: trunk/src/main/org/hornetq/ra/inflow/HornetQActivationSpec.java
===================================================================
--- trunk/src/main/org/hornetq/ra/inflow/HornetQActivationSpec.java 2010-02-17 15:32:21 UTC (rev 8884)
+++ trunk/src/main/org/hornetq/ra/inflow/HornetQActivationSpec.java 2010-02-17 22:13:31 UTC (rev 8885)
@@ -92,7 +92,7 @@
/* use local tx instead of XA*/
private Boolean localTx;
-
+
/**
* Constructor
*/
@@ -735,4 +735,20 @@
{
}
+
+ /**
+ * @param keepAlive the keepAlive to set
+ */
+ public void setKeepAlive(boolean keepAlive)
+ {
+ }
+
+ /**
+ * @param keepAliveMillis the keepAliveMillis to set
+ */
+ public void setKeepAliveMillis(long keepAliveMillis)
+ {
+ }
+
+
}
15 years, 10 months
JBoss hornetq SVN: r8884 - trunk/tests/src/org/hornetq/tests/util.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-02-17 10:32:21 -0500 (Wed, 17 Feb 2010)
New Revision: 8884
Modified:
trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java
Log:
fix test suite
* add a netty connector to the server config to avoid an exception when deploying
connection factories from jms-tests/config/hornetq-jms.xml
Modified: trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java 2010-02-16 16:52:12 UTC (rev 8883)
+++ trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java 2010-02-17 15:32:21 UTC (rev 8884)
@@ -107,6 +107,7 @@
conf.setJMXManagementEnabled(true);
conf.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName()));
+ conf.getConnectorConfigurations().put("netty", new TransportConfiguration(NettyConnectorFactory.class.getName()));
server = HornetQServers.newHornetQServer(conf, usePersistence());
15 years, 10 months
JBoss hornetq SVN: r8883 - in trunk: tests/src/org/hornetq/tests/unit/ra and 1 other directory.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-02-16 11:52:12 -0500 (Tue, 16 Feb 2010)
New Revision: 8883
Modified:
trunk/src/main/org/hornetq/ra/HornetQRAConnectionFactory.java
trunk/src/main/org/hornetq/ra/HornetQResourceAdapter.java
trunk/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-294 - A few minor tweaks to the JCA adapter as requested by the JBJCA's lead (Jesper)
Modified: trunk/src/main/org/hornetq/ra/HornetQRAConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/ra/HornetQRAConnectionFactory.java 2010-02-16 15:28:23 UTC (rev 8882)
+++ trunk/src/main/org/hornetq/ra/HornetQRAConnectionFactory.java 2010-02-16 16:52:12 UTC (rev 8883)
@@ -21,7 +21,7 @@
import javax.jms.XAConnectionFactory;
import javax.jms.XAQueueConnectionFactory;
import javax.jms.XATopicConnectionFactory;
-import javax.naming.Referenceable;
+import javax.resource.Referenceable;
/**
* An aggregate interface for the JMS connection factories
Modified: trunk/src/main/org/hornetq/ra/HornetQResourceAdapter.java
===================================================================
--- trunk/src/main/org/hornetq/ra/HornetQResourceAdapter.java 2010-02-16 15:28:23 UTC (rev 8882)
+++ trunk/src/main/org/hornetq/ra/HornetQResourceAdapter.java 2010-02-16 16:52:12 UTC (rev 8883)
@@ -72,6 +72,11 @@
* The resource adapter properties
*/
private final HornetQRAProperties raProperties;
+
+ /**
+ * The resource adapter properties before parsing
+ */
+ private String unparsedProperties;
/**
* The JBoss connection factory
@@ -234,15 +239,16 @@
return raProperties.getConnectorClassName();
}
- public Map<String, Object> getConnectionParameters()
+ public String getConnectionParameters()
{
- return raProperties.getParsedConnectionParameters();
+ return unparsedProperties;
}
public void setConnectionParameters(final String config)
{
if (config != null)
{
+ this.unparsedProperties = config;
raProperties.setParsedConnectionParameters(Util.parseConfig(config));
}
}
@@ -1381,7 +1387,7 @@
if (connectorClassName != null)
{
Map<String, Object> connectionParams = overrideProperties.getParsedConnectionParameters() != null ? overrideProperties.getParsedConnectionParameters()
- : getConnectionParameters();
+ : raProperties.getParsedConnectionParameters();
TransportConfiguration transportConf = new TransportConfiguration(connectorClassName, connectionParams);
String backUpCOnnectorClassname = overrideProperties.getBackupConnectorClassName() != null ? overrideProperties.getBackupConnectorClassName()
Modified: trunk/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java 2010-02-16 15:28:23 UTC (rev 8882)
+++ trunk/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java 2010-02-16 16:52:12 UTC (rev 8883)
@@ -333,7 +333,7 @@
public void testValidateProperties() throws Exception
{
- validateGettersAndSetters(new HornetQResourceAdapter(), "backupTransportConfiguration");
+ validateGettersAndSetters(new HornetQResourceAdapter(), "backupTransportConfiguration", "connectionParameters");
validateGettersAndSetters(new HornetQRAManagedConnectionFactory(),
"connectionParameters",
"sessionDefaultType",
15 years, 10 months
JBoss hornetq SVN: r8882 - in trunk: tests/src/org/hornetq/tests/integration/stomp and 1 other directory.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-02-16 10:28:23 -0500 (Tue, 16 Feb 2010)
New Revision: 8882
Modified:
trunk/src/main/org/hornetq/core/protocol/stomp/StompSession.java
trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-129: Implement STOMP v1.0
* make sure a text body is encoded with UTF-8
* add testBodyWithUTF8()
Modified: trunk/src/main/org/hornetq/core/protocol/stomp/StompSession.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/stomp/StompSession.java 2010-02-16 14:47:14 UTC (rev 8881)
+++ trunk/src/main/org/hornetq/core/protocol/stomp/StompSession.java 2010-02-16 15:28:23 UTC (rev 8882)
@@ -92,7 +92,7 @@
SimpleString text = serverMessage.getBodyBuffer().readNullableSimpleString();
if (text != null)
{
- data = text.toString().getBytes();
+ data = text.toString().getBytes("UTF-8");
}
}
else
Modified: trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java 2010-02-16 14:47:14 UTC (rev 8881)
+++ trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java 2010-02-16 15:28:23 UTC (rev 8882)
@@ -497,6 +497,49 @@
sendFrame(frame);
}
+ public void testBodyWithUTF8() throws Exception {
+
+ String frame =
+ "CONNECT\n" +
+ "login: brianm\n" +
+ "passcode: wombats\n\n" +
+ Stomp.NULL;
+ sendFrame(frame);
+
+ frame = receiveFrame(100000);
+ Assert.assertTrue(frame.startsWith("CONNECTED"));
+
+ frame =
+ "SUBSCRIBE\n" +
+ "destination:" + getQueuePrefix() + getQueueName() + "\n" +
+ "ack:auto\n\n" +
+ Stomp.NULL;
+ sendFrame(frame);
+
+ String text = "A" + "\u00ea" + "\u00f1" +
+ "\u00fc" + "C";
+ System.out.println(text);
+ sendMessage(text);
+
+ frame = receiveFrame(10000);
+ System.out.println(frame);
+ Assert.assertTrue(frame.startsWith("MESSAGE"));
+ Assert.assertTrue(frame.indexOf("destination:") > 0);
+ Assert.assertTrue(frame.indexOf(text) > 0);
+
+ frame =
+ "DISCONNECT\n" +
+ "\n\n" +
+ Stomp.NULL;
+ sendFrame(frame);
+
+ // message should not be received as it was auto-acked
+ MessageConsumer consumer = session.createConsumer(queue);
+ TextMessage message = (TextMessage) consumer.receive(1000);
+ Assert.assertNull(message);
+
+ }
+
public void testMessagesAreInOrder() throws Exception {
int ctr = 10;
String[] data = new String[ctr];
15 years, 10 months
JBoss hornetq SVN: r8881 - in trunk: src/main/org/hornetq/core/management/impl and 2 other directories.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-02-16 09:47:14 -0500 (Tue, 16 Feb 2010)
New Revision: 8881
Modified:
trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java
trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java
trunk/tests/src/org/hornetq/tests/unit/core/deployers/impl/QueueDeployerTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-300: SecuritySettings should be manageable via the management API
* reorder addSecuritySettings arguments to have send & consume roles first
Modified: trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java
===================================================================
--- trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java 2010-02-16 14:12:26 UTC (rev 8880)
+++ trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java 2010-02-16 14:47:14 UTC (rev 8881)
@@ -480,12 +480,12 @@
@Operation(desc= "Add security settings for addresses matching the addressMatch", impact = MBeanOperationInfo.ACTION)
void addSecuritySettings(
@Parameter(desc="an address match", name="addressMatch") String addressMatch,
+ @Parameter(desc="a comma-separated list of roles allowed to send messages", name="send") String sendRoles,
+ @Parameter(desc="a comma-separated list of roles allowed to consume messages", name="consume") String consumeRoles,
@Parameter(desc="a comma-separated list of roles allowed to create durable queues", name="createDurableQueueRoles") String createDurableQueueRoles,
@Parameter(desc="a comma-separated list of roles allowed to delete durable queues", name="deleteDurableQueueRoles") String deleteDurableQueueRoles,
@Parameter(desc="a comma-separated list of roles allowed to create temporary queues", name="createTempQueueRoles") String createTempQueueRoles,
@Parameter(desc="a comma-separated list of roles allowed to delete temporary queues", name="deleteTempQueueRoles") String deleteTempQueueRoles,
- @Parameter(desc="a comma-separated list of roles allowed to send messages", name="send") String sendRoles,
- @Parameter(desc="a comma-separated list of roles allowed to consume messages", name="consume") String consumeRoles,
@Parameter(desc="a comma-separated list of roles allowed to send management messages messages", name="manage") String manageRoles) throws Exception;
void removeSecuritySettings(String addressMatch) throws Exception;
Modified: trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2010-02-16 14:12:26 UTC (rev 8880)
+++ trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2010-02-16 14:47:14 UTC (rev 8881)
@@ -1073,12 +1073,12 @@
}
public void addSecuritySettings(String addressMatch,
+ String sendRoles,
+ String consumeRoles,
String createDurableQueueRoles,
String deleteDurableQueueRoles,
String createTempQueueRoles,
String deleteTempQueueRoles,
- String sendRoles,
- String consumeRoles,
String manageRoles)
{
clearIO();
Modified: trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java 2010-02-16 14:12:26 UTC (rev 8880)
+++ trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java 2010-02-16 14:47:14 UTC (rev 8881)
@@ -399,7 +399,7 @@
String exactAddress = "test.whatever";
assertEquals(0, serverControl.getRoles(addressMatch).length);
- serverControl.addSecuritySettings(addressMatch, "foo", "bar", "foo, bar", "", "foo", "foo, bar", "");
+ serverControl.addSecuritySettings(addressMatch, "foo", "foo, bar", "foo", "bar", "foo, bar", "", "");
String rolesAsJSON = serverControl.getRolesAsJSON(exactAddress);
RoleInfo[] roleInfos = RoleInfo.from(rolesAsJSON);
@@ -416,20 +416,20 @@
fooRole = roleInfos[1];
barRole = roleInfos[0];
}
+ assertTrue(fooRole.isSend());
+ assertTrue(fooRole.isConsume());
assertTrue(fooRole.isCreateDurableQueue());
assertFalse(fooRole.isDeleteDurableQueue());
assertTrue(fooRole.isCreateNonDurableQueue());
assertFalse(fooRole.isDeleteNonDurableQueue());
- assertTrue(fooRole.isSend());
- assertTrue(fooRole.isConsume());
assertFalse(fooRole.isManage());
+ assertFalse(barRole.isSend());
+ assertTrue(barRole.isConsume());
assertFalse(barRole.isCreateDurableQueue());
assertTrue(barRole.isDeleteDurableQueue());
assertTrue(barRole.isCreateNonDurableQueue());
assertFalse(barRole.isDeleteNonDurableQueue());
- assertFalse(barRole.isSend());
- assertTrue(barRole.isConsume());
assertFalse(barRole.isManage());
serverControl.removeSecuritySettings(addressMatch);
Modified: trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java 2010-02-16 14:12:26 UTC (rev 8880)
+++ trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java 2010-02-16 14:47:14 UTC (rev 8881)
@@ -448,18 +448,18 @@
}
public void addSecuritySettings(String addressMatch,
+ String sendRoles,
+ String consumeRoles,
String createDurableQueueRoles,
String deleteDurableQueueRoles,
String createTempQueueRoles,
String deleteTempQueueRoles,
- String sendRoles,
- String consumeRoles,
String manageRoles) throws Exception
{
proxy.invokeOperation("addSecuritySettings", addressMatch,
+ sendRoles, consumeRoles,
createDurableQueueRoles, deleteDurableQueueRoles,
createTempQueueRoles, deleteTempQueueRoles,
- sendRoles, consumeRoles,
manageRoles);
}
Modified: trunk/tests/src/org/hornetq/tests/unit/core/deployers/impl/QueueDeployerTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/deployers/impl/QueueDeployerTest.java 2010-02-16 14:12:26 UTC (rev 8880)
+++ trunk/tests/src/org/hornetq/tests/unit/core/deployers/impl/QueueDeployerTest.java 2010-02-16 14:47:14 UTC (rev 8881)
@@ -562,12 +562,12 @@
}
public void addSecuritySettings(String addressMatch,
+ String sendRoles,
+ String consumeRoles,
String createDurableQueueRoles,
String deleteDurableQueueRoles,
String createTempQueueRoles,
String deleteTempQueueRoles,
- String sendRoles,
- String consumeRoles,
String manageRoles) throws Exception
{
}
15 years, 10 months
JBoss hornetq SVN: r8880 - trunk/src/main/org/hornetq/core/protocol/stomp.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-02-16 09:12:26 -0500 (Tue, 16 Feb 2010)
New Revision: 8880
Modified:
trunk/src/main/org/hornetq/core/protocol/stomp/StompUtils.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-129: Implement STOMP v1.0
* do not put in Stomp MESSAGE Frame JMS properties which have their own headers specified by Stomp
Modified: trunk/src/main/org/hornetq/core/protocol/stomp/StompUtils.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/stomp/StompUtils.java 2010-02-16 13:49:25 UTC (rev 8879)
+++ trunk/src/main/org/hornetq/core/protocol/stomp/StompUtils.java 2010-02-16 14:12:26 UTC (rev 8880)
@@ -111,6 +111,13 @@
Set<SimpleString> names = message.getPropertyNames();
for (SimpleString name : names)
{
+ if (name.equals(ClientMessageImpl.REPLYTO_HEADER_NAME) ||
+ name.toString().equals("JMSType") ||
+ name.toString().equals("JMSCorrelationID"))
+ {
+ continue;
+ }
+
headers.put(name.toString(), message.getObjectProperty(name));
}
}
15 years, 10 months
JBoss hornetq SVN: r8879 - in trunk: src/main/org/hornetq/core/management/impl and 2 other directories.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-02-16 08:49:25 -0500 (Tue, 16 Feb 2010)
New Revision: 8879
Modified:
trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java
trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java
trunk/tests/src/org/hornetq/tests/unit/core/deployers/impl/QueueDeployerTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-300: SecuritySettings should be manageable via the management API
* added management methods to HornetQServerControl to add/remove/get security settings corresponding to an address match
Modified: trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java
===================================================================
--- trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java 2010-02-16 09:50:10 UTC (rev 8878)
+++ trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java 2010-02-16 13:49:25 UTC (rev 8879)
@@ -477,4 +477,20 @@
*/
void sendQueueInfoToQueue(String queueName, String address) throws Exception;
+ @Operation(desc= "Add security settings for addresses matching the addressMatch", impact = MBeanOperationInfo.ACTION)
+ void addSecuritySettings(
+ @Parameter(desc="an address match", name="addressMatch") String addressMatch,
+ @Parameter(desc="a comma-separated list of roles allowed to create durable queues", name="createDurableQueueRoles") String createDurableQueueRoles,
+ @Parameter(desc="a comma-separated list of roles allowed to delete durable queues", name="deleteDurableQueueRoles") String deleteDurableQueueRoles,
+ @Parameter(desc="a comma-separated list of roles allowed to create temporary queues", name="createTempQueueRoles") String createTempQueueRoles,
+ @Parameter(desc="a comma-separated list of roles allowed to delete temporary queues", name="deleteTempQueueRoles") String deleteTempQueueRoles,
+ @Parameter(desc="a comma-separated list of roles allowed to send messages", name="send") String sendRoles,
+ @Parameter(desc="a comma-separated list of roles allowed to consume messages", name="consume") String consumeRoles,
+ @Parameter(desc="a comma-separated list of roles allowed to send management messages messages", name="manage") String manageRoles) throws Exception;
+
+ void removeSecuritySettings(String addressMatch) throws Exception;
+
+ Object[] getRoles(String addressMatch) throws Exception;
+
+ String getRolesAsJSON(String addressMatch) throws Exception;
}
Modified: trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2010-02-16 09:50:10 UTC (rev 8878)
+++ trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2010-02-16 13:49:25 UTC (rev 8879)
@@ -19,6 +19,7 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -47,6 +48,8 @@
import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.postoffice.PostOffice;
import org.hornetq.core.remoting.server.RemotingService;
+import org.hornetq.core.security.CheckType;
+import org.hornetq.core.security.Role;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.JournalType;
import org.hornetq.core.server.ServerSession;
@@ -87,6 +90,21 @@
// Static --------------------------------------------------------
+ private static List<String> toList(final String commaSeparatedString)
+ {
+ List<String> list = new ArrayList<String>();
+ if (commaSeparatedString == null || commaSeparatedString.trim().length() == 0)
+ {
+ return list;
+ }
+ String[] values = commaSeparatedString.split(",");
+ for (int i = 0; i < values.length; i++)
+ {
+ list.add(values[i].trim());
+ }
+ return list;
+ }
+
// Constructors --------------------------------------------------
public HornetQServerControlImpl(final PostOffice postOffice,
@@ -1053,7 +1071,119 @@
blockOnIO();
}
}
+
+ public void addSecuritySettings(String addressMatch,
+ String createDurableQueueRoles,
+ String deleteDurableQueueRoles,
+ String createTempQueueRoles,
+ String deleteTempQueueRoles,
+ String sendRoles,
+ String consumeRoles,
+ String manageRoles)
+ {
+ clearIO();
+ try
+ {
+ List<String> createDurableQueue = toList(createDurableQueueRoles);
+ List<String> deleteDurableQueue = toList(deleteDurableQueueRoles);
+ List<String> createTempQueue = toList(createTempQueueRoles);
+ List<String> deleteTempQueue = toList(deleteTempQueueRoles);
+ List<String> send = toList(sendRoles);
+ List<String> consume = toList(consumeRoles);
+ List<String> manage = toList(manageRoles);
+ Set<String> allRoles = new HashSet<String>();
+ allRoles.addAll(createDurableQueue);
+ allRoles.addAll(deleteDurableQueue);
+ allRoles.addAll(createTempQueue);
+ allRoles.addAll(deleteTempQueue);
+ allRoles.addAll(send);
+ allRoles.addAll(consume);
+ allRoles.addAll(manage);
+
+ Set<Role> roles = new HashSet<Role>();
+ for (String role : allRoles)
+ {
+ roles.add(new Role(role,
+ send.contains(role),
+ consume.contains(role),
+ createDurableQueue.contains(role),
+ deleteDurableQueue.contains(role),
+ createTempQueue.contains(role),
+ deleteTempQueue.contains(role),
+ manageRoles.contains(role)));
+ }
+
+ server.getSecurityRepository().addMatch(addressMatch, roles );
+ }
+ finally
+ {
+ blockOnIO();
+ }
+ }
+
+ public void removeSecuritySettings(String addressMatch)
+ {
+ clearIO();
+ try
+ {
+ server.getSecurityRepository().removeMatch(addressMatch);
+ }
+ finally
+ {
+ blockOnIO();
+ }
+ }
+
+ public Object[] getRoles(String addressMatch) throws Exception
+ {
+ clearIO();
+ try
+ {
+ Set<Role> roles = server.getSecurityRepository().getMatch(addressMatch);
+
+ Object[] objRoles = new Object[roles.size()];
+
+ int i = 0;
+ for (Role role : roles)
+ {
+ objRoles[i++] = new Object[] { role.getName(),
+ CheckType.SEND.hasRole(role),
+ CheckType.CONSUME.hasRole(role),
+ CheckType.CREATE_DURABLE_QUEUE.hasRole(role),
+ CheckType.DELETE_DURABLE_QUEUE.hasRole(role),
+ CheckType.CREATE_NON_DURABLE_QUEUE.hasRole(role),
+ CheckType.DELETE_NON_DURABLE_QUEUE.hasRole(role),
+ CheckType.MANAGE.hasRole(role) };
+ }
+ return objRoles;
+ }
+ finally
+ {
+ blockOnIO();
+ }
+ }
+
+ public String getRolesAsJSON(String addressMatch) throws Exception
+ {
+ clearIO();
+ try
+ {
+ JSONArray json = new JSONArray();
+ Set<Role> roles = server.getSecurityRepository().getMatch(addressMatch);
+
+ for (Role role : roles)
+ {
+ json.put(new JSONObject(role));
+ }
+ return json.toString();
+ }
+ finally
+ {
+ blockOnIO();
+ }
+ }
+
public void sendQueueInfoToQueue(final String queueName, final String address) throws Exception
{
clearIO();
Modified: trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java 2010-02-16 09:50:10 UTC (rev 8878)
+++ trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java 2010-02-16 13:49:25 UTC (rev 8879)
@@ -23,6 +23,7 @@
import org.hornetq.api.core.management.HornetQServerControl;
import org.hornetq.api.core.management.ObjectNameBuilder;
import org.hornetq.api.core.management.QueueControl;
+import org.hornetq.api.core.management.RoleInfo;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.messagecounter.impl.MessageCounterManagerImpl;
@@ -390,6 +391,50 @@
Assert.assertEquals(newSample, serverControl.getMessageCounterSamplePeriod());
}
+
+ public void testSecuritySettings() throws Exception
+ {
+ HornetQServerControl serverControl = createManagementControl();
+ String addressMatch = "test.#";
+ String exactAddress = "test.whatever";
+
+ assertEquals(0, serverControl.getRoles(addressMatch).length);
+ serverControl.addSecuritySettings(addressMatch, "foo", "bar", "foo, bar", "", "foo", "foo, bar", "");
+
+ String rolesAsJSON = serverControl.getRolesAsJSON(exactAddress);
+ RoleInfo[] roleInfos = RoleInfo.from(rolesAsJSON);
+ assertEquals(2, roleInfos.length);
+ RoleInfo fooRole = null;
+ RoleInfo barRole = null;
+ if (roleInfos[0].getName().equals("foo"))
+ {
+ fooRole = roleInfos[0];
+ barRole = roleInfos[1];
+ }
+ else
+ {
+ fooRole = roleInfos[1];
+ barRole = roleInfos[0];
+ }
+ assertTrue(fooRole.isCreateDurableQueue());
+ assertFalse(fooRole.isDeleteDurableQueue());
+ assertTrue(fooRole.isCreateNonDurableQueue());
+ assertFalse(fooRole.isDeleteNonDurableQueue());
+ assertTrue(fooRole.isSend());
+ assertTrue(fooRole.isConsume());
+ assertFalse(fooRole.isManage());
+
+ assertFalse(barRole.isCreateDurableQueue());
+ assertTrue(barRole.isDeleteDurableQueue());
+ assertTrue(barRole.isCreateNonDurableQueue());
+ assertFalse(barRole.isDeleteNonDurableQueue());
+ assertFalse(barRole.isSend());
+ assertTrue(barRole.isConsume());
+ assertFalse(barRole.isManage());
+
+ serverControl.removeSecuritySettings(addressMatch);
+ assertEquals(0, serverControl.getRoles(exactAddress).length);
+ }
// Package protected ---------------------------------------------
Modified: trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java 2010-02-16 09:50:10 UTC (rev 8878)
+++ trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java 2010-02-16 13:49:25 UTC (rev 8879)
@@ -19,7 +19,6 @@
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.core.management.HornetQServerControl;
import org.hornetq.api.core.management.ResourceNames;
-import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
@@ -447,7 +446,36 @@
{
return (Boolean)proxy.retrieveAttributeValue("PersistenceEnabled");
}
-
+
+ public void addSecuritySettings(String addressMatch,
+ String createDurableQueueRoles,
+ String deleteDurableQueueRoles,
+ String createTempQueueRoles,
+ String deleteTempQueueRoles,
+ String sendRoles,
+ String consumeRoles,
+ String manageRoles) throws Exception
+ {
+ proxy.invokeOperation("addSecuritySettings", addressMatch,
+ createDurableQueueRoles, deleteDurableQueueRoles,
+ createTempQueueRoles, deleteTempQueueRoles,
+ sendRoles, consumeRoles,
+ manageRoles);
+ }
+
+ public void removeSecuritySettings(String addressMatch) throws Exception {
+ proxy.invokeOperation("removeSecuritySettings", addressMatch);
+ };
+
+ public Object[] getRoles(String addressMatch) throws Exception
+ {
+ return (Object[])proxy.invokeOperation("getRoles", addressMatch);
+ }
+
+ public String getRolesAsJSON(String addressMatch) throws Exception
+ {
+ return (String)proxy.invokeOperation("getRolesAsJSON", addressMatch);
+ }
};
}
// Package protected ---------------------------------------------
Modified: trunk/tests/src/org/hornetq/tests/unit/core/deployers/impl/QueueDeployerTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/deployers/impl/QueueDeployerTest.java 2010-02-16 09:50:10 UTC (rev 8878)
+++ trunk/tests/src/org/hornetq/tests/unit/core/deployers/impl/QueueDeployerTest.java 2010-02-16 13:49:25 UTC (rev 8879)
@@ -560,6 +560,31 @@
{
return false;
}
+
+ public void addSecuritySettings(String addressMatch,
+ String createDurableQueueRoles,
+ String deleteDurableQueueRoles,
+ String createTempQueueRoles,
+ String deleteTempQueueRoles,
+ String sendRoles,
+ String consumeRoles,
+ String manageRoles) throws Exception
+ {
+ }
+
+ public void removeSecuritySettings(String addressMatch) throws Exception
+ {
+ }
+
+ public Object[] getRoles(String addressMatch) throws Exception
+ {
+ return null;
+ }
+
+ public String getRolesAsJSON(String addressMatch) throws Exception
+ {
+ return null;
+ }
}
15 years, 10 months
JBoss hornetq SVN: r8878 - in trunk: tests/src/org/hornetq/tests/integration/stomp and 1 other directory.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-02-16 04:50:10 -0500 (Tue, 16 Feb 2010)
New Revision: 8878
Modified:
trunk/src/main/org/hornetq/core/protocol/stomp/StompFrame.java
trunk/src/main/org/hornetq/core/protocol/stomp/StompMarshaller.java
trunk/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java
trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-129: Implement STOMP v1.0
* fixed deadlock
Modified: trunk/src/main/org/hornetq/core/protocol/stomp/StompFrame.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/stomp/StompFrame.java 2010-02-15 20:45:11 UTC (rev 8877)
+++ trunk/src/main/org/hornetq/core/protocol/stomp/StompFrame.java 2010-02-16 09:50:10 UTC (rev 8878)
@@ -17,6 +17,7 @@
*/
package org.hornetq.core.protocol.stomp;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@@ -68,17 +69,20 @@
{
if (size == -1)
{
- throw new IllegalStateException("Frame has not been encoded yet");
+ StompMarshaller marshaller = new StompMarshaller();
+ try
+ {
+ size = marshaller.marshal(this).length;
+ }
+ catch (IOException e)
+ {
+ return -1;
+ }
}
return size ;
}
- public void setEncodedSize(int size)
- {
- this.size = size;
- }
-
@Override
public String toString()
{
Modified: trunk/src/main/org/hornetq/core/protocol/stomp/StompMarshaller.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/stomp/StompMarshaller.java 2010-02-15 20:45:11 UTC (rev 8877)
+++ trunk/src/main/org/hornetq/core/protocol/stomp/StompMarshaller.java 2010-02-16 09:50:10 UTC (rev 8878)
@@ -62,9 +62,7 @@
DataOutputStream dos = new DataOutputStream(baos);
marshal(command, dos);
dos.close();
- byte[] bytes = baos.toByteArray();
- command.setEncodedSize(bytes.length);
- return bytes;
+ return baos.toByteArray();
}
public void marshal(StompFrame stomp, DataOutput os) throws IOException
Modified: trunk/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java 2010-02-15 20:45:11 UTC (rev 8877)
+++ trunk/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java 2010-02-16 09:50:10 UTC (rev 8878)
@@ -34,7 +34,6 @@
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.core.journal.IOAsyncTask;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.ServerSession;
import org.hornetq.core.server.impl.ServerMessageImpl;
@@ -154,7 +153,6 @@
try
{
request = marshaller.unmarshal(buffer);
- System.out.println("received " + request);
if (log.isTraceEnabled())
{
log.trace("received " + request);
@@ -165,27 +163,27 @@
StompFrame response = null;
if (Stomp.Commands.CONNECT.equals(command))
{
- response = onConnect(request, server, conn);
+ response = onConnect(request, conn);
}
else if (Stomp.Commands.DISCONNECT.equals(command))
{
- response = onDisconnect(request, server, conn);
+ response = onDisconnect(request, conn);
}
else if (Stomp.Commands.SEND.equals(command))
{
- response = onSend(request, server, conn);
+ response = onSend(request, conn);
}
else if (Stomp.Commands.SUBSCRIBE.equals(command))
{
- response = onSubscribe(request, server, conn);
+ response = onSubscribe(request, conn);
}
else if (Stomp.Commands.UNSUBSCRIBE.equals(command))
{
- response = onUnsubscribe(request, server, conn);
+ response = onUnsubscribe(request, conn);
}
else if (Stomp.Commands.ACK.equals(command))
{
- response = onAck(request, server, conn);
+ response = onAck(request, conn);
}
else if (Stomp.Commands.BEGIN.equals(command))
{
@@ -193,11 +191,11 @@
}
else if (Stomp.Commands.COMMIT.equals(command))
{
- response = onCommit(request, server, conn);
+ response = onCommit(request, conn);
}
else if (Stomp.Commands.ABORT.equals(command))
{
- response = onAbort(request, server, conn);
+ response = onAbort(request, conn);
}
else
{
@@ -248,7 +246,7 @@
// Private -------------------------------------------------------
- private StompFrame onSubscribe(StompFrame frame, HornetQServer server, StompConnection connection) throws Exception
+ private StompFrame onSubscribe(StompFrame frame, StompConnection connection) throws Exception
{
Map<String, Object> headers = frame.getHeaders();
String destination = (String)headers.get(Stomp.Headers.Subscribe.DESTINATION);
@@ -296,7 +294,6 @@
throw new StompException("There already is a subscription for: " + subscriptionID +
". Either use unique subscription IDs or do not create multiple subscriptions for the same destination");
}
- server.getStorageManager().setContext(stompSession.getContext());
long consumerID = server.getStorageManager().generateUniqueID();
String clientID = (connection.getClientID() != null) ? connection.getClientID() : null;
stompSession.addSubscription(consumerID, subscriptionID, clientID, durableSubscriptionName, destination, selector, ack);
@@ -304,7 +301,7 @@
return null;
}
- private StompFrame onUnsubscribe(StompFrame frame, HornetQServer server, StompConnection connection) throws Exception
+ private StompFrame onUnsubscribe(StompFrame frame, StompConnection connection) throws Exception
{
Map<String, Object> headers = frame.getHeaders();
String destination = (String)headers.get(Stomp.Headers.Unsubscribe.DESTINATION);
@@ -325,7 +322,6 @@
}
StompSession stompSession = getSession(connection);
- server.getStorageManager().setContext(stompSession.getContext());
boolean unsubscribed = stompSession.unsubscribe(subscriptionID);
if (!unsubscribed)
{
@@ -334,7 +330,7 @@
return null;
}
- private StompFrame onAck(StompFrame frame, HornetQServer server, StompConnection connection) throws Exception
+ private StompFrame onAck(StompFrame frame, StompConnection connection) throws Exception
{
Map<String, Object> headers = frame.getHeaders();
String messageID = (String)headers.get(Stomp.Headers.Ack.MESSAGE_ID);
@@ -345,7 +341,6 @@
log.warn("Transactional acknowledgement is not supported");
}
stompSession = getSession(connection);
- server.getStorageManager().setContext(stompSession.getContext());
stompSession.acknowledge(messageID);
return null;
@@ -369,7 +364,7 @@
return null;
}
- private StompFrame onCommit(StompFrame frame, HornetQServer server, StompConnection connection) throws Exception
+ private StompFrame onCommit(StompFrame frame, StompConnection connection) throws Exception
{
Map<String, Object> headers = frame.getHeaders();
String txID = (String)headers.get(Stomp.Headers.TRANSACTION);
@@ -378,18 +373,18 @@
throw new StompException("transaction header is mandatory to COMMIT a transaction");
}
- StompSession session = transactedSessions.remove(txID);
+ StompSession session = getTransactedSession(connection, txID);
if (session == null)
{
throw new StompException("No transaction started: " + txID);
}
-
+ transactedSessions.remove(txID);
session.getSession().commit();
return null;
}
- private StompFrame onAbort(StompFrame frame, HornetQServer server, StompConnection connection) throws Exception
+ private StompFrame onAbort(StompFrame frame, StompConnection connection) throws Exception
{
Map<String, Object> headers = frame.getHeaders();
String txID = (String)headers.get(Stomp.Headers.TRANSACTION);
@@ -398,12 +393,13 @@
throw new StompException("transaction header is mandatory to ABORT a transaction");
}
- StompSession session = transactedSessions.remove(txID);
-
+ StompSession session = getTransactedSession(connection, txID);
+
if (session == null)
{
throw new StompException("No transaction started: " + txID);
}
+ transactedSessions.remove(txID);
session.getSession().rollback(false);
return null;
@@ -437,6 +433,7 @@
stompSession.setServerSession(session);
sessions.put(connection, stompSession);
}
+ server.getStorageManager().setContext(stompSession.getContext());
return stompSession;
}
@@ -460,45 +457,17 @@
stompSession.setServerSession(session);
transactedSessions.put(txID, stompSession);
}
+ server.getStorageManager().setContext(stompSession.getContext());
return stompSession;
}
- private StompFrame onDisconnect(StompFrame frame, HornetQServer server, StompConnection connection) throws Exception
+ private StompFrame onDisconnect(StompFrame frame, StompConnection connection) throws Exception
{
- connection.setValid(false);
-
- StompSession session = sessions.remove(connection);
- if (session != null)
- {
- try
- {
- session.getSession().rollback(true);
- session.getSession().close();
- }
- catch (Exception e)
- {
- throw new StompException(e.getMessage());
- }
- }
-
- // removed the transacted session belonging to the connection
- Iterator<Entry<String, StompSession>> iterator = transactedSessions.entrySet().iterator();
- while (iterator.hasNext())
- {
- Map.Entry<String, StompSession> entry = (Map.Entry<String, StompSession>)iterator.next();
- if (entry.getValue().getConnection() == connection)
- {
- ServerSession serverSession = entry.getValue().getSession();
- serverSession.rollback(true);
- serverSession.close();
- iterator.remove();
- }
- }
-
+ cleanup(connection);
return null;
}
- private StompFrame onSend(StompFrame frame, HornetQServer server, StompConnection connection) throws Exception
+ private StompFrame onSend(StompFrame frame, StompConnection connection) throws Exception
{
checkConnected(connection);
Map<String, Object> headers = frame.getHeaders();
@@ -533,9 +502,8 @@
}
else
{
- stompSession = transactedSessions.get(txID);
+ stompSession = getTransactedSession(connection, txID);
}
- server.getStorageManager().setContext(stompSession.getContext());
if (stompSession.isNoLocal())
{
message.putStringProperty(CONNECTION_ID_PROP, connection.getID().toString());
@@ -544,7 +512,7 @@
return null;
}
- private StompFrame onConnect(StompFrame frame, HornetQServer server, final StompConnection connection) throws Exception
+ private StompFrame onConnect(StompFrame frame, final StompConnection connection) throws Exception
{
Map<String, Object> headers = frame.getHeaders();
String login = (String)headers.get(Stomp.Headers.Connect.LOGIN);
@@ -637,7 +605,6 @@
private void doSend(final StompConnection connection, final StompFrame frame)
{
- System.out.println("sent " + frame);
if (log.isTraceEnabled())
{
log.trace("sent " + frame);
@@ -647,7 +614,9 @@
if (connection.isDestroyed() || !connection.isValid())
{
log.warn("Connection closed " + connection);
+ return;
}
+
try
{
byte[] bytes = marshaller.marshal(frame);
Modified: trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java 2010-02-15 20:45:11 UTC (rev 8877)
+++ trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java 2010-02-16 09:50:10 UTC (rev 8878)
@@ -665,11 +665,11 @@
Assert.assertTrue(message.getJMSRedelivered());
}
- public void _testSubscribeWithClientAckThenConsumingAgainWithAutoAckWithNoDisconnectFrame() throws Exception {
+ public void testSubscribeWithClientAckThenConsumingAgainWithAutoAckWithNoDisconnectFrame() throws Exception {
assertSubscribeWithClientAckThenConsumeWithAutoAck(false);
}
- public void _testSubscribeWithClientAckThenConsumingAgainWithAutoAckWithExplicitDisconnect() throws Exception {
+ public void testSubscribeWithClientAckThenConsumingAgainWithAutoAckWithExplicitDisconnect() throws Exception {
assertSubscribeWithClientAckThenConsumeWithAutoAck(true);
}
@@ -1174,7 +1174,8 @@
"\n\n" +
Stomp.NULL;
sendFrame(disconnectFrame);
-
+ stompSocket.close();
+
// send the message when the durable subscriber is disconnected
sendMessage(getName(), topic);
15 years, 10 months
JBoss hornetq SVN: r8877 - in trunk/src/main/org/hornetq: core/management/impl and 1 other directory.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-02-15 15:45:11 -0500 (Mon, 15 Feb 2010)
New Revision: 8877
Modified:
trunk/src/main/org/hornetq/api/core/management/AddressControl.java
trunk/src/main/org/hornetq/core/management/impl/AddressControlImpl.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-299 - Fixing crossed collections over security
Modified: trunk/src/main/org/hornetq/api/core/management/AddressControl.java
===================================================================
--- trunk/src/main/org/hornetq/api/core/management/AddressControl.java 2010-02-15 17:33:11 UTC (rev 8876)
+++ trunk/src/main/org/hornetq/api/core/management/AddressControl.java 2010-02-15 20:45:11 UTC (rev 8877)
@@ -88,4 +88,10 @@
*/
@Operation(desc = "Remove a Role from this address")
void removeRole(@Parameter(name = "name", desc = "Name of the role to remove") String name) throws Exception;
+
+ /**
+ * This method will remove any matching associated with this address. This will basically reset the security for this address.
+ */
+ @Operation(desc = "Reset the security configuration for this address by using default values")
+ void resetSecurity();
}
Modified: trunk/src/main/org/hornetq/core/management/impl/AddressControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/AddressControlImpl.java 2010-02-15 17:33:11 UTC (rev 8876)
+++ trunk/src/main/org/hornetq/core/management/impl/AddressControlImpl.java 2010-02-15 20:45:11 UTC (rev 8877)
@@ -13,6 +13,7 @@
package org.hornetq.core.management.impl;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
@@ -193,6 +194,9 @@
try
{
Set<Role> roles = securityRepository.getMatch(address.toString());
+ HashSet<Role> newroles = new HashSet<Role>();
+ newroles.addAll(roles);
+
Role newRole = new Role(name,
send,
consume,
@@ -201,12 +205,12 @@
createNonDurableQueue,
deleteNonDurableQueue,
manage);
- boolean added = roles.add(newRole);
+ boolean added = newroles.add(newRole);
if (!added)
{
throw new IllegalArgumentException("Role " + name + " already exists");
}
- securityRepository.addMatch(address.toString(), roles);
+ securityRepository.addMatch(address.toString(), newroles);
}
finally
{
@@ -220,7 +224,11 @@
try
{
Set<Role> roles = securityRepository.getMatch(address.toString());
- Iterator<Role> it = roles.iterator();
+
+ HashSet<Role> newroles = new HashSet<Role>();
+ newroles.addAll(roles);
+
+ Iterator<Role> it = newroles.iterator();
boolean removed = false;
while (it.hasNext())
{
@@ -236,7 +244,10 @@
{
throw new IllegalArgumentException("Role " + role + " does not exist");
}
- securityRepository.addMatch(address.toString(), roles);
+
+ securityRepository.removeMatch(address.toString());
+
+ securityRepository.addMatch(address.toString(), newroles);
}
finally
{
@@ -244,6 +255,15 @@
}
}
+ /* (non-Javadoc)
+ * @see org.hornetq.api.core.management.AddressControl#resetSecurity()
+ */
+ public void resetSecurity()
+ {
+ securityRepository.removeMatch(address.toString());
+ }
+
+
@Override
MBeanOperationInfo[] fillMBeanOperationInfo()
{
15 years, 10 months
JBoss hornetq SVN: r8876 - trunk/src/main/org/hornetq/core/protocol/stomp.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-02-15 12:33:11 -0500 (Mon, 15 Feb 2010)
New Revision: 8876
Modified:
trunk/src/main/org/hornetq/core/protocol/stomp/StompSession.java
Log:
use java.lang.IllegalStateException, not the JMS one
Modified: trunk/src/main/org/hornetq/core/protocol/stomp/StompSession.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/stomp/StompSession.java 2010-02-15 17:23:38 UTC (rev 8875)
+++ trunk/src/main/org/hornetq/core/protocol/stomp/StompSession.java 2010-02-15 17:33:11 UTC (rev 8876)
@@ -17,8 +17,6 @@
import java.util.Map;
import java.util.Map.Entry;
-import javax.jms.IllegalStateException;
-
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.Message;
import org.hornetq.api.core.SimpleString;
15 years, 10 months