From do-not-reply at jboss.org Fri Oct 2 08:41:41 2009 Content-Type: multipart/mixed; boundary="===============4355044984883297757==" MIME-Version: 1.0 From: do-not-reply at jboss.org To: hornetq-commits at lists.jboss.org Subject: [hornetq-commits] JBoss hornetq SVN: r8033 - in trunk: src/main/org/hornetq/jms/server/config and 4 other directories. Date: Fri, 02 Oct 2009 08:41:40 -0400 Message-ID: <200910021241.n92CfeZg013663@svn01.web.mwc.hst.phx2.redhat.com> --===============4355044984883297757== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: jmesnil Date: 2009-10-02 08:41:40 -0400 (Fri, 02 Oct 2009) New Revision: 8033 Added: trunk/src/main/org/hornetq/jms/server/config/ trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfigurat= ion.java trunk/src/main/org/hornetq/jms/server/config/JMSConfiguration.java trunk/src/main/org/hornetq/jms/server/config/QueueConfiguration.java trunk/src/main/org/hornetq/jms/server/config/TopicConfiguration.java trunk/src/main/org/hornetq/jms/server/config/impl/ trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfi= gurationImpl.java trunk/src/main/org/hornetq/jms/server/config/impl/JMSConfigurationImpl.j= ava trunk/src/main/org/hornetq/jms/server/config/impl/QueueConfigurationImpl= .java trunk/src/main/org/hornetq/jms/server/config/impl/TopicConfigurationImpl= .java trunk/tests/src/org/hornetq/tests/integration/jms/server/config/ trunk/tests/src/org/hornetq/tests/integration/jms/server/config/JMSConfi= gurationTest.java Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java Log: HORNETQ-161: Allow creation of JMS destinations via IoC * added org.hornetq.server.jms.config package to configure a JMSServerManag= er using POJOs (similar to Configuration API for core HornetQServer) Added: trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfig= uration.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfigura= tion.java (rev 0) +++ trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfigura= tion.java 2009-10-02 12:41:40 UTC (rev 8033) @@ -0,0 +1,162 @@ +/* + * 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.jms.server.config; + +import java.util.List; + +import org.hornetq.core.config.TransportConfiguration; +import org.hornetq.utils.Pair; + +/** + * A ConnectionFactoryConfiguration + * + * @author Jeff Mesnil + * + * + */ +public interface ConnectionFactoryConfiguration +{ + String getName(); + + String[] getBindings(); + + String getDiscoveryAddress(); + + void setDiscoveryAddress(String discoveryAddress); + + int getDiscoveryPort(); + + void setDiscoveryPort(int discoveryPort); + + List> getConnector= Configs(); + + void setConnectorConfigs(List> connectorConfigs); + + String getClientID(); + + void setClientID(String clientID); + + long getDiscoveryRefreshTimeout(); + + void setDiscoveryRefreshTimeout(long discoveryRefreshTimeout); + + long getClientFailureCheckPeriod(); + + void setClientFailureCheckPeriod(long clientFailureCheckPeriod); + + long getConnectionTTL(); + + void setConnectionTTL(long connectionTTL); + + long getCallTimeout(); + + void setCallTimeout(long callTimeout); + + int getMaxConnections(); + + void setMaxConnections(int maxConnections); + + boolean isCacheLargeMessagesClient(); + + void setCacheLargeMessagesClient(boolean cacheLargeMessagesClient); + + int getMinLargeMessageSize(); + + void setMinLargeMessageSize(int minLargeMessageSize); + + int getConsumerWindowSize(); + + void setConsumerWindowSize(int consumerWindowSize); + + int getConsumerMaxRate(); + + void setConsumerMaxRate(int consumerMaxRate); + + int getProducerWindowSize(); + + void setProducerWindowSize(int producerWindowSize); + + int getProducerMaxRate(); + + void setProducerMaxRate(int producerMaxRate); + + boolean isBlockOnAcknowledge(); + + void setBlockOnAcknowledge(boolean blockOnAcknowledge); + + boolean isBlockOnPersistentSend(); + + void setBlockOnPersistentSend(boolean blockOnPersistentSend); + + boolean isBlockOnNonPersistentSend(); + + void setBlockOnNonPersistentSend(boolean blockOnNonPersistentSend); + + boolean isAutoGroup(); + + void setAutoGroup(boolean autoGroup); + + boolean isPreAcknowledge(); + + void setPreAcknowledge(boolean preAcknowledge); + + String getLoadBalancingPolicyClassName(); + + void setLoadBalancingPolicyClassName(String loadBalancingPolicyClassNam= e); + + int getTransactionBatchSize(); + + void setTransactionBatchSize(int transactionBatchSize); + + int getDupsOKBatchSize(); + + void setDupsOKBatchSize(int dupsOKBatchSize); + + long getInitialWaitTimeout(); + + void setInitialWaitTimeout(long initialWaitTimeout); + + boolean isUseGlobalPools(); + + void setUseGlobalPools(boolean useGlobalPools); + + int getScheduledThreadPoolMaxSize(); + + void setScheduledThreadPoolMaxSize(int scheduledThreadPoolMaxSize); + + int getThreadPoolMaxSize(); + + void setThreadPoolMaxSize(int threadPoolMaxSize); + + long getRetryInterval(); + + void setRetryInterval(long retryInterval); + + double getRetryIntervalMultiplier(); + + void setRetryIntervalMultiplier(double retryIntervalMultiplier); + + long getMaxRetryInterval(); + + void setMaxRetryInterval(long maxRetryInterval); + + int getReconnectAttempts(); + + void setReconnectAttempts(int reconnectAttempts); + + boolean isFailoverOnServerShutdown(); + + void setFailoverOnServerShutdown(boolean failoverOnServerShutdown); + +} Added: trunk/src/main/org/hornetq/jms/server/config/JMSConfiguration.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/src/main/org/hornetq/jms/server/config/JMSConfiguration.java = (rev 0) +++ trunk/src/main/org/hornetq/jms/server/config/JMSConfiguration.java 2009= -10-02 12:41:40 UTC (rev 8033) @@ -0,0 +1,35 @@ +/* + * 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.jms.server.config; + +import java.util.List; + +import javax.naming.Context; + +/** + * A JMSConfiguration + * + * @author Jeff Mesnil + * + * + */ +public interface JMSConfiguration +{ + void setContext(Context context); + Context getContext(); + = + List getQueueConfigurations(); + List getTopicConfigurations(); + List getConnectionFactoryConfigurations= (); +} Added: trunk/src/main/org/hornetq/jms/server/config/QueueConfiguration.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/src/main/org/hornetq/jms/server/config/QueueConfiguration.java = (rev 0) +++ trunk/src/main/org/hornetq/jms/server/config/QueueConfiguration.java 20= 09-10-02 12:41:40 UTC (rev 8033) @@ -0,0 +1,29 @@ +/* + * 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.jms.server.config; + +/** + * A QeueConfiguration + * + * @author Jeff Mesnil + * + * + */ +public interface QueueConfiguration +{ + String getName(); + String getSelector(); + boolean isDurable(); + String[] getBindings(); +} Added: trunk/src/main/org/hornetq/jms/server/config/TopicConfiguration.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/src/main/org/hornetq/jms/server/config/TopicConfiguration.java = (rev 0) +++ trunk/src/main/org/hornetq/jms/server/config/TopicConfiguration.java 20= 09-10-02 12:41:40 UTC (rev 8033) @@ -0,0 +1,25 @@ +/* + * 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.jms.server.config; + +/** + * A TopicConfiguration + * + * @author Jeff Mesnil + */ +public interface TopicConfiguration +{ + String getName(); + String[] getBindings(); +} Added: trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryC= onfigurationImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConf= igurationImpl.java (rev 0) +++ trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConf= igurationImpl.java 2009-10-02 12:41:40 UTC (rev 8033) @@ -0,0 +1,485 @@ +/* + * 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.jms.server.config.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.hornetq.core.client.impl.ClientSessionFactoryImpl; +import org.hornetq.core.config.TransportConfiguration; +import org.hornetq.jms.server.config.ConnectionFactoryConfiguration; +import org.hornetq.utils.Pair; + +/** + * A ConnectionFactoryConfigurationImpl + * + * @author Jeff Mesnil + * + * + */ +public class ConnectionFactoryConfigurationImpl implements ConnectionFacto= ryConfiguration +{ + + // Constants ----------------------------------------------------- + + // Attributes ---------------------------------------------------- + + public final String[] bindings; + + public final String name; + + public String discoveryAddress; + + public int discoveryPort; + + public List> conne= ctorConfigs; + + public String clientID =3D null; + + public long discoveryRefreshTimeout =3D ClientSessionFactoryImpl.DEFAUL= T_DISCOVERY_REFRESH_TIMEOUT; + + public long clientFailureCheckPeriod =3D ClientSessionFactoryImpl.DEFAU= LT_CLIENT_FAILURE_CHECK_PERIOD; + + public long connectionTTL =3D ClientSessionFactoryImpl.DEFAULT_CONNECTI= ON_TTL; + + public long callTimeout =3D ClientSessionFactoryImpl.DEFAULT_CALL_TIMEO= UT; + + public int maxConnections =3D ClientSessionFactoryImpl.DEFAULT_MAX_CONN= ECTIONS; + + public boolean cacheLargeMessagesClient =3D ClientSessionFactoryImpl.DE= FAULT_CACHE_LARGE_MESSAGE_CLIENT; + + public int minLargeMessageSize =3D ClientSessionFactoryImpl.DEFAULT_MIN= _LARGE_MESSAGE_SIZE; + + public int consumerWindowSize =3D ClientSessionFactoryImpl.DEFAULT_CONS= UMER_WINDOW_SIZE; + + public int consumerMaxRate =3D ClientSessionFactoryImpl.DEFAULT_CONSUME= R_MAX_RATE; + + public int producerWindowSize =3D ClientSessionFactoryImpl.DEFAULT_PROD= UCER_WINDOW_SIZE; + + public int producerMaxRate =3D ClientSessionFactoryImpl.DEFAULT_PRODUCE= R_MAX_RATE; + + public boolean blockOnAcknowledge =3D ClientSessionFactoryImpl.DEFAULT_= BLOCK_ON_ACKNOWLEDGE; + + public boolean blockOnPersistentSend =3D ClientSessionFactoryImpl.DEFAU= LT_BLOCK_ON_PERSISTENT_SEND; + + public boolean blockOnNonPersistentSend =3D ClientSessionFactoryImpl.DE= FAULT_BLOCK_ON_NON_PERSISTENT_SEND; + + public boolean autoGroup =3D ClientSessionFactoryImpl.DEFAULT_AUTO_GROU= P; + + public boolean preAcknowledge =3D ClientSessionFactoryImpl.DEFAULT_PRE_= ACKNOWLEDGE; + + public String loadBalancingPolicyClassName =3D ClientSessionFactoryImpl= .DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME; + + public int transactionBatchSize =3D ClientSessionFactoryImpl.DEFAULT_AC= K_BATCH_SIZE; + + public int dupsOKBatchSize =3D ClientSessionFactoryImpl.DEFAULT_ACK_BAT= CH_SIZE; + + public long initialWaitTimeout =3D ClientSessionFactoryImpl.DEFAULT_DIS= COVERY_INITIAL_WAIT_TIMEOUT; + + public boolean useGlobalPools =3D ClientSessionFactoryImpl.DEFAULT_USE_= GLOBAL_POOLS; + + public int scheduledThreadPoolMaxSize =3D ClientSessionFactoryImpl.DEFA= ULT_SCHEDULED_THREAD_POOL_MAX_SIZE; + + public int threadPoolMaxSize =3D ClientSessionFactoryImpl.DEFAULT_THREA= D_POOL_MAX_SIZE; + + public long retryInterval =3D ClientSessionFactoryImpl.DEFAULT_RETRY_IN= TERVAL; + + public double retryIntervalMultiplier =3D ClientSessionFactoryImpl.DEFA= ULT_RETRY_INTERVAL_MULTIPLIER; + + public long maxRetryInterval =3D ClientSessionFactoryImpl.DEFAULT_MAX_R= ETRY_INTERVAL; + + public int reconnectAttempts =3D ClientSessionFactoryImpl.DEFAULT_RECON= NECT_ATTEMPTS; + + public boolean failoverOnServerShutdown =3D ClientSessionFactoryImpl.DE= FAULT_FAILOVER_ON_SERVER_SHUTDOWN; + + // Static -------------------------------------------------------- + + // Constructors -------------------------------------------------- + + public ConnectionFactoryConfigurationImpl(String name, String discovery= Address, int discoveryPort, String... bindings) + { + this(name, bindings); + this.discoveryAddress =3D discoveryAddress; + this.discoveryPort =3D discoveryPort; + } + + public ConnectionFactoryConfigurationImpl(String name, TransportConfigu= ration liveConfig, String... bindings) + { + this(name, liveConfig, null, bindings); + } + + public ConnectionFactoryConfigurationImpl(String name, TransportConfigu= ration liveConfig, TransportConfiguration backupConfig, String... bindings) + { + this(name, bindings); + connectorConfigs =3D new ArrayList>(); + connectorConfigs.add(new Pair(liveConfig, backupConfig)); + } + + public ConnectionFactoryConfigurationImpl(String name, List> transportConfigs, TransportConfig= uration backupConfig, String... bindings) + { + this(name, bindings); + connectorConfigs =3D new ArrayList>(); + connectorConfigs.addAll(transportConfigs); + } + + private ConnectionFactoryConfigurationImpl(String name, String... bindi= ngs) + { + this.name =3D name; + this.bindings =3D new String[bindings.length]; + System.arraycopy(bindings, 0, this.bindings, 0, bindings.length); + } + + // ConnectionFactoryConfiguration implementation ----------------- + + public String[] getBindings() + { + return bindings; + } + + public String getName() + { + return name; + } + + public String getDiscoveryAddress() + { + return discoveryAddress; + } + + public void setDiscoveryAddress(String discoveryAddress) + { + this.discoveryAddress =3D discoveryAddress; + } + + public int getDiscoveryPort() + { + return discoveryPort; + } + + public void setDiscoveryPort(int discoveryPort) + { + this.discoveryPort =3D discoveryPort; + } + + public List> getCo= nnectorConfigs() + { + return connectorConfigs; + } + + public void setConnectorConfigs(List> connectorConfigs) + { + this.connectorConfigs =3D connectorConfigs; + } + + public String getClientID() + { + return clientID; + } + + public void setClientID(String clientID) + { + this.clientID =3D clientID; + } + + public long getDiscoveryRefreshTimeout() + { + return discoveryRefreshTimeout; + } + + public void setDiscoveryRefreshTimeout(long discoveryRefreshTimeout) + { + this.discoveryRefreshTimeout =3D discoveryRefreshTimeout; + } + + public long getClientFailureCheckPeriod() + { + return clientFailureCheckPeriod; + } + + public void setClientFailureCheckPeriod(long clientFailureCheckPeriod) + { + this.clientFailureCheckPeriod =3D clientFailureCheckPeriod; + } + + public long getConnectionTTL() + { + return connectionTTL; + } + + public void setConnectionTTL(long connectionTTL) + { + this.connectionTTL =3D connectionTTL; + } + + public long getCallTimeout() + { + return callTimeout; + } + + public void setCallTimeout(long callTimeout) + { + this.callTimeout =3D callTimeout; + } + + public int getMaxConnections() + { + return maxConnections; + } + + public void setMaxConnections(int maxConnections) + { + this.maxConnections =3D maxConnections; + } + + public boolean isCacheLargeMessagesClient() + { + return cacheLargeMessagesClient; + } + + public void setCacheLargeMessagesClient(boolean cacheLargeMessagesClien= t) + { + this.cacheLargeMessagesClient =3D cacheLargeMessagesClient; + } + + public int getMinLargeMessageSize() + { + return minLargeMessageSize; + } + + public void setMinLargeMessageSize(int minLargeMessageSize) + { + this.minLargeMessageSize =3D minLargeMessageSize; + } + + public int getConsumerWindowSize() + { + return consumerWindowSize; + } + + public void setConsumerWindowSize(int consumerWindowSize) + { + this.consumerWindowSize =3D consumerWindowSize; + } + + public int getConsumerMaxRate() + { + return consumerMaxRate; + } + + public void setConsumerMaxRate(int consumerMaxRate) + { + this.consumerMaxRate =3D consumerMaxRate; + } + + public int getProducerWindowSize() + { + return producerWindowSize; + } + + public void setProducerWindowSize(int producerWindowSize) + { + this.producerWindowSize =3D producerWindowSize; + } + + public int getProducerMaxRate() + { + return producerMaxRate; + } + + public void setProducerMaxRate(int producerMaxRate) + { + this.producerMaxRate =3D producerMaxRate; + } + + public boolean isBlockOnAcknowledge() + { + return blockOnAcknowledge; + } + + public void setBlockOnAcknowledge(boolean blockOnAcknowledge) + { + this.blockOnAcknowledge =3D blockOnAcknowledge; + } + + public boolean isBlockOnPersistentSend() + { + return blockOnPersistentSend; + } + + public void setBlockOnPersistentSend(boolean blockOnPersistentSend) + { + this.blockOnPersistentSend =3D blockOnPersistentSend; + } + + public boolean isBlockOnNonPersistentSend() + { + return blockOnNonPersistentSend; + } + + public void setBlockOnNonPersistentSend(boolean blockOnNonPersistentSen= d) + { + this.blockOnNonPersistentSend =3D blockOnNonPersistentSend; + } + + public boolean isAutoGroup() + { + return autoGroup; + } + + public void setAutoGroup(boolean autoGroup) + { + this.autoGroup =3D autoGroup; + } + + public boolean isPreAcknowledge() + { + return preAcknowledge; + } + + public void setPreAcknowledge(boolean preAcknowledge) + { + this.preAcknowledge =3D preAcknowledge; + } + + public String getLoadBalancingPolicyClassName() + { + return loadBalancingPolicyClassName; + } + + public void setLoadBalancingPolicyClassName(String loadBalancingPolicyC= lassName) + { + this.loadBalancingPolicyClassName =3D loadBalancingPolicyClassName; + } + + public int getTransactionBatchSize() + { + return transactionBatchSize; + } + + public void setTransactionBatchSize(int transactionBatchSize) + { + this.transactionBatchSize =3D transactionBatchSize; + } + + public int getDupsOKBatchSize() + { + return dupsOKBatchSize; + } + + public void setDupsOKBatchSize(int dupsOKBatchSize) + { + this.dupsOKBatchSize =3D dupsOKBatchSize; + } + + public long getInitialWaitTimeout() + { + return initialWaitTimeout; + } + + public void setInitialWaitTimeout(long initialWaitTimeout) + { + this.initialWaitTimeout =3D initialWaitTimeout; + } + + public boolean isUseGlobalPools() + { + return useGlobalPools; + } + + public void setUseGlobalPools(boolean useGlobalPools) + { + this.useGlobalPools =3D useGlobalPools; + } + + public int getScheduledThreadPoolMaxSize() + { + return scheduledThreadPoolMaxSize; + } + + public void setScheduledThreadPoolMaxSize(int scheduledThreadPoolMaxSiz= e) + { + this.scheduledThreadPoolMaxSize =3D scheduledThreadPoolMaxSize; + } + + public int getThreadPoolMaxSize() + { + return threadPoolMaxSize; + } + + public void setThreadPoolMaxSize(int threadPoolMaxSize) + { + this.threadPoolMaxSize =3D threadPoolMaxSize; + } + + public long getRetryInterval() + { + return retryInterval; + } + + public void setRetryInterval(long retryInterval) + { + this.retryInterval =3D retryInterval; + } + + public double getRetryIntervalMultiplier() + { + return retryIntervalMultiplier; + } + + public void setRetryIntervalMultiplier(double retryIntervalMultiplier) + { + this.retryIntervalMultiplier =3D retryIntervalMultiplier; + } + + public long getMaxRetryInterval() + { + return maxRetryInterval; + } + + public void setMaxRetryInterval(long maxRetryInterval) + { + this.maxRetryInterval =3D maxRetryInterval; + } + + public int getReconnectAttempts() + { + return reconnectAttempts; + } + + public void setReconnectAttempts(int reconnectAttempts) + { + this.reconnectAttempts =3D reconnectAttempts; + } + + public boolean isFailoverOnServerShutdown() + { + return failoverOnServerShutdown; + } + + public void setFailoverOnServerShutdown(boolean failoverOnServerShutdow= n) + { + this.failoverOnServerShutdown =3D failoverOnServerShutdown; + } + + // Public -------------------------------------------------------- + + // Package protected --------------------------------------------- + + // Protected ----------------------------------------------------- + + // Private ------------------------------------------------------- + + // Inner classes ------------------------------------------------- + +} Added: trunk/src/main/org/hornetq/jms/server/config/impl/JMSConfigurationIm= pl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/src/main/org/hornetq/jms/server/config/impl/JMSConfigurationImpl.= java (rev 0) +++ trunk/src/main/org/hornetq/jms/server/config/impl/JMSConfigurationImpl.= java 2009-10-02 12:41:40 UTC (rev 8033) @@ -0,0 +1,102 @@ +/* + * 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.jms.server.config.impl; + +import java.util.ArrayList; +import java.util.List; + +import javax.naming.Context; + +import org.hornetq.jms.server.config.ConnectionFactoryConfiguration; +import org.hornetq.jms.server.config.JMSConfiguration; +import org.hornetq.jms.server.config.QueueConfiguration; +import org.hornetq.jms.server.config.TopicConfiguration; + +/** + * A JMSConfigurationImpl + * + * @author Jeff Mesnil + * + * + */ +public class JMSConfigurationImpl implements JMSConfiguration +{ + + private final List connectionFactoryCon= figurations =3D new ArrayList(); + + private final List queueConfigurations =3D new Arra= yList(); + + private final List topicConfigurations =3D new Arra= yList(); + + private Context context =3D null; + = + // Constants ----------------------------------------------------- + + // Attributes ---------------------------------------------------- + + // Static -------------------------------------------------------- + + // Constructors -------------------------------------------------- + + public JMSConfigurationImpl() + { + } + + public JMSConfigurationImpl(final List = connectionFactoryConfigurations, + final List queueConfigu= rations, + final List topicConfigu= rations) + { + this.connectionFactoryConfigurations.addAll(connectionFactoryConfigu= rations); + this.queueConfigurations.addAll(queueConfigurations); + this.topicConfigurations.addAll(topicConfigurations); + } + + // JMSConfiguration implementation ------------------------------- + + public List getConnectionFactoryConfigu= rations() + { + return connectionFactoryConfigurations; + } + + public List getQueueConfigurations() + { + return queueConfigurations; + } + + public List getTopicConfigurations() + { + return topicConfigurations; + } + + public Context getContext() + { + return context; + } + = + public void setContext(Context context) + { + this.context =3D context; + } + = + // Public -------------------------------------------------------- + + // Package protected --------------------------------------------- + + // Protected ----------------------------------------------------- + + // Private ------------------------------------------------------- + + // Inner classes ------------------------------------------------- + +} Added: trunk/src/main/org/hornetq/jms/server/config/impl/QueueConfiguration= Impl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/src/main/org/hornetq/jms/server/config/impl/QueueConfigurationImp= l.java (rev 0) +++ trunk/src/main/org/hornetq/jms/server/config/impl/QueueConfigurationImp= l.java 2009-10-02 12:41:40 UTC (rev 8033) @@ -0,0 +1,82 @@ +/* + * 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.jms.server.config.impl; + +import org.hornetq.jms.server.config.QueueConfiguration; + +/** + * A QueueConfigurationImpl + * + * @author Jeff Mesnil + * + * + */ +public class QueueConfigurationImpl implements QueueConfiguration +{ + = + // Constants ----------------------------------------------------- + + // Attributes ---------------------------------------------------- + + private final String name; + private final String selector; + private final boolean durable; + private final String[] bindings; + + // Static -------------------------------------------------------- + + // Constructors -------------------------------------------------- + + public QueueConfigurationImpl(String name, String selector, boolean dur= able, String... bindings) + { + this.name =3D name; + this.selector =3D selector; + this.durable =3D durable; + this.bindings =3D new String[bindings.length]; + System.arraycopy(bindings, 0, this.bindings, 0, bindings.length); + } + = + // QueueConfiguration implementation ----------------------------- + = + public String[] getBindings() + { + return bindings; + } + + public String getName() + { + return name; + } + + public String getSelector() + { + return selector; + } + + public boolean isDurable() + { + return durable; + } + = + // Public -------------------------------------------------------- + + // Package protected --------------------------------------------- + + // Protected ----------------------------------------------------- + + // Private ------------------------------------------------------- + + // Inner classes ------------------------------------------------- + +} Added: trunk/src/main/org/hornetq/jms/server/config/impl/TopicConfiguration= Impl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/src/main/org/hornetq/jms/server/config/impl/TopicConfigurationImp= l.java (rev 0) +++ trunk/src/main/org/hornetq/jms/server/config/impl/TopicConfigurationImp= l.java 2009-10-02 12:41:40 UTC (rev 8033) @@ -0,0 +1,68 @@ +/* + * 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.jms.server.config.impl; + +import org.hornetq.jms.server.config.TopicConfiguration; + +/** + * A TopicConfigurationImpl + * + * @author Jeff Mesnil + * + * + */ +public class TopicConfigurationImpl implements TopicConfiguration +{ + = + // Constants ----------------------------------------------------- + + // Attributes ---------------------------------------------------- + + private final String name; + private final String[] bindings; + + // Static -------------------------------------------------------- + + // Constructors -------------------------------------------------- + + public TopicConfigurationImpl(String name, String... bindings) + { + this.name =3D name; + this.bindings =3D new String[bindings.length]; + System.arraycopy(bindings, 0, this.bindings, 0, bindings.length); + } + = + // TopicConfiguration implementation ----------------------------- + = + public String[] getBindings() + { + return bindings; + } + + public String getName() + { + return name; + } + = + // Public -------------------------------------------------------- + + // Package protected --------------------------------------------- + + // Protected ----------------------------------------------------- + + // Private ------------------------------------------------------- + + // Inner classes ------------------------------------------------- + +} Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.j= ava =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 20= 09-10-02 12:36:05 UTC (rev 8032) +++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 20= 09-10-02 12:41:40 UTC (rev 8033) @@ -14,6 +14,7 @@ package org.hornetq.jms.server.impl; = import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -37,6 +38,10 @@ import org.hornetq.jms.client.HornetQConnectionFactory; import org.hornetq.jms.client.SelectorTranslator; import org.hornetq.jms.server.JMSServerManager; +import org.hornetq.jms.server.config.ConnectionFactoryConfiguration; +import org.hornetq.jms.server.config.JMSConfiguration; +import org.hornetq.jms.server.config.QueueConfiguration; +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.Pair; @@ -79,9 +84,11 @@ private DeploymentManager deploymentManager; = private final String configFileName; - = + private boolean contextSet; - = + + private JMSConfiguration config; + public JMSServerManagerImpl(final HornetQServer server) throws Exception { this.server =3D server; @@ -96,6 +103,15 @@ this.configFileName =3D configFileName; } = + public JMSServerManagerImpl(final HornetQServer server, final JMSConfig= uration configuration) throws Exception + { + this.server =3D server; + + this.configFileName =3D null; + + this.config =3D configuration; + } + // ActivateCallback implementation ------------------------------------- = public synchronized void activated() @@ -118,6 +134,8 @@ jmsDeployer.start(); = deploymentManager.start(); + + deploy(); } catch (Exception e) { @@ -709,4 +727,112 @@ } destinations.get(destination).add(jndiBinding); } + + private void deploy() throws Exception + { + if (config =3D=3D null) + { + return; + } + = + if (config.getContext() !=3D null) + { + setContext(config.getContext()); + } + + List connectionFactoryConfigurations= =3D config.getConnectionFactoryConfigurations(); + for (ConnectionFactoryConfiguration config : connectionFactoryConfig= urations) + { + if (config.getDiscoveryAddress() !=3D null) + { + createConnectionFactory(config.getName(), + config.getDiscoveryAddress(), + config.getDiscoveryPort(), + config.getClientID(), + config.getDiscoveryRefreshTimeout(), + config.getClientFailureCheckPeriod(), + config.getConnectionTTL(), + config.getCallTimeout(), + config.getMaxConnections(), + config.isCacheLargeMessagesClient(), + config.getMinLargeMessageSize(), + config.getConsumerWindowSize(), + config.getConsumerMaxRate(), + config.getProducerWindowSize(), + config.getProducerMaxRate(), + config.isBlockOnAcknowledge(), + config.isBlockOnPersistentSend(), + config.isBlockOnNonPersistentSend(), + config.isAutoGroup(), + config.isPreAcknowledge(), + config.getLoadBalancingPolicyClassName= (), + config.getTransactionBatchSize(), + config.getDupsOKBatchSize(), + config.getInitialWaitTimeout(), + config.isUseGlobalPools(), + config.getScheduledThreadPoolMaxSize(), + config.getThreadPoolMaxSize(), + config.getRetryInterval(), + config.getRetryIntervalMultiplier(), + config.getMaxRetryInterval(), + config.getReconnectAttempts(), + config.isFailoverOnServerShutdown(), + Arrays.asList(config.getBindings())); + } + else + { + createConnectionFactory(config.getName(), + config.getConnectorConfigs(), + config.getClientID(), + config.getClientFailureCheckPeriod(), + config.getConnectionTTL(), + config.getCallTimeout(), + config.getMaxConnections(), + config.isCacheLargeMessagesClient(), + config.getMinLargeMessageSize(), + config.getConsumerWindowSize(), + config.getConsumerMaxRate(), + config.getProducerWindowSize(), + config.getProducerMaxRate(), + config.isBlockOnAcknowledge(), + config.isBlockOnPersistentSend(), + config.isBlockOnNonPersistentSend(), + config.isAutoGroup(), + config.isPreAcknowledge(), + config.getLoadBalancingPolicyClassName= (), + config.getTransactionBatchSize(), + config.getDupsOKBatchSize(), + config.isUseGlobalPools(), + config.getScheduledThreadPoolMaxSize(), + config.getThreadPoolMaxSize(), + config.getRetryInterval(), + config.getRetryIntervalMultiplier(), + config.getMaxRetryInterval(), + config.getReconnectAttempts(), + config.isFailoverOnServerShutdown(), + Arrays.asList(config.getBindings())); + } + } + + List queueConfigs =3D config.getQueueConfigurati= ons(); + for (QueueConfiguration config : queueConfigs) + { + String[] bindings =3D config.getBindings(); + for (String binding : bindings) + { + createQueue(config.getName(), binding, config.getSelector(), c= onfig.isDurable()); + } + } + + List topicConfigs =3D config.getTopicConfigurati= ons(); + for (TopicConfiguration config : topicConfigs) + { + String[] bindings =3D config.getBindings(); + for (String binding : bindings) + { + createTopic(config.getName(), binding); + } + } + } + } Added: trunk/tests/src/org/hornetq/tests/integration/jms/server/config/JMSC= onfigurationTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/tests/src/org/hornetq/tests/integration/jms/server/config/JMSConf= igurationTest.java (rev 0) +++ trunk/tests/src/org/hornetq/tests/integration/jms/server/config/JMSConf= igurationTest.java 2009-10-02 12:41:40 UTC (rev 8033) @@ -0,0 +1,126 @@ +/* + * 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.jms.server.config; + +import static org.hornetq.tests.util.RandomUtil.randomString; + +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.Queue; +import javax.jms.Topic; +import javax.naming.Context; + +import org.hornetq.core.config.Configuration; +import org.hornetq.core.config.TransportConfiguration; +import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory; +import org.hornetq.core.server.HornetQServer; +import org.hornetq.core.server.impl.HornetQServerImpl; +import org.hornetq.jms.server.JMSServerManager; +import org.hornetq.jms.server.config.ConnectionFactoryConfiguration; +import org.hornetq.jms.server.config.JMSConfiguration; +import org.hornetq.jms.server.config.TopicConfiguration; +import org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationIm= pl; +import org.hornetq.jms.server.config.impl.JMSConfigurationImpl; +import org.hornetq.jms.server.config.impl.QueueConfigurationImpl; +import org.hornetq.jms.server.config.impl.TopicConfigurationImpl; +import org.hornetq.jms.server.impl.JMSServerManagerImpl; +import org.hornetq.tests.unit.util.InVMContext; +import org.hornetq.tests.util.ServiceTestBase; + +/** + * A JMSConfigurationTest + * + * @author Jeff Mesnil + * + * + */ +public class JMSConfigurationTest extends ServiceTestBase +{ + + // Constants ----------------------------------------------------- + + // Attributes ---------------------------------------------------- + + // Static -------------------------------------------------------- + + // Constructors -------------------------------------------------- + + public void testSetupJMSConfiguration() throws Exception + { + Context context =3D new InVMContext(); + + Configuration coreConfiguration =3D createDefaultConfig(false); + HornetQServer coreServer =3D new HornetQServerImpl(coreConfiguration= ); + + JMSConfiguration jmsConfiguration =3D new JMSConfigurationImpl(); + jmsConfiguration.setContext(context); + TransportConfiguration connectorConfig =3D new TransportConfiguratio= n(InVMConnectorFactory.class.getName()); + ConnectionFactoryConfiguration cfConfig =3D new ConnectionFactoryCon= figurationImpl(randomString(), + = connectorConfig, + = "/cf/binding1", + = "/cf/binding2"); + jmsConfiguration.getConnectionFactoryConfigurations().add(cfConfig); + QueueConfigurationImpl queueConfig =3D new QueueConfigurationImpl(ra= ndomString(), + null, + fals= e, + "/qu= eue/binding1", + "/qu= eue/binding2"); + jmsConfiguration.getQueueConfigurations().add(queueConfig); + TopicConfiguration topicConfig =3D new TopicConfigurationImpl(random= String(), "/topic/binding1", "/topic/binding2"); + jmsConfiguration.getTopicConfigurations().add(topicConfig); + + JMSServerManager server =3D new JMSServerManagerImpl(coreServer, jms= Configuration); + server.start(); + + for (String binding : cfConfig.getBindings()) + { + Object o =3D context.lookup(binding); + assertNotNull(o); + assertTrue(o instanceof ConnectionFactory); + ConnectionFactory cf =3D (ConnectionFactory)o; + Connection connection =3D cf.createConnection(); + connection.close(); + } + + for (String binding : queueConfig.getBindings()) + { + Object o =3D context.lookup(binding); + assertNotNull(o); + assertTrue(o instanceof Queue); + Queue queue =3D (Queue)o; + assertEquals(queueConfig.getName(), queue.getQueueName()); + } + + for (String binding : topicConfig.getBindings()) + { + Object o =3D context.lookup(binding); + assertNotNull(o); + assertTrue(o instanceof Topic); + Topic topic =3D (Topic)o; + assertEquals(topicConfig.getName(), topic.getTopicName()); + } + + server.stop(); + } + // Public -------------------------------------------------------- + + // Package protected --------------------------------------------- + + // Protected ----------------------------------------------------- + + // Private ------------------------------------------------------- + + // Inner classes ------------------------------------------------- + +} --===============4355044984883297757==--