JBoss hornetq SVN: r8978 - in trunk/src/main/org/hornetq: jms/management/impl and 1 other directory.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-03-27 06:16:27 -0400 (Sat, 27 Mar 2010)
New Revision: 8978
Modified:
trunk/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java
trunk/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java
Log:
added addJNDI method to cf control
Modified: trunk/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java
===================================================================
--- trunk/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java 2010-03-27 10:12:28 UTC (rev 8977)
+++ trunk/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java 2010-03-27 10:16:27 UTC (rev 8978)
@@ -18,6 +18,8 @@
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.management.Operation;
+import org.hornetq.api.core.management.Parameter;
/**
* A ConnectionFactoryControl is used to manage a JMS ConnectionFactory.
@@ -387,4 +389,10 @@
* @see ClientSessionFactory#setDiscoveryPort(int)
*/
void setDiscoveryPort(int discoveryPort);
+
+ /**
+ * Add the JNDI binding to this destination
+ */
+ @Operation(desc = "Adds the factory to another JNDI binding")
+ void addJNDI(@Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndi) throws Exception;
}
Modified: trunk/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java 2010-03-27 10:12:28 UTC (rev 8977)
+++ trunk/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java 2010-03-27 10:16:27 UTC (rev 8978)
@@ -21,6 +21,7 @@
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.management.Parameter;
import org.hornetq.api.jms.management.ConnectionFactoryControl;
import org.hornetq.core.management.impl.MBeanInfoHelper;
import org.hornetq.jms.client.HornetQConnectionFactory;
@@ -317,6 +318,11 @@
cf.setDiscoveryPort(discoveryPort);
}
+ public void addJNDI(@Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndi) throws Exception
+ {
+ jmsManager.addQueueToJndi(name, jndi);
+ }
+
public long getCallTimeout()
{
return cf.getCallTimeout();
14 years, 2 months
JBoss hornetq SVN: r8977 - in trunk: src/main/org/hornetq/jms/server and 8 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-03-27 06:12:28 -0400 (Sat, 27 Mar 2010)
New Revision: 8977
Modified:
trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
trunk/src/main/org/hornetq/jms/server/JMSServerManager.java
trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java
trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java
trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
trunk/tests/jms-tests/src/org/hornetq/jms/tests/AcknowledgementTest.java
trunk/tests/jms-tests/src/org/hornetq/jms/tests/CTSMiscellaneousTest.java
trunk/tests/jms-tests/src/org/hornetq/jms/tests/ConnectionFactoryTest.java
trunk/tests/jms-tests/src/org/hornetq/jms/tests/HornetQServerTestCase.java
trunk/tests/jms-tests/src/org/hornetq/jms/tests/JMSTestCase.java
trunk/tests/jms-tests/src/org/hornetq/jms/tests/SecurityTest.java
trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java
trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/Server.java
trunk/tests/src/org/hornetq/tests/integration/jms/FloodServerTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/client/PreACKJMSTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/client/ReSendLargeMessageTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/client/TextMessageTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/divert/DivertAndACKClientTest.java
trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java
Log:
updated createconnectionfactory methods to take String ... bindings
Modified: trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -60,12 +60,12 @@
// Static --------------------------------------------------------
- private static List<String> convert(final Object[] jndiBindings)
+ private static String[] convert(final Object[] jndiBindings)
{
- List<String> bindings = new ArrayList<String>();
- for (Object object : jndiBindings)
+ String[] bindings = new String[jndiBindings.length];
+ for (int i = 0, jndiBindingsLength = jndiBindings.length; i < jndiBindingsLength; i++)
{
- bindings.add(object.toString().trim());
+ bindings[i] = jndiBindings[i].toString().trim();
}
return bindings;
}
@@ -159,10 +159,9 @@
try
{
- List<String> jndiBindingsList = JMSServerControlImpl.convert(jndiBindings);
TransportConfiguration liveTC = new TransportConfiguration(liveTransportClassName, liveTransportParams);
- server.createConnectionFactory(name, liveTC, jndiBindingsList);
+ server.createConnectionFactory(name, liveTC, JMSServerControlImpl.convert(jndiBindings));
sendNotification(NotificationType.CONNECTION_FACTORY_CREATED, name);
}
@@ -189,10 +188,8 @@
liveConnectorTransportParams,
backupConnectorsTransportClassNames,
backupConnectorTransportParams);
- List<String> jndiBindingsList = JMSServerControlImpl.convert(jndiBindings);
+ server.createConnectionFactory(name, pairs, JMSServerControlImpl.convert(jndiBindings));
- server.createConnectionFactory(name, pairs, jndiBindingsList);
-
sendNotification(NotificationType.CONNECTION_FACTORY_CREATED, name);
}
finally
@@ -240,10 +237,8 @@
try
{
- List<String> jndiBindingsList = JMSServerControlImpl.convert(jndiBindings);
+ server.createConnectionFactory(name, discoveryAddress, discoveryPort, JMSServerControlImpl.convert(jndiBindings));
- server.createConnectionFactory(name, discoveryAddress, discoveryPort, jndiBindingsList);
-
sendNotification(NotificationType.CONNECTION_FACTORY_CREATED, name);
}
finally
Modified: trunk/src/main/org/hornetq/jms/server/JMSServerManager.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/JMSServerManager.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/src/main/org/hornetq/jms/server/JMSServerManager.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -60,6 +60,8 @@
boolean addQueueToJndi(final String queueName, final String jndiBinding) throws Exception;
+ boolean addConnectionFactoryToJNDI(final String name, final String jndiBinding) throws Exception;
+
/**
* Creates a JMS Topic
*
@@ -122,6 +124,10 @@
*/
boolean removeQueueFromJNDI(String name) throws Exception;
+ boolean removeConnectionFactoryFromJNDI(String name, String jndi) throws Exception;
+
+ boolean removeConnectionFactoryFromJNDI(String name) throws Exception;
+
/**
* destroys a queue and removes it from JNDI
*
@@ -150,37 +156,37 @@
*/
boolean destroyTopic(String name) throws Exception;
- void createConnectionFactory(String name, String discoveryAddress, int discoveryPort, List<String> jndiBindings) throws Exception;
+ void createConnectionFactory(String name, String discoveryAddress, int discoveryPort, String ... jndiBindings) throws Exception;
void createConnectionFactory(String name,
List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
- List<String> jndiBindings) throws Exception;
+ String ... jndiBindings) throws Exception;
void createConnectionFactory(String name,
TransportConfiguration liveTC,
TransportConfiguration backupTC,
- List<String> jndiBindings) throws Exception;
+ String ... jndiBindings) throws Exception;
- void createConnectionFactory(String name, TransportConfiguration liveTC, List<String> jndiBindings) throws Exception;
+ void createConnectionFactory(String name, TransportConfiguration liveTC, String ... jndiBindings) throws Exception;
void createConnectionFactory(String name,
String discoveryAddress,
int discoveryPort,
String clientID,
- List<String> jndiBindings) throws Exception;
+ String ... jndiBindings) throws Exception;
void createConnectionFactory(String name,
List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
String clientID,
- List<String> jndiBindings) throws Exception;
+ String ... jndiBindings) throws Exception;
void createConnectionFactory(String name,
TransportConfiguration liveTC,
TransportConfiguration backupTC,
String clientID,
- List<String> jndiBindings) throws Exception;
+ String ... jndiBindings) throws Exception;
- void createConnectionFactory(String name, TransportConfiguration liveTC, String clientID, List<String> jndiBindings) throws Exception;
+ void createConnectionFactory(String name, TransportConfiguration liveTC, String clientID, String ... jndiBindings) throws Exception;
void createConnectionFactory(String name,
List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
@@ -212,7 +218,7 @@
int reconnectAttempts,
boolean failoverOnServerShutdown,
String groupId,
- List<String> jndiBindings) throws Exception;
+ String ... jndiBindings) throws Exception;
void createConnectionFactory(String name,
String discoveryAddress,
@@ -247,9 +253,9 @@
int reconnectAttempts,
boolean failoverOnServerShutdown,
String groupId,
- List<String> jndiBindings) throws Exception;
+ String ... jndiBindings) throws Exception;
- void createConnectionFactory(ConnectionFactoryConfiguration cfConfig) throws Exception;
+ void createConnectionFactory(ConnectionFactoryConfiguration cfConfig, String... jndiBindings) throws Exception;
/**
* destroys a connection factory.
Modified: trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -555,13 +555,6 @@
int nbindings = buffer.readInt();
- bindings = new String[nbindings];
-
- for (int i = 0; i < nbindings; i++)
- {
- bindings[i] = buffer.readSimpleString().toString();
- }
-
discoveryGroupName = BufferHelper.readNullableSimpleStringAsString(buffer);
discoveryAddress = BufferHelper.readNullableSimpleStringAsString(buffer);
@@ -649,13 +642,6 @@
{
BufferHelper.writeAsSimpleString(buffer, name);
- buffer.writeInt(bindings.length);
-
- for (String str : bindings)
- {
- BufferHelper.writeAsSimpleString(buffer, str);
- }
-
BufferHelper.writeAsNullableSimpleString(buffer, discoveryGroupName);
BufferHelper.writeAsNullableSimpleString(buffer, discoveryAddress);
@@ -734,19 +720,7 @@
BufferHelper.writeAsNullableSimpleString(buffer, groupID);
}
- private int sizeOfBindings()
- {
- int size = DataConstants.SIZE_INT; // for the number of bindings persisted
- for (String str : bindings)
- {
- size += BufferHelper.sizeOfSimpleString(str);
- }
-
- return size;
-
- }
-
private int sizeOfConnectors()
{
int size = DataConstants.SIZE_INT; // for the number of connectors persisted
@@ -769,8 +743,6 @@
public int getEncodeSize()
{
return BufferHelper.sizeOfSimpleString(name) +
-
- sizeOfBindings() +
BufferHelper.sizeOfNullableSimpleString(discoveryGroupName) +
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -364,18 +364,15 @@
ConnectionFactoryConfiguration cfConfig;
- String[] strbindings = jndiBindings.toArray(new String[jndiBindings.size()]);
-
if (discoveryGroupName != null)
{
- cfConfig = new ConnectionFactoryConfigurationImpl(name,
- strbindings);
+ cfConfig = new ConnectionFactoryConfigurationImpl(name);
cfConfig.setInitialWaitTimeout(discoveryInitialWaitTimeout);
cfConfig.setDiscoveryGroupName(discoveryGroupName);
}
else
{
- cfConfig = new ConnectionFactoryConfigurationImpl(name, strbindings);
+ cfConfig = new ConnectionFactoryConfigurationImpl(name);
cfConfig.setConnectorNames(connectorNames);
}
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -190,7 +190,7 @@
private void deployConnectionFactory(final Node node) throws Exception
{
ConnectionFactoryConfiguration cfConfig = parser.parseConnectionFactoryConfiguration(node);
- jmsServerManager.createConnectionFactory(cfConfig);
+ jmsServerManager.createConnectionFactory(cfConfig, cfConfig.getBindings());
}
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -394,7 +394,24 @@
return added;
}
+ public boolean addConnectionFactoryToJNDI(final String name, final String jndiBinding) throws Exception
+ {
+ checkInitialised();
+ HornetQConnectionFactory factory = connectionFactories.get(name);
+ if(factory == null)
+ {
+ throw new IllegalArgumentException("Factory does not exist");
+ }
+ boolean added = bindToJndi(jndiBinding, factory);
+ if (added)
+ {
+ addToBindings(connectionFactoryJNDI, name, jndiBinding);
+ storage.addJNDI(PersistedType.ConnectionFactory, name, jndiBinding);
+ }
+ return added;
+ }
+
/* (non-Javadoc)
* @see org.hornetq.jms.server.JMSServerManager#removeQueueFromJNDI(java.lang.String, java.lang.String)
*/
@@ -450,6 +467,34 @@
return true;
}
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.server.JMSServerManager#removeConnectionFactoryFromJNDI(java.lang.String, java.lang.String)
+ */
+ public boolean removeConnectionFactoryFromJNDI(String name, String jndi) throws Exception
+ {
+ checkInitialised();
+
+ removeFromJNDI(connectionFactoryJNDI, name, jndi);
+
+ storage.deleteJNDI(PersistedType.ConnectionFactory, name, jndi);
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.server.JMSServerManager#removeConnectionFactoryFromJNDI(java.lang.String, java.lang.String)
+ */
+ public boolean removeConnectionFactoryFromJNDI(String name) throws Exception
+ {
+ checkInitialised();
+
+ removeFromJNDI(connectionFactoryJNDI, name);
+
+ storage.deleteJNDI(PersistedType.Topic, name);
+
+ return true;
+ }
public synchronized boolean destroyQueue(final String name) throws Exception
@@ -511,27 +556,21 @@
public synchronized void createConnectionFactory(final String name,
final List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
- final List<String> jndiBindings) throws Exception
+ String ... jndiBindings) throws Exception
{
checkInitialised();
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, connectorConfigs);
- if (jndiBindings != null)
- {
- String[] bindings = new String[jndiBindings.size()];
- jndiBindings.toArray(bindings);
- configuration.setBindings(bindings);
- }
- createConnectionFactory(configuration);
+ createConnectionFactory(configuration, jndiBindings);
}
}
public synchronized void createConnectionFactory(final String name,
final List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
final String clientID,
- final List<String> jndiBindings) throws Exception
+ String ... jndiBindings) throws Exception
{
checkInitialised();
HornetQConnectionFactory cf = connectionFactories.get(name);
@@ -539,13 +578,7 @@
{
ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, connectorConfigs);
configuration.setClientID(clientID);
- if (jndiBindings != null)
- {
- String[] bindings = new String[jndiBindings.size()];
- jndiBindings.toArray(bindings);
- configuration.setBindings(bindings);
- }
- createConnectionFactory(configuration);
+ createConnectionFactory(configuration, jndiBindings);
}
}
@@ -579,7 +612,7 @@
final int reconnectAttempts,
final boolean failoverOnServerShutdown,
final String groupId,
- final List<String> jndiBindings) throws Exception
+ String ... jndiBindings) throws Exception
{
checkInitialised();
HornetQConnectionFactory cf = connectionFactories.get(name);
@@ -614,13 +647,7 @@
configuration.setReconnectAttempts(reconnectAttempts);
configuration.setFailoverOnServerShutdown(failoverOnServerShutdown);
configuration.setGroupID(groupId);
- if (jndiBindings != null)
- {
- String[] bindings = new String[jndiBindings.size()];
- jndiBindings.toArray(bindings);
- configuration.setBindings(bindings);
- }
- createConnectionFactory(configuration);
+ createConnectionFactory(configuration, jndiBindings);
}
}
@@ -657,7 +684,7 @@
final int reconnectAttempts,
final boolean failoverOnServerShutdown,
final String groupId,
- final List<String> jndiBindings) throws Exception
+ final String ... jndiBindings) throws Exception
{
checkInitialised();
HornetQConnectionFactory cf = connectionFactories.get(name);
@@ -693,41 +720,30 @@
configuration.setMaxRetryInterval(maxRetryInterval);
configuration.setReconnectAttempts(reconnectAttempts);
configuration.setFailoverOnServerShutdown(failoverOnServerShutdown);
- if (jndiBindings != null)
- {
- String[] bindings = new String[jndiBindings.size()];
- jndiBindings.toArray(bindings);
- configuration.setBindings(bindings);
- }
- createConnectionFactory(configuration);
+ createConnectionFactory(configuration, jndiBindings);
}
}
public synchronized void createConnectionFactory(final String name,
final String discoveryAddress,
final int discoveryPort,
- final List<String> jndiBindings) throws Exception
+ final String ... jndiBindings) throws Exception
{
checkInitialised();
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, discoveryAddress, discoveryPort);
- if (jndiBindings != null)
- {
- String[] bindings = new String[jndiBindings.size()];
- jndiBindings.toArray(bindings);
- configuration.setBindings(bindings);
- }
- createConnectionFactory(configuration);
+ createConnectionFactory(configuration, jndiBindings);
}
}
+
public synchronized void createConnectionFactory(final String name,
final String discoveryAddress,
final int discoveryPort,
final String clientID,
- final List<String> jndiBindings) throws Exception
+ final String ... jndiBindings) throws Exception
{
checkInitialised();
@@ -736,20 +752,19 @@
{
ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, discoveryAddress, discoveryPort);
configuration.setClientID(clientID);
- if (jndiBindings != null)
- {
- String[] bindings = new String[jndiBindings.size()];
- jndiBindings.toArray(bindings);
- configuration.setBindings(bindings);
- }
- createConnectionFactory(configuration);
+ createConnectionFactory(configuration, jndiBindings);
}
}
- public synchronized void createConnectionFactory(final ConnectionFactoryConfiguration cfConfig) throws Exception
+ public synchronized void createConnectionFactory(final ConnectionFactoryConfiguration cfConfig, String... jndiBindings) throws Exception
{
internalCreateCF(cfConfig);
storage.storeConnectionFactory(new PersistedConnectionFactory(cfConfig));
+ for (String jndiBinding : jndiBindings)
+ {
+ addConnectionFactoryToJNDI(cfConfig.getName(), jndiBinding);
+ }
+
}
private HornetQConnectionFactory internalCreateConnectionFactory(final String name,
@@ -784,8 +799,7 @@
final long maxRetryInterval,
final int reconnectAttempts,
final boolean failoverOnServerShutdown,
- final String groupId,
- final List<String> jndiBindings) throws Exception
+ final String groupId) throws Exception
{
checkInitialised();
HornetQConnectionFactory cf = connectionFactories.get(name);
@@ -823,8 +837,6 @@
cf.setFailoverOnServerShutdown(failoverOnServerShutdown);
}
- bindConnectionFactory(cf, name, jndiBindings);
-
return cf;
}
@@ -857,8 +869,7 @@
final long maxRetryInterval,
final int reconnectAttempts,
final boolean failoverOnServerShutdown,
- final String groupId,
- final List<String> jndiBindings) throws Exception
+ final String groupId) throws Exception
{
checkInitialised();
HornetQConnectionFactory cf = connectionFactories.get(name);
@@ -894,8 +905,6 @@
cf.setFailoverOnServerShutdown(failoverOnServerShutdown);
cf.setGroupID(groupId);
}
-
- bindConnectionFactory(cf, name, jndiBindings);
return cf;
}
@@ -971,11 +980,6 @@
*/
private HornetQConnectionFactory internalCreateCF(final ConnectionFactoryConfiguration cfConfig) throws HornetQException, Exception
{
- ArrayList<String> listBindings = new ArrayList<String>();
- for (String str : cfConfig.getBindings())
- {
- listBindings.add(str);
- }
List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs = lookupConnectors(cfConfig);
@@ -1015,8 +1019,7 @@
cfConfig.getMaxRetryInterval(),
cfConfig.getReconnectAttempts(),
cfConfig.isFailoverOnServerShutdown(),
- cfConfig.getGroupID(),
- listBindings);
+ cfConfig.getGroupID());
}
else
{
@@ -1049,71 +1052,66 @@
cfConfig.getMaxRetryInterval(),
cfConfig.getReconnectAttempts(),
cfConfig.isFailoverOnServerShutdown(),
- cfConfig.getGroupID(),
- listBindings);
+ cfConfig.getGroupID());
}
}
public synchronized void createConnectionFactory(final String name,
final TransportConfiguration liveTC,
- final List<String> jndiBindings) throws Exception
+ final String ... jndiBindings) throws Exception
{
checkInitialised();
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(liveTC);
+ ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, liveTC);
+ createConnectionFactory(configuration, jndiBindings);
}
-
- bindConnectionFactory(cf, name, jndiBindings);
}
public synchronized void createConnectionFactory(final String name,
final TransportConfiguration liveTC,
final String clientID,
- final List<String> jndiBindings) throws Exception
+ final String ... jndiBindings) throws Exception
{
checkInitialised();
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(liveTC);
- cf.setClientID(clientID);
+ ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, liveTC);
+ configuration.setClientID(clientID);
+ createConnectionFactory(configuration, jndiBindings);
}
-
- bindConnectionFactory(cf, name, jndiBindings);
}
public synchronized void createConnectionFactory(final String name,
final TransportConfiguration liveTC,
final TransportConfiguration backupTC,
- final List<String> jndiBindings) throws Exception
+ final String ... jndiBindings) throws Exception
{
checkInitialised();
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(liveTC, backupTC);
+ ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, liveTC, backupTC);
+ createConnectionFactory(configuration, jndiBindings);
}
-
- bindConnectionFactory(cf, name, jndiBindings);
}
public synchronized void createConnectionFactory(final String name,
final TransportConfiguration liveTC,
final TransportConfiguration backupTC,
final String clientID,
- final List<String> jndiBindings) throws Exception
+ final String ... jndiBindings) throws Exception
{
checkInitialised();
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(liveTC, backupTC);
- cf.setClientID(clientID);
+ ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, liveTC, backupTC);
+ configuration.setClientID(clientID);
+ createConnectionFactory(configuration, jndiBindings);
}
-
- bindConnectionFactory(cf, name, jndiBindings);
}
public synchronized boolean destroyConnectionFactory(final String name) throws Exception
Modified: trunk/tests/jms-tests/src/org/hornetq/jms/tests/AcknowledgementTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/hornetq/jms/tests/AcknowledgementTest.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/tests/jms-tests/src/org/hornetq/jms/tests/AcknowledgementTest.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -744,9 +744,7 @@
{
final int BATCH_SIZE = 10;
- ArrayList<String> bindings = new ArrayList<String>();
- bindings.add("mycf");
- deployConnectionFactory(null, "MyConnectionFactory2", bindings, -1, -1, -1, -1, false, false, BATCH_SIZE, true);
+ deployConnectionFactory(null, "MyConnectionFactory2", -1, -1, -1, -1, false, false, BATCH_SIZE, true, "mycf");
Connection conn = null;
try
Modified: trunk/tests/jms-tests/src/org/hornetq/jms/tests/CTSMiscellaneousTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/hornetq/jms/tests/CTSMiscellaneousTest.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/tests/jms-tests/src/org/hornetq/jms/tests/CTSMiscellaneousTest.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -63,8 +63,6 @@
connectorConfigs.add(new Pair<TransportConfiguration, TransportConfiguration>(new TransportConfiguration("org.hornetq.integration.transports.netty.NettyConnectorFactory"),
null));
- List<String> jndiBindings = new ArrayList<String>();
- jndiBindings.add("/StrictTCKConnectionFactory");
getJmsServerManager().createConnectionFactory("StrictTCKConnectionFactory",
connectorConfigs,
@@ -96,7 +94,7 @@
HornetQClient.DEFAULT_RECONNECT_ATTEMPTS,
HornetQClient.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
null,
- jndiBindings);
+ "/StrictTCKConnectionFactory");
CTSMiscellaneousTest.cf = (HornetQConnectionFactory)getInitialContext().lookup("/StrictTCKConnectionFactory");
}
Modified: trunk/tests/jms-tests/src/org/hornetq/jms/tests/ConnectionFactoryTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/hornetq/jms/tests/ConnectionFactoryTest.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/tests/jms-tests/src/org/hornetq/jms/tests/ConnectionFactoryTest.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -81,9 +81,7 @@
public void testAdministrativelyConfiguredClientID() throws Exception
{
// deploy a connection factory that has an administatively configured clientID
- ArrayList<String> bindings = new ArrayList<String>();
- bindings.add("TestConnectionFactory");
- HornetQServerTestCase.deployConnectionFactory("sofiavergara", "TestConnectionFactory", bindings);
+ HornetQServerTestCase.deployConnectionFactory("sofiavergara", "TestConnectionFactory", "TestConnectionFactory");
ConnectionFactory cf = (ConnectionFactory)JMSTestCase.ic.lookup("/TestConnectionFactory");
Connection c = cf.createConnection();
@@ -136,9 +134,7 @@
// Added for http://jira.jboss.org/jira/browse/JBMESSAGING-939
public void testDurableSubscriptionOnPreConfiguredConnectionFactory() throws Exception
{
- ArrayList<String> bindings = new ArrayList<String>();
- bindings.add("/TestDurableCF");
- HornetQServerTestCase.deployConnectionFactory("TestConnectionFactory1", "cfTest", bindings);
+ HornetQServerTestCase.deployConnectionFactory("TestConnectionFactory1", "cfTest", "/TestDurableCF");
createTopic("TestSubscriber");
@@ -190,7 +186,7 @@
{
ArrayList<String> bindings = new ArrayList<String>();
bindings.add("TestSlowConsumersCF");
- HornetQServerTestCase.deployConnectionFactory(0, "TestSlowConsumersCF", bindings, 1);
+ HornetQServerTestCase.deployConnectionFactory(0, "TestSlowConsumersCF", 1, "TestSlowConsumersCF");
Connection conn = null;
Modified: trunk/tests/jms-tests/src/org/hornetq/jms/tests/HornetQServerTestCase.java
===================================================================
--- trunk/tests/jms-tests/src/org/hornetq/jms/tests/HornetQServerTestCase.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/tests/jms-tests/src/org/hornetq/jms/tests/HornetQServerTestCase.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -424,39 +424,34 @@
public static void deployConnectionFactory(final String clientId,
final String objectName,
- final List<String> jndiBindings) throws Exception
+ final String ... jndiBindings) throws Exception
{
HornetQServerTestCase.servers.get(0).deployConnectionFactory(clientId, objectName, jndiBindings);
}
public static void deployConnectionFactory(final String objectName,
- final List<String> jndiBindings,
- final int prefetchSize) throws Exception
+ final int prefetchSize,
+ final String ... jndiBindings) throws Exception
{
- HornetQServerTestCase.servers.get(0).deployConnectionFactory(objectName, jndiBindings, prefetchSize);
+ HornetQServerTestCase.servers.get(0).deployConnectionFactory(objectName, prefetchSize, jndiBindings);
}
- public static void deployConnectionFactory(final String objectName, final List<String> jndiBindings) throws Exception
- {
- HornetQServerTestCase.servers.get(0).deployConnectionFactory(objectName, jndiBindings);
- }
public static void deployConnectionFactory(final int server,
final String objectName,
- final List<String> jndiBindings,
- final int prefetchSize) throws Exception
+ final int prefetchSize,
+ final String ... jndiBindings) throws Exception
{
- HornetQServerTestCase.servers.get(server).deployConnectionFactory(objectName, jndiBindings, prefetchSize);
+ HornetQServerTestCase.servers.get(server).deployConnectionFactory(objectName, prefetchSize, jndiBindings);
}
- public static void deployConnectionFactory(final int server, final String objectName, final List<String> jndiBindings) throws Exception
+ public static void deployConnectionFactory(final int server, final String objectName, final String ... jndiBindings) throws Exception
{
HornetQServerTestCase.servers.get(server).deployConnectionFactory(objectName, jndiBindings);
}
public void deployConnectionFactory(final String clientId,
final String objectName,
- final List<String> jndiBindings,
final int prefetchSize,
final int defaultTempQueueFullSize,
final int defaultTempQueuePageSize,
@@ -464,11 +459,11 @@
final boolean supportsFailover,
final boolean supportsLoadBalancing,
final int dupsOkBatchSize,
- final boolean blockOnAcknowledge) throws Exception
+ final boolean blockOnAcknowledge,
+ final String ... jndiBindings) throws Exception
{
HornetQServerTestCase.servers.get(0).deployConnectionFactory(clientId,
objectName,
- jndiBindings,
prefetchSize,
defaultTempQueueFullSize,
defaultTempQueuePageSize,
@@ -476,22 +471,23 @@
supportsFailover,
supportsLoadBalancing,
dupsOkBatchSize,
- blockOnAcknowledge);
+ blockOnAcknowledge,
+ jndiBindings);
}
public static void deployConnectionFactory(final String objectName,
- final List<String> jndiBindings,
final int prefetchSize,
final int defaultTempQueueFullSize,
final int defaultTempQueuePageSize,
- final int defaultTempQueueDownCacheSize) throws Exception
+ final int defaultTempQueueDownCacheSize,
+ final String ... jndiBindings) throws Exception
{
HornetQServerTestCase.servers.get(0).deployConnectionFactory(objectName,
- jndiBindings,
prefetchSize,
defaultTempQueueFullSize,
defaultTempQueuePageSize,
- defaultTempQueueDownCacheSize);
+ defaultTempQueueDownCacheSize,
+ jndiBindings);
}
public static void undeployConnectionFactory(final String objectName) throws Exception
Modified: trunk/tests/jms-tests/src/org/hornetq/jms/tests/JMSTestCase.java
===================================================================
--- trunk/tests/jms-tests/src/org/hornetq/jms/tests/JMSTestCase.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/tests/jms-tests/src/org/hornetq/jms/tests/JMSTestCase.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -59,8 +59,6 @@
connectorConfigs.add(new Pair<TransportConfiguration, TransportConfiguration>(new TransportConfiguration("org.hornetq.integration.transports.netty.NettyConnectorFactory"),
null));
- List<String> jndiBindings = new ArrayList<String>();
- jndiBindings.add("/testsuitecf");
getJmsServerManager().createConnectionFactory("testsuitecf",
connectorConfigs,
@@ -92,7 +90,7 @@
HornetQClient.DEFAULT_RECONNECT_ATTEMPTS,
HornetQClient.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
null,
- jndiBindings);
+ "/testsuitecf");
JMSTestCase.cf = (HornetQConnectionFactory)getInitialContext().lookup("/testsuitecf");
Modified: trunk/tests/jms-tests/src/org/hornetq/jms/tests/SecurityTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/hornetq/jms/tests/SecurityTest.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/tests/jms-tests/src/org/hornetq/jms/tests/SecurityTest.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -184,9 +184,7 @@
Connection conn = null;
try
{
- ArrayList<String> bindings = new ArrayList<String>();
- bindings.add("preConfcf");
- HornetQServerTestCase.deployConnectionFactory("dilbert-id", "preConfcf", bindings);
+ HornetQServerTestCase.deployConnectionFactory("dilbert-id", "preConfcf", "preConfcf");
ConnectionFactory cf = (ConnectionFactory)getInitialContext().lookup("preConfcf");
conn = cf.createConnection("guest", "guest");
String clientID = conn.getClientID();
@@ -232,9 +230,7 @@
Connection conn = null;
try
{
- ArrayList<String> bindings = new ArrayList<String>();
- bindings.add("preConfcf");
- HornetQServerTestCase.deployConnectionFactory("dilbert-id", "preConfcf", bindings);
+ HornetQServerTestCase.deployConnectionFactory("dilbert-id", "preConfcf", "preConfcf");
ConnectionFactory cf = (ConnectionFactory)getInitialContext().lookup("preConfcf");
conn = cf.createConnection("guest", "guest");
conn.setClientID("myID");
Modified: trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java
===================================================================
--- trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -218,33 +218,32 @@
getJMSServerManager().createTopic(name, "/topic/" + (jndiName != null ? jndiName : name));
}
- public void deployConnectionFactory(final String clientId, final String objectName, final List<String> jndiBindings) throws Exception
+ public void deployConnectionFactory(final String clientId, final String objectName, final String ... jndiBindings) throws Exception
{
- deployConnectionFactory(clientId, objectName, jndiBindings, -1, -1, -1, -1, false, false, -1, false);
+ deployConnectionFactory(clientId, objectName, -1, -1, -1, -1, false, false, -1, false, jndiBindings);
}
public void deployConnectionFactory(final String objectName,
- final List<String> jndiBindings,
- final int consumerWindowSize) throws Exception
+ final int consumerWindowSize,
+ final String ... jndiBindings) throws Exception
{
- deployConnectionFactory(null, objectName, jndiBindings, consumerWindowSize, -1, -1, -1, false, false, -1, false);
+ deployConnectionFactory(null, objectName, consumerWindowSize, -1, -1, -1, false, false, -1, false, jndiBindings);
}
- public void deployConnectionFactory(final String objectName, final List<String> jndiBindings) throws Exception
+ public void deployConnectionFactory(final String objectName, final String ... jndiBindings) throws Exception
{
- deployConnectionFactory(null, objectName, jndiBindings, -1, -1, -1, -1, false, false, -1, false);
+ deployConnectionFactory(null, objectName, -1, -1, -1, -1, false, false, -1, false, jndiBindings);
}
public void deployConnectionFactory(final String objectName,
- final List<String> jndiBindings,
final int prefetchSize,
final int defaultTempQueueFullSize,
final int defaultTempQueuePageSize,
- final int defaultTempQueueDownCacheSize) throws Exception
+ final int defaultTempQueueDownCacheSize,
+ final String ... jndiBindings) throws Exception
{
this.deployConnectionFactory(null,
objectName,
- jndiBindings,
prefetchSize,
defaultTempQueueFullSize,
defaultTempQueuePageSize,
@@ -252,17 +251,17 @@
false,
false,
-1,
- false);
+ false,
+ jndiBindings);
}
public void deployConnectionFactory(final String objectName,
- final List<String> jndiBindings,
final boolean supportsFailover,
- final boolean supportsLoadBalancing) throws Exception
+ final boolean supportsLoadBalancing,
+ final String ... jndiBindings) throws Exception
{
this.deployConnectionFactory(null,
objectName,
- jndiBindings,
-1,
-1,
-1,
@@ -270,12 +269,12 @@
supportsFailover,
supportsLoadBalancing,
-1,
- false);
+ false,
+ jndiBindings);
}
public void deployConnectionFactory(final String clientId,
final String objectName,
- final List<String> jndiBindings,
final int prefetchSize,
final int defaultTempQueueFullSize,
final int defaultTempQueuePageSize,
@@ -283,7 +282,8 @@
final boolean supportsFailover,
final boolean supportsLoadBalancing,
final int dupsOkBatchSize,
- final boolean blockOnAcknowledge) throws Exception
+ final boolean blockOnAcknowledge,
+ final String ... jndiBindings) throws Exception
{
List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs = new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>();
Modified: trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/Server.java
===================================================================
--- trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/Server.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/Server.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -135,7 +135,6 @@
// boolean undeployDestinationProgrammatically(boolean isQueue, String name) throws Exception;
public void deployConnectionFactory(String clientId,
String objectName,
- List<String> jndiBindings,
int prefetchSize,
int defaultTempQueueFullSize,
int defaultTempQueuePageSize,
@@ -143,25 +142,29 @@
boolean supportsFailover,
boolean supportsLoadBalancing,
int dupsOkBatchSize,
- boolean blockOnAcknowledge) throws Exception;
+ boolean blockOnAcknowledge,
+ final String ... jndiBindings) throws Exception;
void deployConnectionFactory(String objectName,
- List<String> jndiBindings,
int prefetchSize,
int defaultTempQueueFullSize,
int defaultTempQueuePageSize,
- int defaultTempQueueDownCacheSize) throws Exception;
+ int defaultTempQueueDownCacheSize,
+ final String ... jndiBindings) throws Exception;
void deployConnectionFactory(String objectName,
- List<String> jndiBindings,
boolean supportsFailover,
- boolean supportsLoadBalancing) throws Exception;
+ boolean supportsLoadBalancing,
+ final String ... jndiBindings) throws Exception;
- void deployConnectionFactory(String clientID, String objectName, List<String> jndiBindings) throws Exception;
+ void deployConnectionFactory(String clientID, String objectName,
+ final String ... jndiBindings) throws Exception;
- void deployConnectionFactory(String objectName, List<String> jndiBindings, int prefetchSize) throws Exception;
+ void deployConnectionFactory(String objectName, int prefetchSize,
+ final String ... jndiBindings) throws Exception;
- void deployConnectionFactory(String objectName, List<String> jndiBindings) throws Exception;
+ void deployConnectionFactory(String objectName,
+ final String ... jndiBindings) throws Exception;
void undeployConnectionFactory(String objectName) throws Exception;
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/FloodServerTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/FloodServerTest.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/FloodServerTest.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -128,9 +128,6 @@
connectorConfigs.add(new Pair<TransportConfiguration, TransportConfiguration>(new TransportConfiguration(NettyConnectorFactory.class.getName()),
null));
- List<String> jndiBindings = new ArrayList<String>();
- jndiBindings.add("/cf");
-
serverManager.createConnectionFactory("ManualReconnectionToSingleServerTest",
connectorConfigs,
null,
@@ -161,7 +158,7 @@
reconnectAttempts,
failoverOnServerShutdown,
null,
- jndiBindings);
+ "/cf");
}
public void testFoo()
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/client/PreACKJMSTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/client/PreACKJMSTest.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/client/PreACKJMSTest.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -190,7 +190,7 @@
@Override
protected void createCF(final List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
- final List<String> jndiBindings) throws Exception
+ final String ... jndiBindings) throws Exception
{
int retryInterval = 1000;
double retryIntervalMultiplier = 1.0;
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/client/ReSendLargeMessageTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/client/ReSendLargeMessageTest.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/client/ReSendLargeMessageTest.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -236,7 +236,7 @@
// Protected -----------------------------------------------------
@Override
protected void createCF(final List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
- final List<String> jndiBindings) throws Exception
+ final String ... jndiBindings) throws Exception
{
int retryInterval = 1000;
double retryIntervalMultiplier = 1.0;
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -65,8 +65,6 @@
connectorConfigs.add(new Pair<TransportConfiguration, TransportConfiguration>(new TransportConfiguration(NettyConnectorFactory.class.getName()),
null));
- List<String> jndiBindings = new ArrayList<String>();
- jndiBindings.add("/cffoo");
jmsServer.createConnectionFactory("cffoo",
connectorConfigs,
@@ -98,7 +96,7 @@
0,
false,
null,
- jndiBindings);
+ "/cffoo");
cf = (ConnectionFactory)context.lookup("/cffoo");
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/client/TextMessageTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/client/TextMessageTest.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/client/TextMessageTest.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -225,7 +225,7 @@
@Override
protected void createCF(final List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
- final List<String> jndiBindings) throws Exception
+ final String ... jndiBindings) throws Exception
{
int retryInterval = 1000;
double retryIntervalMultiplier = 1.0;
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/divert/DivertAndACKClientTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/divert/DivertAndACKClientTest.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/divert/DivertAndACKClientTest.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -136,7 +136,7 @@
// Inner classes -------------------------------------------------
@Override
protected void createCF(final List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
- final List<String> jndiBindings) throws Exception
+ final String ... jndiBindings) throws Exception
{
int retryInterval = 1000;
double retryIntervalMultiplier = 1.0;
Modified: trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java 2010-03-27 08:51:18 UTC (rev 8976)
+++ trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java 2010-03-27 10:12:28 UTC (rev 8977)
@@ -163,11 +163,8 @@
connectorConfigs.add(new Pair<TransportConfiguration, TransportConfiguration>(new TransportConfiguration(NettyConnectorFactory.class.getName()),
null));
- List<String> jndiBindings = new ArrayList<String>();
- jndiBindings.add("/cf");
+ createCF(connectorConfigs, "/cf");
- createCF(connectorConfigs, jndiBindings);
-
cf = (ConnectionFactory)context.lookup("/cf");
}
@@ -178,7 +175,7 @@
* @throws Exception
*/
protected void createCF(final List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
- final List<String> jndiBindings) throws Exception
+ final String ... jndiBindings) throws Exception
{
int retryInterval = 1000;
double retryIntervalMultiplier = 1.0;
14 years, 2 months
JBoss hornetq SVN: r8976 - in trunk: src/main/org/hornetq/jms/server/config/impl and 2 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-03-27 04:51:18 -0400 (Sat, 27 Mar 2010)
New Revision: 8976
Modified:
trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java
trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
trunk/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java
Log:
made all factories created thru same internal method
Modified: trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java 2010-03-27 07:57:02 UTC (rev 8975)
+++ trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java 2010-03-27 08:51:18 UTC (rev 8976)
@@ -33,6 +33,8 @@
String[] getBindings();
+ void setBindings(String[] bindings);
+
String getDiscoveryAddress();
void setDiscoveryAddress(String discoveryAddress);
Modified: trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java 2010-03-27 07:57:02 UTC (rev 8975)
+++ trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java 2010-03-27 08:51:18 UTC (rev 8976)
@@ -171,6 +171,11 @@
return bindings;
}
+ public void setBindings(String[] bindings)
+ {
+ this.bindings = bindings;
+ }
+
public String getName()
{
return name;
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-03-27 07:57:02 UTC (rev 8975)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-03-27 08:51:18 UTC (rev 8976)
@@ -54,6 +54,7 @@
import org.hornetq.jms.server.config.JMSConfiguration;
import org.hornetq.jms.server.config.JMSQueueConfiguration;
import org.hornetq.jms.server.config.TopicConfiguration;
+import org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
import org.hornetq.jms.server.management.JMSManagementService;
import org.hornetq.jms.server.management.impl.JMSManagementServiceImpl;
import org.hornetq.utils.TimeAndCounterIDGenerator;
@@ -516,10 +517,15 @@
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(connectorConfigs);
+ ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, connectorConfigs);
+ if (jndiBindings != null)
+ {
+ String[] bindings = new String[jndiBindings.size()];
+ jndiBindings.toArray(bindings);
+ configuration.setBindings(bindings);
+ }
+ createConnectionFactory(configuration);
}
-
- bindConnectionFactory(cf, name, jndiBindings);
}
public synchronized void createConnectionFactory(final String name,
@@ -531,11 +537,16 @@
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(connectorConfigs);
- cf.setClientID(clientID);
+ ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, connectorConfigs);
+ configuration.setClientID(clientID);
+ if (jndiBindings != null)
+ {
+ String[] bindings = new String[jndiBindings.size()];
+ jndiBindings.toArray(bindings);
+ configuration.setBindings(bindings);
+ }
+ createConnectionFactory(configuration);
}
-
- bindConnectionFactory(cf, name, jndiBindings);
}
public synchronized void createConnectionFactory(final String name,
@@ -574,44 +585,177 @@
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(connectorConfigs);
- cf.setClientID(clientID);
- cf.setClientFailureCheckPeriod(clientFailureCheckPeriod);
- cf.setConnectionTTL(connectionTTL);
- cf.setCallTimeout(callTimeout);
- cf.setCacheLargeMessagesClient(cacheLargeMessagesClient);
- cf.setMinLargeMessageSize(minLargeMessageSize);
- cf.setConsumerWindowSize(consumerWindowSize);
- cf.setConsumerMaxRate(consumerMaxRate);
- cf.setConfirmationWindowSize(confirmationWindowSize);
- cf.setProducerWindowSize(producerWindowSize);
- cf.setProducerMaxRate(producerMaxRate);
- cf.setBlockOnAcknowledge(blockOnAcknowledge);
- cf.setBlockOnDurableSend(blockOnDurableSend);
- cf.setBlockOnNonDurableSend(blockOnNonDurableSend);
- cf.setAutoGroup(autoGroup);
- cf.setPreAcknowledge(preAcknowledge);
- cf.setConnectionLoadBalancingPolicyClassName(loadBalancingPolicyClassName);
- cf.setTransactionBatchSize(transactionBatchSize);
- cf.setDupsOKBatchSize(dupsOKBatchSize);
- cf.setUseGlobalPools(useGlobalPools);
- cf.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
- cf.setThreadPoolMaxSize(threadPoolMaxSize);
- cf.setRetryInterval(retryInterval);
- cf.setRetryIntervalMultiplier(retryIntervalMultiplier);
- cf.setMaxRetryInterval(maxRetryInterval);
- cf.setReconnectAttempts(reconnectAttempts);
- cf.setFailoverOnServerShutdown(failoverOnServerShutdown);
- cf.setGroupID(groupId);
+ ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, connectorConfigs);
+ configuration.setClientID(clientID);
+ configuration.setClientFailureCheckPeriod(clientFailureCheckPeriod);
+ configuration.setConnectionTTL(connectionTTL);
+ configuration.setCallTimeout(callTimeout);
+ configuration.setCacheLargeMessagesClient(cacheLargeMessagesClient);
+ configuration.setMinLargeMessageSize(minLargeMessageSize);
+ configuration.setConsumerWindowSize(consumerWindowSize);
+ configuration.setConsumerMaxRate(consumerMaxRate);
+ configuration.setConfirmationWindowSize(confirmationWindowSize);
+ configuration.setProducerWindowSize(producerWindowSize);
+ configuration.setProducerMaxRate(producerMaxRate);
+ configuration.setBlockOnAcknowledge(blockOnAcknowledge);
+ configuration.setBlockOnDurableSend(blockOnDurableSend);
+ configuration.setBlockOnNonDurableSend(blockOnNonDurableSend);
+ configuration.setAutoGroup(autoGroup);
+ configuration.setPreAcknowledge(preAcknowledge);
+ configuration.setLoadBalancingPolicyClassName(loadBalancingPolicyClassName);
+ configuration.setTransactionBatchSize(transactionBatchSize);
+ configuration.setDupsOKBatchSize(dupsOKBatchSize);
+ configuration.setUseGlobalPools(useGlobalPools);
+ configuration.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
+ configuration.setThreadPoolMaxSize(threadPoolMaxSize);
+ configuration.setRetryInterval(retryInterval);
+ configuration.setRetryIntervalMultiplier(retryIntervalMultiplier);
+ configuration.setMaxRetryInterval(maxRetryInterval);
+ configuration.setReconnectAttempts(reconnectAttempts);
+ configuration.setFailoverOnServerShutdown(failoverOnServerShutdown);
+ configuration.setGroupID(groupId);
+ if (jndiBindings != null)
+ {
+ String[] bindings = new String[jndiBindings.size()];
+ jndiBindings.toArray(bindings);
+ configuration.setBindings(bindings);
+ }
+ createConnectionFactory(configuration);
}
+ }
- bindConnectionFactory(cf, name, jndiBindings);
+ public synchronized void createConnectionFactory(final String name,
+ final String discoveryAddress,
+ final int discoveryPort,
+ final String clientID,
+ final long discoveryRefreshTimeout,
+ final long clientFailureCheckPeriod,
+ final long connectionTTL,
+ final long callTimeout,
+ final boolean cacheLargeMessagesClient,
+ final int minLargeMessageSize,
+ final int consumerWindowSize,
+ final int consumerMaxRate,
+ final int confirmationWindowSize,
+ final int producerWindowSize,
+ final int producerMaxRate,
+ final boolean blockOnAcknowledge,
+ final boolean blockOnDurableSend,
+ final boolean blockOnNonDurableSend,
+ final boolean autoGroup,
+ final boolean preAcknowledge,
+ final String loadBalancingPolicyClassName,
+ final int transactionBatchSize,
+ final int dupsOKBatchSize,
+ final long initialWaitTimeout,
+ final boolean useGlobalPools,
+ final int scheduledThreadPoolMaxSize,
+ final int threadPoolMaxSize,
+ final long retryInterval,
+ final double retryIntervalMultiplier,
+ final long maxRetryInterval,
+ final int reconnectAttempts,
+ final boolean failoverOnServerShutdown,
+ final String groupId,
+ final List<String> jndiBindings) throws Exception
+ {
+ checkInitialised();
+ HornetQConnectionFactory cf = connectionFactories.get(name);
+ if (cf == null)
+ {
+ ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, discoveryAddress, discoveryPort);
+ configuration.setClientID(clientID);
+ configuration.setDiscoveryRefreshTimeout(discoveryRefreshTimeout);
+ configuration.setClientFailureCheckPeriod(clientFailureCheckPeriod);
+ configuration.setConnectionTTL(connectionTTL);
+ configuration.setCallTimeout(callTimeout);
+ configuration.setCacheLargeMessagesClient(cacheLargeMessagesClient);
+ configuration.setMinLargeMessageSize(minLargeMessageSize);
+ configuration.setConsumerWindowSize(consumerWindowSize);
+ configuration.setConsumerMaxRate(consumerMaxRate);
+ configuration.setConfirmationWindowSize(confirmationWindowSize);
+ configuration.setProducerWindowSize(producerWindowSize);
+ configuration.setProducerMaxRate(producerMaxRate);
+ configuration.setBlockOnAcknowledge(blockOnAcknowledge);
+ configuration.setBlockOnDurableSend(blockOnDurableSend);
+ configuration.setBlockOnNonDurableSend(blockOnNonDurableSend);
+ configuration.setAutoGroup(autoGroup);
+ configuration.setPreAcknowledge(preAcknowledge);
+ configuration.setLoadBalancingPolicyClassName(loadBalancingPolicyClassName);
+ configuration.setTransactionBatchSize(transactionBatchSize);
+ configuration.setDupsOKBatchSize(dupsOKBatchSize);
+ configuration.setDiscoveryRefreshTimeout(initialWaitTimeout);
+ configuration.setUseGlobalPools(useGlobalPools);
+ configuration.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
+ configuration.setThreadPoolMaxSize(threadPoolMaxSize);
+ configuration.setRetryInterval(retryInterval);
+ configuration.setRetryIntervalMultiplier(retryIntervalMultiplier);
+ configuration.setMaxRetryInterval(maxRetryInterval);
+ configuration.setReconnectAttempts(reconnectAttempts);
+ configuration.setFailoverOnServerShutdown(failoverOnServerShutdown);
+ if (jndiBindings != null)
+ {
+ String[] bindings = new String[jndiBindings.size()];
+ jndiBindings.toArray(bindings);
+ configuration.setBindings(bindings);
+ }
+ createConnectionFactory(configuration);
+ }
}
public synchronized void createConnectionFactory(final String name,
final String discoveryAddress,
final int discoveryPort,
+ final List<String> jndiBindings) throws Exception
+ {
+ checkInitialised();
+ HornetQConnectionFactory cf = connectionFactories.get(name);
+ if (cf == null)
+ {
+ ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, discoveryAddress, discoveryPort);
+ if (jndiBindings != null)
+ {
+ String[] bindings = new String[jndiBindings.size()];
+ jndiBindings.toArray(bindings);
+ configuration.setBindings(bindings);
+ }
+ createConnectionFactory(configuration);
+ }
+ }
+
+ public synchronized void createConnectionFactory(final String name,
+ final String discoveryAddress,
+ final int discoveryPort,
final String clientID,
+ final List<String> jndiBindings) throws Exception
+ {
+ checkInitialised();
+
+ HornetQConnectionFactory cf = connectionFactories.get(name);
+ if (cf == null)
+ {
+ ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, discoveryAddress, discoveryPort);
+ configuration.setClientID(clientID);
+ if (jndiBindings != null)
+ {
+ String[] bindings = new String[jndiBindings.size()];
+ jndiBindings.toArray(bindings);
+ configuration.setBindings(bindings);
+ }
+ createConnectionFactory(configuration);
+ }
+ }
+
+ public synchronized void createConnectionFactory(final ConnectionFactoryConfiguration cfConfig) throws Exception
+ {
+ internalCreateCF(cfConfig);
+ storage.storeConnectionFactory(new PersistedConnectionFactory(cfConfig));
+ }
+
+ private HornetQConnectionFactory internalCreateConnectionFactory(final String name,
+ final String discoveryAddress,
+ final int discoveryPort,
+ final String clientID,
final long discoveryRefreshTimeout,
final long clientFailureCheckPeriod,
final long connectionTTL,
@@ -680,46 +824,83 @@
}
bindConnectionFactory(cf, name, jndiBindings);
+
+ return cf;
}
- public synchronized void createConnectionFactory(final String name,
- final String discoveryAddress,
- final int discoveryPort,
- final List<String> jndiBindings) throws Exception
- {
- checkInitialised();
- HornetQConnectionFactory cf = connectionFactories.get(name);
- if (cf == null)
- {
- cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(discoveryAddress, discoveryPort);
- }
+ private HornetQConnectionFactory internalCreateConnectionFactory(final String name,
+ final List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
+ final String clientID,
+ final long clientFailureCheckPeriod,
+ final long connectionTTL,
+ final long callTimeout,
+ final boolean cacheLargeMessagesClient,
+ final int minLargeMessageSize,
+ final int consumerWindowSize,
+ final int consumerMaxRate,
+ final int confirmationWindowSize,
+ final int producerWindowSize,
+ final int producerMaxRate,
+ final boolean blockOnAcknowledge,
+ final boolean blockOnDurableSend,
+ final boolean blockOnNonDurableSend,
+ final boolean autoGroup,
+ final boolean preAcknowledge,
+ final String loadBalancingPolicyClassName,
+ final int transactionBatchSize,
+ final int dupsOKBatchSize,
+ final boolean useGlobalPools,
+ final int scheduledThreadPoolMaxSize,
+ final int threadPoolMaxSize,
+ final long retryInterval,
+ final double retryIntervalMultiplier,
+ final long maxRetryInterval,
+ final int reconnectAttempts,
+ final boolean failoverOnServerShutdown,
+ final String groupId,
+ final List<String> jndiBindings) throws Exception
+ {
+ checkInitialised();
+ HornetQConnectionFactory cf = connectionFactories.get(name);
+ if (cf == null)
+ {
+ cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(connectorConfigs);
+ cf.setClientID(clientID);
+ cf.setClientFailureCheckPeriod(clientFailureCheckPeriod);
+ cf.setConnectionTTL(connectionTTL);
+ cf.setCallTimeout(callTimeout);
+ cf.setCacheLargeMessagesClient(cacheLargeMessagesClient);
+ cf.setMinLargeMessageSize(minLargeMessageSize);
+ cf.setConsumerWindowSize(consumerWindowSize);
+ cf.setConsumerMaxRate(consumerMaxRate);
+ cf.setConfirmationWindowSize(confirmationWindowSize);
+ cf.setProducerWindowSize(producerWindowSize);
+ cf.setProducerMaxRate(producerMaxRate);
+ cf.setBlockOnAcknowledge(blockOnAcknowledge);
+ cf.setBlockOnDurableSend(blockOnDurableSend);
+ cf.setBlockOnNonDurableSend(blockOnNonDurableSend);
+ cf.setAutoGroup(autoGroup);
+ cf.setPreAcknowledge(preAcknowledge);
+ cf.setConnectionLoadBalancingPolicyClassName(loadBalancingPolicyClassName);
+ cf.setTransactionBatchSize(transactionBatchSize);
+ cf.setDupsOKBatchSize(dupsOKBatchSize);
+ cf.setUseGlobalPools(useGlobalPools);
+ cf.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
+ cf.setThreadPoolMaxSize(threadPoolMaxSize);
+ cf.setRetryInterval(retryInterval);
+ cf.setRetryIntervalMultiplier(retryIntervalMultiplier);
+ cf.setMaxRetryInterval(maxRetryInterval);
+ cf.setReconnectAttempts(reconnectAttempts);
+ cf.setFailoverOnServerShutdown(failoverOnServerShutdown);
+ cf.setGroupID(groupId);
+ }
- bindConnectionFactory(cf, name, jndiBindings);
- }
+ bindConnectionFactory(cf, name, jndiBindings);
+ return cf;
+ }
- public synchronized void createConnectionFactory(final String name,
- final String discoveryAddress,
- final int discoveryPort,
- final String clientID,
- final List<String> jndiBindings) throws Exception
- {
- checkInitialised();
- HornetQConnectionFactory cf = connectionFactories.get(name);
- if (cf == null)
- {
- cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(discoveryAddress, discoveryPort);
- cf.setClientID(clientID);
- }
- bindConnectionFactory(cf, name, jndiBindings);
- }
- public synchronized void createConnectionFactory(final ConnectionFactoryConfiguration cfConfig) throws Exception
- {
- internalCreateCF(cfConfig);
- storage.storeConnectionFactory(new PersistedConnectionFactory(cfConfig));
- }
-
private List<String> getJNDIList(final Map<String, List<String>> map, final String name)
{
List<String> result = map.get(name);
@@ -788,7 +969,7 @@
* @throws HornetQException
* @throws Exception
*/
- private void internalCreateCF(final ConnectionFactoryConfiguration cfConfig) throws HornetQException, Exception
+ private HornetQConnectionFactory internalCreateCF(final ConnectionFactoryConfiguration cfConfig) throws HornetQException, Exception
{
ArrayList<String> listBindings = new ArrayList<String>();
for (String str : cfConfig.getBindings())
@@ -802,7 +983,7 @@
if (cfConfig.getDiscoveryAddress() != null)
{
- createConnectionFactory(cfConfig.getName(),
+ return internalCreateConnectionFactory(cfConfig.getName(),
cfConfig.getDiscoveryAddress(),
cfConfig.getDiscoveryPort(),
cfConfig.getClientID(),
@@ -839,7 +1020,7 @@
}
else
{
- createConnectionFactory(cfConfig.getName(),
+ return internalCreateConnectionFactory(cfConfig.getName(),
connectorConfigs,
cfConfig.getClientID(),
cfConfig.getClientFailureCheckPeriod(),
Modified: trunk/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java 2010-03-27 07:57:02 UTC (rev 8975)
+++ trunk/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java 2010-03-27 08:51:18 UTC (rev 8976)
@@ -1,14 +1,14 @@
/*
- * Copyright 2010 Red Hat, Inc.
- * Red Hat 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.
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.hornetq.tests.integration.persistence;
14 years, 2 months
JBoss hornetq SVN: r8975 - projects/jopr-plugin/trunk.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-03-27 03:57:02 -0400 (Sat, 27 Mar 2010)
New Revision: 8975
Modified:
projects/jopr-plugin/trunk/pom.xml
Log:
updated version
Modified: projects/jopr-plugin/trunk/pom.xml
===================================================================
--- projects/jopr-plugin/trunk/pom.xml 2010-03-26 22:56:15 UTC (rev 8974)
+++ projects/jopr-plugin/trunk/pom.xml 2010-03-27 07:57:02 UTC (rev 8975)
@@ -5,7 +5,7 @@
<groupId>org.hornetq</groupId>
<artifactId>hornetq-jopr-plugin</artifactId>
<packaging>jar</packaging>
- <version>1.0.0.SNAPSHOT</version>
+ <version>1.0.0-SNAPSHOT</version>
<name>JBoss Application Server JOPR plugin</name>
<url>http://hornetq.org</url>
<description>HornetQ JOPR plugin</description>
14 years, 2 months
JBoss hornetq SVN: r8974 - trunk/src/main/org/hornetq/core/management/impl.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-03-26 18:56:15 -0400 (Fri, 26 Mar 2010)
New Revision: 8974
Modified:
trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
Log:
tweak to run the testsuite
Modified: trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2010-03-26 21:33:52 UTC (rev 8973)
+++ trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2010-03-26 22:56:15 UTC (rev 8974)
@@ -560,7 +560,7 @@
public void deployQueue(final String address, final String name, final String filterStr, final boolean durable) throws Exception
{
- checkStarted();
+// checkStarted(); // TODO: RE-enable this. Deploy is calling this method before start
SimpleString filter = filterStr == null ? null : new SimpleString(filterStr);
clearIO();
14 years, 2 months
JBoss hornetq SVN: r8973 - in trunk: src/main/org/hornetq/api/jms/management and 31 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-03-26 17:33:52 -0400 (Fri, 26 Mar 2010)
New Revision: 8973
Added:
trunk/src/main/org/hornetq/core/persistence/config/
trunk/src/main/org/hornetq/core/persistence/config/PersistedAddressSetting.java
trunk/src/main/org/hornetq/core/persistence/config/PersistedRoles.java
trunk/src/main/org/hornetq/jms/persistence/
trunk/src/main/org/hornetq/jms/persistence/JMSStorageManager.java
trunk/src/main/org/hornetq/jms/persistence/config/
trunk/src/main/org/hornetq/jms/persistence/config/PersistedConnectionFactory.java
trunk/src/main/org/hornetq/jms/persistence/config/PersistedDestination.java
trunk/src/main/org/hornetq/jms/persistence/config/PersistedJNDI.java
trunk/src/main/org/hornetq/jms/persistence/config/PersistedType.java
trunk/src/main/org/hornetq/jms/persistence/impl/
trunk/src/main/org/hornetq/jms/persistence/impl/journal/
trunk/src/main/org/hornetq/jms/persistence/impl/journal/JournalJMSStorageManagerImpl.java
trunk/src/main/org/hornetq/jms/persistence/impl/nullpm/
trunk/src/main/org/hornetq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java
trunk/src/main/org/hornetq/utils/BufferHelper.java
trunk/tests/src/org/hornetq/tests/integration/persistence/AddressSettingsConfigurationStorageTest.java
trunk/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java
trunk/tests/src/org/hornetq/tests/integration/persistence/RolesConfigurationStorageTest.java
trunk/tests/src/org/hornetq/tests/integration/persistence/StorageManagerTestBase.java
Modified:
trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java
trunk/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java
trunk/src/main/org/hornetq/api/jms/management/DestinationControl.java
trunk/src/main/org/hornetq/api/jms/management/JMSQueueControl.java
trunk/src/main/org/hornetq/api/jms/management/JMSServerControl.java
trunk/src/main/org/hornetq/api/jms/management/TopicControl.java
trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
trunk/src/main/org/hornetq/core/persistence/StorageManager.java
trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
trunk/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java
trunk/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java
trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
trunk/src/main/org/hornetq/core/settings/impl/AddressSettings.java
trunk/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java
trunk/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java
trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
trunk/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java
trunk/src/main/org/hornetq/jms/server/JMSServerManager.java
trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java
trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java
trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
trunk/src/main/org/hornetq/jms/server/management/JMSManagementService.java
trunk/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java
trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java
trunk/tests/src/org/hornetq/tests/integration/jms/bridge/BridgeTestBase.java
trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/connection/ExceptionListenerTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/consumer/ConsumerTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java
trunk/tests/src/org/hornetq/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java
trunk/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
trunk/tests/src/org/hornetq/tests/util/JMSClusteredTestBase.java
trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java
Log:
Configuration changes and few JNDI on management changes
Modified: trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java
===================================================================
--- trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -524,7 +524,7 @@
AddressSettings getAddressSettings(String address);
- void removeAddressSettings(String addressMatch);
+ void removeAddressSettings(String addressMatch) throws Exception;
/**
* returns the address settings as a JSON string
Modified: trunk/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java
===================================================================
--- trunk/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -40,7 +40,7 @@
/**
* Returns the JNDI bindings associated to this connection factory.
*/
- List<String> getBindings();
+ List<String> getJNDIBindings();
/**
* Returns the Client ID of this connection factory (or {@code null} if it is not set.
Modified: trunk/src/main/org/hornetq/api/jms/management/DestinationControl.java
===================================================================
--- trunk/src/main/org/hornetq/api/jms/management/DestinationControl.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/api/jms/management/DestinationControl.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -33,11 +33,6 @@
String getName();
/**
- * Returns the JNDI binding of this destination.
- */
- String getJNDIBinding();
-
- /**
* Returns the HornetQ address corresponding to this destination.
*/
String getAddress();
Modified: trunk/src/main/org/hornetq/api/jms/management/JMSQueueControl.java
===================================================================
--- trunk/src/main/org/hornetq/api/jms/management/JMSQueueControl.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/api/jms/management/JMSQueueControl.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -13,6 +13,7 @@
package org.hornetq.api.jms.management;
+import java.util.List;
import java.util.Map;
import javax.management.MBeanOperationInfo;
@@ -77,6 +78,18 @@
// Operations ----------------------------------------------------
/**
+ * Returns the JNDI bindings associated to this connection factory.
+ */
+ @Operation(desc = "Returns the list of JNDI bindings associated")
+ List<String> getJNDIBindings();
+
+ /**
+ * Add the JNDI binding to this destination
+ */
+ @Operation(desc = "Adds the queue to another JNDI binding")
+ void addJNDI(@Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndi) throws Exception;
+
+ /**
* Lists all the JMS messages in this queue matching the specified filter.
* <br>
* 1 Map represents 1 message, keys are the message's properties and headers, values are the corresponding values.
Modified: trunk/src/main/org/hornetq/api/jms/management/JMSServerControl.java
===================================================================
--- trunk/src/main/org/hornetq/api/jms/management/JMSServerControl.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/api/jms/management/JMSServerControl.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -14,7 +14,6 @@
package org.hornetq.api.jms.management;
import java.util.Map;
-import java.util.Set;
import javax.management.MBeanOperationInfo;
@@ -22,8 +21,6 @@
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.management.Operation;
import org.hornetq.api.core.management.Parameter;
-import org.hornetq.core.security.Role;
-import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.spi.core.remoting.ConnectorFactory;
/**
Modified: trunk/src/main/org/hornetq/api/jms/management/TopicControl.java
===================================================================
--- trunk/src/main/org/hornetq/api/jms/management/TopicControl.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/api/jms/management/TopicControl.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -13,6 +13,7 @@
package org.hornetq.api.jms.management;
+import java.util.List;
import java.util.Map;
import javax.management.MBeanOperationInfo;
@@ -54,6 +55,20 @@
*/
int getNonDurableMessageCount();
+ /**
+ * Returns the JNDI bindings associated to this connection factory.
+ */
+ @Operation(desc = "Returns the list of JNDI bindings associated")
+ List<String> getJNDIBindings();
+
+ /**
+ * Add the JNDI binding to this destination
+ */
+ @Operation(desc = "Adds the queue to another JNDI binding")
+ void addJNDI(@Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndi) throws Exception;
+
+
+
// Operations ----------------------------------------------------
/**
Modified: trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -38,6 +38,8 @@
import org.hornetq.core.messagecounter.MessageCounterManager;
import org.hornetq.core.messagecounter.impl.MessageCounterManagerImpl;
import org.hornetq.core.persistence.StorageManager;
+import org.hornetq.core.persistence.config.PersistedAddressSetting;
+import org.hornetq.core.persistence.config.PersistedRoles;
import org.hornetq.core.postoffice.PostOffice;
import org.hornetq.core.remoting.server.RemotingService;
import org.hornetq.core.security.CheckType;
@@ -85,7 +87,6 @@
// Static --------------------------------------------------------
-
// Constructors --------------------------------------------------
public HornetQServerControlImpl(final PostOffice postOffice,
@@ -537,6 +538,7 @@
blockOnIO();
}
}
+
public void deployQueue(final String address, final String name, final String filterString) throws Exception
{
checkStarted();
@@ -1167,7 +1169,7 @@
blockOnIO();
}
}
-
+
public void addSecuritySettings(String addressMatch,
String sendRoles,
String consumeRoles,
@@ -1175,16 +1177,33 @@
String deleteDurableQueueRoles,
String createTempQueueRoles,
String deleteTempQueueRoles,
- String manageRoles)
+ String manageRoles) throws Exception
{
checkStarted();
clearIO();
try
{
- Set<Role> roles = SecurityFormatter.createSecurity(sendRoles, consumeRoles, createDurableQueueRoles, deleteDurableQueueRoles, createTempQueueRoles, deleteTempQueueRoles, manageRoles);
+ Set<Role> roles = SecurityFormatter.createSecurity(sendRoles,
+ consumeRoles,
+ createDurableQueueRoles,
+ deleteDurableQueueRoles,
+ createTempQueueRoles,
+ deleteTempQueueRoles,
+ manageRoles);
- server.getSecurityRepository().addMatch(addressMatch, roles );
+ server.getSecurityRepository().addMatch(addressMatch, roles);
+
+ PersistedRoles persistedRoles = new PersistedRoles(addressMatch,
+ sendRoles,
+ consumeRoles,
+ createDurableQueueRoles,
+ deleteDurableQueueRoles,
+ createTempQueueRoles,
+ deleteTempQueueRoles,
+ manageRoles);
+
+ storageManager.storeSecurityRoles(persistedRoles);
}
finally
{
@@ -1192,8 +1211,7 @@
}
}
-
- public void removeSecuritySettings(String addressMatch)
+ public void removeSecuritySettings(String addressMatch) throws Exception
{
checkStarted();
@@ -1201,6 +1219,7 @@
try
{
server.getSecurityRepository().removeMatch(addressMatch);
+ storageManager.deleteSecurityRoles(new SimpleString(addressMatch));
}
finally
{
@@ -1219,9 +1238,10 @@
}
finally
{
- blockOnIO();
+ blockOnIO();
}
}
+
public Object[] getRoles(String addressMatch) throws Exception
{
checkStarted();
@@ -1283,11 +1303,11 @@
AddressSettings addressSettings = server.getAddressSettingsRepository().getMatch(address);
Map<String, Object> settings = new HashMap<String, Object>();
- if(addressSettings.getDeadLetterAddress() != null)
+ if (addressSettings.getDeadLetterAddress() != null)
{
settings.put("DLA", addressSettings.getDeadLetterAddress());
}
- if(addressSettings.getExpiryAddress() != null)
+ if (addressSettings.getExpiryAddress() != null)
{
settings.put("expiryAddress", addressSettings.getExpiryAddress());
}
@@ -1298,7 +1318,9 @@
settings.put("redistributionDelay", addressSettings.getRedistributionDelay());
settings.put("lastValueQueue", addressSettings.isLastValueQueue());
settings.put("sendToDLAOnNoRoute", addressSettings.isSendToDLAOnNoRoute());
- String policy = addressSettings.getAddressFullMessagePolicy() == AddressFullMessagePolicy.PAGE?"PAGE":addressSettings.getAddressFullMessagePolicy() == AddressFullMessagePolicy.BLOCK?"BLOCK":"DROP";
+ String policy = addressSettings.getAddressFullMessagePolicy() == AddressFullMessagePolicy.PAGE ? "PAGE"
+ : addressSettings.getAddressFullMessagePolicy() == AddressFullMessagePolicy.BLOCK ? "BLOCK"
+ : "DROP";
settings.put("addressFullMessagePolicy", policy);
JSONObject jsonObject = new JSONObject(settings);
@@ -1320,8 +1342,8 @@
checkStarted();
AddressSettings addressSettings = new AddressSettings();
- addressSettings.setDeadLetterAddress(DLA == null?null:new SimpleString(DLA));
- addressSettings.setExpiryAddress(expiryAddress == null?null:new SimpleString(expiryAddress));
+ addressSettings.setDeadLetterAddress(DLA == null ? null : new SimpleString(DLA));
+ addressSettings.setExpiryAddress(expiryAddress == null ? null : new SimpleString(expiryAddress));
addressSettings.setLastValueQueue(lastValueQueue);
addressSettings.setMaxDeliveryAttempts(deliveryAttempts);
addressSettings.setMaxSizeBytes(maxSizeBytes);
@@ -1329,23 +1351,25 @@
addressSettings.setRedeliveryDelay(redeliveryDelay);
addressSettings.setRedistributionDelay(redistributionDelay);
addressSettings.setSendToDLAOnNoRoute(sendToDLAOnNoRoute);
- if(addressFullMessagePolicy == null)
+ if (addressFullMessagePolicy == null)
{
addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
}
- else if(addressFullMessagePolicy.equalsIgnoreCase("PAGE"))
+ else if (addressFullMessagePolicy.equalsIgnoreCase("PAGE"))
{
addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
}
- else if(addressFullMessagePolicy.equalsIgnoreCase("DROP"))
+ else if (addressFullMessagePolicy.equalsIgnoreCase("DROP"))
{
addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.DROP);
}
- else if(addressFullMessagePolicy.equalsIgnoreCase("BLOCK"))
+ else if (addressFullMessagePolicy.equalsIgnoreCase("BLOCK"))
{
addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
}
server.getAddressSettingsRepository().addMatch(address, addressSettings);
+
+ storageManager.storeAddressSetting(new PersistedAddressSetting(new SimpleString(address), addressSettings));
}
public AddressSettings getAddressSettings(final String address)
@@ -1355,11 +1379,12 @@
return server.getAddressSettingsRepository().getMatch(address);
}
- public void removeAddressSettings(String addressMatch)
+ public void removeAddressSettings(String addressMatch) throws Exception
{
checkStarted();
server.getAddressSettingsRepository().removeMatch(addressMatch);
+ storageManager.deleteAddressSetting(new SimpleString(addressMatch));
}
public void sendQueueInfoToQueue(final String queueName, final String address) throws Exception
Modified: trunk/src/main/org/hornetq/core/persistence/StorageManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/StorageManager.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/core/persistence/StorageManager.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -13,6 +13,7 @@
package org.hornetq.core.persistence;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executor;
@@ -26,6 +27,8 @@
import org.hornetq.core.paging.PageTransactionInfo;
import org.hornetq.core.paging.PagedMessage;
import org.hornetq.core.paging.PagingManager;
+import org.hornetq.core.persistence.config.PersistedAddressSetting;
+import org.hornetq.core.persistence.config.PersistedRoles;
import org.hornetq.core.postoffice.Binding;
import org.hornetq.core.postoffice.PostOffice;
import org.hornetq.core.server.HornetQComponent;
@@ -160,4 +163,16 @@
void addGrouping(GroupBinding groupBinding) throws Exception;
void deleteGrouping(GroupBinding groupBinding) throws Exception;
+
+ void storeAddressSetting(PersistedAddressSetting addressSetting) throws Exception;
+
+ void deleteAddressSetting(SimpleString addressMatch) throws Exception;
+
+ List<PersistedAddressSetting> recoverAddressSettings() throws Exception;
+
+ void storeSecurityRoles(PersistedRoles persistedRoles) throws Exception;
+
+ void deleteSecurityRoles(SimpleString addressMatch) throws Exception;
+
+ List<PersistedRoles> recoverPersistedRoles() throws Exception;
}
Added: trunk/src/main/org/hornetq/core/persistence/config/PersistedAddressSetting.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/config/PersistedAddressSetting.java (rev 0)
+++ trunk/src/main/org/hornetq/core/persistence/config/PersistedAddressSetting.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.core.persistence.config;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.journal.EncodingSupport;
+import org.hornetq.core.settings.impl.AddressSettings;
+
+/**
+ * A PersistedAddressSetting
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ */
+public class PersistedAddressSetting implements EncodingSupport
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long storeId;
+
+ private SimpleString addressMatch;
+
+ private AddressSettings setting;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public PersistedAddressSetting()
+ {
+ super();
+ }
+
+ /**
+ * @param addressMatch
+ * @param setting
+ */
+ public PersistedAddressSetting(SimpleString addressMatch, AddressSettings setting)
+ {
+ super();
+ this.addressMatch = addressMatch;
+ this.setting = setting;
+ }
+
+ // Public --------------------------------------------------------
+
+ public void setStoreId(long id)
+ {
+ this.storeId = id;
+ }
+
+ public long getStoreId()
+ {
+ return storeId;
+ }
+
+ /**
+ * @return the addressMatch
+ */
+ public SimpleString getAddressMatch()
+ {
+ return addressMatch;
+ }
+
+ /**
+ * @return the setting
+ */
+ public AddressSettings getSetting()
+ {
+ return setting;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#decode(org.hornetq.api.core.HornetQBuffer)
+ */
+ public void decode(HornetQBuffer buffer)
+ {
+ addressMatch = buffer.readSimpleString();
+
+ setting = new AddressSettings();
+ setting.decode(buffer);
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#encode(org.hornetq.api.core.HornetQBuffer)
+ */
+ public void encode(HornetQBuffer buffer)
+ {
+ buffer.writeSimpleString(addressMatch);
+
+ setting.encode(buffer);
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#getEncodeSize()
+ */
+ public int getEncodeSize()
+ {
+ return addressMatch.sizeof() + setting.getEncodeSize();
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: trunk/src/main/org/hornetq/core/persistence/config/PersistedRoles.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/config/PersistedRoles.java (rev 0)
+++ trunk/src/main/org/hornetq/core/persistence/config/PersistedRoles.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -0,0 +1,316 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.core.persistence.config;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.journal.EncodingSupport;
+
+/**
+ * A ConfiguredRoles
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class PersistedRoles implements EncodingSupport
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long storeId;
+
+ private SimpleString addressMatch;
+
+ private SimpleString sendRoles;
+
+ private SimpleString consumeRoles;
+
+ private SimpleString createDurableQueueRoles;
+
+ private SimpleString deleteDurableQueueRoles;
+
+ private SimpleString createTempQueueRoles;
+
+ private SimpleString deleteTempQueueRoles;
+
+ private SimpleString manageRoles;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public PersistedRoles()
+ {
+ }
+
+ /**
+ * @param address
+ * @param addressMatch
+ * @param sendRoles
+ * @param consumeRoles
+ * @param createDurableQueueRoles
+ * @param deleteDurableQueueRoles
+ * @param createTempQueueRoles
+ * @param deleteTempQueueRoles
+ * @param manageRoles
+ */
+ public PersistedRoles(final String addressMatch,
+ final String sendRoles,
+ final String consumeRoles,
+ final String createDurableQueueRoles,
+ final String deleteDurableQueueRoles,
+ final String createTempQueueRoles,
+ final String deleteTempQueueRoles,
+ final String manageRoles)
+ {
+ super();
+ this.addressMatch = SimpleString.toSimpleString(addressMatch);
+ this.sendRoles = SimpleString.toSimpleString(sendRoles);
+ this.consumeRoles = SimpleString.toSimpleString(consumeRoles);
+ this.createDurableQueueRoles = SimpleString.toSimpleString(createDurableQueueRoles);
+ this.deleteDurableQueueRoles = SimpleString.toSimpleString(deleteDurableQueueRoles);
+ this.createTempQueueRoles = SimpleString.toSimpleString(createTempQueueRoles);
+ this.deleteTempQueueRoles = SimpleString.toSimpleString(deleteTempQueueRoles);
+ this.manageRoles = SimpleString.toSimpleString(manageRoles);
+ }
+
+ // Public --------------------------------------------------------
+
+ public long getStoreId()
+ {
+ return storeId;
+ }
+
+ public void setStoreId(final long id)
+ {
+ storeId = id;
+ }
+
+ /**
+ * @return the addressMatch
+ */
+ public SimpleString getAddressMatch()
+ {
+ return addressMatch;
+ }
+
+ /**
+ * @return the sendRoles
+ */
+ public String getSendRoles()
+ {
+ return sendRoles.toString();
+ }
+
+ /**
+ * @return the consumeRoles
+ */
+ public String getConsumeRoles()
+ {
+ return consumeRoles.toString();
+ }
+
+ /**
+ * @return the createDurableQueueRoles
+ */
+ public String getCreateDurableQueueRoles()
+ {
+ return createDurableQueueRoles.toString();
+ }
+
+ /**
+ * @return the deleteDurableQueueRoles
+ */
+ public String getDeleteDurableQueueRoles()
+ {
+ return deleteDurableQueueRoles.toString();
+ }
+
+ /**
+ * @return the createTempQueueRoles
+ */
+ public String getCreateTempQueueRoles()
+ {
+ return createTempQueueRoles.toString();
+ }
+
+ /**
+ * @return the deleteTempQueueRoles
+ */
+ public String getDeleteTempQueueRoles()
+ {
+ return deleteTempQueueRoles.toString();
+ }
+
+ /**
+ * @return the manageRoles
+ */
+ public String getManageRoles()
+ {
+ return manageRoles.toString();
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#encode(org.hornetq.api.core.HornetQBuffer)
+ */
+ public void encode(final HornetQBuffer buffer)
+ {
+ buffer.writeSimpleString(addressMatch);
+ buffer.writeNullableSimpleString(sendRoles);
+ buffer.writeNullableSimpleString(consumeRoles);
+ buffer.writeNullableSimpleString(createDurableQueueRoles);
+ buffer.writeNullableSimpleString(deleteDurableQueueRoles);
+ buffer.writeNullableSimpleString(createTempQueueRoles);
+ buffer.writeNullableSimpleString(deleteTempQueueRoles);
+ buffer.writeNullableSimpleString(manageRoles);
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#getEncodeSize()
+ */
+ public int getEncodeSize()
+ {
+ return addressMatch.sizeof() + SimpleString.sizeofNullableString(sendRoles) +
+ SimpleString.sizeofNullableString(consumeRoles) +
+ SimpleString.sizeofNullableString(createDurableQueueRoles) +
+ SimpleString.sizeofNullableString(deleteDurableQueueRoles) +
+ SimpleString.sizeofNullableString(createTempQueueRoles) +
+ SimpleString.sizeofNullableString(deleteTempQueueRoles) +
+ SimpleString.sizeofNullableString(manageRoles);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#decode(org.hornetq.api.core.HornetQBuffer)
+ */
+ public void decode(final HornetQBuffer buffer)
+ {
+ addressMatch = buffer.readSimpleString();
+ sendRoles = buffer.readNullableSimpleString();
+ consumeRoles = buffer.readNullableSimpleString();
+ createDurableQueueRoles = buffer.readNullableSimpleString();
+ deleteDurableQueueRoles = buffer.readNullableSimpleString();
+ createTempQueueRoles = buffer.readNullableSimpleString();
+ deleteTempQueueRoles = buffer.readNullableSimpleString();
+ manageRoles = buffer.readNullableSimpleString();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((addressMatch == null) ? 0 : addressMatch.hashCode());
+ result = prime * result + ((consumeRoles == null) ? 0 : consumeRoles.hashCode());
+ result = prime * result + ((createDurableQueueRoles == null) ? 0 : createDurableQueueRoles.hashCode());
+ result = prime * result + ((createTempQueueRoles == null) ? 0 : createTempQueueRoles.hashCode());
+ result = prime * result + ((deleteDurableQueueRoles == null) ? 0 : deleteDurableQueueRoles.hashCode());
+ result = prime * result + ((deleteTempQueueRoles == null) ? 0 : deleteTempQueueRoles.hashCode());
+ result = prime * result + ((manageRoles == null) ? 0 : manageRoles.hashCode());
+ result = prime * result + ((sendRoles == null) ? 0 : sendRoles.hashCode());
+ result = prime * result + (int)(storeId ^ (storeId >>> 32));
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ PersistedRoles other = (PersistedRoles)obj;
+ if (addressMatch == null)
+ {
+ if (other.addressMatch != null)
+ return false;
+ }
+ else if (!addressMatch.equals(other.addressMatch))
+ return false;
+ if (consumeRoles == null)
+ {
+ if (other.consumeRoles != null)
+ return false;
+ }
+ else if (!consumeRoles.equals(other.consumeRoles))
+ return false;
+ if (createDurableQueueRoles == null)
+ {
+ if (other.createDurableQueueRoles != null)
+ return false;
+ }
+ else if (!createDurableQueueRoles.equals(other.createDurableQueueRoles))
+ return false;
+ if (createTempQueueRoles == null)
+ {
+ if (other.createTempQueueRoles != null)
+ return false;
+ }
+ else if (!createTempQueueRoles.equals(other.createTempQueueRoles))
+ return false;
+ if (deleteDurableQueueRoles == null)
+ {
+ if (other.deleteDurableQueueRoles != null)
+ return false;
+ }
+ else if (!deleteDurableQueueRoles.equals(other.deleteDurableQueueRoles))
+ return false;
+ if (deleteTempQueueRoles == null)
+ {
+ if (other.deleteTempQueueRoles != null)
+ return false;
+ }
+ else if (!deleteTempQueueRoles.equals(other.deleteTempQueueRoles))
+ return false;
+ if (manageRoles == null)
+ {
+ if (other.manageRoles != null)
+ return false;
+ }
+ else if (!manageRoles.equals(other.manageRoles))
+ return false;
+ if (sendRoles == null)
+ {
+ if (other.sendRoles != null)
+ return false;
+ }
+ else if (!sendRoles.equals(other.sendRoles))
+ return false;
+ if (storeId != other.storeId)
+ return false;
+ return true;
+ }
+
+
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -20,6 +20,7 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
import javax.transaction.xa.Xid;
@@ -53,6 +54,8 @@
import org.hornetq.core.persistence.OperationContext;
import org.hornetq.core.persistence.QueueBindingInfo;
import org.hornetq.core.persistence.StorageManager;
+import org.hornetq.core.persistence.config.PersistedAddressSetting;
+import org.hornetq.core.persistence.config.PersistedRoles;
import org.hornetq.core.postoffice.Binding;
import org.hornetq.core.postoffice.PostOffice;
import org.hornetq.core.replication.ReplicationManager;
@@ -101,6 +104,10 @@
public static final byte ID_COUNTER_RECORD = 24;
+ public static final byte ADDRESS_SETTING_RECORD = 25;
+
+ public static final byte SECURITY_RECORD = 26;
+
// type + expiration + timestamp + priority
public static final int SIZE_FIELDS = DataConstants.SIZE_INT + DataConstants.SIZE_LONG +
DataConstants.SIZE_LONG +
@@ -160,6 +167,12 @@
private final String journalDir;
private final String largeMessagesDirectory;
+
+
+ // Persisted core configuration
+ private final Map<SimpleString, PersistedRoles> mapPersistedRoles = new ConcurrentHashMap<SimpleString, PersistedRoles>();
+
+ private final Map<SimpleString, PersistedAddressSetting> mapPersistedAddressSettings = new ConcurrentHashMap<SimpleString, PersistedAddressSetting>();
public JournalStorageManager(final Configuration config, final ExecutorFactory executorFactory)
{
@@ -690,7 +703,69 @@
getContext(syncNonTransactional));
}
+
+
+ public void storeAddressSetting(PersistedAddressSetting addressSetting) throws Exception
+ {
+ deleteAddressSetting(addressSetting.getAddressMatch());
+ long id = idGenerator.generateID();
+ addressSetting.setStoreId(id);
+ bindingsJournal.appendAddRecord(id, ADDRESS_SETTING_RECORD, addressSetting, true);
+ mapPersistedAddressSettings.put(addressSetting.getAddressMatch(), addressSetting);
+ }
+
+ public List<PersistedAddressSetting> recoverAddressSettings() throws Exception
+ {
+ ArrayList<PersistedAddressSetting> list = new ArrayList<PersistedAddressSetting>(mapPersistedAddressSettings.size());
+ list.addAll(mapPersistedAddressSettings.values());
+ return list;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#recoverPersistedRoles()
+ */
+ public List<PersistedRoles> recoverPersistedRoles() throws Exception
+ {
+ ArrayList<PersistedRoles> list = new ArrayList<PersistedRoles>(mapPersistedRoles.size());
+ list.addAll(mapPersistedRoles.values());
+ return list;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeSecurityRoles(org.hornetq.core.persistconfig.PersistedRoles)
+ */
+ public void storeSecurityRoles(PersistedRoles persistedRoles) throws Exception
+ {
+
+ deleteSecurityRoles(persistedRoles.getAddressMatch());
+ long id = idGenerator.generateID();
+ persistedRoles.setStoreId(id);
+ bindingsJournal.appendAddRecord(id, SECURITY_RECORD, persistedRoles, true);
+ mapPersistedRoles.put(persistedRoles.getAddressMatch(), persistedRoles);
+ }
+
+ public void deleteAddressSetting(SimpleString addressMatch) throws Exception
+ {
+ PersistedAddressSetting oldSetting = mapPersistedAddressSettings.remove(addressMatch);
+ if (oldSetting != null)
+ {
+ bindingsJournal.appendDeleteRecord(oldSetting.getStoreId(), false);
+ }
+
+ }
+
+ public void deleteSecurityRoles(SimpleString addressMatch) throws Exception
+ {
+ PersistedRoles oldRoles = mapPersistedRoles.remove(addressMatch);
+ if (oldRoles != null)
+ {
+ bindingsJournal.appendDeleteRecord(oldRoles.getStoreId(), false);
+ }
+ }
+
+
+
public JournalLoadInformation loadMessageJournal(final PostOffice postOffice,
final PagingManager pagingManager,
final ResourceManager resourceManager,
@@ -1028,6 +1103,20 @@
encoding.setId(id);
groupingInfos.add(encoding);
}
+ else if (rec == JournalStorageManager.ADDRESS_SETTING_RECORD)
+ {
+ PersistedAddressSetting setting = new PersistedAddressSetting();
+ setting.decode(buffer);
+ setting.setStoreId(id);
+ mapPersistedAddressSettings.put(setting.getAddressMatch(), setting);
+ }
+ else if (rec == JournalStorageManager.SECURITY_RECORD)
+ {
+ PersistedRoles roles = new PersistedRoles();
+ roles.decode(buffer);
+ roles.setStoreId(id);
+ mapPersistedRoles.put(roles.getAddressMatch(), roles);
+ }
else
{
throw new IllegalStateException("Invalid record type " + rec);
@@ -2051,5 +2140,4 @@
}
-
}
Modified: trunk/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -13,6 +13,8 @@
package org.hornetq.core.persistence.impl.nullpm;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executor;
@@ -33,6 +35,8 @@
import org.hornetq.core.persistence.OperationContext;
import org.hornetq.core.persistence.QueueBindingInfo;
import org.hornetq.core.persistence.StorageManager;
+import org.hornetq.core.persistence.config.PersistedAddressSetting;
+import org.hornetq.core.persistence.config.PersistedRoles;
import org.hornetq.core.postoffice.Binding;
import org.hornetq.core.postoffice.PostOffice;
import org.hornetq.core.replication.ReplicationManager;
@@ -388,4 +392,48 @@
{
}
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#recoverAddressSettings()
+ */
+ public List<PersistedAddressSetting> recoverAddressSettings() throws Exception
+ {
+ return Collections.emptyList();
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeAddressSetting(org.hornetq.core.persistconfig.PersistedAddressSetting)
+ */
+ public void storeAddressSetting(PersistedAddressSetting addressSetting) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#recoverPersistedRoles()
+ */
+ public List<PersistedRoles> recoverPersistedRoles() throws Exception
+ {
+ return Collections.emptyList();
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeSecurityRoles(org.hornetq.core.persistconfig.PersistedRoles)
+ */
+ public void storeSecurityRoles(PersistedRoles persistedRoles) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteAddressSetting(org.hornetq.api.core.SimpleString)
+ */
+ public void deleteAddressSetting(SimpleString addressMatch) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteSecurityRoles(org.hornetq.api.core.SimpleString)
+ */
+ public void deleteSecurityRoles(SimpleString addressMatch) throws Exception
+ {
+ }
+
}
Modified: trunk/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -76,11 +76,9 @@
private final HornetQServer server;
private Channel channel;
+
+ private Journal[] journals;
- private Journal bindingsJournal;
-
- private Journal messagingJournal;
-
private JournalStorageManager storage;
private PagingManager pageManager;
@@ -101,6 +99,26 @@
}
// Public --------------------------------------------------------
+
+ public void registerJournal(final byte id, final Journal journal)
+ {
+ if (journals == null || id >= journals.length)
+ {
+ Journal[] oldJournals = journals;
+ journals = new Journal[id + 1];
+
+ if (oldJournals != null)
+ {
+ for (int i = 0 ; i < oldJournals.length; i++)
+ {
+ journals[i] = oldJournals[i];
+ }
+ }
+ }
+
+ journals[id] = journal;
+ }
+
/*
* (non-Javadoc)
* @see org.hornetq.core.remoting.ChannelHandler#handlePacket(org.hornetq.core.remoting.Packet)
@@ -194,8 +212,8 @@
server.getManagementService().setStorageManager(storage);
- bindingsJournal = storage.getBindingsJournal();
- messagingJournal = storage.getMessageJournal();
+ registerJournal((byte)1, storage.getMessageJournal());
+ registerJournal((byte)0, storage.getBindingsJournal());
// We only need to load internal structures on the backup...
journalLoadInformation = storage.loadInternalOnly();
@@ -591,16 +609,7 @@
*/
private Journal getJournal(final byte journalID)
{
- Journal journalToUse;
- if (journalID == (byte)0)
- {
- journalToUse = bindingsJournal;
- }
- else
- {
- journalToUse = messagingJournal;
- }
- return journalToUse;
+ return this.journals[journalID];
}
// Inner classes -------------------------------------------------
Modified: trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -62,6 +62,8 @@
import org.hornetq.core.persistence.GroupingInfo;
import org.hornetq.core.persistence.QueueBindingInfo;
import org.hornetq.core.persistence.StorageManager;
+import org.hornetq.core.persistence.config.PersistedAddressSetting;
+import org.hornetq.core.persistence.config.PersistedRoles;
import org.hornetq.core.persistence.impl.journal.JournalStorageManager;
import org.hornetq.core.persistence.impl.nullpm.NullStorageManager;
import org.hornetq.core.postoffice.Binding;
@@ -111,6 +113,7 @@
import org.hornetq.utils.ExecutorFactory;
import org.hornetq.utils.HornetQThreadFactory;
import org.hornetq.utils.OrderedExecutorFactory;
+import org.hornetq.utils.SecurityFormatter;
import org.hornetq.utils.UUID;
import org.hornetq.utils.UUIDGenerator;
import org.hornetq.utils.VersionLoader;
@@ -258,7 +261,7 @@
addressSettingsRepository = new HierarchicalObjectRepository<AddressSettings>();
addressSettingsRepository.setDefault(new AddressSettings());
-
+
securityRepository = new HierarchicalObjectRepository<Set<Role>>();
securityRepository.setDefault(new HashSet<Role>());
@@ -434,9 +437,9 @@
{
memoryManager.stop();
}
-
+
addressSettingsRepository.clear();
-
+
securityRepository.clear();
pagingManager = null;
@@ -554,7 +557,7 @@
final boolean xa,
final SessionCallback callback) throws Exception
{
-
+
if (securityStore != null)
{
securityStore.authenticate(username, password);
@@ -692,7 +695,11 @@
if (queue.getConsumerCount() != 0)
{
- throw new HornetQException(HornetQException.ILLEGAL_STATE, "Cannot delete queue " + queue.getName() + " on binding " + queueName + " - it has consumers = " + binding.getClass().getName());
+ throw new HornetQException(HornetQException.ILLEGAL_STATE, "Cannot delete queue " + queue.getName() +
+ " on binding " +
+ queueName +
+ " - it has consumers = " +
+ binding.getClass().getName());
}
if (session != null)
@@ -975,7 +982,7 @@
configuration.isBackup());
// Address settings need to deployed initially, since they're require on paging manager.start()
-
+
deployAddressSettingsFromConfiguration();
if (configuration.isFileDeploymentEnabled())
@@ -1120,7 +1127,6 @@
}
}
-
private JournalLoadInformation[] loadJournals() throws Exception
{
JournalLoadInformation[] journalInfo = new JournalLoadInformation[2];
@@ -1131,6 +1137,8 @@
journalInfo[0] = storageManager.loadBindingJournal(queueBindingInfos, groupingInfos);
+ recoverStoredConfigs();
+
// Set the node id - must be before we load the queues into the postoffice, but after we load the journal
setNodeID();
@@ -1190,6 +1198,33 @@
return journalInfo;
}
+ /**
+ * @throws Exception
+ */
+ private void recoverStoredConfigs() throws Exception
+ {
+ List<PersistedAddressSetting> adsettings = storageManager.recoverAddressSettings();
+ for (PersistedAddressSetting set : adsettings)
+ {
+ addressSettingsRepository.addMatch(set.getAddressMatch().toString(), set.getSetting());
+ }
+
+ List<PersistedRoles> roles = storageManager.recoverPersistedRoles();
+
+ for (PersistedRoles roleItem : roles)
+ {
+ Set<Role> setRoles = SecurityFormatter.createSecurity(roleItem.getSendRoles(),
+ roleItem.getConsumeRoles(),
+ roleItem.getCreateDurableQueueRoles(),
+ roleItem.getDeleteDurableQueueRoles(),
+ roleItem.getCreateTempQueueRoles(),
+ roleItem.getDeleteTempQueueRoles(),
+ roleItem.getManageRoles());
+
+ securityRepository.addMatch(roleItem.getAddressMatch().toString(), setRoles);
+ }
+ }
+
private void setNodeID() throws Exception
{
if (!configuration.isBackup())
Modified: trunk/src/main/org/hornetq/core/settings/impl/AddressSettings.java
===================================================================
--- trunk/src/main/org/hornetq/core/settings/impl/AddressSettings.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/core/settings/impl/AddressSettings.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -15,9 +15,13 @@
import java.io.Serializable;
+import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.journal.EncodingSupport;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.settings.Mergeable;
+import org.hornetq.utils.BufferHelper;
+import org.hornetq.utils.DataConstants;
/**
* Configuration settings that are applied on the address level
@@ -25,7 +29,7 @@
* @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
* @author <a href="tim.fox(a)jboss.com">Tim Fox</a>
*/
-public class AddressSettings implements Mergeable<AddressSettings>, Serializable
+public class AddressSettings implements Mergeable<AddressSettings>, Serializable, EncodingSupport
{
private static final long serialVersionUID = 1607502280582336366L;
@@ -240,4 +244,250 @@
}
}
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#decode(org.hornetq.api.core.HornetQBuffer)
+ */
+ public void decode(HornetQBuffer buffer)
+ {
+ SimpleString policyStr = buffer.readNullableSimpleString();
+
+ if (policyStr != null)
+ {
+ addressFullMessagePolicy = AddressFullMessagePolicy.valueOf(policyStr.toString());
+ }
+ else
+ {
+ addressFullMessagePolicy = null;
+ }
+
+ maxSizeBytes = BufferHelper.readNullableLong(buffer);
+
+ pageSizeBytes = BufferHelper.readNullableInteger(buffer);
+
+ dropMessagesWhenFull = BufferHelper.readNullableBoolean(buffer);
+
+ maxDeliveryAttempts = BufferHelper.readNullableInteger(buffer);
+
+ messageCounterHistoryDayLimit = BufferHelper.readNullableInteger(buffer);
+
+ redeliveryDelay = BufferHelper.readNullableLong(buffer);
+
+ deadLetterAddress = buffer.readNullableSimpleString();
+
+ expiryAddress = buffer.readNullableSimpleString();
+
+ lastValueQueue = BufferHelper.readNullableBoolean(buffer);
+
+ redeliveryDelay = BufferHelper.readNullableLong(buffer);
+
+ sendToDLAOnNoRoute = BufferHelper.readNullableBoolean(buffer);
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#getEncodeSize()
+ */
+ public int getEncodeSize()
+ {
+
+ return BufferHelper.sizeOfNullableSimpleString(addressFullMessagePolicy != null ? addressFullMessagePolicy.toString()
+ : null) + BufferHelper.sizeOfNullableLong(maxSizeBytes) +
+ BufferHelper.sizeOfNullableInteger(pageSizeBytes) +
+ BufferHelper.sizeOfNullableBoolean(dropMessagesWhenFull) +
+ BufferHelper.sizeOfNullableInteger(maxDeliveryAttempts) +
+ BufferHelper.sizeOfNullableInteger(messageCounterHistoryDayLimit) +
+ BufferHelper.sizeOfNullableLong(redeliveryDelay) +
+ SimpleString.sizeofNullableString(deadLetterAddress) +
+ SimpleString.sizeofNullableString(expiryAddress) +
+ BufferHelper.sizeOfNullableBoolean(lastValueQueue) +
+ BufferHelper.sizeOfNullableLong(redistributionDelay) +
+ BufferHelper.sizeOfNullableBoolean(sendToDLAOnNoRoute);
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#encode(org.hornetq.api.core.HornetQBuffer)
+ */
+ public void encode(HornetQBuffer buffer)
+ {
+ buffer.writeNullableSimpleString(addressFullMessagePolicy != null ? new SimpleString(addressFullMessagePolicy.toString())
+ : null);
+
+ BufferHelper.writeNullableLong(buffer, maxSizeBytes);
+
+ BufferHelper.writeNullableInteger(buffer, pageSizeBytes);
+
+ BufferHelper.writeNullableBoolean(buffer, dropMessagesWhenFull);
+
+ BufferHelper.writeNullableInteger(buffer, maxDeliveryAttempts);
+
+ BufferHelper.writeNullableInteger(buffer, messageCounterHistoryDayLimit);
+
+ BufferHelper.writeNullableLong(buffer, redeliveryDelay);
+
+ buffer.writeNullableSimpleString(deadLetterAddress);
+
+ buffer.writeNullableSimpleString(expiryAddress);
+
+ BufferHelper.writeNullableBoolean(buffer, lastValueQueue);
+
+ BufferHelper.writeNullableLong(buffer, redistributionDelay);
+
+ BufferHelper.writeNullableBoolean(buffer, sendToDLAOnNoRoute);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((addressFullMessagePolicy == null) ? 0 : addressFullMessagePolicy.hashCode());
+ result = prime * result + ((deadLetterAddress == null) ? 0 : deadLetterAddress.hashCode());
+ result = prime * result + ((dropMessagesWhenFull == null) ? 0 : dropMessagesWhenFull.hashCode());
+ result = prime * result + ((expiryAddress == null) ? 0 : expiryAddress.hashCode());
+ result = prime * result + ((lastValueQueue == null) ? 0 : lastValueQueue.hashCode());
+ result = prime * result + ((maxDeliveryAttempts == null) ? 0 : maxDeliveryAttempts.hashCode());
+ result = prime * result + ((maxSizeBytes == null) ? 0 : maxSizeBytes.hashCode());
+ result = prime * result +
+ ((messageCounterHistoryDayLimit == null) ? 0 : messageCounterHistoryDayLimit.hashCode());
+ result = prime * result + ((pageSizeBytes == null) ? 0 : pageSizeBytes.hashCode());
+ result = prime * result + ((redeliveryDelay == null) ? 0 : redeliveryDelay.hashCode());
+ result = prime * result + ((redistributionDelay == null) ? 0 : redistributionDelay.hashCode());
+ result = prime * result + ((sendToDLAOnNoRoute == null) ? 0 : sendToDLAOnNoRoute.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ AddressSettings other = (AddressSettings)obj;
+ if (addressFullMessagePolicy == null)
+ {
+ if (other.addressFullMessagePolicy != null)
+ return false;
+ }
+ else if (!addressFullMessagePolicy.equals(other.addressFullMessagePolicy))
+ return false;
+ if (deadLetterAddress == null)
+ {
+ if (other.deadLetterAddress != null)
+ return false;
+ }
+ else if (!deadLetterAddress.equals(other.deadLetterAddress))
+ return false;
+ if (dropMessagesWhenFull == null)
+ {
+ if (other.dropMessagesWhenFull != null)
+ return false;
+ }
+ else if (!dropMessagesWhenFull.equals(other.dropMessagesWhenFull))
+ return false;
+ if (expiryAddress == null)
+ {
+ if (other.expiryAddress != null)
+ return false;
+ }
+ else if (!expiryAddress.equals(other.expiryAddress))
+ return false;
+ if (lastValueQueue == null)
+ {
+ if (other.lastValueQueue != null)
+ return false;
+ }
+ else if (!lastValueQueue.equals(other.lastValueQueue))
+ return false;
+ if (maxDeliveryAttempts == null)
+ {
+ if (other.maxDeliveryAttempts != null)
+ return false;
+ }
+ else if (!maxDeliveryAttempts.equals(other.maxDeliveryAttempts))
+ return false;
+ if (maxSizeBytes == null)
+ {
+ if (other.maxSizeBytes != null)
+ return false;
+ }
+ else if (!maxSizeBytes.equals(other.maxSizeBytes))
+ return false;
+ if (messageCounterHistoryDayLimit == null)
+ {
+ if (other.messageCounterHistoryDayLimit != null)
+ return false;
+ }
+ else if (!messageCounterHistoryDayLimit.equals(other.messageCounterHistoryDayLimit))
+ return false;
+ if (pageSizeBytes == null)
+ {
+ if (other.pageSizeBytes != null)
+ return false;
+ }
+ else if (!pageSizeBytes.equals(other.pageSizeBytes))
+ return false;
+ if (redeliveryDelay == null)
+ {
+ if (other.redeliveryDelay != null)
+ return false;
+ }
+ else if (!redeliveryDelay.equals(other.redeliveryDelay))
+ return false;
+ if (redistributionDelay == null)
+ {
+ if (other.redistributionDelay != null)
+ return false;
+ }
+ else if (!redistributionDelay.equals(other.redistributionDelay))
+ return false;
+ if (sendToDLAOnNoRoute == null)
+ {
+ if (other.sendToDLAOnNoRoute != null)
+ return false;
+ }
+ else if (!sendToDLAOnNoRoute.equals(other.sendToDLAOnNoRoute))
+ return false;
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ return "AddressSettings [addressFullMessagePolicy=" + addressFullMessagePolicy +
+ ", deadLetterAddress=" +
+ deadLetterAddress +
+ ", dropMessagesWhenFull=" +
+ dropMessagesWhenFull +
+ ", expiryAddress=" +
+ expiryAddress +
+ ", lastValueQueue=" +
+ lastValueQueue +
+ ", maxDeliveryAttempts=" +
+ maxDeliveryAttempts +
+ ", maxSizeBytes=" +
+ maxSizeBytes +
+ ", messageCounterHistoryDayLimit=" +
+ messageCounterHistoryDayLimit +
+ ", pageSizeBytes=" +
+ pageSizeBytes +
+ ", redeliveryDelay=" +
+ redeliveryDelay +
+ ", redistributionDelay=" +
+ redistributionDelay +
+ ", sendToDLAOnNoRoute=" +
+ sendToDLAOnNoRoute +
+ "]";
+ }
+
}
Modified: trunk/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -21,10 +21,10 @@
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.api.core.client.ClientSessionFactory;
-import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.api.jms.management.ConnectionFactoryControl;
import org.hornetq.core.management.impl.MBeanInfoHelper;
+import org.hornetq.jms.client.HornetQConnectionFactory;
+import org.hornetq.jms.server.JMSServerManager;
/**
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
@@ -40,31 +40,31 @@
private final HornetQConnectionFactory cf;
- private final List<String> bindings;
-
private final String name;
+
+ private final JMSServerManager jmsManager;
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
public JMSConnectionFactoryControlImpl(final HornetQConnectionFactory cf,
- final String name,
- final List<String> bindings) throws NotCompliantMBeanException
+ final JMSServerManager jmsManager,
+ final String name) throws NotCompliantMBeanException
{
super(ConnectionFactoryControl.class);
this.cf = cf;
this.name = name;
- this.bindings = bindings;
+ this.jmsManager = jmsManager;
}
// Public --------------------------------------------------------
// ManagedConnectionFactoryMBean implementation ------------------
- public List<String> getBindings()
+ public List<String> getJNDIBindings()
{
- return bindings;
+ return jmsManager.getJNDIOnConnectionFactory(name);
}
public String getClientID()
Modified: trunk/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -13,6 +13,7 @@
package org.hornetq.jms.management.impl;
+import java.util.List;
import java.util.Map;
import javax.management.MBeanInfo;
@@ -30,6 +31,7 @@
import org.hornetq.jms.client.HornetQDestination;
import org.hornetq.jms.client.HornetQMessage;
import org.hornetq.jms.client.SelectorTranslator;
+import org.hornetq.jms.server.JMSServerManager;
import org.hornetq.utils.json.JSONArray;
import org.hornetq.utils.json.JSONObject;
@@ -48,11 +50,11 @@
// Attributes ----------------------------------------------------
private final HornetQDestination managedQueue;
+
+ private final JMSServerManager jmsServerManager;
private final QueueControl coreQueueControl;
- private final String binding;
-
private final MessageCounter counter;
// Static --------------------------------------------------------
@@ -85,13 +87,13 @@
public JMSQueueControlImpl(final HornetQDestination managedQueue,
final QueueControl coreQueueControl,
- final String jndiBinding,
+ final JMSServerManager jmsServerManager,
final MessageCounter counter) throws Exception
{
super(JMSQueueControl.class);
this.managedQueue = managedQueue;
+ this.jmsServerManager = jmsServerManager;
this.coreQueueControl = coreQueueControl;
- binding = jndiBinding;
this.counter = counter;
}
@@ -144,11 +146,6 @@
return coreQueueControl.isDurable();
}
- public String getJNDIBinding()
- {
- return binding;
- }
-
public String getDeadLetterAddress()
{
return coreQueueControl.getDeadLetterAddress();
@@ -169,6 +166,20 @@
coreQueueControl.setExpiryAddress(expiryAddres);
}
+ /* (non-Javadoc)
+ * @see org.hornetq.api.jms.management.JMSQueueControl#addJNDI(java.lang.String)
+ */
+ public void addJNDI(String jndi) throws Exception
+ {
+ jmsServerManager.addQueueToJndi(managedQueue.getName(), jndi);
+ }
+
+ public List<String> getJNDIBindings()
+ {
+ return jmsServerManager.getJNDIOnQueue(managedQueue.getName());
+ }
+
+
public boolean removeMessage(final String messageID) throws Exception
{
String filter = JMSQueueControlImpl.createFilterForJMSMessageID(messageID);
@@ -355,7 +366,7 @@
MBeanInfoHelper.getMBeanOperationsInfo(JMSQueueControl.class),
info.getNotifications());
}
-
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -283,7 +283,7 @@
try
{
- boolean created = server.createQueue(name, jndiBinding, null, true);
+ boolean created = server.createQueue(name, null, true, jndiBinding);
if (created)
{
sendNotification(NotificationType.QUEUE_CREATED, name);
Modified: trunk/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -34,6 +34,7 @@
import org.hornetq.jms.client.HornetQDestination;
import org.hornetq.jms.client.HornetQMessage;
import org.hornetq.jms.client.SelectorTranslator;
+import org.hornetq.jms.server.JMSServerManager;
import org.hornetq.utils.json.JSONArray;
import org.hornetq.utils.json.JSONObject;
@@ -53,11 +54,11 @@
private final HornetQDestination managedTopic;
- private final String binding;
-
private final AddressControl addressControl;
private final ManagementService managementService;
+
+ private final JMSServerManager jmsServerManager;
// Static --------------------------------------------------------
@@ -70,19 +71,33 @@
// Constructors --------------------------------------------------
public JMSTopicControlImpl(final HornetQDestination topic,
+ final JMSServerManager jmsServerManager,
final AddressControl addressControl,
- final String jndiBinding,
final ManagementService managementService) throws Exception
{
super(TopicControl.class);
+ this.jmsServerManager = jmsServerManager;
managedTopic = topic;
this.addressControl = addressControl;
- binding = jndiBinding;
this.managementService = managementService;
}
// TopicControlMBean implementation ------------------------------
+
+ /* (non-Javadoc)
+ * @see org.hornetq.api.jms.management.JMSQueueControl#addJNDI(java.lang.String)
+ */
+ public void addJNDI(String jndi) throws Exception
+ {
+ jmsServerManager.addQueueToJndi(managedTopic.getName(), jndi);
+ }
+
+ public List<String> getJNDIBindings()
+ {
+ return jmsServerManager.getJNDIOnQueue(managedTopic.getName());
+ }
+
public String getName()
{
return managedTopic.getName();
@@ -98,11 +113,6 @@
return managedTopic.getAddress();
}
- public String getJNDIBinding()
- {
- return binding;
- }
-
public int getMessageCount()
{
return getMessageCount(DurabilityType.ALL);
Added: trunk/src/main/org/hornetq/jms/persistence/JMSStorageManager.java
===================================================================
--- trunk/src/main/org/hornetq/jms/persistence/JMSStorageManager.java (rev 0)
+++ trunk/src/main/org/hornetq/jms/persistence/JMSStorageManager.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.jms.persistence;
+
+import java.util.List;
+
+import org.hornetq.core.server.HornetQComponent;
+import org.hornetq.jms.persistence.config.PersistedConnectionFactory;
+import org.hornetq.jms.persistence.config.PersistedDestination;
+import org.hornetq.jms.persistence.config.PersistedJNDI;
+import org.hornetq.jms.persistence.config.PersistedType;
+
+/**
+ * A JMSPersistence
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public interface JMSStorageManager extends HornetQComponent
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ void storeDestination(PersistedDestination destination) throws Exception;
+
+ void deleteDestination(PersistedType type, String name) throws Exception;
+
+ List<PersistedDestination> recoverDestinations();
+
+ void deleteConnectionFactory(String connectionFactory) throws Exception;
+
+ void storeConnectionFactory(PersistedConnectionFactory connectionFactory) throws Exception;
+
+ List<PersistedConnectionFactory> recoverConnectionFactories();
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+ void addJNDI(PersistedType type, String name, String address) throws Exception;
+
+ List<PersistedJNDI> recoverPersistedJNDI() throws Exception;
+
+ void deleteJNDI(PersistedType type, String name, String address) throws Exception;
+
+ void deleteJNDI(PersistedType type, String name) throws Exception;
+}
Added: trunk/src/main/org/hornetq/jms/persistence/config/PersistedConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/persistence/config/PersistedConnectionFactory.java (rev 0)
+++ trunk/src/main/org/hornetq/jms/persistence/config/PersistedConnectionFactory.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.jms.persistence.config;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.journal.EncodingSupport;
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
+
+/**
+ * A PersistedConnectionFactory
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class PersistedConnectionFactory implements EncodingSupport
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long id;
+
+ private ConnectionFactoryConfiguration config;
+
+ public PersistedConnectionFactory()
+ {
+ super();
+ }
+
+ /**
+ * @param id
+ * @param config
+ */
+ public PersistedConnectionFactory(final ConnectionFactoryConfiguration config)
+ {
+ super();
+ this.config = config;
+ }
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ /**
+ * @return the id
+ */
+ public long getId()
+ {
+ return id;
+ }
+
+ public void setId(final long id)
+ {
+ this.id = id;
+ }
+
+ public String getName()
+ {
+ return config.getName();
+ }
+
+ /**
+ * @return the config
+ */
+ public ConnectionFactoryConfiguration getConfig()
+ {
+ return config;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#decode(org.hornetq.api.core.HornetQBuffer)
+ */
+ public void decode(final HornetQBuffer buffer)
+ {
+ config = new ConnectionFactoryConfigurationImpl();
+ config.decode(buffer);
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#encode(org.hornetq.api.core.HornetQBuffer)
+ */
+ public void encode(final HornetQBuffer buffer)
+ {
+ config.encode(buffer);
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#getEncodeSize()
+ */
+ public int getEncodeSize()
+ {
+ return config.getEncodeSize();
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: trunk/src/main/org/hornetq/jms/persistence/config/PersistedDestination.java
===================================================================
--- trunk/src/main/org/hornetq/jms/persistence/config/PersistedDestination.java (rev 0)
+++ trunk/src/main/org/hornetq/jms/persistence/config/PersistedDestination.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.jms.persistence.config;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.journal.EncodingSupport;
+import org.hornetq.utils.BufferHelper;
+import org.hornetq.utils.DataConstants;
+
+/**
+ * A PersistedDestination
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ */
+public class PersistedDestination implements EncodingSupport
+{
+
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long id;
+
+ private PersistedType type;
+
+ private String name;
+
+ private String selector;
+
+ private boolean durable;
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public PersistedDestination()
+ {
+ }
+
+ public PersistedDestination(final PersistedType type, final String name)
+ {
+ this(type, name, null, true);
+ }
+
+ public PersistedDestination(final PersistedType type, final String name, final String selector, final boolean durable)
+ {
+ this.type = type;
+ this.name = name;
+ this.selector = selector;
+ this.durable = durable;
+ }
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+
+ public long getId()
+ {
+ return id;
+ }
+
+ public void setId(final long id)
+ {
+ this.id = id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public PersistedType getType()
+ {
+ return type;
+ }
+
+ public String getSelector()
+ {
+ return selector;
+ }
+
+ public boolean isDurable()
+ {
+ return durable;
+ }
+
+ public int getEncodeSize()
+ {
+ return DataConstants.SIZE_BYTE +
+ BufferHelper.sizeOfSimpleString(name) +
+ BufferHelper.sizeOfNullableSimpleString(selector) +
+ DataConstants.SIZE_BOOLEAN;
+ }
+
+ public void encode(final HornetQBuffer buffer)
+ {
+ buffer.writeByte(type.getType());
+ buffer.writeString(name);
+ buffer.writeNullableString(selector);
+ buffer.writeBoolean(durable);
+ }
+
+ public void decode(final HornetQBuffer buffer)
+ {
+ type = PersistedType.getType(buffer.readByte());
+ name = buffer.readString();
+ selector = buffer.readNullableString();
+ durable = buffer.readBoolean();
+ }
+}
Added: trunk/src/main/org/hornetq/jms/persistence/config/PersistedJNDI.java
===================================================================
--- trunk/src/main/org/hornetq/jms/persistence/config/PersistedJNDI.java (rev 0)
+++ trunk/src/main/org/hornetq/jms/persistence/config/PersistedJNDI.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.jms.persistence.config;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.journal.EncodingSupport;
+import org.hornetq.utils.BufferHelper;
+import org.hornetq.utils.DataConstants;
+
+/**
+ * A PersistedJNDI
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class PersistedJNDI implements EncodingSupport
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long id;
+
+ private PersistedType type;
+
+ private String name;
+
+ private ArrayList<String> jndi = new ArrayList<String>();
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public PersistedJNDI()
+ {
+ }
+
+ /**
+ * @param type
+ * @param name
+ */
+ public PersistedJNDI(PersistedType type, String name)
+ {
+ super();
+ this.type = type;
+ this.name = name;
+ }
+
+ // Public --------------------------------------------------------
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#decode(org.hornetq.api.core.HornetQBuffer)
+ */
+ public void decode(HornetQBuffer buffer)
+ {
+ type = PersistedType.getType(buffer.readByte());
+ name = buffer.readSimpleString().toString();
+ int jndiArraySize = buffer.readInt();
+ jndi = new ArrayList<String>(jndiArraySize);
+
+ for (int i = 0 ; i < jndiArraySize; i++)
+ {
+ jndi.add(buffer.readSimpleString().toString());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#encode(org.hornetq.api.core.HornetQBuffer)
+ */
+ public void encode(HornetQBuffer buffer)
+ {
+ buffer.writeByte(type.getType());
+ BufferHelper.writeAsSimpleString(buffer, name);
+ buffer.writeInt(jndi.size());
+ for (String jndiEl : jndi)
+ {
+ BufferHelper.writeAsSimpleString(buffer, jndiEl);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#getEncodeSize()
+ */
+ public int getEncodeSize()
+ {
+ return DataConstants.SIZE_BYTE +
+ BufferHelper.sizeOfSimpleString(name) +
+ sizeOfJNDI();
+ }
+
+ private int sizeOfJNDI()
+ {
+ int size = DataConstants.SIZE_INT; // for the number of elements written
+
+ for (String str : jndi)
+ {
+ size += BufferHelper.sizeOfSimpleString(str);
+ }
+
+ return size;
+ }
+
+ /**
+ * @return the id
+ */
+ public long getId()
+ {
+ return id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(long id)
+ {
+ this.id = id;
+ }
+
+ /**
+ * @return the type
+ */
+ public PersistedType getType()
+ {
+ return type;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * @return the jndi
+ */
+ public List<String> getJndi()
+ {
+ return jndi;
+ }
+
+ public void addJNDI(String address)
+ {
+ jndi.add(address);
+ }
+
+ public void deleteJNDI(String address)
+ {
+ jndi.remove(address);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: trunk/src/main/org/hornetq/jms/persistence/config/PersistedType.java
===================================================================
--- trunk/src/main/org/hornetq/jms/persistence/config/PersistedType.java (rev 0)
+++ trunk/src/main/org/hornetq/jms/persistence/config/PersistedType.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.jms.persistence.config;
+
+/**
+ * A PersistedType
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public enum PersistedType
+{
+ ConnectionFactory, Topic, Queue;
+
+ public byte getType()
+ {
+ switch (this)
+ {
+ case ConnectionFactory: return 0;
+ case Topic: return 1;
+ case Queue: return 2;
+ default: return -1;
+ }
+ }
+
+ public static PersistedType getType(byte type)
+ {
+ switch (type)
+ {
+ case 0: return ConnectionFactory;
+ case 1: return Topic;
+ case 2: return Queue;
+ default: return null;
+ }
+ }
+}
Added: trunk/src/main/org/hornetq/jms/persistence/impl/journal/JournalJMSStorageManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/persistence/impl/journal/JournalJMSStorageManagerImpl.java (rev 0)
+++ trunk/src/main/org/hornetq/jms/persistence/impl/journal/JournalJMSStorageManagerImpl.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -0,0 +1,385 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.jms.persistence.impl.journal;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQBuffers;
+import org.hornetq.api.core.Pair;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.journal.Journal;
+import org.hornetq.core.journal.PreparedTransactionInfo;
+import org.hornetq.core.journal.RecordInfo;
+import org.hornetq.core.journal.SequentialFileFactory;
+import org.hornetq.core.journal.impl.JournalImpl;
+import org.hornetq.core.journal.impl.NIOSequentialFileFactory;
+import org.hornetq.core.replication.ReplicationManager;
+import org.hornetq.core.replication.impl.ReplicatedJournal;
+import org.hornetq.core.server.JournalType;
+import org.hornetq.jms.persistence.JMSStorageManager;
+import org.hornetq.jms.persistence.config.PersistedConnectionFactory;
+import org.hornetq.jms.persistence.config.PersistedDestination;
+import org.hornetq.jms.persistence.config.PersistedJNDI;
+import org.hornetq.jms.persistence.config.PersistedType;
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.hornetq.utils.IDGenerator;
+
+/**
+ * A JournalJMSStorageManagerImpl
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class JournalJMSStorageManagerImpl implements JMSStorageManager
+{
+
+ // Constants -----------------------------------------------------
+
+ private final byte CF_RECORD = 1;
+
+ private final byte DESTINATION_RECORD = 2;
+
+ private final byte JNDI_RECORD = 3;
+
+ // Attributes ----------------------------------------------------
+
+ private final IDGenerator idGenerator;
+
+ private final String bindingsDir;
+
+ private final boolean createBindingsDir;
+
+ private final Journal jmsJournal;
+
+ private volatile boolean started;
+
+ private Map<String, PersistedConnectionFactory> mapFactories = new ConcurrentHashMap<String, PersistedConnectionFactory>();
+
+ private Map<Pair<PersistedType, String>, PersistedDestination> destinations = new ConcurrentHashMap<Pair<PersistedType, String>, PersistedDestination>();
+
+ private Map<Pair<PersistedType, String>, PersistedJNDI> mapJNDI = new ConcurrentHashMap<Pair<PersistedType, String>, PersistedJNDI>();
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+ public JournalJMSStorageManagerImpl(final IDGenerator idGenerator,
+ final Configuration config,
+ final ReplicationManager replicator)
+ {
+ if (config.getJournalType() != JournalType.NIO && config.getJournalType() != JournalType.ASYNCIO)
+ {
+ throw new IllegalArgumentException("Only NIO and AsyncIO are supported journals");
+ }
+
+ bindingsDir = config.getBindingsDirectory();
+
+ if (bindingsDir == null)
+ {
+ throw new NullPointerException("bindings-dir is null");
+ }
+
+ createBindingsDir = config.isCreateBindingsDir();
+
+ SequentialFileFactory bindingsJMS = new NIOSequentialFileFactory(bindingsDir);
+
+ Journal localJMS = new JournalImpl(1024 * 1024,
+ 2,
+ config.getJournalCompactMinFiles(),
+ config.getJournalCompactPercentage(),
+ bindingsJMS,
+ "hornetq-jms-config",
+ "jms",
+ 1);
+
+ if (replicator != null)
+ {
+ jmsJournal = new ReplicatedJournal((byte)2, localJMS, replicator);
+ }
+ else
+ {
+ jmsJournal = localJMS;
+ }
+
+ this.idGenerator = idGenerator;
+ }
+
+
+ // Public --------------------------------------------------------
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#recoverConnectionFactories()
+ */
+ public List<PersistedConnectionFactory> recoverConnectionFactories()
+ {
+ List<PersistedConnectionFactory> cfs = new ArrayList<PersistedConnectionFactory>(mapFactories.size());
+ cfs.addAll(mapFactories.values());
+ return cfs;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#storeConnectionFactory(org.hornetq.jms.persistence.PersistedConnectionFactory)
+ */
+ public void storeConnectionFactory(final PersistedConnectionFactory connectionFactory) throws Exception
+ {
+ deleteConnectionFactory(connectionFactory.getName());
+ long id = idGenerator.generateID();
+ connectionFactory.setId(id);
+ jmsJournal.appendAddRecord(id, CF_RECORD, connectionFactory, true);
+ mapFactories.put(connectionFactory.getName(), connectionFactory);
+ }
+
+ public void deleteConnectionFactory(final String cfName) throws Exception
+ {
+ PersistedConnectionFactory oldCF = mapFactories.remove(cfName);
+ if (oldCF != null)
+ {
+ jmsJournal.appendDeleteRecord(oldCF.getId(), false);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#recoverDestinations()
+ */
+ public List<PersistedDestination> recoverDestinations()
+ {
+ List<PersistedDestination> destinations = new ArrayList<PersistedDestination>(this.destinations.size());
+ destinations.addAll(this.destinations.values());
+ return destinations;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#storeDestination(org.hornetq.jms.persistence.PersistedDestination)
+ */
+ public void storeDestination(final PersistedDestination destination) throws Exception
+ {
+ deleteDestination(destination.getType(), destination.getName());
+ long id = idGenerator.generateID();
+ destination.setId(id);
+ jmsJournal.appendAddRecord(id, DESTINATION_RECORD, destination, true);
+ destinations.put(new Pair<PersistedType, String>(destination.getType(), destination.getName()), destination);
+ }
+
+ public List<PersistedJNDI> recoverPersistedJNDI() throws Exception
+ {
+ ArrayList<PersistedJNDI> list = new ArrayList<PersistedJNDI>();
+
+ list.addAll(mapJNDI.values());
+
+ return list;
+ }
+
+ public void addJNDI(PersistedType type, String name, String address) throws Exception
+ {
+ Pair<PersistedType, String> key = new Pair<PersistedType, String>(type, name);
+
+ long tx = idGenerator.generateID();
+
+ PersistedJNDI currentJNDI = mapJNDI.get(key);
+ if (currentJNDI != null)
+ {
+ jmsJournal.appendDeleteRecordTransactional(tx, currentJNDI.getId());
+ }
+ else
+ {
+ currentJNDI = new PersistedJNDI(type, name);
+ }
+
+ currentJNDI.addJNDI(address);
+
+ long newId = idGenerator.generateID();
+
+ currentJNDI.setId(newId);
+
+ jmsJournal.appendAddRecordTransactional(tx, newId, JNDI_RECORD, currentJNDI);
+
+ jmsJournal.appendCommitRecord(tx, true);
+ }
+
+ public void deleteJNDI(PersistedType type, String name, String address) throws Exception
+ {
+ Pair<PersistedType, String> key = new Pair<PersistedType, String>(type, name);
+
+ long tx = idGenerator.generateID();
+
+ PersistedJNDI currentJNDI = mapJNDI.get(key);
+ if (currentJNDI == null)
+ {
+ return;
+ }
+ else
+ {
+ jmsJournal.appendDeleteRecordTransactional(tx, currentJNDI.getId());
+ }
+
+ currentJNDI.deleteJNDI(address);
+
+ if (currentJNDI.getJndi().size() == 0)
+ {
+ mapJNDI.remove(key);
+ }
+ else
+ {
+ long newId = idGenerator.generateID();
+ currentJNDI.setId(newId);
+ jmsJournal.appendAddRecordTransactional(tx, newId, JNDI_RECORD, currentJNDI);
+ }
+
+ jmsJournal.appendCommitRecord(tx, true);
+ }
+
+
+ public void deleteJNDI(PersistedType type, String name) throws Exception
+ {
+ Pair<PersistedType, String> key = new Pair<PersistedType, String>(type, name);
+
+ PersistedJNDI currentJNDI = mapJNDI.remove(key);
+
+ if (currentJNDI == null)
+ {
+ return;
+ }
+ else
+ {
+ jmsJournal.appendDeleteRecord(currentJNDI.getId(), true);
+ }
+ }
+
+ public void deleteDestination(final PersistedType type, final String name) throws Exception
+ {
+ PersistedDestination destination = destinations.get(new Pair<PersistedType, String>(type, name));
+ if(destination != null)
+ {
+ jmsJournal.appendDeleteRecord(destination.getId(), false);
+ }
+ deleteJNDI(type, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.HornetQComponent#isStarted()
+ */
+ public boolean isStarted()
+ {
+ return started;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.HornetQComponent#start()
+ */
+ public void start() throws Exception
+ {
+
+ checkAndCreateDir(bindingsDir, createBindingsDir);
+
+ jmsJournal.start();
+
+ load();
+
+ started = true;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.HornetQComponent#stop()
+ */
+ public void stop() throws Exception
+ {
+ jmsJournal.stop();
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ private void load() throws Exception
+ {
+ mapFactories.clear();
+
+ List<RecordInfo> data = new ArrayList<RecordInfo>();
+
+ ArrayList<PreparedTransactionInfo> list = new ArrayList<PreparedTransactionInfo>();
+
+ jmsJournal.load(data, list, null);
+
+ for (RecordInfo record : data)
+ {
+ long id = record.id;
+
+ HornetQBuffer buffer = HornetQBuffers.wrappedBuffer(record.data);
+
+ byte rec = record.getUserRecordType();
+
+ if (rec == CF_RECORD)
+ {
+ PersistedConnectionFactory cf = new PersistedConnectionFactory();
+ cf.decode(buffer);
+ cf.setId(id);
+ mapFactories.put(cf.getName(), cf);
+ }
+ else if(rec == DESTINATION_RECORD)
+ {
+ PersistedDestination destination = new PersistedDestination();
+ destination.decode(buffer);
+ destination.setId(id);
+ destinations.put(new Pair<PersistedType, String>(destination.getType(), destination.getName()), destination);
+ }
+ else if (rec == JNDI_RECORD)
+ {
+ PersistedJNDI jndi = new PersistedJNDI();
+ jndi.decode(buffer);
+ jndi.setId(id);
+ Pair<PersistedType, String> key = new Pair<PersistedType, String>(jndi.getType(), jndi.getName());
+ mapJNDI.put(key, jndi);
+ }
+ else
+ {
+ throw new IllegalStateException("Invalid record type " + rec);
+ }
+
+ }
+
+ }
+
+ private void checkAndCreateDir(final String dir, final boolean create)
+ {
+ File f = new File(dir);
+
+ if (!f.exists())
+ {
+ if (create)
+ {
+ if (!f.mkdirs())
+ {
+ throw new IllegalStateException("Failed to create directory " + dir);
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException("Directory " + dir + " does not exist and will not create it");
+ }
+ }
+ }
+
+
+ // Inner classes -------------------------------------------------
+
+}
Added: trunk/src/main/org/hornetq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java (rev 0)
+++ trunk/src/main/org/hornetq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.jms.persistence.impl.nullpm;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.hornetq.jms.persistence.JMSStorageManager;
+import org.hornetq.jms.persistence.config.PersistedConnectionFactory;
+import org.hornetq.jms.persistence.config.PersistedDestination;
+import org.hornetq.jms.persistence.config.PersistedJNDI;
+import org.hornetq.jms.persistence.config.PersistedType;
+
+/**
+ * A NullJMSStorageManagerImpl
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class NullJMSStorageManagerImpl implements JMSStorageManager
+{
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#deleteConnectionFactory(java.lang.String)
+ */
+ public void deleteConnectionFactory(String connectionFactory) throws Exception
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#recoverConnectionFactories()
+ */
+ public List<PersistedConnectionFactory> recoverConnectionFactories()
+ {
+ return Collections.emptyList();
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#recoverDestinations()
+ */
+ public List<PersistedDestination> recoverDestinations()
+ {
+ return Collections.emptyList();
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#storeConnectionFactory(org.hornetq.jms.persistence.PersistedConnectionFactory)
+ */
+ public void storeConnectionFactory(PersistedConnectionFactory connectionFactory) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#storeDestination(org.hornetq.jms.persistence.PersistedDestination)
+ */
+ public void storeDestination(PersistedDestination destination)
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#deleteDestination (org.hornetq.jms.persistence.PersistedDestination)
+ */
+ public void deleteDestination(String name) throws Exception
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.HornetQComponent#isStarted()
+ */
+ public boolean isStarted()
+ {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.HornetQComponent#start()
+ */
+ public void start() throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.HornetQComponent#stop()
+ */
+ public void stop() throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#addJNDI(org.hornetq.jms.persistence.PersistedType, java.lang.String, java.lang.String)
+ */
+ public void addJNDI(PersistedType type, String name, String address) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#deleteJNDI(org.hornetq.jms.persistence.PersistedType, java.lang.String, java.lang.String)
+ */
+ public void deleteJNDI(PersistedType type, String name, String address) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#deleteDestination(org.hornetq.jms.persistence.PersistedType, java.lang.String)
+ */
+ public void deleteDestination(PersistedType type, String name) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#deleteJNDI(org.hornetq.jms.persistence.PersistedType, java.lang.String)
+ */
+ public void deleteJNDI(PersistedType type, String name) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#recoverPersistedJNDI()
+ */
+ public List<PersistedJNDI> recoverPersistedJNDI() throws Exception
+ {
+ return Collections.emptyList();
+ }
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: trunk/src/main/org/hornetq/jms/server/JMSServerManager.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/JMSServerManager.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/jms/server/JMSServerManager.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -49,8 +49,6 @@
*
* @param queueName
* The name of the queue to create
- * @param jndiBinding
- * the name of the binding for JNDI
* @param selectorString
* @param durable
* @return true if the queue is created or if it existed and was added to
@@ -58,7 +56,9 @@
* @throws Exception
* if problems were encountered creating the queue.
*/
- boolean createQueue(String queueName, String jndiBinding, String selectorString, boolean durable) throws Exception;
+ boolean createQueue(String queueName, String selectorString, boolean durable, String ...jndi) throws Exception;
+
+ boolean addQueueToJndi(final String queueName, final String jndiBinding) throws Exception;
/**
* Creates a JMS Topic
@@ -72,10 +72,10 @@
* @throws Exception
* if a problem occurred creating the topic
*/
- boolean createTopic(String topicName, String jndiBinding) throws Exception;
+ boolean createTopic(String topicName, String ... jndi) throws Exception;
/**
- * Remove the destination from JNDI.
+ * Remove the topic from JNDI.
* Calling this method does <em>not</em> destroy the destination.
*
* @param name
@@ -84,9 +84,45 @@
* @throws Exception
* if a problem occurred removing the destination
*/
- boolean undeployDestination(String name) throws Exception;
+ boolean removeTopicFromJNDI(String name, String jndi) throws Exception;
/**
+ * Remove the topic from JNDI.
+ * Calling this method does <em>not</em> destroy the destination.
+ *
+ * @param name
+ * the name of the destination to remove from JNDI
+ * @return true if removed
+ * @throws Exception
+ * if a problem occurred removing the destination
+ */
+ boolean removeTopicFromJNDI(String name) throws Exception;
+
+ /**
+ * Remove the queue from JNDI.
+ * Calling this method does <em>not</em> destroy the destination.
+ *
+ * @param name
+ * the name of the destination to remove from JNDI
+ * @return true if removed
+ * @throws Exception
+ * if a problem occurred removing the destination
+ */
+ boolean removeQueueFromJNDI(String name, String jndi) throws Exception;
+
+ /**
+ * Remove the queue from JNDI.
+ * Calling this method does <em>not</em> destroy the destination.
+ *
+ * @param name
+ * the name of the destination to remove from JNDI
+ * @return true if removed
+ * @throws Exception
+ * if a problem occurred removing the destination
+ */
+ boolean removeQueueFromJNDI(String name) throws Exception;
+
+ /**
* destroys a queue and removes it from JNDI
*
* @param name
@@ -96,6 +132,12 @@
* if a problem occurred destroying the queue
*/
boolean destroyQueue(String name) throws Exception;
+
+ List<String> getJNDIOnQueue(String queue);
+
+ List<String> getJNDIOnTopic(String topic);
+
+ List<String> getJNDIOnConnectionFactory(String factoryName);
/**
* destroys a topic and removes it from JNDI
Modified: trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -17,6 +17,7 @@
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.core.journal.EncodingSupport;
import org.hornetq.jms.server.JMSServerManager;
/**
@@ -26,7 +27,7 @@
*
*
*/
-public interface ConnectionFactoryConfiguration
+public interface ConnectionFactoryConfiguration extends EncodingSupport
{
String getName();
Modified: trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -14,12 +14,16 @@
package org.hornetq.jms.server.config.impl;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
+import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.hornetq.utils.BufferHelper;
+import org.hornetq.utils.DataConstants;
/**
* A ConnectionFactoryConfigurationImpl
@@ -34,10 +38,10 @@
// Attributes ----------------------------------------------------
- private final String[] bindings;
+ private String name;
- private final String name;
-
+ private String[] bindings;
+
private String discoveryGroupName;
private String discoveryAddress;
@@ -45,7 +49,7 @@
private int discoveryPort;
private List<Pair<String, String>> connectorNames;
-
+
private List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs;
private String clientID = null;
@@ -112,6 +116,11 @@
// Constructors --------------------------------------------------
+ /** To be used on persistence only */
+ public ConnectionFactoryConfigurationImpl()
+ {
+ }
+
public ConnectionFactoryConfigurationImpl(final String name,
final String discoveryAddress,
final int discoveryPort,
@@ -527,9 +536,306 @@
public void setDiscoveryGroupName(String groupName)
{
this.discoveryGroupName = groupName;
+
+ }
+
+ // Encoding Support Implementation --------------------------------------------------------------
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#decode(org.hornetq.api.core.HornetQBuffer)
+ */
+ public void decode(HornetQBuffer buffer)
+ {
+ name = buffer.readSimpleString().toString();
+
+ int nbindings = buffer.readInt();
+
+ bindings = new String[nbindings];
+
+ for (int i = 0; i < nbindings; i++)
+ {
+ bindings[i] = buffer.readSimpleString().toString();
+ }
+
+ discoveryGroupName = BufferHelper.readNullableSimpleStringAsString(buffer);
+
+ discoveryAddress = BufferHelper.readNullableSimpleStringAsString(buffer);
+
+ discoveryPort = buffer.readInt();
+
+ int nConnectors = buffer.readInt();
+
+ connectorNames = new ArrayList<Pair<String, String>>(nConnectors);
+
+ for (int i = 0; i < nConnectors; i++)
+ {
+ String a = BufferHelper.readNullableSimpleStringAsString(buffer);
+
+ String b = BufferHelper.readNullableSimpleStringAsString(buffer);
+
+ connectorNames.add(new Pair<String, String>(a, b));
+ }
+
+ clientID = BufferHelper.readNullableSimpleStringAsString(buffer);
+
+ discoveryRefreshTimeout = buffer.readLong();
+
+ clientFailureCheckPeriod = buffer.readLong();
+
+ connectionTTL = buffer.readLong();
+
+ callTimeout = buffer.readLong();
+
+ cacheLargeMessagesClient = buffer.readBoolean();
+
+ minLargeMessageSize = buffer.readInt();
+
+ consumerWindowSize = buffer.readInt();
+
+ consumerMaxRate = buffer.readInt();
+
+ confirmationWindowSize = buffer.readInt();
+
+ producerWindowSize = buffer.readInt();
+
+ producerMaxRate = buffer.readInt();
+
+ blockOnAcknowledge = buffer.readBoolean();
+
+ blockOnDurableSend = buffer.readBoolean();
+
+ blockOnNonDurableSend = buffer.readBoolean();
+
+ autoGroup = buffer.readBoolean();
+
+ preAcknowledge = buffer.readBoolean();
+
+ loadBalancingPolicyClassName = buffer.readSimpleString().toString();
+
+ transactionBatchSize = buffer.readInt();
+
+ dupsOKBatchSize = buffer.readInt();
+
+ initialWaitTimeout = buffer.readLong();
+
+ useGlobalPools = buffer.readBoolean();
+
+ scheduledThreadPoolMaxSize = buffer.readInt();
+
+ threadPoolMaxSize = buffer.readInt();
+
+ retryInterval = buffer.readLong();
+
+ retryIntervalMultiplier = buffer.readDouble();
+
+ maxRetryInterval = buffer.readLong();
+
+ reconnectAttempts = buffer.readInt();
+
+ failoverOnServerShutdown = buffer.readBoolean();
+
+ groupID = BufferHelper.readNullableSimpleStringAsString(buffer);
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#encode(org.hornetq.api.core.HornetQBuffer)
+ */
+ public void encode(HornetQBuffer buffer)
+ {
+ BufferHelper.writeAsSimpleString(buffer, name);
+
+ buffer.writeInt(bindings.length);
+
+ for (String str : bindings)
+ {
+ BufferHelper.writeAsSimpleString(buffer, str);
+ }
+
+ BufferHelper.writeAsNullableSimpleString(buffer, discoveryGroupName);
+
+ BufferHelper.writeAsNullableSimpleString(buffer, discoveryAddress);
+
+ buffer.writeInt(discoveryPort);
+
+ buffer.writeInt(connectorNames == null ? 0 : connectorNames.size());
+
+ if (connectorNames != null)
+ {
+ for (Pair<String, String> namePair : connectorNames)
+ {
+ BufferHelper.writeAsNullableSimpleString(buffer, namePair.a);
+ BufferHelper.writeAsNullableSimpleString(buffer, namePair.b);
+ }
+ }
+
+ BufferHelper.writeAsNullableSimpleString(buffer, clientID);
+
+ buffer.writeLong(discoveryRefreshTimeout);
+
+ buffer.writeLong(clientFailureCheckPeriod);
+
+ buffer.writeLong(connectionTTL);
+
+ buffer.writeLong(callTimeout);
+
+ buffer.writeBoolean(cacheLargeMessagesClient);
+
+ buffer.writeInt(minLargeMessageSize);
+
+ buffer.writeInt(consumerWindowSize);
+
+ buffer.writeInt(consumerMaxRate);
+
+ buffer.writeInt(confirmationWindowSize);
+
+ buffer.writeInt(producerWindowSize);
+
+ buffer.writeInt(producerMaxRate);
+
+ buffer.writeBoolean(blockOnAcknowledge);
+
+ buffer.writeBoolean(blockOnDurableSend);
+
+ buffer.writeBoolean(blockOnNonDurableSend);
+
+ buffer.writeBoolean(autoGroup);
+
+ buffer.writeBoolean(preAcknowledge);
+
+ BufferHelper.writeAsSimpleString(buffer, loadBalancingPolicyClassName);
+
+ buffer.writeInt(transactionBatchSize);
+
+ buffer.writeInt(dupsOKBatchSize);
+
+ buffer.writeLong(initialWaitTimeout);
+
+ buffer.writeBoolean(useGlobalPools);
+
+ buffer.writeInt(scheduledThreadPoolMaxSize);
+
+ buffer.writeInt(threadPoolMaxSize);
+
+ buffer.writeLong(retryInterval);
+
+ buffer.writeDouble(retryIntervalMultiplier);
+
+ buffer.writeLong(maxRetryInterval);
+
+ buffer.writeInt(reconnectAttempts);
+
+ buffer.writeBoolean(failoverOnServerShutdown);
+
+ BufferHelper.writeAsNullableSimpleString(buffer, groupID);
+ }
+
+ private int sizeOfBindings()
+ {
+ int size = DataConstants.SIZE_INT; // for the number of bindings persisted
+
+ for (String str : bindings)
+ {
+ size += BufferHelper.sizeOfSimpleString(str);
+ }
+
+ return size;
+
+ }
+
+ private int sizeOfConnectors()
+ {
+ int size = DataConstants.SIZE_INT; // for the number of connectors persisted
+
+ if (connectorNames != null)
+ {
+ for (Pair<String, String> pair : connectorNames)
+ {
+ size += BufferHelper.sizeOfNullableSimpleString(pair.a);
+ size += BufferHelper.sizeOfNullableSimpleString(pair.b);
+ }
+ }
+
+ return size;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#getEncodeSize()
+ */
+ public int getEncodeSize()
+ {
+ return BufferHelper.sizeOfSimpleString(name) +
+ sizeOfBindings() +
+
+ BufferHelper.sizeOfNullableSimpleString(discoveryGroupName) +
+
+ BufferHelper.sizeOfNullableSimpleString(discoveryAddress)+
+
+ DataConstants.SIZE_INT + // discoveryPort
+
+ sizeOfConnectors() +
+
+ BufferHelper.sizeOfNullableSimpleString(clientID) +
+
+ DataConstants.SIZE_LONG + // discoveryRefreshTimeout
+
+ DataConstants.SIZE_LONG + // clientFailureCheckPeriod
+
+ DataConstants.SIZE_LONG + // connectionTTL
+
+ DataConstants.SIZE_LONG + // callTimeout
+
+ DataConstants.SIZE_BOOLEAN + // cacheLargeMessagesClient
+
+ DataConstants.SIZE_INT + // minLargeMessageSize
+
+ DataConstants.SIZE_INT + // consumerWindowSize
+
+ DataConstants.SIZE_INT + // consumerMaxRate
+
+ DataConstants.SIZE_INT + // confirmationWindowSize
+
+ DataConstants.SIZE_INT + // producerWindowSize
+
+ DataConstants.SIZE_INT + // producerMaxRate
+
+ DataConstants.SIZE_BOOLEAN + // blockOnAcknowledge
+
+ DataConstants.SIZE_BOOLEAN + // blockOnDurableSend
+
+ DataConstants.SIZE_BOOLEAN + // blockOnNonDurableSend
+
+ DataConstants.SIZE_BOOLEAN + // autoGroup
+
+ DataConstants.SIZE_BOOLEAN + // preAcknowledge
+
+ BufferHelper.sizeOfSimpleString(loadBalancingPolicyClassName) +
+
+ DataConstants.SIZE_INT + // transactionBatchSize
+
+ DataConstants.SIZE_INT + // dupsOKBatchSize
+
+ DataConstants.SIZE_LONG + // initialWaitTimeout
+
+ DataConstants.SIZE_BOOLEAN + // useGlobalPools
+
+ DataConstants.SIZE_INT + // scheduledThreadPoolMaxSize
+
+ DataConstants.SIZE_INT + // threadPoolMaxSize
+
+ DataConstants.SIZE_LONG + // retryInterval
+
+ DataConstants.SIZE_DOUBLE + // retryIntervalMultiplier
+
+ DataConstants.SIZE_LONG + // maxRetryInterval
+
+ DataConstants.SIZE_INT + // reconnectAttempts
+
+ DataConstants.SIZE_BOOLEAN + // failoverOnServerShutdown
+
+ BufferHelper.sizeOfNullableSimpleString(groupID);
}
-
+
// Public --------------------------------------------------------
// Package protected ---------------------------------------------
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -13,8 +13,6 @@
package org.hornetq.jms.server.impl;
-import java.util.ArrayList;
-
import org.hornetq.core.config.Configuration;
import org.hornetq.core.deployers.DeploymentManager;
import org.hornetq.core.deployers.impl.XmlDeployer;
@@ -39,7 +37,7 @@
private final JMSServerConfigParser parser;
- private final JMSServerManager jmsServerControl;
+ private final JMSServerManager jmsServerManager;
protected static final String CONNECTOR_REF_ELEMENT = "connector-ref";
@@ -67,7 +65,7 @@
{
super(deploymentManager);
- jmsServerControl = jmsServerManager;
+ this.jmsServerManager = jmsServerManager;
configuration = config;
@@ -139,17 +137,17 @@
if (node.getNodeName().equals(JMSServerDeployer.CONNECTION_FACTORY_NODE_NAME))
{
String cfName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
- jmsServerControl.destroyConnectionFactory(cfName);
+ jmsServerManager.destroyConnectionFactory(cfName);
}
else if (node.getNodeName().equals(JMSServerDeployer.QUEUE_NODE_NAME))
{
String queueName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
- jmsServerControl.undeployDestination(queueName);
+ jmsServerManager.removeQueueFromJNDI(queueName);
}
else if (node.getNodeName().equals(JMSServerDeployer.TOPIC_NODE_NAME))
{
String topicName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
- jmsServerControl.undeployDestination(topicName);
+ jmsServerManager.removeTopicFromJNDI(topicName);
}
}
@@ -171,7 +169,7 @@
TopicConfiguration topicConfig = parser.parseTopicConfiguration(node);
for (String jndi : topicConfig.getBindings())
{
- jmsServerControl.createTopic(topicConfig.getName(), jndi);
+ jmsServerManager.createTopic(topicConfig.getName(), jndi);
}
}
@@ -182,10 +180,7 @@
private void deployQueue(final Node node) throws Exception
{
JMSQueueConfiguration queueconfig = parser.parseQueueConfiguration(node);
- for (String jndiName : queueconfig.getBindings())
- {
- jmsServerControl.createQueue(queueconfig.getName(), jndiName, queueconfig.getSelector(), queueconfig.isDurable());
- }
+ jmsServerManager.createQueue(queueconfig.getName(), queueconfig.getSelector(), queueconfig.isDurable(), queueconfig.getBindings());
}
/**
@@ -195,7 +190,7 @@
private void deployConnectionFactory(final Node node) throws Exception
{
ConnectionFactoryConfiguration cfConfig = parser.parseConnectionFactoryConfiguration(node);
- jmsServerControl.createConnectionFactory(cfConfig);
+ jmsServerManager.createConnectionFactory(cfConfig);
}
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -42,6 +42,13 @@
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.client.HornetQDestination;
import org.hornetq.jms.client.SelectorTranslator;
+import org.hornetq.jms.persistence.JMSStorageManager;
+import org.hornetq.jms.persistence.config.PersistedConnectionFactory;
+import org.hornetq.jms.persistence.config.PersistedDestination;
+import org.hornetq.jms.persistence.config.PersistedJNDI;
+import org.hornetq.jms.persistence.config.PersistedType;
+import org.hornetq.jms.persistence.impl.journal.JournalJMSStorageManagerImpl;
+import org.hornetq.jms.persistence.impl.nullpm.NullJMSStorageManagerImpl;
import org.hornetq.jms.server.JMSServerManager;
import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
import org.hornetq.jms.server.config.JMSConfiguration;
@@ -49,6 +56,7 @@
import org.hornetq.jms.server.config.TopicConfiguration;
import org.hornetq.jms.server.management.JMSManagementService;
import org.hornetq.jms.server.management.impl.JMSManagementServiceImpl;
+import org.hornetq.utils.TimeAndCounterIDGenerator;
/**
* A Deployer used to create and add to JNDI queues, topics and connection
@@ -77,12 +85,18 @@
*/
private Context context;
- private final Map<String, List<String>> destinations = new HashMap<String, List<String>>();
+ private Map<String, HornetQDestination> queues = new HashMap<String, HornetQDestination>();
+ private Map<String, HornetQDestination> topics = new HashMap<String, HornetQDestination>();
+
private final Map<String, HornetQConnectionFactory> connectionFactories = new HashMap<String, HornetQConnectionFactory>();
- private final Map<String, List<String>> connectionFactoryBindings = new HashMap<String, List<String>>();
+ private final Map<String, List<String>> queueJNDI = new HashMap<String, List<String>>();
+ private final Map<String, List<String>> topicJNDI = new HashMap<String, List<String>>();
+
+ private final Map<String, List<String>> connectionFactoryJNDI = new HashMap<String, List<String>>();
+
private final HornetQServer server;
private JMSManagementService jmsManagementService;
@@ -101,6 +115,10 @@
private JMSConfiguration config;
+ private Configuration coreConfig;
+
+ private JMSStorageManager storage;
+
public JMSServerManagerImpl(final HornetQServer server) throws Exception
{
this.server = server;
@@ -130,12 +148,14 @@
{
active = true;
- jmsManagementService = new JMSManagementServiceImpl(server.getManagementService());
+ jmsManagementService = new JMSManagementServiceImpl(server.getManagementService(), this);
try
{
jmsManagementService.registerJMSServer(this);
+ initJournal();
+
// start the JMS deployer only if the configuration is not done using the JMSConfiguration object
if (config == null)
{
@@ -157,6 +177,7 @@
{
deploy();
}
+
}
catch (Exception e)
{
@@ -204,19 +225,19 @@
deploymentManager.stop();
}
- for (String destination : destinations.keySet())
- {
- undeployDestination(destination);
- }
+ // for (String destination : destinationBindings.keySet())
+ // {
+ // undeployDestination(destination);
+ // }
for (String connectionFactory : new HashSet<String>(connectionFactories.keySet()))
{
destroyConnectionFactory(connectionFactory);
}
- destinations.clear();
+ // destinationBindings.clear();
connectionFactories.clear();
- connectionFactoryBindings.clear();
+ connectionFactoryJNDI.clear();
if (context != null)
{
@@ -278,91 +299,173 @@
return server.getVersion().getFullVersion();
}
- public synchronized boolean createQueue(final String queueName,
- final String jndiBinding,
- final String selectorString,
- final boolean durable) throws Exception
+ public synchronized boolean createQueue(final String queueName, final String selectorString, final boolean durable, final String ... jndi) throws Exception
{
checkInitialised();
- HornetQDestination jBossQueue = HornetQDestination.createQueue(queueName);
- // Convert from JMS selector to core filter
- SimpleString coreFilterString = null;
+ boolean added = internalCreateQueue(queueName, selectorString, durable);
- if (selectorString != null)
+ storage.storeDestination(new PersistedDestination(PersistedType.Queue, queueName, selectorString, durable));
+
+ for (String jndiItem : jndi)
{
- coreFilterString = SimpleString.toSimpleString(SelectorTranslator.convertToHornetQFilterString(selectorString));
+ addQueueToJndi(queueName, jndiItem);
}
- server.deployQueue(jBossQueue.getSimpleAddress(),
- jBossQueue.getSimpleAddress(),
- coreFilterString,
- durable,
- false);
+ return added;
+ }
- boolean added = bindToJndi(jndiBinding, jBossQueue);
+ public synchronized boolean createTopic(final String topicName, final String ... jndi) throws Exception
+ {
+ checkInitialised();
- if (added)
+ boolean added = internalCreateTopic(topicName);
+
+ storage.storeDestination(new PersistedDestination(PersistedType.Topic, topicName));
+
+ for (String jndiItem : jndi)
{
- addToDestinationBindings(queueName, jndiBinding);
+ addTopicToJndi(topicName, jndiItem);
}
- jmsManagementService.registerQueue(jBossQueue, jndiBinding);
return added;
}
- public synchronized boolean createTopic(final String topicName, final String jndiBinding) throws Exception
+ public boolean addTopicToJndi(final String topicName, final String jndiBinding) throws Exception
{
checkInitialised();
- HornetQDestination jBossTopic = HornetQDestination.createTopic(topicName);
- // We create a dummy subscription on the topic, that never receives messages - this is so we can perform JMS
- // checks when routing messages to a topic that
- // does not exist - otherwise we would not be able to distinguish from a non existent topic and one with no
- // subscriptions - core has no notion of a topic
- server.deployQueue(jBossTopic.getSimpleAddress(),
- jBossTopic.getSimpleAddress(),
- SimpleString.toSimpleString(JMSServerManagerImpl.REJECT_FILTER),
- true,
- false);
- boolean added = bindToJndi(jndiBinding, jBossTopic);
+ HornetQDestination destination = topics.get(topicName);
+ if (destination == null)
+ {
+ throw new IllegalArgumentException("Topic does not exist");
+ }
+ if (destination.getTopicName() == null)
+ {
+ throw new IllegalArgumentException(topicName + " is not a topic");
+ }
+ boolean added = bindToJndi(jndiBinding, destination);
+
if (added)
{
- addToDestinationBindings(topicName, jndiBinding);
+ addToBindings(topicJNDI, topicName, jndiBinding);
+ storage.addJNDI(PersistedType.Topic, topicName, jndiBinding);
}
- jmsManagementService.registerTopic(jBossTopic, jndiBinding);
return added;
}
+
+ public List<String> getJNDIOnQueue(String queue)
+ {
+ return getJNDIList(queueJNDI, queue);
+ }
+
+ public List<String> getJNDIOnTopic(String topic)
+ {
+ return getJNDIList(topicJNDI, topic);
+ }
+
+ public List<String> getJNDIOnConnectionFactory(String factoryName)
+ {
+ return getJNDIList(connectionFactoryJNDI, factoryName);
+ }
- public synchronized boolean undeployDestination(final String name) throws Exception
+
+
+ public boolean addQueueToJndi(final String queueName, final String jndiBinding) throws Exception
{
checkInitialised();
- List<String> jndiBindings = destinations.get(name);
- if (jndiBindings == null || jndiBindings.size() == 0)
+
+ HornetQDestination destination = queues.get(queueName);
+ if (destination == null)
{
- return false;
+ throw new IllegalArgumentException("Queue does not exist");
}
- if (context != null)
+ if (destination.getQueueName() == null)
{
- Iterator<String> iter = jndiBindings.iterator();
- while (iter.hasNext())
- {
- String jndiBinding = iter.next();
- context.unbind(jndiBinding);
- iter.remove();
- }
+ throw new IllegalArgumentException(queueName + " is not a queue");
}
+ boolean added = bindToJndi(jndiBinding, destination);
+ if (added)
+ {
+ addToBindings(queueJNDI, queueName, jndiBinding);
+ storage.addJNDI(PersistedType.Queue, queueName, jndiBinding);
+ }
+ return added;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.server.JMSServerManager#removeQueueFromJNDI(java.lang.String, java.lang.String)
+ */
+ public boolean removeQueueFromJNDI(String name, String jndi) throws Exception
+ {
+ checkInitialised();
+
+ removeFromJNDI(queueJNDI, name, jndi);
+
+ storage.deleteJNDI(PersistedType.Queue, name, jndi);
+
return true;
}
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.server.JMSServerManager#removeQueueFromJNDI(java.lang.String, java.lang.String)
+ */
+ public boolean removeQueueFromJNDI(String name) throws Exception
+ {
+ checkInitialised();
+
+ removeFromJNDI(queueJNDI, name);
+
+ storage.deleteJNDI(PersistedType.Queue, name);
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.server.JMSServerManager#removeTopicFromJNDI(java.lang.String, java.lang.String)
+ */
+ public boolean removeTopicFromJNDI(String name, String jndi) throws Exception
+ {
+ checkInitialised();
+
+ removeFromJNDI(topicJNDI, name, jndi);
+
+ storage.deleteJNDI(PersistedType.Topic, name, jndi);
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.server.JMSServerManager#removeTopicFromJNDI(java.lang.String, java.lang.String)
+ */
+ public boolean removeTopicFromJNDI(String name) throws Exception
+ {
+ checkInitialised();
+
+ removeFromJNDI(topicJNDI, name);
+
+ storage.deleteJNDI(PersistedType.Topic, name);
+
+ return true;
+ }
+
+
public synchronized boolean destroyQueue(final String name) throws Exception
{
checkInitialised();
- undeployDestination(name);
+
+ removeFromJNDI(queueJNDI, name);
+
- destinations.remove(name);
+ queues.remove(name);
+ queueJNDI.remove(name);
+
jmsManagementService.unregisterQueue(name);
- server.destroyQueue(HornetQDestination.createQueueAddressFromName(name), null);
+
+ server.getHornetQServerControl().destroyQueue(HornetQDestination.createQueueAddressFromName(name).toString());
+
+ storage.deleteDestination(PersistedType.Queue, name);
return true;
}
@@ -370,11 +473,16 @@
public synchronized boolean destroyTopic(final String name) throws Exception
{
checkInitialised();
- undeployDestination(name);
+
+ removeFromJNDI(topicJNDI, name);
- destinations.remove(name);
+ topics.remove(name);
+ topicJNDI.remove(name);
+
jmsManagementService.unregisterTopic(name);
- AddressControl addressControl = (AddressControl)server.getManagementService().getResource(ResourceNames.CORE_ADDRESS + HornetQDestination.createTopicAddressFromName(name));
+
+ AddressControl addressControl = (AddressControl)server.getManagementService()
+ .getResource(ResourceNames.CORE_ADDRESS + HornetQDestination.createTopicAddressFromName(name));
if (addressControl != null)
{
for (String queueName : addressControl.getQueueNames())
@@ -382,10 +490,13 @@
Binding binding = server.getPostOffice().getBinding(new SimpleString(queueName));
if (binding == null)
{
- log.warn("Queue " + queueName + " doesn't exist on the topic " + name + ". It was deleted manually probably.");
+ log.warn("Queue " + queueName +
+ " doesn't exist on the topic " +
+ name +
+ ". It was deleted manually probably.");
continue;
}
-
+
// We can't remove the remote binding. As this would be the bridge associated with the topic on this case
if (binding.getType() != BindingType.REMOTE_QUEUE)
{
@@ -393,6 +504,7 @@
}
}
}
+ storage.deleteDestination(PersistedType.Topic, name);
return true;
}
@@ -604,7 +716,80 @@
public synchronized void createConnectionFactory(final ConnectionFactoryConfiguration cfConfig) throws Exception
{
+ internalCreateCF(cfConfig);
+ storage.storeConnectionFactory(new PersistedConnectionFactory(cfConfig));
+ }
+
+ private List<String> getJNDIList(final Map<String, List<String>> map, final String name)
+ {
+ List<String> result = map.get(name);
+ if (result == null)
+ {
+ return Collections.emptyList();
+ }
+ else
+ {
+ return Collections.unmodifiableList(result);
+ }
+ }
+ private boolean internalCreateQueue(final String queueName, final String selectorString, final boolean durable) throws Exception
+ {
+ HornetQDestination hqQueue = HornetQDestination.createQueue(queueName);
+
+ // Convert from JMS selector to core filter
+ String coreFilterString = null;
+
+ if (selectorString != null)
+ {
+ coreFilterString = SelectorTranslator.convertToHornetQFilterString(selectorString);
+ }
+
+ server.getHornetQServerControl().deployQueue(hqQueue.getAddress(),
+ hqQueue.getAddress(),
+ coreFilterString,
+ durable);
+
+ queues.put(queueName, hqQueue);
+
+ jmsManagementService.registerQueue(hqQueue);
+
+ return true;
+ }
+
+ /**
+ * Performs the internal creation without activating any storage.
+ * The storage load will call this method
+ * @param topicName
+ * @return
+ * @throws Exception
+ */
+ private boolean internalCreateTopic(final String topicName) throws Exception
+ {
+ HornetQDestination hqTopic = HornetQDestination.createTopic(topicName);
+ // We create a dummy subscription on the topic, that never receives messages - this is so we can perform JMS
+ // checks when routing messages to a topic that
+ // does not exist - otherwise we would not be able to distinguish from a non existent topic and one with no
+ // subscriptions - core has no notion of a topic
+ server.getHornetQServerControl().deployQueue(hqTopic.getAddress(),
+ hqTopic.getAddress(),
+ JMSServerManagerImpl.REJECT_FILTER,
+ true);
+
+ topics.put(topicName, hqTopic);
+
+ jmsManagementService.registerTopic(hqTopic);
+
+ return true;
+ }
+
+ /**
+ * @param cfConfig
+ * @throws HornetQException
+ * @throws Exception
+ */
+ private void internalCreateCF(final ConnectionFactoryConfiguration cfConfig) throws HornetQException, Exception
+ {
ArrayList<String> listBindings = new ArrayList<String>();
for (String str : cfConfig.getBindings())
{
@@ -686,7 +871,6 @@
cfConfig.getGroupID(),
listBindings);
}
-
}
public synchronized void createConnectionFactory(final String name,
@@ -754,7 +938,7 @@
public synchronized boolean destroyConnectionFactory(final String name) throws Exception
{
checkInitialised();
- List<String> jndiBindings = connectionFactoryBindings.get(name);
+ List<String> jndiBindings = connectionFactoryJNDI.get(name);
if (jndiBindings == null || jndiBindings.size() == 0)
{
return false;
@@ -773,7 +957,7 @@
}
}
}
- connectionFactoryBindings.remove(name);
+ connectionFactoryJNDI.remove(name);
connectionFactories.remove(name);
jmsManagementService.unregisterConnectionFactory(name);
@@ -809,6 +993,7 @@
checkInitialised();
return server.getHornetQServerControl().listSessions(connectionID);
}
+
// Public --------------------------------------------------------
// Private -------------------------------------------------------
@@ -829,15 +1014,22 @@
{
bindToJndi(jndiBinding, cf);
- if (connectionFactoryBindings.get(name) == null)
- {
- connectionFactoryBindings.put(name, new ArrayList<String>());
- }
- connectionFactoryBindings.get(name).add(jndiBinding);
+ addToBindings(connectionFactoryJNDI, name, jndiBinding);
}
- jmsManagementService.registerConnectionFactory(name, cf, jndiBindings);
+ jmsManagementService.registerConnectionFactory(name, cf);
}
+
+ private void addToBindings(Map<String, List<String>> map, String name, String jndi)
+ {
+ List<String> list = map.get(name);
+ if (list == null)
+ {
+ list = new ArrayList<String>();
+ map.put(name, list);
+ }
+ list.add(jndi);
+ }
private boolean bindToJndi(final String jndiName, final Object objectToBind) throws NamingException
{
@@ -904,15 +1096,6 @@
}
}
- private void addToDestinationBindings(final String destination, final String jndiBinding)
- {
- if (destinations.get(destination) == null)
- {
- destinations.put(destination, new ArrayList<String>());
- }
- destinations.get(destination).add(jndiBinding);
- }
-
private void deploy() throws Exception
{
if (config == null)
@@ -935,9 +1118,10 @@
for (JMSQueueConfiguration config : queueConfigs)
{
String[] bindings = config.getBindings();
+ createQueue(config.getName(), config.getSelector(), config.isDurable());
for (String binding : bindings)
{
- createQueue(config.getName(), binding, config.getSelector(), config.isDurable());
+ addQueueToJndi(config.getName(), binding);
}
}
@@ -945,14 +1129,144 @@
for (TopicConfiguration config : topicConfigs)
{
String[] bindings = config.getBindings();
+ createTopic(config.getName());
+
for (String binding : bindings)
{
- createTopic(config.getName(), binding);
+ addTopicToJndi(config.getName(), binding);
}
}
}
/**
+ * @param server
+ */
+ private void initJournal() throws Exception
+ {
+ this.coreConfig = server.getConfiguration();
+
+ if (coreConfig.isPersistenceEnabled())
+ {
+ // TODO: replication
+ storage = new JournalJMSStorageManagerImpl(new TimeAndCounterIDGenerator(), coreConfig, null);
+ }
+ else
+ {
+ storage = new NullJMSStorageManagerImpl();
+ }
+
+ storage.start();
+
+ List<PersistedConnectionFactory> cfs = storage.recoverConnectionFactories();
+
+ for (PersistedConnectionFactory cf : cfs)
+ {
+ internalCreateCF(cf.getConfig());
+ }
+
+ List<PersistedDestination> destinations = storage.recoverDestinations();
+
+ for (PersistedDestination destination : destinations)
+ {
+ if (destination.getType() == PersistedType.Queue)
+ {
+ internalCreateQueue(destination.getName(),
+ destination.getSelector(),
+ destination.isDurable());
+ }
+ else if (destination.getType() == PersistedType.Topic)
+ {
+ internalCreateTopic(destination.getName());
+ }
+ }
+
+ List<PersistedJNDI> jndiSpace = storage.recoverPersistedJNDI();
+ for (PersistedJNDI record : jndiSpace)
+ {
+ Map<String, List<String>> mapJNDI;
+ Map<String, ?> objects;
+
+ switch (record.getType())
+ {
+ case Queue:
+ mapJNDI = queueJNDI;
+ objects = queues;
+ break;
+ case Topic:
+ mapJNDI = topicJNDI;
+ objects = topics;
+ break;
+ default:
+ case ConnectionFactory:
+ mapJNDI = connectionFactoryJNDI;
+ objects = connectionFactories;
+ break;
+ }
+
+ Object objectToBind = objects.get(record.getName());
+
+ if (objectToBind == null)
+ {
+ continue;
+ }
+
+ List<String> jndiList = mapJNDI.get(record.getName());
+ if (jndiList == null)
+ {
+ jndiList = new ArrayList<String>();
+ mapJNDI.put(record.getName(), jndiList);
+ }
+
+
+ for (String jndi : record.getJndi())
+ {
+ jndiList.add(jndi);
+ bindToJndi(jndi, objectToBind);
+ }
+ }
+ }
+
+ private synchronized boolean removeFromJNDI(final Map<String, List<String>> jndiMap, final String name) throws Exception
+ {
+ checkInitialised();
+ List<String> jndiBindings = jndiMap.get(name);
+ if (jndiBindings == null || jndiBindings.size() == 0)
+ {
+ return false;
+ }
+ if (context != null)
+ {
+ Iterator<String> iter = jndiBindings.iterator();
+ while (iter.hasNext())
+ {
+ String jndiBinding = iter.next();
+ context.unbind(jndiBinding);
+ iter.remove();
+ }
+ }
+ return true;
+ }
+
+
+ private synchronized boolean removeFromJNDI(final Map<String, List<String>> jndiMap, final String name, final String jndi) throws Exception
+ {
+ checkInitialised();
+ List<String> jndiBindings = jndiMap.get(name);
+ if (jndiBindings == null || jndiBindings.size() == 0)
+ {
+ return false;
+ }
+ if (context != null)
+ {
+ if (jndiBindings.remove(jndi))
+ {
+ context.unbind(jndi);
+ }
+ }
+ return true;
+ }
+
+ /**
* @param cfConfig
* @return
* @throws HornetQException
Modified: trunk/src/main/org/hornetq/jms/server/management/JMSManagementService.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/management/JMSManagementService.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/jms/server/management/JMSManagementService.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -13,8 +13,6 @@
package org.hornetq.jms.server.management;
-import java.util.List;
-
import org.hornetq.api.jms.management.JMSServerControl;
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.client.HornetQDestination;
@@ -32,15 +30,15 @@
void unregisterJMSServer() throws Exception;
- void registerQueue(HornetQDestination queue, String jndiBinding) throws Exception;
+ void registerQueue(HornetQDestination queue) throws Exception;
void unregisterQueue(String name) throws Exception;
- void registerTopic(HornetQDestination topic, String jndiBinding) throws Exception;
+ void registerTopic(HornetQDestination topic) throws Exception;
void unregisterTopic(String name) throws Exception;
- void registerConnectionFactory(String name, HornetQConnectionFactory connectionFactory, List<String> bindings) throws Exception;
+ void registerConnectionFactory(String name, HornetQConnectionFactory connectionFactory) throws Exception;
void unregisterConnectionFactory(String name) throws Exception;
Modified: trunk/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -13,8 +13,6 @@
package org.hornetq.jms.server.management.impl;
-import java.util.List;
-
import javax.management.ObjectName;
import org.hornetq.api.core.management.AddressControl;
@@ -49,12 +47,15 @@
// Attributes ----------------------------------------------------
private final ManagementService managementService;
+
+ private final JMSServerManager jmsServerManager;
// Static --------------------------------------------------------
- public JMSManagementServiceImpl(final ManagementService managementService)
+ public JMSManagementServiceImpl(final ManagementService managementService, final JMSServerManager jmsServerManager)
{
this.managementService = managementService;
+ this.jmsServerManager = jmsServerManager;
}
// Public --------------------------------------------------------
@@ -77,7 +78,7 @@
managementService.unregisterFromRegistry(ResourceNames.JMS_SERVER);
}
- public synchronized void registerQueue(final HornetQDestination queue, final String jndiBinding) throws Exception
+ public synchronized void registerQueue(final HornetQDestination queue) throws Exception
{
QueueControl coreQueueControl = (QueueControl)managementService.getResource(ResourceNames.CORE_QUEUE + queue.getAddress());
MessageCounterManager messageCounterManager = managementService.getMessageCounterManager();
@@ -89,7 +90,7 @@
messageCounterManager.getMaxDayCount());
messageCounterManager.registerMessageCounter(queue.getName(), counter);
ObjectName objectName = managementService.getObjectNameBuilder().getJMSQueueObjectName(queue.getQueueName());
- JMSQueueControlImpl control = new JMSQueueControlImpl(queue, coreQueueControl, jndiBinding, counter);
+ JMSQueueControlImpl control = new JMSQueueControlImpl(queue, coreQueueControl, jmsServerManager, counter);
managementService.registerInJMX(objectName, control);
managementService.registerInRegistry(ResourceNames.JMS_QUEUE + queue.getQueueName(), control);
}
@@ -101,11 +102,11 @@
managementService.unregisterFromRegistry(ResourceNames.JMS_QUEUE + name);
}
- public synchronized void registerTopic(final HornetQDestination topic, final String jndiBinding) throws Exception
+ public synchronized void registerTopic(final HornetQDestination topic) throws Exception
{
ObjectName objectName = managementService.getObjectNameBuilder().getJMSTopicObjectName(topic.getTopicName());
AddressControl addressControl = (AddressControl)managementService.getResource(ResourceNames.CORE_ADDRESS + topic.getAddress());
- JMSTopicControlImpl control = new JMSTopicControlImpl(topic, addressControl, jndiBinding, managementService);
+ JMSTopicControlImpl control = new JMSTopicControlImpl(topic, jmsServerManager, addressControl, managementService);
managementService.registerInJMX(objectName, control);
managementService.registerInRegistry(ResourceNames.JMS_TOPIC + topic.getTopicName(), control);
}
@@ -118,11 +119,10 @@
}
public synchronized void registerConnectionFactory(final String name,
- final HornetQConnectionFactory connectionFactory,
- final List<String> bindings) throws Exception
+ final HornetQConnectionFactory connectionFactory) throws Exception
{
ObjectName objectName = managementService.getObjectNameBuilder().getConnectionFactoryObjectName(name);
- JMSConnectionFactoryControlImpl control = new JMSConnectionFactoryControlImpl(connectionFactory, name, bindings);
+ JMSConnectionFactoryControlImpl control = new JMSConnectionFactoryControlImpl(connectionFactory, jmsServerManager, name);
managementService.registerInJMX(objectName, control);
managementService.registerInRegistry(ResourceNames.JMS_CONNECTION_FACTORY + name, control);
}
Added: trunk/src/main/org/hornetq/utils/BufferHelper.java
===================================================================
--- trunk/src/main/org/hornetq/utils/BufferHelper.java (rev 0)
+++ trunk/src/main/org/hornetq/utils/BufferHelper.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.utils;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.SimpleString;
+
+/**
+ * Helper methods to read and write from HornetQBuffer.
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class BufferHelper
+{
+
+ /** Size of a String as if it was a Nullable Simple String */
+ public static int sizeOfNullableSimpleString(String str)
+ {
+ if (str == null)
+ {
+ return DataConstants.SIZE_BOOLEAN;
+ }
+ else
+ {
+ return DataConstants.SIZE_BOOLEAN + sizeOfSimpleString(str);
+ }
+ }
+
+ /** Size of a String as it if was a Simple String*/
+ public static int sizeOfSimpleString(String str)
+ {
+ return DataConstants.SIZE_INT + str.length() * 2;
+ }
+
+ public static void writeAsNullableSimpleString(HornetQBuffer buffer, String str)
+ {
+ buffer.writeNullableSimpleString(SimpleString.toSimpleString(str));
+ }
+
+ public static String readNullableSimpleStringAsString(HornetQBuffer buffer)
+ {
+ SimpleString str = buffer.readNullableSimpleString();
+ return str != null ? str.toString() : null;
+ }
+
+ public static void writeAsSimpleString(HornetQBuffer buffer, String str)
+ {
+ buffer.writeSimpleString(new SimpleString(str));
+ }
+
+ /**
+ * @param buffer
+ */
+ public static void writeNullableBoolean(HornetQBuffer buffer, Boolean value)
+ {
+ buffer.writeBoolean(value != null);
+
+ if (value != null)
+ {
+ buffer.writeBoolean(value.booleanValue());
+ }
+ }
+
+ public static int sizeOfNullableBoolean(Boolean value)
+ {
+ return DataConstants.SIZE_BOOLEAN + (value != null ? DataConstants.SIZE_BOOLEAN : 0);
+ }
+
+ public static Boolean readNullableBoolean(HornetQBuffer buffer)
+ {
+ boolean isNotNull = buffer.readBoolean();
+
+ if (isNotNull)
+ {
+ return buffer.readBoolean();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * @param buffer
+ */
+ public static void writeNullableLong(HornetQBuffer buffer, Long value)
+ {
+ buffer.writeBoolean(value != null);
+
+ if (value != null)
+ {
+ buffer.writeLong(value.longValue());
+ }
+ }
+
+ public static int sizeOfNullableLong(Long value)
+ {
+ return DataConstants.SIZE_BOOLEAN + (value != null ? DataConstants.SIZE_LONG : 0);
+ }
+
+ public static Long readNullableLong(HornetQBuffer buffer)
+ {
+ boolean isNotNull = buffer.readBoolean();
+
+ if (isNotNull)
+ {
+ return buffer.readLong();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * @param buffer
+ */
+ public static void writeNullableInteger(HornetQBuffer buffer, Integer value)
+ {
+ buffer.writeBoolean(value != null);
+
+ if (value != null)
+ {
+ buffer.writeInt(value.intValue());
+ }
+ }
+
+ public static int sizeOfNullableInteger(Integer value)
+ {
+ return DataConstants.SIZE_BOOLEAN + (value != null ? DataConstants.SIZE_INT : 0);
+ }
+
+ public static Integer readNullableInteger(HornetQBuffer buffer)
+ {
+ boolean isNotNull = buffer.readBoolean();
+
+ if (isNotNull)
+ {
+ return buffer.readInt();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+}
Modified: trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java
===================================================================
--- trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -210,7 +210,7 @@
public void createQueue(final String name, final String jndiName) throws Exception
{
- getJMSServerManager().createQueue(name, "/queue/" + (jndiName != null ? jndiName : name), null, true);
+ getJMSServerManager().createQueue(name, null, true, "/queue/" + (jndiName != null ? jndiName : name));
}
public void createTopic(final String name, final String jndiName) throws Exception
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/bridge/BridgeTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/bridge/BridgeTestBase.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/bridge/BridgeTestBase.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -150,7 +150,7 @@
{
server = jmsServer1;
}
- server.createQueue(queueName, "/queue/" + queueName, null, true);
+ server.createQueue(queueName, null, true, "/queue/" + queueName);
}
@Override
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -199,7 +199,7 @@
JMSBridgeReconnectionTest.log.info("Restarting server");
jmsServer1.start();
- jmsServer1.createQueue("targetQueue", "queue/targetQueue", null, true);
+ jmsServer1.createQueue("targetQueue", null, true, "queue/targetQueue");
createQueue("targetQueue", 1);
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/connection/ExceptionListenerTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/connection/ExceptionListenerTest.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/connection/ExceptionListenerTest.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -69,7 +69,7 @@
jmsServer = new JMSServerManagerImpl(server);
jmsServer.setContext(new NullInitialContext());
jmsServer.start();
- jmsServer.createQueue(ExceptionListenerTest.Q_NAME, ExceptionListenerTest.Q_NAME, null, true);
+ jmsServer.createQueue(ExceptionListenerTest.Q_NAME, null, true, ExceptionListenerTest.Q_NAME);
cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactory(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
cf.setBlockOnDurableSend(true);
cf.setPreAcknowledge(true);
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/consumer/ConsumerTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/consumer/ConsumerTest.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/consumer/ConsumerTest.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -49,7 +49,7 @@
{
super.setUp();
- jmsServer.createQueue(ConsumerTest.Q_NAME, ConsumerTest.Q_NAME, null, true);
+ jmsServer.createQueue(ConsumerTest.Q_NAME, null, true, ConsumerTest.Q_NAME);
cf = HornetQJMSClient.createConnectionFactory(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
}
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -417,7 +417,7 @@
JMSQueueControl queueControl = createManagementControl();
String expiryQueueName = RandomUtil.randomString();
HornetQDestination expiryQueue = (HornetQDestination)HornetQJMSClient.createQueue(expiryQueueName);
- serverManager.createQueue(expiryQueueName, expiryQueueName, null, true);
+ serverManager.createQueue(expiryQueueName, null, true, expiryQueueName);
queueControl.setExpiryAddress(expiryQueue.getAddress());
JMSQueueControl expiryQueueControl = ManagementControlHelper.createJMSQueueControl(expiryQueue, mbeanServer);
@@ -544,7 +544,7 @@
public void testSendMessageToDeadLetterAddress() throws Exception
{
String deadLetterQueue = RandomUtil.randomString();
- serverManager.createQueue(deadLetterQueue, deadLetterQueue, null, true);
+ serverManager.createQueue(deadLetterQueue, null, true, deadLetterQueue);
HornetQDestination dlq = (HornetQDestination)HornetQJMSClient.createQueue(deadLetterQueue);
Connection conn = createConnection();
@@ -605,7 +605,7 @@
String filter = "key = " + matchingValue;
String deadLetterQueue = RandomUtil.randomString();
- serverManager.createQueue(deadLetterQueue, deadLetterQueue, null, true);
+ serverManager.createQueue(deadLetterQueue, null, true, deadLetterQueue);
HornetQDestination dlq = (HornetQDestination)HornetQJMSClient.createQueue(deadLetterQueue);
Connection conn = createConnection();
@@ -647,7 +647,7 @@
{
String otherQueueName = RandomUtil.randomString();
- serverManager.createQueue(otherQueueName, otherQueueName, null, true);
+ serverManager.createQueue(otherQueueName, null, true, otherQueueName);
HornetQDestination otherQueue = (HornetQDestination)HornetQJMSClient.createQueue(otherQueueName);
// send on queue
@@ -694,7 +694,7 @@
String filter = "key = " + matchingValue;
String otherQueueName = RandomUtil.randomString();
- serverManager.createQueue(otherQueueName, otherQueueName, null, true);
+ serverManager.createQueue(otherQueueName, null, true, otherQueueName);
HornetQDestination otherQueue = (HornetQDestination)HornetQJMSClient.createQueue(otherQueueName);
Connection connection = JMSUtil.createConnection(InVMConnectorFactory.class.getName());
@@ -729,7 +729,7 @@
{
String otherQueueName = RandomUtil.randomString();
- serverManager.createQueue(otherQueueName, otherQueueName, null, true);
+ serverManager.createQueue(otherQueueName, null, true, otherQueueName);
HornetQDestination otherQueue = (HornetQDestination)HornetQJMSClient.createQueue(otherQueueName);
String[] messageIDs = JMSUtil.sendMessages(queue, 1);
@@ -752,7 +752,7 @@
String unknownMessageID = RandomUtil.randomString();
String otherQueueName = RandomUtil.randomString();
- serverManager.createQueue(otherQueueName, otherQueueName, null, true);
+ serverManager.createQueue(otherQueueName, null, true, otherQueueName);
JMSQueueControl queueControl = createManagementControl();
Assert.assertEquals(0, queueControl.getMessageCount());
@@ -834,7 +834,7 @@
serverManager.activated();
String queueName = RandomUtil.randomString();
- serverManager.createQueue(queueName, queueName, null, true);
+ serverManager.createQueue(queueName, null, true, queueName);
queue = (HornetQDestination)HornetQJMSClient.createQueue(queueName);
}
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -13,6 +13,7 @@
package org.hornetq.tests.integration.jms.server.management;
+import java.util.List;
import java.util.Map;
import javax.jms.QueueConnection;
@@ -270,6 +271,18 @@
{
return (String)proxy.retrieveAttributeValue("selector");
}
+
+ public void addJNDI(String jndi) throws Exception
+ {
+ // TODO: Add a test for this
+ proxy.invokeOperation("addJNDI", jndi);
+ }
+
+ public List<String> getJNDIBindings()
+ {
+ // TODO: Add a test for this
+ return null;
+ }
};
}
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -167,14 +167,14 @@
return (Boolean)proxy.invokeOperation("closeConnectionsForAddress", ipAddress);
}
- public boolean createQueue(final String name, final String jndiBinding) throws Exception
+ public boolean createQueue(final String name) throws Exception
{
- return (Boolean)proxy.invokeOperation("createQueue", name, jndiBinding);
+ return (Boolean)proxy.invokeOperation("createQueue", name);
}
- public boolean createTopic(final String name, final String jndiBinding) throws Exception
+ public boolean createTopic(final String name) throws Exception
{
- return (Boolean)proxy.invokeOperation("createTopic", name, jndiBinding);
+ return (Boolean)proxy.invokeOperation("createTopic", name);
}
public void destroyConnectionFactory(final String name) throws Exception
@@ -253,6 +253,18 @@
return (String)proxy.invokeOperation("getSecuritySettingsAsJSON", addressMatch);
}
+ public boolean createQueue(String name, String jndiBinding) throws Exception
+ {
+ // TODO add a test for this
+ return false;
+ }
+
+ public boolean createTopic(String name, String jndiBinding) throws Exception
+ {
+ // TODO add a test for this
+ return false;
+ }
+
};
}
// Public --------------------------------------------------------
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -76,7 +76,6 @@
Assert.assertEquals(topic.getTopicName(), topicControl.getName());
Assert.assertEquals(topic.getAddress(), topicControl.getAddress());
Assert.assertEquals(topic.isTemporary(), topicControl.isTemporary());
- Assert.assertEquals(topic.getName(), topicControl.getJNDIBinding());
}
public void testGetXXXSubscriptionsCount() throws Exception
Added: trunk/tests/src/org/hornetq/tests/integration/persistence/AddressSettingsConfigurationStorageTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/persistence/AddressSettingsConfigurationStorageTest.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/persistence/AddressSettingsConfigurationStorageTest.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.tests.integration.persistence;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.persistence.config.PersistedAddressSetting;
+import org.hornetq.core.persistence.impl.journal.JournalStorageManager;
+import org.hornetq.core.settings.impl.AddressFullMessagePolicy;
+import org.hornetq.core.settings.impl.AddressSettings;
+
+/**
+ * A ConfigurationStorageTest
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class AddressSettingsConfigurationStorageTest extends StorageManagerTestBase
+{
+
+ private Map<SimpleString, PersistedAddressSetting> mapExpectedAddresses;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ mapExpectedAddresses = new HashMap<SimpleString, PersistedAddressSetting>();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ mapExpectedAddresses = null;
+
+ super.tearDown();
+ }
+
+ protected void addAddress(JournalStorageManager journal, String address, AddressSettings setting) throws Exception
+ {
+ SimpleString str = new SimpleString(address);
+ PersistedAddressSetting persistedSetting = new PersistedAddressSetting(str, setting);
+ mapExpectedAddresses.put(str, persistedSetting);
+ journal.storeAddressSetting(persistedSetting);
+ }
+
+ public void testStoreSecuritySettings() throws Exception
+ {
+ createStorage();
+
+ AddressSettings setting = new AddressSettings();
+
+ setting = new AddressSettings();
+
+ setting.setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
+
+ setting.setDeadLetterAddress(new SimpleString("some-test"));
+
+ addAddress(journal, "a2", setting);
+
+ journal.stop();
+
+ createStorage();
+
+ checkAddresses(journal);
+
+ setting = new AddressSettings();
+
+ setting.setDeadLetterAddress(new SimpleString("new-adddress"));
+
+ // Replacing the first setting
+ addAddress(journal, "a1", setting);
+
+ journal.stop();
+
+ createStorage();
+
+ checkAddresses(journal);
+
+ journal.stop();
+
+ journal = null;
+
+ }
+
+ /**
+ * @param journal
+ * @throws Exception
+ */
+ private void checkAddresses(JournalStorageManager journal) throws Exception
+ {
+ List<PersistedAddressSetting> listSetting = journal.recoverAddressSettings();
+
+ assertEquals(mapExpectedAddresses.size(), listSetting.size());
+
+ for (PersistedAddressSetting el : listSetting)
+ {
+ PersistedAddressSetting el2 = mapExpectedAddresses.get(el.getAddressMatch());
+
+ assertEquals(el.getAddressMatch(), el2.getAddressMatch());
+ assertEquals(el.getSetting(), el2.getSetting());
+ }
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: trunk/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.tests.integration.persistence;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQBuffers;
+import org.hornetq.jms.persistence.config.PersistedConnectionFactory;
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
+
+/**
+ * A JMSConnectionFactoryConfigurationStorageTest
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class JMSConnectionFactoryConfigurationStorageTest extends StorageManagerTestBase
+{
+
+ private Map<String, PersistedConnectionFactory> mapExpectedCFs;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ mapExpectedCFs = new HashMap<String, PersistedConnectionFactory>();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ mapExpectedCFs = null;
+
+ super.tearDown();
+ }
+
+ protected void addSetting(PersistedConnectionFactory setting) throws Exception
+ {
+ mapExpectedCFs.put(setting.getName(), setting);
+ jmsJournal.storeConnectionFactory(setting);
+ }
+
+ public void testSettings() throws Exception
+ {
+
+ createJMSStorage();
+
+ String str[] = new String[5];
+ for (int i = 0; i < 5; i++)
+ {
+ str[i] = "str" + i;
+ }
+
+ ConnectionFactoryConfiguration config = new ConnectionFactoryConfigurationImpl("some-name", str);
+
+ addSetting(new PersistedConnectionFactory(config));
+
+ jmsJournal.stop();
+
+ createJMSStorage();
+
+ List<PersistedConnectionFactory> cfs = jmsJournal.recoverConnectionFactories();
+
+ assertEquals(1, cfs.size());
+
+ assertEquals("some-name", cfs.get(0).getName());
+
+ assertEquals(5, cfs.get(0).getConfig().getBindings().length);
+
+ for (int i = 0; i < 5; i++)
+ {
+ assertEquals("str" + i, cfs.get(0).getConfig().getBindings()[i]);
+ }
+ }
+
+ public void testSizeOfCF() throws Exception
+ {
+
+ String str[] = new String[5];
+ for (int i = 0; i < 5; i++)
+ {
+ str[i] = "str" + i;
+ }
+
+ ConnectionFactoryConfiguration config = new ConnectionFactoryConfigurationImpl("some-name", str);
+
+ int size = config.getEncodeSize();
+
+ HornetQBuffer buffer = HornetQBuffers.fixedBuffer(size);
+
+ config.encode(buffer);
+
+ assertEquals(size, buffer.writerIndex());
+
+ PersistedConnectionFactory persistedCF = new PersistedConnectionFactory(config);
+
+ size = persistedCF.getEncodeSize();
+
+ buffer = HornetQBuffers.fixedBuffer(size);
+
+ persistedCF.encode(buffer);
+
+ assertEquals(size, buffer.writerIndex());
+
+ }
+
+ /**
+ * @param journal
+ * @throws Exception
+ */
+ private void checkSettings() throws Exception
+ {
+ List<PersistedConnectionFactory> listSetting = jmsJournal.recoverConnectionFactories();
+
+ assertEquals(mapExpectedCFs.size(), listSetting.size());
+
+ for (PersistedConnectionFactory el : listSetting)
+ {
+ PersistedConnectionFactory el2 = mapExpectedCFs.get(el.getName());
+
+ assertEquals(el, el2);
+ }
+ }
+
+}
Added: trunk/tests/src/org/hornetq/tests/integration/persistence/RolesConfigurationStorageTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/persistence/RolesConfigurationStorageTest.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/persistence/RolesConfigurationStorageTest.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.tests.integration.persistence;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.persistence.config.PersistedRoles;
+
+/**
+ * A ConfigurationStorageTest
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class RolesConfigurationStorageTest extends StorageManagerTestBase
+{
+
+ private Map<SimpleString, PersistedRoles> mapExpectedSets;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ mapExpectedSets = new HashMap<SimpleString, PersistedRoles>();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ mapExpectedSets = null;
+
+ super.tearDown();
+ }
+
+ protected void addSetting(PersistedRoles setting) throws Exception
+ {
+ mapExpectedSets.put(setting.getAddressMatch(), setting);
+ journal.storeSecurityRoles(setting);
+ }
+
+ public void testStoreSecuritySettings() throws Exception
+ {
+ createStorage();
+
+
+ addSetting(new PersistedRoles("a#",
+ "a1",
+ "a1",
+ "a1",
+ "a1",
+ "a1",
+ "a1",
+ "a1"));
+
+
+ addSetting(new PersistedRoles("a2",
+ "a1",
+ null,
+ "a1",
+ "a1",
+ "a1",
+ "a1",
+ "a1"));
+
+ journal.stop();
+
+ checkSettings();
+
+ createStorage();
+
+ checkSettings();
+
+ addSetting(new PersistedRoles("a2",
+ "a1",
+ null,
+ "a1",
+ "a1",
+ "a1",
+ "a1",
+ "a1"));
+
+ addSetting(new PersistedRoles("a3",
+ "a1",
+ null,
+ "a1",
+ "a1",
+ "a1",
+ "a1",
+ "a1"));
+
+ checkSettings();
+
+ journal.stop();
+
+ createStorage();
+
+ checkSettings();
+
+ journal.stop();
+
+ journal = null;
+
+ }
+
+ /**
+ * @param journal
+ * @throws Exception
+ */
+ private void checkSettings() throws Exception
+ {
+ List<PersistedRoles> listSetting = journal.recoverPersistedRoles();
+
+ assertEquals(mapExpectedSets.size(), listSetting.size());
+
+ for (PersistedRoles el : listSetting)
+ {
+ PersistedRoles el2 = mapExpectedSets.get(el.getAddressMatch());
+
+ assertEquals(el, el2);
+ }
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: trunk/tests/src/org/hornetq/tests/integration/persistence/StorageManagerTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/persistence/StorageManagerTestBase.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/persistence/StorageManagerTestBase.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.tests.integration.persistence;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.persistence.GroupingInfo;
+import org.hornetq.core.persistence.QueueBindingInfo;
+import org.hornetq.core.persistence.impl.journal.JournalStorageManager;
+import org.hornetq.core.server.JournalType;
+import org.hornetq.core.server.Queue;
+import org.hornetq.jms.persistence.JMSStorageManager;
+import org.hornetq.jms.persistence.impl.journal.JournalJMSStorageManagerImpl;
+import org.hornetq.tests.unit.core.server.impl.fakes.FakePostOffice;
+import org.hornetq.tests.util.ServiceTestBase;
+import org.hornetq.utils.ExecutorFactory;
+import org.hornetq.utils.OrderedExecutorFactory;
+import org.hornetq.utils.TimeAndCounterIDGenerator;
+
+/**
+ * A StorageManagerTestBase
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class StorageManagerTestBase extends ServiceTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+ protected ExecutorService executor;
+
+ protected ExecutorFactory execFactory;
+
+ protected JournalStorageManager journal;
+
+ protected JMSStorageManager jmsJournal;
+
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ executor = Executors.newCachedThreadPool();
+
+ execFactory = new OrderedExecutorFactory(executor);
+
+ File testdir = new File(getTestDir());
+
+ deleteDirectory(testdir);
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ executor.shutdown();
+
+ if (journal != null)
+ {
+ try
+ {
+ journal.stop();
+ }
+ catch (Throwable e)
+ {
+ e.printStackTrace(); // >> junit report
+ }
+
+ journal = null;
+ }
+
+ if (jmsJournal != null)
+ {
+ try
+ {
+ jmsJournal.stop();
+ }
+ catch (Throwable e)
+ {
+ e.printStackTrace(); // >> junit report
+ }
+
+ jmsJournal = null;
+ }
+
+ super.tearDown();
+ }
+
+ /**
+ * @return
+ * @throws Exception
+ */
+ protected void createStorage() throws Exception
+ {
+ Configuration configuration = createDefaultConfig();
+
+ configuration.setJournalType(JournalType.ASYNCIO);
+
+ journal = new JournalStorageManager(configuration, execFactory);
+
+ journal.start();
+
+ journal.loadBindingJournal(new ArrayList<QueueBindingInfo>(), new ArrayList<GroupingInfo>());
+
+ Map<Long, Queue> queues = new HashMap<Long, Queue>();
+
+ journal.loadMessageJournal(new FakePostOffice(), null, null, queues, null);
+ }
+
+ /**
+ * @return
+ * @throws Exception
+ */
+ protected void createJMSStorage() throws Exception
+ {
+ Configuration configuration = createDefaultConfig();
+
+ configuration.setJournalType(JournalType.ASYNCIO);
+
+ jmsJournal = new JournalJMSStorageManagerImpl(new TimeAndCounterIDGenerator(), configuration, null);
+
+ jmsJournal.start();
+ }
+
+
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: trunk/tests/src/org/hornetq/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/tests/src/org/hornetq/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -533,8 +533,8 @@
jmsServer.setContext(context);
jmsServer.start();
- jmsServer.createQueue(JMSBridgeImplTest.SOURCE, "/queue/" + JMSBridgeImplTest.SOURCE, null, true);
- jmsServer.createQueue(JMSBridgeImplTest.TARGET, "/queue/" + JMSBridgeImplTest.TARGET, null, true);
+ jmsServer.createQueue(JMSBridgeImplTest.SOURCE, null, true, "/queue/" + JMSBridgeImplTest.SOURCE);
+ jmsServer.createQueue(JMSBridgeImplTest.TARGET, null, true, "/queue/" + JMSBridgeImplTest.TARGET);
}
Modified: trunk/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -15,6 +15,7 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -52,6 +53,8 @@
import org.hornetq.core.persistence.OperationContext;
import org.hornetq.core.persistence.QueueBindingInfo;
import org.hornetq.core.persistence.StorageManager;
+import org.hornetq.core.persistence.config.PersistedAddressSetting;
+import org.hornetq.core.persistence.config.PersistedRoles;
import org.hornetq.core.postoffice.Binding;
import org.hornetq.core.postoffice.PostOffice;
import org.hornetq.core.replication.ReplicationManager;
@@ -1307,10 +1310,52 @@
public void storeReference(final long queueID, final long messageID, final boolean last) throws Exception
{
- // TODO Auto-generated method stub
+ }
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#recoverAddressSettings()
+ */
+ public List<PersistedAddressSetting> recoverAddressSettings() throws Exception
+ {
+ return Collections.emptyList();
}
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#recoverPersistedRoles()
+ */
+ public List<PersistedRoles> recoverPersistedRoles() throws Exception
+ {
+ return Collections.emptyList();
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeAddressSetting(org.hornetq.core.persistconfig.PersistedAddressSetting)
+ */
+ public void storeAddressSetting(PersistedAddressSetting addressSetting) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeSecurityRoles(org.hornetq.core.persistconfig.PersistedRoles)
+ */
+ public void storeSecurityRoles(PersistedRoles persistedRoles) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteAddressSetting(org.hornetq.api.core.SimpleString)
+ */
+ public void deleteAddressSetting(SimpleString addressMatch) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteSecurityRoles(org.hornetq.api.core.SimpleString)
+ */
+ public void deleteSecurityRoles(SimpleString addressMatch) throws Exception
+ {
+ }
+
}
class FakeStoreFactory implements PagingStoreFactory
Modified: trunk/tests/src/org/hornetq/tests/util/JMSClusteredTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/util/JMSClusteredTestBase.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/tests/src/org/hornetq/tests/util/JMSClusteredTestBase.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -90,8 +90,8 @@
*/
protected Queue createQueue(final String name) throws Exception, NamingException
{
- jmsServer2.createQueue(name, "/queue/" + name, null, true);
- jmsServer1.createQueue(name, "/queue/" + name, null, true);
+ jmsServer2.createQueue(name, null, true, "/queue/" + name);
+ jmsServer1.createQueue(name, null, true, "/queue/" + name);
return (Queue)context1.lookup("/queue/" + name);
}
Modified: trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java 2010-03-26 18:10:52 UTC (rev 8972)
+++ trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java 2010-03-26 21:33:52 UTC (rev 8973)
@@ -85,7 +85,7 @@
*/
protected Queue createQueue(final String name) throws Exception, NamingException
{
- jmsServer.createQueue(name, "/jms/" + name, null, true);
+ jmsServer.createQueue(name, null, true, "/jms/" + name);
return (Queue)context.lookup("/jms/" + name);
}
14 years, 2 months
JBoss hornetq SVN: r8972 - in branches/Clebert_TMP/src/main/org/hornetq: jms/server/impl and 1 other directory.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-03-26 14:10:52 -0400 (Fri, 26 Mar 2010)
New Revision: 8972
Modified:
branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/JMSServerControl.java
branches/Clebert_TMP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
Log:
tweaks before merge
Modified: branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/JMSServerControl.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/JMSServerControl.java 2010-03-26 17:53:40 UTC (rev 8971)
+++ branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/JMSServerControl.java 2010-03-26 18:10:52 UTC (rev 8972)
@@ -14,7 +14,6 @@
package org.hornetq.api.jms.management;
import java.util.Map;
-import java.util.Set;
import javax.management.MBeanOperationInfo;
@@ -22,8 +21,6 @@
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.management.Operation;
import org.hornetq.api.core.management.Parameter;
-import org.hornetq.core.security.Role;
-import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.spi.core.remoting.ConnectorFactory;
/**
Modified: branches/Clebert_TMP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-03-26 17:53:40 UTC (rev 8971)
+++ branches/Clebert_TMP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-03-26 18:10:52 UTC (rev 8972)
@@ -154,6 +154,8 @@
{
jmsManagementService.registerJMSServer(this);
+ initJournal();
+
// start the JMS deployer only if the configuration is not done using the JMSConfiguration object
if (config == null)
{
@@ -176,7 +178,6 @@
deploy();
}
- initJournal();
}
catch (Exception e)
{
@@ -324,7 +325,7 @@
for (String jndiItem : jndi)
{
- addQueueToJndi(topicName, jndiItem);
+ addTopicToJndi(topicName, jndiItem);
}
return added;
14 years, 2 months
JBoss hornetq SVN: r8971 - branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/impl/nullpm.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-03-26 13:53:40 -0400 (Fri, 26 Mar 2010)
New Revision: 8971
Modified:
branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java
Log:
tweak before merge
Modified: branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java 2010-03-26 16:19:56 UTC (rev 8970)
+++ branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java 2010-03-26 17:53:40 UTC (rev 8971)
@@ -119,8 +119,6 @@
*/
public void deleteDestination(PersistedType type, String name) throws Exception
{
- // TODO Auto-generated method stub
-
}
/* (non-Javadoc)
@@ -128,8 +126,6 @@
*/
public void deleteJNDI(PersistedType type, String name) throws Exception
{
- // TODO Auto-generated method stub
-
}
/* (non-Javadoc)
@@ -137,8 +133,7 @@
*/
public List<PersistedJNDI> recoverPersistedJNDI() throws Exception
{
- // TODO Auto-generated method stub
- return null;
+ return Collections.emptyList();
}
// Constants -----------------------------------------------------
14 years, 2 months
JBoss hornetq SVN: r8970 - in projects/jopr-plugin/trunk: src and 11 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-03-26 12:19:56 -0400 (Fri, 26 Mar 2010)
New Revision: 8970
Added:
projects/jopr-plugin/trunk/jopr-plugin.iml
projects/jopr-plugin/trunk/pom.xml
projects/jopr-plugin/trunk/src/
projects/jopr-plugin/trunk/src/main/
projects/jopr-plugin/trunk/src/main/java/
projects/jopr-plugin/trunk/src/main/java/org/
projects/jopr-plugin/trunk/src/main/java/org/jboss/
projects/jopr-plugin/trunk/src/main/java/org/jboss/as/
projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/
projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/
projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/
projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSComponent.java
projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSConnectionFactoryComponent.java
projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSConnectionFactoryDiscoveryComponent.java
projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSConstants.java
projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSManagerComponent.java
projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSManagerDiscoveryComponent.java
projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSQueueComponent.java
projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSQueueDiscoveryComponent.java
projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSResourceComponent.java
projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSTopicComponent.java
projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSTopicDiscoveryComponent.java
projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/util/
projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/util/ManagementSupport.java
projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/util/Operation.java
projects/jopr-plugin/trunk/src/resources/
projects/jopr-plugin/trunk/src/resources/META-INF/
projects/jopr-plugin/trunk/src/resources/META-INF/rhq-plugin.xml
Log:
first cut of hornetq jopr plugin
Added: projects/jopr-plugin/trunk/jopr-plugin.iml
===================================================================
--- projects/jopr-plugin/trunk/jopr-plugin.iml (rev 0)
+++ projects/jopr-plugin/trunk/jopr-plugin.iml 2010-03-26 16:19:56 UTC (rev 8970)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/target/classes" />
+ <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/resources" isTestSource="false" />
+ <excludeFolder url="file://$MODULE_DIR$/target" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" exported="" name="Maven: org.jboss.integration:jboss-profileservice-spi:6.0.0.Alpha9" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.jboss:jboss-common-core:2.2.17.GA" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.jboss.logging:jboss-logging-spi:2.1.0.GA" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.jboss.man:jboss-managed:2.1.1.SP1" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.jboss.man:jboss-metatype:2.1.0.SP1" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.jboss:jboss-reflect:2.0.2.GA" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.jboss:jboss-mdr:2.0.2.GA" level="project" />
+ <orderEntry type="library" exported="" name="Maven: sun-jaxb:jaxb-api:2.1.4" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.jboss:jboss-vfs:3.0.0.CR1" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.jboss.kernel:jboss-dependency:2.2.0.Alpha6" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.jboss:jbossxb:2.0.2.Beta4" level="project" />
+ <orderEntry type="library" exported="" name="Maven: apache-xerces:xml-apis:2.9.1" level="project" />
+ <orderEntry type="library" exported="" name="Maven: apache-xerces:xercesImpl:2.9.1" level="project" />
+ <orderEntry type="library" exported="" name="Maven: wutka-dtdparser:dtdparser121:1.2.1" level="project" />
+ <orderEntry type="library" exported="" name="Maven: javax.activation:activation:1.1" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.rhq:rhq-core-domain:1.4.0.B01" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.rhq:rhq-core-util:1.4.0.B01" level="project" />
+ <orderEntry type="library" exported="" name="Maven: jdom:jdom:1.0" level="project" />
+ <orderEntry type="library" exported="" name="Maven: i18nlog:i18nlog:1.0.9" level="project" />
+ <orderEntry type="library" exported="" name="Maven: javax.xml.bind:jaxb-api:2.1" level="project" />
+ <orderEntry type="library" exported="" name="Maven: javax.xml.stream:stax-api:1.0-2" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.rhq:rhq-core-plugin-api:1.4.0.B01" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.rhq:rhq-core-native-system:1.4.0.B01" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.hyperic:sigar:1.6.3.82" level="project" />
+ <orderEntry type="library" exported="" name="Maven: com.sun.xml.bind:jaxb-impl:2.1.6" level="project" />
+ <orderEntry type="library" scope="PROVIDED" name="Maven: org.rhq:rhq-jmx-plugin:1.4.0.B01" level="project" />
+ <orderEntry type="library" scope="PROVIDED" name="Maven: mc4j:org-mc4j-ems:1.2.11" level="project" />
+ <orderEntry type="library" name="Maven: com.sun:tools:1.4.2" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.0-CR-1" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.hibernate:hibernate-annotations:3.5.0-CR-1" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.hibernate:hibernate-core:3.5.0-CR-1" level="project" />
+ <orderEntry type="library" exported="" name="Maven: antlr:antlr:2.7.6" level="project" />
+ <orderEntry type="library" exported="" name="Maven: commons-collections:commons-collections:3.1" level="project" />
+ <orderEntry type="library" exported="" name="Maven: dom4j:dom4j:1.6.1" level="project" />
+ <orderEntry type="library" exported="" name="Maven: xml-apis:xml-apis:1.0.b2" level="project" />
+ <orderEntry type="library" exported="" name="Maven: javax.transaction:jta:1.1" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.slf4j:slf4j-api:1.5.8" level="project" />
+ <orderEntry type="library" exported="" name="Maven: org.hibernate:hibernate-commons-annotations:3.2.0.Beta1" level="project" />
+ </component>
+</module>
+
Added: projects/jopr-plugin/trunk/pom.xml
===================================================================
--- projects/jopr-plugin/trunk/pom.xml (rev 0)
+++ projects/jopr-plugin/trunk/pom.xml 2010-03-26 16:19:56 UTC (rev 8970)
@@ -0,0 +1,125 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.hornetq</groupId>
+ <artifactId>hornetq-jopr-plugin</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0.0.SNAPSHOT</version>
+ <name>JBoss Application Server JOPR plugin</name>
+ <url>http://hornetq.org</url>
+ <description>HornetQ JOPR plugin</description>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <resources>
+ <resource>
+ <directory>src/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <!-- Compile (global dependencies) -->
+ <dependency>
+ <groupId>org.jboss.integration</groupId>
+ <artifactId>jboss-profileservice-spi</artifactId>
+ <version>6.0.0.Alpha9</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <version>2.1.1.SP1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>1.4.0.B01</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-plugin-api</artifactId>
+ <version>1.4.0.B01</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-jmx-plugin</artifactId>
+ <version>1.4.0.B01</version>
+ <scope>provided</scope>
+ </dependency>
+ <!--we dont compile without these, some strange annotation dependency-->
+ <dependency>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.0-api</artifactId>
+ <version>1.0.0-CR-1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.5.0-CR-1</version>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>false</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>interval:10080</updatePolicy>
+ </releases>
+ <id>jboss.release</id>
+ <name>JBoss releases</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>false</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>interval:10080</updatePolicy>
+ </releases>
+ <id>jboss.release</id>
+ <name>JBoss releases</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <distributionManagement>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss.org Release Distribution Repository</name>
+ <url>dav:https://svn.jboss.org/repos/repository.jboss.org/maven2</url>
+ </repository>
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss.org Development Snapshot Repository</name>
+ <url>dav:https://snapshots.jboss.org/maven2</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+</project>
Added: projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSComponent.java
===================================================================
--- projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSComponent.java (rev 0)
+++ projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSComponent.java 2010-03-26 16:19:56 UTC (rev 8970)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.as.integration.hornetq.jopr;
+
+import org.jboss.deployers.spi.management.ManagementView;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ * Created: 17-Mar-2010
+ */
+public interface JMSComponent
+{
+ ManagementView getProfileService() throws Exception;
+}
Added: projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSConnectionFactoryComponent.java
===================================================================
--- projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSConnectionFactoryComponent.java (rev 0)
+++ projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSConnectionFactoryComponent.java 2010-03-26 16:19:56 UTC (rev 8970)
@@ -0,0 +1,201 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.jboss.as.integration.hornetq.jopr;
+
+import org.jboss.as.integration.hornetq.jopr.util.ManagementSupport;
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+
+import java.util.Map;
+
+import static org.jboss.as.integration.hornetq.jopr.JMSConstants.ConnectionFactory.COMPONENT_NAME;
+import static org.jboss.as.integration.hornetq.jopr.JMSConstants.ConnectionFactory.COMPONENT_TYPE;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ * Created Mar 19, 2010
+ */
+public class JMSConnectionFactoryComponent extends JMSResourceComponent
+{
+
+ @Override
+ protected String getInvokeOperationSubscriptionMessage()
+ {
+ return null;
+ }
+
+ @Override
+ protected String getInvokeOperationJMSMessage()
+ {
+ return null;
+ }
+
+ @Override
+ protected String getInvokeOperation()
+ {
+ return "";
+ }
+
+ @Override
+ String getComponentName()
+ {
+ return COMPONENT_NAME;
+ }
+
+ @Override
+ ComponentType getComponentType()
+ {
+ return COMPONENT_TYPE;
+ }
+
+ @Override
+ String getConfigurationOperationName()
+ {
+ return "getConfiguration";
+ }
+
+ @Override
+ String getMeasurementsOperationName()
+ {
+ return "getMeasurements";
+ }
+
+ @Override
+ String getDeleteOperationName()
+ {
+ return "deleteConnectionFactory";
+ }
+
+ public void updateResourceConfiguration(ConfigurationUpdateReport configurationUpdateReport)
+ {
+ Map<String, PropertySimple> simpleProps = configurationUpdateReport.getConfiguration().getSimpleProperties();
+ String name = simpleProps.get("name").getStringValue();
+ long discoveryRefreshTimeout = simpleProps.get("DiscoveryRefreshTimeout").getLongValue();
+ String clientId = simpleProps.get("ClientID").getStringValue();
+ int dupsOkBatchSize = simpleProps.get("DupsOKBatchSize").getIntegerValue();
+ int transactionBatchSize = simpleProps.get("TransactionBatchSize").getIntegerValue();
+ long clientFailureCheckPeriod = simpleProps.get("ClientFailureCheckPeriod").getLongValue();
+ long connectionTTL = simpleProps.get("ConnectionTTL").getLongValue();
+ long callTimeout = simpleProps.get("CallTimeout").getLongValue();
+ int consumerWindowSize = simpleProps.get("ConsumerWindowSize").getIntegerValue();
+ int confirmationWindowSize = simpleProps.get("ConfirmationWindowSize").getIntegerValue();
+ int producerMaxRate = simpleProps.get("ProducerMaxRate").getIntegerValue();
+ int producerWindowSize = simpleProps.get("ProducerWindowSize").getIntegerValue();
+ boolean cacheLargeMessageClient = simpleProps.get("CacheLargeMessagesClient").getBooleanValue();
+ int minLargeMessageSize = simpleProps.get("MinLargeMessageSize").getIntegerValue();
+ boolean blockOnNonDurableSend = simpleProps.get("BlockOnNonDurableSend").getBooleanValue();
+ boolean blockOnAcknowledge = simpleProps.get("BlockOnAcknowledge").getBooleanValue();
+ boolean blockOnDurableSend = simpleProps.get("BlockOnDurableSend").getBooleanValue();
+ boolean autoGroup = simpleProps.get("AutoGroup").getBooleanValue();
+ boolean preAcknowledge = simpleProps.get("PreAcknowledge").getBooleanValue();
+ long maxRetryInterval = simpleProps.get("MaxRetryInterval").getLongValue();
+ double retryIntervalMultiplier = simpleProps.get("RetryIntervalMultiplier").getDoubleValue();
+ int reconnectAttempts = simpleProps.get("ReconnectAttempts").getIntegerValue();
+ boolean failoverOnShutdown = simpleProps.get("FailoverOnServerShutdown").getBooleanValue();
+ int scheduledThreadPoolMaxSize = simpleProps.get("ScheduledThreadPoolMaxSize").getIntegerValue();
+ int threadPoolMaxSize = simpleProps.get("ThreadPoolMaxSize").getIntegerValue();
+ String groupId = simpleProps.get("GroupID").getStringValue();
+ int initialMessagePacketSize = simpleProps.get("InitialMessagePacketSize").getIntegerValue();
+ boolean useGlobalPools = simpleProps.get("UseGlobalPools").getBooleanValue();
+ long retryInterval = simpleProps.get("RetryInterval").getLongValue();
+ String connectionLoadBalancingPolicyClassName = simpleProps.get("ConnectionLoadBalancingPolicyClassName").getStringValue();
+
+ try
+ {
+ ManagementView managementView = getProfileService();
+
+ updateConnectionFactory(configurationUpdateReport, managementView, name, discoveryRefreshTimeout, clientId, dupsOkBatchSize, transactionBatchSize, clientFailureCheckPeriod, connectionTTL, callTimeout, consumerWindowSize, confirmationWindowSize, producerMaxRate, producerWindowSize, cacheLargeMessageClient, minLargeMessageSize, blockOnNonDurableSend, blockOnAcknowledge, blockOnDurableSend, autoGroup, preAcknowledge, maxRetryInterval, retryIntervalMultiplier, reconnectAttempts, failoverOnShutdown, scheduledThreadPoolMaxSize, threadPoolMaxSize, groupId, initialMessagePacketSize, useGlobalPools, retryInterval, connectionLoadBalancingPolicyClassName);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ configurationUpdateReport.setStatus(ConfigurationUpdateStatus.FAILURE);
+ configurationUpdateReport.setErrorMessage(e.getMessage());
+ }
+
+ }
+
+ private void updateConnectionFactory(ConfigurationUpdateReport configurationUpdateReport,
+ ManagementView managementView,
+ String name,
+ long discoveryRefreshTimeout,
+ String clientId,
+ int dupsOkBatchSize,
+ int transactionBatchSize,
+ long clientFailureCheckPeriod,
+ long connectionTTL,
+ long callTimeout,
+ int consumerWindowSize,
+ int confirmationWindowSize,
+ int producerMaxRate,
+ int producerWindowSize,
+ boolean cacheLargeMessageClient,
+ int minLargeMessageSize,
+ boolean blockOnNonDurableSend,
+ boolean blockOnAcknowledge,
+ boolean blockOnDurableSend,
+ boolean autoGroup,
+ boolean preAcknowledge,
+ long maxRetryInterval,
+ double retryIntervalMultiplier,
+ int reconnectAttempts,
+ boolean failoverOnShutdown,
+ int scheduledThreadPoolMaxSize,
+ int threadPoolMaxSize,
+ String groupId,
+ int initialMessagePacketSize,
+ boolean useGlobalPools,
+ long retryInterval,
+ String connectionLoadBalancingPolicyClassName) throws Exception
+ {
+ ManagedOperation operation = ManagementSupport.getOperation(managementView, COMPONENT_NAME, "updateConnectionFactory", new ComponentType("JMSManage", "ConnectionFactoryManage"));
+ operation.invoke(new SimpleValueSupport(SimpleMetaType.STRING, name),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, discoveryRefreshTimeout),
+ new SimpleValueSupport(SimpleMetaType.STRING, clientId),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, dupsOkBatchSize),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, transactionBatchSize),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, clientFailureCheckPeriod),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, connectionTTL),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, callTimeout),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, consumerWindowSize),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, confirmationWindowSize),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, producerMaxRate),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, producerWindowSize),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, cacheLargeMessageClient),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, minLargeMessageSize),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, blockOnNonDurableSend),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, blockOnAcknowledge),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, blockOnDurableSend),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, autoGroup),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, preAcknowledge),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, maxRetryInterval),
+ new SimpleValueSupport(SimpleMetaType.DOUBLE_PRIMITIVE, retryIntervalMultiplier),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, reconnectAttempts),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, failoverOnShutdown),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, scheduledThreadPoolMaxSize),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, threadPoolMaxSize),
+ new SimpleValueSupport(SimpleMetaType.STRING, groupId),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, initialMessagePacketSize),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, useGlobalPools),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, retryInterval),
+ new SimpleValueSupport(SimpleMetaType.STRING, connectionLoadBalancingPolicyClassName));
+
+ configurationUpdateReport.setStatus(ConfigurationUpdateStatus.SUCCESS);
+ }
+}
Added: projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSConnectionFactoryDiscoveryComponent.java
===================================================================
--- projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSConnectionFactoryDiscoveryComponent.java (rev 0)
+++ projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSConnectionFactoryDiscoveryComponent.java 2010-03-26 16:19:56 UTC (rev 8970)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.jboss.as.integration.hornetq.jopr;
+
+import org.jboss.as.integration.hornetq.jopr.util.ManagementSupport;
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.metatype.api.values.ArrayValueSupport;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.jboss.as.integration.hornetq.jopr.JMSConstants.ConnectionFactory.COMPONENT_NAME;
+import static org.jboss.as.integration.hornetq.jopr.JMSConstants.ConnectionFactory.COMPONENT_TYPE;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ * Created Mar 19, 2010
+ */
+public class JMSConnectionFactoryDiscoveryComponent implements ResourceDiscoveryComponent
+{
+
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext resourceDiscoveryContext) throws InvalidPluginConfigurationException, Exception
+ {
+ Set<DiscoveredResourceDetails> set = new HashSet<DiscoveredResourceDetails>();
+ JMSComponent context = (JMSComponent) resourceDiscoveryContext.getParentResourceComponent();
+ ManagementView managementView = context.getProfileService();
+ ManagedOperation operation = ManagementSupport.getOperation(managementView, COMPONENT_NAME, "getJMSConnectionFactories", COMPONENT_TYPE);
+
+ ArrayValueSupport value = (ArrayValueSupport) operation.invoke();
+
+ for (int i = 0; i < value.getLength(); i++)
+ {
+ SimpleValueSupport queue = (SimpleValueSupport) value.getValue(i);
+ ResourceType resourceType = resourceDiscoveryContext.getResourceType();
+ String queueName = queue.getValue().toString();
+ set.add(new DiscoveredResourceDetails(resourceType,
+ queueName,
+ queueName,
+ "a JMS ConnectionFactory",
+ "",
+ resourceDiscoveryContext.getDefaultPluginConfiguration(),
+ null));
+ }
+ return set;
+ }
+}
Added: projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSConstants.java
===================================================================
--- projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSConstants.java (rev 0)
+++ projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSConstants.java 2010-03-26 16:19:56 UTC (rev 8970)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.jboss.as.integration.hornetq.jopr;
+
+import org.jboss.managed.api.ComponentType;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ * Created Mar 24, 2010
+ */
+public class JMSConstants
+{
+ interface ConnectionFactory
+ {
+ public static final String COMPONENT_NAME = "JMSConnectionFactoryManageMO";
+
+ public static final ComponentType COMPONENT_TYPE = new ComponentType("JMSManage", "ConnectionFactoryManage");
+ }
+
+ interface Queue
+ {
+ public static final String COMPONENT_NAME = "JMSQueueManageMO";
+
+ public static final ComponentType COMPONENT_TYPE = new ComponentType("JMSDestinationManage", "QueueManage");
+ }
+
+ interface Topic
+ {
+ public static final String COMPONENT_NAME = "JMSTopicManageMO";
+
+ public static final ComponentType COMPONENT_TYPE = new ComponentType("JMSDestinationManage", "TopicManage");
+ }
+}
Added: projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSManagerComponent.java
===================================================================
--- projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSManagerComponent.java (rev 0)
+++ projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSManagerComponent.java 2010-03-26 16:19:56 UTC (rev 8970)
@@ -0,0 +1,423 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.as.integration.hornetq.jopr;
+
+import org.jboss.as.integration.hornetq.jopr.util.ManagementSupport;
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.domain.resource.CreateResourceStatus;
+import org.rhq.core.pluginapi.inventory.*;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ * Created 11-Mar-2010
+ */
+public class JMSManagerComponent implements ResourceComponent, CreateChildResourceFacet, MeasurementFacet, JMSComponent
+{
+ private ResourceContext resourceContext;
+
+ public void getValues(MeasurementReport measurementReport, Set<MeasurementScheduleRequest> measurementScheduleRequests) throws Exception
+ {
+
+ for (MeasurementScheduleRequest measurementScheduleRequest : measurementScheduleRequests)
+ {
+
+ if("version".equalsIgnoreCase(measurementScheduleRequest.getName()))
+ {
+ ManagementView managementView = getProfileService();
+ ManagedOperation operation = ManagementSupport.getOperation(managementView, "JMSServerMO", "getVersion", new ComponentType("JMSManage", "ServerManage"));
+ SimpleValueSupport support = (SimpleValueSupport) operation.invoke();measurementReport.addData(new MeasurementDataTrait(measurementScheduleRequest, support.getValue().toString()));
+ }
+ else if("started".equalsIgnoreCase(measurementScheduleRequest.getName()))
+ {
+ ManagementView managementView = getProfileService();
+ ManagedOperation operation = ManagementSupport.getOperation(managementView, "JMSServerMO", "isStarted", new ComponentType("JMSManage", "ServerManage"));
+ SimpleValueSupport support = (SimpleValueSupport) operation.invoke();measurementReport.addData(new MeasurementDataTrait(measurementScheduleRequest, support.getValue().toString()));
+ }
+ }
+
+ }
+
+ public CreateResourceReport createResource(CreateResourceReport createResourceReport)
+ {
+ createResourceReport.setStatus(CreateResourceStatus.IN_PROGRESS);
+ ManagementView managementView = null;
+ try
+ {
+ managementView = getProfileService();
+ }
+ catch (Exception e)
+ {
+ createResourceReport.setStatus(CreateResourceStatus.FAILURE);
+ createResourceReport.setErrorMessage(e.getMessage());
+ e.printStackTrace();
+ return createResourceReport;
+ }
+ Map<String, PropertySimple> simpleProps = createResourceReport.getResourceConfiguration().getSimpleProperties();
+
+
+ try
+ {
+ if ("JMS Connection Factory".equalsIgnoreCase(createResourceReport.getResourceType().getName()))
+ {
+
+ String name = simpleProps.get("name").getStringValue();
+ String liveTransportClassNames = simpleProps.get("liveTransportClassNames").getStringValue();
+ String liveTransportParams = simpleProps.get("liveTransportParams").getStringValue();
+ String backupTransportClassNames = simpleProps.get("backupTransportClassNames").getStringValue();
+ String backupTransportParams = simpleProps.get("backupTransportParams").getStringValue();
+ String bindings = simpleProps.get("Bindings").getStringValue();
+ String discoveryAddress = simpleProps.get("DiscoveryAddress").getStringValue();
+ int discoveryPort = simpleProps.get("DiscoveryPort").getIntegerValue();
+ long discoveryRefreshTimeout = simpleProps.get("DiscoveryRefreshTimeout").getLongValue();
+ String clientId = simpleProps.get("ClientID").getStringValue();
+ int dupsOkBatchSize = simpleProps.get("DupsOKBatchSize").getIntegerValue();
+ int transactionBatchSize = simpleProps.get("TransactionBatchSize").getIntegerValue();
+ long clientFailureCheckPeriod = simpleProps.get("ClientFailureCheckPeriod").getLongValue();
+ long connectionTTL = simpleProps.get("ConnectionTTL").getLongValue();
+ long callTimeout = simpleProps.get("CallTimeout").getLongValue();
+ int consumerWindowSize = simpleProps.get("ConsumerWindowSize").getIntegerValue();
+ int confirmationWindowSize = simpleProps.get("ConfirmationWindowSize").getIntegerValue();
+ int producerMaxRate = simpleProps.get("ProducerMaxRate").getIntegerValue();
+ int producerWindowSize = simpleProps.get("ProducerWindowSize").getIntegerValue();
+ boolean cacheLargeMessageClient = simpleProps.get("CacheLargeMessagesClient").getBooleanValue();
+ int minLargeMessageSize = simpleProps.get("MinLargeMessageSize").getIntegerValue();
+ boolean blockOnNonDurableSend = simpleProps.get("BlockOnNonDurableSend").getBooleanValue();
+ boolean blockOnAcknowledge = simpleProps.get("BlockOnAcknowledge").getBooleanValue();
+ boolean blockOnDurableSend = simpleProps.get("BlockOnDurableSend").getBooleanValue();
+ boolean autoGroup = simpleProps.get("AutoGroup").getBooleanValue();
+ boolean preAcknowledge = simpleProps.get("PreAcknowledge").getBooleanValue();
+ long maxRetryInterval = simpleProps.get("MaxRetryInterval").getLongValue();
+ double retryIntervalMultiplier = simpleProps.get("RetryIntervalMultiplier").getDoubleValue();
+ int reconnectAttempts = simpleProps.get("ReconnectAttempts").getIntegerValue();
+ boolean failoverOnShutdown = simpleProps.get("FailoverOnServerShutdown").getBooleanValue();
+ int scheduledThreadPoolMaxSize = simpleProps.get("ScheduledThreadPoolMaxSize").getIntegerValue();
+ int threadPoolMaxSize = simpleProps.get("ThreadPoolMaxSize").getIntegerValue();
+ String groupId = simpleProps.get("GroupID").getStringValue();
+ int initialMessagePacketSize = simpleProps.get("InitialMessagePacketSize").getIntegerValue();
+ boolean useGlobalPools = simpleProps.get("UseGlobalPools").getBooleanValue();
+ long retryInterval = simpleProps.get("RetryInterval").getLongValue();
+ String connectionLoadBalancingPolicyClassName = simpleProps.get("ConnectionLoadBalancingPolicyClassName").getStringValue();
+ createConnectionFactory(createResourceReport, managementView, name,liveTransportClassNames, liveTransportParams, backupTransportClassNames, backupTransportParams, bindings, discoveryAddress, discoveryPort, discoveryRefreshTimeout, clientId, dupsOkBatchSize, transactionBatchSize, clientFailureCheckPeriod, connectionTTL, callTimeout, consumerWindowSize, confirmationWindowSize, producerMaxRate, producerWindowSize, cacheLargeMessageClient, minLargeMessageSize, blockOnNonDurableSend, blockOnAcknowledge, blockOnDurableSend, autoGroup, preAcknowledge, maxRetryInterval, retryIntervalMultiplier, reconnectAttempts, failoverOnShutdown, scheduledThreadPoolMaxSize, threadPoolMaxSize, groupId, initialMessagePacketSize, useGlobalPools, retryInterval, connectionLoadBalancingPolicyClassName);
+ }
+ else
+ {
+ String name = simpleProps.get("name").getStringValue();
+ String jndiName = simpleProps.get("jndiBindings").getStringValue();
+ String DLA = simpleProps.get("dla").getStringValue();
+ String expiryAddress = simpleProps.get("expiryAddress").getStringValue();
+ int maxSize = simpleProps.get("maxSize").getIntegerValue();
+ int pageSize = simpleProps.get("pageSize").getIntegerValue();
+ int maxDeliveryAttempts = simpleProps.get("maxDeliveryAttempts").getIntegerValue();
+ long redeliveryDelay = simpleProps.get("redeliveryDelay").getLongValue();
+ boolean lastValueQueue = simpleProps.get("lastValueQueue").getBooleanValue();
+ long redistributionDelay = simpleProps.get("redistributionDelay").getLongValue();
+ boolean sendToDLAOnNoRoute = simpleProps.get("sendToDLAOnNoRoute").getBooleanValue();
+ String addressFullMessagePolicy = simpleProps.get("addressFullMessagePolicy").getStringValue();
+ if ("JMS Queue".equalsIgnoreCase(createResourceReport.getResourceType().getName()))
+ {
+ createQueue(createResourceReport, managementView, name, jndiName, DLA, expiryAddress, maxSize, pageSize, maxDeliveryAttempts, redeliveryDelay, lastValueQueue, redistributionDelay, sendToDLAOnNoRoute, addressFullMessagePolicy);
+ }
+ else if ("JMS Topic".equalsIgnoreCase(createResourceReport.getResourceType().getName()))
+ {
+ createTopic(createResourceReport, managementView, name, jndiName, DLA, expiryAddress, maxSize, pageSize, maxDeliveryAttempts, redeliveryDelay, lastValueQueue, redistributionDelay, sendToDLAOnNoRoute, addressFullMessagePolicy);
+ }
+ }
+
+
+ }
+ catch (Exception e)
+ {
+ createResourceReport.setStatus(CreateResourceStatus.FAILURE);
+ createResourceReport.setErrorMessage(e.getMessage());
+ e.printStackTrace();
+ }
+ return createResourceReport;
+ }
+
+ private void createConnectionFactory(CreateResourceReport createResourceReport, ManagementView managementView, String name,String liveTransportClassNames, String liveTransportParams, String backupTransportClassNames, String backupTransportParams, String bindings, String discoveryAddress, int discoveryPort, long discoveryRefreshTimeout, String clientId, int dupsOkBatchSize, int transactionBatchSize, long clientFailureCheckPeriod, long connectionTTL, long callTimeout, int consumerWindowSize, int confirmationWindowSize, int producerMaxRate, int producerWindowSize, boolean cacheLargeMessageClient, int minLargeMessageSize, boolean blockOnNonDurableSend, boolean blockOnAcknowledge, boolean blockOnDurableSend, boolean autoGroup, boolean preAcknowledge, long maxRetryInterval, double retryIntervalMultiplier, int reconnectAttempts, boolean failoverOnShutdown, int scheduledThreadPoolMaxSize, int threadPoolMaxSize, String groupId, int initialMessagePacketSize, boolean useGlobalPool!
s, long retryInterval, String connectionLoadBalancingPolicyClassName)
+ throws Exception
+ {
+ ManagedOperation operation = ManagementSupport.getOperation(managementView, JMSConstants.ConnectionFactory.COMPONENT_NAME, "createConnectionFactory", JMSConstants.ConnectionFactory.COMPONENT_TYPE);
+ operation.invoke(new SimpleValueSupport(SimpleMetaType.STRING, name),
+ new SimpleValueSupport(SimpleMetaType.STRING, liveTransportClassNames),
+ new SimpleValueSupport(SimpleMetaType.STRING, liveTransportParams),
+ new SimpleValueSupport(SimpleMetaType.STRING, backupTransportClassNames),
+ new SimpleValueSupport(SimpleMetaType.STRING, backupTransportParams),
+ new SimpleValueSupport(SimpleMetaType.STRING, bindings),
+ new SimpleValueSupport(SimpleMetaType.STRING, discoveryAddress),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, discoveryPort),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, discoveryRefreshTimeout),
+ new SimpleValueSupport(SimpleMetaType.STRING, clientId),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, dupsOkBatchSize),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, transactionBatchSize),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, clientFailureCheckPeriod),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, connectionTTL),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, callTimeout),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, consumerWindowSize),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, confirmationWindowSize),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, producerMaxRate),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, producerWindowSize),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, cacheLargeMessageClient),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, minLargeMessageSize),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, blockOnNonDurableSend),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, blockOnAcknowledge),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, blockOnDurableSend),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, autoGroup),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, preAcknowledge),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, maxRetryInterval),
+ new SimpleValueSupport(SimpleMetaType.DOUBLE_PRIMITIVE, retryIntervalMultiplier),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, reconnectAttempts),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, failoverOnShutdown),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, scheduledThreadPoolMaxSize),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, threadPoolMaxSize),
+ new SimpleValueSupport(SimpleMetaType.STRING, groupId),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, initialMessagePacketSize),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, useGlobalPools),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, retryInterval),
+ new SimpleValueSupport(SimpleMetaType.STRING, connectionLoadBalancingPolicyClassName));
+
+ createResourceReport.setStatus(CreateResourceStatus.SUCCESS);
+ createResourceReport.setResourceKey(name);
+ createResourceReport.setResourceName(name);
+ }
+
+ private void createQueue(CreateResourceReport createResourceReport, ManagementView managementView, String name, String jndiName, String DLA, String expiryAddress, int maxSize, int pageSize, int maxDeliveryAttempts, long redeliveryDelay, boolean lastValueQueue, long redistributionDelay, boolean sendToDLAOnNoRoute, String addressFullMessagePolicy)
+ throws Exception
+ {
+ ManagedOperation operation = ManagementSupport.getOperation(managementView, JMSConstants.Queue.COMPONENT_NAME, "createQueue", JMSConstants.Queue.COMPONENT_TYPE);
+
+ StringBuffer sendRoles = new StringBuffer();
+ StringBuffer consumeRoles = new StringBuffer();
+ createRoles(createResourceReport, name, sendRoles, consumeRoles);
+
+ operation.invoke(new SimpleValueSupport(SimpleMetaType.STRING, name),
+ new SimpleValueSupport(SimpleMetaType.STRING, jndiName),
+ new SimpleValueSupport(SimpleMetaType.STRING, DLA),
+ new SimpleValueSupport(SimpleMetaType.STRING, expiryAddress),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, maxSize),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, pageSize),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, maxDeliveryAttempts),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, redeliveryDelay),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, lastValueQueue),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, redistributionDelay),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, sendToDLAOnNoRoute),
+ new SimpleValueSupport(SimpleMetaType.STRING, addressFullMessagePolicy),
+ new SimpleValueSupport(SimpleMetaType.STRING, sendRoles.toString()),
+ new SimpleValueSupport(SimpleMetaType.STRING, consumeRoles.toString()));
+ createResourceReport.setStatus(CreateResourceStatus.SUCCESS);
+ createResourceReport.setResourceKey("jms.queue." + name);
+ createResourceReport.setResourceName("jms.queue." + name);
+ }
+
+ private void createTopic(CreateResourceReport createResourceReport, ManagementView managementView, String name, String jndiName, String DLA, String expiryAddress, int maxSize, int pageSize, int maxDeliveryAttempts, long redeliveryDelay, boolean lastValueQueue, long redistributionDelay, boolean sendToDLAOnNoRoute, String addressFullMessagePolicy)
+ throws Exception
+ {
+ ManagedOperation operation = ManagementSupport.getOperation(managementView, JMSConstants.Topic.COMPONENT_NAME,
+ "createTopic", JMSConstants.Topic.COMPONENT_TYPE);
+
+ StringBuffer sendRoles = new StringBuffer();
+ StringBuffer consumeRoles = new StringBuffer();
+ StringBuffer createNonDurableRoles = new StringBuffer();
+ StringBuffer deleteNonDurableRoles = new StringBuffer();
+ StringBuffer createDurableRoles = new StringBuffer();
+ StringBuffer deleteDurableRoles = new StringBuffer();
+ createRoles(createResourceReport, name, sendRoles, consumeRoles, createNonDurableRoles, deleteNonDurableRoles, createDurableRoles, deleteDurableRoles);
+
+ operation.invoke(new SimpleValueSupport(SimpleMetaType.STRING, name),
+ new SimpleValueSupport(SimpleMetaType.STRING, jndiName),
+ new SimpleValueSupport(SimpleMetaType.STRING, DLA),
+ new SimpleValueSupport(SimpleMetaType.STRING, expiryAddress),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, maxSize),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, pageSize),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, maxDeliveryAttempts),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, redeliveryDelay),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, lastValueQueue),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, redistributionDelay),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, sendToDLAOnNoRoute),
+ new SimpleValueSupport(SimpleMetaType.STRING, addressFullMessagePolicy),
+ new SimpleValueSupport(SimpleMetaType.STRING, sendRoles.toString()),
+ new SimpleValueSupport(SimpleMetaType.STRING, consumeRoles.toString()),
+ new SimpleValueSupport(SimpleMetaType.STRING, createDurableRoles.toString()),
+ new SimpleValueSupport(SimpleMetaType.STRING, deleteDurableRoles.toString()),
+ new SimpleValueSupport(SimpleMetaType.STRING, createNonDurableRoles.toString()),
+ new SimpleValueSupport(SimpleMetaType.STRING, deleteNonDurableRoles.toString()));
+ createResourceReport.setStatus(CreateResourceStatus.SUCCESS);
+ createResourceReport.setResourceKey("jms.topic." + name);
+ createResourceReport.setResourceName("jms.topic." + name);
+ }
+
+
+ public void start(ResourceContext resourceContext) throws InvalidPluginConfigurationException, Exception
+ {
+ this.resourceContext = resourceContext;
+ }
+
+ public void stop()
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public AvailabilityType getAvailability()
+ {
+ return AvailabilityType.UP;
+ }
+
+ public ManagementView getProfileService() throws Exception
+ {
+ ResourceComponent component = resourceContext.getParentResourceComponent();
+ Method m = component.getClass().getMethod("getConnection");
+ Object conn = m.invoke(component);
+ m = conn.getClass().getMethod("getManagementView");
+ return (ManagementView) m.invoke(conn);
+ }
+
+ private void createRoles(CreateResourceReport configurationUpdateReport, String name, StringBuffer sendRoles, StringBuffer consumeRoles)
+ {
+ PropertyList propertyList = (PropertyList) configurationUpdateReport.getResourceConfiguration().get("roles");
+ List<Property> roles = propertyList.getList();
+ for (Property role : roles)
+ {
+ PropertyMap actRole = (PropertyMap) role;
+ boolean send;
+ boolean consume;
+ PropertySimple simple = (PropertySimple) actRole.get("name");
+ name = simple.getStringValue();
+ simple = (PropertySimple) actRole.get("send");
+ send = simple.getBooleanValue();
+ simple = (PropertySimple) actRole.get("consume");
+ consume = simple.getBooleanValue();
+ if (send)
+ {
+ if (sendRoles.length() > 0)
+ {
+ sendRoles.append(",");
+ }
+ sendRoles.append(name);
+ }
+ if (consume)
+ {
+ if (consumeRoles.length() > 0)
+ {
+ consumeRoles.append(",");
+ }
+ consumeRoles.append(name);
+ }
+ }
+ }
+
+ private void createRoles(CreateResourceReport configurationUpdateReport, String name, StringBuffer sendRoles, StringBuffer consumeRoles, StringBuffer createNonDurableRoles, StringBuffer deleteNonDurableRoles, StringBuffer createDurableRoles, StringBuffer deleteDurableRoles)
+ {
+ PropertyList propertyList = (PropertyList) configurationUpdateReport.getResourceConfiguration().get("roles");
+ List<Property> roles = propertyList.getList();
+ for (Property role : roles)
+ {
+ PropertyMap actRole = (PropertyMap) role;
+ boolean send;
+ boolean consume;
+ boolean createNonDurableQueue;
+ boolean deleteNonDurableQueue;
+ boolean createDurableQueue;
+ boolean deleteDurableQueue;
+ PropertySimple simple = (PropertySimple) actRole.get("name");
+ name = simple.getStringValue();
+ simple = (PropertySimple) actRole.get("send");
+ send = simple.getBooleanValue();
+ simple = (PropertySimple) actRole.get("consume");
+ consume = simple.getBooleanValue();
+ simple = (PropertySimple) actRole.get("createNonDurableQueue");
+ createNonDurableQueue = simple.getBooleanValue();
+ simple = (PropertySimple) actRole.get("deleteNonDurableQueue");
+ deleteNonDurableQueue = simple.getBooleanValue();
+ simple = (PropertySimple) actRole.get("createDurableQueue");
+ createDurableQueue = simple.getBooleanValue();
+ simple = (PropertySimple) actRole.get("deleteDurableQueue");
+ deleteDurableQueue = simple.getBooleanValue();
+ if (send)
+ {
+ if (sendRoles.length() > 0)
+ {
+ sendRoles.append(",");
+ }
+ sendRoles.append(name);
+ }
+ if (consume)
+ {
+ if (consumeRoles.length() > 0)
+ {
+ consumeRoles.append(",");
+ }
+ consumeRoles.append(name);
+ }
+ if (createDurableQueue)
+ {
+ if (createDurableRoles.length() > 0)
+ {
+ createDurableRoles.append(",");
+ }
+ createDurableRoles.append(name);
+ }
+ if (deleteDurableQueue)
+ {
+ if (deleteDurableRoles.length() > 0)
+ {
+ deleteDurableRoles.append(",");
+ }
+ deleteDurableRoles.append(name);
+ }
+ if (createNonDurableQueue)
+ {
+ if (createNonDurableRoles.length() > 0)
+ {
+ createNonDurableRoles.append(",");
+ }
+ createNonDurableRoles.append(name);
+ }
+ if (deleteNonDurableQueue)
+ {
+ if (deleteNonDurableRoles.length() > 0)
+ {
+ deleteNonDurableRoles.append(",");
+ }
+ deleteNonDurableRoles.append(name);
+ }
+ }
+ }
+}
Added: projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSManagerDiscoveryComponent.java
===================================================================
--- projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSManagerDiscoveryComponent.java (rev 0)
+++ projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSManagerDiscoveryComponent.java 2010-03-26 16:19:56 UTC (rev 8970)
@@ -0,0 +1,67 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.as.integration.hornetq.jopr;
+
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedComponent;
+import org.rhq.core.pluginapi.inventory.*;
+
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ * Created 11-Mar-2010
+ */
+public class JMSManagerDiscoveryComponent implements ResourceDiscoveryComponent
+{
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext ctx) throws InvalidPluginConfigurationException, Exception
+ {
+ ManagementView managementView = getProfileService(ctx);
+ ManagedComponent component = managementView.getComponent("JMSServerMO", new ComponentType("JMSManage", "ServerManage"));
+ if(component != null)
+ {
+ DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
+ ctx.getResourceType(), // Resource type
+ ctx.getResourceType().getName(), // Resource key
+ ctx.getResourceType().getName(), // Resource name
+ null, // Resource version
+ ctx.getResourceType().getDescription(), // Description
+ ctx.getDefaultPluginConfiguration(), // Plugin config
+ null // Process info from a process scan
+ );
+ return Collections.singleton(detail);
+ }
+ return Collections.EMPTY_SET;
+ }
+
+ public ManagementView getProfileService(ResourceDiscoveryContext ctx) throws Exception
+ {
+ ResourceComponent component = ctx.getParentResourceComponent();
+ Method m = component.getClass().getMethod("getConnection");
+ Object conn = m.invoke(component);
+ m = conn.getClass().getMethod("getManagementView");
+ return (ManagementView) m.invoke(conn);
+ }
+}
Added: projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSQueueComponent.java
===================================================================
--- projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSQueueComponent.java (rev 0)
+++ projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSQueueComponent.java 2010-03-26 16:19:56 UTC (rev 8970)
@@ -0,0 +1,338 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.as.integration.hornetq.jopr;
+
+import org.jboss.as.integration.hornetq.jopr.util.ManagementSupport;
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.metatype.api.types.ImmutableCompositeMetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.CollectionValueSupport;
+import org.jboss.metatype.api.values.CompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.rhq.core.domain.configuration.*;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.core.pluginapi.operation.OperationFacet;
+import org.rhq.core.pluginapi.operation.OperationResult;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static org.jboss.as.integration.hornetq.jopr.JMSConstants.Queue.COMPONENT_NAME;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ * Created: 17-Mar-2010
+ */
+public class JMSQueueComponent extends JMSResourceComponent implements ResourceComponent, MeasurementFacet, OperationFacet, ConfigurationFacet
+{
+ @Override
+ String getMeasurementsOperationName()
+ {
+ return "getQueueMeasurements";
+ }
+
+ public AvailabilityType getAvailability()
+ {
+ try
+ {
+ ManagementView view = getProfileService();
+ ManagedOperation operation = ManagementSupport.getOperation(view, getComponentName(), "isPaused", getComponentType());
+ SimpleValueSupport val = (SimpleValueSupport) operation.invoke(new SimpleValueSupport(SimpleMetaType.STRING, resourceContext.getResourceKey()));
+ boolean paused = ((Boolean)val.getValue()).booleanValue();
+ return paused ? AvailabilityType.DOWN : AvailabilityType.UP;
+ }
+ catch (Exception e)
+ {
+ return AvailabilityType.DOWN;
+ }
+ }
+
+ @Override
+ String getComponentName()
+ {
+ return COMPONENT_NAME;
+ }
+
+ @Override
+ ComponentType getComponentType()
+ {
+ return JMSConstants.Queue.COMPONENT_TYPE;
+ }
+
+ @Override
+ String getConfigurationOperationName()
+ {
+ return "getQueueConfiguration";
+ }
+
+ @Override
+ protected String getInvokeOperation()
+ {
+ return "invokeQueueOperation";
+ }
+
+ @Override
+ protected String getInvokeOperationJMSMessage()
+ {
+ return "invokeQueueOperationMessageType";
+ }
+
+ @Override
+ protected String getInvokeOperationSubscriptionMessage()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ String getDeleteOperationName()
+ {
+ return "deleteQueue";
+ }
+
+ public void updateResourceConfiguration(ConfigurationUpdateReport configurationUpdateReport)
+ {
+ configurationUpdateReport.setStatus(ConfigurationUpdateStatus.INPROGRESS);
+
+ ManagementView view = null;
+ try
+ {
+ view = getProfileService();
+ }
+ catch (Exception e)
+ {
+ configurationUpdateReport.setStatus(ConfigurationUpdateStatus.FAILURE);
+ configurationUpdateReport.setErrorMessage(e.getMessage());
+ e.printStackTrace();
+ return;
+ }
+ Map<String, PropertySimple> simpleProps = configurationUpdateReport.getConfiguration().getSimpleProperties();
+ String name = simpleProps.get("name").getStringValue();
+ String jndiName = simpleProps.get("jndiBindings").getStringValue();
+ String DLA = simpleProps.get("dla").getStringValue();
+ String expiryAddress = simpleProps.get("expiryAddress").getStringValue();
+ int maxSize = simpleProps.get("maxSize").getIntegerValue();
+ int pageSize = simpleProps.get("pageSize").getIntegerValue();
+ int maxDeliveryAttempts = simpleProps.get("maxDeliveryAttempts").getIntegerValue();
+ long redeliveryDelay = simpleProps.get("redeliveryDelay").getLongValue();
+ boolean lastValueQueue = simpleProps.get("lastValueQueue").getBooleanValue();
+ long redistributionDelay = simpleProps.get("redistributionDelay").getLongValue();
+ boolean sendToDLAOnNoRoute = simpleProps.get("sendToDLAOnNoRoute").getBooleanValue();
+ String addressFullMessagePolicy = simpleProps.get("addressFullMessagePolicy").getStringValue();
+
+
+ StringBuffer sendRoles = new StringBuffer();
+ StringBuffer consumeRoles = new StringBuffer();
+ createRoles(configurationUpdateReport, name, sendRoles, consumeRoles);
+ try
+ {
+ ManagedOperation operation = ManagementSupport.getOperation(view, JMSConstants.Queue.COMPONENT_NAME, "updateQueueConfiguration", JMSConstants.Queue.COMPONENT_TYPE);
+ operation.invoke(new SimpleValueSupport(SimpleMetaType.STRING, resourceContext.getResourceKey()),
+ new SimpleValueSupport(SimpleMetaType.STRING, jndiName),
+ new SimpleValueSupport(SimpleMetaType.STRING, DLA),
+ new SimpleValueSupport(SimpleMetaType.STRING, expiryAddress),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, maxSize),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, pageSize),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, maxDeliveryAttempts),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, redeliveryDelay),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, lastValueQueue),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, redistributionDelay),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, sendToDLAOnNoRoute),
+ new SimpleValueSupport(SimpleMetaType.STRING, addressFullMessagePolicy),
+ new SimpleValueSupport(SimpleMetaType.STRING, sendRoles.toString()),
+ new SimpleValueSupport(SimpleMetaType.STRING, consumeRoles.toString()));
+ }
+ catch (Exception e)
+ {
+ configurationUpdateReport.setStatus(ConfigurationUpdateStatus.FAILURE);
+ configurationUpdateReport.setErrorMessage(e.getMessage());
+ e.printStackTrace();
+ return;
+ }
+ configurationUpdateReport.setStatus(ConfigurationUpdateStatus.SUCCESS);
+ }
+
+ private void createRoles(ConfigurationUpdateReport configurationUpdateReport, String name, StringBuffer sendRoles, StringBuffer consumeRoles)
+ {
+ PropertyList propertyList = (PropertyList) configurationUpdateReport.getConfiguration().get("securityConfig");
+ if(propertyList == null)
+ {
+ return;
+ }
+ List<Property> roles = propertyList.getList();
+ for (Property role : roles)
+ {
+ PropertyMap actRole = (PropertyMap) role;
+ boolean send;
+ boolean consume;
+ PropertySimple simple = (PropertySimple) actRole.get("name");
+ name = simple.getStringValue();
+ simple = (PropertySimple) actRole.get("send");
+ send = simple.getBooleanValue();
+ simple = (PropertySimple) actRole.get("consume");
+ consume = simple.getBooleanValue();
+ if(send)
+ {
+ if(sendRoles.length() > 0)
+ {
+ sendRoles.append(",");
+ }
+ sendRoles.append(name);
+ }
+ if(consume)
+ {
+ if(consumeRoles.length() > 0)
+ {
+ consumeRoles.append(",");
+ }
+ consumeRoles.append(name);
+ }
+ }
+ }
+
+ private void populateParams(final Collection<PropertySimple> props, final SimpleValueSupport[] params, final SimpleValueSupport[] signature)
+ {
+ int pos = 0;
+ for (PropertySimple prop : props)
+ {
+ String[] val = prop.getName().split(":");
+ if (val.length == 1)
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getStringValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "java.lang.String");
+ }
+ else
+ {
+ if (val[0].equals("Boolean"))
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getBooleanValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "java.lang.Boolean");
+ }
+ else if (val[0].equals("boolean"))
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getBooleanValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "boolean");
+ }
+ else if (val[0].equals("String"))
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getStringValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "java.lang.String");
+ }
+ else if (val[0].equals("Long"))
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getLongValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "java.lang.Long");
+ }
+ else if (val[0].equals("long"))
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getLongValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "long");
+ }
+ else if (val[0].equals("Integer"))
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getIntegerValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "java.lang.Integer");
+ }
+ else if (val[0].equals("int"))
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getIntegerValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "int");
+ }
+ else if (val[0].equals("Double"))
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getDoubleValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "java.lang.Double");
+ }
+ else if (val[0].equals("double"))
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getDoubleValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "double");
+ }
+ }
+ pos++;
+ }
+ }
+
+ private String getStringValue(Object o)
+ {
+ return o == null ? "null" : o.toString();
+ }
+
+
+ private OperationResult formatResults(Object val, String type) throws Exception
+ {
+ if (type == null)
+ {
+ SimpleValueSupport valueSupport = (SimpleValueSupport) val;
+ return new OperationResult(valueSupport.getValue().toString());
+ }
+ else if(type.equalsIgnoreCase("String"))
+ {
+ SimpleValueSupport valueSupport = (SimpleValueSupport) val;
+ return new OperationResult(valueSupport.getValue().toString());
+ }
+ else if(type.equalsIgnoreCase("JMSMessage"))
+ {
+ OperationResult operationResult = new OperationResult();
+ Configuration c = operationResult.getComplexResults();
+ PropertyList property = new PropertyList("result");
+ CollectionValueSupport valueSupport = (CollectionValueSupport) val;
+ MetaValue[] msgs = valueSupport.getElements();
+ for (MetaValue mv : msgs)
+ {
+ CompositeValueSupport msg = (CompositeValueSupport) mv;
+ org.rhq.core.domain.configuration.PropertyMap p1 = new org.rhq.core.domain.configuration.PropertyMap("element");
+ property.add(p1);
+ ImmutableCompositeMetaType metaType = (ImmutableCompositeMetaType) msg.getMetaType();
+ Set<String> keys = metaType.keySet();
+ for (String key : keys)
+ {
+ SimpleValueSupport sattr = (SimpleValueSupport) msg.get(key);
+ p1.put(new PropertySimple(key,sattr.getValue()));
+ }
+ }
+ c.put(property);
+ return operationResult;
+ }
+ else if (val instanceof CompositeValueSupport)
+ {
+ CompositeValueSupport valueSupport = (CompositeValueSupport) val;
+ if (valueSupport.containsKey("cause"))
+ {
+ CompositeValueSupport cause = (CompositeValueSupport) valueSupport.get("cause");
+ SimpleValueSupport message = (SimpleValueSupport) cause.get("message");
+ Exception exception = new Exception(message.toString());
+ throw exception;
+ }
+ return new OperationResult("not yet");
+ }
+ return new OperationResult("not yet");
+ }
+}
\ No newline at end of file
Added: projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSQueueDiscoveryComponent.java
===================================================================
--- projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSQueueDiscoveryComponent.java (rev 0)
+++ projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSQueueDiscoveryComponent.java 2010-03-26 16:19:56 UTC (rev 8970)
@@ -0,0 +1,68 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.as.integration.hornetq.jopr;
+
+import org.jboss.as.integration.hornetq.jopr.util.ManagementSupport;
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.metatype.api.values.ArrayValueSupport;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public class JMSQueueDiscoveryComponent implements ResourceDiscoveryComponent
+{
+
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext resourceDiscoveryContext) throws InvalidPluginConfigurationException, Exception
+ {
+ Set<DiscoveredResourceDetails> set = new HashSet<DiscoveredResourceDetails>();
+ JMSComponent context = (JMSComponent) resourceDiscoveryContext.getParentResourceComponent();
+ ManagementView managementView = context.getProfileService();
+ ManagedOperation operation = ManagementSupport.getOperation(managementView, JMSConstants.Queue.COMPONENT_NAME, "getJMSQueues", JMSConstants.Queue.COMPONENT_TYPE);
+
+ ArrayValueSupport value = (ArrayValueSupport) operation.invoke();
+
+ for (int i = 0; i < value.getLength(); i++)
+ {
+ SimpleValueSupport queue = (SimpleValueSupport) value.getValue(i);
+ ResourceType resourceType = resourceDiscoveryContext.getResourceType();
+ String queueName = "jms.queue." + queue.getValue();
+ set.add(new DiscoveredResourceDetails(resourceType,
+ queueName,
+ queueName,
+ "a JMS Queue",
+ "",
+ resourceDiscoveryContext.getDefaultPluginConfiguration(),
+ null));
+ }
+ return set;
+ }
+}
Added: projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSResourceComponent.java
===================================================================
--- projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSResourceComponent.java (rev 0)
+++ projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSResourceComponent.java 2010-03-26 16:19:56 UTC (rev 8970)
@@ -0,0 +1,340 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.as.integration.hornetq.jopr;
+
+import org.jboss.as.integration.hornetq.jopr.util.ManagementSupport;
+import org.jboss.as.integration.hornetq.jopr.util.Operation;
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.metatype.api.types.ArrayMetaType;
+import org.jboss.metatype.api.types.ImmutableCompositeMetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.*;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinition;
+import org.rhq.core.domain.measurement.*;
+import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
+import org.rhq.core.pluginapi.inventory.DeleteResourceFacet;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.core.pluginapi.operation.OperationFacet;
+import org.rhq.core.pluginapi.operation.OperationResult;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ * Created: 17-Mar-2010
+ */
+public abstract class JMSResourceComponent implements ResourceComponent, MeasurementFacet, OperationFacet, ConfigurationFacet, JMSComponent, DeleteResourceFacet
+{
+ protected ResourceContext resourceContext;
+ private JMSComponent jmsComponent;
+
+ public AvailabilityType getAvailability()
+ {
+ return AvailabilityType.UP;
+ }
+
+ public void deleteResource() throws Exception
+ {
+ ManagementView view = getProfileService();
+ ManagedOperation operation = ManagementSupport.getOperation(view, getComponentName(), getDeleteOperationName(), getComponentType());
+ operation.invoke(new SimpleValueSupport(SimpleMetaType.STRING, resourceContext.getResourceKey()));
+ }
+
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> measurementScheduleRequests) throws Exception
+ {
+ ArrayValueSupport support = new ArrayValueSupport(new ArrayMetaType(SimpleMetaType.STRING, false));
+ SimpleValueSupport[] valueSupports = new SimpleValueSupport[measurementScheduleRequests.size()];
+ Iterator<MeasurementScheduleRequest> it = measurementScheduleRequests.iterator();
+ for (int i = 0, valueSupportsLength = valueSupports.length; i < valueSupportsLength; i++)
+ {
+ valueSupports[i] = new SimpleValueSupport(SimpleMetaType.STRING, it.next().getName());
+ }
+ support.setValue(valueSupports);
+ ManagementView view = getProfileService();
+
+ ManagedOperation operation = ManagementSupport.getOperation(view, getComponentName(), getMeasurementsOperationName(), getComponentType());
+ ArrayValueSupport vals = (ArrayValueSupport) operation.invoke(new SimpleValueSupport(SimpleMetaType.STRING, resourceContext.getResourceKey()), support);
+ it = measurementScheduleRequests.iterator();
+ for (int i = 0, valueSupportsLength = valueSupports.length; i < valueSupportsLength; i++)
+ {
+ MeasurementScheduleRequest request = it.next();
+ SimpleValueSupport simpleValueSupport = (SimpleValueSupport) vals.getValue(i);
+ simpleValueSupport.getValue();
+ if (request.getDataType().equals(DataType.MEASUREMENT))
+ {
+ report.addData(new MeasurementDataNumeric(request, Double.valueOf(simpleValueSupport.getValue().toString())));
+ }
+ else if (request.getDataType().equals(DataType.TRAIT))
+ {
+ report.addData(new MeasurementDataTrait(request, simpleValueSupport.getValue().toString()));
+ }
+ }
+ }
+
+ public Configuration loadResourceConfiguration() throws Exception
+ {
+ Configuration config = new Configuration();
+ ManagementView view = getProfileService();
+
+ ManagedOperation operation = ManagementSupport.getOperation(view, getComponentName(), getConfigurationOperationName(), getComponentType());
+
+ CompositeValueSupport val = (CompositeValueSupport) operation.invoke(new SimpleValueSupport(SimpleMetaType.STRING, resourceContext.getResourceKey()));
+
+ ConfigurationDefinition configDef = resourceContext.getResourceType().getResourceConfigurationDefinition();
+ List<PropertyDefinition> propertyDefinitionList = configDef.getPropertiesInGroup("HornetQCustomProperties");
+ for (PropertyDefinition definition : propertyDefinitionList)
+ {
+ String name = definition.getName();
+ if (val.containsKey(name))
+ {
+ MetaValue mv = val.get(name);
+ if(mv instanceof SimpleValueSupport)
+ {
+ SimpleValueSupport attr = (SimpleValueSupport) mv;
+ PropertySimple simple = new PropertySimple(name, attr.getValue());
+ config.put(simple);
+ }
+ else if(mv instanceof CollectionValueSupport)
+ {
+ PropertyList property = new PropertyList("securityConfig");
+ CollectionValueSupport valueSupport = (CollectionValueSupport) mv;
+ MetaValue[] msgs = valueSupport.getElements();
+ for (MetaValue mv2 : msgs)
+ {
+ CompositeValueSupport msg = (CompositeValueSupport) mv2;
+ org.rhq.core.domain.configuration.PropertyMap p1 = new org.rhq.core.domain.configuration.PropertyMap("element");
+ property.add(p1);
+ ImmutableCompositeMetaType metaType = (ImmutableCompositeMetaType) msg.getMetaType();
+ Set<String> keys = metaType.keySet();
+ for (String key : keys)
+ {
+ SimpleValueSupport sattr = (SimpleValueSupport) msg.get(key);
+ if(sattr != null)
+ p1.put(new PropertySimple(key,sattr.getValue()));
+ }
+ }
+ config.put(property);
+ }
+ }
+ }
+ return config;
+ }
+
+ public OperationResult invokeOperation(String s, Configuration configuration) throws InterruptedException, Exception
+ {
+ Operation oper = Operation.getOperation(s);
+ Collection<PropertySimple> props = configuration.getSimpleProperties().values();
+ SimpleValueSupport[] params = new SimpleValueSupport[props.size()];
+ SimpleValueSupport[] signature = new SimpleValueSupport[props.size()];
+ populateParams(props, params, signature);
+ ArrayValueSupport param = new ArrayValueSupport(new ArrayMetaType(SimpleMetaType.STRING, false));
+ param.setValue(params);
+ ArrayValueSupport sig = new ArrayValueSupport(new ArrayMetaType(SimpleMetaType.STRING, false));
+ sig.setValue(signature);
+ SimpleValueSupport queueName = new SimpleValueSupport(SimpleMetaType.STRING, resourceContext.getResourceKey());
+ SimpleValueSupport methodName = new SimpleValueSupport(SimpleMetaType.STRING, oper.getOperationName());
+ ManagementView view = getProfileService();
+ String methodOperation = getInvokeOperation();
+ if("JMSMessage".equalsIgnoreCase(oper.getResultsType()))
+ {
+ methodOperation = getInvokeOperationJMSMessage();
+ }
+ else if("SubscriptionInfo".equalsIgnoreCase(oper.getResultsType()))
+ {
+ methodOperation = getInvokeOperationSubscriptionMessage();
+ }
+ ManagedOperation operation = ManagementSupport.getOperation(view, getComponentName(), methodOperation, getComponentType());
+ Object result = null;
+ result = operation.invoke(queueName, methodName, param, sig);
+ if (result == null)
+ {
+ return null;
+ }
+ return formatResults(result, oper.getResultsType());
+ }
+
+ public void start(ResourceContext resourceContext) throws InvalidPluginConfigurationException, Exception
+ {
+ this.resourceContext = resourceContext;
+
+ jmsComponent = (JMSComponent) resourceContext.getParentResourceComponent();
+ }
+
+ public void stop()
+ {
+ this.resourceContext = null;
+ }
+
+ protected abstract String getInvokeOperationSubscriptionMessage();
+
+ protected abstract String getInvokeOperationJMSMessage();
+
+ protected abstract String getInvokeOperation();
+
+
+ abstract String getComponentName();
+
+ abstract ComponentType getComponentType();
+
+ abstract String getConfigurationOperationName();
+
+ abstract String getMeasurementsOperationName();
+
+ abstract String getDeleteOperationName();
+
+ private void populateParams(final Collection<PropertySimple> props, final SimpleValueSupport[] params, final SimpleValueSupport[] signature)
+ {
+ int pos = 0;
+ for (PropertySimple prop : props)
+ {
+ String[] val = prop.getName().split(":");
+ if (val.length == 1)
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getStringValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "java.lang.String");
+ }
+ else
+ {
+ if (val[0].equals("Boolean"))
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getBooleanValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "java.lang.Boolean");
+ }
+ else if (val[0].equals("boolean"))
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getBooleanValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "boolean");
+ }
+ else if (val[0].equals("String"))
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getStringValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "java.lang.String");
+ }
+ else if (val[0].equals("Long"))
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getLongValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "java.lang.Long");
+ }
+ else if (val[0].equals("long"))
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getLongValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "long");
+ }
+ else if (val[0].equals("Integer"))
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getIntegerValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "java.lang.Integer");
+ }
+ else if (val[0].equals("int"))
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getIntegerValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "int");
+ }
+ else if (val[0].equals("Double"))
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getDoubleValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "java.lang.Double");
+ }
+ else if (val[0].equals("double"))
+ {
+ params[pos] = new SimpleValueSupport(SimpleMetaType.STRING, getStringValue(prop.getDoubleValue()));
+ signature[pos] = new SimpleValueSupport(SimpleMetaType.STRING, "double");
+ }
+ }
+ pos++;
+ }
+ }
+
+ private String getStringValue(Object o)
+ {
+ return o == null ? "null" : o.toString();
+ }
+
+
+ private OperationResult formatResults(Object val, String type) throws Exception
+ {
+ if (type == null)
+ {
+ SimpleValueSupport valueSupport = (SimpleValueSupport) val;
+ return new OperationResult(valueSupport.getValue().toString());
+ }
+ else if(type.equalsIgnoreCase("String"))
+ {
+ SimpleValueSupport valueSupport = (SimpleValueSupport) val;
+ return new OperationResult(valueSupport.getValue().toString());
+ }
+ else if(type.equalsIgnoreCase("JMSMessage") || type.equalsIgnoreCase("SubscriptionInfo"))
+ {
+ OperationResult operationResult = new OperationResult();
+ Configuration c = operationResult.getComplexResults();
+ PropertyList property = new PropertyList("result");
+ CollectionValueSupport valueSupport = (CollectionValueSupport) val;
+ MetaValue[] msgs = valueSupport.getElements();
+ for (MetaValue mv : msgs)
+ {
+ CompositeValueSupport msg = (CompositeValueSupport) mv;
+ org.rhq.core.domain.configuration.PropertyMap p1 = new org.rhq.core.domain.configuration.PropertyMap("element");
+ property.add(p1);
+ ImmutableCompositeMetaType metaType = (ImmutableCompositeMetaType) msg.getMetaType();
+ Set<String> keys = metaType.keySet();
+ for (String key : keys)
+ {
+ SimpleValueSupport sattr = (SimpleValueSupport) msg.get(key);
+ if(sattr != null)
+ p1.put(new PropertySimple(key,sattr.getValue()));
+ }
+ }
+ c.put(property);
+ return operationResult;
+ }
+ else if (val instanceof CompositeValueSupport)
+ {
+ CompositeValueSupport valueSupport = (CompositeValueSupport) val;
+ if (valueSupport.containsKey("cause"))
+ {
+ CompositeValueSupport cause = (CompositeValueSupport) valueSupport.get("cause");
+ SimpleValueSupport message = (SimpleValueSupport) cause.get("message");
+ Exception exception = new Exception(message.toString());
+ throw exception;
+ }
+ return new OperationResult("not yet");
+ }
+ return new OperationResult("not yet");
+ }
+
+ public ManagementView getProfileService() throws Exception
+ {
+ return jmsComponent.getProfileService();
+ }
+}
Added: projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSTopicComponent.java
===================================================================
--- projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSTopicComponent.java (rev 0)
+++ projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSTopicComponent.java 2010-03-26 16:19:56 UTC (rev 8970)
@@ -0,0 +1,246 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.as.integration.hornetq.jopr;
+
+import org.jboss.as.integration.hornetq.jopr.util.ManagementSupport;
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.rhq.core.domain.configuration.*;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ * Created: 17-Mar-2010
+ */
+public class JMSTopicComponent extends JMSResourceComponent
+{
+ public AvailabilityType getAvailability()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ String getComponentName()
+ {
+ return JMSConstants.Topic.COMPONENT_NAME;
+ }
+
+ @Override
+ ComponentType getComponentType()
+ {
+ return JMSConstants.Topic.COMPONENT_TYPE;
+ }
+
+ @Override
+ String getConfigurationOperationName()
+ {
+ return "getTopicConfiguration";
+ }
+
+ @Override
+ String getMeasurementsOperationName()
+ {
+ return "getTopicMeasurements";
+ }
+
+
+ @Override
+ protected String getInvokeOperation()
+ {
+ return "invokeTopicOperation";
+ }
+
+ @Override
+ protected String getInvokeOperationJMSMessage()
+ {
+ return "invokeTopicOperationMessageType";
+ }
+
+ @Override
+ protected String getInvokeOperationSubscriptionMessage()
+ {
+ return "invokeTopicOperationSubscriptionType";
+ }
+
+ @Override
+ String getDeleteOperationName()
+ {
+ return "deleteTopic";
+ }
+
+ public void updateResourceConfiguration(ConfigurationUpdateReport configurationUpdateReport)
+ {
+ configurationUpdateReport.setStatus(ConfigurationUpdateStatus.INPROGRESS);
+
+ ManagementView view = null;
+ try
+ {
+ view = getProfileService();
+ }
+ catch (Exception e)
+ {
+ configurationUpdateReport.setStatus(ConfigurationUpdateStatus.FAILURE);
+ configurationUpdateReport.setErrorMessage(e.getMessage());
+ e.printStackTrace();
+ return;
+ }
+ Map<String, PropertySimple> simpleProps = configurationUpdateReport.getConfiguration().getSimpleProperties();
+ String name = simpleProps.get("name").getStringValue();
+ String jndiName = simpleProps.get("jndiBindings").getStringValue();
+ String DLA = simpleProps.get("dla").getStringValue();
+ String expiryAddress = simpleProps.get("expiryAddress").getStringValue();
+ int maxSize = simpleProps.get("maxSize").getIntegerValue();
+ int pageSize = simpleProps.get("pageSize").getIntegerValue();
+ int maxDeliveryAttempts = simpleProps.get("maxDeliveryAttempts").getIntegerValue();
+ long redeliveryDelay = simpleProps.get("redeliveryDelay").getLongValue();
+ boolean lastValueQueue = simpleProps.get("lastValueQueue").getBooleanValue();
+ long redistributionDelay = simpleProps.get("redistributionDelay").getLongValue();
+ boolean sendToDLAOnNoRoute = simpleProps.get("sendToDLAOnNoRoute").getBooleanValue();
+ String addressFullMessagePolicy = simpleProps.get("addressFullMessagePolicy").getStringValue();
+
+
+ StringBuffer sendRoles = new StringBuffer();
+ StringBuffer consumeRoles = new StringBuffer();
+ StringBuffer createNonDurableRoles = new StringBuffer();
+ StringBuffer deleteNonDurableRoles = new StringBuffer();
+ StringBuffer createDurableRoles = new StringBuffer();
+ StringBuffer deleteDurableRoles = new StringBuffer();
+ createRoles(configurationUpdateReport, name, sendRoles, consumeRoles, createNonDurableRoles, deleteNonDurableRoles, createDurableRoles, deleteDurableRoles);
+ try
+ {
+ ManagedOperation operation = ManagementSupport.getOperation(view, JMSConstants.Topic.COMPONENT_NAME,
+ "updateTopicConfiguration", JMSConstants.Topic.COMPONENT_TYPE);
+ operation.invoke(new SimpleValueSupport(SimpleMetaType.STRING, resourceContext.getResourceKey()),
+ new SimpleValueSupport(SimpleMetaType.STRING, jndiName),
+ new SimpleValueSupport(SimpleMetaType.STRING, DLA),
+ new SimpleValueSupport(SimpleMetaType.STRING, expiryAddress),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, maxSize),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, pageSize),
+ new SimpleValueSupport(SimpleMetaType.INTEGER_PRIMITIVE, maxDeliveryAttempts),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, redeliveryDelay),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, lastValueQueue),
+ new SimpleValueSupport(SimpleMetaType.LONG_PRIMITIVE, redistributionDelay),
+ new SimpleValueSupport(SimpleMetaType.BOOLEAN_PRIMITIVE, sendToDLAOnNoRoute),
+ new SimpleValueSupport(SimpleMetaType.STRING, addressFullMessagePolicy),
+ new SimpleValueSupport(SimpleMetaType.STRING, sendRoles.toString()),
+ new SimpleValueSupport(SimpleMetaType.STRING, consumeRoles.toString()),
+ new SimpleValueSupport(SimpleMetaType.STRING, createDurableRoles.toString()),
+ new SimpleValueSupport(SimpleMetaType.STRING, deleteDurableRoles.toString()),
+ new SimpleValueSupport(SimpleMetaType.STRING, createNonDurableRoles.toString()),
+ new SimpleValueSupport(SimpleMetaType.STRING, deleteNonDurableRoles.toString()));
+ }
+ catch (Exception e)
+ {
+ configurationUpdateReport.setStatus(ConfigurationUpdateStatus.FAILURE);
+ configurationUpdateReport.setErrorMessage(e.getMessage());
+ e.printStackTrace();
+ return;
+ }
+ configurationUpdateReport.setStatus(ConfigurationUpdateStatus.SUCCESS);
+ }
+
+ private void createRoles(ConfigurationUpdateReport configurationUpdateReport, String name, StringBuffer sendRoles, StringBuffer consumeRoles, StringBuffer createNonDurableRoles, StringBuffer deleteNonDurableRoles, StringBuffer createDurableRoles, StringBuffer deleteDurableRoles)
+ {
+ PropertyList propertyList = (PropertyList) configurationUpdateReport.getConfiguration().get("securityConfig");
+ List<Property> roles = propertyList.getList();
+ for (Property role : roles)
+ {
+ PropertyMap actRole = (PropertyMap) role;
+ boolean send;
+ boolean consume;
+ boolean createNonDurableQueue;
+ boolean deleteNonDurableQueue;
+ boolean createDurableQueue;
+ boolean deleteDurableQueue;
+ PropertySimple simple = (PropertySimple) actRole.get("name");
+ name = simple.getStringValue();
+ simple = (PropertySimple) actRole.get("send");
+ send = simple.getBooleanValue();
+ simple = (PropertySimple) actRole.get("consume");
+ consume = simple.getBooleanValue();
+ simple = (PropertySimple) actRole.get("createNonDurableQueue");
+ createNonDurableQueue = simple.getBooleanValue();
+ simple = (PropertySimple) actRole.get("deleteNonDurableQueue");
+ deleteNonDurableQueue = simple.getBooleanValue();
+ simple = (PropertySimple) actRole.get("createDurableQueue");
+ createDurableQueue = simple.getBooleanValue();
+ simple = (PropertySimple) actRole.get("deleteDurableQueue");
+ deleteDurableQueue = simple.getBooleanValue();
+ if(send)
+ {
+ if(sendRoles.length() > 0)
+ {
+ sendRoles.append(",");
+ }
+ sendRoles.append(name);
+ }
+ if(consume)
+ {
+ if(consumeRoles.length() > 0)
+ {
+ consumeRoles.append(",");
+ }
+ consumeRoles.append(name);
+ }
+ if(createDurableQueue)
+ {
+ if(createDurableRoles.length() > 0)
+ {
+ createDurableRoles.append(",");
+ }
+ createDurableRoles.append(name);
+ }
+ if(deleteDurableQueue)
+ {
+ if(deleteDurableRoles.length() > 0)
+ {
+ deleteDurableRoles.append(",");
+ }
+ deleteDurableRoles.append(name);
+ }
+ if(createNonDurableQueue)
+ {
+ if(createNonDurableRoles.length() > 0)
+ {
+ createNonDurableRoles.append(",");
+ }
+ createNonDurableRoles.append(name);
+ }
+ if(deleteNonDurableQueue)
+ {
+ if(deleteNonDurableRoles.length() > 0)
+ {
+ deleteNonDurableRoles.append(",");
+ }
+ deleteNonDurableRoles.append(name);
+ }
+ }
+ }
+
+}
Added: projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSTopicDiscoveryComponent.java
===================================================================
--- projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSTopicDiscoveryComponent.java (rev 0)
+++ projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/JMSTopicDiscoveryComponent.java 2010-03-26 16:19:56 UTC (rev 8970)
@@ -0,0 +1,69 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.as.integration.hornetq.jopr;
+
+import org.jboss.as.integration.hornetq.jopr.util.ManagementSupport;
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.metatype.api.values.ArrayValueSupport;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public class JMSTopicDiscoveryComponent implements ResourceDiscoveryComponent
+{
+
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext resourceDiscoveryContext) throws InvalidPluginConfigurationException, Exception
+ {
+ Set<DiscoveredResourceDetails> set = new HashSet<DiscoveredResourceDetails>();
+ JMSComponent context = (JMSComponent) resourceDiscoveryContext.getParentResourceComponent();
+ ManagementView managementView = context.getProfileService();
+ ManagedOperation operation = ManagementSupport.getOperation(managementView, JMSConstants.Topic.COMPONENT_NAME,
+ "getJMSTopics", JMSConstants.Topic.COMPONENT_TYPE);
+
+ ArrayValueSupport value = (ArrayValueSupport) operation.invoke();
+
+ for (int i = 0; i < value.getLength(); i++)
+ {
+ SimpleValueSupport queue = (SimpleValueSupport) value.getValue(i);
+ ResourceType resourceType = resourceDiscoveryContext.getResourceType();
+ String queueName = "jms.topic." + queue.getValue();
+ set.add(new DiscoveredResourceDetails(resourceType,
+ queueName,
+ queueName,
+ "a JMS Topic",
+ "",
+ resourceDiscoveryContext.getDefaultPluginConfiguration(),
+ null));
+ }
+ return set;
+ }
+}
\ No newline at end of file
Added: projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/util/ManagementSupport.java
===================================================================
--- projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/util/ManagementSupport.java (rev 0)
+++ projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/util/ManagementSupport.java 2010-03-26 16:19:56 UTC (rev 8970)
@@ -0,0 +1,50 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.as.integration.hornetq.jopr.util;
+
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedOperation;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ * Created 16-Mar-2010
+ */
+public class ManagementSupport
+{
+ public static ManagedOperation getOperation(ManagementView view, String componentName, String operName, ComponentType componentType) throws Exception
+ {
+ ManagedComponent component = view.getComponent(componentName, componentType);
+ Set<ManagedOperation> operations = component.getOperations();
+ for (ManagedOperation operation : operations)
+ {
+ if (operation.getName().equals(operName))
+ {
+ return operation;
+ }
+ }
+ throw new IllegalArgumentException(" no operation available " + operName);
+ }
+}
Added: projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/util/Operation.java
===================================================================
--- projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/util/Operation.java (rev 0)
+++ projects/jopr-plugin/trunk/src/main/java/org/jboss/as/integration/hornetq/jopr/util/Operation.java 2010-03-26 16:19:56 UTC (rev 8970)
@@ -0,0 +1,68 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.as.integration.hornetq.jopr.util;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ * Created Feb 9, 2010
+ */
+public class Operation
+{
+ final private String operationName;
+ final private String resultsType;
+
+ Operation(String operationName, String resultsType)
+ {
+ this.operationName = operationName;
+ this.resultsType = resultsType;
+ }
+
+ public String getOperationName()
+ {
+ return operationName;
+ }
+
+ public String getResultsType()
+ {
+ return resultsType;
+ }
+
+ public static Operation getOperation(String oper)
+ {
+ String[] split = oper.split(",", 3);
+ String operationName = split[0];
+ String resultsType = null;
+ for (int i = 1, splitLength = split.length; i < splitLength; i++)
+ {
+ String s = split[i];
+ if(s.startsWith("operation"))
+ {
+ operationName = s.substring(s.indexOf("=") + 1);
+ }
+ else if(s.startsWith("result"))
+ {
+ resultsType = s.substring(s.indexOf("=") + 1);
+ }
+ }
+ return new Operation(operationName, resultsType);
+ }
+}
Added: projects/jopr-plugin/trunk/src/resources/META-INF/rhq-plugin.xml
===================================================================
--- projects/jopr-plugin/trunk/src/resources/META-INF/rhq-plugin.xml (rev 0)
+++ projects/jopr-plugin/trunk/src/resources/META-INF/rhq-plugin.xml 2010-03-26 16:19:56 UTC (rev 8970)
@@ -0,0 +1,755 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE plugin [
+
+ <!ENTITY destinationMetrics '
+ <metric property="getName"
+ displayName="Name"
+ description="name of this destination"
+ dataType="trait" displayType="summary"/>
+ <metric property="getJNDIBinding"
+ displayName="JNDI Binding"
+ description="JNDI Binding of this destination"
+ dataType="trait" displayType="summary"/>
+ <metric property="getAddress"
+ displayName="Address"
+ description="Address of this destination"
+ dataType="trait" displayType="summary"/>
+ <metric property="isTemporary"
+ displayName="Temporary"
+ description="If this destination is temporary"
+ dataType="trait" displayType="summary"/>
+'>
+ ]>
+
+<plugin name="HornetQ"
+ displayName="HornetQPlugin"
+ description="Supports management and monitoring of HornetQ Servers"
+ package="org.jboss.as.integration.hornetq.jopr"
+ version="2.1.10"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:xmlns:rhq-plugin"
+ xmlns:c="urn:xmlns:rhq-configuration">
+
+ <service name="JMS Manager"
+ discovery="JMSManagerDiscoveryComponent"
+ class="JMSManagerComponent"
+ singleton="true">
+
+ <runs-inside>
+ <parent-resource-type name="JBossAS Server" plugin="JBossAS"/>
+ <parent-resource-type name="JBossAS Server" plugin="JBossAS5"/>
+ </runs-inside>
+
+ <metric property="version"
+ displayName="HornetQ Version"
+ description="The HornetQ version"
+ dataType="trait" displayType="summary"/>
+ <metric property="started"
+ displayName="Is Started"
+ description="The HornetQ version"
+ dataType="trait" displayType="summary"/>
+
+ <service name="JMS Queue"
+ discovery="JMSQueueDiscoveryComponent"
+ class="JMSQueueComponent"
+ createDeletePolicy="both">
+ <operation name="removeMessages" displayName="Remove Messages"
+ description="Remove all the messages from this queue that match the given message selector. A null selector will delete all messages.">
+ <parameters>
+ <c:simple-property required="false" name="filter" displayName="A message filter"/>
+ </parameters>
+ <results>
+ <c:simple-property name="operationResult" type="integer" description="Number of removed messages."/>
+ </results>
+ </operation>
+ <operation name="listMessages,result=JMSMessage" displayName="List Messages"
+ description="list all the messages currently in this queue.">
+ <parameters>
+ <c:simple-property required="false" name="filter" displayName="A JMS message filter (can be empty)"/>
+ </parameters>
+ <results>
+ <c:list-property name="result">
+ <c:map-property required="false" name="element">
+ <c:simple-property type="string" name="JMSMessageID"/>
+ <c:simple-property type="long" required="false" name="JMSTimestamp"/>
+ <c:simple-property type="integer" required="false" name="JMSPriority"/>
+ <c:simple-property type="long" required="false" name="JMSExpiration"/>
+ <c:simple-property type="string" required="false" name="JMSDeliveryMode"/>
+ </c:map-property>
+ </c:list-property>
+ </results>
+ </operation>
+ <operation name="countMessages" displayName="Count Messages"
+ description="Returns the number of the messages in the queue matching the given filter.">
+ <parameters>
+ <c:simple-property required="false" name="selector" displayName="the selector"/>
+ </parameters>
+ <results>
+ <c:simple-property name="operationResult" type="integer"
+ description="Number of the messages in the queue matching the given filter."/>
+ </results>
+ </operation>
+ <operation name="removeMessage" displayName="Remove Message"
+ description="Remove the message corresponding to the given messageID.">
+ <parameters>
+ <c:simple-property required="true" name="messageID" displayName="The message ID"/>
+ </parameters>
+ <results>
+ <c:simple-property name="operationResult" type="boolean" description="Was the message removed."/>
+ </results>
+ </operation>
+ <operation name="expireMessages" displayName="Expire Messages"
+ description="Expires the messages corresponding to the given filter.">
+ <parameters>
+ <c:simple-property required="false" name="filter" displayName="A message filter"/>
+ </parameters>
+ <results>
+ <c:simple-property name="operationResult" type="integer" description="Number of expired messages."/>
+ </results>
+ </operation>
+ <operation name="expireMessage" displayName="Expire Message"
+ description="Expire the message corresponding to the given messageID.">
+ <parameters>
+ <c:simple-property required="true" name="messageID" displayName="The message ID"/>
+ </parameters>
+ <results>
+ <c:simple-property name="operationResult" type="boolean" description="Was the message removed."/>
+ </results>
+ </operation>
+ <operation name="sendMessageToDeadLetterAddress" displayName="Send Message to DLA"
+ description="Send the message corresponding to the given messageID to this queue's Dead Letter Address.">
+ <parameters>
+ <c:simple-property required="true" name="messageID" displayName="The message ID"/>
+ </parameters>
+ <results>
+ <c:simple-property name="operationResult" type="boolean" description="Was the message sent."/>
+ </results>
+ </operation>
+ <operation name="sendMessagesToDeadLetterAddress" displayName="Send Messages to DLA"
+ description="Send the messages corresponding to the given filter to this queue's Dead Letter Address.">
+ <parameters>
+ <c:simple-property required="false" name="filterStr" displayName="A message filter"/>
+ </parameters>
+ <results>
+ <c:simple-property name="operationResult" type="integer" description="Number of expired messages."/>
+ </results>
+ </operation>
+ <operation name="changeMessagePriority" displayName="Change Message Priority"
+ description="Change the priority of the message corresponding to the given messageID.">
+ <parameters>
+ <c:simple-property required="true" name="messageID" displayName="A message ID"/>
+ <c:simple-property required="true" type="integer" name="int:newPriority"
+ displayName="the new priority (between 0 and 9)"/>
+ </parameters>
+ <results>
+ <c:simple-property name="operationResult" type="boolean" description="True if priority set."/>
+ </results>
+ </operation>
+ <operation name="changeMessagesPriority" displayName="Change Messages Priority"
+ description="Change the priority of the messages corresponding to the given filter.">
+ <parameters>
+ <c:simple-property required="false" name="filter" displayName="A message filter"/>
+ <c:simple-property required="true" type="integer" name="int:newPriority"
+ displayName="The New Priority (between 0 and 9)"/>
+ </parameters>
+ <results>
+ <c:simple-property name="operationResult" type="integer"
+ description="Number of messages reset with priority."/>
+ </results>
+ </operation>
+ <operation name="moveMessage" displayName="Move Message"
+ description="Move the message corresponding to the given messageID to another queue.">
+ <parameters>
+ <c:simple-property required="true" name="messageID" displayName="A message ID"/>
+ <c:simple-property required="true" name="otherQueueName"
+ displayName="Destination Queue"/>
+ </parameters>
+ <results>
+ <c:simple-property name="operationResult" type="boolean" description="True if message moved."/>
+ </results>
+ </operation>
+ <operation name="moveMessages" displayName="Move Messages"
+ description="Move the messages corresponding to the given filter.">
+ <parameters>
+ <c:simple-property required="false" name="filter" displayName="The Filter"/>
+ <c:simple-property required="true" name="otherQueueName"
+ displayName="Destination Queue"/>
+ </parameters>
+ <results>
+ <c:simple-property name="operationResult" type="integer" description="Number of moved messages."/>
+ </results>
+ </operation>
+ <operation name="listMessageCounter" displayName="List Message Counter"
+ description="List the message counters for this queue. This will show statistics for the queue">
+ <results>
+ <c:simple-property name="operationResult" description="Message Counters."/>
+ </results>
+ </operation>
+ <operation name="resetMessageCounter" displayName="Reset Message Counter"
+ description="Reset the message counters.">
+ </operation>
+ <operation name="listMessageCounterAsHTML" displayName="List Message Counter in HTML"
+ description="List the message counters in HTML.">
+ <results>
+ <c:simple-property name="operationResult" description="Message Counters."/>
+ </results>
+ </operation>
+ <operation name="listMessageCounterHistory" displayName="List Message Counter History"
+ description="List the message counters history.">
+ <results>
+ <c:simple-property name="operationResult" description="Message Counter history."/>
+ </results>
+ </operation>
+ <operation name="listMessageCounterHistoryAsHTML" displayName="List Message Counter History in HTML"
+ description="List the message counters history in HTML.">
+ <results>
+ <c:simple-property name="operationResult" description="Message Counter history."/>
+ </results>
+ </operation>
+ <operation name="pause" displayName="Pause the Queue" description="Pause the Queue. If the queue is paused no messages can be routed to it or consumed from it.">
+ </operation>
+ <operation name="resume" displayName="restart the Queue" description="Restart the Queue from its paused state.">
+ </operation>
+ &destinationMetrics;
+ <metric property="getMessageCount"
+ displayName="Message Count"
+ description="number of messages currently held in this queue awaiting delivery"
+ dataType="measurement" displayType="summary"/>
+ <metric property="getScheduledCount"
+ displayName="Scheduled Message Count"
+ description="number of scheduled messages in this queue awaiting scheduled delivery"
+ dataType="measurement" displayType="summary"/>
+ <metric property="getConsumerCount"
+ displayName="Consumer Count"
+ description="number of consumers currently consuming messages from this queue"
+ dataType="measurement" displayType="summary"/>
+ <metric property="getDeliveringCount"
+ displayName="Delivering Count"
+ description="number of messages that this queue is currently delivering to its consumers that have not been acknowledged"
+ dataType="measurement" displayType="summary"/>
+ <metric property="getMessagesAdded"
+ displayName="Messages Added"
+ description="number of messages added to this queue since it was initially created"
+ dataType="measurement" displayType="summary"/>
+ <metric property="isPaused"
+ displayName="paused"
+ description="Is the queue currently paused"
+ dataType="trait" displayType="summary"/>
+ <resource-configuration>
+ <c:group name="HornetQCustomProperties" displayName="Destination Options">
+ <c:simple-property name="name" displayName="Name" required="true" readOnly="true">
+ <c:description>The name of the queue</c:description>
+ </c:simple-property>
+ <c:simple-property name="jndiBindings" displayName="JNDI Name" required="true" readOnly="true">
+ <c:description>The JNDI name of the queue. This will be used when looking up the queue using the naming server</c:description>
+ </c:simple-property>
+ <c:simple-property name="dla" displayName="Dead Letter Address" required="false">
+ <c:description>The address to route messages to once the message has been delivered more than the configured number of times. This is specified by 'Max Delivery Attempts'</c:description>
+ </c:simple-property>
+ <c:simple-property name="expiryAddress" displayName="Expiry Address" required="false">
+ <c:description>The Address to route messages to once they have expired.</c:description>
+ </c:simple-property>
+ <c:simple-property name="maxSize" default="-1" type="integer" displayName="Max Size of Address"
+ required="true">
+ <c:description>The maximum size in bytes of messages that can be delivered to this queue. -1 means no limit, if limit is set then 'Address Full Message Policy' specifies what should happen</c:description>
+ </c:simple-property>
+ <c:simple-property name="pageSize" default="10485760" type="integer" displayName="Page Size"
+ required="true">
+ <c:description>The point at which messages will be paged on an Address</c:description>
+ </c:simple-property>
+ <c:simple-property name="maxDeliveryAttempts" type="integer" default="10"
+ displayName="Max Delivery Attempts" required="true">
+ <c:description>The maximum time to attempt delivery of a message to a consumer, once hit the message is routed to which ever address is specified by 'Dead Letter Address'</c:description>
+ </c:simple-property>
+ <c:simple-property name="redeliveryDelay" type="long" default="0" displayName="Redelivery Delay"
+ required="true">
+ <c:description>The delay (in milli seconds) before re routing a message to this Address after an unsuccessful delivery attempt has occurred. default 0 means no delay</c:description>
+ </c:simple-property>
+ <c:simple-property name="lastValueQueue" default="false" type="boolean" displayName="Last Value Queue"
+ required="true">
+ <c:description>Is this queue a last value queue. A last value queue can only ever contain a single message for each value for the message property '_HQ_LVQ_NAME'.</c:description>
+ </c:simple-property>
+ <c:simple-property name="redistributionDelay" default="-1" type="long" displayName="Redistribution Delay"
+ required="true">
+ <c:description>How long to wait (in milli seconds) before redistributing messages to another node when clustered when a queue has no consumers. Default -1 means do not re distribute.</c:description>
+ </c:simple-property>
+ <c:simple-property name="sendToDLAOnNoRoute" default="false" type="boolean"
+ displayName="Send To DLA on no route" required="true">
+ <c:description>Whether or not messages routed to this address gets sent to DLA when no consumers are available</c:description>
+ </c:simple-property>
+ <c:simple-property name="addressFullMessagePolicy" default="PAGE" type="string"
+ displayName="Address Full Message Policy" required="true">
+ <c:description>The policy to use when this Address is full. PAGE means that the message will be paged, DROP means that messages are just droppoed and BLOCK means that the client will block on send until the queue clears some messages</c:description>
+ <c:property-options>
+ <c:option name="PAGE" value="PAGE"/>
+ <c:option name="DROP" value="DROP"/>
+ <c:option name="BLOCK" value="BLOCK"/>
+ </c:property-options>
+ </c:simple-property>
+ <c:list-property name="roles"
+ displayName="Roles"
+ description="These are the roles for this queue. The 'name' of the role, 'send' allows a producer to send a message, 'consume' allows a consumer to receive a message.">
+ <c:map-property name="role"
+ displayName="Role Attributes"
+ description="These are the attributes that define the role name, and if the role is allowed to send and consume messages on this queue">
+ <c:simple-property name="name"
+ displayName="name"
+ description="The name of the role?"
+ summary="true"
+ required="true"
+ type="string"/>
+ <c:simple-property name="send"
+ displayName="send"
+ description="Is this role allowed to send messages to this queue?"
+ summary="true"
+ required="true"
+ type="boolean"/>
+ <c:simple-property name="consume"
+ displayName="consume"
+ description="Is this role allowed to consume messages from this queue?"
+ summary="true"
+ required="true"
+ type="boolean"/>
+ </c:map-property>
+
+ </c:list-property>
+ </c:group>
+ </resource-configuration>
+ </service>
+ <service name="JMS Topic"
+ discovery="JMSTopicDiscoveryComponent"
+ class="JMSTopicComponent"
+ createDeletePolicy="both">
+ <operation name="listAllSubscriptions,result=SubscriptionInfo" displayName="List all Subscriptions"
+ description="Lists all the subscriptions for this topic (both durable and non-durable).">
+ <results>
+ <c:list-property name="result">
+ <c:map-property required="false" name="element">
+ <c:simple-property type="string" name="name"/>
+ <c:simple-property type="string" required="false" name="clientID"/>
+ <c:simple-property type="string" required="false" name="subName"/>
+ <c:simple-property type="boolean" required="false" name="durable"/>
+ <c:simple-property type="integer" name="messageCount"/>
+ <c:simple-property type="string" name="filter"/>
+ </c:map-property>
+ </c:list-property>
+ </results>
+ </operation>
+ <operation name="listDurableSubscriptions,result=SubscriptionInfo" displayName="List all Durable Dubscriptions"
+ description="Lists all the durable subscriptions for this topic.">
+ <results>
+ <c:list-property name="result">
+ <c:map-property required="false" name="element">
+ <c:simple-property type="string" name="name"/>
+ <c:simple-property type="string" required="false" name="clientID"/>
+ <c:simple-property type="string" required="false" name="subName"/>
+ <c:simple-property type="boolean" required="false" name="durable"/>
+ <c:simple-property type="integer" name="messageCount"/>
+ <c:simple-property type="string" name="filter"/>
+ </c:map-property>
+ </c:list-property>
+ </results>
+ </operation>
+ <operation name="listNonDurableSubscriptions,result=SubscriptionInfo"
+ displayName="List all non Durable Subscriptions"
+ description="Lists all the non-durable subscriptions for this topic.">
+ <results>
+ <c:list-property name="result">
+ <c:map-property required="false" name="element">
+ <c:simple-property type="string" name="name"/>
+ <c:simple-property type="string" required="false" name="clientID"/>
+ <c:simple-property type="string" required="false" name="subName"/>
+ <c:simple-property type="boolean" required="false" name="durable"/>
+ <c:simple-property type="integer" name="messageCount"/>
+ <c:simple-property type="string" name="filter"/>
+ </c:map-property>
+ </c:list-property>
+ </results>
+ </operation>
+ <operation name="listMessagesForSubscription,result=JMSMessage" displayName="List all Messages"
+ description="list all the messages.">
+ <parameters>
+ <c:simple-property required="true" name="queueName"
+ displayName="the name of the queue representing a subscription"/>
+ </parameters>
+ <results>
+ <c:list-property name="result">
+ <c:map-property required="false" name="element">
+ <c:simple-property type="string" name="JMSMessageID"/>
+ <c:simple-property type="long" required="false" name="JMSTimestamp"/>
+ <c:simple-property type="long" required="false" name="JMSExpiration"/>
+ <c:simple-property type="string" required="false" name="JMSDeliveryMode"/>
+ <c:simple-property type="string" name="JMSMessageID"/>
+ </c:map-property>
+ </c:list-property>
+ </results>
+ </operation>
+ <operation name="countMessagesForSubscription" displayName="List Messages for Subscription"
+ description="Count the number of messages matching the filter for the given subscription.">
+ <parameters>
+ <c:simple-property required="true" name="clientID" displayName="the client ID"/>
+ <c:simple-property required="true" name="subscriptionName"
+ displayName="Durable Subscription Name"/>
+ <c:simple-property required="false" name="filter" displayName="JMS Selector (can be empty)"/>
+ </parameters>
+ <results>
+ <c:simple-property name="operationResult" description="Message Subscriptions."/>
+ </results>
+ </operation>
+ <operation name="dropDurableSubscription" displayName="Drop Durable Subscription"
+ description="Drop a durable subscription.">
+ <parameters>
+ <c:simple-property required="true" name="clientID" displayName="The Client ID"/>
+ <c:simple-property required="true" name="subscriptionName"
+ displayName="Durable Subscription Name"/>
+ </parameters>
+ </operation>
+ <operation name="dropAllSubscriptions" displayName="Drop Durable Subscriptions"
+ description="Drop all durable subscription.">
+ </operation>
+ &destinationMetrics;
+ <metric property="getSubscriptionCount"
+ displayName="Subscription Count"
+ description="number of (durable and non-durable) subscribers for this topic"
+ dataType="measurement" displayType="summary"/>
+ <metric property="getDurableSubscriptionCount"
+ displayName="Durable Subscription Count"
+ description="number of durable subscribers for this topic"
+ dataType="measurement" displayType="summary"/>
+ <metric property="getNonDurableSubscriptionCount"
+ displayName="Non Durable Subscription Count"
+ description="number of non-durable subscribers for this topic"
+ dataType="measurement" displayType="summary"/>
+ <metric property="getMessageCount"
+ displayName="Message Count"
+ description="number of messages for all subscribers for this topic"
+ dataType="measurement" displayType="summary"/>
+ <metric property="getDurableMessageCount"
+ displayName="Durable Message Count"
+ description="number of messages for all durable subscribers for this topic"
+ dataType="measurement" displayType="summary"/>
+ <metric property="getNonDurableMessageCount"
+ displayName="Non Durable Message Count"
+ description="number of messages for all non-durable subscribers for this topic"
+ dataType="measurement" displayType="summary"/>
+ <resource-configuration>
+ <c:group name="HornetQCustomProperties" displayName="Destination Options">
+ <c:simple-property name="name" displayName="Name" required="true" readOnly="true">
+ <c:description>The Name of the topic to deploy</c:description>
+ </c:simple-property>
+ <c:simple-property name="jndiBindings" displayName="JNDI Name" required="true" readOnly="true">
+ <c:description>The JNDI name of the queue. This will be used when looking up the queue using the naming server</c:description>
+ </c:simple-property>
+ <c:simple-property name="dla" displayName="Dead Letter Address" required="false">
+ <c:description>The address to route messages to once the message has been delivered more than the configured number of times. This is specified by 'Max Delivery Attempts'</c:description>
+ </c:simple-property>
+ <c:simple-property name="expiryAddress" displayName="Expiry Address" required="false">
+ <c:description>The Address to route messages to once they have expired.</c:description>
+ </c:simple-property>
+ <c:simple-property name="maxSize" default="-1" type="integer" displayName="Max Size of Address"
+ required="true">
+ <c:description>The maximum size in bytes of messages that can be delivered to this queue. -1 means no limit, if limit is set then 'Address Full Message Policy' specifies what should happen</c:description>
+ </c:simple-property>
+ <c:simple-property name="pageSize" default="10485760" type="integer" displayName="Page Size"
+ required="true">
+ <c:description>The point at which messages will be paged on an Address</c:description>
+ </c:simple-property>
+ <c:simple-property name="maxDeliveryAttempts" type="integer" default="10"
+ displayName="Max Delivery Attempts" required="true">
+ <c:description>The maximum time to attempt delivery of a message to a consumer, once hit the message is routed to which ever address is specified by 'Dead Letter Address'</c:description>
+ </c:simple-property>
+ <c:simple-property name="redeliveryDelay" type="long" default="0" displayName="Redelivery Delay"
+ required="true">
+ <c:description>The delay (in milli seconds) before re routing a message to this Address after an unsuccessful delivery attempt has occurred. default 0 means no delay</c:description>
+ </c:simple-property>
+ <c:simple-property name="lastValueQueue" default="false" type="boolean" displayName="Last Value Queue"
+ required="true">
+ <c:description>Is this queue a last value queue. A last value queue can only ever contain a single message for each value for the message property '_HQ_LVQ_NAME'.</c:description>
+ </c:simple-property>
+ <c:simple-property name="redistributionDelay" default="-1" type="long" displayName="Redistribution Delay"
+ required="true">
+ <c:description>How long to wait (in milli seconds) before redistributing messages to another node when clustered when a queue has no consumers. Default -1 means do not re distribute.</c:description>
+ </c:simple-property>
+ <c:simple-property name="sendToDLAOnNoRoute" default="false" type="boolean"
+ displayName="Send To DLA on no route" required="true">
+ <c:description>Whether or not messages routed to this address gets sent to DLA when no consumers are available</c:description>
+ </c:simple-property>
+ <c:simple-property name="addressFullMessagePolicy" default="PAGE" type="string"
+ displayName="Address Full Message Policy" required="true">
+ <c:description>The policy to use when this Address is full. PAGE means that the message will be paged, DROP means that messages are just droppoed and BLOCK means that the client will block on send until the queue clears some messages</c:description>
+ <c:property-options>
+ <c:option name="PAGE" value="PAGE"/>
+ <c:option name="DROP" value="DROP"/>
+ <c:option name="BLOCK" value="BLOCK"/>
+ </c:property-options>
+ </c:simple-property>
+ <c:list-property name="roles"
+ displayName="Roles"
+ description="These are the role defined for this topic. The 'name' of the role, 'send' allows a producer to send a message, 'consume' allows a consumer or subscriber to receive a message. The create/delete (non) durable subscriber specifies whether the queue representing the subscription can be created or deleted">
+ <c:map-property name="role"
+ displayName="Role Attributes"
+ description="These are the attributes that define a role for this topic.">
+ <c:simple-property name="name"
+ displayName="name"
+ description="The name of the role"
+ summary="true"
+ required="true"
+ type="string"/>
+ <c:simple-property name="send"
+ displayName="send"
+ description="Is this role allowed to send messages to this topic?"
+ summary="true"
+ required="true"
+ type="boolean"/>
+ <c:simple-property name="consume"
+ displayName="consume"
+ description="Is this role allowed to consume messages from this topic?"
+ summary="true"
+ required="true"
+ type="boolean"/>
+ <c:simple-property name="createNonDurableQueue"
+ displayName="create subscriber"
+ description="Is this role allowed to create non durable subscribers for this topic?"
+ summary="true"
+ required="true"
+ type="boolean"/>
+ <c:simple-property name="deleteNonDurableQueue"
+ displayName="delete subscriber"
+ description="Is this role allowed to delete non durable subscribers for this topic?"
+ summary="true"
+ required="true"
+ type="boolean"/>
+ <c:simple-property name="createDurableQueue"
+ displayName="create durable subscriber"
+ description="Is this role allowed to create durable subscribers for this topic?"
+ summary="true"
+ required="true"
+ type="boolean"/>
+ <c:simple-property name="deleteDurableQueue"
+ displayName="delete durable subscriber"
+ description="Is this role allowed to delete durable subscribers for this topic?"
+ summary="true"
+ required="true"
+ type="boolean"/>
+ </c:map-property>
+
+ </c:list-property>
+ </c:group>
+ </resource-configuration>
+ </service>
+ <service name="JMS Connection Factory"
+ discovery="JMSConnectionFactoryDiscoveryComponent"
+ class="JMSConnectionFactoryComponent"
+ createDeletePolicy="both">
+ <metric property="getName"
+ displayName="Name"
+ description="name of this connection factory"
+ dataType="trait" displayType="summary"/>
+ <metric property="getBindings"
+ displayName="JNDI Bindings"
+ description="JNDI Bindings of this connection factory"
+ dataType="trait" displayType="summary"/>
+ <resource-configuration>
+ <c:group name="HornetQCustomProperties" displayName="Connection Factory Options">
+ <c:simple-property name="name" displayName="Connection Factory Name" required="true" readOnly="true">
+ <c:description>Name of the connection factory to deploy</c:description>
+ </c:simple-property>
+ <c:simple-property name="Bindings" displayName="Connection Factory JNDI Bindings" required="true" readOnly="true">
+ <c:description>JNDI Bindings of the connection factory to deploy</c:description>
+ </c:simple-property>
+ <c:simple-property name="liveTransportClassNames"
+ default="org.hornetq.integration.transports.netty.NettyConnectorFactory"
+ readOnly="true" required="false"
+ displayName="Connectors to live servers">
+ <c:description>comma-separated list of class names to connect to live servers</c:description>
+ </c:simple-property>
+ <c:simple-property name="liveTransportParams"
+ default="{host=localhost,port=5445}"
+ readOnly="true" required="false"
+ displayName="Parameters for connectors to live servers">
+ <c:description>comma-separated list of key=value parameters for the live connectors ( enclosed between { })</c:description>
+ </c:simple-property>
+ <c:simple-property name="backupTransportClassNames"
+ required="false" readOnly="true"
+ displayName="Connectors to backup servers">
+ <c:description>comma-separated list of class names to connect to backup servers</c:description>
+ </c:simple-property>
+ <c:simple-property name="backupTransportParams"
+ required="false" readOnly="true"
+ displayName="Parameters for connectors to backup servers">
+ <c:description>comma-separated list of key=value parameters for the backup connectors ( enclosed between { })</c:description>
+ </c:simple-property>
+ <c:simple-property name="DiscoveryAddress"
+ required="false"
+ readOnly="true"
+ displayName="Discovery Address">
+ <c:description>the address to listen to discover which connectors this connection factory can use</c:description>
+ </c:simple-property>
+ <c:simple-property name="DiscoveryPort"
+ readOnly="true"
+ default="0" type="integer"
+ displayName="Discovery Port">
+ <c:description>port to listen to discover which connectors this connection factory can use</c:description>
+ </c:simple-property>
+ <c:simple-property name="DiscoveryRefreshTimeout"
+ default="10000" type="long"
+ displayName="Discovery Refresh Timeout">
+ <c:description>refresh timeout for discovered HornetQ servers</c:description>
+ </c:simple-property>
+ <c:simple-property name="DiscoveryInitialWaitTimeout"
+ default="2000" type="long"
+ displayName="Discovery Initial Wait Timeout">
+ <c:description>initial wait timeout if this connection factory is configured to use discovery </c:description>
+ </c:simple-property>
+ <c:simple-property name="ClientID"
+ required="false"
+ displayName="Client ID">
+ <c:description>Client ID for connections created by this connection factory</c:description>
+ </c:simple-property>
+ <c:simple-property name="DupsOKBatchSize"
+ default="1048576" type="integer"
+ displayName="Dups OK Batch Size">
+ <c:description>batch size (in bytes) between acknowledgements when using DUPS_OK_ACKNOWLEDGE mode</c:description>
+ </c:simple-property>
+ <c:simple-property name="TransactionBatchSize"
+ default="1048576" type="integer"
+ displayName="Transaction Batch Size">
+ <c:description>batch size (in bytes) between acknowledgements when using a transacted session</c:description>
+ </c:simple-property>
+ <c:simple-property name="ClientFailureCheckPeriod"
+ default="30000" type="long"
+ displayName="Client Failure Check Period">
+ <c:description>period used to check if a client has failed to receive pings from the serve</c:description>
+ </c:simple-property>
+ <c:simple-property name="ConnectionTTL"
+ default="60000" type="long"
+ displayName="Connection TTL">
+ <c:description>connection time-to-live (in milliseconds)</c:description>
+ </c:simple-property>
+ <c:simple-property name="CallTimeout"
+ default="30000" type="long"
+ displayName="Call Timeout">
+ <c:description>blocking calls timeout (in milliseconds)</c:description>
+ </c:simple-property>
+ <c:simple-property name="ConsumerWindowSize"
+ default="1048576" type="integer"
+ displayName="Consumer Window Size">
+ <c:description>window size (in bytes) used for consumer flow control</c:description>
+ </c:simple-property>
+ <c:simple-property name="ConsumerMaxRate"
+ default="-1" type="integer"
+ displayName="Consumer Max Rate">
+ <c:description>maximum rate of message consumption (in messages per seconds)</c:description>
+ </c:simple-property>
+ <c:simple-property name="ConfirmationWindowSize"
+ default="-1" type="integer"
+ displayName="Confirmation Window Size">
+ <c:description>size (in bytes) for the confirmation window of clients using this connection factory</c:description>
+ </c:simple-property>
+ <c:simple-property name="ProducerMaxRate"
+ default="-1" type="integer"
+ displayName="Producer Max Rate">
+ <c:description>maximum rate of message production (in messages per seconds)</c:description>
+ </c:simple-property>
+ <c:simple-property name="ProducerWindowSize"
+ default="65536" type="integer"
+ displayName="Producer Window Size">
+ <c:description>window size (in bytes) used for producer flow control</c:description>
+ </c:simple-property>
+ <c:simple-property name="CacheLargeMessagesClient"
+ default="false" type="boolean"
+ displayName="Cache Large Messages Client">
+ <c:description>Whether consumers created through this factory will cache large messages in temporary files</c:description>
+ </c:simple-property>
+ <c:simple-property name="MinLargeMessageSize"
+ default="102400" type="integer"
+ displayName="Minimum Large Message Size">
+ <c:description>message size threshold (in bytes) to treat messages as large messages</c:description>
+ </c:simple-property>
+ <c:simple-property name="BlockOnNonDurableSend"
+ default="false" type="boolean"
+ displayName="Block On Non Durable Send">
+ <c:description>whether producers will block while sending non-durable messages or do it asynchronously</c:description>
+ </c:simple-property>
+ <c:simple-property name="BlockOnAcknowledge"
+ default="false" type="boolean"
+ displayName="Block On Acknowledge">
+ <c:description>whether consumers will block while sending message acknowledgements or do it asynchronously</c:description>
+ </c:simple-property>
+ <c:simple-property name="BlockOnDurableSend"
+ default="true" type="boolean"
+ displayName="Block On Durable Send">
+ <c:description>whether producers will block while sending persistent messages or do it asynchronously</c:description>
+ </c:simple-property>
+ <c:simple-property name="AutoGroup"
+ default="false" type="boolean"
+ displayName="Auto Group">
+ <c:description> whether producers will automatically assign a group ID to their messages</c:description>
+ </c:simple-property>
+ <c:simple-property name="PreAcknowledge"
+ default="false" type="boolean"
+ displayName="Pre Acknowledge">
+ <c:description>whether messages will pre-acknowledged on the server before they are sent to the consumers or not</c:description>
+ </c:simple-property>
+ <c:simple-property name="RetryInterval"
+ default="2000" type="long"
+ displayName="Retry Interval">
+ <c:description>interval (in milliseconds) to retry connections created by this factory after failure</c:description>
+ </c:simple-property>
+ <c:simple-property name="MaxRetryInterval"
+ default="2000" type="long"
+ displayName="Maximum Retry Interval">
+ <c:description>maximum retry interval (in milliseconds)</c:description>
+ </c:simple-property>
+ <c:simple-property name="RetryIntervalMultiplier"
+ default="1.0" type="double"
+ displayName="Retry Interval Multiplier">
+ <c:description>multiplier to apply to successive retry intervals</c:description>
+ </c:simple-property>
+ <c:simple-property name="ReconnectAttempts"
+ default="0" type="integer"
+ displayName="Reconnect Attempts">
+ <c:description>maximum number of attempts to retry connection in case of failure</c:description>
+ </c:simple-property>
+ <c:simple-property name="FailoverOnServerShutdown"
+ default="false" type="boolean"
+ displayName="Failover On Server Shutdown">
+ <c:description>whether connections created by this factory must failover in case the server they are connected to has normally shut down</c:description>
+ </c:simple-property>
+ <c:simple-property name="ScheduledThreadPoolMaxSize"
+ default="5" type="integer"
+ displayName="Scheduled Thread Pool Max Size">
+ <c:description>maximum size of the scheduled thread pool</c:description>
+ </c:simple-property>
+ <c:simple-property name="ThreadPoolMaxSize"
+ default="-1" type="integer"
+ displayName="Thread Pool Max Size">
+ <c:description>maximum size of the thread pool</c:description>
+ </c:simple-property>
+ <c:simple-property name="GroupID"
+ default="false" type="boolean"
+ required="false"
+ displayName="Group ID">
+ <c:description>group ID that will be eventually set on each message</c:description>
+ </c:simple-property>
+ <c:simple-property name="InitialMessagePacketSize"
+ default="1500" type="integer"
+ displayName="Initial Message Packet Size">
+ <c:description>initial size (in bytes) of messages created through this factory</c:description>
+ </c:simple-property>
+ <c:simple-property name="UseGlobalPools"
+ default="true" type="boolean"
+ displayName="Use Global Pools">
+ <c:description>whether this factory will use global thread pools (shared among all the factories in the same JVM) or its own pools</c:description>
+ </c:simple-property>
+ <c:simple-property name="ConnectionLoadBalancingPolicyClassName"
+ default="org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy"
+ displayName="Connection Load Balancing Policy Class Name">
+ <c:description>class name of the connection load balancing policy</c:description>
+ </c:simple-property>
+ </c:group>
+ </resource-configuration>
+ </service>
+ </service>
+</plugin>
14 years, 2 months
JBoss hornetq SVN: r8969 - projects and 1 other directory.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-03-26 05:00:27 -0400 (Fri, 26 Mar 2010)
New Revision: 8969
Added:
projects/
projects/jopr-plugin/
Removed:
jopr-plugin/
Log:
moved folders
Copied: projects/jopr-plugin (from rev 8968, jopr-plugin)
14 years, 2 months