[jboss-cvs] JBoss Messaging SVN: r5927 - in trunk: examples/messaging/src/org/jboss/messaging/example and 103 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Feb 25 06:15:57 EST 2009
Author: ataylor
Date: 2009-02-25 06:15:55 -0500 (Wed, 25 Feb 2009)
New Revision: 5927
Added:
trunk/src/main/org/jboss/messaging/utils/
trunk/src/main/org/jboss/messaging/utils/Base64.java
trunk/src/main/org/jboss/messaging/utils/ConcurrentHashSet.java
trunk/src/main/org/jboss/messaging/utils/ConcurrentSet.java
trunk/src/main/org/jboss/messaging/utils/ConfigurationHelper.java
trunk/src/main/org/jboss/messaging/utils/DataConstants.java
trunk/src/main/org/jboss/messaging/utils/ExecutorFactory.java
trunk/src/main/org/jboss/messaging/utils/Future.java
trunk/src/main/org/jboss/messaging/utils/IDGenerator.java
trunk/src/main/org/jboss/messaging/utils/JBMThreadFactory.java
trunk/src/main/org/jboss/messaging/utils/JNDIUtil.java
trunk/src/main/org/jboss/messaging/utils/ObjectInputStreamWithClassLoader.java
trunk/src/main/org/jboss/messaging/utils/OrderedExecutorFactory.java
trunk/src/main/org/jboss/messaging/utils/Pair.java
trunk/src/main/org/jboss/messaging/utils/Random.java
trunk/src/main/org/jboss/messaging/utils/SimpleIDGenerator.java
trunk/src/main/org/jboss/messaging/utils/SimpleString.java
trunk/src/main/org/jboss/messaging/utils/SimpleStringReader.java
trunk/src/main/org/jboss/messaging/utils/TimeAndCounterIDGenerator.java
trunk/src/main/org/jboss/messaging/utils/TokenBucketLimiter.java
trunk/src/main/org/jboss/messaging/utils/TokenBucketLimiterImpl.java
trunk/src/main/org/jboss/messaging/utils/TypedProperties.java
trunk/src/main/org/jboss/messaging/utils/UTF8Util.java
trunk/src/main/org/jboss/messaging/utils/UUID.java
trunk/src/main/org/jboss/messaging/utils/UUIDGenerator.java
trunk/src/main/org/jboss/messaging/utils/UUIDTimer.java
trunk/src/main/org/jboss/messaging/utils/VariableLatch.java
trunk/src/main/org/jboss/messaging/utils/VersionLoader.java
trunk/src/main/org/jboss/messaging/utils/XMLUtil.java
Removed:
trunk/src/main/org/jboss/messaging/util/Base64.java
trunk/src/main/org/jboss/messaging/util/ConcurrentHashSet.java
trunk/src/main/org/jboss/messaging/util/ConcurrentSet.java
trunk/src/main/org/jboss/messaging/util/ConfigurationHelper.java
trunk/src/main/org/jboss/messaging/util/DataConstants.java
trunk/src/main/org/jboss/messaging/util/ExecutorFactory.java
trunk/src/main/org/jboss/messaging/util/Future.java
trunk/src/main/org/jboss/messaging/util/IDGenerator.java
trunk/src/main/org/jboss/messaging/util/JBMThreadFactory.java
trunk/src/main/org/jboss/messaging/util/JNDIUtil.java
trunk/src/main/org/jboss/messaging/util/ObjectInputStreamWithClassLoader.java
trunk/src/main/org/jboss/messaging/util/OrderedExecutorFactory.java
trunk/src/main/org/jboss/messaging/util/Pair.java
trunk/src/main/org/jboss/messaging/util/Random.java
trunk/src/main/org/jboss/messaging/util/SimpleIDGenerator.java
trunk/src/main/org/jboss/messaging/util/SimpleString.java
trunk/src/main/org/jboss/messaging/util/SimpleStringReader.java
trunk/src/main/org/jboss/messaging/util/TimeAndCounterIDGenerator.java
trunk/src/main/org/jboss/messaging/util/TokenBucketLimiter.java
trunk/src/main/org/jboss/messaging/util/TokenBucketLimiterImpl.java
trunk/src/main/org/jboss/messaging/util/TypedProperties.java
trunk/src/main/org/jboss/messaging/util/UTF8Util.java
trunk/src/main/org/jboss/messaging/util/UUID.java
trunk/src/main/org/jboss/messaging/util/UUIDGenerator.java
trunk/src/main/org/jboss/messaging/util/UUIDTimer.java
trunk/src/main/org/jboss/messaging/util/VariableLatch.java
trunk/src/main/org/jboss/messaging/util/VersionLoader.java
trunk/src/main/org/jboss/messaging/util/XMLUtil.java
Modified:
trunk/examples/jms/src/org/jboss/jms/example/EJB3MDBExample.java
trunk/examples/jms/src/org/jboss/jms/example/PerfExample.java
trunk/examples/messaging/src/org/jboss/messaging/example/HttpClient.java
trunk/examples/messaging/src/org/jboss/messaging/example/ManagementClient.java
trunk/examples/messaging/src/org/jboss/messaging/example/SSLClient.java
trunk/examples/messaging/src/org/jboss/messaging/example/ScheduledMessageExample.java
trunk/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java
trunk/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java
trunk/examples/messaging/src/org/jboss/messaging/example/WildCardClient.java
trunk/src/main/org/jboss/messaging/core/client/ClientProducer.java
trunk/src/main/org/jboss/messaging/core/client/ClientRequestor.java
trunk/src/main/org/jboss/messaging/core/client/ClientSession.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientMessageImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/RandomConnectionLoadBalancingPolicy.java
trunk/src/main/org/jboss/messaging/core/client/impl/RoundRobinConnectionLoadBalancingPolicy.java
trunk/src/main/org/jboss/messaging/core/client/management/impl/ManagementHelper.java
trunk/src/main/org/jboss/messaging/core/cluster/DiscoveryGroup.java
trunk/src/main/org/jboss/messaging/core/cluster/impl/DiscoveryGroupImpl.java
trunk/src/main/org/jboss/messaging/core/config/Configuration.java
trunk/src/main/org/jboss/messaging/core/config/cluster/BridgeConfiguration.java
trunk/src/main/org/jboss/messaging/core/config/cluster/BroadcastGroupConfiguration.java
trunk/src/main/org/jboss/messaging/core/config/cluster/ClusterConnectionConfiguration.java
trunk/src/main/org/jboss/messaging/core/config/cluster/MessageFlowConfiguration.java
trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java
trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java
trunk/src/main/org/jboss/messaging/core/deployers/impl/AddressSettingsDeployer.java
trunk/src/main/org/jboss/messaging/core/deployers/impl/BasicSecurityDeployer.java
trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueDeployer.java
trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityDeployer.java
trunk/src/main/org/jboss/messaging/core/deployers/impl/XmlDeployer.java
trunk/src/main/org/jboss/messaging/core/filter/Filter.java
trunk/src/main/org/jboss/messaging/core/filter/impl/FilterImpl.java
trunk/src/main/org/jboss/messaging/core/filter/impl/FilterParser.jj
trunk/src/main/org/jboss/messaging/core/filter/impl/Identifier.java
trunk/src/main/org/jboss/messaging/core/filter/impl/Operator.java
trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
trunk/src/main/org/jboss/messaging/core/management/ManagementService.java
trunk/src/main/org/jboss/messaging/core/management/MessagingServerControlMBean.java
trunk/src/main/org/jboss/messaging/core/management/Notification.java
trunk/src/main/org/jboss/messaging/core/management/ObjectNames.java
trunk/src/main/org/jboss/messaging/core/management/PairsInfo.java
trunk/src/main/org/jboss/messaging/core/management/impl/AddressControl.java
trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
trunk/src/main/org/jboss/messaging/core/management/impl/MessagingServerControl.java
trunk/src/main/org/jboss/messaging/core/management/impl/QueueControl.java
trunk/src/main/org/jboss/messaging/core/management/impl/ReplicationOperationInvokerImpl.java
trunk/src/main/org/jboss/messaging/core/message/Message.java
trunk/src/main/org/jboss/messaging/core/message/impl/MessageImpl.java
trunk/src/main/org/jboss/messaging/core/paging/PagingManager.java
trunk/src/main/org/jboss/messaging/core/paging/PagingStore.java
trunk/src/main/org/jboss/messaging/core/paging/PagingStoreFactory.java
trunk/src/main/org/jboss/messaging/core/paging/impl/PageImpl.java
trunk/src/main/org/jboss/messaging/core/paging/impl/PageTransactionInfoImpl.java
trunk/src/main/org/jboss/messaging/core/paging/impl/PagedMessageImpl.java
trunk/src/main/org/jboss/messaging/core/paging/impl/PagingManagerImpl.java
trunk/src/main/org/jboss/messaging/core/paging/impl/PagingStoreFactoryNIO.java
trunk/src/main/org/jboss/messaging/core/paging/impl/PagingStoreImpl.java
trunk/src/main/org/jboss/messaging/core/persistence/QueueBindingInfo.java
trunk/src/main/org/jboss/messaging/core/persistence/StorageManager.java
trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalLargeServerMessage.java
trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java
trunk/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageManager.java
trunk/src/main/org/jboss/messaging/core/postoffice/Address.java
trunk/src/main/org/jboss/messaging/core/postoffice/AddressManager.java
trunk/src/main/org/jboss/messaging/core/postoffice/Binding.java
trunk/src/main/org/jboss/messaging/core/postoffice/Bindings.java
trunk/src/main/org/jboss/messaging/core/postoffice/DuplicateIDCache.java
trunk/src/main/org/jboss/messaging/core/postoffice/PostOffice.java
trunk/src/main/org/jboss/messaging/core/postoffice/QueueInfo.java
trunk/src/main/org/jboss/messaging/core/postoffice/impl/AddressImpl.java
trunk/src/main/org/jboss/messaging/core/postoffice/impl/BindingsImpl.java
trunk/src/main/org/jboss/messaging/core/postoffice/impl/DivertBinding.java
trunk/src/main/org/jboss/messaging/core/postoffice/impl/DuplicateIDCacheImpl.java
trunk/src/main/org/jboss/messaging/core/postoffice/impl/LocalQueueBinding.java
trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
trunk/src/main/org/jboss/messaging/core/postoffice/impl/SimpleAddressManager.java
trunk/src/main/org/jboss/messaging/core/postoffice/impl/WildcardAddressManager.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/AbstractBufferHandler.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/ByteBufferWrapper.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/ExpandingMessagingBuffer.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMAcceptor.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnection.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/RollbackMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionAddDestinationMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryResponseMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionContinuationMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateConsumerMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateQueueMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionDeleteQueueMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryResponseMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveContinuationMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionRemoveDestinationMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendContinuationMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/XidCodecSupport.java
trunk/src/main/org/jboss/messaging/core/remoting/spi/MessagingBuffer.java
trunk/src/main/org/jboss/messaging/core/security/SecurityStore.java
trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java
trunk/src/main/org/jboss/messaging/core/server/Divert.java
trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java
trunk/src/main/org/jboss/messaging/core/server/Queue.java
trunk/src/main/org/jboss/messaging/core/server/QueueFactory.java
trunk/src/main/org/jboss/messaging/core/server/cluster/Bridge.java
trunk/src/main/org/jboss/messaging/core/server/cluster/BroadcastGroup.java
trunk/src/main/org/jboss/messaging/core/server/cluster/ClusterConnection.java
trunk/src/main/org/jboss/messaging/core/server/cluster/RemoteQueueBinding.java
trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java
trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BroadcastGroupImpl.java
trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java
trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java
trunk/src/main/org/jboss/messaging/core/server/cluster/impl/Redistributor.java
trunk/src/main/org/jboss/messaging/core/server/cluster/impl/RemoteQueueBindingImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/DivertImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/GroupingRoundRobinDistributor.java
trunk/src/main/org/jboss/messaging/core/server/impl/MessageReferenceImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/QueueFactoryImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/SoloQueueImpl.java
trunk/src/main/org/jboss/messaging/core/settings/impl/AddressSettings.java
trunk/src/main/org/jboss/messaging/core/transaction/impl/XidImpl.java
trunk/src/main/org/jboss/messaging/integration/transports/mina/IoBufferWrapper.java
trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaAcceptor.java
trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnector.java
trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaProtocolCodecFilter.java
trunk/src/main/org/jboss/messaging/integration/transports/netty/ChannelBufferWrapper.java
trunk/src/main/org/jboss/messaging/integration/transports/netty/MessagingFrameDecoder.java
trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java
trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java
trunk/src/main/org/jboss/messaging/jms/JBossDestination.java
trunk/src/main/org/jboss/messaging/jms/JBossQueue.java
trunk/src/main/org/jboss/messaging/jms/JBossTopic.java
trunk/src/main/org/jboss/messaging/jms/client/JBossConnection.java
trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java
trunk/src/main/org/jboss/messaging/jms/client/JBossMapMessage.java
trunk/src/main/org/jboss/messaging/jms/client/JBossMessage.java
trunk/src/main/org/jboss/messaging/jms/client/JBossMessageConsumer.java
trunk/src/main/org/jboss/messaging/jms/client/JBossMessageProducer.java
trunk/src/main/org/jboss/messaging/jms/client/JBossObjectMessage.java
trunk/src/main/org/jboss/messaging/jms/client/JBossQueueBrowser.java
trunk/src/main/org/jboss/messaging/jms/client/JBossSession.java
trunk/src/main/org/jboss/messaging/jms/client/JBossStreamMessage.java
trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java
trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
trunk/src/main/org/jboss/messaging/jms/server/management/JMSMessageInfo.java
trunk/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java
trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSQueueControl.java
trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java
trunk/src/main/org/jboss/messaging/jms/server/management/impl/TopicControl.java
trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java
trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivationSpec.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCReceiver.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCSender.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/MockJBossSecurityManager.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/ServiceContainerConfiguration.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/jboss/MBeanConfigurationElement.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/jboss/ServiceDeploymentDescriptor.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/util/JNDIUtilTest.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/util/MBeanConfigurationElementTest.java
trunk/tests/src/org/jboss/messaging/tests/concurrent/server/impl/QueueTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/DuplicateDetectionTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/basic/AutoGroupClientTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/basic/ClientRequestorTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/basic/CoreClientTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkTestBase.java
trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientExitTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/DummyInterceptor.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeReconnectTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeStartTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/SimpleTransformer.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ActivationTimeoutTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/AutomaticFailoverWithDiscoveryTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailBackupServerTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverExpiredMessageTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverManagementTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverNoSessionsFailoverTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverPreAcknowledgeTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverScheduledMessageTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailureOnCreateConnectionTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/JustReplicationTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/RandomFailoverTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectWithBackupTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleAutomaticFailoverTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleManualFailoverTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SplitBrainTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareAddressControlWrapperTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareMessagingServerControlWrapperTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareQueueControlWrapperTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/consumer/ConsumerTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/consumer/RedeliveryConsumerTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/consumer/TransactionDurabilityTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/discovery/DiscoveryTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/divert/DivertTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/divert/PersistentDivertTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/http/CoreClientOverHttpTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/JMSFailoverTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/consumer/ConsumerTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/BridgeControlTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementControlHelper.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementServiceImplTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/NotificationTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/QueueControlTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementTestBase.java
trunk/tests/src/org/jboss/messaging/tests/integration/paging/PageCrashTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/paging/PagingManagerIntegrationTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/paging/PagingServiceIntegrationTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/queue/DeadLetterAddressTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/queue/ExpiryAddressTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/queue/ExpiryRunnerTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/queue/MessageGroupingTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/queue/PredefinedQueueTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/queue/SoloQueueRecoveryTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/queue/SoloQueueTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/scheduling/ScheduledMessageTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/session/CreateQueueTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/session/SendAcknowledgementsTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSLTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/wildcard/WildCardRoutingTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/xa/XaTimeoutTest.java
trunk/tests/src/org/jboss/messaging/tests/performance/paging/MeasurePagingMultiThreadTest.java
trunk/tests/src/org/jboss/messaging/tests/performance/persistence/FakeBinding.java
trunk/tests/src/org/jboss/messaging/tests/performance/persistence/FakePostOffice.java
trunk/tests/src/org/jboss/messaging/tests/performance/persistence/StorageManagerTimingTest.java
trunk/tests/src/org/jboss/messaging/tests/stress/failover/PagingFailoverStressTest.java
trunk/tests/src/org/jboss/messaging/tests/stress/paging/PageStressTest.java
trunk/tests/src/org/jboss/messaging/tests/timing/core/server/impl/QueueImplTest.java
trunk/tests/src/org/jboss/messaging/tests/timing/util/TokenBucketLimiterImplTest.java
trunk/tests/src/org/jboss/messaging/tests/timing/util/UTF8Test.java
trunk/tests/src/org/jboss/messaging/tests/timing/util/VariableLatchTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ClientSessionImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/client/management/impl/ManagementHelperTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/ConfigurationImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/ConfigurationValidationTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/FileConfigurationTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/QueueDeployerTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/AddressSettingsDeployerTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/BasicSecurityDeployerTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/SecurityDeployerTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/XMLDeployerTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/filter/impl/FilterParserTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/filter/impl/FilterTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/filter/impl/OperatorTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/AddressControlTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/ManagementServiceImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/QueueControlTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/message/impl/MessageImplTestBase.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PageImplTestBase.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PagingStoreImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PagingStoreTestBase.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/persistence/impl/journal/JournalStorageManagerTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/AddressImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/PostOfficeImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/MessagingBufferTestBase.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/security/impl/SecurityStoreImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/GroupingRoundRobinDistributionPolicyTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/QueueFactoryImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/QueueImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/ServerMessageImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakeConsumer.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakeFilter.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakeQueueFactory.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/settings/impl/AddressSettingsTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/jms/JBossTemporaryTopicTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/jms/JBossTopicTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageProducerTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossQueueBrowserTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/JMSMessageInfoTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/impl/JMSQueueControlTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/util/ConcurrentHashSetTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/util/ObjectInputStreamWithClassLoaderTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/util/SimpleStringTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/util/TimeAndCounterIDGeneratorTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/util/TypedPropertiesTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/util/UTF8Test.java
trunk/tests/src/org/jboss/messaging/tests/unit/util/UUIDGeneratorTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/util/UUIDTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/util/VariableLatchTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/util/VersionLoaderTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/util/XMLUtilTest.java
trunk/tests/src/org/jboss/messaging/tests/util/RandomUtil.java
trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java
Log:
renamed util package
Modified: trunk/examples/jms/src/org/jboss/jms/example/EJB3MDBExample.java
===================================================================
--- trunk/examples/jms/src/org/jboss/jms/example/EJB3MDBExample.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/examples/jms/src/org/jboss/jms/example/EJB3MDBExample.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -49,6 +49,11 @@
})
public class EJB3MDBExample implements MessageListener
{
+ public EJB3MDBExample()
+ {
+ System.out.println("this = " + this);
+ }
+
public void onMessage(Message m)
{
businessLogic(m);
Modified: trunk/examples/jms/src/org/jboss/jms/example/PerfExample.java
===================================================================
--- trunk/examples/jms/src/org/jboss/jms/example/PerfExample.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/examples/jms/src/org/jboss/jms/example/PerfExample.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -39,8 +39,8 @@
import org.jboss.jms.util.PerfParams;
import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.util.TokenBucketLimiter;
-import org.jboss.messaging.util.TokenBucketLimiterImpl;
+import org.jboss.messaging.utils.TokenBucketLimiter;
+import org.jboss.messaging.utils.TokenBucketLimiterImpl;
/**
* A simple example that can be used to gather basic performance measurements.
Modified: trunk/examples/messaging/src/org/jboss/messaging/example/HttpClient.java
===================================================================
--- trunk/examples/messaging/src/org/jboss/messaging/example/HttpClient.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/examples/messaging/src/org/jboss/messaging/example/HttpClient.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -31,7 +31,7 @@
import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.exception.MessagingException;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* Uses the core messaging API to send and receive a message to a queue via http. You will need to enable the server with
Modified: trunk/examples/messaging/src/org/jboss/messaging/example/ManagementClient.java
===================================================================
--- trunk/examples/messaging/src/org/jboss/messaging/example/ManagementClient.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/examples/messaging/src/org/jboss/messaging/example/ManagementClient.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -40,7 +40,7 @@
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.management.ObjectNames;
import org.jboss.messaging.core.security.impl.SecurityStoreImpl;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/*
* Uses the core messaging API to send and receive a message to a queue.
Modified: trunk/examples/messaging/src/org/jboss/messaging/example/SSLClient.java
===================================================================
--- trunk/examples/messaging/src/org/jboss/messaging/example/SSLClient.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/examples/messaging/src/org/jboss/messaging/example/SSLClient.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -30,7 +30,7 @@
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.integration.transports.netty.TransportConstants;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A simple Client that uses SSL
Modified: trunk/examples/messaging/src/org/jboss/messaging/example/ScheduledMessageExample.java
===================================================================
--- trunk/examples/messaging/src/org/jboss/messaging/example/ScheduledMessageExample.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/examples/messaging/src/org/jboss/messaging/example/ScheduledMessageExample.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -35,7 +35,7 @@
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.message.impl.MessageImpl;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java
===================================================================
--- trunk/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -29,8 +29,7 @@
import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.exception.MessagingException;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.jms.client.JBossMessage;
+import org.jboss.messaging.utils.SimpleString;
import org.jboss.messaging.jms.client.JBossTextMessage;
/**
Modified: trunk/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java
===================================================================
--- trunk/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -32,7 +32,7 @@
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingService;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A simple server is started with TCP transport, a message is sent and received.
Modified: trunk/examples/messaging/src/org/jboss/messaging/example/WildCardClient.java
===================================================================
--- trunk/examples/messaging/src/org/jboss/messaging/example/WildCardClient.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/examples/messaging/src/org/jboss/messaging/example/WildCardClient.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -31,7 +31,7 @@
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/src/main/org/jboss/messaging/core/client/ClientProducer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/ClientProducer.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/client/ClientProducer.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,7 +24,7 @@
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.message.Message;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/jboss/messaging/core/client/ClientRequestor.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/ClientRequestor.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/client/ClientRequestor.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -21,12 +21,12 @@
*/
package org.jboss.messaging.core.client;
-import static org.jboss.messaging.util.SimpleString.toSimpleString;
+import static org.jboss.messaging.utils.SimpleString.toSimpleString;
+import org.jboss.messaging.utils.SimpleString;
import java.util.UUID;
import org.jboss.messaging.core.client.impl.ClientMessageImpl;
-import org.jboss.messaging.util.SimpleString;
/**
* a ClientRequestor.
Modified: trunk/src/main/org/jboss/messaging/core/client/ClientSession.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/ClientSession.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/client/ClientSession.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -30,7 +30,7 @@
import org.jboss.messaging.core.remoting.FailureListener;
import org.jboss.messaging.core.remoting.impl.wireformat.SessionBindingQueryResponseMessage;
import org.jboss.messaging.core.remoting.impl.wireformat.SessionQueueQueryResponseMessage;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/*
*
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -32,7 +32,7 @@
import org.jboss.messaging.core.remoting.impl.wireformat.SessionReceiveContinuationMessage;
import org.jboss.messaging.core.remoting.impl.wireformat.SessionReceiveMessage;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.Future;
+import org.jboss.messaging.utils.Future;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -515,7 +515,7 @@
return;
}
- Future future = new Future();
+ org.jboss.messaging.utils.Future future = new Future();
sessionExecutor.execute(future);
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientMessageImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientMessageImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientMessageImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -25,7 +25,7 @@
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.message.impl.MessageImpl;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -22,7 +22,7 @@
package org.jboss.messaging.core.client.impl;
-import static org.jboss.messaging.util.SimpleString.toSimpleString;
+import static org.jboss.messaging.utils.SimpleString.toSimpleString;
import java.nio.ByteBuffer;
@@ -35,9 +35,9 @@
import org.jboss.messaging.core.remoting.impl.wireformat.SessionSendContinuationMessage;
import org.jboss.messaging.core.remoting.impl.wireformat.SessionSendMessage;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.TokenBucketLimiter;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.TokenBucketLimiter;
+import org.jboss.messaging.utils.UUIDGenerator;
/**
* The client-side Producer connectionFactory class.
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -28,8 +28,8 @@
import org.jboss.messaging.core.config.impl.ConfigurationImpl;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.UUIDGenerator;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -21,7 +21,7 @@
*/
package org.jboss.messaging.core.client.impl;
-import static org.jboss.messaging.util.SimpleString.toSimpleString;
+import static org.jboss.messaging.utils.SimpleString.toSimpleString;
import java.io.File;
import java.util.HashSet;
@@ -83,14 +83,12 @@
import org.jboss.messaging.core.remoting.impl.wireformat.SessionXASetTimeoutResponseMessage;
import org.jboss.messaging.core.remoting.impl.wireformat.SessionXAStartMessage;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.ConcurrentHashSet;
-import org.jboss.messaging.util.ExecutorFactory;
-import org.jboss.messaging.util.IDGenerator;
-import org.jboss.messaging.util.JBMThreadFactory;
-import org.jboss.messaging.util.OrderedExecutorFactory;
-import org.jboss.messaging.util.SimpleIDGenerator;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.TokenBucketLimiterImpl;
+import org.jboss.messaging.utils.ConcurrentHashSet;
+import org.jboss.messaging.utils.IDGenerator;
+import org.jboss.messaging.utils.OrderedExecutorFactory;
+import org.jboss.messaging.utils.SimpleIDGenerator;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.TokenBucketLimiterImpl;
/*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -118,7 +116,7 @@
public static final int INITIAL_MESSAGE_BODY_SIZE = 1024;
- private static final ExecutorFactory executorFactory = new OrderedExecutorFactory(Executors.newCachedThreadPool(new JBMThreadFactory("jbm-client-session-threads")));
+ private static final org.jboss.messaging.utils.ExecutorFactory executorFactory = new OrderedExecutorFactory(Executors.newCachedThreadPool(new org.jboss.messaging.utils.JBMThreadFactory("jbm-client-session-threads")));
// Attributes ----------------------------------------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -54,9 +54,8 @@
import org.jboss.messaging.core.remoting.spi.ConnectorFactory;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
import org.jboss.messaging.core.version.Version;
-import org.jboss.messaging.util.JBMThreadFactory;
-import org.jboss.messaging.util.UUIDGenerator;
-import org.jboss.messaging.util.VersionLoader;
+import org.jboss.messaging.utils.UUIDGenerator;
+import org.jboss.messaging.utils.VersionLoader;
/**
* A ConnectionManagerImpl
@@ -107,7 +106,7 @@
// TODO - allow this to be configurable
private static final ScheduledThreadPoolExecutor pingExecutor = new ScheduledThreadPoolExecutor(5,
- new JBMThreadFactory("jbm-pinger-threads"));
+ new org.jboss.messaging.utils.JBMThreadFactory("jbm-pinger-threads"));
private final Map<Object, ConnectionEntry> connections = new LinkedHashMap<Object, ConnectionEntry>();
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/RandomConnectionLoadBalancingPolicy.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/RandomConnectionLoadBalancingPolicy.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/RandomConnectionLoadBalancingPolicy.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,7 +24,7 @@
package org.jboss.messaging.core.client.impl;
import org.jboss.messaging.core.client.ConnectionLoadBalancingPolicy;
-import org.jboss.messaging.util.Random;
+import org.jboss.messaging.utils.Random;
/**
* A RandomConnectionLoadBalancingPolicy
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/RoundRobinConnectionLoadBalancingPolicy.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/RoundRobinConnectionLoadBalancingPolicy.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/RoundRobinConnectionLoadBalancingPolicy.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,7 +24,7 @@
package org.jboss.messaging.core.client.impl;
import org.jboss.messaging.core.client.ConnectionLoadBalancingPolicy;
-import org.jboss.messaging.util.Random;
+import org.jboss.messaging.utils.Random;
/**
* A RoundRobinConnectionLoadBalancingPolicy
Modified: trunk/src/main/org/jboss/messaging/core/client/management/impl/ManagementHelper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/management/impl/ManagementHelper.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/client/management/impl/ManagementHelper.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -36,7 +36,7 @@
import javax.management.openmbean.TabularData;
import org.jboss.messaging.core.message.Message;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/*
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/core/cluster/DiscoveryGroup.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/cluster/DiscoveryGroup.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/cluster/DiscoveryGroup.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -27,7 +27,7 @@
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.server.MessagingComponent;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
/**
* A DiscoveryGroup
Modified: trunk/src/main/org/jboss/messaging/core/cluster/impl/DiscoveryGroupImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/cluster/impl/DiscoveryGroupImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/cluster/impl/DiscoveryGroupImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -38,7 +38,7 @@
import org.jboss.messaging.core.cluster.DiscoveryListener;
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
/**
* A DiscoveryGroupImpl
Modified: trunk/src/main/org/jboss/messaging/core/config/Configuration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/Configuration.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/config/Configuration.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -34,7 +34,7 @@
import org.jboss.messaging.core.config.cluster.DivertConfiguration;
import org.jboss.messaging.core.config.cluster.QueueConfiguration;
import org.jboss.messaging.core.server.JournalType;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/config/cluster/BridgeConfiguration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/cluster/BridgeConfiguration.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/config/cluster/BridgeConfiguration.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,7 +24,7 @@
import java.io.Serializable;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
/**
* A BridgeConfiguration
Modified: trunk/src/main/org/jboss/messaging/core/config/cluster/BroadcastGroupConfiguration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/cluster/BroadcastGroupConfiguration.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/config/cluster/BroadcastGroupConfiguration.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -27,7 +27,7 @@
import java.util.List;
import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
/**
* A BroadcastGroupConfiguration
Modified: trunk/src/main/org/jboss/messaging/core/config/cluster/ClusterConnectionConfiguration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/cluster/ClusterConnectionConfiguration.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/config/cluster/ClusterConnectionConfiguration.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -25,7 +25,7 @@
import java.io.Serializable;
import java.util.List;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
/**
* A ClusterConnectionConfiguration
Modified: trunk/src/main/org/jboss/messaging/core/config/cluster/MessageFlowConfiguration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/cluster/MessageFlowConfiguration.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/config/cluster/MessageFlowConfiguration.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -25,7 +25,7 @@
import java.io.Serializable;
import java.util.List;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
/**
* A MessageFlowConfiguration
Modified: trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -29,7 +29,7 @@
import org.jboss.messaging.core.config.cluster.DivertConfiguration;
import org.jboss.messaging.core.config.cluster.QueueConfiguration;
import org.jboss.messaging.core.server.JournalType;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:ataylor at redhat.com>Andy Taylor</a>
Modified: trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -43,9 +43,9 @@
import org.jboss.messaging.core.config.cluster.DivertConfiguration;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.server.JournalType;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.XMLUtil;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.XMLUtil;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -80,10 +80,10 @@
{
URL url = getClass().getClassLoader().getResource(configurationUrl);
Reader reader = new InputStreamReader(url.openStream());
- String xml = XMLUtil.readerToString(reader);
+ String xml = org.jboss.messaging.utils.XMLUtil.readerToString(reader);
xml = XMLUtil.replaceSystemProps(xml);
- Element e = XMLUtil.stringToElement(xml);
- XMLUtil.validate(e, CONFIGURATION_SCHEMA_URL);
+ Element e = org.jboss.messaging.utils.XMLUtil.stringToElement(xml);
+ org.jboss.messaging.utils.XMLUtil.validate(e, CONFIGURATION_SCHEMA_URL);
clustered = getBoolean(e, "clustered", clustered);
@@ -315,7 +315,7 @@
NodeList nl = e.getElementsByTagName(name);
if (nl.getLength() > 0)
{
- return XMLUtil.parseBoolean(nl.item(0));
+ return org.jboss.messaging.utils.XMLUtil.parseBoolean(nl.item(0));
}
return def;
}
@@ -335,7 +335,7 @@
NodeList nl = e.getElementsByTagName(name);
if (nl.getLength() > 0)
{
- return XMLUtil.parseLong(nl.item(0));
+ return org.jboss.messaging.utils.XMLUtil.parseLong(nl.item(0));
}
return def;
}
@@ -386,13 +386,13 @@
if (type.equalsIgnoreCase("Integer"))
{
- int iVal = XMLUtil.parseInt(nValue);
+ int iVal = org.jboss.messaging.utils.XMLUtil.parseInt(nValue);
params.put(key, iVal);
}
else if (type.equalsIgnoreCase("Long"))
{
- long lVal = XMLUtil.parseLong(nValue);
+ long lVal = org.jboss.messaging.utils.XMLUtil.parseLong(nValue);
params.put(key, lVal);
}
@@ -402,7 +402,7 @@
}
else if (type.equalsIgnoreCase("Boolean"))
{
- boolean bVal = XMLUtil.parseBoolean(nValue);
+ boolean bVal = org.jboss.messaging.utils.XMLUtil.parseBoolean(nValue);
params.put(key, bVal);
}
@@ -444,7 +444,7 @@
}
else if (child.getNodeName().equals("local-bind-port"))
{
- localBindPort = XMLUtil.parseInt(child);
+ localBindPort = org.jboss.messaging.utils.XMLUtil.parseInt(child);
}
else if (child.getNodeName().equals("group-address"))
{
@@ -452,11 +452,11 @@
}
else if (child.getNodeName().equals("group-port"))
{
- groupPort = XMLUtil.parseInt(child);
+ groupPort = org.jboss.messaging.utils.XMLUtil.parseInt(child);
}
else if (child.getNodeName().equals("broadcast-period"))
{
- broadcastPeriod = XMLUtil.parseLong(child);
+ broadcastPeriod = org.jboss.messaging.utils.XMLUtil.parseLong(child);
}
else if (child.getNodeName().equals("connector-ref"))
{
@@ -510,11 +510,11 @@
}
else if (child.getNodeName().equals("group-port"))
{
- groupPort = XMLUtil.parseInt(child);
+ groupPort = org.jboss.messaging.utils.XMLUtil.parseInt(child);
}
else if (child.getNodeName().equals("refresh-timeout"))
{
- refreshTimeout = XMLUtil.parseLong(child);
+ refreshTimeout = org.jboss.messaging.utils.XMLUtil.parseLong(child);
}
}
@@ -573,19 +573,19 @@
}
else if (child.getNodeName().equals("retry-interval-multiplier"))
{
- retryIntervalMultiplier = XMLUtil.parseDouble(child);
+ retryIntervalMultiplier = org.jboss.messaging.utils.XMLUtil.parseDouble(child);
}
else if (child.getNodeName().equals("max-retries-before-failover"))
{
- maxRetriesBeforeFailover = XMLUtil.parseInt(child);
+ maxRetriesBeforeFailover = org.jboss.messaging.utils.XMLUtil.parseInt(child);
}
else if (child.getNodeName().equals("max-retries-after-failover"))
{
- maxRetriesAfterFailover = XMLUtil.parseInt(child);
+ maxRetriesAfterFailover = org.jboss.messaging.utils.XMLUtil.parseInt(child);
}
else if (child.getNodeName().equals("use-duplicate-detection"))
{
- duplicateDetection = XMLUtil.parseBoolean(child);
+ duplicateDetection = org.jboss.messaging.utils.XMLUtil.parseBoolean(child);
}
else if (child.getNodeName().equals("discovery-group-ref"))
{
@@ -694,7 +694,7 @@
}
else if (child.getNodeName().equals("retry-interval"))
{
- retryInterval = XMLUtil.parseLong(child);
+ retryInterval = org.jboss.messaging.utils.XMLUtil.parseLong(child);
}
else if (child.getNodeName().equals("retry-interval-multiplier"))
{
@@ -706,11 +706,11 @@
}
else if (child.getNodeName().equals("max-retries-after-failover"))
{
- maxRetriesAfterFailover = XMLUtil.parseInt(child);
+ maxRetriesAfterFailover = org.jboss.messaging.utils.XMLUtil.parseInt(child);
}
else if (child.getNodeName().equals("use-duplicate-detection"))
{
- useDuplicateDetection = XMLUtil.parseBoolean(child);
+ useDuplicateDetection = org.jboss.messaging.utils.XMLUtil.parseBoolean(child);
}
else if (child.getNodeName().equals("discovery-group-ref"))
{
@@ -807,7 +807,7 @@
}
else if (child.getNodeName().equals("exclusive"))
{
- exclusive = XMLUtil.parseBoolean(child);
+ exclusive = org.jboss.messaging.utils.XMLUtil.parseBoolean(child);
}
else if (child.getNodeName().equals("filter"))
{
Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/AddressSettingsDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/AddressSettingsDeployer.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/AddressSettingsDeployer.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -25,8 +25,7 @@
import org.jboss.messaging.core.deployers.DeploymentManager;
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.settings.impl.AddressSettings;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.XMLUtil;
+import org.jboss.messaging.utils.SimpleString;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -77,11 +76,11 @@
{
if ("deployment".equals(rootNode.getNodeName()))
{
- XMLUtil.validate(rootNode, "jbm-configuration.xsd");
+ org.jboss.messaging.utils.XMLUtil.validate(rootNode, "jbm-configuration.xsd");
}
else
{
- XMLUtil.validate(rootNode, "jbm-queues.xsd");
+ org.jboss.messaging.utils.XMLUtil.validate(rootNode, "jbm-queues.xsd");
}
}
Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/BasicSecurityDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/BasicSecurityDeployer.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/BasicSecurityDeployer.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,6 @@
import org.jboss.messaging.core.deployers.DeploymentManager;
import org.jboss.messaging.core.security.JBMUpdateableSecurityManager;
-import org.jboss.messaging.util.XMLUtil;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -52,7 +51,7 @@
@Override
public void validate(Node rootNode) throws Exception
{
- XMLUtil.validate(rootNode, "jbm-security.xsd");
+ org.jboss.messaging.utils.XMLUtil.validate(rootNode, "jbm-security.xsd");
}
public void deploy(final Node node) throws Exception
Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueDeployer.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueDeployer.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -27,7 +27,6 @@
import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.config.cluster.QueueConfiguration;
import org.jboss.messaging.core.deployers.DeploymentManager;
-import org.jboss.messaging.util.XMLUtil;
import org.w3c.dom.Node;
/**
@@ -60,11 +59,11 @@
{
if ("deployment".equals(rootNode.getNodeName()))
{
- XMLUtil.validate(rootNode, "jbm-configuration.xsd");
+ org.jboss.messaging.utils.XMLUtil.validate(rootNode, "jbm-configuration.xsd");
}
else
{
- XMLUtil.validate(rootNode, "jbm-queues.xsd");
+ org.jboss.messaging.utils.XMLUtil.validate(rootNode, "jbm-queues.xsd");
}
}
Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityDeployer.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityDeployer.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -29,7 +29,7 @@
import org.jboss.messaging.core.deployers.DeploymentManager;
import org.jboss.messaging.core.security.Role;
import org.jboss.messaging.core.settings.HierarchicalRepository;
-import org.jboss.messaging.util.XMLUtil;
+import org.jboss.messaging.utils.XMLUtil;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/XmlDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/XmlDeployer.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/XmlDeployer.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -36,7 +36,6 @@
import org.jboss.messaging.core.deployers.DeploymentManager;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.server.MessagingComponent;
-import org.jboss.messaging.util.XMLUtil;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -279,9 +278,9 @@
throws Exception
{
Reader reader = new InputStreamReader(url.openStream());
- String xml = XMLUtil.readerToString(reader);
- xml = XMLUtil.replaceSystemProps(xml);
- return XMLUtil.stringToElement(xml);
+ String xml = org.jboss.messaging.utils.XMLUtil.readerToString(reader);
+ xml = org.jboss.messaging.utils.XMLUtil.replaceSystemProps(xml);
+ return org.jboss.messaging.utils.XMLUtil.stringToElement(xml);
}
private boolean hasNodeChanged(final URL url, final Node child, final String name)
Modified: trunk/src/main/org/jboss/messaging/core/filter/Filter.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/filter/Filter.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/filter/Filter.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,7 @@
package org.jboss.messaging.core.filter;
import org.jboss.messaging.core.server.ServerMessage;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/filter/impl/FilterImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/filter/impl/FilterImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/filter/impl/FilterImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -29,7 +29,7 @@
import org.jboss.messaging.core.filter.Filter;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.server.ServerMessage;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* This class implements a JBoss Messaging filter
Modified: trunk/src/main/org/jboss/messaging/core/filter/impl/FilterParser.jj
===================================================================
--- trunk/src/main/org/jboss/messaging/core/filter/impl/FilterParser.jj 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/filter/impl/FilterParser.jj 2009-02-25 11:15:55 UTC (rev 5927)
@@ -39,8 +39,8 @@
import java.util.Map;
import java.util.Set;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.SimpleStringReader;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.SimpleStringReader;
/**
* A JavaCC 2.0 grammar for JBoss Messaging filters
Modified: trunk/src/main/org/jboss/messaging/core/filter/impl/Identifier.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/filter/impl/Identifier.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/filter/impl/Identifier.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -22,7 +22,7 @@
package org.jboss.messaging.core.filter.impl;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/filter/impl/Operator.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/filter/impl/Operator.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/filter/impl/Operator.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -25,7 +25,7 @@
import java.util.HashSet;
import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* Implementations of the operators used in JBM filter expressions
Modified: trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -62,8 +62,8 @@
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.VariableLatch;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.VariableLatch;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/management/ManagementService.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/ManagementService.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/management/ManagementService.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -51,7 +51,7 @@
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.core.transaction.ResourceManager;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/core/management/MessagingServerControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/MessagingServerControlMBean.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/management/MessagingServerControlMBean.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -30,7 +30,6 @@
import javax.management.openmbean.TabularData;
import org.jboss.messaging.core.config.Configuration;
-import org.jboss.messaging.util.SimpleString;
/**
* This interface describes the core management interface exposed by the server
Modified: trunk/src/main/org/jboss/messaging/core/management/Notification.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/Notification.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/management/Notification.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,7 @@
package org.jboss.messaging.core.management;
-import org.jboss.messaging.util.TypedProperties;
+import org.jboss.messaging.utils.TypedProperties;
/**
* A Notification
Modified: trunk/src/main/org/jboss/messaging/core/management/ObjectNames.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/ObjectNames.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/management/ObjectNames.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -28,7 +28,7 @@
import javax.management.ObjectName;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A ObjectNames
Modified: trunk/src/main/org/jboss/messaging/core/management/PairsInfo.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/PairsInfo.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/management/PairsInfo.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -37,7 +37,7 @@
import javax.management.openmbean.TabularDataSupport;
import javax.management.openmbean.TabularType;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
/**
* Info for a Message property.
Modified: trunk/src/main/org/jboss/messaging/core/management/impl/AddressControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/AddressControl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/AddressControl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -35,7 +35,7 @@
import org.jboss.messaging.core.security.CheckType;
import org.jboss.messaging.core.security.Role;
import org.jboss.messaging.core.settings.HierarchicalRepository;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -34,8 +34,6 @@
import java.util.Map;
import java.util.Set;
-import javax.management.MBeanInfo;
-import javax.management.MBeanOperationInfo;
import javax.management.MBeanServer;
import javax.management.NotificationBroadcasterSupport;
import javax.management.ObjectName;
@@ -85,9 +83,8 @@
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.core.transaction.ResourceManager;
-import org.jboss.messaging.util.ConcurrentHashSet;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.TypedProperties;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.TypedProperties;
/*
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
@@ -133,7 +130,7 @@
private boolean noticationsEnabled;
- private final Set<NotificationListener> listeners = new ConcurrentHashSet<NotificationListener>();
+ private final Set<NotificationListener> listeners = new org.jboss.messaging.utils.ConcurrentHashSet<NotificationListener>();
private ReplicationOperationInvoker replicationInvoker;
Modified: trunk/src/main/org/jboss/messaging/core/management/impl/MessagingServerControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/MessagingServerControl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/MessagingServerControl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -66,7 +66,7 @@
import org.jboss.messaging.core.transaction.ResourceManager;
import org.jboss.messaging.core.transaction.Transaction;
import org.jboss.messaging.core.transaction.impl.XidImpl;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/core/management/impl/QueueControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/QueueControl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/QueueControl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -46,7 +46,7 @@
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.settings.impl.AddressSettings;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/core/management/impl/ReplicationOperationInvokerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/ReplicationOperationInvokerImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/ReplicationOperationInvokerImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -36,7 +36,7 @@
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.management.ReplicationOperationInvoker;
import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A ReplicationOperationInvoker
Modified: trunk/src/main/org/jboss/messaging/core/message/Message.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/message/Message.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/message/Message.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,10 +24,9 @@
import java.util.Set;
-import org.jboss.messaging.core.client.SendAcknowledgementHandler;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.TypedProperties;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.TypedProperties;
/**
* A message is a routable instance that has a payload.
Modified: trunk/src/main/org/jboss/messaging/core/message/impl/MessageImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/message/impl/MessageImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/message/impl/MessageImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -22,19 +22,18 @@
package org.jboss.messaging.core.message.impl;
-import static org.jboss.messaging.util.DataConstants.SIZE_BOOLEAN;
-import static org.jboss.messaging.util.DataConstants.SIZE_BYTE;
-import static org.jboss.messaging.util.DataConstants.SIZE_INT;
-import static org.jboss.messaging.util.DataConstants.SIZE_LONG;
+import static org.jboss.messaging.utils.DataConstants.SIZE_BOOLEAN;
+import static org.jboss.messaging.utils.DataConstants.SIZE_BYTE;
+import static org.jboss.messaging.utils.DataConstants.SIZE_INT;
+import static org.jboss.messaging.utils.DataConstants.SIZE_LONG;
+import org.jboss.messaging.utils.SimpleString;
import java.util.Set;
-import org.jboss.messaging.core.client.SendAcknowledgementHandler;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.message.Message;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.TypedProperties;
+import org.jboss.messaging.utils.TypedProperties;
/**
* A concrete implementation of a message
Modified: trunk/src/main/org/jboss/messaging/core/paging/PagingManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/paging/PagingManager.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/paging/PagingManager.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -28,7 +28,7 @@
import org.jboss.messaging.core.postoffice.PostOffice;
import org.jboss.messaging.core.server.MessagingComponent;
import org.jboss.messaging.core.server.ServerMessage;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/paging/PagingStore.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/paging/PagingStore.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/paging/PagingStore.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -25,7 +25,7 @@
import java.util.concurrent.Executor;
import org.jboss.messaging.core.server.MessagingComponent;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/paging/PagingStoreFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/paging/PagingStoreFactory.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/paging/PagingStoreFactory.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -30,7 +30,7 @@
import org.jboss.messaging.core.postoffice.PostOffice;
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.settings.impl.AddressSettings;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* The integration point between the PagingManger and the File System (aka SequentialFiles)
Modified: trunk/src/main/org/jboss/messaging/core/paging/impl/PageImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/paging/impl/PageImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/paging/impl/PageImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -22,8 +22,8 @@
package org.jboss.messaging.core.paging.impl;
-import static org.jboss.messaging.util.DataConstants.SIZE_BYTE;
-import static org.jboss.messaging.util.DataConstants.SIZE_INT;
+import static org.jboss.messaging.utils.DataConstants.SIZE_BYTE;
+import static org.jboss.messaging.utils.DataConstants.SIZE_INT;
import java.nio.ByteBuffer;
import java.util.ArrayList;
Modified: trunk/src/main/org/jboss/messaging/core/paging/impl/PageTransactionInfoImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/paging/impl/PageTransactionInfoImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/paging/impl/PageTransactionInfoImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -22,8 +22,8 @@
package org.jboss.messaging.core.paging.impl;
-import static org.jboss.messaging.util.DataConstants.SIZE_INT;
-import static org.jboss.messaging.util.DataConstants.SIZE_LONG;
+import static org.jboss.messaging.utils.DataConstants.SIZE_INT;
+import static org.jboss.messaging.utils.DataConstants.SIZE_LONG;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
Modified: trunk/src/main/org/jboss/messaging/core/paging/impl/PagedMessageImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/paging/impl/PagedMessageImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/paging/impl/PagedMessageImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -22,9 +22,9 @@
package org.jboss.messaging.core.paging.impl;
-import static org.jboss.messaging.util.DataConstants.SIZE_BYTE;
-import static org.jboss.messaging.util.DataConstants.SIZE_INT;
-import static org.jboss.messaging.util.DataConstants.SIZE_LONG;
+import static org.jboss.messaging.utils.DataConstants.SIZE_BYTE;
+import static org.jboss.messaging.utils.DataConstants.SIZE_INT;
+import static org.jboss.messaging.utils.DataConstants.SIZE_LONG;
import java.nio.ByteBuffer;
Modified: trunk/src/main/org/jboss/messaging/core/paging/impl/PagingManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/paging/impl/PagingManagerImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/paging/impl/PagingManagerImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -39,7 +39,7 @@
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.settings.impl.AddressSettings;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* <p>Look at the <a href="http://wiki.jboss.org/wiki/JBossMessaging2Paging">WIKI</a> for more information.</p>
Modified: trunk/src/main/org/jboss/messaging/core/paging/impl/PagingStoreFactoryNIO.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/paging/impl/PagingStoreFactoryNIO.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/paging/impl/PagingStoreFactoryNIO.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -47,10 +47,9 @@
import org.jboss.messaging.core.postoffice.PostOffice;
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.settings.impl.AddressSettings;
-import org.jboss.messaging.util.JBMThreadFactory;
-import org.jboss.messaging.util.OrderedExecutorFactory;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.OrderedExecutorFactory;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.UUIDGenerator;
/**
*
@@ -90,9 +89,9 @@
{
this.directory = directory;
- parentExecutor = Executors.newFixedThreadPool(maxThreads, new JBMThreadFactory("JBM-depaging-threads"));
+ parentExecutor = Executors.newFixedThreadPool(maxThreads, new org.jboss.messaging.utils.JBMThreadFactory("JBM-depaging-threads"));
- executorFactory = new OrderedExecutorFactory(parentExecutor);
+ executorFactory = new org.jboss.messaging.utils.OrderedExecutorFactory(parentExecutor);
globalDepagerExecutor = executorFactory.getExecutor();
}
Modified: trunk/src/main/org/jboss/messaging/core/paging/impl/PagingStoreImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/paging/impl/PagingStoreImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/paging/impl/PagingStoreImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -52,8 +52,8 @@
import org.jboss.messaging.core.transaction.Transaction;
import org.jboss.messaging.core.transaction.TransactionPropertyIndexes;
import org.jboss.messaging.core.transaction.impl.TransactionImpl;
-import org.jboss.messaging.util.Future;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.Future;
+import org.jboss.messaging.utils.SimpleString;
/**
*
@@ -505,7 +505,7 @@
{
running = false;
- Future future = new Future();
+ org.jboss.messaging.utils.Future future = new Future();
executor.execute(future);
Modified: trunk/src/main/org/jboss/messaging/core/persistence/QueueBindingInfo.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/persistence/QueueBindingInfo.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/persistence/QueueBindingInfo.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,7 @@
package org.jboss.messaging.core.persistence;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A QueueBindingInfo
Modified: trunk/src/main/org/jboss/messaging/core/persistence/StorageManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/persistence/StorageManager.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/persistence/StorageManager.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -38,9 +38,9 @@
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.core.transaction.ResourceManager;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.UUID;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.UUID;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalLargeServerMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalLargeServerMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalLargeServerMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -22,7 +22,7 @@
package org.jboss.messaging.core.persistence.impl.journal;
-import static org.jboss.messaging.util.DataConstants.SIZE_INT;
+import static org.jboss.messaging.utils.DataConstants.SIZE_INT;
import java.nio.ByteBuffer;
Modified: trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -22,9 +22,9 @@
package org.jboss.messaging.core.persistence.impl.journal;
-import static org.jboss.messaging.util.DataConstants.SIZE_BYTE;
-import static org.jboss.messaging.util.DataConstants.SIZE_INT;
-import static org.jboss.messaging.util.DataConstants.SIZE_LONG;
+import static org.jboss.messaging.utils.DataConstants.SIZE_BYTE;
+import static org.jboss.messaging.utils.DataConstants.SIZE_INT;
+import static org.jboss.messaging.utils.DataConstants.SIZE_LONG;
import java.io.File;
import java.nio.ByteBuffer;
@@ -79,14 +79,14 @@
import org.jboss.messaging.core.transaction.TransactionPropertyIndexes;
import org.jboss.messaging.core.transaction.Transaction.State;
import org.jboss.messaging.core.transaction.impl.TransactionImpl;
-import org.jboss.messaging.util.DataConstants;
-import org.jboss.messaging.util.IDGenerator;
-import org.jboss.messaging.util.JBMThreadFactory;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.TimeAndCounterIDGenerator;
-import org.jboss.messaging.util.UUID;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.DataConstants;
+import org.jboss.messaging.utils.IDGenerator;
+import org.jboss.messaging.utils.JBMThreadFactory;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.TimeAndCounterIDGenerator;
+import org.jboss.messaging.utils.UUID;
+import org.jboss.messaging.utils.UUIDGenerator;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageManager.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageManager.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -39,12 +39,12 @@
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.core.transaction.ResourceManager;
-import org.jboss.messaging.util.IDGenerator;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.TimeAndCounterIDGenerator;
-import org.jboss.messaging.util.UUID;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.IDGenerator;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.TimeAndCounterIDGenerator;
+import org.jboss.messaging.utils.UUID;
+import org.jboss.messaging.utils.UUIDGenerator;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/Address.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/Address.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/Address.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -21,7 +21,7 @@
*/
package org.jboss.messaging.core.postoffice;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
import java.util.List;
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/AddressManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/AddressManager.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/AddressManager.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -21,7 +21,7 @@
*/
package org.jboss.messaging.core.postoffice;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
import java.util.Map;
import java.util.Set;
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/Binding.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/Binding.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/Binding.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -25,7 +25,7 @@
import org.jboss.messaging.core.filter.Filter;
import org.jboss.messaging.core.server.Bindable;
import org.jboss.messaging.core.server.ServerMessage;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/Bindings.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/Bindings.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/Bindings.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -26,7 +26,7 @@
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.core.transaction.Transaction;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A Bindings
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/DuplicateIDCache.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/DuplicateIDCache.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/DuplicateIDCache.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -25,7 +25,7 @@
import java.util.List;
import org.jboss.messaging.core.transaction.Transaction;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
/**
* A DuplicateIDCache
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/PostOffice.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/PostOffice.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/PostOffice.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -31,7 +31,7 @@
import org.jboss.messaging.core.server.SendLock;
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.core.transaction.Transaction;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/QueueInfo.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/QueueInfo.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/QueueInfo.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -26,7 +26,7 @@
import java.io.Serializable;
import java.util.List;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A QueueInfo
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/impl/AddressImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/AddressImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/impl/AddressImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -27,7 +27,7 @@
import static org.jboss.messaging.core.postoffice.impl.WildcardAddressManager.DELIM;
import static org.jboss.messaging.core.postoffice.impl.WildcardAddressManager.SINGLE_WORD;
import static org.jboss.messaging.core.postoffice.impl.WildcardAddressManager.SINGLE_WORD_SIMPLESTRING;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
import java.util.ArrayList;
import java.util.List;
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/impl/BindingsImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/BindingsImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/impl/BindingsImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -40,7 +40,7 @@
import org.jboss.messaging.core.server.Bindable;
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.core.transaction.Transaction;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A BindingsImpl
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/impl/DivertBinding.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/DivertBinding.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/impl/DivertBinding.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -29,7 +29,7 @@
import org.jboss.messaging.core.server.Bindable;
import org.jboss.messaging.core.server.Divert;
import org.jboss.messaging.core.server.ServerMessage;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A LocalQueueBinding
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/impl/DuplicateIDCacheImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/DuplicateIDCacheImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/impl/DuplicateIDCacheImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -32,9 +32,8 @@
import org.jboss.messaging.core.transaction.Transaction;
import org.jboss.messaging.core.transaction.TransactionOperation;
import org.jboss.messaging.core.transaction.TransactionPropertyIndexes;
-import org.jboss.messaging.util.ConcurrentHashSet;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
/**
* A DuplicateIDCacheImpl
@@ -51,7 +50,7 @@
{
private static final Logger log = Logger.getLogger(DuplicateIDCacheImpl.class);
- private final Set<ByteArrayHolder> cache = new ConcurrentHashSet<ByteArrayHolder>();
+ private final Set<ByteArrayHolder> cache = new org.jboss.messaging.utils.ConcurrentHashSet<ByteArrayHolder>();
private final SimpleString address;
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/impl/LocalQueueBinding.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/LocalQueueBinding.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/impl/LocalQueueBinding.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -34,7 +34,7 @@
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.core.server.cluster.impl.Redistributor;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A LocalQueueBinding
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -68,10 +68,9 @@
import org.jboss.messaging.core.transaction.TransactionPropertyIndexes;
import org.jboss.messaging.core.transaction.Transaction.State;
import org.jboss.messaging.core.transaction.impl.TransactionImpl;
-import org.jboss.messaging.util.ExecutorFactory;
-import org.jboss.messaging.util.JBMThreadFactory;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.TypedProperties;
+import org.jboss.messaging.utils.ExecutorFactory;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.TypedProperties;
/**
* A PostOfficeImpl
@@ -130,7 +129,7 @@
private final Object notificationLock = new Object();
- private final ExecutorFactory redistributorExecutorFactory;
+ private final org.jboss.messaging.utils.ExecutorFactory redistributorExecutorFactory;
private final HierarchicalRepository<AddressSettings> addressSettingsRepository;
@@ -200,7 +199,7 @@
if (messageExpiryScanPeriod > 0)
{
MessageExpiryRunner messageExpiryRunner = new MessageExpiryRunner();
- messageExpiryExecutor = new ScheduledThreadPoolExecutor(1, new JBMThreadFactory("JBM-scheduled-threads",
+ messageExpiryExecutor = new ScheduledThreadPoolExecutor(1, new org.jboss.messaging.utils.JBMThreadFactory("JBM-scheduled-threads",
messageExpiryThreadPriority));
messageExpiryExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
messageExpiryExecutor.scheduleWithFixedDelay(messageExpiryRunner,
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/impl/SimpleAddressManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/SimpleAddressManager.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/impl/SimpleAddressManager.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,9 +24,9 @@
import org.jboss.messaging.core.postoffice.AddressManager;
import org.jboss.messaging.core.postoffice.Binding;
import org.jboss.messaging.core.postoffice.Bindings;
-import org.jboss.messaging.util.ConcurrentHashSet;
-import org.jboss.messaging.util.ConcurrentSet;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.ConcurrentHashSet;
+import org.jboss.messaging.utils.ConcurrentSet;
+import org.jboss.messaging.utils.SimpleString;
import java.util.Map;
import java.util.Set;
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/impl/WildcardAddressManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/WildcardAddressManager.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/impl/WildcardAddressManager.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -30,7 +30,7 @@
import org.jboss.messaging.core.postoffice.Address;
import org.jboss.messaging.core.postoffice.Binding;
import org.jboss.messaging.core.postoffice.Bindings;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* extends the simple manager to allow wildcard addresses to be used.
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/AbstractBufferHandler.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/AbstractBufferHandler.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/AbstractBufferHandler.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -21,7 +21,7 @@
*/
package org.jboss.messaging.core.remoting.impl;
-import static org.jboss.messaging.util.DataConstants.SIZE_INT;
+import static org.jboss.messaging.utils.DataConstants.SIZE_INT;
import org.jboss.messaging.core.remoting.spi.BufferHandler;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/ByteBufferWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/ByteBufferWrapper.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/ByteBufferWrapper.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -22,18 +22,17 @@
package org.jboss.messaging.core.remoting.impl;
-import static org.jboss.messaging.util.DataConstants.FALSE;
-import static org.jboss.messaging.util.DataConstants.NOT_NULL;
-import static org.jboss.messaging.util.DataConstants.NULL;
-import static org.jboss.messaging.util.DataConstants.TRUE;
+import static org.jboss.messaging.utils.DataConstants.FALSE;
+import static org.jboss.messaging.utils.DataConstants.NOT_NULL;
+import static org.jboss.messaging.utils.DataConstants.NULL;
+import static org.jboss.messaging.utils.DataConstants.TRUE;
+import org.jboss.messaging.utils.SimpleString;
import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
import java.nio.charset.Charset;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.UTF8Util;
+import org.jboss.messaging.utils.UTF8Util;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/ExpandingMessagingBuffer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/ExpandingMessagingBuffer.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/ExpandingMessagingBuffer.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -22,14 +22,14 @@
*/
package org.jboss.messaging.core.remoting.impl;
-import static org.jboss.messaging.util.DataConstants.NOT_NULL;
-import static org.jboss.messaging.util.DataConstants.NULL;
+import static org.jboss.messaging.utils.DataConstants.NOT_NULL;
+import static org.jboss.messaging.utils.DataConstants.NULL;
+import org.jboss.messaging.utils.SimpleString;
import java.nio.ByteBuffer;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.UTF8Util;
+import org.jboss.messaging.utils.UTF8Util;
/**
* A {@link MessagingBuffer} which increases its capacity and length by itself
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -140,7 +140,7 @@
import org.jboss.messaging.core.remoting.spi.Connector;
import org.jboss.messaging.core.remoting.spi.ConnectorFactory;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleIDGenerator;
+import org.jboss.messaging.utils.SimpleIDGenerator;
/**
* @author <a href="tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMAcceptor.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMAcceptor.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMAcceptor.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -30,7 +30,7 @@
import org.jboss.messaging.core.remoting.spi.BufferHandler;
import org.jboss.messaging.core.remoting.spi.Connection;
import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
-import org.jboss.messaging.util.ConfigurationHelper;
+import org.jboss.messaging.utils.ConfigurationHelper;
/**
* A InVMAcceptor
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnection.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnection.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnection.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -32,10 +32,10 @@
import org.jboss.messaging.core.remoting.spi.Connection;
import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.ExecutorFactory;
-import org.jboss.messaging.util.JBMThreadFactory;
-import org.jboss.messaging.util.OrderedExecutorFactory;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.ExecutorFactory;
+import org.jboss.messaging.utils.JBMThreadFactory;
+import org.jboss.messaging.utils.OrderedExecutorFactory;
+import org.jboss.messaging.utils.UUIDGenerator;
/**
* A InVMConnection
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -32,7 +32,7 @@
import org.jboss.messaging.core.remoting.spi.Connection;
import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
import org.jboss.messaging.core.remoting.spi.Connector;
-import org.jboss.messaging.util.ConfigurationHelper;
+import org.jboss.messaging.utils.ConfigurationHelper;
/**
* A InVMConnector
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -15,7 +15,7 @@
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.remoting.Packet;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.DataConstants;
+import org.jboss.messaging.utils.DataConstants;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/RollbackMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/RollbackMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/RollbackMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.DataConstants;
+import org.jboss.messaging.utils.DataConstants;
/**
* A RollbackMessage
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionAddDestinationMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionAddDestinationMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionAddDestinationMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryResponseMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryResponseMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryResponseMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -26,7 +26,7 @@
import java.util.List;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionContinuationMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionContinuationMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionContinuationMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.DataConstants;
+import org.jboss.messaging.utils.DataConstants;
/**
* A SessionContinuationMessage
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateConsumerMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateConsumerMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateConsumerMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateQueueMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateQueueMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateQueueMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionDeleteQueueMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionDeleteQueueMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionDeleteQueueMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryResponseMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryResponseMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryResponseMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveContinuationMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveContinuationMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveContinuationMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.DataConstants;
+import org.jboss.messaging.utils.DataConstants;
/**
* A SessionSendContinuationMessage
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -27,7 +27,7 @@
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
import org.jboss.messaging.core.server.ServerMessage;
-import org.jboss.messaging.util.DataConstants;
+import org.jboss.messaging.utils.DataConstants;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionRemoveDestinationMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionRemoveDestinationMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionRemoveDestinationMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendContinuationMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendContinuationMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendContinuationMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.DataConstants;
+import org.jboss.messaging.utils.DataConstants;
/**
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -26,7 +26,7 @@
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.core.server.impl.ServerMessageImpl;
-import org.jboss.messaging.util.DataConstants;
+import org.jboss.messaging.utils.DataConstants;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/XidCodecSupport.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/XidCodecSupport.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/XidCodecSupport.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -26,7 +26,7 @@
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
import org.jboss.messaging.core.transaction.impl.XidImpl;
-import org.jboss.messaging.util.DataConstants;
+import org.jboss.messaging.utils.DataConstants;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/core/remoting/spi/MessagingBuffer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/spi/MessagingBuffer.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/remoting/spi/MessagingBuffer.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -22,7 +22,7 @@
package org.jboss.messaging.core.remoting.spi;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/security/SecurityStore.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/security/SecurityStore.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/security/SecurityStore.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -26,7 +26,7 @@
import org.jboss.messaging.core.server.ServerSession;
import org.jboss.messaging.core.settings.HierarchicalRepository;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
Modified: trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -35,8 +35,7 @@
import org.jboss.messaging.core.server.ServerSession;
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.settings.HierarchicalRepositoryChangeListener;
-import org.jboss.messaging.util.ConcurrentHashSet;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* The JBM SecurityStore implementation
@@ -72,11 +71,11 @@
private JBMSecurityManager securityManager;
- private final Set<SimpleString> readCache = new ConcurrentHashSet<SimpleString>();
+ private final Set<SimpleString> readCache = new org.jboss.messaging.utils.ConcurrentHashSet<SimpleString>();
- private final Set<SimpleString> writeCache = new ConcurrentHashSet<SimpleString>();
+ private final Set<SimpleString> writeCache = new org.jboss.messaging.utils.ConcurrentHashSet<SimpleString>();
- private final Set<SimpleString> createCache = new ConcurrentHashSet<SimpleString>();
+ private final Set<SimpleString> createCache = new org.jboss.messaging.utils.ConcurrentHashSet<SimpleString>();
private final long invalidationInterval;
Modified: trunk/src/main/org/jboss/messaging/core/server/Divert.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/Divert.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/Divert.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,7 +24,7 @@
package org.jboss.messaging.core.server;
import org.jboss.messaging.core.filter.Filter;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
Modified: trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -31,8 +31,8 @@
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.core.transaction.ResourceManager;
import org.jboss.messaging.core.version.Version;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.UUID;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.UUID;
/**
* This interface defines the internal interface of the Messaging Server exposed to other components of the server. The
Modified: trunk/src/main/org/jboss/messaging/core/server/Queue.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/Queue.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/Queue.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -28,7 +28,7 @@
import org.jboss.messaging.core.filter.Filter;
import org.jboss.messaging.core.transaction.Transaction;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/server/QueueFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/QueueFactory.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/QueueFactory.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,7 +24,7 @@
import org.jboss.messaging.core.filter.Filter;
import org.jboss.messaging.core.postoffice.PostOffice;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/Bridge.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/Bridge.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/Bridge.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -26,7 +26,7 @@
import org.jboss.messaging.core.server.Consumer;
import org.jboss.messaging.core.server.MessagingComponent;
import org.jboss.messaging.core.server.Queue;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/BroadcastGroup.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/BroadcastGroup.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/BroadcastGroup.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -25,7 +25,7 @@
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.server.MessagingComponent;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
/**
* A BroadcastGroup
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/ClusterConnection.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/ClusterConnection.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/ClusterConnection.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,7 +24,7 @@
package org.jboss.messaging.core.server.cluster;
import org.jboss.messaging.core.server.MessagingComponent;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A ClusterConnection
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/RemoteQueueBinding.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/RemoteQueueBinding.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/RemoteQueueBinding.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,7 @@
package org.jboss.messaging.core.server.cluster;
import org.jboss.messaging.core.postoffice.QueueBinding;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A RemoteQueueBinding
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -74,11 +74,11 @@
import org.jboss.messaging.core.server.cluster.Bridge;
import org.jboss.messaging.core.server.cluster.MessageFlowRecord;
import org.jboss.messaging.core.server.cluster.Transformer;
-import org.jboss.messaging.util.Future;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.UUID;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.Future;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.UUID;
+import org.jboss.messaging.utils.UUIDGenerator;
/**
* A BridgeImpl
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BroadcastGroupImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BroadcastGroupImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BroadcastGroupImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -29,14 +29,12 @@
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import java.util.concurrent.ScheduledFuture;
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.server.cluster.BroadcastGroup;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.Pair;
/**
* A BroadcastGroupImpl
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -52,10 +52,10 @@
import org.jboss.messaging.core.server.cluster.ClusterConnection;
import org.jboss.messaging.core.server.cluster.MessageFlowRecord;
import org.jboss.messaging.core.server.cluster.RemoteQueueBinding;
-import org.jboss.messaging.util.ExecutorFactory;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.UUID;
+import org.jboss.messaging.utils.ExecutorFactory;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.UUID;
/**
*
@@ -71,7 +71,7 @@
{
private static final Logger log = Logger.getLogger(ClusterConnectionImpl.class);
- private final ExecutorFactory executorFactory;
+ private final org.jboss.messaging.utils.ExecutorFactory executorFactory;
private final StorageManager storageManager;
@@ -120,7 +120,7 @@
final int maxRetriesAfterFailover,
final boolean useDuplicateDetection,
final boolean routeWhenNoConsumers,
- final ExecutorFactory executorFactory,
+ final org.jboss.messaging.utils.ExecutorFactory executorFactory,
final StorageManager storageManager,
final PostOffice postOffice,
final ManagementService managementService,
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -54,10 +54,9 @@
import org.jboss.messaging.core.server.cluster.ClusterConnection;
import org.jboss.messaging.core.server.cluster.ClusterManager;
import org.jboss.messaging.core.server.cluster.Transformer;
-import org.jboss.messaging.util.ExecutorFactory;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.UUID;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.UUID;
/**
* A ClusterManagerImpl
@@ -80,7 +79,7 @@
private final Map<String, ClusterConnection> clusters = new HashMap<String, ClusterConnection>();
- private final ExecutorFactory executorFactory;
+ private final org.jboss.messaging.utils.ExecutorFactory executorFactory;
private final StorageManager storageManager;
@@ -98,7 +97,7 @@
private volatile boolean started;
- public ClusterManagerImpl(final ExecutorFactory executorFactory,
+ public ClusterManagerImpl(final org.jboss.messaging.utils.ExecutorFactory executorFactory,
final StorageManager storageManager,
final PostOffice postOffice,
final ScheduledExecutorService scheduledExecutor,
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/Redistributor.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/Redistributor.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/Redistributor.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -34,7 +34,7 @@
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.core.transaction.Transaction;
import org.jboss.messaging.core.transaction.impl.TransactionImpl;
-import org.jboss.messaging.util.Future;
+import org.jboss.messaging.utils.Future;
/**
* A Redistributor
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/RemoteQueueBindingImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/RemoteQueueBindingImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/RemoteQueueBindingImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -37,8 +37,8 @@
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.core.server.cluster.RemoteQueueBinding;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.UUIDGenerator;
/**
* A RemoteQueueBindingImpl
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/DivertImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/DivertImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/DivertImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -34,7 +34,7 @@
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.core.server.cluster.Transformer;
import org.jboss.messaging.core.transaction.Transaction;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A DivertImpl simply diverts a message to a different forwardAddress
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/GroupingRoundRobinDistributor.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/GroupingRoundRobinDistributor.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/GroupingRoundRobinDistributor.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -28,7 +28,7 @@
import org.jboss.messaging.core.server.Consumer;
import org.jboss.messaging.core.server.HandleStatus;
import org.jboss.messaging.core.server.MessageReference;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* Distributes message based on the message property 'JBM_GROUP_ID'. Once a message has been successfully delivered to a
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/MessageReferenceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/MessageReferenceImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/MessageReferenceImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -26,7 +26,7 @@
import org.jboss.messaging.core.server.MessageReference;
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.core.server.ServerMessage;
-import org.jboss.messaging.util.DataConstants;
+import org.jboss.messaging.utils.DataConstants;
/**
* Implementation of a MessageReference
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -76,13 +76,10 @@
import org.jboss.messaging.core.transaction.ResourceManager;
import org.jboss.messaging.core.transaction.impl.ResourceManagerImpl;
import org.jboss.messaging.core.version.Version;
-import org.jboss.messaging.util.ExecutorFactory;
-import org.jboss.messaging.util.JBMThreadFactory;
-import org.jboss.messaging.util.OrderedExecutorFactory;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.UUID;
-import org.jboss.messaging.util.VersionLoader;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.UUID;
+import org.jboss.messaging.utils.VersionLoader;
/**
* The messaging server implementation
@@ -128,7 +125,7 @@
private ExecutorService asyncDeliveryPool;
- private ExecutorFactory executorFactory;
+ private org.jboss.messaging.utils.ExecutorFactory executorFactory;
private HierarchicalRepository<Set<Role>> securityRepository;
@@ -176,9 +173,9 @@
return;
}
- asyncDeliveryPool = Executors.newCachedThreadPool(new JBMThreadFactory("JBM-async-session-delivery-threads"));
+ asyncDeliveryPool = Executors.newCachedThreadPool(new org.jboss.messaging.utils.JBMThreadFactory("JBM-async-session-delivery-threads"));
- executorFactory = new OrderedExecutorFactory(asyncDeliveryPool);
+ executorFactory = new org.jboss.messaging.utils.OrderedExecutorFactory(asyncDeliveryPool);
/*
* The following components are pluggable on the messaging server: Configuration, StorageManager, RemotingService,
@@ -228,7 +225,7 @@
securityStore.setManagementClusterPassword(configuration.getManagementClusterPassword());
addressSettingsRepository.setDefault(new AddressSettings());
scheduledExecutor = new ScheduledThreadPoolExecutor(configuration.getScheduledThreadPoolMaxSize(),
- new JBMThreadFactory("JBM-scheduled-threads"));
+ new org.jboss.messaging.utils.JBMThreadFactory("JBM-scheduled-threads"));
queueFactory = new QueueFactoryImpl(scheduledExecutor, addressSettingsRepository, storageManager);
pagingManager = createPagingManager();
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/QueueFactoryImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/QueueFactoryImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/QueueFactoryImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -31,7 +31,7 @@
import org.jboss.messaging.core.server.QueueFactory;
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.settings.impl.AddressSettings;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -55,9 +55,9 @@
import org.jboss.messaging.core.transaction.TransactionOperation;
import org.jboss.messaging.core.transaction.TransactionPropertyIndexes;
import org.jboss.messaging.core.transaction.impl.TransactionImpl;
-import org.jboss.messaging.util.ConcurrentHashSet;
-import org.jboss.messaging.util.ConcurrentSet;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.ConcurrentHashSet;
+import org.jboss.messaging.utils.ConcurrentSet;
+import org.jboss.messaging.utils.SimpleString;
/**
* Implementation of a Queue TODO use Java 5 concurrent queue
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -62,8 +62,7 @@
import org.jboss.messaging.core.server.ServerSession;
import org.jboss.messaging.core.transaction.Transaction;
import org.jboss.messaging.core.transaction.impl.TransactionImpl;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.TypedProperties;
+import org.jboss.messaging.utils.TypedProperties;
/**
* Concrete implementation of a ClientConsumer.
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -96,10 +96,10 @@
import org.jboss.messaging.core.transaction.ResourceManager;
import org.jboss.messaging.core.transaction.Transaction;
import org.jboss.messaging.core.transaction.impl.TransactionImpl;
-import org.jboss.messaging.util.IDGenerator;
-import org.jboss.messaging.util.SimpleIDGenerator;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.TypedProperties;
+import org.jboss.messaging.utils.IDGenerator;
+import org.jboss.messaging.utils.SimpleIDGenerator;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.TypedProperties;
/*
* Session implementation
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/SoloQueueImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/SoloQueueImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/SoloQueueImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -32,7 +32,7 @@
import org.jboss.messaging.core.transaction.Transaction;
import org.jboss.messaging.core.paging.PagingStore;
import org.jboss.messaging.core.paging.PagingManager;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
import java.util.ArrayList;
import java.util.HashMap;
Modified: trunk/src/main/org/jboss/messaging/core/settings/impl/AddressSettings.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/settings/impl/AddressSettings.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/settings/impl/AddressSettings.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -26,7 +26,7 @@
import org.jboss.messaging.core.server.Distributor;
import org.jboss.messaging.core.server.impl.RoundRobinDistributor;
import org.jboss.messaging.core.settings.Mergeable;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* Configuration settings that are applied on the address level
Modified: trunk/src/main/org/jboss/messaging/core/transaction/impl/XidImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/transaction/impl/XidImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/core/transaction/impl/XidImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -26,7 +26,7 @@
import javax.transaction.xa.Xid;
-import org.jboss.messaging.util.Base64;
+import org.jboss.messaging.utils.Base64;
/**
*
Modified: trunk/src/main/org/jboss/messaging/integration/transports/mina/IoBufferWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/mina/IoBufferWrapper.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/integration/transports/mina/IoBufferWrapper.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -22,16 +22,16 @@
package org.jboss.messaging.integration.transports.mina;
-import static org.jboss.messaging.util.DataConstants.FALSE;
-import static org.jboss.messaging.util.DataConstants.NOT_NULL;
-import static org.jboss.messaging.util.DataConstants.NULL;
-import static org.jboss.messaging.util.DataConstants.TRUE;
+import static org.jboss.messaging.utils.DataConstants.FALSE;
+import static org.jboss.messaging.utils.DataConstants.NOT_NULL;
+import static org.jboss.messaging.utils.DataConstants.NULL;
+import static org.jboss.messaging.utils.DataConstants.TRUE;
+import org.jboss.messaging.utils.SimpleString;
import java.nio.charset.Charset;
import org.apache.mina.core.buffer.IoBuffer;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
/**
*
Modified: trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaAcceptor.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaAcceptor.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaAcceptor.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -44,7 +44,7 @@
import org.jboss.messaging.core.remoting.spi.BufferHandler;
import org.jboss.messaging.core.remoting.spi.Connection;
import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
-import org.jboss.messaging.util.ConfigurationHelper;
+import org.jboss.messaging.utils.ConfigurationHelper;
/**
Modified: trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnector.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnector.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnector.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -41,7 +41,8 @@
import org.jboss.messaging.core.remoting.spi.Connection;
import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
import org.jboss.messaging.core.remoting.spi.Connector;
-import org.jboss.messaging.util.ConfigurationHelper;
+import org.jboss.messaging.utils.ConfigurationHelper;
+
/**
*
* A MinaConnector
Modified: trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaProtocolCodecFilter.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaProtocolCodecFilter.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaProtocolCodecFilter.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -22,7 +22,7 @@
package org.jboss.messaging.integration.transports.mina;
-import static org.jboss.messaging.util.DataConstants.SIZE_INT;
+import static org.jboss.messaging.utils.DataConstants.SIZE_INT;
import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession;
Modified: trunk/src/main/org/jboss/messaging/integration/transports/netty/ChannelBufferWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/ChannelBufferWrapper.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/ChannelBufferWrapper.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -22,18 +22,18 @@
package org.jboss.messaging.integration.transports.netty;
-import static org.jboss.messaging.util.DataConstants.FALSE;
-import static org.jboss.messaging.util.DataConstants.NOT_NULL;
-import static org.jboss.messaging.util.DataConstants.NULL;
-import static org.jboss.messaging.util.DataConstants.TRUE;
+import static org.jboss.messaging.utils.DataConstants.FALSE;
+import static org.jboss.messaging.utils.DataConstants.NOT_NULL;
+import static org.jboss.messaging.utils.DataConstants.NULL;
+import static org.jboss.messaging.utils.DataConstants.TRUE;
+import org.jboss.messaging.utils.SimpleString;
import static org.jboss.netty.buffer.ChannelBuffers.copiedBuffer;
import static org.jboss.netty.buffer.ChannelBuffers.dynamicBuffer;
import java.nio.BufferUnderflowException;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.UTF8Util;
+import org.jboss.messaging.utils.UTF8Util;
import org.jboss.netty.buffer.ChannelBuffer;
/**
Modified: trunk/src/main/org/jboss/messaging/integration/transports/netty/MessagingFrameDecoder.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/MessagingFrameDecoder.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/MessagingFrameDecoder.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -22,7 +22,7 @@
package org.jboss.messaging.integration.transports.netty;
-import static org.jboss.messaging.util.DataConstants.SIZE_INT;
+import static org.jboss.messaging.utils.DataConstants.SIZE_INT;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.remoting.spi.BufferHandler;
Modified: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -38,14 +38,13 @@
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.remoting.impl.invm.InVMConnector;
import org.jboss.messaging.core.remoting.impl.ssl.SSLSupport;
import org.jboss.messaging.core.remoting.spi.Acceptor;
import org.jboss.messaging.core.remoting.spi.BufferHandler;
import org.jboss.messaging.core.remoting.spi.Connection;
import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
-import org.jboss.messaging.util.ConfigurationHelper;
-import org.jboss.messaging.util.JBMThreadFactory;
+import org.jboss.messaging.utils.ConfigurationHelper;
+import org.jboss.messaging.utils.JBMThreadFactory;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelFactory;
@@ -208,7 +207,7 @@
// Already started
return;
}
- bossExecutor = Executors.newCachedThreadPool(new JBMThreadFactory("jbm-netty-acceptor-boss-threads"));
+ bossExecutor = Executors.newCachedThreadPool(new org.jboss.messaging.utils.JBMThreadFactory("jbm-netty-acceptor-boss-threads"));
workerExecutor = Executors.newCachedThreadPool(new JBMThreadFactory("jbm-netty-acceptor-worker-threads"));
if (useNio)
{
Modified: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -44,8 +44,8 @@
import org.jboss.messaging.core.remoting.spi.Connection;
import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
import org.jboss.messaging.core.remoting.spi.Connector;
-import org.jboss.messaging.util.ConfigurationHelper;
-import org.jboss.messaging.util.JBMThreadFactory;
+import org.jboss.messaging.utils.ConfigurationHelper;
+import org.jboss.messaging.utils.JBMThreadFactory;
import org.jboss.netty.bootstrap.ClientBootstrap;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
@@ -212,7 +212,7 @@
return;
}
- workerExecutor = Executors.newCachedThreadPool(new JBMThreadFactory("jbm-netty-connector-worker-threads"));
+ workerExecutor = Executors.newCachedThreadPool(new org.jboss.messaging.utils.JBMThreadFactory("jbm-netty-connector-worker-threads"));
if (useNio)
{
bossExecutor = Executors.newCachedThreadPool(new JBMThreadFactory("jbm-netty-connector-boss-threads"));
Modified: trunk/src/main/org/jboss/messaging/jms/JBossDestination.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/JBossDestination.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/JBossDestination.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -30,7 +30,7 @@
import org.jboss.messaging.jms.referenceable.DestinationObjectFactory;
import org.jboss.messaging.jms.referenceable.SerializableObjectRefAddr;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
Modified: trunk/src/main/org/jboss/messaging/jms/JBossQueue.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/JBossQueue.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/JBossQueue.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -25,7 +25,7 @@
import javax.jms.JMSException;
import javax.jms.Queue;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
Modified: trunk/src/main/org/jboss/messaging/jms/JBossTopic.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/JBossTopic.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/JBossTopic.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -25,8 +25,8 @@
import javax.jms.JMSException;
import javax.jms.Topic;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossConnection.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossConnection.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossConnection.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -53,10 +53,9 @@
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.remoting.FailureListener;
import org.jboss.messaging.core.version.Version;
-import org.jboss.messaging.util.ConcurrentHashSet;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.UUIDGenerator;
-import org.jboss.messaging.util.VersionLoader;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.UUIDGenerator;
+import org.jboss.messaging.utils.VersionLoader;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
@@ -87,11 +86,11 @@
private final int connectionType;
- private final Set<JBossSession> sessions = new ConcurrentHashSet<JBossSession>();
+ private final Set<JBossSession> sessions = new org.jboss.messaging.utils.ConcurrentHashSet<JBossSession>();
- private final Set<SimpleString> tempAddresses = new ConcurrentHashSet<SimpleString>();
+ private final Set<SimpleString> tempAddresses = new org.jboss.messaging.utils.ConcurrentHashSet<SimpleString>();
- private final Set<SimpleString> tempQueues = new ConcurrentHashSet<SimpleString>();
+ private final Set<SimpleString> tempQueues = new org.jboss.messaging.utils.ConcurrentHashSet<SimpleString>();
private volatile boolean hasNoLocal;
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -41,7 +41,7 @@
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.jms.referenceable.ConnectionFactoryObjectFactory;
import org.jboss.messaging.jms.referenceable.SerializableObjectRefAddr;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossMapMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossMapMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossMapMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -33,8 +33,8 @@
import org.jboss.messaging.core.client.ClientMessage;
import org.jboss.messaging.core.client.ClientSession;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.TypedProperties;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.TypedProperties;
/**
* This class implements javax.jms.MapMessage
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -37,7 +37,7 @@
import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
import org.jboss.messaging.jms.JBossDestination;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* Implementation of a JMS Message JMS Messages only live on the client side - the server only deals with MessageImpl
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossMessageConsumer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossMessageConsumer.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossMessageConsumer.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -38,7 +38,7 @@
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.jms.JBossDestination;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossMessageProducer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossMessageProducer.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossMessageProducer.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -47,8 +47,8 @@
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.jms.JBossDestination;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.UUIDGenerator;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossObjectMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossObjectMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossObjectMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -33,7 +33,6 @@
import org.jboss.messaging.core.client.ClientMessage;
import org.jboss.messaging.core.client.ClientSession;
-import org.jboss.messaging.util.ObjectInputStreamWithClassLoader;
/**
* This class implements javax.jms.ObjectMessage
@@ -166,7 +165,7 @@
try
{
ByteArrayInputStream bais = new ByteArrayInputStream(data);
- ObjectInputStream ois = new ObjectInputStreamWithClassLoader(bais);
+ ObjectInputStream ois = new org.jboss.messaging.utils.ObjectInputStreamWithClassLoader(bais);
Serializable object = (Serializable)ois.readObject();
return object;
}
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossQueueBrowser.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossQueueBrowser.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossQueueBrowser.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -35,7 +35,7 @@
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.jms.JBossQueue;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossSession.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossSession.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossSession.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -72,7 +72,7 @@
import org.jboss.messaging.jms.JBossTemporaryQueue;
import org.jboss.messaging.jms.JBossTemporaryTopic;
import org.jboss.messaging.jms.JBossTopic;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossStreamMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossStreamMessage.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossStreamMessage.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -33,7 +33,7 @@
import org.jboss.messaging.core.client.ClientSession;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.DataConstants;
+import org.jboss.messaging.utils.DataConstants;
/**
* This class implements javax.jms.StreamMessage.
Modified: trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -26,7 +26,7 @@
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.config.cluster.DiscoveryGroupConfiguration;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
/**
* The JMS Management interface.
Modified: trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,8 +23,7 @@
import org.jboss.messaging.core.deployers.impl.XmlDeployer;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.jms.server.JMSServerManager;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.XMLUtil;
+import org.jboss.messaging.utils.Pair;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -126,7 +125,7 @@
@Override
public void validate(Node rootNode) throws Exception
{
- XMLUtil.validate(rootNode, "jbm-jms.xsd");
+ org.jboss.messaging.utils.XMLUtil.validate(rootNode, "jbm-jms.xsd");
}
/**
@@ -187,35 +186,35 @@
if (PING_PERIOD_ELEMENT.equals(child.getNodeName()))
{
- pingPeriod = XMLUtil.parseLong(child);
+ pingPeriod = org.jboss.messaging.utils.XMLUtil.parseLong(child);
}
else if (CONNECTION_TTL_ELEMENT.equals(child.getNodeName()))
{
- connectionTTL = XMLUtil.parseLong(child);
+ connectionTTL = org.jboss.messaging.utils.XMLUtil.parseLong(child);
}
else if (CALL_TIMEOUT_ELEMENT.equals(child.getNodeName()))
{
- callTimeout = XMLUtil.parseLong(child);
+ callTimeout = org.jboss.messaging.utils.XMLUtil.parseLong(child);
}
else if (CONSUMER_WINDOW_SIZE_ELEMENT.equals(child.getNodeName()))
{
- consumerWindowSize = XMLUtil.parseInt(child);
+ consumerWindowSize = org.jboss.messaging.utils.XMLUtil.parseInt(child);
}
else if (CONSUMER_MAX_RATE_ELEMENT.equals(child.getNodeName()))
{
- consumerMaxRate = XMLUtil.parseInt(child);
+ consumerMaxRate = org.jboss.messaging.utils.XMLUtil.parseInt(child);
}
else if (SEND_WINDOW_SIZE.equals(child.getNodeName()))
{
- sendWindowSize = XMLUtil.parseInt(child);
+ sendWindowSize = org.jboss.messaging.utils.XMLUtil.parseInt(child);
}
else if (PRODUCER_MAX_RATE_ELEMENT.equals(child.getNodeName()))
{
- producerMaxRate = XMLUtil.parseInt(child);
+ producerMaxRate = org.jboss.messaging.utils.XMLUtil.parseInt(child);
}
else if (BIG_MESSAGE_ELEMENT.equals(child.getNodeName()))
{
- minLargeMessageSize = XMLUtil.parseInt(child);
+ minLargeMessageSize = org.jboss.messaging.utils.XMLUtil.parseInt(child);
}
else if (CLIENTID_ELEMENT.equals(child.getNodeName()))
{
@@ -223,55 +222,55 @@
}
else if (DUPS_OK_BATCH_SIZE_ELEMENT.equals(child.getNodeName()))
{
- dupsOKBatchSize = XMLUtil.parseInt(child);
+ dupsOKBatchSize = org.jboss.messaging.utils.XMLUtil.parseInt(child);
}
else if (TRANSACTION_BATCH_SIZE_ELEMENT.equals(child.getNodeName()))
{
- transactionBatchSize = XMLUtil.parseInt(child);
+ transactionBatchSize = org.jboss.messaging.utils.XMLUtil.parseInt(child);
}
else if (BLOCK_ON_ACKNOWLEDGE_ELEMENT.equals(child.getNodeName()))
{
- blockOnAcknowledge = XMLUtil.parseBoolean(child);
+ blockOnAcknowledge = org.jboss.messaging.utils.XMLUtil.parseBoolean(child);
}
else if (SEND_NP_MESSAGES_SYNCHRONOUSLY_ELEMENT.equals(child.getNodeName()))
{
- blockOnNonPersistentSend = XMLUtil.parseBoolean(child);
+ blockOnNonPersistentSend = org.jboss.messaging.utils.XMLUtil.parseBoolean(child);
}
else if (SEND_P_MESSAGES_SYNCHRONOUSLY_ELEMENT.equals(child.getNodeName()))
{
- blockOnPersistentSend = XMLUtil.parseBoolean(child);
+ blockOnPersistentSend = org.jboss.messaging.utils.XMLUtil.parseBoolean(child);
}
else if (AUTO_GROUP_ID_ELEMENT.equals(child.getNodeName()))
{
- autoGroup = XMLUtil.parseBoolean(child);
+ autoGroup = org.jboss.messaging.utils.XMLUtil.parseBoolean(child);
}
else if (MAX_CONNECTIONS_ELEMENT.equals(child.getNodeName()))
{
- maxConnections = XMLUtil.parseInt(child);
+ maxConnections = org.jboss.messaging.utils.XMLUtil.parseInt(child);
}
else if (PRE_ACKNOWLEDGE_ELEMENT.equals(child.getNodeName()))
{
- preAcknowledge = XMLUtil.parseBoolean(child);;
+ preAcknowledge = org.jboss.messaging.utils.XMLUtil.parseBoolean(child);;
}
else if (RETRY_ON_FAILURE_ELEMENT.equals(child.getNodeName()))
{
- preAcknowledge = XMLUtil.parseBoolean(child);;
+ preAcknowledge = org.jboss.messaging.utils.XMLUtil.parseBoolean(child);;
}
else if (RETRY_INTERVAL.equals(child.getNodeName()))
{
- retryInterval = XMLUtil.parseInt(child);;
+ retryInterval = org.jboss.messaging.utils.XMLUtil.parseInt(child);;
}
else if (RETRY_INTERVAL_MULTIPLIER.equals(child.getNodeName()))
{
- retryIntervalMultiplier = XMLUtil.parseDouble(child);
+ retryIntervalMultiplier = org.jboss.messaging.utils.XMLUtil.parseDouble(child);
}
else if (MAX_RETRIES_BEFORE_FAILOVER.equals(child.getNodeName()))
{
- maxRetriesBeforeFailover = XMLUtil.parseInt(child);;
+ maxRetriesBeforeFailover = org.jboss.messaging.utils.XMLUtil.parseInt(child);;
}
else if (MAX_RETRIES_AFTER_FAILOVER.equals(child.getNodeName()))
{
- maxRetriesAfterFailover = XMLUtil.parseInt(child);;
+ maxRetriesAfterFailover = org.jboss.messaging.utils.XMLUtil.parseInt(child);;
}
else if (ENTRY_NODE_NAME.equals(child.getNodeName()))
{
@@ -331,7 +330,7 @@
}
else if (DISCOVERY_INITIAL_WAIT_ELEMENT.equals(child.getNodeName()))
{
- discoveryInitialWait = XMLUtil.parseInt(child);
+ discoveryInitialWait = org.jboss.messaging.utils.XMLUtil.parseInt(child);
}
}
Modified: trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -51,8 +51,7 @@
import org.jboss.messaging.jms.server.JMSServerManager;
import org.jboss.messaging.jms.server.management.JMSManagementService;
import org.jboss.messaging.jms.server.management.impl.JMSManagementServiceImpl;
-import org.jboss.messaging.util.JNDIUtil;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
/**
* A Deployer used to create and add to JNDI queues, topics and connection
@@ -432,7 +431,7 @@
// OK
}
- Context c = JNDIUtil.createContext(context, parentContext);
+ Context c = org.jboss.messaging.utils.JNDIUtil.createContext(context, parentContext);
c.rebind(jndiNameInContext, objectToBind);
return true;
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/JMSMessageInfo.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/JMSMessageInfo.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/JMSMessageInfo.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -41,7 +41,7 @@
import org.jboss.messaging.core.management.PropertiesInfo;
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.jms.client.JBossMessage;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -30,7 +30,7 @@
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.management.Operation;
import org.jboss.messaging.core.management.Parameter;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSQueueControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSQueueControl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSQueueControl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -51,7 +51,7 @@
import org.jboss.messaging.jms.client.SelectorTranslator;
import org.jboss.messaging.jms.server.management.JMSMessageInfo;
import org.jboss.messaging.jms.server.management.JMSQueueControlMBean;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -42,7 +42,7 @@
import org.jboss.messaging.core.management.impl.MBeanInfoHelper;
import org.jboss.messaging.jms.server.JMSServerManager;
import org.jboss.messaging.jms.server.management.JMSServerControlMBean;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/impl/TopicControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/impl/TopicControl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/impl/TopicControl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -42,8 +42,8 @@
import org.jboss.messaging.jms.server.management.JMSMessageInfo;
import org.jboss.messaging.jms.server.management.SubscriptionInfo;
import org.jboss.messaging.jms.server.management.TopicControlMBean;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -33,7 +33,7 @@
import org.jboss.messaging.core.management.jmx.impl.ReplicationAwareStandardMBeanWrapper;
import org.jboss.messaging.jms.server.management.JMSServerControlMBean;
import org.jboss.messaging.jms.server.management.impl.JMSServerControl;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
/**
* A ReplicationAwareJMSServerControlWrapper
Modified: trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivationSpec.java
===================================================================
--- trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivationSpec.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivationSpec.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -897,4 +897,25 @@
buffer.append(')');
return buffer.toString();
}
+
+ //here for backwards compatibilty
+ public void setUseDLQ(boolean b)
+ {
+
+ }
+
+ public void setDLQJNDIName(String name)
+ {
+
+ }
+
+ public void setDLQMaxResent(int maxResent)
+ {
+
+ }
+
+ public void setProviderAdapterJNDI(String jndi)
+ {
+
+ }
}
Deleted: trunk/src/main/org/jboss/messaging/util/Base64.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/Base64.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/Base64.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,1809 +0,0 @@
-package org.jboss.messaging.util;
-
-/**
- * <p>Encodes and decodes to and from Base64 notation.</p>
- * <p>Homepage: <a href="http://iharder.net/base64">http://iharder.net/base64</a>.</p>
- *
- * <p>The <tt>options</tt> parameter, which appears in a few places, is used to pass
- * several pieces of information to the encoder. In the "higher level" methods such as
- * encodeBytes( bytes, options ) the options parameter can be used to indicate such
- * things as first gzipping the bytes before encoding them, not inserting linefeeds
- * (though that breaks strict Base64 compatibility), and encoding using the URL-safe
- * and Ordered dialects.</p>
- *
- * <p>The constants defined in Base64 can be OR-ed together to combine options, so you
- * might make a call like this:</p>
- *
- * <code>String encoded = Base64.encodeBytes( mybytes, Base64.GZIP | Base64.DONT_BREAK_LINES );</code>
- *
- * <p>to compress the data before encoding it and then making the output have no newline characters.</p>
- *
- *
- * <p>
- * Change Log:
- * </p>
- * <ul>
- * <li>v2.2.2 - Fixed encodeFileToFile and decodeFileToFile to use the
- * Base64.InputStream class to encode and decode on the fly which uses
- * less memory than encoding/decoding an entire file into memory before writing.</li>
- * <li>v2.2.1 - Fixed bug using URL_SAFE and ORDERED encodings. Fixed bug
- * when using very small files (~< 40 bytes).</li>
- * <li>v2.2 - Added some helper methods for encoding/decoding directly from
- * one file to the next. Also added a main() method to support command line
- * encoding/decoding from one file to the next. Also added these Base64 dialects:
- * <ol>
- * <li>The default is RFC3548 format.</li>
- * <li>Calling Base64.setFormat(Base64.BASE64_FORMAT.URLSAFE_FORMAT) generates
- * URL and file name friendly format as described in Section 4 of RFC3548.
- * http://www.faqs.org/rfcs/rfc3548.html</li>
- * <li>Calling Base64.setFormat(Base64.BASE64_FORMAT.ORDERED_FORMAT) generates
- * URL and file name friendly format that preserves lexical ordering as described
- * in http://www.faqs.org/qa/rfcc-1940.html</li>
- * </ol>
- * Special thanks to Jim Kellerman at <a href="http://www.powerset.com/">http://www.powerset.com/</a>
- * for contributing the new Base64 dialects.
- * </li>
- *
- * <li>v2.1 - Cleaned up javadoc comments and unused variables and methods. Added
- * some convenience methods for reading and writing to and from files.</li>
- * <li>v2.0.2 - Now specifies UTF-8 encoding in places where the code fails on systems
- * with other encodings (like EBCDIC).</li>
- * <li>v2.0.1 - Fixed an error when decoding a single byte, that is, when the
- * encoded data was a single byte.</li>
- * <li>v2.0 - I got rid of methods that used booleans to set options.
- * Now everything is more consolidated and cleaner. The code now detects
- * when data that's being decoded is gzip-compressed and will decompress it
- * automatically. Generally things are cleaner. You'll probably have to
- * change some method calls that you were making to support the new
- * options format (<tt>int</tt>s that you "OR" together).</li>
- * <li>v1.5.1 - Fixed bug when decompressing and decoding to a
- * byte[] using <tt>decode( String s, boolean gzipCompressed )</tt>.
- * Added the ability to "suspend" encoding in the Output Stream so
- * you can turn on and off the encoding if you need to embed base64
- * data in an otherwise "normal" stream (like an XML file).</li>
- * <li>v1.5 - Output stream pases on flush() command but doesn't do anything itself.
- * This helps when using GZIP streams.
- * Added the ability to GZip-compress objects before encoding them.</li>
- * <li>v1.4 - Added helper methods to read/write files.</li>
- * <li>v1.3.6 - Fixed OutputStream.flush() so that 'position' is reset.</li>
- * <li>v1.3.5 - Added flag to turn on and off line breaks. Fixed bug in input stream
- * where last buffer being read, if not completely full, was not returned.</li>
- * <li>v1.3.4 - Fixed when "improperly padded stream" error was thrown at the wrong time.</li>
- * <li>v1.3.3 - Fixed I/O streams which were totally messed up.</li>
- * </ul>
- *
- * <p>
- * I am placing this code in the Public Domain. Do with it as you will.
- * This software comes with no guarantees or warranties but with
- * plenty of well-wishing instead!
- * Please visit <a href="http://iharder.net/base64">http://iharder.net/base64</a>
- * periodically to check for updates or to contribute improvements.
- * </p>
- *
- * @author Robert Harder
- * @author rob at iharder.net
- * @version 2.2.2
- */
-public class Base64
-{
-
-/* ******** P U B L I C F I E L D S ******** */
-
-
- /** No options specified. Value is zero. */
- public final static int NO_OPTIONS = 0;
-
- /** Specify encoding. */
- public final static int ENCODE = 1;
-
-
- /** Specify decoding. */
- public final static int DECODE = 0;
-
-
- /** Specify that data should be gzip-compressed. */
- public final static int GZIP = 2;
-
-
- /** Don't break lines when encoding (violates strict Base64 specification) */
- public final static int DONT_BREAK_LINES = 8;
-
- /**
- * Encode using Base64-like encoding that is URL- and Filename-safe as described
- * in Section 4 of RFC3548:
- * <a href="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs.org/rfcs/rfc3548.html</a>.
- * It is important to note that data encoded this way is <em>not</em> officially valid Base64,
- * or at the very least should not be called Base64 without also specifying that is
- * was encoded using the URL- and Filename-safe dialect.
- */
- public final static int URL_SAFE = 16;
-
-
- /**
- * Encode using the special "ordered" dialect of Base64 described here:
- * <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.
- */
- public final static int ORDERED = 32;
-
-
-/* ******** P R I V A T E F I E L D S ******** */
-
-
- /** Maximum line length (76) of Base64 output. */
- private final static int MAX_LINE_LENGTH = 76;
-
-
- /** The equals sign (=) as a byte. */
- private final static byte EQUALS_SIGN = (byte)'=';
-
-
- /** The new line character (\n) as a byte. */
- private final static byte NEW_LINE = (byte)'\n';
-
-
- /** Preferred encoding. */
- private final static String PREFERRED_ENCODING = "UTF-8";
-
-
- // I think I end up not using the BAD_ENCODING indicator.
- //private final static byte BAD_ENCODING = -9; // Indicates error in encoding
- private final static byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding
- private final static byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding
-
-
-/* ******** S T A N D A R D B A S E 6 4 A L P H A B E T ******** */
-
- /** The 64 valid Base64 values. */
- //private final static byte[] ALPHABET;
- /* Host platform me be something funny like EBCDIC, so we hardcode these values. */
- private final static byte[] _STANDARD_ALPHABET =
- {
- (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
- (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
- (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
- (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
- (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
- (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
- (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
- (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z',
- (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5',
- (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/'
- };
-
-
- /**
- * Translates a Base64 value to either its 6-bit reconstruction value
- * or a negative number indicating some other meaning.
- **/
- private final static byte[] _STANDARD_DECODABET =
- {
- -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
- -5,-5, // Whitespace: Tab and Linefeed
- -9,-9, // Decimal 11 - 12
- -5, // Whitespace: Carriage Return
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26
- -9,-9,-9,-9,-9, // Decimal 27 - 31
- -5, // Whitespace: Space
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42
- 62, // Plus sign at decimal 43
- -9,-9,-9, // Decimal 44 - 46
- 63, // Slash at decimal 47
- 52,53,54,55,56,57,58,59,60,61, // Numbers zero through nine
- -9,-9,-9, // Decimal 58 - 60
- -1, // Equals sign at decimal 61
- -9,-9,-9, // Decimal 62 - 64
- 0,1,2,3,4,5,6,7,8,9,10,11,12,13, // Letters 'A' through 'N'
- 14,15,16,17,18,19,20,21,22,23,24,25, // Letters 'O' through 'Z'
- -9,-9,-9,-9,-9,-9, // Decimal 91 - 96
- 26,27,28,29,30,31,32,33,34,35,36,37,38, // Letters 'a' through 'm'
- 39,40,41,42,43,44,45,46,47,48,49,50,51, // Letters 'n' through 'z'
- -9,-9,-9,-9 // Decimal 123 - 126
- /*,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 127 - 139
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */
- };
-
-
-/* ******** U R L S A F E B A S E 6 4 A L P H A B E T ******** */
-
- /**
- * Used in the URL- and Filename-safe dialect described in Section 4 of RFC3548:
- * <a href="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs.org/rfcs/rfc3548.html</a>.
- * Notice that the last two bytes become "hyphen" and "underscore" instead of "plus" and "slash."
- */
- private final static byte[] _URL_SAFE_ALPHABET =
- {
- (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
- (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
- (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
- (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
- (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
- (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
- (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
- (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z',
- (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5',
- (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'-', (byte)'_'
- };
-
- /**
- * Used in decoding URL- and Filename-safe dialects of Base64.
- */
- private final static byte[] _URL_SAFE_DECODABET =
- {
- -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
- -5,-5, // Whitespace: Tab and Linefeed
- -9,-9, // Decimal 11 - 12
- -5, // Whitespace: Carriage Return
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26
- -9,-9,-9,-9,-9, // Decimal 27 - 31
- -5, // Whitespace: Space
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42
- -9, // Plus sign at decimal 43
- -9, // Decimal 44
- 62, // Minus sign at decimal 45
- -9, // Decimal 46
- -9, // Slash at decimal 47
- 52,53,54,55,56,57,58,59,60,61, // Numbers zero through nine
- -9,-9,-9, // Decimal 58 - 60
- -1, // Equals sign at decimal 61
- -9,-9,-9, // Decimal 62 - 64
- 0,1,2,3,4,5,6,7,8,9,10,11,12,13, // Letters 'A' through 'N'
- 14,15,16,17,18,19,20,21,22,23,24,25, // Letters 'O' through 'Z'
- -9,-9,-9,-9, // Decimal 91 - 94
- 63, // Underscore at decimal 95
- -9, // Decimal 96
- 26,27,28,29,30,31,32,33,34,35,36,37,38, // Letters 'a' through 'm'
- 39,40,41,42,43,44,45,46,47,48,49,50,51, // Letters 'n' through 'z'
- -9,-9,-9,-9 // Decimal 123 - 126
- /*,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 127 - 139
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */
- };
-
-
-
-/* ******** O R D E R E D B A S E 6 4 A L P H A B E T ******** */
-
- /**
- * I don't get the point of this technique, but it is described here:
- * <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.
- */
- private final static byte[] _ORDERED_ALPHABET =
- {
- (byte)'-',
- (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4',
- (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9',
- (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
- (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
- (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
- (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
- (byte)'_',
- (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
- (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
- (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
- (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z'
- };
-
- /**
- * Used in decoding the "ordered" dialect of Base64.
- */
- private final static byte[] _ORDERED_DECODABET =
- {
- -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
- -5,-5, // Whitespace: Tab and Linefeed
- -9,-9, // Decimal 11 - 12
- -5, // Whitespace: Carriage Return
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26
- -9,-9,-9,-9,-9, // Decimal 27 - 31
- -5, // Whitespace: Space
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42
- -9, // Plus sign at decimal 43
- -9, // Decimal 44
- 0, // Minus sign at decimal 45
- -9, // Decimal 46
- -9, // Slash at decimal 47
- 1,2,3,4,5,6,7,8,9,10, // Numbers zero through nine
- -9,-9,-9, // Decimal 58 - 60
- -1, // Equals sign at decimal 61
- -9,-9,-9, // Decimal 62 - 64
- 11,12,13,14,15,16,17,18,19,20,21,22,23, // Letters 'A' through 'M'
- 24,25,26,27,28,29,30,31,32,33,34,35,36, // Letters 'N' through 'Z'
- -9,-9,-9,-9, // Decimal 91 - 94
- 37, // Underscore at decimal 95
- -9, // Decimal 96
- 38,39,40,41,42,43,44,45,46,47,48,49,50, // Letters 'a' through 'm'
- 51,52,53,54,55,56,57,58,59,60,61,62,63, // Letters 'n' through 'z'
- -9,-9,-9,-9 // Decimal 123 - 126
- /*,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 127 - 139
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */
- };
-
-
-/* ******** D E T E R M I N E W H I C H A L H A B E T ******** */
-
-
- /**
- * Returns one of the _SOMETHING_ALPHABET byte arrays depending on
- * the options specified.
- * It's possible, though silly, to specify ORDERED and URLSAFE
- * in which case one of them will be picked, though there is
- * no guarantee as to which one will be picked.
- */
- private final static byte[] getAlphabet( int options )
- {
- if( (options & URL_SAFE) == URL_SAFE ) return _URL_SAFE_ALPHABET;
- else if( (options & ORDERED) == ORDERED ) return _ORDERED_ALPHABET;
- else return _STANDARD_ALPHABET;
-
- } // end getAlphabet
-
-
- /**
- * Returns one of the _SOMETHING_DECODABET byte arrays depending on
- * the options specified.
- * It's possible, though silly, to specify ORDERED and URL_SAFE
- * in which case one of them will be picked, though there is
- * no guarantee as to which one will be picked.
- */
- private final static byte[] getDecodabet( int options )
- {
- if( (options & URL_SAFE) == URL_SAFE ) return _URL_SAFE_DECODABET;
- else if( (options & ORDERED) == ORDERED ) return _ORDERED_DECODABET;
- else return _STANDARD_DECODABET;
-
- } // end getAlphabet
-
-
-
- /** Defeats instantiation. */
- private Base64(){}
-
-
- /**
- * Encodes or decodes two files from the command line;
- * <strong>feel free to delete this method (in fact you probably should)
- * if you're embedding this code into a larger program.</strong>
- */
- public final static void main( String[] args )
- {
- if( args.length < 3 ){
- usage("Not enough arguments.");
- } // end if: args.length < 3
- else {
- String flag = args[0];
- String infile = args[1];
- String outfile = args[2];
- if( flag.equals( "-e" ) ){
- Base64.encodeFileToFile( infile, outfile );
- } // end if: encode
- else if( flag.equals( "-d" ) ) {
- Base64.decodeFileToFile( infile, outfile );
- } // end else if: decode
- else {
- usage( "Unknown flag: " + flag );
- } // end else
- } // end else
- } // end main
-
- /**
- * Prints command line usage.
- *
- * @param msg A message to include with usage info.
- */
- private final static void usage( String msg )
- {
- System.err.println( msg );
- System.err.println( "Usage: java Base64 -e|-d inputfile outputfile" );
- } // end usage
-
-
-/* ******** E N C O D I N G M E T H O D S ******** */
-
-
- /**
- * Encodes up to the first three bytes of array <var>threeBytes</var>
- * and returns a four-byte array in Base64 notation.
- * The actual number of significant bytes in your array is
- * given by <var>numSigBytes</var>.
- * The array <var>threeBytes</var> needs only be as big as
- * <var>numSigBytes</var>.
- * Code can reuse a byte array by passing a four-byte array as <var>b4</var>.
- *
- * @param b4 A reusable byte array to reduce array instantiation
- * @param threeBytes the array to convert
- * @param numSigBytes the number of significant bytes in your array
- * @return four byte array in Base64 notation.
- * @since 1.5.1
- */
- private static byte[] encode3to4( byte[] b4, byte[] threeBytes, int numSigBytes, int options )
- {
- encode3to4( threeBytes, 0, numSigBytes, b4, 0, options );
- return b4;
- } // end encode3to4
-
-
- /**
- * <p>Encodes up to three bytes of the array <var>source</var>
- * and writes the resulting four Base64 bytes to <var>destination</var>.
- * The source and destination arrays can be manipulated
- * anywhere along their length by specifying
- * <var>srcOffset</var> and <var>destOffset</var>.
- * This method does not check to make sure your arrays
- * are large enough to accomodate <var>srcOffset</var> + 3 for
- * the <var>source</var> array or <var>destOffset</var> + 4 for
- * the <var>destination</var> array.
- * The actual number of significant bytes in your array is
- * given by <var>numSigBytes</var>.</p>
- * <p>This is the lowest level of the encoding methods with
- * all possible parameters.</p>
- *
- * @param source the array to convert
- * @param srcOffset the index where conversion begins
- * @param numSigBytes the number of significant bytes in your array
- * @param destination the array to hold the conversion
- * @param destOffset the index where output will be put
- * @return the <var>destination</var> array
- * @since 1.3
- */
- private static byte[] encode3to4(
- byte[] source, int srcOffset, int numSigBytes,
- byte[] destination, int destOffset, int options )
- {
- byte[] ALPHABET = getAlphabet( options );
-
- // 1 2 3
- // 01234567890123456789012345678901 Bit position
- // --------000000001111111122222222 Array position from threeBytes
- // --------| || || || | Six bit groups to index ALPHABET
- // >>18 >>12 >> 6 >> 0 Right shift necessary
- // 0x3f 0x3f 0x3f Additional AND
-
- // Create buffer with zero-padding if there are only one or two
- // significant bytes passed in the array.
- // We have to shift left 24 in order to flush out the 1's that appear
- // when Java treats a value as negative that is cast from a byte to an int.
- int inBuff = ( numSigBytes > 0 ? ((source[ srcOffset ] << 24) >>> 8) : 0 )
- | ( numSigBytes > 1 ? ((source[ srcOffset + 1 ] << 24) >>> 16) : 0 )
- | ( numSigBytes > 2 ? ((source[ srcOffset + 2 ] << 24) >>> 24) : 0 );
-
- switch( numSigBytes )
- {
- case 3:
- destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
- destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
- destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ];
- destination[ destOffset + 3 ] = ALPHABET[ (inBuff ) & 0x3f ];
- return destination;
-
- case 2:
- destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
- destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
- destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ];
- destination[ destOffset + 3 ] = EQUALS_SIGN;
- return destination;
-
- case 1:
- destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
- destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
- destination[ destOffset + 2 ] = EQUALS_SIGN;
- destination[ destOffset + 3 ] = EQUALS_SIGN;
- return destination;
-
- default:
- return destination;
- } // end switch
- } // end encode3to4
-
-
-
- /**
- * Serializes an object and returns the Base64-encoded
- * version of that serialized object. If the object
- * cannot be serialized or there is another error,
- * the method will return <tt>null</tt>.
- * The object is not GZip-compressed before being encoded.
- *
- * @param serializableObject The object to encode
- * @return The Base64-encoded object
- * @since 1.4
- */
- public static String encodeObject( java.io.Serializable serializableObject )
- {
- return encodeObject( serializableObject, NO_OPTIONS );
- } // end encodeObject
-
-
-
- /**
- * Serializes an object and returns the Base64-encoded
- * version of that serialized object. If the object
- * cannot be serialized or there is another error,
- * the method will return <tt>null</tt>.
- * <p>
- * Valid options:<pre>
- * GZIP: gzip-compresses object before encoding it.
- * DONT_BREAK_LINES: don't break lines at 76 characters
- * <i>Note: Technically, this makes your encoding non-compliant.</i>
- * </pre>
- * <p>
- * Example: <code>encodeObject( myObj, Base64.GZIP )</code> or
- * <p>
- * Example: <code>encodeObject( myObj, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
- *
- * @param serializableObject The object to encode
- * @param options Specified options
- * @return The Base64-encoded object
- * @see Base64#GZIP
- * @see Base64#DONT_BREAK_LINES
- * @since 2.0
- */
- public static String encodeObject( java.io.Serializable serializableObject, int options )
- {
- // Streams
- java.io.ByteArrayOutputStream baos = null;
- java.io.OutputStream b64os = null;
- java.io.ObjectOutputStream oos = null;
- java.util.zip.GZIPOutputStream gzos = null;
-
- // Isolate options
- int gzip = (options & GZIP);
- int dontBreakLines = (options & DONT_BREAK_LINES);
-
- try
- {
- // ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream
- baos = new java.io.ByteArrayOutputStream();
- b64os = new Base64.OutputStream( baos, ENCODE | options );
-
- // GZip?
- if( gzip == GZIP )
- {
- gzos = new java.util.zip.GZIPOutputStream( b64os );
- oos = new java.io.ObjectOutputStream( gzos );
- } // end if: gzip
- else
- oos = new java.io.ObjectOutputStream( b64os );
-
- oos.writeObject( serializableObject );
- } // end try
- catch( java.io.IOException e )
- {
- e.printStackTrace();
- return null;
- } // end catch
- finally
- {
- try{ oos.close(); } catch( Exception e ){}
- try{ gzos.close(); } catch( Exception e ){}
- try{ b64os.close(); } catch( Exception e ){}
- try{ baos.close(); } catch( Exception e ){}
- } // end finally
-
- // Return value according to relevant encoding.
- try
- {
- return new String( baos.toByteArray(), PREFERRED_ENCODING );
- } // end try
- catch (java.io.UnsupportedEncodingException uue)
- {
- return new String( baos.toByteArray() );
- } // end catch
-
- } // end encode
-
-
-
- /**
- * Encodes a byte array into Base64 notation.
- * Does not GZip-compress data.
- *
- * @param source The data to convert
- * @since 1.4
- */
- public static String encodeBytes( byte[] source )
- {
- return encodeBytes( source, 0, source.length, NO_OPTIONS );
- } // end encodeBytes
-
-
-
- /**
- * Encodes a byte array into Base64 notation.
- * <p>
- * Valid options:<pre>
- * GZIP: gzip-compresses object before encoding it.
- * DONT_BREAK_LINES: don't break lines at 76 characters
- * <i>Note: Technically, this makes your encoding non-compliant.</i>
- * </pre>
- * <p>
- * Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
- * <p>
- * Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
- *
- *
- * @param source The data to convert
- * @param options Specified options
- * @see Base64#GZIP
- * @see Base64#DONT_BREAK_LINES
- * @since 2.0
- */
- public static String encodeBytes( byte[] source, int options )
- {
- return encodeBytes( source, 0, source.length, options );
- } // end encodeBytes
-
-
- /**
- * Encodes a byte array into Base64 notation.
- * Does not GZip-compress data.
- *
- * @param source The data to convert
- * @param off Offset in array where conversion should begin
- * @param len Length of data to convert
- * @since 1.4
- */
- public static String encodeBytes( byte[] source, int off, int len )
- {
- return encodeBytes( source, off, len, NO_OPTIONS );
- } // end encodeBytes
-
-
-
- /**
- * Encodes a byte array into Base64 notation.
- * <p>
- * Valid options:<pre>
- * GZIP: gzip-compresses object before encoding it.
- * DONT_BREAK_LINES: don't break lines at 76 characters
- * <i>Note: Technically, this makes your encoding non-compliant.</i>
- * </pre>
- * <p>
- * Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
- * <p>
- * Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
- *
- *
- * @param source The data to convert
- * @param off Offset in array where conversion should begin
- * @param len Length of data to convert
- * @param options Specified options
- * @param options alphabet type is pulled from this (standard, url-safe, ordered)
- * @see Base64#GZIP
- * @see Base64#DONT_BREAK_LINES
- * @since 2.0
- */
- public static String encodeBytes( byte[] source, int off, int len, int options )
- {
- // Isolate options
- int dontBreakLines = ( options & DONT_BREAK_LINES );
- int gzip = ( options & GZIP );
-
- // Compress?
- if( gzip == GZIP )
- {
- java.io.ByteArrayOutputStream baos = null;
- java.util.zip.GZIPOutputStream gzos = null;
- Base64.OutputStream b64os = null;
-
-
- try
- {
- // GZip -> Base64 -> ByteArray
- baos = new java.io.ByteArrayOutputStream();
- b64os = new Base64.OutputStream( baos, ENCODE | options );
- gzos = new java.util.zip.GZIPOutputStream( b64os );
-
- gzos.write( source, off, len );
- gzos.close();
- } // end try
- catch( java.io.IOException e )
- {
- e.printStackTrace();
- return null;
- } // end catch
- finally
- {
- try{ gzos.close(); } catch( Exception e ){}
- try{ b64os.close(); } catch( Exception e ){}
- try{ baos.close(); } catch( Exception e ){}
- } // end finally
-
- // Return value according to relevant encoding.
- try
- {
- return new String( baos.toByteArray(), PREFERRED_ENCODING );
- } // end try
- catch (java.io.UnsupportedEncodingException uue)
- {
- return new String( baos.toByteArray() );
- } // end catch
- } // end if: compress
-
- // Else, don't compress. Better not to use streams at all then.
- else
- {
- // Convert option to boolean in way that code likes it.
- boolean breakLines = dontBreakLines == 0;
-
- int len43 = len * 4 / 3;
- byte[] outBuff = new byte[ ( len43 ) // Main 4:3
- + ( (len % 3) > 0 ? 4 : 0 ) // Account for padding
- + (breakLines ? ( len43 / MAX_LINE_LENGTH ) : 0) ]; // New lines
- int d = 0;
- int e = 0;
- int len2 = len - 2;
- int lineLength = 0;
- for( ; d < len2; d+=3, e+=4 )
- {
- encode3to4( source, d+off, 3, outBuff, e, options );
-
- lineLength += 4;
- if( breakLines && lineLength == MAX_LINE_LENGTH )
- {
- outBuff[e+4] = NEW_LINE;
- e++;
- lineLength = 0;
- } // end if: end of line
- } // en dfor: each piece of array
-
- if( d < len )
- {
- encode3to4( source, d+off, len - d, outBuff, e, options );
- e += 4;
- } // end if: some padding needed
-
-
- // Return value according to relevant encoding.
- try
- {
- return new String( outBuff, 0, e, PREFERRED_ENCODING );
- } // end try
- catch (java.io.UnsupportedEncodingException uue)
- {
- return new String( outBuff, 0, e );
- } // end catch
-
- } // end else: don't compress
-
- } // end encodeBytes
-
-
-
-
-
-/* ******** D E C O D I N G M E T H O D S ******** */
-
-
- /**
- * Decodes four bytes from array <var>source</var>
- * and writes the resulting bytes (up to three of them)
- * to <var>destination</var>.
- * The source and destination arrays can be manipulated
- * anywhere along their length by specifying
- * <var>srcOffset</var> and <var>destOffset</var>.
- * This method does not check to make sure your arrays
- * are large enough to accomodate <var>srcOffset</var> + 4 for
- * the <var>source</var> array or <var>destOffset</var> + 3 for
- * the <var>destination</var> array.
- * This method returns the actual number of bytes that
- * were converted from the Base64 encoding.
- * <p>This is the lowest level of the decoding methods with
- * all possible parameters.</p>
- *
- *
- * @param source the array to convert
- * @param srcOffset the index where conversion begins
- * @param destination the array to hold the conversion
- * @param destOffset the index where output will be put
- * @param options alphabet type is pulled from this (standard, url-safe, ordered)
- * @return the number of decoded bytes converted
- * @since 1.3
- */
- private static int decode4to3( byte[] source, int srcOffset, byte[] destination, int destOffset, int options )
- {
- byte[] DECODABET = getDecodabet( options );
-
- // Example: Dk==
- if( source[ srcOffset + 2] == EQUALS_SIGN )
- {
- // Two ways to do the same thing. Don't know which way I like best.
- //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
- // | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 );
- int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
- | ( ( DECODABET[ source[ srcOffset + 1] ] & 0xFF ) << 12 );
-
- destination[ destOffset ] = (byte)( outBuff >>> 16 );
- return 1;
- }
-
- // Example: DkL=
- else if( source[ srcOffset + 3 ] == EQUALS_SIGN )
- {
- // Two ways to do the same thing. Don't know which way I like best.
- //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
- // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
- // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 );
- int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
- | ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
- | ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6 );
-
- destination[ destOffset ] = (byte)( outBuff >>> 16 );
- destination[ destOffset + 1 ] = (byte)( outBuff >>> 8 );
- return 2;
- }
-
- // Example: DkLE
- else
- {
- try{
- // Two ways to do the same thing. Don't know which way I like best.
- //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
- // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
- // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 )
- // | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 );
- int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
- | ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
- | ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6)
- | ( ( DECODABET[ source[ srcOffset + 3 ] ] & 0xFF ) );
-
-
- destination[ destOffset ] = (byte)( outBuff >> 16 );
- destination[ destOffset + 1 ] = (byte)( outBuff >> 8 );
- destination[ destOffset + 2 ] = (byte)( outBuff );
-
- return 3;
- }catch( Exception e){
- System.out.println(""+source[srcOffset]+ ": " + ( DECODABET[ source[ srcOffset ] ] ) );
- System.out.println(""+source[srcOffset+1]+ ": " + ( DECODABET[ source[ srcOffset + 1 ] ] ) );
- System.out.println(""+source[srcOffset+2]+ ": " + ( DECODABET[ source[ srcOffset + 2 ] ] ) );
- System.out.println(""+source[srcOffset+3]+ ": " + ( DECODABET[ source[ srcOffset + 3 ] ] ) );
- return -1;
- } // end catch
- }
- } // end decodeToBytes
-
-
-
-
- /**
- * Very low-level access to decoding ASCII characters in
- * the form of a byte array. Does not support automatically
- * gunzipping or any other "fancy" features.
- *
- * @param source The Base64 encoded data
- * @param off The offset of where to begin decoding
- * @param len The length of characters to decode
- * @return decoded data
- * @since 1.3
- */
- public static byte[] decode( byte[] source, int off, int len, int options )
- {
- byte[] DECODABET = getDecodabet( options );
-
- int len34 = len * 3 / 4;
- byte[] outBuff = new byte[ len34 ]; // Upper limit on size of output
- int outBuffPosn = 0;
-
- byte[] b4 = new byte[4];
- int b4Posn = 0;
- int i = 0;
- byte sbiCrop = 0;
- byte sbiDecode = 0;
- for( i = off; i < off+len; i++ )
- {
- sbiCrop = (byte)(source[i] & 0x7f); // Only the low seven bits
- sbiDecode = DECODABET[ sbiCrop ];
-
- if( sbiDecode >= WHITE_SPACE_ENC ) // White space, Equals sign or better
- {
- if( sbiDecode >= EQUALS_SIGN_ENC )
- {
- b4[ b4Posn++ ] = sbiCrop;
- if( b4Posn > 3 )
- {
- outBuffPosn += decode4to3( b4, 0, outBuff, outBuffPosn, options );
- b4Posn = 0;
-
- // If that was the equals sign, break out of 'for' loop
- if( sbiCrop == EQUALS_SIGN )
- break;
- } // end if: quartet built
-
- } // end if: equals sign or better
-
- } // end if: white space, equals sign or better
- else
- {
- System.err.println( "Bad Base64 input character at " + i + ": " + source[i] + "(decimal)" );
- return null;
- } // end else:
- } // each input character
-
- byte[] out = new byte[ outBuffPosn ];
- System.arraycopy( outBuff, 0, out, 0, outBuffPosn );
- return out;
- } // end decode
-
-
-
-
- /**
- * Decodes data from Base64 notation, automatically
- * detecting gzip-compressed data and decompressing it.
- *
- * @param s the string to decode
- * @return the decoded data
- * @since 1.4
- */
- public static byte[] decode( String s )
- {
- return decode( s, NO_OPTIONS );
- }
-
-
- /**
- * Decodes data from Base64 notation, automatically
- * detecting gzip-compressed data and decompressing it.
- *
- * @param s the string to decode
- * @param options encode options such as URL_SAFE
- * @return the decoded data
- * @since 1.4
- */
- public static byte[] decode( String s, int options )
- {
- byte[] bytes;
- try
- {
- bytes = s.getBytes( PREFERRED_ENCODING );
- } // end try
- catch( java.io.UnsupportedEncodingException uee )
- {
- bytes = s.getBytes();
- } // end catch
- //</change>
-
- // Decode
- bytes = decode( bytes, 0, bytes.length, options );
-
-
- // Check to see if it's gzip-compressed
- // GZIP Magic Two-Byte Number: 0x8b1f (35615)
- if( bytes != null && bytes.length >= 4 )
- {
-
- int head = ((int)bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
- if( java.util.zip.GZIPInputStream.GZIP_MAGIC == head )
- {
- java.io.ByteArrayInputStream bais = null;
- java.util.zip.GZIPInputStream gzis = null;
- java.io.ByteArrayOutputStream baos = null;
- byte[] buffer = new byte[2048];
- int length = 0;
-
- try
- {
- baos = new java.io.ByteArrayOutputStream();
- bais = new java.io.ByteArrayInputStream( bytes );
- gzis = new java.util.zip.GZIPInputStream( bais );
-
- while( ( length = gzis.read( buffer ) ) >= 0 )
- {
- baos.write(buffer,0,length);
- } // end while: reading input
-
- // No error? Get new bytes.
- bytes = baos.toByteArray();
-
- } // end try
- catch( java.io.IOException e )
- {
- // Just return originally-decoded bytes
- } // end catch
- finally
- {
- try{ baos.close(); } catch( Exception e ){}
- try{ gzis.close(); } catch( Exception e ){}
- try{ bais.close(); } catch( Exception e ){}
- } // end finally
-
- } // end if: gzipped
- } // end if: bytes.length >= 2
-
- return bytes;
- } // end decode
-
-
-
-
- /**
- * Attempts to decode Base64 data and deserialize a Java
- * Object within. Returns <tt>null</tt> if there was an error.
- *
- * @param encodedObject The Base64 data to decode
- * @return The decoded and deserialized object
- * @since 1.5
- */
- public static Object decodeToObject( String encodedObject )
- {
- // Decode and gunzip if necessary
- byte[] objBytes = decode( encodedObject );
-
- java.io.ByteArrayInputStream bais = null;
- java.io.ObjectInputStream ois = null;
- Object obj = null;
-
- try
- {
- bais = new java.io.ByteArrayInputStream( objBytes );
- ois = new java.io.ObjectInputStream( bais );
-
- obj = ois.readObject();
- } // end try
- catch( java.io.IOException e )
- {
- e.printStackTrace();
- obj = null;
- } // end catch
- catch( java.lang.ClassNotFoundException e )
- {
- e.printStackTrace();
- obj = null;
- } // end catch
- finally
- {
- try{ bais.close(); } catch( Exception e ){}
- try{ ois.close(); } catch( Exception e ){}
- } // end finally
-
- return obj;
- } // end decodeObject
-
-
-
- /**
- * Convenience method for encoding data to a file.
- *
- * @param dataToEncode byte array of data to encode in base64 form
- * @param filename Filename for saving encoded data
- * @return <tt>true</tt> if successful, <tt>false</tt> otherwise
- *
- * @since 2.1
- */
- public static boolean encodeToFile( byte[] dataToEncode, String filename )
- {
- boolean success = false;
- Base64.OutputStream bos = null;
- try
- {
- bos = new Base64.OutputStream(
- new java.io.FileOutputStream( filename ), Base64.ENCODE );
- bos.write( dataToEncode );
- success = true;
- } // end try
- catch( java.io.IOException e )
- {
-
- success = false;
- } // end catch: IOException
- finally
- {
- try{ bos.close(); } catch( Exception e ){}
- } // end finally
-
- return success;
- } // end encodeToFile
-
-
- /**
- * Convenience method for decoding data to a file.
- *
- * @param dataToDecode Base64-encoded data as a string
- * @param filename Filename for saving decoded data
- * @return <tt>true</tt> if successful, <tt>false</tt> otherwise
- *
- * @since 2.1
- */
- public static boolean decodeToFile( String dataToDecode, String filename )
- {
- boolean success = false;
- Base64.OutputStream bos = null;
- try
- {
- bos = new Base64.OutputStream(
- new java.io.FileOutputStream( filename ), Base64.DECODE );
- bos.write( dataToDecode.getBytes( PREFERRED_ENCODING ) );
- success = true;
- } // end try
- catch( java.io.IOException e )
- {
- success = false;
- } // end catch: IOException
- finally
- {
- try{ bos.close(); } catch( Exception e ){}
- } // end finally
-
- return success;
- } // end decodeToFile
-
-
-
-
- /**
- * Convenience method for reading a base64-encoded
- * file and decoding it.
- *
- * @param filename Filename for reading encoded data
- * @return decoded byte array or null if unsuccessful
- *
- * @since 2.1
- */
- public static byte[] decodeFromFile( String filename )
- {
- byte[] decodedData = null;
- Base64.InputStream bis = null;
- try
- {
- // Set up some useful variables
- java.io.File file = new java.io.File( filename );
- byte[] buffer = null;
- int length = 0;
- int numBytes = 0;
-
- // Check for size of file
- if( file.length() > Integer.MAX_VALUE )
- {
- System.err.println( "File is too big for this convenience method (" + file.length() + " bytes)." );
- return null;
- } // end if: file too big for int index
- buffer = new byte[ (int)file.length() ];
-
- // Open a stream
- bis = new Base64.InputStream(
- new java.io.BufferedInputStream(
- new java.io.FileInputStream( file ) ), Base64.DECODE );
-
- // Read until done
- while( ( numBytes = bis.read( buffer, length, 4096 ) ) >= 0 )
- length += numBytes;
-
- // Save in a variable to return
- decodedData = new byte[ length ];
- System.arraycopy( buffer, 0, decodedData, 0, length );
-
- } // end try
- catch( java.io.IOException e )
- {
- System.err.println( "Error decoding from file " + filename );
- } // end catch: IOException
- finally
- {
- try{ bis.close(); } catch( Exception e) {}
- } // end finally
-
- return decodedData;
- } // end decodeFromFile
-
-
-
- /**
- * Convenience method for reading a binary file
- * and base64-encoding it.
- *
- * @param filename Filename for reading binary data
- * @return base64-encoded string or null if unsuccessful
- *
- * @since 2.1
- */
- public static String encodeFromFile( String filename )
- {
- String encodedData = null;
- Base64.InputStream bis = null;
- try
- {
- // Set up some useful variables
- java.io.File file = new java.io.File( filename );
- byte[] buffer = new byte[ Math.max((int)(file.length() * 1.4),40) ]; // Need max() for math on small files (v2.2.1)
- int length = 0;
- int numBytes = 0;
-
- // Open a stream
- bis = new Base64.InputStream(
- new java.io.BufferedInputStream(
- new java.io.FileInputStream( file ) ), Base64.ENCODE );
-
- // Read until done
- while( ( numBytes = bis.read( buffer, length, 4096 ) ) >= 0 )
- length += numBytes;
-
- // Save in a variable to return
- encodedData = new String( buffer, 0, length, Base64.PREFERRED_ENCODING );
-
- } // end try
- catch( java.io.IOException e )
- {
- System.err.println( "Error encoding from file " + filename );
- } // end catch: IOException
- finally
- {
- try{ bis.close(); } catch( Exception e) {}
- } // end finally
-
- return encodedData;
- } // end encodeFromFile
-
-
-
-
- /**
- * Reads <tt>infile</tt> and encodes it to <tt>outfile</tt>.
- *
- * @param infile Input file
- * @param outfile Output file
- * @return true if the operation is successful
- * @since 2.2
- */
- public static boolean encodeFileToFile( String infile, String outfile )
- {
- boolean success = false;
- java.io.InputStream in = null;
- java.io.OutputStream out = null;
- try{
- in = new Base64.InputStream(
- new java.io.BufferedInputStream(
- new java.io.FileInputStream( infile ) ),
- Base64.ENCODE );
- out = new java.io.BufferedOutputStream( new java.io.FileOutputStream( outfile ) );
- byte[] buffer = new byte[65536]; // 64K
- int read = -1;
- while( ( read = in.read(buffer) ) >= 0 ){
- out.write( buffer,0,read );
- } // end while: through file
- success = true;
- } catch( java.io.IOException exc ){
- exc.printStackTrace();
- } finally{
- try{ in.close(); } catch( Exception exc ){}
- try{ out.close(); } catch( Exception exc ){}
- } // end finally
-
- return success;
- } // end encodeFileToFile
-
-
-
- /**
- * Reads <tt>infile</tt> and decodes it to <tt>outfile</tt>.
- *
- * @param infile Input file
- * @param outfile Output file
- * @return true if the operation is successful
- * @since 2.2
- */
- public static boolean decodeFileToFile( String infile, String outfile )
- {
- boolean success = false;
- java.io.InputStream in = null;
- java.io.OutputStream out = null;
- try{
- in = new Base64.InputStream(
- new java.io.BufferedInputStream(
- new java.io.FileInputStream( infile ) ),
- Base64.DECODE );
- out = new java.io.BufferedOutputStream( new java.io.FileOutputStream( outfile ) );
- byte[] buffer = new byte[65536]; // 64K
- int read = -1;
- while( ( read = in.read(buffer) ) >= 0 ){
- out.write( buffer,0,read );
- } // end while: through file
- success = true;
- } catch( java.io.IOException exc ){
- exc.printStackTrace();
- } finally{
- try{ in.close(); } catch( Exception exc ){}
- try{ out.close(); } catch( Exception exc ){}
- } // end finally
-
- return success;
- } // end decodeFileToFile
-
-
- /* ******** I N N E R C L A S S I N P U T S T R E A M ******** */
-
-
-
- /**
- * A {@link Base64.InputStream} will read data from another
- * <tt>java.io.InputStream</tt>, given in the constructor,
- * and encode/decode to/from Base64 notation on the fly.
- *
- * @see Base64
- * @since 1.3
- */
- public static class InputStream extends java.io.FilterInputStream
- {
- private boolean encode; // Encoding or decoding
- private int position; // Current position in the buffer
- private byte[] buffer; // Small buffer holding converted data
- private int bufferLength; // Length of buffer (3 or 4)
- private int numSigBytes; // Number of meaningful bytes in the buffer
- private int lineLength;
- private boolean breakLines; // Break lines at less than 80 characters
- private int options; // Record options used to create the stream.
- private byte[] alphabet; // Local copies to avoid extra method calls
- private byte[] decodabet; // Local copies to avoid extra method calls
-
-
- /**
- * Constructs a {@link Base64.InputStream} in DECODE mode.
- *
- * @param in the <tt>java.io.InputStream</tt> from which to read data.
- * @since 1.3
- */
- public InputStream( java.io.InputStream in )
- {
- this( in, DECODE );
- } // end constructor
-
-
- /**
- * Constructs a {@link Base64.InputStream} in
- * either ENCODE or DECODE mode.
- * <p>
- * Valid options:<pre>
- * ENCODE or DECODE: Encode or Decode as data is read.
- * DONT_BREAK_LINES: don't break lines at 76 characters
- * (only meaningful when encoding)
- * <i>Note: Technically, this makes your encoding non-compliant.</i>
- * </pre>
- * <p>
- * Example: <code>new Base64.InputStream( in, Base64.DECODE )</code>
- *
- *
- * @param in the <tt>java.io.InputStream</tt> from which to read data.
- * @param options Specified options
- * @see Base64#ENCODE
- * @see Base64#DECODE
- * @see Base64#DONT_BREAK_LINES
- * @since 2.0
- */
- public InputStream( java.io.InputStream in, int options )
- {
- super( in );
- this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES;
- this.encode = (options & ENCODE) == ENCODE;
- this.bufferLength = encode ? 4 : 3;
- this.buffer = new byte[ bufferLength ];
- this.position = -1;
- this.lineLength = 0;
- this.options = options; // Record for later, mostly to determine which alphabet to use
- this.alphabet = getAlphabet(options);
- this.decodabet = getDecodabet(options);
- } // end constructor
-
- /**
- * Reads enough of the input stream to convert
- * to/from Base64 and returns the next byte.
- *
- * @return next byte
- * @since 1.3
- */
- public int read() throws java.io.IOException
- {
- // Do we need to get data?
- if( position < 0 )
- {
- if( encode )
- {
- byte[] b3 = new byte[3];
- int numBinaryBytes = 0;
- for( int i = 0; i < 3; i++ )
- {
- try
- {
- int b = in.read();
-
- // If end of stream, b is -1.
- if( b >= 0 )
- {
- b3[i] = (byte)b;
- numBinaryBytes++;
- } // end if: not end of stream
-
- } // end try: read
- catch( java.io.IOException e )
- {
- // Only a problem if we got no data at all.
- if( i == 0 )
- throw e;
-
- } // end catch
- } // end for: each needed input byte
-
- if( numBinaryBytes > 0 )
- {
- encode3to4( b3, 0, numBinaryBytes, buffer, 0, options );
- position = 0;
- numSigBytes = 4;
- } // end if: got data
- else
- {
- return -1;
- } // end else
- } // end if: encoding
-
- // Else decoding
- else
- {
- byte[] b4 = new byte[4];
- int i = 0;
- for( i = 0; i < 4; i++ )
- {
- // Read four "meaningful" bytes:
- int b = 0;
- do{ b = in.read(); }
- while( b >= 0 && decodabet[ b & 0x7f ] <= WHITE_SPACE_ENC );
-
- if( b < 0 )
- break; // Reads a -1 if end of stream
-
- b4[i] = (byte)b;
- } // end for: each needed input byte
-
- if( i == 4 )
- {
- numSigBytes = decode4to3( b4, 0, buffer, 0, options );
- position = 0;
- } // end if: got four characters
- else if( i == 0 ){
- return -1;
- } // end else if: also padded correctly
- else
- {
- // Must have broken out from above.
- throw new java.io.IOException( "Improperly padded Base64 input." );
- } // end
-
- } // end else: decode
- } // end else: get data
-
- // Got data?
- if( position >= 0 )
- {
- // End of relevant data?
- if( /*!encode &&*/ position >= numSigBytes )
- return -1;
-
- if( encode && breakLines && lineLength >= MAX_LINE_LENGTH )
- {
- lineLength = 0;
- return '\n';
- } // end if
- else
- {
- lineLength++; // This isn't important when decoding
- // but throwing an extra "if" seems
- // just as wasteful.
-
- int b = buffer[ position++ ];
-
- if( position >= bufferLength )
- position = -1;
-
- return b & 0xFF; // This is how you "cast" a byte that's
- // intended to be unsigned.
- } // end else
- } // end if: position >= 0
-
- // Else error
- else
- {
- // When JDK1.4 is more accepted, use an assertion here.
- throw new java.io.IOException( "Error in Base64 code reading stream." );
- } // end else
- } // end read
-
-
- /**
- * Calls {@link #read()} repeatedly until the end of stream
- * is reached or <var>len</var> bytes are read.
- * Returns number of bytes read into array or -1 if
- * end of stream is encountered.
- *
- * @param dest array to hold values
- * @param off offset for array
- * @param len max number of bytes to read into array
- * @return bytes read into array or -1 if end of stream is encountered.
- * @since 1.3
- */
- public int read( byte[] dest, int off, int len ) throws java.io.IOException
- {
- int i;
- int b;
- for( i = 0; i < len; i++ )
- {
- b = read();
-
- //if( b < 0 && i == 0 )
- // return -1;
-
- if( b >= 0 )
- dest[off + i] = (byte)b;
- else if( i == 0 )
- return -1;
- else
- break; // Out of 'for' loop
- } // end for: each byte read
- return i;
- } // end read
-
- } // end inner class InputStream
-
-
-
-
-
-
- /* ******** I N N E R C L A S S O U T P U T S T R E A M ******** */
-
-
-
- /**
- * A {@link Base64.OutputStream} will write data to another
- * <tt>java.io.OutputStream</tt>, given in the constructor,
- * and encode/decode to/from Base64 notation on the fly.
- *
- * @see Base64
- * @since 1.3
- */
- public static class OutputStream extends java.io.FilterOutputStream
- {
- private boolean encode;
- private int position;
- private byte[] buffer;
- private int bufferLength;
- private int lineLength;
- private boolean breakLines;
- private byte[] b4; // Scratch used in a few places
- private boolean suspendEncoding;
- private int options; // Record for later
- private byte[] alphabet; // Local copies to avoid extra method calls
- private byte[] decodabet; // Local copies to avoid extra method calls
-
- /**
- * Constructs a {@link Base64.OutputStream} in ENCODE mode.
- *
- * @param out the <tt>java.io.OutputStream</tt> to which data will be written.
- * @since 1.3
- */
- public OutputStream( java.io.OutputStream out )
- {
- this( out, ENCODE );
- } // end constructor
-
-
- /**
- * Constructs a {@link Base64.OutputStream} in
- * either ENCODE or DECODE mode.
- * <p>
- * Valid options:<pre>
- * ENCODE or DECODE: Encode or Decode as data is read.
- * DONT_BREAK_LINES: don't break lines at 76 characters
- * (only meaningful when encoding)
- * <i>Note: Technically, this makes your encoding non-compliant.</i>
- * </pre>
- * <p>
- * Example: <code>new Base64.OutputStream( out, Base64.ENCODE )</code>
- *
- * @param out the <tt>java.io.OutputStream</tt> to which data will be written.
- * @param options Specified options.
- * @see Base64#ENCODE
- * @see Base64#DECODE
- * @see Base64#DONT_BREAK_LINES
- * @since 1.3
- */
- public OutputStream( java.io.OutputStream out, int options )
- {
- super( out );
- this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES;
- this.encode = (options & ENCODE) == ENCODE;
- this.bufferLength = encode ? 3 : 4;
- this.buffer = new byte[ bufferLength ];
- this.position = 0;
- this.lineLength = 0;
- this.suspendEncoding = false;
- this.b4 = new byte[4];
- this.options = options;
- this.alphabet = getAlphabet(options);
- this.decodabet = getDecodabet(options);
- } // end constructor
-
-
- /**
- * Writes the byte to the output stream after
- * converting to/from Base64 notation.
- * When encoding, bytes are buffered three
- * at a time before the output stream actually
- * gets a write() call.
- * When decoding, bytes are buffered four
- * at a time.
- *
- * @param theByte the byte to write
- * @since 1.3
- */
- public void write(int theByte) throws java.io.IOException
- {
- // Encoding suspended?
- if( suspendEncoding )
- {
- super.out.write( theByte );
- return;
- } // end if: supsended
-
- // Encode?
- if( encode )
- {
- buffer[ position++ ] = (byte)theByte;
- if( position >= bufferLength ) // Enough to encode.
- {
- out.write( encode3to4( b4, buffer, bufferLength, options ) );
-
- lineLength += 4;
- if( breakLines && lineLength >= MAX_LINE_LENGTH )
- {
- out.write( NEW_LINE );
- lineLength = 0;
- } // end if: end of line
-
- position = 0;
- } // end if: enough to output
- } // end if: encoding
-
- // Else, Decoding
- else
- {
- // Meaningful Base64 character?
- if( decodabet[ theByte & 0x7f ] > WHITE_SPACE_ENC )
- {
- buffer[ position++ ] = (byte)theByte;
- if( position >= bufferLength ) // Enough to output.
- {
- int len = Base64.decode4to3( buffer, 0, b4, 0, options );
- out.write( b4, 0, len );
- //out.write( Base64.decode4to3( buffer ) );
- position = 0;
- } // end if: enough to output
- } // end if: meaningful base64 character
- else if( decodabet[ theByte & 0x7f ] != WHITE_SPACE_ENC )
- {
- throw new java.io.IOException( "Invalid character in Base64 data." );
- } // end else: not white space either
- } // end else: decoding
- } // end write
-
-
-
- /**
- * Calls {@link #write(int)} repeatedly until <var>len</var>
- * bytes are written.
- *
- * @param theBytes array from which to read bytes
- * @param off offset for array
- * @param len max number of bytes to read into array
- * @since 1.3
- */
- public void write( byte[] theBytes, int off, int len ) throws java.io.IOException
- {
- // Encoding suspended?
- if( suspendEncoding )
- {
- super.out.write( theBytes, off, len );
- return;
- } // end if: supsended
-
- for( int i = 0; i < len; i++ )
- {
- write( theBytes[ off + i ] );
- } // end for: each byte written
-
- } // end write
-
-
-
- /**
- * Method added by PHIL. [Thanks, PHIL. -Rob]
- * This pads the buffer without closing the stream.
- */
- public void flushBase64() throws java.io.IOException
- {
- if( position > 0 )
- {
- if( encode )
- {
- out.write( encode3to4( b4, buffer, position, options ) );
- position = 0;
- } // end if: encoding
- else
- {
- throw new java.io.IOException( "Base64 input not properly padded." );
- } // end else: decoding
- } // end if: buffer partially full
-
- } // end flush
-
-
- /**
- * Flushes and closes (I think, in the superclass) the stream.
- *
- * @since 1.3
- */
- public void close() throws java.io.IOException
- {
- // 1. Ensure that pending characters are written
- flushBase64();
-
- // 2. Actually close the stream
- // Base class both flushes and closes.
- super.close();
-
- buffer = null;
- out = null;
- } // end close
-
-
-
- /**
- * Suspends encoding of the stream.
- * May be helpful if you need to embed a piece of
- * base640-encoded data in a stream.
- *
- * @since 1.5.1
- */
- public void suspendEncoding() throws java.io.IOException
- {
- flushBase64();
- this.suspendEncoding = true;
- } // end suspendEncoding
-
-
- /**
- * Resumes encoding of the stream.
- * May be helpful if you need to embed a piece of
- * base640-encoded data in a stream.
- *
- * @since 1.5.1
- */
- public void resumeEncoding()
- {
- this.suspendEncoding = false;
- } // end resumeEncoding
-
-
-
- } // end inner class OutputStream
-
-
-} // end class Base64
Deleted: trunk/src/main/org/jboss/messaging/util/ConcurrentHashSet.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/ConcurrentHashSet.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/ConcurrentHashSet.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-import java.util.AbstractSet;
-import java.util.Iterator;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- *
- * A ConcurrentHashSet.
- *
- * Offers same concurrency as ConcurrentHashMap but for a Set
- *
- * @author <a href="tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 1935 $</tt>
- *
- * $Id: ConcurrentReaderHashSet.java 1935 2007-01-09 23:29:20Z clebert.suconic at jboss.com $
- */
-public class ConcurrentHashSet<E> extends AbstractSet<E> implements ConcurrentSet<E>
-{
- private ConcurrentMap<E, Object> theMap;
-
- private static final Object dummy = new Object();
-
- public ConcurrentHashSet()
- {
- theMap = new ConcurrentHashMap<E, Object>();
- }
-
- public int size()
- {
- return theMap.size();
- }
-
- public Iterator<E> iterator()
- {
- return theMap.keySet().iterator();
- }
-
- public boolean isEmpty()
- {
- return theMap.isEmpty();
- }
-
- public boolean add(E o)
- {
- return theMap.put(o, dummy) == null;
- }
-
- public boolean contains(Object o)
- {
- return theMap.containsKey(o);
- }
-
- public void clear()
- {
- theMap.clear();
- }
-
- public boolean remove(Object o)
- {
- return theMap.remove(o) == dummy;
- }
-
- public boolean addIfAbsent(E o)
- {
- Object obj = theMap.putIfAbsent(o, dummy);
-
- return obj == null;
- }
-
-}
Deleted: trunk/src/main/org/jboss/messaging/util/ConcurrentSet.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/ConcurrentSet.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/ConcurrentSet.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-import java.util.Set;
-
-/**
- *
- * A ConcurrentSet
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- * @param <E>
- */
-public interface ConcurrentSet<E> extends Set<E>
-{
- boolean addIfAbsent(E o);
-}
Deleted: trunk/src/main/org/jboss/messaging/util/ConfigurationHelper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/ConfigurationHelper.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/ConfigurationHelper.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,152 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss 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.messaging.util;
-
-import java.util.Map;
-
-import org.jboss.messaging.core.logging.Logger;
-
-/**
- * A ConfigurationHelper
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public class ConfigurationHelper
-{
- public static final Logger log = Logger.getLogger(ConfigurationHelper.class);
-
- public static String getStringProperty(final String propName, final String def,
- final Map<String, Object> props)
- {
- if (props == null)
- {
- return def;
- }
-
- Object prop = props.get(propName);
-
- if (prop == null)
- {
- return def;
- }
- else
- {
- if (prop instanceof String == false)
- {
- log.warn("Property " + propName + " must be a String");
-
- return def;
- }
- else
- {
- return (String)prop;
- }
- }
- }
-
- public static int getIntProperty(final String propName, final int def,
- final Map<String, Object> props)
- {
- if (props == null)
- {
- return def;
- }
- Object prop = props.get(propName);
-
- if (prop == null)
- {
- return def;
- }
- else
- {
- if (prop instanceof Integer == false)
- {
- log.warn("Property " + propName + " must be an Integer");
-
- return def;
- }
- else
- {
- return (Integer)prop;
- }
- }
- }
-
- public static long getLongProperty(final String propName, final long def,
- final Map<String, Object> props)
- {
- if (props == null)
- {
- return def;
- }
-
- Object prop = props.get(propName);
-
- if (prop == null)
- {
- return def;
- }
- else
- {
- if (prop instanceof Long == false)
- {
- log.warn("Property " + propName + " must be an Long");
-
- return def;
- }
- else
- {
- return (Long)prop;
- }
- }
- }
-
- public static boolean getBooleanProperty(final String propName, final boolean def,
- final Map<String, Object> props)
- {
- if (props == null)
- {
- return def;
- }
-
- Object prop = props.get(propName);
-
- if (prop == null)
- {
- return def;
- }
- else
- {
- if (prop instanceof Boolean == false)
- {
- log.warn("Property " + propName + " must be a Boolean");
-
- return def;
- }
- else
- {
- return (Boolean)prop;
- }
- }
- }
-}
Deleted: trunk/src/main/org/jboss/messaging/util/DataConstants.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/DataConstants.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/DataConstants.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,59 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-/**
- *
- * A DataConstants
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public class DataConstants
-{
- public static final int SIZE_INT = 4;
- public static final int SIZE_BOOLEAN = 1;
- public static final int SIZE_LONG = 8;
- public static final int SIZE_BYTE = 1;
- public static final int SIZE_SHORT = 2;
- public static final int SIZE_DOUBLE = 8;
- public static final int SIZE_FLOAT = 4;
- public static final int SIZE_CHAR = 2;
-
- public static final byte TRUE = 1;
- public static final byte FALSE = 0;
-
- public static final byte NULL = 0;
- public static final byte NOT_NULL = 1;
-
- public static final byte BOOLEAN = 2;
- public static final byte BYTE = 3;
- public static final byte BYTES = 4;
- public static final byte SHORT = 5;
- public static final byte INT = 6;
- public static final byte LONG = 7;
- public static final byte FLOAT = 8;
- public static final byte DOUBLE = 9;
- public static final byte STRING = 10;
- public static final byte CHAR = 11;
-}
Deleted: trunk/src/main/org/jboss/messaging/util/ExecutorFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/ExecutorFactory.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/ExecutorFactory.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-import java.util.concurrent.Executor;
-
-/**
- *
- * A ExecutorFactory
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public interface ExecutorFactory
-{
- Executor getExecutor();
-}
Deleted: trunk/src/main/org/jboss/messaging/util/Future.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/Future.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/Future.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss 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.messaging.util;
-
-
-/**
- * A Future
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public class Future implements Runnable
-{
- private boolean done;
-
- public synchronized boolean await(final long timeout)
- {
- long toWait = timeout;
-
- long start = System.currentTimeMillis();
-
- while (!done && toWait > 0)
- {
- try
- {
- wait(toWait);
- }
- catch (InterruptedException e)
- {
- }
-
- long now = System.currentTimeMillis();
-
- toWait -= now - start;
-
- start = now;
- }
-
- return done;
- }
-
- public synchronized void run()
- {
- done = true;
-
- notify();
- }
-
-}
Deleted: trunk/src/main/org/jboss/messaging/util/IDGenerator.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/IDGenerator.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/IDGenerator.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-/**
- * A IDGenerator
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- * Created 25 Sep 2008 10:28:52
- *
- *
- */
-public interface IDGenerator
-{
- long generateID();
-
- long getCurrentID();
-}
Deleted: trunk/src/main/org/jboss/messaging/util/JBMThreadFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/JBMThreadFactory.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/JBMThreadFactory.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,64 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2005-2008, Red Hat
- * Middleware LLC, and individual contributors 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.messaging.util;
-
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- *
- * A JBMThreadFactory
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public class JBMThreadFactory implements ThreadFactory
-{
- private final ThreadGroup group;
-
- private final AtomicInteger threadCount = new AtomicInteger(0);
-
- private final int threadPriority;
- public JBMThreadFactory(final String groupName)
- {
- this(groupName, Thread.NORM_PRIORITY);
- }
-
- public JBMThreadFactory(String groupName, int priority)
- {
- group = new ThreadGroup(groupName + "-" + System.identityHashCode(this));
- threadPriority = priority;
- }
-
- public Thread newThread(final Runnable command)
- {
- Thread t = new Thread(group, command, "Thread-" + threadCount.getAndIncrement() +
- " (group:" +
- group.getName() +
- ")");
-
- // Don't want to prevent VM from exiting
- t.setDaemon(true);
- t.setPriority(threadPriority);
- return t;
- }
-}
Deleted: trunk/src/main/org/jboss/messaging/util/JNDIUtil.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/JNDIUtil.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/JNDIUtil.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,134 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-import java.util.StringTokenizer;
-
-import javax.naming.Binding;
-import javax.naming.Context;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-
-/**
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class JNDIUtil
-{
- // Constants -----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- /**
- * Create a context path recursively.
- */
- public static Context createContext(Context c, String path) throws NamingException
- {
- Context crtContext = c;
- for(StringTokenizer st = new StringTokenizer(path, "/"); st.hasMoreTokens(); )
- {
- String tok = st.nextToken();
-
- try
- {
- Object o = crtContext.lookup(tok);
- if (!(o instanceof Context))
- {
- throw new NamingException("Path " + path + " overwrites and already bound object");
- }
- crtContext = (Context)o;
- continue;
- }
- catch(NameNotFoundException e)
- {
- // OK
- }
- crtContext = crtContext.createSubcontext(tok);
- }
- return crtContext;
- }
-
- public static void tearDownRecursively(Context c) throws Exception
- {
- for(NamingEnumeration ne = c.listBindings(""); ne.hasMore(); )
- {
- Binding b = (Binding)ne.next();
- String name = b.getName();
- Object object = b.getObject();
- if (object instanceof Context)
- {
- tearDownRecursively((Context)object);
- }
- c.unbind(name);
- }
- }
-
- /**
- * Context.rebind() requires that all intermediate contexts and the target context (that named by
- * all but terminal atomic component of the name) must already exist, otherwise
- * NameNotFoundException is thrown. This method behaves similar to Context.rebind(), but creates
- * intermediate contexts, if necessary.
- */
- public static void rebind(Context c, String jndiName, Object o) throws NamingException
- {
- Context context = c;
- String name = jndiName;
-
- int idx = jndiName.lastIndexOf('/');
- if (idx != -1)
- {
- context = createContext(c, jndiName.substring(0, idx));
- name = jndiName.substring(idx + 1);
- }
- boolean failed=false;
- try
- {
- context.rebind(name,o);
- }
- catch (Exception ignored)
- {
- failed=true;
- }
- if (failed)
- {
- context.bind(name, o);
- }
- }
-
- // Attributes ----------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Deleted: trunk/src/main/org/jboss/messaging/util/ObjectInputStreamWithClassLoader.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/ObjectInputStreamWithClassLoader.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/ObjectInputStreamWithClassLoader.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectStreamClass;
-
-/**
- * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class ObjectInputStreamWithClassLoader extends ObjectInputStream
-{
-
- // Constants ------------------------------------------------------------------------------------
-
- // Attributes -----------------------------------------------------------------------------------
-
- // Static ---------------------------------------------------------------------------------------
-
- // Constructors ---------------------------------------------------------------------------------
-
- public ObjectInputStreamWithClassLoader(InputStream in)
- throws IOException
- {
- super(in);
- }
-
- // Public ---------------------------------------------------------------------------------------
-
- // Package protected ----------------------------------------------------------------------------
-
- // Protected ------------------------------------------------------------------------------------
-
- protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException
- {
- String name = desc.getName();
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- try
- {
- Class clazz = loader.loadClass(name);
- // sanity check only.. if a classLoader can't find a clazz, it will throw an exception
- if (clazz == null)
- {
- return super.resolveClass(desc);
- }
- else
- {
- return clazz;
- }
- }
- catch (ClassNotFoundException e)
- {
- return super.resolveClass(desc);
- }
- }
-
- // Private --------------------------------------------------------------------------------------
-
- // Inner classes --------------------------------------------------------------------------------
-
-}
Deleted: trunk/src/main/org/jboss/messaging/util/OrderedExecutorFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/OrderedExecutorFactory.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/OrderedExecutorFactory.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,136 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-import java.util.LinkedList;
-import java.util.concurrent.Executor;
-
-/**
- * A factory for producing executors that run all tasks in order, which delegate to a single common executor instance.
- *
- * @author <a href="david.lloyd at jboss.com">David Lloyd</a>
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
- *
- */
-public final class OrderedExecutorFactory implements ExecutorFactory
-{
- private final Executor parent;
-
- /**
- * Construct a new instance delegating to the given parent executor.
- *
- * @param parent the parent executor
- */
- public OrderedExecutorFactory(final Executor parent)
- {
- this.parent = parent;
- }
-
- /**
- * Get an executor that always executes tasks in order.
- *
- * @return an ordered executor
- */
- public Executor getExecutor()
- {
- return new OrderedExecutor(parent);
- }
-
- /**
- * An executor that always runs all tasks in order, using a delegate executor to run the tasks.
- * <p/>
- * More specifically, any call B to the {@link #execute(Runnable)} method that happens-after another call A to the
- * same method, will result in B's task running after A's.
- */
- private static final class OrderedExecutor implements Executor
- {
- // @protectedby tasks
- private final LinkedList<Runnable> tasks = new LinkedList<Runnable>();
-
- // @protectedby tasks
- private boolean running;
-
- private final Executor parent;
-
- private final Runnable runner;
-
- /**
- * Construct a new instance.
- *
- * @param parent the parent executor
- */
- public OrderedExecutor(final Executor parent)
- {
- this.parent = parent;
- runner = new Runnable()
- {
- public void run()
- {
- for (;;)
- {
- final Runnable task;
- synchronized (tasks)
- {
- task = tasks.poll();
- if (task == null)
- {
- running = false;
- return;
- }
- }
- try
- {
- task.run();
- }
- catch (Throwable t)
- {
- // eat it!
- }
- }
- }
- };
- }
-
- /**
- * Run a task.
- *
- * @param command the task to run.
- */
- public void execute(Runnable command)
- {
- synchronized (tasks)
- {
- tasks.add(command);
- if (!running)
- {
- running = true;
- parent.execute(runner);
- }
- }
- }
- }
-}
-
-
Deleted: trunk/src/main/org/jboss/messaging/util/Pair.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/Pair.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/Pair.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-import java.io.Serializable;
-
-/**
- *
- * A Pair
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public class Pair<A, B> implements Serializable
-{
- private static final long serialVersionUID = -2496357457812368127L;
-
- public Pair(A a, B b)
- {
- this.a = a;
-
- this.b = b;
- }
-
- public A a;
-
- public B b;
-
- private int hash = -1;
-
- public int hashCode()
- {
- if (hash == -1)
- {
- if (a == null && b == null)
- {
- return super.hashCode();
- }
- else
- {
- hash = (a == null ? 0 : a.hashCode()) + 37 * (b == null ? 0 : b.hashCode());
- }
- }
-
- return hash;
- }
-
- public boolean equals(Object other)
- {
- if (other == this)
- {
- return true;
- }
-
- if (other instanceof Pair == false)
- {
- return false;
- }
-
- Pair<A, B> pother = (Pair<A, B>)other;
-
- return (pother.a == null ? a == null : pother.a.equals(a)) &&
- (pother.b == null ? b == null : pother.b.equals(b));
-
- }
-}
Deleted: trunk/src/main/org/jboss/messaging/util/Random.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/Random.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/Random.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-
-/**
- * A Random
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- * Created 28 Nov 2008 10:28:28
- *
- *
- */
-public class Random
-{
- private static int extraSeed;
-
- private static synchronized long getSeed()
- {
- long seed = System.currentTimeMillis() + extraSeed++;
-
- return seed;
- }
-
- private java.util.Random random = new java.util.Random(getSeed());
-
- public java.util.Random getRandom()
- {
- return random;
- }
-
-}
Deleted: trunk/src/main/org/jboss/messaging/util/SimpleIDGenerator.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/SimpleIDGenerator.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/SimpleIDGenerator.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss 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.messaging.util;
-
-/**
- * A SimpleIDGenerator
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public class SimpleIDGenerator implements IDGenerator
-{
- private long idSequence;
-
- private boolean wrapped;
-
- public SimpleIDGenerator(final long startID)
- {
- idSequence = startID;
- }
-
- public synchronized long generateID()
- {
- long id = idSequence++;
-
- if (idSequence == Long.MIN_VALUE)
- {
- wrapped = true;
- }
-
- if (wrapped)
- {
- // Wrap - Very unlikely to happen
- throw new IllegalStateException("Exhausted ids to use!");
- }
-
- return id;
- }
-
- public synchronized long getCurrentID()
- {
- return idSequence;
- }
-}
Deleted: trunk/src/main/org/jboss/messaging/util/SimpleString.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/SimpleString.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/SimpleString.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,354 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-import static org.jboss.messaging.util.DataConstants.SIZE_INT;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.messaging.core.logging.Logger;
-
-/**
- *
- * A SimpleString
- *
- * A simple String class that can store all characters, and stores as simple byte[],
- * this minimises expensive copying between String objects
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- * TODO - implement an intern() method like in java.lang.String, since many Strings e.g. addresses, queue names, remote node ids are duplicated heavily
- * in bindings taking up more memory than they should
- * Intern can be called when receiving a sent message at the server (destination)
- * Also when receiving bindings remotely via bridge, the address, queue name and node id can be interned
- *
- */
-public class SimpleString implements CharSequence, Serializable, Comparable<SimpleString>
-{
- private static final long serialVersionUID = 4204223851422244307L;
-
- private static final Logger log = Logger.getLogger(SimpleString.class);
-
- // Attributes
- // ------------------------------------------------------------------------
- private final byte[] data;
-
- private transient int hash;
-
- // Cache the string
- private transient String str;
-
- // Static
- // ----------------------------------------------------------------------
-
- /**
- * Returns a SimpleString constructed from the <code>string</code> parameter.
- * If <code>string</code> is <code>null</code>, the return value will be <code>null</code> too.
- */
- public static SimpleString toSimpleString(final String string)
- {
- if (string == null)
- {
- return null;
- }
- return new SimpleString(string);
- }
-
- // Constructors
- // ----------------------------------------------------------------------
-
- public SimpleString(final String string)
- {
- int len = string.length();
-
- data = new byte[len << 1];
-
- int j = 0;
-
- for (int i = 0; i < len; i++)
- {
- char c = string.charAt(i);
-
- byte low = (byte)(c & 0xFF); // low byte
-
- data[j++] = low;
-
- byte high = (byte)(c >> 8 & 0xFF); // high byte
-
- data[j++] = high;
- }
-
- str = string;
- }
-
- public SimpleString(final byte[] data)
- {
- this.data = data;
- }
-
- // CharSequence implementation
- // ---------------------------------------------------------------------------
-
- public int length()
- {
- return data.length >> 1;
- }
-
- public char charAt(int pos)
- {
- if (pos < 0 || pos >= data.length >> 1)
- {
- throw new IndexOutOfBoundsException();
- }
- pos <<= 1;
-
- return (char)(data[pos] | data[pos + 1] << 8);
- }
-
- public CharSequence subSequence(final int start, final int end)
- {
- int len = data.length >> 1;
-
- if (end < start || start < 0 || end > len)
- {
- throw new IndexOutOfBoundsException();
- }
- else
- {
- int newlen = (end - start) << 1;
- byte[] bytes = new byte[newlen];
-
- System.arraycopy(data, start << 1, bytes, 0, newlen);
-
- return new SimpleString(bytes);
- }
- }
-
- // Comparable implementation -------------------------------------
-
- public int compareTo(SimpleString o)
- {
- return toString().compareTo(o.toString());
- }
-
- // Public
- // ---------------------------------------------------------------------------
-
- public byte[] getData()
- {
- return data;
- }
-
- public boolean startsWith(final SimpleString other)
- {
- byte[] otherdata = other.data;
-
- if (otherdata.length > this.data.length)
- {
- return false;
- }
-
- for (int i = 0; i < otherdata.length; i++)
- {
- if (this.data[i] != otherdata[i])
- {
- return false;
- }
- }
-
- return true;
- }
-
- public String toString()
- {
- if (str == null)
- {
- int len = data.length >> 1;
-
- char[] chars = new char[len];
-
- int j = 0;
-
- for (int i = 0; i < len; i++)
- {
- int low = data[j++] & 0xFF;
-
- int high = (data[j++] << 8) & 0xFF00;
-
- chars[i] = (char)(low | high);
- }
-
- str = new String(chars);
- }
-
- return str;
- }
-
- public boolean equals(Object other)
- {
- if (other instanceof SimpleString)
- {
- SimpleString s = (SimpleString)other;
-
- if (data.length != s.data.length)
- {
- return false;
- }
-
- for (int i = 0; i < data.length; i++)
- {
- if (data[i] != s.data[i])
- {
- return false;
- }
- }
-
- return true;
- }
- else
- {
- return false;
- }
- }
-
- public int hashCode()
- {
- if (hash == 0)
- {
- for (int i = 0; i < data.length; i++)
- {
- hash = (hash << 5) - hash + data[i]; // (hash << 5) - hash is same as hash * 31
- }
- }
-
- return hash;
- }
-
- public SimpleString[] split(char delim)
- {
- if (!contains(delim))
- {
- return new SimpleString[] { this };
- }
- else
- {
- List<SimpleString> all = new ArrayList<SimpleString>();
- int lasPos = 0;
- for (int i = 0; i < data.length; i += 2)
- {
- byte low = (byte)(delim & 0xFF); // low byte
- byte high = (byte)(delim >> 8 & 0xFF); // high byte
- if (data[i] == low && data[i + 1] == high)
- {
- byte[] bytes = new byte[i - lasPos];
- System.arraycopy(data, lasPos, bytes, 0, bytes.length);
- lasPos = i + 2;
- all.add(new SimpleString(bytes));
- }
- }
- byte[] bytes = new byte[data.length - lasPos];
- System.arraycopy(data, lasPos, bytes, 0, bytes.length);
- all.add(new SimpleString(bytes));
- SimpleString[] parts = new SimpleString[all.size()];
- return all.toArray(parts);
- }
- }
-
- public boolean contains(char c)
- {
- for (int i = 0; i < data.length; i += 2)
- {
- byte low = (byte)(c & 0xFF); // low byte
- byte high = (byte)(c >> 8 & 0xFF); // high byte
- if (data[i] == low && data[i + 1] == high)
- {
- return true;
- }
- }
- return false;
- }
-
- public SimpleString concat(final SimpleString toAdd)
- {
- byte[] bytes = new byte[data.length + toAdd.getData().length];
- System.arraycopy(data, 0, bytes, 0, data.length);
- System.arraycopy(toAdd.getData(), 0, bytes, data.length, toAdd.getData().length);
- return new SimpleString(bytes);
- }
-
- public SimpleString concat(final char c)
- {
- byte[] bytes = new byte[data.length + 2];
- System.arraycopy(data, 0, bytes, 0, data.length);
- bytes[data.length] = (byte)(c & 0xFF);
- bytes[data.length + 1] = (byte)(c >> 8 & 0xFF);
- return new SimpleString(bytes);
- }
-
- public static int sizeofString(final SimpleString str)
- {
- return SIZE_INT + str.data.length;
- }
-
- public static int sizeofNullableString(final SimpleString str)
- {
- if (str == null)
- {
- return 1;
- }
- else
- {
- return 1 + sizeofString(str);
- }
- }
-
- public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin)
- {
- if (srcBegin < 0)
- {
- throw new StringIndexOutOfBoundsException(srcBegin);
- }
- if (srcEnd > length())
- {
- throw new StringIndexOutOfBoundsException(srcEnd);
- }
- if (srcBegin > srcEnd)
- {
- throw new StringIndexOutOfBoundsException(srcEnd - srcBegin);
- }
-
- int j = 0;
-
- for (int i = srcBegin; i < srcEnd - srcBegin; i++)
- {
- int low = data[j++] & 0xFF;
-
- int high = (data[j++] << 8) & 0xFF00;
-
- dst[i] = (char)(low | high);
- }
- }
-
-}
\ No newline at end of file
Deleted: trunk/src/main/org/jboss/messaging/util/SimpleStringReader.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/SimpleStringReader.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/SimpleStringReader.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,99 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-import java.io.IOException;
-import java.io.Reader;
-
-/**
- * A SimpleStringReader
- *
- * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
- *
- * Created 31 oct. 2008 14:41:18
- *
- *
- */
-public class SimpleStringReader extends Reader
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private final SimpleString simpleString;
-
- private int next = 0;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SimpleStringReader(final SimpleString simpleString)
- {
- this.simpleString = simpleString;
- }
-
- // Public --------------------------------------------------------
-
- // Reader overrides ----------------------------------------------
-
- @Override
- public int read(char[] cbuf, int off, int len) throws IOException
- {
- synchronized (simpleString)
- {
- if ((off < 0) || (off > cbuf.length) || (len < 0) || ((off + len) > cbuf.length) || ((off + len) < 0))
- {
- throw new IndexOutOfBoundsException();
- }
- else if (len == 0)
- {
- return 0;
- }
- int length = simpleString.length();
- if (next >= length)
- {
- return -1;
- }
- int n = Math.min(length - next, len);
- simpleString.getChars(next, next + n, cbuf, off);
- next += n;
- return n;
- }
- }
-
- @Override
- public void close() throws IOException
- {
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Deleted: trunk/src/main/org/jboss/messaging/util/TimeAndCounterIDGenerator.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/TimeAndCounterIDGenerator.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/TimeAndCounterIDGenerator.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,178 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * A TimeAndCounterIDGenerator
- * <p>
- * This IDGenerator doesn't support more than 16777215 IDs per 16 millisecond. It would throw an exception if this happens.
- * </p>
- *
- * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a> Created Sep 24, 2008 11:54:10 AM
- */
-public class TimeAndCounterIDGenerator implements IDGenerator
-{
- // Constants ----------------------------------------------------
-
- /**
- * Bits to move the date accordingly to MASK_TIME
- */
- private static final int BITS_TO_MOVE = 20;
-
- public static final long MASK_TIME = 0x7fffffffff0l;
-
- //44 bits of time and 20 bits of counter
-
- public static final long ID_MASK = 0xffffffl;
-
- private static final long TIME_ID_MASK = 0x7fffffffff000000l;
-
- // Attributes ----------------------------------------------------
-
- private final AtomicLong counter = new AtomicLong(0);
-
- private volatile boolean wrapped = false;
-
- private volatile long tmMark;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public TimeAndCounterIDGenerator()
- {
- refresh();
- }
-
- // Public --------------------------------------------------------
-
- // Public --------------------------------------------------------
-
- public long generateID()
- {
- long idReturn = counter.incrementAndGet();
-
- if ((idReturn & ID_MASK) == 0)
- {
- final long timePortion = idReturn & TIME_ID_MASK;
-
- // Wrapping ID logic
-
- if (timePortion >= newTM())
- {
- // Unlikely to happen
-
- wrapped = true;
-
- }
- else
- {
- // Else.. no worry... we will just accept the new time portion being added
- // This time-mark would have been generated some time ago, so this is ok.
- // tmMark is just a cache to validate the MaxIDs, so there is no need to make it atomic (synchronized)
- tmMark = timePortion;
- }
- }
-
- if (wrapped)
- {
- // This will only happen if a computer can generate more than ID_MASK ids (16 million IDs per 16
- // milliseconds)
- // If this wrapping code starts to happen, it needs revision
- throw new IllegalStateException("The IDGenerator is being overlaped, and it needs revision as the system generated more than " + ID_MASK +
- " ids per 16 milliseconds which exceeded the IDgenerator limit");
- }
-
- return idReturn;
- }
-
- public long getCurrentID()
- {
- return counter.get();
- }
-
-
- // for use in testcases
- public long getInternalTimeMark()
- {
- return tmMark;
- }
-
- // for use in testcases
- public void setInternalID(final long id)
- {
- counter.set(tmMark | id);
- }
-
- // for use in testcases
- public void setInternalDate(final long date)
- {
- tmMark = (date & MASK_TIME) << BITS_TO_MOVE;
- counter.set(tmMark);
- }
-
- public synchronized void refresh()
- {
- long oldTm = tmMark;
- long newTm = newTM();
-
- while (newTm <= oldTm)
- {
- newTm = newTM();
- }
- tmMark = newTm;
- counter.set(tmMark);
- }
-
- @Override
- public String toString()
- {
- long currentCounter = counter.get();
- return "SequenceGenerator(tmMark=" + hex(tmMark) +
- ", CurrentCounter = " +
- currentCounter +
- ", HexCurrentCounter = " +
- hex(currentCounter) +
- ")";
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- private long newTM()
- {
- return (System.currentTimeMillis() & MASK_TIME) << BITS_TO_MOVE;
- }
-
- private String hex(final long x)
- {
- return String.format("%1$X", x);
- }
-
-}
Deleted: trunk/src/main/org/jboss/messaging/util/TokenBucketLimiter.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/TokenBucketLimiter.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/TokenBucketLimiter.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-/**
- *
- * A TokenBucketLimiterImpl
- *
- * This class can throttle to a specfic rate, using an algorithm based on the Token Bucket metaphor
- * http://en.wikipedia.org/wiki/Token_bucket
- *
- * The rate is specified in Hertz
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public interface TokenBucketLimiter
-{
- int getRate();
-
- boolean isSpin();
-
- void limit();
-}
Deleted: trunk/src/main/org/jboss/messaging/util/TokenBucketLimiterImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/TokenBucketLimiterImpl.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/TokenBucketLimiterImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,121 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-/**
- *
- * A TokenBucketLimiterImpl
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public class TokenBucketLimiterImpl implements TokenBucketLimiter
-{
- private final int rate;
-
- private final boolean spin;
-
- private volatile long last;
-
- private volatile int tokens;
-
- private volatile int tokensAdded;
-
- public TokenBucketLimiterImpl(final int rate, final boolean spin)
- {
- this.rate = rate;
-
- this.spin = spin;
- }
-
- public int getRate()
- {
- return rate;
- }
-
- public boolean isSpin()
- {
- return spin;
- }
-
- public void limit()
- {
- while (!check())
- {
- if (!spin)
- {
- try
- {
- Thread.sleep(1);
- }
- catch (Exception e)
- {
- //Ignore
- }
- }
- }
- }
-
- private boolean check()
- {
- long now = System.currentTimeMillis();
-
- if (last == 0)
- {
- last = now;
- }
-
- long diff = now - last;
-
- if (diff >= 1000)
- {
- last = last + 1000;
-
- tokens = 0;
-
- tokensAdded = 0;
- }
-
- int tokensDue = (int)(rate * diff / 1000);
-
- int tokensToAdd = tokensDue - tokensAdded;
-
- if (tokensToAdd > 0)
- {
- tokens += tokensToAdd;
-
- tokensAdded += tokensToAdd;
- }
-
- if (tokens > 0)
- {
- tokens--;
-
- return true;
- }
- else
- {
- return false;
- }
- }
-}
Deleted: trunk/src/main/org/jboss/messaging/util/TypedProperties.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/TypedProperties.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/TypedProperties.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,752 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-import static org.jboss.messaging.util.DataConstants.BOOLEAN;
-import static org.jboss.messaging.util.DataConstants.BYTE;
-import static org.jboss.messaging.util.DataConstants.BYTES;
-import static org.jboss.messaging.util.DataConstants.CHAR;
-import static org.jboss.messaging.util.DataConstants.DOUBLE;
-import static org.jboss.messaging.util.DataConstants.FLOAT;
-import static org.jboss.messaging.util.DataConstants.INT;
-import static org.jboss.messaging.util.DataConstants.LONG;
-import static org.jboss.messaging.util.DataConstants.NOT_NULL;
-import static org.jboss.messaging.util.DataConstants.NULL;
-import static org.jboss.messaging.util.DataConstants.SHORT;
-import static org.jboss.messaging.util.DataConstants.SIZE_BOOLEAN;
-import static org.jboss.messaging.util.DataConstants.SIZE_BYTE;
-import static org.jboss.messaging.util.DataConstants.SIZE_CHAR;
-import static org.jboss.messaging.util.DataConstants.SIZE_DOUBLE;
-import static org.jboss.messaging.util.DataConstants.SIZE_FLOAT;
-import static org.jboss.messaging.util.DataConstants.SIZE_INT;
-import static org.jboss.messaging.util.DataConstants.SIZE_LONG;
-import static org.jboss.messaging.util.DataConstants.SIZE_SHORT;
-import static org.jboss.messaging.util.DataConstants.STRING;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-
-/**
- *
- * A TypedProperties
- *
- * TODO - should have typed property getters and do conversions herein
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
- *
- */
-public class TypedProperties
-{
- private static final Logger log = Logger.getLogger(TypedProperties.class);
-
- private Map<SimpleString, PropertyValue> properties;
-
- private volatile int size;
-
- public TypedProperties()
- {
- }
-
- public TypedProperties(final TypedProperties other)
- {
- properties = other.properties == null ? null : new HashMap<SimpleString, PropertyValue>(other.properties);
- size = other.size;
- }
-
- public void putBooleanProperty(final SimpleString key, final boolean value)
- {
- checkCreateProperties();
- doPutValue(key, new BooleanValue(value));
- }
-
- public void putByteProperty(final SimpleString key, final byte value)
- {
- checkCreateProperties();
- doPutValue(key, new ByteValue(value));
- }
-
- public void putBytesProperty(final SimpleString key, final byte[] value)
- {
- checkCreateProperties();
- doPutValue(key, value == null ? new NullValue() : new BytesValue(value));
- }
-
- public void putShortProperty(final SimpleString key, final short value)
- {
- checkCreateProperties();
- doPutValue(key, new ShortValue(value));
- }
-
- public void putIntProperty(final SimpleString key, final int value)
- {
- checkCreateProperties();
- doPutValue(key, new IntValue(value));
- }
-
- public void putLongProperty(final SimpleString key, final long value)
- {
- checkCreateProperties();
- doPutValue(key, new LongValue(value));
- }
-
- public void putFloatProperty(final SimpleString key, final float value)
- {
- checkCreateProperties();
- doPutValue(key, new FloatValue(value));
- }
-
- public void putDoubleProperty(final SimpleString key, final double value)
- {
- checkCreateProperties();
- doPutValue(key, new DoubleValue(value));
- }
-
- public void putStringProperty(final SimpleString key, final SimpleString value)
- {
- checkCreateProperties();
- doPutValue(key, value == null ? new NullValue() : new StringValue(value));
- }
-
- public void putCharProperty(final SimpleString key, final char value)
- {
- checkCreateProperties();
- doPutValue(key, new CharValue(value));
- }
-
- public void putTypedProperties(final TypedProperties otherProps)
- {
- if (otherProps == null || otherProps.properties == null)
- {
- return;
- }
-
- checkCreateProperties();
- Set<Entry<SimpleString,PropertyValue>> otherEntries = otherProps.properties.entrySet();
- for (Entry<SimpleString, PropertyValue> otherEntry : otherEntries)
- {
- doPutValue(otherEntry.getKey(), otherEntry.getValue());
- }
- }
-
- public Object getProperty(final SimpleString key)
- {
- return doGetProperty(key);
- }
-
- public Object removeProperty(final SimpleString key)
- {
- return doRemoveProperty(key);
- }
-
- public boolean containsProperty(final SimpleString key)
- {
- if (properties != null)
- {
- return properties.containsKey(key);
- }
- else
- {
- return false;
- }
- }
-
- public Set<SimpleString> getPropertyNames()
- {
- if (properties != null)
- {
- return properties.keySet();
- }
- else
- {
- return Collections.EMPTY_SET;
- }
- }
-
- public synchronized void decode(final MessagingBuffer buffer)
- {
- byte b = buffer.getByte();
-
- if (b == NULL)
- {
- properties = null;
- }
- else
- {
- int numHeaders = buffer.getInt();
-
- properties = new HashMap<SimpleString, PropertyValue>(numHeaders);
- size = 0;
-
- for (int i = 0; i < numHeaders; i++)
- {
- int len = buffer.getInt();
- byte[] data = new byte[len];
- buffer.getBytes(data);
- SimpleString key = new SimpleString(data);
-
- byte type = buffer.getByte();
-
- PropertyValue val;
-
- switch (type)
- {
- case NULL:
- {
- val = new NullValue();
- doPutValue(key, val);
- break;
- }
- case CHAR:
- {
- val = new CharValue(buffer);
- doPutValue(key, val);
- break;
- }
- case BOOLEAN:
- {
- val = new BooleanValue(buffer);
- doPutValue(key, val);
- break;
- }
- case BYTE:
- {
- val = new ByteValue(buffer);
- doPutValue(key, val);
- break;
- }
- case BYTES:
- {
- val = new BytesValue(buffer);
- doPutValue(key, val);
- break;
- }
- case SHORT:
- {
- val = new ShortValue(buffer);
- doPutValue(key, val);
- break;
- }
- case INT:
- {
- val = new IntValue(buffer);
- doPutValue(key, val);
- break;
- }
- case LONG:
- {
- val = new LongValue(buffer);
- doPutValue(key, val);
- break;
- }
- case FLOAT:
- {
- val = new FloatValue(buffer);
- doPutValue(key, val);
- break;
- }
- case DOUBLE:
- {
- val = new DoubleValue(buffer);
- doPutValue(key, val);
- break;
- }
- case STRING:
- {
- val = new StringValue(buffer);
- doPutValue(key, val);
- break;
- }
- default:
- {
- throw new IllegalArgumentException("Invalid type: " + type);
- }
- }
- }
- }
- }
-
- public synchronized void encode(final MessagingBuffer buffer)
- {
- if (properties == null)
- {
- buffer.putByte(NULL);
- }
- else
- {
- buffer.putByte(NOT_NULL);
-
- buffer.putInt(properties.size());
-
- for (Map.Entry<SimpleString, PropertyValue> entry : properties.entrySet())
- {
- SimpleString s = entry.getKey();
- byte[] data = s.getData();
- buffer.putInt(data.length);
- buffer.putBytes(data);
-
- entry.getValue().write(buffer);
- }
- }
- }
-
- public int getEncodeSize()
- {
- if (properties == null)
- {
- return SIZE_BYTE;
- }
- else
- {
- return SIZE_BYTE + SIZE_INT + size;
-
- }
- }
-
- public void clear()
- {
- if (properties != null)
- {
- properties.clear();
- }
- }
-
- // Private ------------------------------------------------------------------------------------
-
- private void checkCreateProperties()
- {
- if (properties == null)
- {
- properties = new HashMap<SimpleString, PropertyValue>();
- }
- }
-
- private synchronized void doPutValue(final SimpleString key, final PropertyValue value)
- {
- PropertyValue oldValue = properties.put(key, value);
- if (oldValue != null)
- {
- size += value.encodeSize() - oldValue.encodeSize();
- }
- else
- {
- size += SimpleString.sizeofString(key) + value.encodeSize();
- }
- }
-
- private synchronized Object doRemoveProperty(final SimpleString key)
- {
- if (properties == null)
- {
- return null;
- }
-
- PropertyValue val = properties.remove(key);
-
- if (val == null)
- {
- return null;
- }
- else
- {
- size -= SimpleString.sizeofString(key) + val.encodeSize();
-
- return val.getValue();
- }
- }
-
- private synchronized Object doGetProperty(final Object key)
- {
- if (properties == null)
- {
- return null;
- }
-
- PropertyValue val = properties.get(key);
-
- if (val == null)
- {
- return null;
- }
- else
- {
- return val.getValue();
- }
- }
-
- // Inner classes ------------------------------------------------------------------------------
-
- private interface PropertyValue
- {
- Object getValue();
-
- void write(MessagingBuffer buffer);
-
- int encodeSize();
- }
-
- private static final class NullValue implements PropertyValue
- {
- public NullValue()
- {
- }
-
- public Object getValue()
- {
- return null;
- }
-
- public void write(final MessagingBuffer buffer)
- {
- buffer.putByte(NULL);
- }
-
- public int encodeSize()
- {
- return SIZE_BYTE;
- }
-
- }
-
- private static final class BooleanValue implements PropertyValue
- {
- final boolean val;
-
- public BooleanValue(final boolean val)
- {
- this.val = val;
- }
-
- public BooleanValue(final MessagingBuffer buffer)
- {
- val = buffer.getBoolean();
- }
-
- public Object getValue()
- {
- return val;
- }
-
- public void write(final MessagingBuffer buffer)
- {
- buffer.putByte(BOOLEAN);
- buffer.putBoolean(val);
- }
-
- public int encodeSize()
- {
- return SIZE_BYTE + SIZE_BOOLEAN;
- }
-
- }
-
- private static final class ByteValue implements PropertyValue
- {
- final byte val;
-
- public ByteValue(final byte val)
- {
- this.val = val;
- }
-
- public ByteValue(final MessagingBuffer buffer)
- {
- val = buffer.getByte();
- }
-
- public Object getValue()
- {
- return val;
- }
-
- public void write(final MessagingBuffer buffer)
- {
- buffer.putByte(BYTE);
- buffer.putByte(val);
- }
-
- public int encodeSize()
- {
- return SIZE_BYTE + SIZE_BYTE;
- }
- }
-
- private static final class BytesValue implements PropertyValue
- {
- final byte[] val;
-
- public BytesValue(final byte[] val)
- {
- this.val = val;
- }
-
- public BytesValue(final MessagingBuffer buffer)
- {
- int len = buffer.getInt();
- val = new byte[len];
- buffer.getBytes(val);
- }
-
- public Object getValue()
- {
- return val;
- }
-
- public void write(final MessagingBuffer buffer)
- {
- buffer.putByte(BYTES);
- buffer.putInt(val.length);
- buffer.putBytes(val);
- }
-
- public int encodeSize()
- {
- return SIZE_BYTE + SIZE_INT + val.length;
- }
-
- }
-
- private static final class ShortValue implements PropertyValue
- {
- final short val;
-
- public ShortValue(final short val)
- {
- this.val = val;
- }
-
- public ShortValue(final MessagingBuffer buffer)
- {
- val = buffer.getShort();
- }
-
- public Object getValue()
- {
- return val;
- }
-
- public void write(final MessagingBuffer buffer)
- {
- buffer.putByte(SHORT);
- buffer.putShort(val);
- }
-
- public int encodeSize()
- {
- return SIZE_BYTE + SIZE_SHORT;
- }
- }
-
- private static final class IntValue implements PropertyValue
- {
- final int val;
-
- public IntValue(final int val)
- {
- this.val = val;
- }
-
- public IntValue(final MessagingBuffer buffer)
- {
- val = buffer.getInt();
- }
-
- public Object getValue()
- {
- return val;
- }
-
- public void write(final MessagingBuffer buffer)
- {
- buffer.putByte(INT);
- buffer.putInt(val);
- }
-
- public int encodeSize()
- {
- return SIZE_BYTE + SIZE_INT;
- }
- }
-
- private static final class LongValue implements PropertyValue
- {
- final long val;
-
- public LongValue(final long val)
- {
- this.val = val;
- }
-
- public LongValue(final MessagingBuffer buffer)
- {
- val = buffer.getLong();
- }
-
- public Object getValue()
- {
- return val;
- }
-
- public void write(final MessagingBuffer buffer)
- {
- buffer.putByte(LONG);
- buffer.putLong(val);
- }
-
- public int encodeSize()
- {
- return SIZE_BYTE + SIZE_LONG;
- }
- }
-
- private static final class FloatValue implements PropertyValue
- {
- final float val;
-
- public FloatValue(final float val)
- {
- this.val = val;
- }
-
- public FloatValue(final MessagingBuffer buffer)
- {
- val = buffer.getFloat();
- }
-
- public Object getValue()
- {
- return val;
- }
-
- public void write(final MessagingBuffer buffer)
- {
- buffer.putByte(FLOAT);
- buffer.putFloat(val);
- }
-
- public int encodeSize()
- {
- return SIZE_BYTE + SIZE_FLOAT;
- }
-
- }
-
- private static final class DoubleValue implements PropertyValue
- {
- final double val;
-
- public DoubleValue(final double val)
- {
- this.val = val;
- }
-
- public DoubleValue(final MessagingBuffer buffer)
- {
- val = buffer.getDouble();
- }
-
- public Object getValue()
- {
- return val;
- }
-
- public void write(final MessagingBuffer buffer)
- {
- buffer.putByte(DOUBLE);
- buffer.putDouble(val);
- }
-
- public int encodeSize()
- {
- return SIZE_BYTE + SIZE_DOUBLE;
- }
- }
-
- private static final class CharValue implements PropertyValue
- {
- final char val;
-
- public CharValue(final char val)
- {
- this.val = val;
- }
-
- public CharValue(final MessagingBuffer buffer)
- {
- val = buffer.getChar();
- }
-
- public Object getValue()
- {
- return val;
- }
-
- public void write(final MessagingBuffer buffer)
- {
- buffer.putByte(CHAR);
- buffer.putChar(val);
- }
-
- public int encodeSize()
- {
- return SIZE_BYTE + SIZE_CHAR;
- }
- }
-
- private static final class StringValue implements PropertyValue
- {
- final SimpleString val;
-
- public StringValue(final SimpleString val)
- {
- this.val = val;
- }
-
- public StringValue(final MessagingBuffer buffer)
- {
- val = buffer.getSimpleString();
- }
-
- public Object getValue()
- {
- return val;
- }
-
- public void write(final MessagingBuffer buffer)
- {
- buffer.putByte(STRING);
- buffer.putSimpleString(val);
- }
-
- public int encodeSize()
- {
- return SIZE_BYTE + SimpleString.sizeofString(val);
- }
- }
-}
Deleted: trunk/src/main/org/jboss/messaging/util/UTF8Util.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/UTF8Util.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/UTF8Util.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,280 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-import java.io.IOException;
-import java.lang.ref.SoftReference;
-
-import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-
-/**
- *
- * A UTF8Util
- *
- * This class will write UTFs directly to the ByteOutput (through the MessageBuffer interface)
- *
- * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- *
- * Created Feb 20, 2009 1:37:18 PM
- *
- *
- */
-public class UTF8Util
-{
- static boolean optimizeStrings = true;
-
- private static final Logger log = Logger.getLogger(UTF8Util.class);
-
- private static final boolean isDebug = log.isDebugEnabled();
-
- private static ThreadLocal<SoftReference<StringUtilBuffer>> currenBuffer = new ThreadLocal<SoftReference<StringUtilBuffer>>();
-
- public static void saveUTF(final MessagingBuffer out, final String str) throws IOException
- {
- StringUtilBuffer buffer = getThreadLocalBuffer();
-
- if (str.length() > 0xffff)
- {
- throw new IllegalArgumentException("the specified string is too long (" + str.length() + ")");
- }
-
- final int len = calculateUTFSize(str, buffer);
-
- if (len > 0xffff)
- {
- throw new IllegalArgumentException("the encoded string is too long (" + len + ")");
- }
-
- out.putShort((short)len);
-
- if (len > buffer.byteBuffer.length)
- {
- buffer.resizeByteBuffer(len);
- }
-
- if (len == (long)str.length())
- {
- for (int byteLocation = 0; byteLocation < len; byteLocation++)
- {
- buffer.byteBuffer[byteLocation] = (byte)buffer.charBuffer[byteLocation];
- }
- out.putBytes(buffer.byteBuffer, 0, len);
- }
- else
- {
- if (isDebug)
- {
- log.debug("Saving string with utfSize=" + len + " stringSize=" + str.length());
- }
-
- int stringLength = str.length();
-
- int charCount = 0;
-
- for (int i = 0; i < stringLength; i++)
- {
- char charAtPos = buffer.charBuffer[i];
- if (charAtPos >= 1 && charAtPos < 0x7f)
- {
- buffer.byteBuffer[charCount++] = (byte)charAtPos;
- }
- else if (charAtPos >= 0x800)
- {
- buffer.byteBuffer[charCount++] = (byte)(0xE0 | charAtPos >> 12 & 0x0F);
- buffer.byteBuffer[charCount++] = (byte)(0x80 | charAtPos >> 6 & 0x3F);
- buffer.byteBuffer[charCount++] = (byte)(0x80 | charAtPos >> 0 & 0x3F);
- }
- else
- {
- buffer.byteBuffer[charCount++] = (byte)(0xC0 | charAtPos >> 6 & 0x1F);
- buffer.byteBuffer[charCount++] = (byte)(0x80 | charAtPos >> 0 & 0x3F);
-
- }
- }
- out.putBytes(buffer.byteBuffer, 0, len);
- }
- }
-
- public static String readUTF(final MessagingBuffer input) throws IOException
- {
- StringUtilBuffer buffer = getThreadLocalBuffer();
-
- final int size = input.getUnsignedShort();
-
- if (size > buffer.byteBuffer.length)
- {
- buffer.resizeByteBuffer(size);
- }
-
- if (size > buffer.charBuffer.length)
- {
- buffer.resizeCharBuffer(size);
- }
-
- if (isDebug)
- {
- log.debug("Reading string with utfSize=" + size);
- }
-
- int count = 0;
- int byte1, byte2, byte3;
- int charCount = 0;
-
- input.getBytes(buffer.byteBuffer, 0, size);
-
- while (count < size)
- {
- byte1 = buffer.byteBuffer[count++];
-
- if (byte1 > 0 && byte1 <= 0x7F)
- {
- buffer.charBuffer[charCount++] = (char)byte1;
- }
- else
- {
- int c = byte1 & 0xff;
- switch (c >> 4)
- {
- case 0xc:
- case 0xd:
- byte2 = buffer.byteBuffer[count++];
- buffer.charBuffer[charCount++] = (char)((c & 0x1F) << 6 | byte2 & 0x3F);
- break;
- case 0xe:
- byte2 = buffer.byteBuffer[count++];
- byte3 = buffer.byteBuffer[count++];
- buffer.charBuffer[charCount++] = (char)((c & 0x0F) << 12 | (byte2 & 0x3F) << 6 | (byte3 & 0x3F) << 0);
- break;
- }
- }
- }
-
- return new String(buffer.charBuffer, 0, charCount);
-
- }
-
- private static StringUtilBuffer getThreadLocalBuffer()
- {
- SoftReference<StringUtilBuffer> softReference = currenBuffer.get();
- StringUtilBuffer value;
- if (softReference == null)
- {
- value = new StringUtilBuffer();
- softReference = new SoftReference<StringUtilBuffer>(value);
- currenBuffer.set(softReference);
- }
- else
- {
- value = softReference.get();
- }
-
- if (value == null)
- {
- value = new StringUtilBuffer();
- softReference = new SoftReference<StringUtilBuffer>(value);
- currenBuffer.set(softReference);
- }
-
- return value;
- }
-
- public static void clearBuffer()
- {
- SoftReference<StringUtilBuffer> ref = currenBuffer.get();
- if (ref.get() != null)
- {
- ref.clear();
- }
- }
-
- public static int calculateUTFSize(final String str, final StringUtilBuffer stringBuffer)
- {
- int calculatedLen = 0;
-
- int stringLength = str.length();
-
- if (stringLength > stringBuffer.charBuffer.length)
- {
- stringBuffer.resizeCharBuffer(stringLength);
- }
-
- str.getChars(0, stringLength, stringBuffer.charBuffer, 0);
-
- for (int i = 0; i < stringLength; i++)
- {
- char c = stringBuffer.charBuffer[i];
-
- if (c >= 1 && c < 0x7f)
- {
- calculatedLen++;
- }
- else if (c >= 0x800)
- {
- calculatedLen += 3;
- }
- else
- {
- calculatedLen += 2;
- }
- }
- return calculatedLen;
- }
-
- private static class StringUtilBuffer
- {
-
- public char charBuffer[];
-
- public byte byteBuffer[];
-
- public void resizeCharBuffer(final int newSize)
- {
- if (newSize > charBuffer.length)
- {
- charBuffer = new char[newSize];
- }
- }
-
- public void resizeByteBuffer(final int newSize)
- {
- if (newSize > byteBuffer.length)
- {
- this.byteBuffer = new byte[newSize];
- }
- }
-
- public StringUtilBuffer()
- {
- this(1024, 1024);
- }
-
- public StringUtilBuffer(final int sizeChar, final int sizeByte)
- {
- charBuffer = new char[sizeChar];
- byteBuffer = new byte[sizeByte];
- }
-
- }
-
-}
Deleted: trunk/src/main/org/jboss/messaging/util/UUID.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/UUID.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/UUID.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,222 +0,0 @@
-/* JUG Java Uuid Generator
- *
- * Copyright (c) 2002- Tatu Saloranta, tatu.saloranta at iki.fi
- *
- * Licensed under the License specified in the file licenses/LICENSE.txt which is
- * included with the source code.
- * You may not use this file except in compliance with the License.
- *
- * 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.messaging.util;
-
-
-/**
- * UUID represents Universally Unique Identifiers (aka Global UID in Windows
- * world). UUIDs are usually generated via UUIDGenerator (or in case of 'Null
- * UUID', 16 zero bytes, via static method getNullUUID()), or received from
- * external systems.
- *
- * By default class caches the string presentations of UUIDs so that description
- * is only created the first time it's needed. For memory stingy applications
- * this caching can be turned off (note though that if uuid.toString() is never
- * called, desc is never calculated so only loss is the space allocated for the
- * desc pointer... which can of course be commented out to save memory).
- *
- * Similarly, hash code is calculated when it's needed for the first time, and
- * from thereon that value is just returned. This means that using UUIDs as keys
- * should be reasonably efficient.
- *
- * UUIDs can be compared for equality, serialized, cloned and even sorted.
- * Equality is a simple bit-wise comparison. Ordering (for sorting) is done by
- * first ordering based on type (in the order of numeric values of types),
- * secondarily by time stamp (only for time-based time stamps), and finally by
- * straight numeric byte-by-byte comparison (from most to least significant
- * bytes).
- */
-
-public final class UUID
-{
- private final static String kHexChars = "0123456789abcdefABCDEF";
-
- public final static byte INDEX_CLOCK_HI = 6;
- public final static byte INDEX_CLOCK_MID = 4;
- public final static byte INDEX_CLOCK_LO = 0;
-
- public final static byte INDEX_TYPE = 6;
- // Clock seq. & variant are multiplexed...
- public final static byte INDEX_CLOCK_SEQUENCE = 8;
- public final static byte INDEX_VARIATION = 8;
-
- public final static byte TYPE_NULL = 0;
- public final static byte TYPE_TIME_BASED = 1;
- public final static byte TYPE_DCE = 2; // Not used
- public final static byte TYPE_NAME_BASED = 3;
- public final static byte TYPE_RANDOM_BASED = 4;
-
- /*
- * 'Standard' namespaces defined (suggested) by UUID specs:
- */
- public final static String NAMESPACE_DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
- public final static String NAMESPACE_URL = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
- public final static String NAMESPACE_OID = "6ba7b812-9dad-11d1-80b4-00c04fd430c8";
- public final static String NAMESPACE_X500 = "6ba7b814-9dad-11d1-80b4-00c04fd430c8";
-
- /*
- * By default let's cache desc, can be turned off. For hash code there's no
- * point in turning it off (since the int is already part of the instance
- * memory allocation); if you want to save those 4 bytes (or possibly bit
- * more if alignment is bad) just comment out hash caching.
- */
- private static boolean sDescCaching = true;
-
- private final byte[] mId = new byte[16];
- // Both string presentation and hash value may be cached...
- private transient String mDesc = null;
- private transient int mHashCode = 0;
-
- /**
- * Protected constructor used by UUIDGenerator
- *
- * @param type
- * UUID type
- * @param data
- * 16 byte UUID contents
- */
- public UUID(int type, byte[] data)
- {
- for (int i = 0; i < 16; ++i)
- {
- mId[i] = data[i];
- }
- // Type is multiplexed with time_hi:
- mId[INDEX_TYPE] &= (byte) 0x0F;
- mId[INDEX_TYPE] |= (byte) (type << 4);
- // Variant masks first two bits of the clock_seq_hi:
- mId[INDEX_VARIATION] &= (byte) 0x3F;
- mId[INDEX_VARIATION] |= (byte) 0x80;
- }
-
- public final byte[] asBytes()
- {
- return mId;
- }
-
- /**
- * Could use just the default hash code, but we can probably create a better
- * identity hash (ie. same contents generate same hash) manually, without
- * sacrificing speed too much. Although multiplications with modulos would
- * generate better hashing, let's use just shifts, and do 2 bytes at a time.
- * <p>
- * Of course, assuming UUIDs are randomized enough, even simpler approach
- * might be good enough?
- * <p>
- * Is this a good hash? ... one of these days I better read more about basic
- * hashing techniques I swear!
- */
- private final static int[] kShifts = { 3, 7, 17, 21, 29, 4, 9 };
-
- public final int hashCode()
- {
- if (mHashCode == 0)
- {
- // Let's handle first and last byte separately:
- int result = mId[0] & 0xFF;
-
- result |= (result << 16);
- result |= (result << 8);
-
- for (int i = 1; i < 15; i += 2)
- {
- int curr = (mId[i] & 0xFF) << 8 | (mId[i + 1] & 0xFF);
- int shift = kShifts[i >> 1];
-
- if (shift > 16)
- {
- result ^= (curr << shift) | (curr >>> (32 - shift));
- } else
- {
- result ^= (curr << shift);
- }
- }
-
- // and then the last byte:
- int last = mId[15] & 0xFF;
- result ^= (last << 3);
- result ^= (last << 13);
-
- result ^= (last << 27);
- // Let's not accept hash 0 as it indicates 'not hashed yet':
- if (result == 0)
- {
- mHashCode = -1;
- } else
- {
- mHashCode = result;
- }
- }
- return mHashCode;
- }
-
- public final String toString()
- {
- /*
- * Could be synchronized, but there isn't much harm in just taking our
- * chances (ie. in the worst case we'll form the string more than once...
- * but result is the same)
- */
-
- if (mDesc == null)
- {
- StringBuffer b = new StringBuffer(36);
-
- for (int i = 0; i < 16; ++i)
- {
- // Need to bypass hyphens:
- switch (i)
- {
- case 4:
- case 6:
- case 8:
- case 10:
- b.append('-');
- }
- int hex = mId[i] & 0xFF;
- b.append(kHexChars.charAt(hex >> 4));
- b.append(kHexChars.charAt(hex & 0x0f));
- }
- if (!sDescCaching)
- {
- return b.toString();
- }
- mDesc = b.toString();
- }
- return mDesc;
- }
-
- /**
- * Checking equality of UUIDs is easy; just compare the 128-bit number.
- */
- public final boolean equals(Object o)
- {
- if (!(o instanceof UUID))
- {
- return false;
- }
- byte[] otherId = ((UUID) o).mId;
- byte[] thisId = mId;
- for (int i = 0; i < 16; ++i)
- {
- if (otherId[i] != thisId[i])
- {
- return false;
- }
- }
- return true;
- }
-}
Deleted: trunk/src/main/org/jboss/messaging/util/UUIDGenerator.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/UUIDGenerator.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/UUIDGenerator.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,292 +0,0 @@
-/* JUG Java Uuid Generator
- *
- * Copyright (c) 2002- Tatu Saloranta, tatu.saloranta at iki.fi
- *
- * Licensed under the License specified in the file licenses/LICENSE.txt which is
- * included with the source code.
- * You may not use this file except in compliance with the License.
- *
- * 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.messaging.util;
-
-import java.lang.reflect.Method;
-import java.net.NetworkInterface;
-import java.security.SecureRandom;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.Random;
-
-import org.jboss.messaging.core.logging.Logger;
-
-public final class UUIDGenerator
-{
- private final static UUIDGenerator sSingleton = new UUIDGenerator();
-
- private static final Logger log = Logger.getLogger(UUIDGenerator.class);
-
- // Windows has some fake adapters that will return the same HARDWARE ADDRESS on any computer. We need to ignore those
- private static final byte[][] BLACK_LIST = new byte[][] { { 2, 0, 84, 85, 78, 1 } };
-
- /**
- * Random-generator, used by various UUID-generation methods:
- */
- private Random mRnd = null;
-
- private final Object mTimerLock = new Object();
-
- private UUIDTimer mTimer = null;
-
- private byte[] address;
-
- /**
- * Constructor is private to enforce singleton access.
- */
- private UUIDGenerator()
- {
- }
-
- /**
- * Method used for accessing the singleton generator instance.
- */
- public static UUIDGenerator getInstance()
- {
- return sSingleton;
- }
-
- /*
- * ///////////////////////////////////////////////////// // Configuration
- * /////////////////////////////////////////////////////
- */
-
- /**
- * Method for getting the shared random number generator used for generating
- * the UUIDs. This way the initialization cost is only taken once; access
- * need not be synchronized (or in cases where it has to, SecureRandom takes
- * care of it); it might even be good for getting really 'random' stuff to
- * get shared access...
- */
- public final Random getRandomNumberGenerator()
- {
- /*
- * Could be synchronized, but since side effects are trivial (ie.
- * possibility of generating more than one SecureRandom, of which all but
- * one are dumped) let's not add synchronization overhead:
- */
- if (mRnd == null)
- {
- mRnd = new SecureRandom();
- }
- return mRnd;
- }
-
- public final UUID generateTimeBasedUUID(final byte[] byteAddr)
- {
- byte[] contents = new byte[16];
- int pos = 10;
- for (int i = 0; i < 6; ++i)
- {
- contents[pos + i] = byteAddr[i];
- }
-
- synchronized (mTimerLock)
- {
- if (mTimer == null)
- {
- mTimer = new UUIDTimer(getRandomNumberGenerator());
- }
-
- mTimer.getTimestamp(contents);
- }
-
- return new UUID(UUID.TYPE_TIME_BASED, contents);
- }
-
- public final byte[] generateDummyAddress()
- {
- Random rnd = getRandomNumberGenerator();
- byte[] dummy = new byte[6];
- rnd.nextBytes(dummy);
- /* Need to set the broadcast bit to indicate it's not a real
- * address.
- */
- dummy[0] |= (byte)0x01;
-
- if (log.isDebugEnabled())
- {
- log.debug("using dummy address " + asString(dummy));
- }
- return dummy;
- }
-
- /**
- * If running java 6 or above, returns {@link NetworkInterface#getHardwareAddress()}, else return <code>null</code>.
- * The first hardware address is returned when iterating all the NetworkInterfaces
- */
- public final static byte[] getHardwareAddress()
- {
- Method getHardwareAddressMethod;
- Method isUpMethod;
- Method isLoopbackMethod;
- Method isVirtualMethod;
- try
- {
- getHardwareAddressMethod = NetworkInterface.class.getMethod("getHardwareAddress");
- isUpMethod = NetworkInterface.class.getMethod("isUp");
- isLoopbackMethod = NetworkInterface.class.getMethod("isLoopback");
- isVirtualMethod = NetworkInterface.class.getMethod("isVirtual");
- }
- catch (Throwable t)
- {
- // not on Java 6 or not enough security permission
- return null;
- }
-
- try
- {
- Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
- while (networkInterfaces.hasMoreElements())
- {
- NetworkInterface networkInterface = networkInterfaces.nextElement();
- boolean up = (Boolean)isUpMethod.invoke(networkInterface);
- boolean loopback = (Boolean)isLoopbackMethod.invoke(networkInterface);
- boolean virtual = (Boolean)isVirtualMethod.invoke(networkInterface);
-
- if (loopback || virtual || !up)
- {
- continue;
- }
-
- Object res = getHardwareAddressMethod.invoke(networkInterface);
- if (res != null && res instanceof byte[])
- {
- byte[] address = (byte[])res;
- byte[] paddedAddress = getZeroPaddedSixBytes(address);
-
- if (isBlackList(address))
- {
- continue;
- }
-
- if (paddedAddress != null)
- {
- if (log.isDebugEnabled())
- {
- log.debug("using hardware address " + asString(paddedAddress));
- }
- return paddedAddress;
- }
- }
- }
- }
- catch (Throwable t)
- {
- }
-
- return null;
- }
-
- public final SimpleString generateSimpleStringUUID()
- {
- return new SimpleString(generateStringUUID());
- }
-
- public final UUID generateUUID()
- {
- byte[] address = getAddressBytes();
-
- UUID uid = generateTimeBasedUUID(address);
-
- return uid;
- }
-
- public final String generateStringUUID()
- {
- byte[] address = getAddressBytes();
-
- if (address == null)
- {
- return java.util.UUID.randomUUID().toString();
- }
- else
- {
- return generateTimeBasedUUID(address).toString();
- }
- }
-
- public final static byte[] getZeroPaddedSixBytes(final byte[] bytes)
- {
- if (bytes == null)
- {
- return null;
- }
- if (bytes.length > 0 && bytes.length <= 6)
- {
- if (bytes.length == 6)
- {
- return bytes;
- }
- else
- {
- // pad with zeroes to have a 6-byte array
- byte[] paddedAddress = new byte[6];
- System.arraycopy(bytes, 0, paddedAddress, 0, bytes.length);
- for (int i = bytes.length; i < 6; i++)
- {
- paddedAddress[i] = 0;
- }
- return paddedAddress;
- }
- }
- return null;
- }
-
- // Private -------------------------------------------------------
-
- private static final boolean isBlackList(final byte[] address)
- {
- for (byte[] blackList : BLACK_LIST)
- {
- if (Arrays.equals(address, blackList))
- {
- return true;
- }
- }
- return false;
- }
-
- private final byte[] getAddressBytes()
- {
- if (address == null)
- {
- address = getHardwareAddress();
- if (address == null)
- {
- address = generateDummyAddress();
- }
- }
-
- return address;
- }
-
- private static final String asString(final byte[] bytes)
- {
- if (bytes == null)
- {
- return null;
- }
-
- String s = "";
- for (int i = 0; i < bytes.length - 1; i++)
- {
- s += Integer.toHexString(bytes[i]) + ":";
- }
- s += bytes[bytes.length - 1];
- return s;
- }
-}
\ No newline at end of file
Deleted: trunk/src/main/org/jboss/messaging/util/UUIDTimer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/UUIDTimer.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/UUIDTimer.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,317 +0,0 @@
-/* JUG Java Uuid Generator
- *
- * Copyright (c) 2002- Tatu Saloranta, tatu.saloranta at iki.fi
- *
- * Licensed under the License specified in the file licenses/LICENSE.txt which is
- * included with the source code.
- * You may not use this file except in compliance with the License.
- *
- * 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.messaging.util;
-
-import java.util.Random;
-
-/**
- * UUIDTimer produces the time stamps required for time-based UUIDs. It works as
- * outlined in the UUID specification, with following implementation:
- * <ul>
- * <li>Java classes can only product time stamps with maximum resolution of one
- * millisecond (at least before JDK 1.5). To compensate, an additional counter
- * is used, so that more than one UUID can be generated between java clock
- * updates. Counter may be used to generate up to 10000 UUIDs for each distrinct
- * java clock value.
- * <li>Due to even lower clock resolution on some platforms (older Windows
- * versions use 55 msec resolution), timestamp value can also advanced ahead of
- * physical value within limits (by default, up 100 millisecond ahead of
- * reported), iff necessary (ie. 10000 instances created before clock time
- * advances).
- * <li>As an additional precaution, counter is initialized not to 0 but to a
- * random 8-bit number, and each time clock changes, lowest 8-bits of counter
- * are preserved. The purpose it to make likelyhood of multi-JVM multi-instance
- * generators to collide, without significantly reducing max. UUID generation
- * speed. Note though that using more than one generator (from separate JVMs) is
- * strongly discouraged, so hopefully this enhancement isn't needed. This 8-bit
- * offset has to be reduced from total max. UUID count to preserve ordering
- * property of UUIDs (ie. one can see which UUID was generated first for given
- * UUID generator); the resulting 9500 UUIDs isn't much different from the
- * optimal choice.
- * <li>Finally, as of version 2.0 and onwards, optional external timestamp
- * synchronization can be done. This is done similar to the way UUID
- * specification suggests; except that since there is no way to lock the whole
- * system, file-based locking is used. This works between multiple JVMs and Jug
- * instances.
- * </ul>
- * <p>
- * Some additional assumptions about calculating the timestamp:
- * <ul>
- * <li>System.currentTimeMillis() is assumed to give time offset in UTC, or at
- * least close enough thing to get correct timestamps. The alternate route would
- * have to go through calendar object, use TimeZone offset to get to UTC, and
- * then modify. Using currentTimeMillis should be much faster to allow rapid
- * UUID creation.
- * <li>Similarly, the constant used for time offset between 1.1.1970 and start
- * of Gregorian calendar is assumed to be correct (which seems to be the case
- * when testing with Java calendars).
- * </ul>
- * <p>
- * Note about synchronization: this class is assumed to always be called from a
- * synchronized context (caller locks on either this object, or a similar timer
- * lock), and so has no method synchronization.
- */
-public class UUIDTimer
-{
- // // // Constants
-
- /**
- * Since System.longTimeMillis() returns time from january 1st 1970, and
- * UUIDs need time from the beginning of gregorian calendar (15-oct-1582),
- * need to apply the offset:
- */
- private final static long kClockOffset = 0x01b21dd213814000L;
- /**
- * Also, instead of getting time in units of 100nsecs, we get something with
- * max resolution of 1 msec... and need the multiplier as well
- */
- private final static long kClockMultiplier = 10000;
- private final static long kClockMultiplierL = 10000L;
-
- /**
- * Let's allow "virtual" system time to advance at most 100 milliseconds
- * beyond actual physical system time, before adding delays.
- */
- private final static long kMaxClockAdvance = 100L;
-
- // // // Configuration
-
- private final Random mRnd;
-
- // // // Clock state:
-
- /**
- * Additional state information used to protect against anomalous cases
- * (clock time going backwards, node id getting mixed up). Third byte is
- * actually used for seeding counter on counter overflow.
- */
- private final byte[] mClockSequence = new byte[3];
-
- /**
- * Last physical timestamp value <code>System.currentTimeMillis()</code>
- * returned: used to catch (and report) cases where system clock goes
- * backwards. Is also used to limit "drifting", that is, amount timestamps
- * used can differ from the system time value. This value is not guaranteed
- * to be monotonically increasing.
- */
- private long mLastSystemTimestamp = 0L;
-
- /**
- * Timestamp value last used for generating a UUID (along with
- * {@link #mClockCounter}. Usually the same as {@link #mLastSystemTimestamp},
- * but not always (system clock moved backwards). Note that this value is
- * guaranteed to be monotonically increasing; that is, at given absolute time
- * points t1 and t2 (where t2 is after t1), t1 <= t2 will always hold true.
- */
- private long mLastUsedTimestamp = 0L;
-
- /**
- * Counter used to compensate inadequate resolution of JDK system timer.
- */
- private int mClockCounter = 0;
-
- UUIDTimer(Random rnd)
- {
- mRnd = rnd;
- initCounters(rnd);
- mLastSystemTimestamp = 0L;
- // This may get overwritten by the synchronizer
- mLastUsedTimestamp = 0L;
- }
-
- private void initCounters(Random rnd)
- {
- /*
- * Let's generate the clock sequence field now; as with counter, this
- * reduces likelihood of collisions (as explained in UUID specs)
- */
- rnd.nextBytes(mClockSequence);
- /*
- * Ok, let's also initialize the counter... Counter is used to make it
- * slightly less likely that two instances of UUIDGenerator (from separate
- * JVMs as no more than one can be created in one JVM) would produce
- * colliding time-based UUIDs. The practice of using multiple generators,
- * is strongly discouraged, of course, but just in case...
- */
- mClockCounter = mClockSequence[2] & 0xFF;
- }
-
- public void getTimestamp(byte[] uuidData)
- {
- // First the clock sequence:
- uuidData[UUID.INDEX_CLOCK_SEQUENCE] = mClockSequence[0];
- uuidData[UUID.INDEX_CLOCK_SEQUENCE + 1] = mClockSequence[1];
-
- long systime = System.currentTimeMillis();
-
- /*
- * Let's first verify that the system time is not going backwards;
- * independent of whether we can use it:
- */
- if (systime < mLastSystemTimestamp)
- {
- // Logger.logWarning("System time going backwards! (got value
- // "+systime+", last "+mLastSystemTimestamp);
- // Let's write it down, still
- mLastSystemTimestamp = systime;
- }
-
- /*
- * But even without it going backwards, it may be less than the last one
- * used (when generating UUIDs fast with coarse clock resolution; or if
- * clock has gone backwards over reboot etc).
- */
- if (systime <= mLastUsedTimestamp)
- {
- /*
- * Can we just use the last time stamp (ok if the counter hasn't hit
- * max yet)
- */
- if (mClockCounter < kClockMultiplier)
- { // yup, still have room
- systime = mLastUsedTimestamp;
- } else
- { // nope, have to roll over to next value and maybe wait
- long actDiff = mLastUsedTimestamp - systime;
- long origTime = systime;
- systime = mLastUsedTimestamp + 1L;
-
- // Logger.logWarning("Timestamp over-run: need to reinitialize
- // random sequence");
-
- /*
- * Clock counter is now at exactly the multiplier; no use just
- * anding its value. So, we better get some random numbers
- * instead...
- */
- initCounters(mRnd);
-
- /*
- * But do we also need to slow down? (to try to keep virtual time
- * close to physical time; ie. either catch up when system clock has
- * been moved backwards, or when coarse clock resolution has forced
- * us to advance virtual timer too far)
- */
- if (actDiff >= kMaxClockAdvance)
- {
- slowDown(origTime, actDiff);
- }
- }
- } else
- {
- /*
- * Clock has advanced normally; just need to make sure counter is reset
- * to a low value (need not be 0; good to leave a small residual to
- * further decrease collisions)
- */
- mClockCounter &= 0xFF;
- }
-
- mLastUsedTimestamp = systime;
-
- /*
- * Now, let's translate the timestamp to one UUID needs, 100ns unit offset
- * from the beginning of Gregorian calendar...
- */
- systime *= kClockMultiplierL;
- systime += kClockOffset;
-
- // Plus add the clock counter:
- systime += mClockCounter;
- // and then increase
- ++mClockCounter;
-
- /*
- * Time fields are nicely split across the UUID, so can't just linearly
- * dump the stamp:
- */
- int clockHi = (int) (systime >>> 32);
- int clockLo = (int) systime;
-
- uuidData[UUID.INDEX_CLOCK_HI] = (byte) (clockHi >>> 24);
- uuidData[UUID.INDEX_CLOCK_HI + 1] = (byte) (clockHi >>> 16);
- uuidData[UUID.INDEX_CLOCK_MID] = (byte) (clockHi >>> 8);
- uuidData[UUID.INDEX_CLOCK_MID + 1] = (byte) clockHi;
-
- uuidData[UUID.INDEX_CLOCK_LO] = (byte) (clockLo >>> 24);
- uuidData[UUID.INDEX_CLOCK_LO + 1] = (byte) (clockLo >>> 16);
- uuidData[UUID.INDEX_CLOCK_LO + 2] = (byte) (clockLo >>> 8);
- uuidData[UUID.INDEX_CLOCK_LO + 3] = (byte) clockLo;
- }
-
- /*
- * /////////////////////////////////////////////////////////// // Private
- * methods ///////////////////////////////////////////////////////////
- */
-
- private final static int MAX_WAIT_COUNT = 50;
-
- /**
- * Simple utility method to use to wait for couple of milliseconds, to let
- * system clock hopefully advance closer to the virtual timestamps used.
- * Delay is kept to just a millisecond or two, to prevent excessive blocking;
- * but that should be enough to eventually synchronize physical clock with
- * virtual clock values used for UUIDs.
- *
- * @param msecs
- * Number of milliseconds to wait for from current time point
- */
- private final static void slowDown(long startTime, long actDiff)
- {
- /*
- * First, let's determine how long we'd like to wait. This is based on how
- * far ahead are we as of now.
- */
- long ratio = actDiff / kMaxClockAdvance;
- long delay;
-
- if (ratio < 2L)
- { // 200 msecs or less
- delay = 1L;
- } else if (ratio < 10L)
- { // 1 second or less
- delay = 2L;
- } else if (ratio < 600L)
- { // 1 minute or less
- delay = 3L;
- } else
- {
- delay = 5L;
- }
- // Logger.logWarning("Need to wait for "+delay+" milliseconds; virtual
- // clock advanced too far in the future");
- long waitUntil = startTime + delay;
- int counter = 0;
- do
- {
- try
- {
- Thread.sleep(delay);
- } catch (InterruptedException ie)
- {
- }
- delay = 1L;
- /*
- * This is just a sanity check: don't want an "infinite" loop if clock
- * happened to be moved backwards by, say, an hour...
- */
- if (++counter > MAX_WAIT_COUNT)
- {
- break;
- }
- } while (System.currentTimeMillis() < waitUntil);
- }
-}
Deleted: trunk/src/main/org/jboss/messaging/util/VariableLatch.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/VariableLatch.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/VariableLatch.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,127 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.AbstractQueuedSynchronizer;
-
-/**
- *
- * <p>This class will use the framework provided to by AbstractQueuedSynchronizer.</p>
- * <p>AbstractQueuedSynchronizer is the framework for any sort of concurrent synchronization, such as Semaphores, events, etc, based on AtomicIntegers.</p>
- *
- * <p>The idea is, instead of providing each user specific Latch/Synchronization, java.util.concurrent provides the framework for reuses, based on an AtomicInteger (getState())</p>
- *
- * <p>On JBossMessaging we have the requirement of increment and decrement a counter until the user fires a ready event (commit). At that point we just act as a regular countDown.</p>
- *
- * <p>Note: This latch is reusable. Once it reaches zero, you can call up again, and reuse it on further waits.</p>
- *
- * <p>For example: prepareTransaction will wait for the current completions, and further adds will be called on the latch. Later on when commit is called you can reuse the same latch.</p>
- *
- * @author Clebert Suconic
- * */
-public class VariableLatch
-{
- /**
- * Look at the doc and examples provided by AbstractQueuedSynchronizer for more information
- * @see AbstractQueuedSynchronizer*/
- @SuppressWarnings("serial")
- private static class CountSync extends AbstractQueuedSynchronizer
- {
- public CountSync()
- {
- setState(0);
- }
-
- public int getCount()
- {
- return getState();
- }
-
- @Override
- public int tryAcquireShared(final int numberOfAqcquires)
- {
- return getState() == 0 ? 1 : -1;
- }
-
- public void add()
- {
- for (;;)
- {
- int actualState = getState();
- int newState = actualState + 1;
- if (compareAndSetState(actualState, newState))
- {
- return;
- }
- }
- }
-
- @Override
- public boolean tryReleaseShared(final int numberOfReleases)
- {
- for (;;)
- {
- int actualState = getState();
- if (actualState == 0)
- {
- return true;
- }
-
- int newState = actualState - numberOfReleases;
-
- if (compareAndSetState(actualState, newState))
- {
- return newState == 0;
- }
- }
- }
- }
-
- private final CountSync control = new CountSync();
-
- public int getCount()
- {
- return control.getCount();
- }
-
- public void up()
- {
- control.add();
- }
-
- public void down()
- {
- control.releaseShared(1);
- }
-
- public void waitCompletion() throws InterruptedException
- {
- control.acquireSharedInterruptibly(1);
- }
-
- public boolean waitCompletion(final long milliseconds) throws InterruptedException
- {
- return control.tryAcquireSharedNanos(1, TimeUnit.MILLISECONDS.toNanos(milliseconds));
- }
-}
Deleted: trunk/src/main/org/jboss/messaging/util/VersionLoader.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/VersionLoader.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/VersionLoader.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,115 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.version.Version;
-import org.jboss.messaging.core.version.impl.VersionImpl;
-
-/**
- * This loads the version info in from a version.properties file.
- *
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
- * @author <a href="csuconic at redhat.com">Clebert Suconic</a>
- */
-public class VersionLoader
-{
-
- private static final Logger log = Logger.getLogger(VersionLoader.class);
-
-
- private static Version version;
-
- static
- {
- try
- {
- version = load();
- }
- catch (Throwable e)
- {
- version = null;
- log.error(e.getMessage(), e);
- }
-
- }
-
- public static Version getVersion()
- {
- if (version == null)
- {
- throw new RuntimeException("version.properties is not available");
- }
-
- return version;
- }
-
- private static Version load()
- {
- Properties versionProps = new Properties();
- InputStream in = VersionImpl.class.getClassLoader().getResourceAsStream("version.properties");
- try
- {
- if (in == null)
- {
- throw new RuntimeException("version.properties is not available");
- }
- try
- {
- versionProps.load(in);
- String versionName = versionProps.getProperty("messaging.version.versionName");
- int majorVersion = Integer.valueOf(versionProps.getProperty("messaging.version.majorVersion"));
- int minorVersion = Integer.valueOf(versionProps.getProperty("messaging.version.minorVersion"));
- int microVersion = Integer.valueOf(versionProps.getProperty("messaging.version.microVersion"));
- int incrementingVersion = Integer.valueOf(versionProps.getProperty("messaging.version.incrementingVersion"));
- String versionSuffix = versionProps.getProperty("messaging.version.versionSuffix");
- return new VersionImpl(versionName,
- majorVersion,
- minorVersion,
- microVersion,
- incrementingVersion,
- versionSuffix);
- }
- catch (IOException e)
- {
- //if we get here then the messaging hasnt been built properly and the version.properties is skewed in some way
- throw new RuntimeException("unable to load version.properties", e);
- }
- }
- finally
- {
- try
- {
- in.close();
- }
- catch (Throwable ignored)
- {
- }
- }
-
- }
-}
Deleted: trunk/src/main/org/jboss/messaging/util/XMLUtil.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/XMLUtil.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/src/main/org/jboss/messaging/util/XMLUtil.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -1,534 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.util;
-
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.StringReader;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Properties;
-
-import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import javax.xml.validation.Validator;
-
-import org.jboss.messaging.core.logging.Logger;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- * $Id$
- */
-public class XMLUtil
-{
- // Constants ------------------------------------------------------------------------------------
-
- private static final Logger log = Logger.getLogger(XMLUtil.class);
-
- // Static ---------------------------------------------------------------------------------------
-
- public static Element stringToElement(String s) throws Exception
- {
- return readerToElement(new StringReader(s));
- }
-
- public static Element urlToElement(URL url) throws Exception
- {
- return readerToElement(new InputStreamReader(url.openStream()));
- }
-
- public static String readerToString(Reader r) throws Exception
- {
- // Read into string
- StringBuffer buff = new StringBuffer();
- int c;
- while ((c = r.read()) != -1)
- {
- buff.append((char)c);
- }
- return buff.toString();
- }
-
- public static Element readerToElement(Reader r) throws Exception
- {
- // Read into string
- StringBuffer buff = new StringBuffer();
- int c;
- while ((c = r.read()) != -1)
- {
- buff.append((char)c);
- }
-
- // Quick hardcoded replace, FIXME this is a kludge - use regexp to match properly
- String s = buff.toString();
- s = doReplace(s, "jboss.messaging.groupname", "MessagingPostOffice");
- s = doReplace(s, "jboss.messaging.datachanneludpaddress", "228.6.6.6");
- s = doReplace(s, "jboss.messaging.controlchanneludpaddress", "228.7.7.7");
- s = doReplace(s, "jboss.messaging.datachanneludpport", "45567");
- s = doReplace(s, "jboss.messaging.controlchanneludpport", "45568");
- s = doReplace(s, "jboss.messaging.ipttl", "2");
- s = doReplace(s, "jboss.messaging.ipttl", "8");
-
- StringReader sreader = new StringReader(s);
-
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- // see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6529766
- factory.setNamespaceAware(true);
- DocumentBuilder parser = factory.newDocumentBuilder();
- Document doc = parser.parse(new InputSource(sreader));
- return doc.getDocumentElement();
- }
-
- public static String elementToString(Node n)
- {
-
- String name = n.getNodeName();
-
- short type = n.getNodeType();
-
- if (Node.CDATA_SECTION_NODE == type)
- {
- return "<![CDATA[" + n.getNodeValue() + "]]>";
- }
-
- if (name.startsWith("#"))
- {
- return "";
- }
-
- StringBuffer sb = new StringBuffer();
- sb.append('<').append(name);
-
- NamedNodeMap attrs = n.getAttributes();
- if (attrs != null)
- {
- for (int i = 0; i < attrs.getLength(); i++)
- {
- Node attr = attrs.item(i);
- sb.append(' ').append(attr.getNodeName()).append("=\"").append(attr.getNodeValue()).append("\"");
- }
- }
-
- String textContent = null;
- NodeList children = n.getChildNodes();
-
- if (children.getLength() == 0)
- {
- if ((textContent = XMLUtil.getTextContent(n)) != null && !"".equals(textContent))
- {
- sb.append(textContent).append("</").append(name).append('>');;
- }
- else
- {
- sb.append("/>").append('\n');
- }
- }
- else
- {
- sb.append('>').append('\n');
- boolean hasValidChildren = false;
- for (int i = 0; i < children.getLength(); i++)
- {
- String childToString = elementToString(children.item(i));
- if (!"".equals(childToString))
- {
- sb.append(childToString);
- hasValidChildren = true;
- }
- }
-
- if (!hasValidChildren && ((textContent = XMLUtil.getTextContent(n)) != null))
- {
- sb.append(textContent);
- }
-
- sb.append("</").append(name).append('>');
- }
-
- return sb.toString();
- }
-
- private static final Object[] EMPTY_ARRAY = new Object[0];
-
- /**
- * This metod is here because Node.getTextContent() is not available in JDK 1.4 and I would like
- * to have an uniform access to this functionality.
- *
- * Note: if the content is another element or set of elements, it returns a string representation
- * of the hierarchy.
- *
- * TODO implementation of this method is a hack. Implement it properly.
- */
- public static String getTextContent(Node n)
- {
- if (n.hasChildNodes())
- {
- StringBuffer sb = new StringBuffer();
- NodeList nl = n.getChildNodes();
- for (int i = 0; i < nl.getLength(); i++)
- {
- sb.append(XMLUtil.elementToString(nl.item(i)));
- if (i < nl.getLength() - 1)
- {
- sb.append('\n');
- }
- }
-
- String s = sb.toString();
- if (s.length() != 0)
- {
- return s;
- }
- }
-
- Method[] methods = Node.class.getMethods();
-
- for (int i = 0; i < methods.length; i++)
- {
- if ("getTextContent".equals(methods[i].getName()))
- {
- Method getTextContext = methods[i];
- try
- {
- return (String)getTextContext.invoke(n, EMPTY_ARRAY);
- }
- catch (Exception e)
- {
- log.error("Failed to invoke getTextContent() on node " + n, e);
- return null;
- }
- }
- }
-
- String textContent = null;
-
- if (n.hasChildNodes())
- {
- NodeList nl = n.getChildNodes();
- for (int i = 0; i < nl.getLength(); i++)
- {
- Node c = nl.item(i);
- if (c.getNodeType() == Node.TEXT_NODE)
- {
- textContent = n.getNodeValue();
- if (textContent == null)
- {
- // TODO This is a hack. Get rid of it and implement this properly
- String s = c.toString();
- int idx = s.indexOf("#text:");
- if (idx != -1)
- {
- textContent = s.substring(idx + 6).trim();
- if (textContent.endsWith("]"))
- {
- textContent = textContent.substring(0, textContent.length() - 1);
- }
- }
- }
- if (textContent == null)
- {
- break;
- }
- }
- }
-
- // TODO This is a hack. Get rid of it and implement this properly
- String s = n.toString();
- int i = s.indexOf('>');
- int i2 = s.indexOf("</");
- if (i != -1 && i2 != -1)
- {
- textContent = s.substring(i + 1, i2);
- }
- }
-
- return textContent;
- }
-
- public static void assertEquivalent(Node node, Node node2)
- {
- if (node == null)
- {
- throw new IllegalArgumentException("the first node to be compared is null");
- }
-
- if (node2 == null)
- {
- throw new IllegalArgumentException("the second node to be compared is null");
- }
-
- if (!node.getNodeName().equals(node2.getNodeName()))
- {
- throw new IllegalArgumentException("nodes have different node names");
- }
-
- int attrCount = 0;
- NamedNodeMap attrs = node.getAttributes();
- if (attrs != null)
- {
- attrCount = attrs.getLength();
- }
-
- int attrCount2 = 0;
- NamedNodeMap attrs2 = node2.getAttributes();
- if (attrs2 != null)
- {
- attrCount2 = attrs2.getLength();
- }
-
- if (attrCount != attrCount2)
- {
- throw new IllegalArgumentException("nodes hava a different number of attributes");
- }
-
- outer: for (int i = 0; i < attrCount; i++)
- {
- Node n = attrs.item(i);
- String name = n.getNodeName();
- String value = n.getNodeValue();
-
- for (int j = 0; j < attrCount; j++)
- {
- Node n2 = attrs2.item(j);
- String name2 = n2.getNodeName();
- String value2 = n2.getNodeValue();
-
- if (name.equals(name2) && value.equals(value2))
- {
- continue outer;
- }
- }
- throw new IllegalArgumentException("attribute " + name + "=" + value + " doesn't match");
- }
-
- boolean hasChildren = node.hasChildNodes();
-
- if (hasChildren != node2.hasChildNodes())
- {
- throw new IllegalArgumentException("one node has children and the other doesn't");
- }
-
- if (hasChildren)
- {
- NodeList nl = node.getChildNodes();
- NodeList nl2 = node2.getChildNodes();
-
- short[] toFilter = new short[] { Node.TEXT_NODE, Node.ATTRIBUTE_NODE, Node.COMMENT_NODE };
- List nodes = filter(nl, toFilter);
- List nodes2 = filter(nl2, toFilter);
-
- int length = nodes.size();
-
- if (length != nodes2.size())
- {
- throw new IllegalArgumentException("nodes hava a different number of children");
- }
-
- for (int i = 0; i < length; i++)
- {
- Node n = (Node)nodes.get(i);
- Node n2 = (Node)nodes2.get(i);
- assertEquivalent(n, n2);
- }
- }
- }
-
- public static String stripCDATA(String s)
- {
- s = s.trim();
- if (s.startsWith("<![CDATA["))
- {
- s = s.substring(9);
- int i = s.indexOf("]]>");
- if (i == -1)
- {
- throw new IllegalStateException("argument starts with <![CDATA[ but cannot find pairing ]]>");
- }
- s = s.substring(0, i);
- }
- return s;
- }
-
- public static String replaceSystemProps(String xml)
- {
- Properties properties = System.getProperties();
- Enumeration e = properties.propertyNames();
- while (e.hasMoreElements())
- {
- String key = (String)e.nextElement();
- String s = "${" + key + "}";
- if (xml.contains(s))
- {
- xml = xml.replace(s, properties.getProperty(key));
- }
-
- }
- return xml;
- }
-
- public static long parseLong(final Node elem)
- {
- String value = elem.getTextContent().trim();
-
- try
- {
- return Long.parseLong(value);
- }
- catch (NumberFormatException e)
- {
- throw new IllegalArgumentException("Element " + elem +
- " requires a valid Long value, but '" +
- value +
- "' cannot be parsed as a Long");
- }
- }
-
- public static int parseInt(final Node elem)
- {
- String value = elem.getTextContent().trim();
-
- try
- {
- return Integer.parseInt(value);
- }
- catch (NumberFormatException e)
- {
- throw new IllegalArgumentException("Element " + elem +
- " requires a valid Integer value, but '" +
- value +
- "' cannot be parsed as an Integer");
- }
- }
-
- public static boolean parseBoolean(final Node elem)
- {
- String value = elem.getTextContent().trim();
-
- try
- {
- return Boolean.parseBoolean(value);
- }
- catch (NumberFormatException e)
- {
- throw new IllegalArgumentException("Element " + elem +
- " requires a valid Boolean value, but '" +
- value +
- "' cannot be parsed as a Boolean");
- }
- }
-
- public static double parseDouble(final Node elem)
- {
- String value = elem.getTextContent().trim();
-
- try
- {
- return Double.parseDouble(value);
- }
- catch (NumberFormatException e)
- {
- throw new IllegalArgumentException("Element " + elem +
- " requires a valid Double value, but '" +
- value +
- "' cannot be parsed as a Double");
- }
- }
-
- public static void validate(Node node, String schemaFile) throws Exception
- {
- SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- Schema schema = factory.newSchema(Thread.currentThread().getContextClassLoader().getResource(schemaFile));
- Validator validator = schema.newValidator();
-
- // validate the DOM tree
- try
- {
- validator.validate(new DOMSource(node));
- }
- catch (SAXException e)
- {
- throw new IllegalStateException("Invalid configuration", e);
- }
- }
-
- // Attributes -----------------------------------------------------------------------------------
-
- // Constructors ---------------------------------------------------------------------------------
-
- // Public ---------------------------------------------------------------------------------------
-
- // Package protected ----------------------------------------------------------------------------
-
- // Protected ------------------------------------------------------------------------------------
-
- // Private --------------------------------------------------------------------------------------
-
- private static List filter(NodeList nl, short[] typesToFilter)
- {
- List nodes = new ArrayList();
-
- outer: for (int i = 0; i < nl.getLength(); i++)
- {
- Node n = nl.item(i);
- short type = n.getNodeType();
- for (int j = 0; j < typesToFilter.length; j++)
- {
- if (typesToFilter[j] == type)
- {
- continue outer;
- }
- }
- nodes.add(n);
- }
- return nodes;
- }
-
- // Quick dirty replace - use a reg exp to use true default value
- private static String doReplace(String s, String propertyName, String defaultValue)
- {
- String sysProp = System.getProperty(propertyName);
-
- s = s.replace("${" + propertyName + ":" + defaultValue + "}", sysProp == null ? defaultValue : sysProp);
-
- return s;
- }
-
- // Inner classes --------------------------------------------------------------------------------
-
-}
Copied: trunk/src/main/org/jboss/messaging/utils/Base64.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/Base64.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/Base64.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/Base64.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,1809 @@
+package org.jboss.messaging.utils;
+
+/**
+ * <p>Encodes and decodes to and from Base64 notation.</p>
+ * <p>Homepage: <a href="http://iharder.net/base64">http://iharder.net/base64</a>.</p>
+ *
+ * <p>The <tt>options</tt> parameter, which appears in a few places, is used to pass
+ * several pieces of information to the encoder. In the "higher level" methods such as
+ * encodeBytes( bytes, options ) the options parameter can be used to indicate such
+ * things as first gzipping the bytes before encoding them, not inserting linefeeds
+ * (though that breaks strict Base64 compatibility), and encoding using the URL-safe
+ * and Ordered dialects.</p>
+ *
+ * <p>The constants defined in Base64 can be OR-ed together to combine options, so you
+ * might make a call like this:</p>
+ *
+ * <code>String encoded = Base64.encodeBytes( mybytes, Base64.GZIP | Base64.DONT_BREAK_LINES );</code>
+ *
+ * <p>to compress the data before encoding it and then making the output have no newline characters.</p>
+ *
+ *
+ * <p>
+ * Change Log:
+ * </p>
+ * <ul>
+ * <li>v2.2.2 - Fixed encodeFileToFile and decodeFileToFile to use the
+ * Base64.InputStream class to encode and decode on the fly which uses
+ * less memory than encoding/decoding an entire file into memory before writing.</li>
+ * <li>v2.2.1 - Fixed bug using URL_SAFE and ORDERED encodings. Fixed bug
+ * when using very small files (~< 40 bytes).</li>
+ * <li>v2.2 - Added some helper methods for encoding/decoding directly from
+ * one file to the next. Also added a main() method to support command line
+ * encoding/decoding from one file to the next. Also added these Base64 dialects:
+ * <ol>
+ * <li>The default is RFC3548 format.</li>
+ * <li>Calling Base64.setFormat(Base64.BASE64_FORMAT.URLSAFE_FORMAT) generates
+ * URL and file name friendly format as described in Section 4 of RFC3548.
+ * http://www.faqs.org/rfcs/rfc3548.html</li>
+ * <li>Calling Base64.setFormat(Base64.BASE64_FORMAT.ORDERED_FORMAT) generates
+ * URL and file name friendly format that preserves lexical ordering as described
+ * in http://www.faqs.org/qa/rfcc-1940.html</li>
+ * </ol>
+ * Special thanks to Jim Kellerman at <a href="http://www.powerset.com/">http://www.powerset.com/</a>
+ * for contributing the new Base64 dialects.
+ * </li>
+ *
+ * <li>v2.1 - Cleaned up javadoc comments and unused variables and methods. Added
+ * some convenience methods for reading and writing to and from files.</li>
+ * <li>v2.0.2 - Now specifies UTF-8 encoding in places where the code fails on systems
+ * with other encodings (like EBCDIC).</li>
+ * <li>v2.0.1 - Fixed an error when decoding a single byte, that is, when the
+ * encoded data was a single byte.</li>
+ * <li>v2.0 - I got rid of methods that used booleans to set options.
+ * Now everything is more consolidated and cleaner. The code now detects
+ * when data that's being decoded is gzip-compressed and will decompress it
+ * automatically. Generally things are cleaner. You'll probably have to
+ * change some method calls that you were making to support the new
+ * options format (<tt>int</tt>s that you "OR" together).</li>
+ * <li>v1.5.1 - Fixed bug when decompressing and decoding to a
+ * byte[] using <tt>decode( String s, boolean gzipCompressed )</tt>.
+ * Added the ability to "suspend" encoding in the Output Stream so
+ * you can turn on and off the encoding if you need to embed base64
+ * data in an otherwise "normal" stream (like an XML file).</li>
+ * <li>v1.5 - Output stream pases on flush() command but doesn't do anything itself.
+ * This helps when using GZIP streams.
+ * Added the ability to GZip-compress objects before encoding them.</li>
+ * <li>v1.4 - Added helper methods to read/write files.</li>
+ * <li>v1.3.6 - Fixed OutputStream.flush() so that 'position' is reset.</li>
+ * <li>v1.3.5 - Added flag to turn on and off line breaks. Fixed bug in input stream
+ * where last buffer being read, if not completely full, was not returned.</li>
+ * <li>v1.3.4 - Fixed when "improperly padded stream" error was thrown at the wrong time.</li>
+ * <li>v1.3.3 - Fixed I/O streams which were totally messed up.</li>
+ * </ul>
+ *
+ * <p>
+ * I am placing this code in the Public Domain. Do with it as you will.
+ * This software comes with no guarantees or warranties but with
+ * plenty of well-wishing instead!
+ * Please visit <a href="http://iharder.net/base64">http://iharder.net/base64</a>
+ * periodically to check for updates or to contribute improvements.
+ * </p>
+ *
+ * @author Robert Harder
+ * @author rob at iharder.net
+ * @version 2.2.2
+ */
+public class Base64
+{
+
+/* ******** P U B L I C F I E L D S ******** */
+
+
+ /** No options specified. Value is zero. */
+ public final static int NO_OPTIONS = 0;
+
+ /** Specify encoding. */
+ public final static int ENCODE = 1;
+
+
+ /** Specify decoding. */
+ public final static int DECODE = 0;
+
+
+ /** Specify that data should be gzip-compressed. */
+ public final static int GZIP = 2;
+
+
+ /** Don't break lines when encoding (violates strict Base64 specification) */
+ public final static int DONT_BREAK_LINES = 8;
+
+ /**
+ * Encode using Base64-like encoding that is URL- and Filename-safe as described
+ * in Section 4 of RFC3548:
+ * <a href="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs.org/rfcs/rfc3548.html</a>.
+ * It is important to note that data encoded this way is <em>not</em> officially valid Base64,
+ * or at the very least should not be called Base64 without also specifying that is
+ * was encoded using the URL- and Filename-safe dialect.
+ */
+ public final static int URL_SAFE = 16;
+
+
+ /**
+ * Encode using the special "ordered" dialect of Base64 described here:
+ * <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.
+ */
+ public final static int ORDERED = 32;
+
+
+/* ******** P R I V A T E F I E L D S ******** */
+
+
+ /** Maximum line length (76) of Base64 output. */
+ private final static int MAX_LINE_LENGTH = 76;
+
+
+ /** The equals sign (=) as a byte. */
+ private final static byte EQUALS_SIGN = (byte)'=';
+
+
+ /** The new line character (\n) as a byte. */
+ private final static byte NEW_LINE = (byte)'\n';
+
+
+ /** Preferred encoding. */
+ private final static String PREFERRED_ENCODING = "UTF-8";
+
+
+ // I think I end up not using the BAD_ENCODING indicator.
+ //private final static byte BAD_ENCODING = -9; // Indicates error in encoding
+ private final static byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding
+ private final static byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding
+
+
+/* ******** S T A N D A R D B A S E 6 4 A L P H A B E T ******** */
+
+ /** The 64 valid Base64 values. */
+ //private final static byte[] ALPHABET;
+ /* Host platform me be something funny like EBCDIC, so we hardcode these values. */
+ private final static byte[] _STANDARD_ALPHABET =
+ {
+ (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
+ (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
+ (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
+ (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
+ (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
+ (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
+ (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
+ (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z',
+ (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5',
+ (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/'
+ };
+
+
+ /**
+ * Translates a Base64 value to either its 6-bit reconstruction value
+ * or a negative number indicating some other meaning.
+ **/
+ private final static byte[] _STANDARD_DECODABET =
+ {
+ -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
+ -5,-5, // Whitespace: Tab and Linefeed
+ -9,-9, // Decimal 11 - 12
+ -5, // Whitespace: Carriage Return
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26
+ -9,-9,-9,-9,-9, // Decimal 27 - 31
+ -5, // Whitespace: Space
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42
+ 62, // Plus sign at decimal 43
+ -9,-9,-9, // Decimal 44 - 46
+ 63, // Slash at decimal 47
+ 52,53,54,55,56,57,58,59,60,61, // Numbers zero through nine
+ -9,-9,-9, // Decimal 58 - 60
+ -1, // Equals sign at decimal 61
+ -9,-9,-9, // Decimal 62 - 64
+ 0,1,2,3,4,5,6,7,8,9,10,11,12,13, // Letters 'A' through 'N'
+ 14,15,16,17,18,19,20,21,22,23,24,25, // Letters 'O' through 'Z'
+ -9,-9,-9,-9,-9,-9, // Decimal 91 - 96
+ 26,27,28,29,30,31,32,33,34,35,36,37,38, // Letters 'a' through 'm'
+ 39,40,41,42,43,44,45,46,47,48,49,50,51, // Letters 'n' through 'z'
+ -9,-9,-9,-9 // Decimal 123 - 126
+ /*,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 127 - 139
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */
+ };
+
+
+/* ******** U R L S A F E B A S E 6 4 A L P H A B E T ******** */
+
+ /**
+ * Used in the URL- and Filename-safe dialect described in Section 4 of RFC3548:
+ * <a href="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs.org/rfcs/rfc3548.html</a>.
+ * Notice that the last two bytes become "hyphen" and "underscore" instead of "plus" and "slash."
+ */
+ private final static byte[] _URL_SAFE_ALPHABET =
+ {
+ (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
+ (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
+ (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
+ (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
+ (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
+ (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
+ (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
+ (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z',
+ (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5',
+ (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'-', (byte)'_'
+ };
+
+ /**
+ * Used in decoding URL- and Filename-safe dialects of Base64.
+ */
+ private final static byte[] _URL_SAFE_DECODABET =
+ {
+ -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
+ -5,-5, // Whitespace: Tab and Linefeed
+ -9,-9, // Decimal 11 - 12
+ -5, // Whitespace: Carriage Return
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26
+ -9,-9,-9,-9,-9, // Decimal 27 - 31
+ -5, // Whitespace: Space
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42
+ -9, // Plus sign at decimal 43
+ -9, // Decimal 44
+ 62, // Minus sign at decimal 45
+ -9, // Decimal 46
+ -9, // Slash at decimal 47
+ 52,53,54,55,56,57,58,59,60,61, // Numbers zero through nine
+ -9,-9,-9, // Decimal 58 - 60
+ -1, // Equals sign at decimal 61
+ -9,-9,-9, // Decimal 62 - 64
+ 0,1,2,3,4,5,6,7,8,9,10,11,12,13, // Letters 'A' through 'N'
+ 14,15,16,17,18,19,20,21,22,23,24,25, // Letters 'O' through 'Z'
+ -9,-9,-9,-9, // Decimal 91 - 94
+ 63, // Underscore at decimal 95
+ -9, // Decimal 96
+ 26,27,28,29,30,31,32,33,34,35,36,37,38, // Letters 'a' through 'm'
+ 39,40,41,42,43,44,45,46,47,48,49,50,51, // Letters 'n' through 'z'
+ -9,-9,-9,-9 // Decimal 123 - 126
+ /*,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 127 - 139
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */
+ };
+
+
+
+/* ******** O R D E R E D B A S E 6 4 A L P H A B E T ******** */
+
+ /**
+ * I don't get the point of this technique, but it is described here:
+ * <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.
+ */
+ private final static byte[] _ORDERED_ALPHABET =
+ {
+ (byte)'-',
+ (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4',
+ (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9',
+ (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
+ (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
+ (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
+ (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
+ (byte)'_',
+ (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
+ (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
+ (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
+ (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z'
+ };
+
+ /**
+ * Used in decoding the "ordered" dialect of Base64.
+ */
+ private final static byte[] _ORDERED_DECODABET =
+ {
+ -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
+ -5,-5, // Whitespace: Tab and Linefeed
+ -9,-9, // Decimal 11 - 12
+ -5, // Whitespace: Carriage Return
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26
+ -9,-9,-9,-9,-9, // Decimal 27 - 31
+ -5, // Whitespace: Space
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42
+ -9, // Plus sign at decimal 43
+ -9, // Decimal 44
+ 0, // Minus sign at decimal 45
+ -9, // Decimal 46
+ -9, // Slash at decimal 47
+ 1,2,3,4,5,6,7,8,9,10, // Numbers zero through nine
+ -9,-9,-9, // Decimal 58 - 60
+ -1, // Equals sign at decimal 61
+ -9,-9,-9, // Decimal 62 - 64
+ 11,12,13,14,15,16,17,18,19,20,21,22,23, // Letters 'A' through 'M'
+ 24,25,26,27,28,29,30,31,32,33,34,35,36, // Letters 'N' through 'Z'
+ -9,-9,-9,-9, // Decimal 91 - 94
+ 37, // Underscore at decimal 95
+ -9, // Decimal 96
+ 38,39,40,41,42,43,44,45,46,47,48,49,50, // Letters 'a' through 'm'
+ 51,52,53,54,55,56,57,58,59,60,61,62,63, // Letters 'n' through 'z'
+ -9,-9,-9,-9 // Decimal 123 - 126
+ /*,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 127 - 139
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
+ -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */
+ };
+
+
+/* ******** D E T E R M I N E W H I C H A L H A B E T ******** */
+
+
+ /**
+ * Returns one of the _SOMETHING_ALPHABET byte arrays depending on
+ * the options specified.
+ * It's possible, though silly, to specify ORDERED and URLSAFE
+ * in which case one of them will be picked, though there is
+ * no guarantee as to which one will be picked.
+ */
+ private final static byte[] getAlphabet( int options )
+ {
+ if( (options & URL_SAFE) == URL_SAFE ) return _URL_SAFE_ALPHABET;
+ else if( (options & ORDERED) == ORDERED ) return _ORDERED_ALPHABET;
+ else return _STANDARD_ALPHABET;
+
+ } // end getAlphabet
+
+
+ /**
+ * Returns one of the _SOMETHING_DECODABET byte arrays depending on
+ * the options specified.
+ * It's possible, though silly, to specify ORDERED and URL_SAFE
+ * in which case one of them will be picked, though there is
+ * no guarantee as to which one will be picked.
+ */
+ private final static byte[] getDecodabet( int options )
+ {
+ if( (options & URL_SAFE) == URL_SAFE ) return _URL_SAFE_DECODABET;
+ else if( (options & ORDERED) == ORDERED ) return _ORDERED_DECODABET;
+ else return _STANDARD_DECODABET;
+
+ } // end getAlphabet
+
+
+
+ /** Defeats instantiation. */
+ private Base64(){}
+
+
+ /**
+ * Encodes or decodes two files from the command line;
+ * <strong>feel free to delete this method (in fact you probably should)
+ * if you're embedding this code into a larger program.</strong>
+ */
+ public final static void main( String[] args )
+ {
+ if( args.length < 3 ){
+ usage("Not enough arguments.");
+ } // end if: args.length < 3
+ else {
+ String flag = args[0];
+ String infile = args[1];
+ String outfile = args[2];
+ if( flag.equals( "-e" ) ){
+ Base64.encodeFileToFile( infile, outfile );
+ } // end if: encode
+ else if( flag.equals( "-d" ) ) {
+ Base64.decodeFileToFile( infile, outfile );
+ } // end else if: decode
+ else {
+ usage( "Unknown flag: " + flag );
+ } // end else
+ } // end else
+ } // end main
+
+ /**
+ * Prints command line usage.
+ *
+ * @param msg A message to include with usage info.
+ */
+ private final static void usage( String msg )
+ {
+ System.err.println( msg );
+ System.err.println( "Usage: java Base64 -e|-d inputfile outputfile" );
+ } // end usage
+
+
+/* ******** E N C O D I N G M E T H O D S ******** */
+
+
+ /**
+ * Encodes up to the first three bytes of array <var>threeBytes</var>
+ * and returns a four-byte array in Base64 notation.
+ * The actual number of significant bytes in your array is
+ * given by <var>numSigBytes</var>.
+ * The array <var>threeBytes</var> needs only be as big as
+ * <var>numSigBytes</var>.
+ * Code can reuse a byte array by passing a four-byte array as <var>b4</var>.
+ *
+ * @param b4 A reusable byte array to reduce array instantiation
+ * @param threeBytes the array to convert
+ * @param numSigBytes the number of significant bytes in your array
+ * @return four byte array in Base64 notation.
+ * @since 1.5.1
+ */
+ private static byte[] encode3to4( byte[] b4, byte[] threeBytes, int numSigBytes, int options )
+ {
+ encode3to4( threeBytes, 0, numSigBytes, b4, 0, options );
+ return b4;
+ } // end encode3to4
+
+
+ /**
+ * <p>Encodes up to three bytes of the array <var>source</var>
+ * and writes the resulting four Base64 bytes to <var>destination</var>.
+ * The source and destination arrays can be manipulated
+ * anywhere along their length by specifying
+ * <var>srcOffset</var> and <var>destOffset</var>.
+ * This method does not check to make sure your arrays
+ * are large enough to accomodate <var>srcOffset</var> + 3 for
+ * the <var>source</var> array or <var>destOffset</var> + 4 for
+ * the <var>destination</var> array.
+ * The actual number of significant bytes in your array is
+ * given by <var>numSigBytes</var>.</p>
+ * <p>This is the lowest level of the encoding methods with
+ * all possible parameters.</p>
+ *
+ * @param source the array to convert
+ * @param srcOffset the index where conversion begins
+ * @param numSigBytes the number of significant bytes in your array
+ * @param destination the array to hold the conversion
+ * @param destOffset the index where output will be put
+ * @return the <var>destination</var> array
+ * @since 1.3
+ */
+ private static byte[] encode3to4(
+ byte[] source, int srcOffset, int numSigBytes,
+ byte[] destination, int destOffset, int options )
+ {
+ byte[] ALPHABET = getAlphabet( options );
+
+ // 1 2 3
+ // 01234567890123456789012345678901 Bit position
+ // --------000000001111111122222222 Array position from threeBytes
+ // --------| || || || | Six bit groups to index ALPHABET
+ // >>18 >>12 >> 6 >> 0 Right shift necessary
+ // 0x3f 0x3f 0x3f Additional AND
+
+ // Create buffer with zero-padding if there are only one or two
+ // significant bytes passed in the array.
+ // We have to shift left 24 in order to flush out the 1's that appear
+ // when Java treats a value as negative that is cast from a byte to an int.
+ int inBuff = ( numSigBytes > 0 ? ((source[ srcOffset ] << 24) >>> 8) : 0 )
+ | ( numSigBytes > 1 ? ((source[ srcOffset + 1 ] << 24) >>> 16) : 0 )
+ | ( numSigBytes > 2 ? ((source[ srcOffset + 2 ] << 24) >>> 24) : 0 );
+
+ switch( numSigBytes )
+ {
+ case 3:
+ destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
+ destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
+ destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ];
+ destination[ destOffset + 3 ] = ALPHABET[ (inBuff ) & 0x3f ];
+ return destination;
+
+ case 2:
+ destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
+ destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
+ destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ];
+ destination[ destOffset + 3 ] = EQUALS_SIGN;
+ return destination;
+
+ case 1:
+ destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
+ destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
+ destination[ destOffset + 2 ] = EQUALS_SIGN;
+ destination[ destOffset + 3 ] = EQUALS_SIGN;
+ return destination;
+
+ default:
+ return destination;
+ } // end switch
+ } // end encode3to4
+
+
+
+ /**
+ * Serializes an object and returns the Base64-encoded
+ * version of that serialized object. If the object
+ * cannot be serialized or there is another error,
+ * the method will return <tt>null</tt>.
+ * The object is not GZip-compressed before being encoded.
+ *
+ * @param serializableObject The object to encode
+ * @return The Base64-encoded object
+ * @since 1.4
+ */
+ public static String encodeObject( java.io.Serializable serializableObject )
+ {
+ return encodeObject( serializableObject, NO_OPTIONS );
+ } // end encodeObject
+
+
+
+ /**
+ * Serializes an object and returns the Base64-encoded
+ * version of that serialized object. If the object
+ * cannot be serialized or there is another error,
+ * the method will return <tt>null</tt>.
+ * <p>
+ * Valid options:<pre>
+ * GZIP: gzip-compresses object before encoding it.
+ * DONT_BREAK_LINES: don't break lines at 76 characters
+ * <i>Note: Technically, this makes your encoding non-compliant.</i>
+ * </pre>
+ * <p>
+ * Example: <code>encodeObject( myObj, Base64.GZIP )</code> or
+ * <p>
+ * Example: <code>encodeObject( myObj, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
+ *
+ * @param serializableObject The object to encode
+ * @param options Specified options
+ * @return The Base64-encoded object
+ * @see Base64#GZIP
+ * @see Base64#DONT_BREAK_LINES
+ * @since 2.0
+ */
+ public static String encodeObject( java.io.Serializable serializableObject, int options )
+ {
+ // Streams
+ java.io.ByteArrayOutputStream baos = null;
+ java.io.OutputStream b64os = null;
+ java.io.ObjectOutputStream oos = null;
+ java.util.zip.GZIPOutputStream gzos = null;
+
+ // Isolate options
+ int gzip = (options & GZIP);
+ int dontBreakLines = (options & DONT_BREAK_LINES);
+
+ try
+ {
+ // ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream
+ baos = new java.io.ByteArrayOutputStream();
+ b64os = new Base64.OutputStream( baos, ENCODE | options );
+
+ // GZip?
+ if( gzip == GZIP )
+ {
+ gzos = new java.util.zip.GZIPOutputStream( b64os );
+ oos = new java.io.ObjectOutputStream( gzos );
+ } // end if: gzip
+ else
+ oos = new java.io.ObjectOutputStream( b64os );
+
+ oos.writeObject( serializableObject );
+ } // end try
+ catch( java.io.IOException e )
+ {
+ e.printStackTrace();
+ return null;
+ } // end catch
+ finally
+ {
+ try{ oos.close(); } catch( Exception e ){}
+ try{ gzos.close(); } catch( Exception e ){}
+ try{ b64os.close(); } catch( Exception e ){}
+ try{ baos.close(); } catch( Exception e ){}
+ } // end finally
+
+ // Return value according to relevant encoding.
+ try
+ {
+ return new String( baos.toByteArray(), PREFERRED_ENCODING );
+ } // end try
+ catch (java.io.UnsupportedEncodingException uue)
+ {
+ return new String( baos.toByteArray() );
+ } // end catch
+
+ } // end encode
+
+
+
+ /**
+ * Encodes a byte array into Base64 notation.
+ * Does not GZip-compress data.
+ *
+ * @param source The data to convert
+ * @since 1.4
+ */
+ public static String encodeBytes( byte[] source )
+ {
+ return encodeBytes( source, 0, source.length, NO_OPTIONS );
+ } // end encodeBytes
+
+
+
+ /**
+ * Encodes a byte array into Base64 notation.
+ * <p>
+ * Valid options:<pre>
+ * GZIP: gzip-compresses object before encoding it.
+ * DONT_BREAK_LINES: don't break lines at 76 characters
+ * <i>Note: Technically, this makes your encoding non-compliant.</i>
+ * </pre>
+ * <p>
+ * Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
+ * <p>
+ * Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
+ *
+ *
+ * @param source The data to convert
+ * @param options Specified options
+ * @see Base64#GZIP
+ * @see Base64#DONT_BREAK_LINES
+ * @since 2.0
+ */
+ public static String encodeBytes( byte[] source, int options )
+ {
+ return encodeBytes( source, 0, source.length, options );
+ } // end encodeBytes
+
+
+ /**
+ * Encodes a byte array into Base64 notation.
+ * Does not GZip-compress data.
+ *
+ * @param source The data to convert
+ * @param off Offset in array where conversion should begin
+ * @param len Length of data to convert
+ * @since 1.4
+ */
+ public static String encodeBytes( byte[] source, int off, int len )
+ {
+ return encodeBytes( source, off, len, NO_OPTIONS );
+ } // end encodeBytes
+
+
+
+ /**
+ * Encodes a byte array into Base64 notation.
+ * <p>
+ * Valid options:<pre>
+ * GZIP: gzip-compresses object before encoding it.
+ * DONT_BREAK_LINES: don't break lines at 76 characters
+ * <i>Note: Technically, this makes your encoding non-compliant.</i>
+ * </pre>
+ * <p>
+ * Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
+ * <p>
+ * Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
+ *
+ *
+ * @param source The data to convert
+ * @param off Offset in array where conversion should begin
+ * @param len Length of data to convert
+ * @param options Specified options
+ * @param options alphabet type is pulled from this (standard, url-safe, ordered)
+ * @see Base64#GZIP
+ * @see Base64#DONT_BREAK_LINES
+ * @since 2.0
+ */
+ public static String encodeBytes( byte[] source, int off, int len, int options )
+ {
+ // Isolate options
+ int dontBreakLines = ( options & DONT_BREAK_LINES );
+ int gzip = ( options & GZIP );
+
+ // Compress?
+ if( gzip == GZIP )
+ {
+ java.io.ByteArrayOutputStream baos = null;
+ java.util.zip.GZIPOutputStream gzos = null;
+ Base64.OutputStream b64os = null;
+
+
+ try
+ {
+ // GZip -> Base64 -> ByteArray
+ baos = new java.io.ByteArrayOutputStream();
+ b64os = new Base64.OutputStream( baos, ENCODE | options );
+ gzos = new java.util.zip.GZIPOutputStream( b64os );
+
+ gzos.write( source, off, len );
+ gzos.close();
+ } // end try
+ catch( java.io.IOException e )
+ {
+ e.printStackTrace();
+ return null;
+ } // end catch
+ finally
+ {
+ try{ gzos.close(); } catch( Exception e ){}
+ try{ b64os.close(); } catch( Exception e ){}
+ try{ baos.close(); } catch( Exception e ){}
+ } // end finally
+
+ // Return value according to relevant encoding.
+ try
+ {
+ return new String( baos.toByteArray(), PREFERRED_ENCODING );
+ } // end try
+ catch (java.io.UnsupportedEncodingException uue)
+ {
+ return new String( baos.toByteArray() );
+ } // end catch
+ } // end if: compress
+
+ // Else, don't compress. Better not to use streams at all then.
+ else
+ {
+ // Convert option to boolean in way that code likes it.
+ boolean breakLines = dontBreakLines == 0;
+
+ int len43 = len * 4 / 3;
+ byte[] outBuff = new byte[ ( len43 ) // Main 4:3
+ + ( (len % 3) > 0 ? 4 : 0 ) // Account for padding
+ + (breakLines ? ( len43 / MAX_LINE_LENGTH ) : 0) ]; // New lines
+ int d = 0;
+ int e = 0;
+ int len2 = len - 2;
+ int lineLength = 0;
+ for( ; d < len2; d+=3, e+=4 )
+ {
+ encode3to4( source, d+off, 3, outBuff, e, options );
+
+ lineLength += 4;
+ if( breakLines && lineLength == MAX_LINE_LENGTH )
+ {
+ outBuff[e+4] = NEW_LINE;
+ e++;
+ lineLength = 0;
+ } // end if: end of line
+ } // en dfor: each piece of array
+
+ if( d < len )
+ {
+ encode3to4( source, d+off, len - d, outBuff, e, options );
+ e += 4;
+ } // end if: some padding needed
+
+
+ // Return value according to relevant encoding.
+ try
+ {
+ return new String( outBuff, 0, e, PREFERRED_ENCODING );
+ } // end try
+ catch (java.io.UnsupportedEncodingException uue)
+ {
+ return new String( outBuff, 0, e );
+ } // end catch
+
+ } // end else: don't compress
+
+ } // end encodeBytes
+
+
+
+
+
+/* ******** D E C O D I N G M E T H O D S ******** */
+
+
+ /**
+ * Decodes four bytes from array <var>source</var>
+ * and writes the resulting bytes (up to three of them)
+ * to <var>destination</var>.
+ * The source and destination arrays can be manipulated
+ * anywhere along their length by specifying
+ * <var>srcOffset</var> and <var>destOffset</var>.
+ * This method does not check to make sure your arrays
+ * are large enough to accomodate <var>srcOffset</var> + 4 for
+ * the <var>source</var> array or <var>destOffset</var> + 3 for
+ * the <var>destination</var> array.
+ * This method returns the actual number of bytes that
+ * were converted from the Base64 encoding.
+ * <p>This is the lowest level of the decoding methods with
+ * all possible parameters.</p>
+ *
+ *
+ * @param source the array to convert
+ * @param srcOffset the index where conversion begins
+ * @param destination the array to hold the conversion
+ * @param destOffset the index where output will be put
+ * @param options alphabet type is pulled from this (standard, url-safe, ordered)
+ * @return the number of decoded bytes converted
+ * @since 1.3
+ */
+ private static int decode4to3( byte[] source, int srcOffset, byte[] destination, int destOffset, int options )
+ {
+ byte[] DECODABET = getDecodabet( options );
+
+ // Example: Dk==
+ if( source[ srcOffset + 2] == EQUALS_SIGN )
+ {
+ // Two ways to do the same thing. Don't know which way I like best.
+ //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
+ // | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 );
+ int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
+ | ( ( DECODABET[ source[ srcOffset + 1] ] & 0xFF ) << 12 );
+
+ destination[ destOffset ] = (byte)( outBuff >>> 16 );
+ return 1;
+ }
+
+ // Example: DkL=
+ else if( source[ srcOffset + 3 ] == EQUALS_SIGN )
+ {
+ // Two ways to do the same thing. Don't know which way I like best.
+ //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
+ // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
+ // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 );
+ int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
+ | ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
+ | ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6 );
+
+ destination[ destOffset ] = (byte)( outBuff >>> 16 );
+ destination[ destOffset + 1 ] = (byte)( outBuff >>> 8 );
+ return 2;
+ }
+
+ // Example: DkLE
+ else
+ {
+ try{
+ // Two ways to do the same thing. Don't know which way I like best.
+ //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
+ // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
+ // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 )
+ // | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 );
+ int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
+ | ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
+ | ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6)
+ | ( ( DECODABET[ source[ srcOffset + 3 ] ] & 0xFF ) );
+
+
+ destination[ destOffset ] = (byte)( outBuff >> 16 );
+ destination[ destOffset + 1 ] = (byte)( outBuff >> 8 );
+ destination[ destOffset + 2 ] = (byte)( outBuff );
+
+ return 3;
+ }catch( Exception e){
+ System.out.println(""+source[srcOffset]+ ": " + ( DECODABET[ source[ srcOffset ] ] ) );
+ System.out.println(""+source[srcOffset+1]+ ": " + ( DECODABET[ source[ srcOffset + 1 ] ] ) );
+ System.out.println(""+source[srcOffset+2]+ ": " + ( DECODABET[ source[ srcOffset + 2 ] ] ) );
+ System.out.println(""+source[srcOffset+3]+ ": " + ( DECODABET[ source[ srcOffset + 3 ] ] ) );
+ return -1;
+ } // end catch
+ }
+ } // end decodeToBytes
+
+
+
+
+ /**
+ * Very low-level access to decoding ASCII characters in
+ * the form of a byte array. Does not support automatically
+ * gunzipping or any other "fancy" features.
+ *
+ * @param source The Base64 encoded data
+ * @param off The offset of where to begin decoding
+ * @param len The length of characters to decode
+ * @return decoded data
+ * @since 1.3
+ */
+ public static byte[] decode( byte[] source, int off, int len, int options )
+ {
+ byte[] DECODABET = getDecodabet( options );
+
+ int len34 = len * 3 / 4;
+ byte[] outBuff = new byte[ len34 ]; // Upper limit on size of output
+ int outBuffPosn = 0;
+
+ byte[] b4 = new byte[4];
+ int b4Posn = 0;
+ int i = 0;
+ byte sbiCrop = 0;
+ byte sbiDecode = 0;
+ for( i = off; i < off+len; i++ )
+ {
+ sbiCrop = (byte)(source[i] & 0x7f); // Only the low seven bits
+ sbiDecode = DECODABET[ sbiCrop ];
+
+ if( sbiDecode >= WHITE_SPACE_ENC ) // White space, Equals sign or better
+ {
+ if( sbiDecode >= EQUALS_SIGN_ENC )
+ {
+ b4[ b4Posn++ ] = sbiCrop;
+ if( b4Posn > 3 )
+ {
+ outBuffPosn += decode4to3( b4, 0, outBuff, outBuffPosn, options );
+ b4Posn = 0;
+
+ // If that was the equals sign, break out of 'for' loop
+ if( sbiCrop == EQUALS_SIGN )
+ break;
+ } // end if: quartet built
+
+ } // end if: equals sign or better
+
+ } // end if: white space, equals sign or better
+ else
+ {
+ System.err.println( "Bad Base64 input character at " + i + ": " + source[i] + "(decimal)" );
+ return null;
+ } // end else:
+ } // each input character
+
+ byte[] out = new byte[ outBuffPosn ];
+ System.arraycopy( outBuff, 0, out, 0, outBuffPosn );
+ return out;
+ } // end decode
+
+
+
+
+ /**
+ * Decodes data from Base64 notation, automatically
+ * detecting gzip-compressed data and decompressing it.
+ *
+ * @param s the string to decode
+ * @return the decoded data
+ * @since 1.4
+ */
+ public static byte[] decode( String s )
+ {
+ return decode( s, NO_OPTIONS );
+ }
+
+
+ /**
+ * Decodes data from Base64 notation, automatically
+ * detecting gzip-compressed data and decompressing it.
+ *
+ * @param s the string to decode
+ * @param options encode options such as URL_SAFE
+ * @return the decoded data
+ * @since 1.4
+ */
+ public static byte[] decode( String s, int options )
+ {
+ byte[] bytes;
+ try
+ {
+ bytes = s.getBytes( PREFERRED_ENCODING );
+ } // end try
+ catch( java.io.UnsupportedEncodingException uee )
+ {
+ bytes = s.getBytes();
+ } // end catch
+ //</change>
+
+ // Decode
+ bytes = decode( bytes, 0, bytes.length, options );
+
+
+ // Check to see if it's gzip-compressed
+ // GZIP Magic Two-Byte Number: 0x8b1f (35615)
+ if( bytes != null && bytes.length >= 4 )
+ {
+
+ int head = ((int)bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
+ if( java.util.zip.GZIPInputStream.GZIP_MAGIC == head )
+ {
+ java.io.ByteArrayInputStream bais = null;
+ java.util.zip.GZIPInputStream gzis = null;
+ java.io.ByteArrayOutputStream baos = null;
+ byte[] buffer = new byte[2048];
+ int length = 0;
+
+ try
+ {
+ baos = new java.io.ByteArrayOutputStream();
+ bais = new java.io.ByteArrayInputStream( bytes );
+ gzis = new java.util.zip.GZIPInputStream( bais );
+
+ while( ( length = gzis.read( buffer ) ) >= 0 )
+ {
+ baos.write(buffer,0,length);
+ } // end while: reading input
+
+ // No error? Get new bytes.
+ bytes = baos.toByteArray();
+
+ } // end try
+ catch( java.io.IOException e )
+ {
+ // Just return originally-decoded bytes
+ } // end catch
+ finally
+ {
+ try{ baos.close(); } catch( Exception e ){}
+ try{ gzis.close(); } catch( Exception e ){}
+ try{ bais.close(); } catch( Exception e ){}
+ } // end finally
+
+ } // end if: gzipped
+ } // end if: bytes.length >= 2
+
+ return bytes;
+ } // end decode
+
+
+
+
+ /**
+ * Attempts to decode Base64 data and deserialize a Java
+ * Object within. Returns <tt>null</tt> if there was an error.
+ *
+ * @param encodedObject The Base64 data to decode
+ * @return The decoded and deserialized object
+ * @since 1.5
+ */
+ public static Object decodeToObject( String encodedObject )
+ {
+ // Decode and gunzip if necessary
+ byte[] objBytes = decode( encodedObject );
+
+ java.io.ByteArrayInputStream bais = null;
+ java.io.ObjectInputStream ois = null;
+ Object obj = null;
+
+ try
+ {
+ bais = new java.io.ByteArrayInputStream( objBytes );
+ ois = new java.io.ObjectInputStream( bais );
+
+ obj = ois.readObject();
+ } // end try
+ catch( java.io.IOException e )
+ {
+ e.printStackTrace();
+ obj = null;
+ } // end catch
+ catch( java.lang.ClassNotFoundException e )
+ {
+ e.printStackTrace();
+ obj = null;
+ } // end catch
+ finally
+ {
+ try{ bais.close(); } catch( Exception e ){}
+ try{ ois.close(); } catch( Exception e ){}
+ } // end finally
+
+ return obj;
+ } // end decodeObject
+
+
+
+ /**
+ * Convenience method for encoding data to a file.
+ *
+ * @param dataToEncode byte array of data to encode in base64 form
+ * @param filename Filename for saving encoded data
+ * @return <tt>true</tt> if successful, <tt>false</tt> otherwise
+ *
+ * @since 2.1
+ */
+ public static boolean encodeToFile( byte[] dataToEncode, String filename )
+ {
+ boolean success = false;
+ Base64.OutputStream bos = null;
+ try
+ {
+ bos = new Base64.OutputStream(
+ new java.io.FileOutputStream( filename ), Base64.ENCODE );
+ bos.write( dataToEncode );
+ success = true;
+ } // end try
+ catch( java.io.IOException e )
+ {
+
+ success = false;
+ } // end catch: IOException
+ finally
+ {
+ try{ bos.close(); } catch( Exception e ){}
+ } // end finally
+
+ return success;
+ } // end encodeToFile
+
+
+ /**
+ * Convenience method for decoding data to a file.
+ *
+ * @param dataToDecode Base64-encoded data as a string
+ * @param filename Filename for saving decoded data
+ * @return <tt>true</tt> if successful, <tt>false</tt> otherwise
+ *
+ * @since 2.1
+ */
+ public static boolean decodeToFile( String dataToDecode, String filename )
+ {
+ boolean success = false;
+ Base64.OutputStream bos = null;
+ try
+ {
+ bos = new Base64.OutputStream(
+ new java.io.FileOutputStream( filename ), Base64.DECODE );
+ bos.write( dataToDecode.getBytes( PREFERRED_ENCODING ) );
+ success = true;
+ } // end try
+ catch( java.io.IOException e )
+ {
+ success = false;
+ } // end catch: IOException
+ finally
+ {
+ try{ bos.close(); } catch( Exception e ){}
+ } // end finally
+
+ return success;
+ } // end decodeToFile
+
+
+
+
+ /**
+ * Convenience method for reading a base64-encoded
+ * file and decoding it.
+ *
+ * @param filename Filename for reading encoded data
+ * @return decoded byte array or null if unsuccessful
+ *
+ * @since 2.1
+ */
+ public static byte[] decodeFromFile( String filename )
+ {
+ byte[] decodedData = null;
+ Base64.InputStream bis = null;
+ try
+ {
+ // Set up some useful variables
+ java.io.File file = new java.io.File( filename );
+ byte[] buffer = null;
+ int length = 0;
+ int numBytes = 0;
+
+ // Check for size of file
+ if( file.length() > Integer.MAX_VALUE )
+ {
+ System.err.println( "File is too big for this convenience method (" + file.length() + " bytes)." );
+ return null;
+ } // end if: file too big for int index
+ buffer = new byte[ (int)file.length() ];
+
+ // Open a stream
+ bis = new Base64.InputStream(
+ new java.io.BufferedInputStream(
+ new java.io.FileInputStream( file ) ), Base64.DECODE );
+
+ // Read until done
+ while( ( numBytes = bis.read( buffer, length, 4096 ) ) >= 0 )
+ length += numBytes;
+
+ // Save in a variable to return
+ decodedData = new byte[ length ];
+ System.arraycopy( buffer, 0, decodedData, 0, length );
+
+ } // end try
+ catch( java.io.IOException e )
+ {
+ System.err.println( "Error decoding from file " + filename );
+ } // end catch: IOException
+ finally
+ {
+ try{ bis.close(); } catch( Exception e) {}
+ } // end finally
+
+ return decodedData;
+ } // end decodeFromFile
+
+
+
+ /**
+ * Convenience method for reading a binary file
+ * and base64-encoding it.
+ *
+ * @param filename Filename for reading binary data
+ * @return base64-encoded string or null if unsuccessful
+ *
+ * @since 2.1
+ */
+ public static String encodeFromFile( String filename )
+ {
+ String encodedData = null;
+ Base64.InputStream bis = null;
+ try
+ {
+ // Set up some useful variables
+ java.io.File file = new java.io.File( filename );
+ byte[] buffer = new byte[ Math.max((int)(file.length() * 1.4),40) ]; // Need max() for math on small files (v2.2.1)
+ int length = 0;
+ int numBytes = 0;
+
+ // Open a stream
+ bis = new Base64.InputStream(
+ new java.io.BufferedInputStream(
+ new java.io.FileInputStream( file ) ), Base64.ENCODE );
+
+ // Read until done
+ while( ( numBytes = bis.read( buffer, length, 4096 ) ) >= 0 )
+ length += numBytes;
+
+ // Save in a variable to return
+ encodedData = new String( buffer, 0, length, Base64.PREFERRED_ENCODING );
+
+ } // end try
+ catch( java.io.IOException e )
+ {
+ System.err.println( "Error encoding from file " + filename );
+ } // end catch: IOException
+ finally
+ {
+ try{ bis.close(); } catch( Exception e) {}
+ } // end finally
+
+ return encodedData;
+ } // end encodeFromFile
+
+
+
+
+ /**
+ * Reads <tt>infile</tt> and encodes it to <tt>outfile</tt>.
+ *
+ * @param infile Input file
+ * @param outfile Output file
+ * @return true if the operation is successful
+ * @since 2.2
+ */
+ public static boolean encodeFileToFile( String infile, String outfile )
+ {
+ boolean success = false;
+ java.io.InputStream in = null;
+ java.io.OutputStream out = null;
+ try{
+ in = new Base64.InputStream(
+ new java.io.BufferedInputStream(
+ new java.io.FileInputStream( infile ) ),
+ Base64.ENCODE );
+ out = new java.io.BufferedOutputStream( new java.io.FileOutputStream( outfile ) );
+ byte[] buffer = new byte[65536]; // 64K
+ int read = -1;
+ while( ( read = in.read(buffer) ) >= 0 ){
+ out.write( buffer,0,read );
+ } // end while: through file
+ success = true;
+ } catch( java.io.IOException exc ){
+ exc.printStackTrace();
+ } finally{
+ try{ in.close(); } catch( Exception exc ){}
+ try{ out.close(); } catch( Exception exc ){}
+ } // end finally
+
+ return success;
+ } // end encodeFileToFile
+
+
+
+ /**
+ * Reads <tt>infile</tt> and decodes it to <tt>outfile</tt>.
+ *
+ * @param infile Input file
+ * @param outfile Output file
+ * @return true if the operation is successful
+ * @since 2.2
+ */
+ public static boolean decodeFileToFile( String infile, String outfile )
+ {
+ boolean success = false;
+ java.io.InputStream in = null;
+ java.io.OutputStream out = null;
+ try{
+ in = new Base64.InputStream(
+ new java.io.BufferedInputStream(
+ new java.io.FileInputStream( infile ) ),
+ Base64.DECODE );
+ out = new java.io.BufferedOutputStream( new java.io.FileOutputStream( outfile ) );
+ byte[] buffer = new byte[65536]; // 64K
+ int read = -1;
+ while( ( read = in.read(buffer) ) >= 0 ){
+ out.write( buffer,0,read );
+ } // end while: through file
+ success = true;
+ } catch( java.io.IOException exc ){
+ exc.printStackTrace();
+ } finally{
+ try{ in.close(); } catch( Exception exc ){}
+ try{ out.close(); } catch( Exception exc ){}
+ } // end finally
+
+ return success;
+ } // end decodeFileToFile
+
+
+ /* ******** I N N E R C L A S S I N P U T S T R E A M ******** */
+
+
+
+ /**
+ * A {@link Base64.InputStream} will read data from another
+ * <tt>java.io.InputStream</tt>, given in the constructor,
+ * and encode/decode to/from Base64 notation on the fly.
+ *
+ * @see Base64
+ * @since 1.3
+ */
+ public static class InputStream extends java.io.FilterInputStream
+ {
+ private boolean encode; // Encoding or decoding
+ private int position; // Current position in the buffer
+ private byte[] buffer; // Small buffer holding converted data
+ private int bufferLength; // Length of buffer (3 or 4)
+ private int numSigBytes; // Number of meaningful bytes in the buffer
+ private int lineLength;
+ private boolean breakLines; // Break lines at less than 80 characters
+ private int options; // Record options used to create the stream.
+ private byte[] alphabet; // Local copies to avoid extra method calls
+ private byte[] decodabet; // Local copies to avoid extra method calls
+
+
+ /**
+ * Constructs a {@link Base64.InputStream} in DECODE mode.
+ *
+ * @param in the <tt>java.io.InputStream</tt> from which to read data.
+ * @since 1.3
+ */
+ public InputStream( java.io.InputStream in )
+ {
+ this( in, DECODE );
+ } // end constructor
+
+
+ /**
+ * Constructs a {@link Base64.InputStream} in
+ * either ENCODE or DECODE mode.
+ * <p>
+ * Valid options:<pre>
+ * ENCODE or DECODE: Encode or Decode as data is read.
+ * DONT_BREAK_LINES: don't break lines at 76 characters
+ * (only meaningful when encoding)
+ * <i>Note: Technically, this makes your encoding non-compliant.</i>
+ * </pre>
+ * <p>
+ * Example: <code>new Base64.InputStream( in, Base64.DECODE )</code>
+ *
+ *
+ * @param in the <tt>java.io.InputStream</tt> from which to read data.
+ * @param options Specified options
+ * @see Base64#ENCODE
+ * @see Base64#DECODE
+ * @see Base64#DONT_BREAK_LINES
+ * @since 2.0
+ */
+ public InputStream( java.io.InputStream in, int options )
+ {
+ super( in );
+ this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES;
+ this.encode = (options & ENCODE) == ENCODE;
+ this.bufferLength = encode ? 4 : 3;
+ this.buffer = new byte[ bufferLength ];
+ this.position = -1;
+ this.lineLength = 0;
+ this.options = options; // Record for later, mostly to determine which alphabet to use
+ this.alphabet = getAlphabet(options);
+ this.decodabet = getDecodabet(options);
+ } // end constructor
+
+ /**
+ * Reads enough of the input stream to convert
+ * to/from Base64 and returns the next byte.
+ *
+ * @return next byte
+ * @since 1.3
+ */
+ public int read() throws java.io.IOException
+ {
+ // Do we need to get data?
+ if( position < 0 )
+ {
+ if( encode )
+ {
+ byte[] b3 = new byte[3];
+ int numBinaryBytes = 0;
+ for( int i = 0; i < 3; i++ )
+ {
+ try
+ {
+ int b = in.read();
+
+ // If end of stream, b is -1.
+ if( b >= 0 )
+ {
+ b3[i] = (byte)b;
+ numBinaryBytes++;
+ } // end if: not end of stream
+
+ } // end try: read
+ catch( java.io.IOException e )
+ {
+ // Only a problem if we got no data at all.
+ if( i == 0 )
+ throw e;
+
+ } // end catch
+ } // end for: each needed input byte
+
+ if( numBinaryBytes > 0 )
+ {
+ encode3to4( b3, 0, numBinaryBytes, buffer, 0, options );
+ position = 0;
+ numSigBytes = 4;
+ } // end if: got data
+ else
+ {
+ return -1;
+ } // end else
+ } // end if: encoding
+
+ // Else decoding
+ else
+ {
+ byte[] b4 = new byte[4];
+ int i = 0;
+ for( i = 0; i < 4; i++ )
+ {
+ // Read four "meaningful" bytes:
+ int b = 0;
+ do{ b = in.read(); }
+ while( b >= 0 && decodabet[ b & 0x7f ] <= WHITE_SPACE_ENC );
+
+ if( b < 0 )
+ break; // Reads a -1 if end of stream
+
+ b4[i] = (byte)b;
+ } // end for: each needed input byte
+
+ if( i == 4 )
+ {
+ numSigBytes = decode4to3( b4, 0, buffer, 0, options );
+ position = 0;
+ } // end if: got four characters
+ else if( i == 0 ){
+ return -1;
+ } // end else if: also padded correctly
+ else
+ {
+ // Must have broken out from above.
+ throw new java.io.IOException( "Improperly padded Base64 input." );
+ } // end
+
+ } // end else: decode
+ } // end else: get data
+
+ // Got data?
+ if( position >= 0 )
+ {
+ // End of relevant data?
+ if( /*!encode &&*/ position >= numSigBytes )
+ return -1;
+
+ if( encode && breakLines && lineLength >= MAX_LINE_LENGTH )
+ {
+ lineLength = 0;
+ return '\n';
+ } // end if
+ else
+ {
+ lineLength++; // This isn't important when decoding
+ // but throwing an extra "if" seems
+ // just as wasteful.
+
+ int b = buffer[ position++ ];
+
+ if( position >= bufferLength )
+ position = -1;
+
+ return b & 0xFF; // This is how you "cast" a byte that's
+ // intended to be unsigned.
+ } // end else
+ } // end if: position >= 0
+
+ // Else error
+ else
+ {
+ // When JDK1.4 is more accepted, use an assertion here.
+ throw new java.io.IOException( "Error in Base64 code reading stream." );
+ } // end else
+ } // end read
+
+
+ /**
+ * Calls {@link #read()} repeatedly until the end of stream
+ * is reached or <var>len</var> bytes are read.
+ * Returns number of bytes read into array or -1 if
+ * end of stream is encountered.
+ *
+ * @param dest array to hold values
+ * @param off offset for array
+ * @param len max number of bytes to read into array
+ * @return bytes read into array or -1 if end of stream is encountered.
+ * @since 1.3
+ */
+ public int read( byte[] dest, int off, int len ) throws java.io.IOException
+ {
+ int i;
+ int b;
+ for( i = 0; i < len; i++ )
+ {
+ b = read();
+
+ //if( b < 0 && i == 0 )
+ // return -1;
+
+ if( b >= 0 )
+ dest[off + i] = (byte)b;
+ else if( i == 0 )
+ return -1;
+ else
+ break; // Out of 'for' loop
+ } // end for: each byte read
+ return i;
+ } // end read
+
+ } // end inner class InputStream
+
+
+
+
+
+
+ /* ******** I N N E R C L A S S O U T P U T S T R E A M ******** */
+
+
+
+ /**
+ * A {@link Base64.OutputStream} will write data to another
+ * <tt>java.io.OutputStream</tt>, given in the constructor,
+ * and encode/decode to/from Base64 notation on the fly.
+ *
+ * @see Base64
+ * @since 1.3
+ */
+ public static class OutputStream extends java.io.FilterOutputStream
+ {
+ private boolean encode;
+ private int position;
+ private byte[] buffer;
+ private int bufferLength;
+ private int lineLength;
+ private boolean breakLines;
+ private byte[] b4; // Scratch used in a few places
+ private boolean suspendEncoding;
+ private int options; // Record for later
+ private byte[] alphabet; // Local copies to avoid extra method calls
+ private byte[] decodabet; // Local copies to avoid extra method calls
+
+ /**
+ * Constructs a {@link Base64.OutputStream} in ENCODE mode.
+ *
+ * @param out the <tt>java.io.OutputStream</tt> to which data will be written.
+ * @since 1.3
+ */
+ public OutputStream( java.io.OutputStream out )
+ {
+ this( out, ENCODE );
+ } // end constructor
+
+
+ /**
+ * Constructs a {@link Base64.OutputStream} in
+ * either ENCODE or DECODE mode.
+ * <p>
+ * Valid options:<pre>
+ * ENCODE or DECODE: Encode or Decode as data is read.
+ * DONT_BREAK_LINES: don't break lines at 76 characters
+ * (only meaningful when encoding)
+ * <i>Note: Technically, this makes your encoding non-compliant.</i>
+ * </pre>
+ * <p>
+ * Example: <code>new Base64.OutputStream( out, Base64.ENCODE )</code>
+ *
+ * @param out the <tt>java.io.OutputStream</tt> to which data will be written.
+ * @param options Specified options.
+ * @see Base64#ENCODE
+ * @see Base64#DECODE
+ * @see Base64#DONT_BREAK_LINES
+ * @since 1.3
+ */
+ public OutputStream( java.io.OutputStream out, int options )
+ {
+ super( out );
+ this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES;
+ this.encode = (options & ENCODE) == ENCODE;
+ this.bufferLength = encode ? 3 : 4;
+ this.buffer = new byte[ bufferLength ];
+ this.position = 0;
+ this.lineLength = 0;
+ this.suspendEncoding = false;
+ this.b4 = new byte[4];
+ this.options = options;
+ this.alphabet = getAlphabet(options);
+ this.decodabet = getDecodabet(options);
+ } // end constructor
+
+
+ /**
+ * Writes the byte to the output stream after
+ * converting to/from Base64 notation.
+ * When encoding, bytes are buffered three
+ * at a time before the output stream actually
+ * gets a write() call.
+ * When decoding, bytes are buffered four
+ * at a time.
+ *
+ * @param theByte the byte to write
+ * @since 1.3
+ */
+ public void write(int theByte) throws java.io.IOException
+ {
+ // Encoding suspended?
+ if( suspendEncoding )
+ {
+ super.out.write( theByte );
+ return;
+ } // end if: supsended
+
+ // Encode?
+ if( encode )
+ {
+ buffer[ position++ ] = (byte)theByte;
+ if( position >= bufferLength ) // Enough to encode.
+ {
+ out.write( encode3to4( b4, buffer, bufferLength, options ) );
+
+ lineLength += 4;
+ if( breakLines && lineLength >= MAX_LINE_LENGTH )
+ {
+ out.write( NEW_LINE );
+ lineLength = 0;
+ } // end if: end of line
+
+ position = 0;
+ } // end if: enough to output
+ } // end if: encoding
+
+ // Else, Decoding
+ else
+ {
+ // Meaningful Base64 character?
+ if( decodabet[ theByte & 0x7f ] > WHITE_SPACE_ENC )
+ {
+ buffer[ position++ ] = (byte)theByte;
+ if( position >= bufferLength ) // Enough to output.
+ {
+ int len = Base64.decode4to3( buffer, 0, b4, 0, options );
+ out.write( b4, 0, len );
+ //out.write( Base64.decode4to3( buffer ) );
+ position = 0;
+ } // end if: enough to output
+ } // end if: meaningful base64 character
+ else if( decodabet[ theByte & 0x7f ] != WHITE_SPACE_ENC )
+ {
+ throw new java.io.IOException( "Invalid character in Base64 data." );
+ } // end else: not white space either
+ } // end else: decoding
+ } // end write
+
+
+
+ /**
+ * Calls {@link #write(int)} repeatedly until <var>len</var>
+ * bytes are written.
+ *
+ * @param theBytes array from which to read bytes
+ * @param off offset for array
+ * @param len max number of bytes to read into array
+ * @since 1.3
+ */
+ public void write( byte[] theBytes, int off, int len ) throws java.io.IOException
+ {
+ // Encoding suspended?
+ if( suspendEncoding )
+ {
+ super.out.write( theBytes, off, len );
+ return;
+ } // end if: supsended
+
+ for( int i = 0; i < len; i++ )
+ {
+ write( theBytes[ off + i ] );
+ } // end for: each byte written
+
+ } // end write
+
+
+
+ /**
+ * Method added by PHIL. [Thanks, PHIL. -Rob]
+ * This pads the buffer without closing the stream.
+ */
+ public void flushBase64() throws java.io.IOException
+ {
+ if( position > 0 )
+ {
+ if( encode )
+ {
+ out.write( encode3to4( b4, buffer, position, options ) );
+ position = 0;
+ } // end if: encoding
+ else
+ {
+ throw new java.io.IOException( "Base64 input not properly padded." );
+ } // end else: decoding
+ } // end if: buffer partially full
+
+ } // end flush
+
+
+ /**
+ * Flushes and closes (I think, in the superclass) the stream.
+ *
+ * @since 1.3
+ */
+ public void close() throws java.io.IOException
+ {
+ // 1. Ensure that pending characters are written
+ flushBase64();
+
+ // 2. Actually close the stream
+ // Base class both flushes and closes.
+ super.close();
+
+ buffer = null;
+ out = null;
+ } // end close
+
+
+
+ /**
+ * Suspends encoding of the stream.
+ * May be helpful if you need to embed a piece of
+ * base640-encoded data in a stream.
+ *
+ * @since 1.5.1
+ */
+ public void suspendEncoding() throws java.io.IOException
+ {
+ flushBase64();
+ this.suspendEncoding = true;
+ } // end suspendEncoding
+
+
+ /**
+ * Resumes encoding of the stream.
+ * May be helpful if you need to embed a piece of
+ * base640-encoded data in a stream.
+ *
+ * @since 1.5.1
+ */
+ public void resumeEncoding()
+ {
+ this.suspendEncoding = false;
+ } // end resumeEncoding
+
+
+
+ } // end inner class OutputStream
+
+
+} // end class Base64
Copied: trunk/src/main/org/jboss/messaging/utils/ConcurrentHashSet.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/ConcurrentHashSet.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/ConcurrentHashSet.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/ConcurrentHashSet.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+import java.util.AbstractSet;
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ *
+ * A ConcurrentHashSet.
+ *
+ * Offers same concurrency as ConcurrentHashMap but for a Set
+ *
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 1935 $</tt>
+ *
+ * $Id: ConcurrentReaderHashSet.java 1935 2007-01-09 23:29:20Z clebert.suconic at jboss.com $
+ */
+public class ConcurrentHashSet<E> extends AbstractSet<E> implements ConcurrentSet<E>
+{
+ private ConcurrentMap<E, Object> theMap;
+
+ private static final Object dummy = new Object();
+
+ public ConcurrentHashSet()
+ {
+ theMap = new ConcurrentHashMap<E, Object>();
+ }
+
+ public int size()
+ {
+ return theMap.size();
+ }
+
+ public Iterator<E> iterator()
+ {
+ return theMap.keySet().iterator();
+ }
+
+ public boolean isEmpty()
+ {
+ return theMap.isEmpty();
+ }
+
+ public boolean add(E o)
+ {
+ return theMap.put(o, dummy) == null;
+ }
+
+ public boolean contains(Object o)
+ {
+ return theMap.containsKey(o);
+ }
+
+ public void clear()
+ {
+ theMap.clear();
+ }
+
+ public boolean remove(Object o)
+ {
+ return theMap.remove(o) == dummy;
+ }
+
+ public boolean addIfAbsent(E o)
+ {
+ Object obj = theMap.putIfAbsent(o, dummy);
+
+ return obj == null;
+ }
+
+}
Copied: trunk/src/main/org/jboss/messaging/utils/ConcurrentSet.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/ConcurrentSet.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/ConcurrentSet.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/ConcurrentSet.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+import java.util.Set;
+
+/**
+ *
+ * A ConcurrentSet
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ * @param <E>
+ */
+public interface ConcurrentSet<E> extends Set<E>
+{
+ boolean addIfAbsent(E o);
+}
Copied: trunk/src/main/org/jboss/messaging/utils/ConfigurationHelper.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/ConfigurationHelper.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/ConfigurationHelper.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/ConfigurationHelper.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,152 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss 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.messaging.utils;
+
+import java.util.Map;
+
+import org.jboss.messaging.core.logging.Logger;
+
+/**
+ * A ConfigurationHelper
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class ConfigurationHelper
+{
+ public static final Logger log = Logger.getLogger(ConfigurationHelper.class);
+
+ public static String getStringProperty(final String propName, final String def,
+ final Map<String, Object> props)
+ {
+ if (props == null)
+ {
+ return def;
+ }
+
+ Object prop = props.get(propName);
+
+ if (prop == null)
+ {
+ return def;
+ }
+ else
+ {
+ if (prop instanceof String == false)
+ {
+ log.warn("Property " + propName + " must be a String");
+
+ return def;
+ }
+ else
+ {
+ return (String)prop;
+ }
+ }
+ }
+
+ public static int getIntProperty(final String propName, final int def,
+ final Map<String, Object> props)
+ {
+ if (props == null)
+ {
+ return def;
+ }
+ Object prop = props.get(propName);
+
+ if (prop == null)
+ {
+ return def;
+ }
+ else
+ {
+ if (prop instanceof Integer == false)
+ {
+ log.warn("Property " + propName + " must be an Integer");
+
+ return def;
+ }
+ else
+ {
+ return (Integer)prop;
+ }
+ }
+ }
+
+ public static long getLongProperty(final String propName, final long def,
+ final Map<String, Object> props)
+ {
+ if (props == null)
+ {
+ return def;
+ }
+
+ Object prop = props.get(propName);
+
+ if (prop == null)
+ {
+ return def;
+ }
+ else
+ {
+ if (prop instanceof Long == false)
+ {
+ log.warn("Property " + propName + " must be an Long");
+
+ return def;
+ }
+ else
+ {
+ return (Long)prop;
+ }
+ }
+ }
+
+ public static boolean getBooleanProperty(final String propName, final boolean def,
+ final Map<String, Object> props)
+ {
+ if (props == null)
+ {
+ return def;
+ }
+
+ Object prop = props.get(propName);
+
+ if (prop == null)
+ {
+ return def;
+ }
+ else
+ {
+ if (prop instanceof Boolean == false)
+ {
+ log.warn("Property " + propName + " must be a Boolean");
+
+ return def;
+ }
+ else
+ {
+ return (Boolean)prop;
+ }
+ }
+ }
+}
Copied: trunk/src/main/org/jboss/messaging/utils/DataConstants.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/DataConstants.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/DataConstants.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/DataConstants.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+/**
+ *
+ * A DataConstants
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class DataConstants
+{
+ public static final int SIZE_INT = 4;
+ public static final int SIZE_BOOLEAN = 1;
+ public static final int SIZE_LONG = 8;
+ public static final int SIZE_BYTE = 1;
+ public static final int SIZE_SHORT = 2;
+ public static final int SIZE_DOUBLE = 8;
+ public static final int SIZE_FLOAT = 4;
+ public static final int SIZE_CHAR = 2;
+
+ public static final byte TRUE = 1;
+ public static final byte FALSE = 0;
+
+ public static final byte NULL = 0;
+ public static final byte NOT_NULL = 1;
+
+ public static final byte BOOLEAN = 2;
+ public static final byte BYTE = 3;
+ public static final byte BYTES = 4;
+ public static final byte SHORT = 5;
+ public static final byte INT = 6;
+ public static final byte LONG = 7;
+ public static final byte FLOAT = 8;
+ public static final byte DOUBLE = 9;
+ public static final byte STRING = 10;
+ public static final byte CHAR = 11;
+}
Copied: trunk/src/main/org/jboss/messaging/utils/ExecutorFactory.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/ExecutorFactory.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/ExecutorFactory.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/ExecutorFactory.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+import java.util.concurrent.Executor;
+
+/**
+ *
+ * A ExecutorFactory
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public interface ExecutorFactory
+{
+ Executor getExecutor();
+}
Copied: trunk/src/main/org/jboss/messaging/utils/Future.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/Future.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/Future.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/Future.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss 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.messaging.utils;
+
+
+/**
+ * A Future
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class Future implements Runnable
+{
+ private boolean done;
+
+ public synchronized boolean await(final long timeout)
+ {
+ long toWait = timeout;
+
+ long start = System.currentTimeMillis();
+
+ while (!done && toWait > 0)
+ {
+ try
+ {
+ wait(toWait);
+ }
+ catch (InterruptedException e)
+ {
+ }
+
+ long now = System.currentTimeMillis();
+
+ toWait -= now - start;
+
+ start = now;
+ }
+
+ return done;
+ }
+
+ public synchronized void run()
+ {
+ done = true;
+
+ notify();
+ }
+
+}
Copied: trunk/src/main/org/jboss/messaging/utils/IDGenerator.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/IDGenerator.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/IDGenerator.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/IDGenerator.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+/**
+ * A IDGenerator
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ * Created 25 Sep 2008 10:28:52
+ *
+ *
+ */
+public interface IDGenerator
+{
+ long generateID();
+
+ long getCurrentID();
+}
Copied: trunk/src/main/org/jboss/messaging/utils/JBMThreadFactory.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/JBMThreadFactory.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/JBMThreadFactory.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/JBMThreadFactory.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2005-2008, Red Hat
+ * Middleware LLC, and individual contributors 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.messaging.utils;
+
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ *
+ * A JBMThreadFactory
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class JBMThreadFactory implements ThreadFactory
+{
+ private final ThreadGroup group;
+
+ private final AtomicInteger threadCount = new AtomicInteger(0);
+
+ private final int threadPriority;
+ public JBMThreadFactory(final String groupName)
+ {
+ this(groupName, Thread.NORM_PRIORITY);
+ }
+
+ public JBMThreadFactory(String groupName, int priority)
+ {
+ group = new ThreadGroup(groupName + "-" + System.identityHashCode(this));
+ threadPriority = priority;
+ }
+
+ public Thread newThread(final Runnable command)
+ {
+ Thread t = new Thread(group, command, "Thread-" + threadCount.getAndIncrement() +
+ " (group:" +
+ group.getName() +
+ ")");
+
+ // Don't want to prevent VM from exiting
+ t.setDaemon(true);
+ t.setPriority(threadPriority);
+ return t;
+ }
+}
Copied: trunk/src/main/org/jboss/messaging/utils/JNDIUtil.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/JNDIUtil.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/JNDIUtil.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/JNDIUtil.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+import java.util.StringTokenizer;
+
+import javax.naming.Binding;
+import javax.naming.Context;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ */
+public class JNDIUtil
+{
+ // Constants -----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ /**
+ * Create a context path recursively.
+ */
+ public static Context createContext(Context c, String path) throws NamingException
+ {
+ Context crtContext = c;
+ for(StringTokenizer st = new StringTokenizer(path, "/"); st.hasMoreTokens(); )
+ {
+ String tok = st.nextToken();
+
+ try
+ {
+ Object o = crtContext.lookup(tok);
+ if (!(o instanceof Context))
+ {
+ throw new NamingException("Path " + path + " overwrites and already bound object");
+ }
+ crtContext = (Context)o;
+ continue;
+ }
+ catch(NameNotFoundException e)
+ {
+ // OK
+ }
+ crtContext = crtContext.createSubcontext(tok);
+ }
+ return crtContext;
+ }
+
+ public static void tearDownRecursively(Context c) throws Exception
+ {
+ for(NamingEnumeration ne = c.listBindings(""); ne.hasMore(); )
+ {
+ Binding b = (Binding)ne.next();
+ String name = b.getName();
+ Object object = b.getObject();
+ if (object instanceof Context)
+ {
+ tearDownRecursively((Context)object);
+ }
+ c.unbind(name);
+ }
+ }
+
+ /**
+ * Context.rebind() requires that all intermediate contexts and the target context (that named by
+ * all but terminal atomic component of the name) must already exist, otherwise
+ * NameNotFoundException is thrown. This method behaves similar to Context.rebind(), but creates
+ * intermediate contexts, if necessary.
+ */
+ public static void rebind(Context c, String jndiName, Object o) throws NamingException
+ {
+ Context context = c;
+ String name = jndiName;
+
+ int idx = jndiName.lastIndexOf('/');
+ if (idx != -1)
+ {
+ context = createContext(c, jndiName.substring(0, idx));
+ name = jndiName.substring(idx + 1);
+ }
+ boolean failed=false;
+ try
+ {
+ context.rebind(name,o);
+ }
+ catch (Exception ignored)
+ {
+ failed=true;
+ }
+ if (failed)
+ {
+ context.bind(name, o);
+ }
+ }
+
+ // Attributes ----------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Property changes on: trunk/src/main/org/jboss/messaging/utils/JNDIUtil.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/src/main/org/jboss/messaging/utils/ObjectInputStreamWithClassLoader.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/ObjectInputStreamWithClassLoader.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/ObjectInputStreamWithClassLoader.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/ObjectInputStreamWithClassLoader.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+
+/**
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ */
+public class ObjectInputStreamWithClassLoader extends ObjectInputStream
+{
+
+ // Constants ------------------------------------------------------------------------------------
+
+ // Attributes -----------------------------------------------------------------------------------
+
+ // Static ---------------------------------------------------------------------------------------
+
+ // Constructors ---------------------------------------------------------------------------------
+
+ public ObjectInputStreamWithClassLoader(InputStream in)
+ throws IOException
+ {
+ super(in);
+ }
+
+ // Public ---------------------------------------------------------------------------------------
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException
+ {
+ String name = desc.getName();
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Class clazz = loader.loadClass(name);
+ // sanity check only.. if a classLoader can't find a clazz, it will throw an exception
+ if (clazz == null)
+ {
+ return super.resolveClass(desc);
+ }
+ else
+ {
+ return clazz;
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ return super.resolveClass(desc);
+ }
+ }
+
+ // Private --------------------------------------------------------------------------------------
+
+ // Inner classes --------------------------------------------------------------------------------
+
+}
Property changes on: trunk/src/main/org/jboss/messaging/utils/ObjectInputStreamWithClassLoader.java
___________________________________________________________________
Name: svn:keywords
+ Id LastChangedDate Author Revision
Copied: trunk/src/main/org/jboss/messaging/utils/OrderedExecutorFactory.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/OrderedExecutorFactory.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/OrderedExecutorFactory.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/OrderedExecutorFactory.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,136 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+import java.util.LinkedList;
+import java.util.concurrent.Executor;
+
+/**
+ * A factory for producing executors that run all tasks in order, which delegate to a single common executor instance.
+ *
+ * @author <a href="david.lloyd at jboss.com">David Lloyd</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public final class OrderedExecutorFactory implements ExecutorFactory
+{
+ private final Executor parent;
+
+ /**
+ * Construct a new instance delegating to the given parent executor.
+ *
+ * @param parent the parent executor
+ */
+ public OrderedExecutorFactory(final Executor parent)
+ {
+ this.parent = parent;
+ }
+
+ /**
+ * Get an executor that always executes tasks in order.
+ *
+ * @return an ordered executor
+ */
+ public Executor getExecutor()
+ {
+ return new OrderedExecutor(parent);
+ }
+
+ /**
+ * An executor that always runs all tasks in order, using a delegate executor to run the tasks.
+ * <p/>
+ * More specifically, any call B to the {@link #execute(Runnable)} method that happens-after another call A to the
+ * same method, will result in B's task running after A's.
+ */
+ private static final class OrderedExecutor implements Executor
+ {
+ // @protectedby tasks
+ private final LinkedList<Runnable> tasks = new LinkedList<Runnable>();
+
+ // @protectedby tasks
+ private boolean running;
+
+ private final Executor parent;
+
+ private final Runnable runner;
+
+ /**
+ * Construct a new instance.
+ *
+ * @param parent the parent executor
+ */
+ public OrderedExecutor(final Executor parent)
+ {
+ this.parent = parent;
+ runner = new Runnable()
+ {
+ public void run()
+ {
+ for (;;)
+ {
+ final Runnable task;
+ synchronized (tasks)
+ {
+ task = tasks.poll();
+ if (task == null)
+ {
+ running = false;
+ return;
+ }
+ }
+ try
+ {
+ task.run();
+ }
+ catch (Throwable t)
+ {
+ // eat it!
+ }
+ }
+ }
+ };
+ }
+
+ /**
+ * Run a task.
+ *
+ * @param command the task to run.
+ */
+ public void execute(Runnable command)
+ {
+ synchronized (tasks)
+ {
+ tasks.add(command);
+ if (!running)
+ {
+ running = true;
+ parent.execute(runner);
+ }
+ }
+ }
+ }
+}
+
+
Copied: trunk/src/main/org/jboss/messaging/utils/Pair.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/Pair.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/Pair.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/Pair.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+import java.io.Serializable;
+
+/**
+ *
+ * A Pair
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class Pair<A, B> implements Serializable
+{
+ private static final long serialVersionUID = -2496357457812368127L;
+
+ public Pair(A a, B b)
+ {
+ this.a = a;
+
+ this.b = b;
+ }
+
+ public A a;
+
+ public B b;
+
+ private int hash = -1;
+
+ public int hashCode()
+ {
+ if (hash == -1)
+ {
+ if (a == null && b == null)
+ {
+ return super.hashCode();
+ }
+ else
+ {
+ hash = (a == null ? 0 : a.hashCode()) + 37 * (b == null ? 0 : b.hashCode());
+ }
+ }
+
+ return hash;
+ }
+
+ public boolean equals(Object other)
+ {
+ if (other == this)
+ {
+ return true;
+ }
+
+ if (other instanceof Pair == false)
+ {
+ return false;
+ }
+
+ Pair<A, B> pother = (Pair<A, B>)other;
+
+ return (pother.a == null ? a == null : pother.a.equals(a)) &&
+ (pother.b == null ? b == null : pother.b.equals(b));
+
+ }
+}
Copied: trunk/src/main/org/jboss/messaging/utils/Random.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/Random.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/Random.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/Random.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+
+/**
+ * A Random
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ * Created 28 Nov 2008 10:28:28
+ *
+ *
+ */
+public class Random
+{
+ private static int extraSeed;
+
+ private static synchronized long getSeed()
+ {
+ long seed = System.currentTimeMillis() + extraSeed++;
+
+ return seed;
+ }
+
+ private java.util.Random random = new java.util.Random(getSeed());
+
+ public java.util.Random getRandom()
+ {
+ return random;
+ }
+
+}
Copied: trunk/src/main/org/jboss/messaging/utils/SimpleIDGenerator.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/SimpleIDGenerator.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/SimpleIDGenerator.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/SimpleIDGenerator.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss 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.messaging.utils;
+
+/**
+ * A SimpleIDGenerator
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class SimpleIDGenerator implements IDGenerator
+{
+ private long idSequence;
+
+ private boolean wrapped;
+
+ public SimpleIDGenerator(final long startID)
+ {
+ idSequence = startID;
+ }
+
+ public synchronized long generateID()
+ {
+ long id = idSequence++;
+
+ if (idSequence == Long.MIN_VALUE)
+ {
+ wrapped = true;
+ }
+
+ if (wrapped)
+ {
+ // Wrap - Very unlikely to happen
+ throw new IllegalStateException("Exhausted ids to use!");
+ }
+
+ return id;
+ }
+
+ public synchronized long getCurrentID()
+ {
+ return idSequence;
+ }
+}
Copied: trunk/src/main/org/jboss/messaging/utils/SimpleString.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/SimpleString.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/SimpleString.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/SimpleString.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,354 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+import static org.jboss.messaging.utils.DataConstants.SIZE_INT;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.messaging.core.logging.Logger;
+
+/**
+ *
+ * A SimpleString
+ *
+ * A simple String class that can store all characters, and stores as simple byte[],
+ * this minimises expensive copying between String objects
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ * TODO - implement an intern() method like in java.lang.String, since many Strings e.g. addresses, queue names, remote node ids are duplicated heavily
+ * in bindings taking up more memory than they should
+ * Intern can be called when receiving a sent message at the server (destination)
+ * Also when receiving bindings remotely via bridge, the address, queue name and node id can be interned
+ *
+ */
+public class SimpleString implements CharSequence, Serializable, Comparable<SimpleString>
+{
+ private static final long serialVersionUID = 4204223851422244307L;
+
+ private static final Logger log = Logger.getLogger(SimpleString.class);
+
+ // Attributes
+ // ------------------------------------------------------------------------
+ private final byte[] data;
+
+ private transient int hash;
+
+ // Cache the string
+ private transient String str;
+
+ // Static
+ // ----------------------------------------------------------------------
+
+ /**
+ * Returns a SimpleString constructed from the <code>string</code> parameter.
+ * If <code>string</code> is <code>null</code>, the return value will be <code>null</code> too.
+ */
+ public static SimpleString toSimpleString(final String string)
+ {
+ if (string == null)
+ {
+ return null;
+ }
+ return new SimpleString(string);
+ }
+
+ // Constructors
+ // ----------------------------------------------------------------------
+
+ public SimpleString(final String string)
+ {
+ int len = string.length();
+
+ data = new byte[len << 1];
+
+ int j = 0;
+
+ for (int i = 0; i < len; i++)
+ {
+ char c = string.charAt(i);
+
+ byte low = (byte)(c & 0xFF); // low byte
+
+ data[j++] = low;
+
+ byte high = (byte)(c >> 8 & 0xFF); // high byte
+
+ data[j++] = high;
+ }
+
+ str = string;
+ }
+
+ public SimpleString(final byte[] data)
+ {
+ this.data = data;
+ }
+
+ // CharSequence implementation
+ // ---------------------------------------------------------------------------
+
+ public int length()
+ {
+ return data.length >> 1;
+ }
+
+ public char charAt(int pos)
+ {
+ if (pos < 0 || pos >= data.length >> 1)
+ {
+ throw new IndexOutOfBoundsException();
+ }
+ pos <<= 1;
+
+ return (char)(data[pos] | data[pos + 1] << 8);
+ }
+
+ public CharSequence subSequence(final int start, final int end)
+ {
+ int len = data.length >> 1;
+
+ if (end < start || start < 0 || end > len)
+ {
+ throw new IndexOutOfBoundsException();
+ }
+ else
+ {
+ int newlen = (end - start) << 1;
+ byte[] bytes = new byte[newlen];
+
+ System.arraycopy(data, start << 1, bytes, 0, newlen);
+
+ return new SimpleString(bytes);
+ }
+ }
+
+ // Comparable implementation -------------------------------------
+
+ public int compareTo(SimpleString o)
+ {
+ return toString().compareTo(o.toString());
+ }
+
+ // Public
+ // ---------------------------------------------------------------------------
+
+ public byte[] getData()
+ {
+ return data;
+ }
+
+ public boolean startsWith(final SimpleString other)
+ {
+ byte[] otherdata = other.data;
+
+ if (otherdata.length > this.data.length)
+ {
+ return false;
+ }
+
+ for (int i = 0; i < otherdata.length; i++)
+ {
+ if (this.data[i] != otherdata[i])
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public String toString()
+ {
+ if (str == null)
+ {
+ int len = data.length >> 1;
+
+ char[] chars = new char[len];
+
+ int j = 0;
+
+ for (int i = 0; i < len; i++)
+ {
+ int low = data[j++] & 0xFF;
+
+ int high = (data[j++] << 8) & 0xFF00;
+
+ chars[i] = (char)(low | high);
+ }
+
+ str = new String(chars);
+ }
+
+ return str;
+ }
+
+ public boolean equals(Object other)
+ {
+ if (other instanceof SimpleString)
+ {
+ SimpleString s = (SimpleString)other;
+
+ if (data.length != s.data.length)
+ {
+ return false;
+ }
+
+ for (int i = 0; i < data.length; i++)
+ {
+ if (data[i] != s.data[i])
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public int hashCode()
+ {
+ if (hash == 0)
+ {
+ for (int i = 0; i < data.length; i++)
+ {
+ hash = (hash << 5) - hash + data[i]; // (hash << 5) - hash is same as hash * 31
+ }
+ }
+
+ return hash;
+ }
+
+ public SimpleString[] split(char delim)
+ {
+ if (!contains(delim))
+ {
+ return new SimpleString[] { this };
+ }
+ else
+ {
+ List<SimpleString> all = new ArrayList<SimpleString>();
+ int lasPos = 0;
+ for (int i = 0; i < data.length; i += 2)
+ {
+ byte low = (byte)(delim & 0xFF); // low byte
+ byte high = (byte)(delim >> 8 & 0xFF); // high byte
+ if (data[i] == low && data[i + 1] == high)
+ {
+ byte[] bytes = new byte[i - lasPos];
+ System.arraycopy(data, lasPos, bytes, 0, bytes.length);
+ lasPos = i + 2;
+ all.add(new SimpleString(bytes));
+ }
+ }
+ byte[] bytes = new byte[data.length - lasPos];
+ System.arraycopy(data, lasPos, bytes, 0, bytes.length);
+ all.add(new SimpleString(bytes));
+ SimpleString[] parts = new SimpleString[all.size()];
+ return all.toArray(parts);
+ }
+ }
+
+ public boolean contains(char c)
+ {
+ for (int i = 0; i < data.length; i += 2)
+ {
+ byte low = (byte)(c & 0xFF); // low byte
+ byte high = (byte)(c >> 8 & 0xFF); // high byte
+ if (data[i] == low && data[i + 1] == high)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public SimpleString concat(final SimpleString toAdd)
+ {
+ byte[] bytes = new byte[data.length + toAdd.getData().length];
+ System.arraycopy(data, 0, bytes, 0, data.length);
+ System.arraycopy(toAdd.getData(), 0, bytes, data.length, toAdd.getData().length);
+ return new SimpleString(bytes);
+ }
+
+ public SimpleString concat(final char c)
+ {
+ byte[] bytes = new byte[data.length + 2];
+ System.arraycopy(data, 0, bytes, 0, data.length);
+ bytes[data.length] = (byte)(c & 0xFF);
+ bytes[data.length + 1] = (byte)(c >> 8 & 0xFF);
+ return new SimpleString(bytes);
+ }
+
+ public static int sizeofString(final SimpleString str)
+ {
+ return SIZE_INT + str.data.length;
+ }
+
+ public static int sizeofNullableString(final SimpleString str)
+ {
+ if (str == null)
+ {
+ return 1;
+ }
+ else
+ {
+ return 1 + sizeofString(str);
+ }
+ }
+
+ public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin)
+ {
+ if (srcBegin < 0)
+ {
+ throw new StringIndexOutOfBoundsException(srcBegin);
+ }
+ if (srcEnd > length())
+ {
+ throw new StringIndexOutOfBoundsException(srcEnd);
+ }
+ if (srcBegin > srcEnd)
+ {
+ throw new StringIndexOutOfBoundsException(srcEnd - srcBegin);
+ }
+
+ int j = 0;
+
+ for (int i = srcBegin; i < srcEnd - srcBegin; i++)
+ {
+ int low = data[j++] & 0xFF;
+
+ int high = (data[j++] << 8) & 0xFF00;
+
+ dst[i] = (char)(low | high);
+ }
+ }
+
+}
\ No newline at end of file
Copied: trunk/src/main/org/jboss/messaging/utils/SimpleStringReader.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/SimpleStringReader.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/SimpleStringReader.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/SimpleStringReader.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+import java.io.IOException;
+import java.io.Reader;
+
+/**
+ * A SimpleStringReader
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * Created 31 oct. 2008 14:41:18
+ *
+ *
+ */
+public class SimpleStringReader extends Reader
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private final SimpleString simpleString;
+
+ private int next = 0;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SimpleStringReader(final SimpleString simpleString)
+ {
+ this.simpleString = simpleString;
+ }
+
+ // Public --------------------------------------------------------
+
+ // Reader overrides ----------------------------------------------
+
+ @Override
+ public int read(char[] cbuf, int off, int len) throws IOException
+ {
+ synchronized (simpleString)
+ {
+ if ((off < 0) || (off > cbuf.length) || (len < 0) || ((off + len) > cbuf.length) || ((off + len) < 0))
+ {
+ throw new IndexOutOfBoundsException();
+ }
+ else if (len == 0)
+ {
+ return 0;
+ }
+ int length = simpleString.length();
+ if (next >= length)
+ {
+ return -1;
+ }
+ int n = Math.min(length - next, len);
+ simpleString.getChars(next, next + n, cbuf, off);
+ next += n;
+ return n;
+ }
+ }
+
+ @Override
+ public void close() throws IOException
+ {
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Copied: trunk/src/main/org/jboss/messaging/utils/TimeAndCounterIDGenerator.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/TimeAndCounterIDGenerator.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/TimeAndCounterIDGenerator.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/TimeAndCounterIDGenerator.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,178 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * A TimeAndCounterIDGenerator
+ * <p>
+ * This IDGenerator doesn't support more than 16777215 IDs per 16 millisecond. It would throw an exception if this happens.
+ * </p>
+ *
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a> Created Sep 24, 2008 11:54:10 AM
+ */
+public class TimeAndCounterIDGenerator implements IDGenerator
+{
+ // Constants ----------------------------------------------------
+
+ /**
+ * Bits to move the date accordingly to MASK_TIME
+ */
+ private static final int BITS_TO_MOVE = 20;
+
+ public static final long MASK_TIME = 0x7fffffffff0l;
+
+ //44 bits of time and 20 bits of counter
+
+ public static final long ID_MASK = 0xffffffl;
+
+ private static final long TIME_ID_MASK = 0x7fffffffff000000l;
+
+ // Attributes ----------------------------------------------------
+
+ private final AtomicLong counter = new AtomicLong(0);
+
+ private volatile boolean wrapped = false;
+
+ private volatile long tmMark;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public TimeAndCounterIDGenerator()
+ {
+ refresh();
+ }
+
+ // Public --------------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public long generateID()
+ {
+ long idReturn = counter.incrementAndGet();
+
+ if ((idReturn & ID_MASK) == 0)
+ {
+ final long timePortion = idReturn & TIME_ID_MASK;
+
+ // Wrapping ID logic
+
+ if (timePortion >= newTM())
+ {
+ // Unlikely to happen
+
+ wrapped = true;
+
+ }
+ else
+ {
+ // Else.. no worry... we will just accept the new time portion being added
+ // This time-mark would have been generated some time ago, so this is ok.
+ // tmMark is just a cache to validate the MaxIDs, so there is no need to make it atomic (synchronized)
+ tmMark = timePortion;
+ }
+ }
+
+ if (wrapped)
+ {
+ // This will only happen if a computer can generate more than ID_MASK ids (16 million IDs per 16
+ // milliseconds)
+ // If this wrapping code starts to happen, it needs revision
+ throw new IllegalStateException("The IDGenerator is being overlaped, and it needs revision as the system generated more than " + ID_MASK +
+ " ids per 16 milliseconds which exceeded the IDgenerator limit");
+ }
+
+ return idReturn;
+ }
+
+ public long getCurrentID()
+ {
+ return counter.get();
+ }
+
+
+ // for use in testcases
+ public long getInternalTimeMark()
+ {
+ return tmMark;
+ }
+
+ // for use in testcases
+ public void setInternalID(final long id)
+ {
+ counter.set(tmMark | id);
+ }
+
+ // for use in testcases
+ public void setInternalDate(final long date)
+ {
+ tmMark = (date & MASK_TIME) << BITS_TO_MOVE;
+ counter.set(tmMark);
+ }
+
+ public synchronized void refresh()
+ {
+ long oldTm = tmMark;
+ long newTm = newTM();
+
+ while (newTm <= oldTm)
+ {
+ newTm = newTM();
+ }
+ tmMark = newTm;
+ counter.set(tmMark);
+ }
+
+ @Override
+ public String toString()
+ {
+ long currentCounter = counter.get();
+ return "SequenceGenerator(tmMark=" + hex(tmMark) +
+ ", CurrentCounter = " +
+ currentCounter +
+ ", HexCurrentCounter = " +
+ hex(currentCounter) +
+ ")";
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ private long newTM()
+ {
+ return (System.currentTimeMillis() & MASK_TIME) << BITS_TO_MOVE;
+ }
+
+ private String hex(final long x)
+ {
+ return String.format("%1$X", x);
+ }
+
+}
Copied: trunk/src/main/org/jboss/messaging/utils/TokenBucketLimiter.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/TokenBucketLimiter.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/TokenBucketLimiter.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/TokenBucketLimiter.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+/**
+ *
+ * A TokenBucketLimiterImpl
+ *
+ * This class can throttle to a specfic rate, using an algorithm based on the Token Bucket metaphor
+ * http://en.wikipedia.org/wiki/Token_bucket
+ *
+ * The rate is specified in Hertz
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public interface TokenBucketLimiter
+{
+ int getRate();
+
+ boolean isSpin();
+
+ void limit();
+}
Copied: trunk/src/main/org/jboss/messaging/utils/TokenBucketLimiterImpl.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/TokenBucketLimiterImpl.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/TokenBucketLimiterImpl.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/TokenBucketLimiterImpl.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+/**
+ *
+ * A TokenBucketLimiterImpl
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class TokenBucketLimiterImpl implements TokenBucketLimiter
+{
+ private final int rate;
+
+ private final boolean spin;
+
+ private volatile long last;
+
+ private volatile int tokens;
+
+ private volatile int tokensAdded;
+
+ public TokenBucketLimiterImpl(final int rate, final boolean spin)
+ {
+ this.rate = rate;
+
+ this.spin = spin;
+ }
+
+ public int getRate()
+ {
+ return rate;
+ }
+
+ public boolean isSpin()
+ {
+ return spin;
+ }
+
+ public void limit()
+ {
+ while (!check())
+ {
+ if (!spin)
+ {
+ try
+ {
+ Thread.sleep(1);
+ }
+ catch (Exception e)
+ {
+ //Ignore
+ }
+ }
+ }
+ }
+
+ private boolean check()
+ {
+ long now = System.currentTimeMillis();
+
+ if (last == 0)
+ {
+ last = now;
+ }
+
+ long diff = now - last;
+
+ if (diff >= 1000)
+ {
+ last = last + 1000;
+
+ tokens = 0;
+
+ tokensAdded = 0;
+ }
+
+ int tokensDue = (int)(rate * diff / 1000);
+
+ int tokensToAdd = tokensDue - tokensAdded;
+
+ if (tokensToAdd > 0)
+ {
+ tokens += tokensToAdd;
+
+ tokensAdded += tokensToAdd;
+ }
+
+ if (tokens > 0)
+ {
+ tokens--;
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+}
Copied: trunk/src/main/org/jboss/messaging/utils/TypedProperties.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/TypedProperties.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/TypedProperties.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/TypedProperties.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,752 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+import static org.jboss.messaging.utils.DataConstants.BOOLEAN;
+import static org.jboss.messaging.utils.DataConstants.BYTE;
+import static org.jboss.messaging.utils.DataConstants.BYTES;
+import static org.jboss.messaging.utils.DataConstants.CHAR;
+import static org.jboss.messaging.utils.DataConstants.DOUBLE;
+import static org.jboss.messaging.utils.DataConstants.FLOAT;
+import static org.jboss.messaging.utils.DataConstants.INT;
+import static org.jboss.messaging.utils.DataConstants.LONG;
+import static org.jboss.messaging.utils.DataConstants.NOT_NULL;
+import static org.jboss.messaging.utils.DataConstants.NULL;
+import static org.jboss.messaging.utils.DataConstants.SHORT;
+import static org.jboss.messaging.utils.DataConstants.SIZE_BOOLEAN;
+import static org.jboss.messaging.utils.DataConstants.SIZE_BYTE;
+import static org.jboss.messaging.utils.DataConstants.SIZE_CHAR;
+import static org.jboss.messaging.utils.DataConstants.SIZE_DOUBLE;
+import static org.jboss.messaging.utils.DataConstants.SIZE_FLOAT;
+import static org.jboss.messaging.utils.DataConstants.SIZE_INT;
+import static org.jboss.messaging.utils.DataConstants.SIZE_LONG;
+import static org.jboss.messaging.utils.DataConstants.SIZE_SHORT;
+import static org.jboss.messaging.utils.DataConstants.STRING;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ *
+ * A TypedProperties
+ *
+ * TODO - should have typed property getters and do conversions herein
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
+ *
+ */
+public class TypedProperties
+{
+ private static final Logger log = Logger.getLogger(TypedProperties.class);
+
+ private Map<SimpleString, PropertyValue> properties;
+
+ private volatile int size;
+
+ public TypedProperties()
+ {
+ }
+
+ public TypedProperties(final TypedProperties other)
+ {
+ properties = other.properties == null ? null : new HashMap<SimpleString, PropertyValue>(other.properties);
+ size = other.size;
+ }
+
+ public void putBooleanProperty(final SimpleString key, final boolean value)
+ {
+ checkCreateProperties();
+ doPutValue(key, new BooleanValue(value));
+ }
+
+ public void putByteProperty(final SimpleString key, final byte value)
+ {
+ checkCreateProperties();
+ doPutValue(key, new ByteValue(value));
+ }
+
+ public void putBytesProperty(final SimpleString key, final byte[] value)
+ {
+ checkCreateProperties();
+ doPutValue(key, value == null ? new NullValue() : new BytesValue(value));
+ }
+
+ public void putShortProperty(final SimpleString key, final short value)
+ {
+ checkCreateProperties();
+ doPutValue(key, new ShortValue(value));
+ }
+
+ public void putIntProperty(final SimpleString key, final int value)
+ {
+ checkCreateProperties();
+ doPutValue(key, new IntValue(value));
+ }
+
+ public void putLongProperty(final SimpleString key, final long value)
+ {
+ checkCreateProperties();
+ doPutValue(key, new LongValue(value));
+ }
+
+ public void putFloatProperty(final SimpleString key, final float value)
+ {
+ checkCreateProperties();
+ doPutValue(key, new FloatValue(value));
+ }
+
+ public void putDoubleProperty(final SimpleString key, final double value)
+ {
+ checkCreateProperties();
+ doPutValue(key, new DoubleValue(value));
+ }
+
+ public void putStringProperty(final SimpleString key, final SimpleString value)
+ {
+ checkCreateProperties();
+ doPutValue(key, value == null ? new NullValue() : new StringValue(value));
+ }
+
+ public void putCharProperty(final SimpleString key, final char value)
+ {
+ checkCreateProperties();
+ doPutValue(key, new CharValue(value));
+ }
+
+ public void putTypedProperties(final TypedProperties otherProps)
+ {
+ if (otherProps == null || otherProps.properties == null)
+ {
+ return;
+ }
+
+ checkCreateProperties();
+ Set<Entry<SimpleString,PropertyValue>> otherEntries = otherProps.properties.entrySet();
+ for (Entry<SimpleString, PropertyValue> otherEntry : otherEntries)
+ {
+ doPutValue(otherEntry.getKey(), otherEntry.getValue());
+ }
+ }
+
+ public Object getProperty(final SimpleString key)
+ {
+ return doGetProperty(key);
+ }
+
+ public Object removeProperty(final SimpleString key)
+ {
+ return doRemoveProperty(key);
+ }
+
+ public boolean containsProperty(final SimpleString key)
+ {
+ if (properties != null)
+ {
+ return properties.containsKey(key);
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public Set<SimpleString> getPropertyNames()
+ {
+ if (properties != null)
+ {
+ return properties.keySet();
+ }
+ else
+ {
+ return Collections.EMPTY_SET;
+ }
+ }
+
+ public synchronized void decode(final MessagingBuffer buffer)
+ {
+ byte b = buffer.getByte();
+
+ if (b == NULL)
+ {
+ properties = null;
+ }
+ else
+ {
+ int numHeaders = buffer.getInt();
+
+ properties = new HashMap<SimpleString, PropertyValue>(numHeaders);
+ size = 0;
+
+ for (int i = 0; i < numHeaders; i++)
+ {
+ int len = buffer.getInt();
+ byte[] data = new byte[len];
+ buffer.getBytes(data);
+ SimpleString key = new SimpleString(data);
+
+ byte type = buffer.getByte();
+
+ PropertyValue val;
+
+ switch (type)
+ {
+ case NULL:
+ {
+ val = new NullValue();
+ doPutValue(key, val);
+ break;
+ }
+ case CHAR:
+ {
+ val = new CharValue(buffer);
+ doPutValue(key, val);
+ break;
+ }
+ case BOOLEAN:
+ {
+ val = new BooleanValue(buffer);
+ doPutValue(key, val);
+ break;
+ }
+ case BYTE:
+ {
+ val = new ByteValue(buffer);
+ doPutValue(key, val);
+ break;
+ }
+ case BYTES:
+ {
+ val = new BytesValue(buffer);
+ doPutValue(key, val);
+ break;
+ }
+ case SHORT:
+ {
+ val = new ShortValue(buffer);
+ doPutValue(key, val);
+ break;
+ }
+ case INT:
+ {
+ val = new IntValue(buffer);
+ doPutValue(key, val);
+ break;
+ }
+ case LONG:
+ {
+ val = new LongValue(buffer);
+ doPutValue(key, val);
+ break;
+ }
+ case FLOAT:
+ {
+ val = new FloatValue(buffer);
+ doPutValue(key, val);
+ break;
+ }
+ case DOUBLE:
+ {
+ val = new DoubleValue(buffer);
+ doPutValue(key, val);
+ break;
+ }
+ case STRING:
+ {
+ val = new StringValue(buffer);
+ doPutValue(key, val);
+ break;
+ }
+ default:
+ {
+ throw new IllegalArgumentException("Invalid type: " + type);
+ }
+ }
+ }
+ }
+ }
+
+ public synchronized void encode(final MessagingBuffer buffer)
+ {
+ if (properties == null)
+ {
+ buffer.putByte(NULL);
+ }
+ else
+ {
+ buffer.putByte(NOT_NULL);
+
+ buffer.putInt(properties.size());
+
+ for (Map.Entry<SimpleString, PropertyValue> entry : properties.entrySet())
+ {
+ SimpleString s = entry.getKey();
+ byte[] data = s.getData();
+ buffer.putInt(data.length);
+ buffer.putBytes(data);
+
+ entry.getValue().write(buffer);
+ }
+ }
+ }
+
+ public int getEncodeSize()
+ {
+ if (properties == null)
+ {
+ return SIZE_BYTE;
+ }
+ else
+ {
+ return SIZE_BYTE + SIZE_INT + size;
+
+ }
+ }
+
+ public void clear()
+ {
+ if (properties != null)
+ {
+ properties.clear();
+ }
+ }
+
+ // Private ------------------------------------------------------------------------------------
+
+ private void checkCreateProperties()
+ {
+ if (properties == null)
+ {
+ properties = new HashMap<SimpleString, PropertyValue>();
+ }
+ }
+
+ private synchronized void doPutValue(final SimpleString key, final PropertyValue value)
+ {
+ PropertyValue oldValue = properties.put(key, value);
+ if (oldValue != null)
+ {
+ size += value.encodeSize() - oldValue.encodeSize();
+ }
+ else
+ {
+ size += SimpleString.sizeofString(key) + value.encodeSize();
+ }
+ }
+
+ private synchronized Object doRemoveProperty(final SimpleString key)
+ {
+ if (properties == null)
+ {
+ return null;
+ }
+
+ PropertyValue val = properties.remove(key);
+
+ if (val == null)
+ {
+ return null;
+ }
+ else
+ {
+ size -= SimpleString.sizeofString(key) + val.encodeSize();
+
+ return val.getValue();
+ }
+ }
+
+ private synchronized Object doGetProperty(final Object key)
+ {
+ if (properties == null)
+ {
+ return null;
+ }
+
+ PropertyValue val = properties.get(key);
+
+ if (val == null)
+ {
+ return null;
+ }
+ else
+ {
+ return val.getValue();
+ }
+ }
+
+ // Inner classes ------------------------------------------------------------------------------
+
+ private interface PropertyValue
+ {
+ Object getValue();
+
+ void write(MessagingBuffer buffer);
+
+ int encodeSize();
+ }
+
+ private static final class NullValue implements PropertyValue
+ {
+ public NullValue()
+ {
+ }
+
+ public Object getValue()
+ {
+ return null;
+ }
+
+ public void write(final MessagingBuffer buffer)
+ {
+ buffer.putByte(NULL);
+ }
+
+ public int encodeSize()
+ {
+ return SIZE_BYTE;
+ }
+
+ }
+
+ private static final class BooleanValue implements PropertyValue
+ {
+ final boolean val;
+
+ public BooleanValue(final boolean val)
+ {
+ this.val = val;
+ }
+
+ public BooleanValue(final MessagingBuffer buffer)
+ {
+ val = buffer.getBoolean();
+ }
+
+ public Object getValue()
+ {
+ return val;
+ }
+
+ public void write(final MessagingBuffer buffer)
+ {
+ buffer.putByte(BOOLEAN);
+ buffer.putBoolean(val);
+ }
+
+ public int encodeSize()
+ {
+ return SIZE_BYTE + SIZE_BOOLEAN;
+ }
+
+ }
+
+ private static final class ByteValue implements PropertyValue
+ {
+ final byte val;
+
+ public ByteValue(final byte val)
+ {
+ this.val = val;
+ }
+
+ public ByteValue(final MessagingBuffer buffer)
+ {
+ val = buffer.getByte();
+ }
+
+ public Object getValue()
+ {
+ return val;
+ }
+
+ public void write(final MessagingBuffer buffer)
+ {
+ buffer.putByte(BYTE);
+ buffer.putByte(val);
+ }
+
+ public int encodeSize()
+ {
+ return SIZE_BYTE + SIZE_BYTE;
+ }
+ }
+
+ private static final class BytesValue implements PropertyValue
+ {
+ final byte[] val;
+
+ public BytesValue(final byte[] val)
+ {
+ this.val = val;
+ }
+
+ public BytesValue(final MessagingBuffer buffer)
+ {
+ int len = buffer.getInt();
+ val = new byte[len];
+ buffer.getBytes(val);
+ }
+
+ public Object getValue()
+ {
+ return val;
+ }
+
+ public void write(final MessagingBuffer buffer)
+ {
+ buffer.putByte(BYTES);
+ buffer.putInt(val.length);
+ buffer.putBytes(val);
+ }
+
+ public int encodeSize()
+ {
+ return SIZE_BYTE + SIZE_INT + val.length;
+ }
+
+ }
+
+ private static final class ShortValue implements PropertyValue
+ {
+ final short val;
+
+ public ShortValue(final short val)
+ {
+ this.val = val;
+ }
+
+ public ShortValue(final MessagingBuffer buffer)
+ {
+ val = buffer.getShort();
+ }
+
+ public Object getValue()
+ {
+ return val;
+ }
+
+ public void write(final MessagingBuffer buffer)
+ {
+ buffer.putByte(SHORT);
+ buffer.putShort(val);
+ }
+
+ public int encodeSize()
+ {
+ return SIZE_BYTE + SIZE_SHORT;
+ }
+ }
+
+ private static final class IntValue implements PropertyValue
+ {
+ final int val;
+
+ public IntValue(final int val)
+ {
+ this.val = val;
+ }
+
+ public IntValue(final MessagingBuffer buffer)
+ {
+ val = buffer.getInt();
+ }
+
+ public Object getValue()
+ {
+ return val;
+ }
+
+ public void write(final MessagingBuffer buffer)
+ {
+ buffer.putByte(INT);
+ buffer.putInt(val);
+ }
+
+ public int encodeSize()
+ {
+ return SIZE_BYTE + SIZE_INT;
+ }
+ }
+
+ private static final class LongValue implements PropertyValue
+ {
+ final long val;
+
+ public LongValue(final long val)
+ {
+ this.val = val;
+ }
+
+ public LongValue(final MessagingBuffer buffer)
+ {
+ val = buffer.getLong();
+ }
+
+ public Object getValue()
+ {
+ return val;
+ }
+
+ public void write(final MessagingBuffer buffer)
+ {
+ buffer.putByte(LONG);
+ buffer.putLong(val);
+ }
+
+ public int encodeSize()
+ {
+ return SIZE_BYTE + SIZE_LONG;
+ }
+ }
+
+ private static final class FloatValue implements PropertyValue
+ {
+ final float val;
+
+ public FloatValue(final float val)
+ {
+ this.val = val;
+ }
+
+ public FloatValue(final MessagingBuffer buffer)
+ {
+ val = buffer.getFloat();
+ }
+
+ public Object getValue()
+ {
+ return val;
+ }
+
+ public void write(final MessagingBuffer buffer)
+ {
+ buffer.putByte(FLOAT);
+ buffer.putFloat(val);
+ }
+
+ public int encodeSize()
+ {
+ return SIZE_BYTE + SIZE_FLOAT;
+ }
+
+ }
+
+ private static final class DoubleValue implements PropertyValue
+ {
+ final double val;
+
+ public DoubleValue(final double val)
+ {
+ this.val = val;
+ }
+
+ public DoubleValue(final MessagingBuffer buffer)
+ {
+ val = buffer.getDouble();
+ }
+
+ public Object getValue()
+ {
+ return val;
+ }
+
+ public void write(final MessagingBuffer buffer)
+ {
+ buffer.putByte(DOUBLE);
+ buffer.putDouble(val);
+ }
+
+ public int encodeSize()
+ {
+ return SIZE_BYTE + SIZE_DOUBLE;
+ }
+ }
+
+ private static final class CharValue implements PropertyValue
+ {
+ final char val;
+
+ public CharValue(final char val)
+ {
+ this.val = val;
+ }
+
+ public CharValue(final MessagingBuffer buffer)
+ {
+ val = buffer.getChar();
+ }
+
+ public Object getValue()
+ {
+ return val;
+ }
+
+ public void write(final MessagingBuffer buffer)
+ {
+ buffer.putByte(CHAR);
+ buffer.putChar(val);
+ }
+
+ public int encodeSize()
+ {
+ return SIZE_BYTE + SIZE_CHAR;
+ }
+ }
+
+ private static final class StringValue implements PropertyValue
+ {
+ final SimpleString val;
+
+ public StringValue(final SimpleString val)
+ {
+ this.val = val;
+ }
+
+ public StringValue(final MessagingBuffer buffer)
+ {
+ val = buffer.getSimpleString();
+ }
+
+ public Object getValue()
+ {
+ return val;
+ }
+
+ public void write(final MessagingBuffer buffer)
+ {
+ buffer.putByte(STRING);
+ buffer.putSimpleString(val);
+ }
+
+ public int encodeSize()
+ {
+ return SIZE_BYTE + SimpleString.sizeofString(val);
+ }
+ }
+}
Copied: trunk/src/main/org/jboss/messaging/utils/UTF8Util.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/UTF8Util.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/UTF8Util.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/UTF8Util.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,280 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+import java.io.IOException;
+import java.lang.ref.SoftReference;
+
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ *
+ * A UTF8Util
+ *
+ * This class will write UTFs directly to the ByteOutput (through the MessageBuffer interface)
+ *
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ *
+ * Created Feb 20, 2009 1:37:18 PM
+ *
+ *
+ */
+public class UTF8Util
+{
+ static boolean optimizeStrings = true;
+
+ private static final Logger log = Logger.getLogger(UTF8Util.class);
+
+ private static final boolean isDebug = log.isDebugEnabled();
+
+ private static ThreadLocal<SoftReference<StringUtilBuffer>> currenBuffer = new ThreadLocal<SoftReference<StringUtilBuffer>>();
+
+ public static void saveUTF(final MessagingBuffer out, final String str) throws IOException
+ {
+ StringUtilBuffer buffer = getThreadLocalBuffer();
+
+ if (str.length() > 0xffff)
+ {
+ throw new IllegalArgumentException("the specified string is too long (" + str.length() + ")");
+ }
+
+ final int len = calculateUTFSize(str, buffer);
+
+ if (len > 0xffff)
+ {
+ throw new IllegalArgumentException("the encoded string is too long (" + len + ")");
+ }
+
+ out.putShort((short)len);
+
+ if (len > buffer.byteBuffer.length)
+ {
+ buffer.resizeByteBuffer(len);
+ }
+
+ if (len == (long)str.length())
+ {
+ for (int byteLocation = 0; byteLocation < len; byteLocation++)
+ {
+ buffer.byteBuffer[byteLocation] = (byte)buffer.charBuffer[byteLocation];
+ }
+ out.putBytes(buffer.byteBuffer, 0, len);
+ }
+ else
+ {
+ if (isDebug)
+ {
+ log.debug("Saving string with utfSize=" + len + " stringSize=" + str.length());
+ }
+
+ int stringLength = str.length();
+
+ int charCount = 0;
+
+ for (int i = 0; i < stringLength; i++)
+ {
+ char charAtPos = buffer.charBuffer[i];
+ if (charAtPos >= 1 && charAtPos < 0x7f)
+ {
+ buffer.byteBuffer[charCount++] = (byte)charAtPos;
+ }
+ else if (charAtPos >= 0x800)
+ {
+ buffer.byteBuffer[charCount++] = (byte)(0xE0 | charAtPos >> 12 & 0x0F);
+ buffer.byteBuffer[charCount++] = (byte)(0x80 | charAtPos >> 6 & 0x3F);
+ buffer.byteBuffer[charCount++] = (byte)(0x80 | charAtPos >> 0 & 0x3F);
+ }
+ else
+ {
+ buffer.byteBuffer[charCount++] = (byte)(0xC0 | charAtPos >> 6 & 0x1F);
+ buffer.byteBuffer[charCount++] = (byte)(0x80 | charAtPos >> 0 & 0x3F);
+
+ }
+ }
+ out.putBytes(buffer.byteBuffer, 0, len);
+ }
+ }
+
+ public static String readUTF(final MessagingBuffer input) throws IOException
+ {
+ StringUtilBuffer buffer = getThreadLocalBuffer();
+
+ final int size = input.getUnsignedShort();
+
+ if (size > buffer.byteBuffer.length)
+ {
+ buffer.resizeByteBuffer(size);
+ }
+
+ if (size > buffer.charBuffer.length)
+ {
+ buffer.resizeCharBuffer(size);
+ }
+
+ if (isDebug)
+ {
+ log.debug("Reading string with utfSize=" + size);
+ }
+
+ int count = 0;
+ int byte1, byte2, byte3;
+ int charCount = 0;
+
+ input.getBytes(buffer.byteBuffer, 0, size);
+
+ while (count < size)
+ {
+ byte1 = buffer.byteBuffer[count++];
+
+ if (byte1 > 0 && byte1 <= 0x7F)
+ {
+ buffer.charBuffer[charCount++] = (char)byte1;
+ }
+ else
+ {
+ int c = byte1 & 0xff;
+ switch (c >> 4)
+ {
+ case 0xc:
+ case 0xd:
+ byte2 = buffer.byteBuffer[count++];
+ buffer.charBuffer[charCount++] = (char)((c & 0x1F) << 6 | byte2 & 0x3F);
+ break;
+ case 0xe:
+ byte2 = buffer.byteBuffer[count++];
+ byte3 = buffer.byteBuffer[count++];
+ buffer.charBuffer[charCount++] = (char)((c & 0x0F) << 12 | (byte2 & 0x3F) << 6 | (byte3 & 0x3F) << 0);
+ break;
+ }
+ }
+ }
+
+ return new String(buffer.charBuffer, 0, charCount);
+
+ }
+
+ private static StringUtilBuffer getThreadLocalBuffer()
+ {
+ SoftReference<StringUtilBuffer> softReference = currenBuffer.get();
+ StringUtilBuffer value;
+ if (softReference == null)
+ {
+ value = new StringUtilBuffer();
+ softReference = new SoftReference<StringUtilBuffer>(value);
+ currenBuffer.set(softReference);
+ }
+ else
+ {
+ value = softReference.get();
+ }
+
+ if (value == null)
+ {
+ value = new StringUtilBuffer();
+ softReference = new SoftReference<StringUtilBuffer>(value);
+ currenBuffer.set(softReference);
+ }
+
+ return value;
+ }
+
+ public static void clearBuffer()
+ {
+ SoftReference<StringUtilBuffer> ref = currenBuffer.get();
+ if (ref.get() != null)
+ {
+ ref.clear();
+ }
+ }
+
+ public static int calculateUTFSize(final String str, final StringUtilBuffer stringBuffer)
+ {
+ int calculatedLen = 0;
+
+ int stringLength = str.length();
+
+ if (stringLength > stringBuffer.charBuffer.length)
+ {
+ stringBuffer.resizeCharBuffer(stringLength);
+ }
+
+ str.getChars(0, stringLength, stringBuffer.charBuffer, 0);
+
+ for (int i = 0; i < stringLength; i++)
+ {
+ char c = stringBuffer.charBuffer[i];
+
+ if (c >= 1 && c < 0x7f)
+ {
+ calculatedLen++;
+ }
+ else if (c >= 0x800)
+ {
+ calculatedLen += 3;
+ }
+ else
+ {
+ calculatedLen += 2;
+ }
+ }
+ return calculatedLen;
+ }
+
+ private static class StringUtilBuffer
+ {
+
+ public char charBuffer[];
+
+ public byte byteBuffer[];
+
+ public void resizeCharBuffer(final int newSize)
+ {
+ if (newSize > charBuffer.length)
+ {
+ charBuffer = new char[newSize];
+ }
+ }
+
+ public void resizeByteBuffer(final int newSize)
+ {
+ if (newSize > byteBuffer.length)
+ {
+ this.byteBuffer = new byte[newSize];
+ }
+ }
+
+ public StringUtilBuffer()
+ {
+ this(1024, 1024);
+ }
+
+ public StringUtilBuffer(final int sizeChar, final int sizeByte)
+ {
+ charBuffer = new char[sizeChar];
+ byteBuffer = new byte[sizeByte];
+ }
+
+ }
+
+}
Property changes on: trunk/src/main/org/jboss/messaging/utils/UTF8Util.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/src/main/org/jboss/messaging/utils/UUID.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/UUID.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/UUID.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/UUID.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,222 @@
+/* JUG Java Uuid Generator
+ *
+ * Copyright (c) 2002- Tatu Saloranta, tatu.saloranta at iki.fi
+ *
+ * Licensed under the License specified in the file licenses/LICENSE.txt which is
+ * included with the source code.
+ * You may not use this file except in compliance with the License.
+ *
+ * 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.messaging.utils;
+
+
+/**
+ * UUID represents Universally Unique Identifiers (aka Global UID in Windows
+ * world). UUIDs are usually generated via UUIDGenerator (or in case of 'Null
+ * UUID', 16 zero bytes, via static method getNullUUID()), or received from
+ * external systems.
+ *
+ * By default class caches the string presentations of UUIDs so that description
+ * is only created the first time it's needed. For memory stingy applications
+ * this caching can be turned off (note though that if uuid.toString() is never
+ * called, desc is never calculated so only loss is the space allocated for the
+ * desc pointer... which can of course be commented out to save memory).
+ *
+ * Similarly, hash code is calculated when it's needed for the first time, and
+ * from thereon that value is just returned. This means that using UUIDs as keys
+ * should be reasonably efficient.
+ *
+ * UUIDs can be compared for equality, serialized, cloned and even sorted.
+ * Equality is a simple bit-wise comparison. Ordering (for sorting) is done by
+ * first ordering based on type (in the order of numeric values of types),
+ * secondarily by time stamp (only for time-based time stamps), and finally by
+ * straight numeric byte-by-byte comparison (from most to least significant
+ * bytes).
+ */
+
+public final class UUID
+{
+ private final static String kHexChars = "0123456789abcdefABCDEF";
+
+ public final static byte INDEX_CLOCK_HI = 6;
+ public final static byte INDEX_CLOCK_MID = 4;
+ public final static byte INDEX_CLOCK_LO = 0;
+
+ public final static byte INDEX_TYPE = 6;
+ // Clock seq. & variant are multiplexed...
+ public final static byte INDEX_CLOCK_SEQUENCE = 8;
+ public final static byte INDEX_VARIATION = 8;
+
+ public final static byte TYPE_NULL = 0;
+ public final static byte TYPE_TIME_BASED = 1;
+ public final static byte TYPE_DCE = 2; // Not used
+ public final static byte TYPE_NAME_BASED = 3;
+ public final static byte TYPE_RANDOM_BASED = 4;
+
+ /*
+ * 'Standard' namespaces defined (suggested) by UUID specs:
+ */
+ public final static String NAMESPACE_DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
+ public final static String NAMESPACE_URL = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
+ public final static String NAMESPACE_OID = "6ba7b812-9dad-11d1-80b4-00c04fd430c8";
+ public final static String NAMESPACE_X500 = "6ba7b814-9dad-11d1-80b4-00c04fd430c8";
+
+ /*
+ * By default let's cache desc, can be turned off. For hash code there's no
+ * point in turning it off (since the int is already part of the instance
+ * memory allocation); if you want to save those 4 bytes (or possibly bit
+ * more if alignment is bad) just comment out hash caching.
+ */
+ private static boolean sDescCaching = true;
+
+ private final byte[] mId = new byte[16];
+ // Both string presentation and hash value may be cached...
+ private transient String mDesc = null;
+ private transient int mHashCode = 0;
+
+ /**
+ * Protected constructor used by UUIDGenerator
+ *
+ * @param type
+ * UUID type
+ * @param data
+ * 16 byte UUID contents
+ */
+ public UUID(int type, byte[] data)
+ {
+ for (int i = 0; i < 16; ++i)
+ {
+ mId[i] = data[i];
+ }
+ // Type is multiplexed with time_hi:
+ mId[INDEX_TYPE] &= (byte) 0x0F;
+ mId[INDEX_TYPE] |= (byte) (type << 4);
+ // Variant masks first two bits of the clock_seq_hi:
+ mId[INDEX_VARIATION] &= (byte) 0x3F;
+ mId[INDEX_VARIATION] |= (byte) 0x80;
+ }
+
+ public final byte[] asBytes()
+ {
+ return mId;
+ }
+
+ /**
+ * Could use just the default hash code, but we can probably create a better
+ * identity hash (ie. same contents generate same hash) manually, without
+ * sacrificing speed too much. Although multiplications with modulos would
+ * generate better hashing, let's use just shifts, and do 2 bytes at a time.
+ * <p>
+ * Of course, assuming UUIDs are randomized enough, even simpler approach
+ * might be good enough?
+ * <p>
+ * Is this a good hash? ... one of these days I better read more about basic
+ * hashing techniques I swear!
+ */
+ private final static int[] kShifts = { 3, 7, 17, 21, 29, 4, 9 };
+
+ public final int hashCode()
+ {
+ if (mHashCode == 0)
+ {
+ // Let's handle first and last byte separately:
+ int result = mId[0] & 0xFF;
+
+ result |= (result << 16);
+ result |= (result << 8);
+
+ for (int i = 1; i < 15; i += 2)
+ {
+ int curr = (mId[i] & 0xFF) << 8 | (mId[i + 1] & 0xFF);
+ int shift = kShifts[i >> 1];
+
+ if (shift > 16)
+ {
+ result ^= (curr << shift) | (curr >>> (32 - shift));
+ } else
+ {
+ result ^= (curr << shift);
+ }
+ }
+
+ // and then the last byte:
+ int last = mId[15] & 0xFF;
+ result ^= (last << 3);
+ result ^= (last << 13);
+
+ result ^= (last << 27);
+ // Let's not accept hash 0 as it indicates 'not hashed yet':
+ if (result == 0)
+ {
+ mHashCode = -1;
+ } else
+ {
+ mHashCode = result;
+ }
+ }
+ return mHashCode;
+ }
+
+ public final String toString()
+ {
+ /*
+ * Could be synchronized, but there isn't much harm in just taking our
+ * chances (ie. in the worst case we'll form the string more than once...
+ * but result is the same)
+ */
+
+ if (mDesc == null)
+ {
+ StringBuffer b = new StringBuffer(36);
+
+ for (int i = 0; i < 16; ++i)
+ {
+ // Need to bypass hyphens:
+ switch (i)
+ {
+ case 4:
+ case 6:
+ case 8:
+ case 10:
+ b.append('-');
+ }
+ int hex = mId[i] & 0xFF;
+ b.append(kHexChars.charAt(hex >> 4));
+ b.append(kHexChars.charAt(hex & 0x0f));
+ }
+ if (!sDescCaching)
+ {
+ return b.toString();
+ }
+ mDesc = b.toString();
+ }
+ return mDesc;
+ }
+
+ /**
+ * Checking equality of UUIDs is easy; just compare the 128-bit number.
+ */
+ public final boolean equals(Object o)
+ {
+ if (!(o instanceof UUID))
+ {
+ return false;
+ }
+ byte[] otherId = ((UUID) o).mId;
+ byte[] thisId = mId;
+ for (int i = 0; i < 16; ++i)
+ {
+ if (otherId[i] != thisId[i])
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+}
Copied: trunk/src/main/org/jboss/messaging/utils/UUIDGenerator.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/UUIDGenerator.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/UUIDGenerator.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/UUIDGenerator.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,292 @@
+/* JUG Java Uuid Generator
+ *
+ * Copyright (c) 2002- Tatu Saloranta, tatu.saloranta at iki.fi
+ *
+ * Licensed under the License specified in the file licenses/LICENSE.txt which is
+ * included with the source code.
+ * You may not use this file except in compliance with the License.
+ *
+ * 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.messaging.utils;
+
+import java.lang.reflect.Method;
+import java.net.NetworkInterface;
+import java.security.SecureRandom;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.Random;
+
+import org.jboss.messaging.core.logging.Logger;
+
+public final class UUIDGenerator
+{
+ private final static UUIDGenerator sSingleton = new UUIDGenerator();
+
+ private static final Logger log = Logger.getLogger(UUIDGenerator.class);
+
+ // Windows has some fake adapters that will return the same HARDWARE ADDRESS on any computer. We need to ignore those
+ private static final byte[][] BLACK_LIST = new byte[][] { { 2, 0, 84, 85, 78, 1 } };
+
+ /**
+ * Random-generator, used by various UUID-generation methods:
+ */
+ private Random mRnd = null;
+
+ private final Object mTimerLock = new Object();
+
+ private UUIDTimer mTimer = null;
+
+ private byte[] address;
+
+ /**
+ * Constructor is private to enforce singleton access.
+ */
+ private UUIDGenerator()
+ {
+ }
+
+ /**
+ * Method used for accessing the singleton generator instance.
+ */
+ public static UUIDGenerator getInstance()
+ {
+ return sSingleton;
+ }
+
+ /*
+ * ///////////////////////////////////////////////////// // Configuration
+ * /////////////////////////////////////////////////////
+ */
+
+ /**
+ * Method for getting the shared random number generator used for generating
+ * the UUIDs. This way the initialization cost is only taken once; access
+ * need not be synchronized (or in cases where it has to, SecureRandom takes
+ * care of it); it might even be good for getting really 'random' stuff to
+ * get shared access...
+ */
+ public final Random getRandomNumberGenerator()
+ {
+ /*
+ * Could be synchronized, but since side effects are trivial (ie.
+ * possibility of generating more than one SecureRandom, of which all but
+ * one are dumped) let's not add synchronization overhead:
+ */
+ if (mRnd == null)
+ {
+ mRnd = new SecureRandom();
+ }
+ return mRnd;
+ }
+
+ public final UUID generateTimeBasedUUID(final byte[] byteAddr)
+ {
+ byte[] contents = new byte[16];
+ int pos = 10;
+ for (int i = 0; i < 6; ++i)
+ {
+ contents[pos + i] = byteAddr[i];
+ }
+
+ synchronized (mTimerLock)
+ {
+ if (mTimer == null)
+ {
+ mTimer = new UUIDTimer(getRandomNumberGenerator());
+ }
+
+ mTimer.getTimestamp(contents);
+ }
+
+ return new UUID(UUID.TYPE_TIME_BASED, contents);
+ }
+
+ public final byte[] generateDummyAddress()
+ {
+ Random rnd = getRandomNumberGenerator();
+ byte[] dummy = new byte[6];
+ rnd.nextBytes(dummy);
+ /* Need to set the broadcast bit to indicate it's not a real
+ * address.
+ */
+ dummy[0] |= (byte)0x01;
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("using dummy address " + asString(dummy));
+ }
+ return dummy;
+ }
+
+ /**
+ * If running java 6 or above, returns {@link NetworkInterface#getHardwareAddress()}, else return <code>null</code>.
+ * The first hardware address is returned when iterating all the NetworkInterfaces
+ */
+ public final static byte[] getHardwareAddress()
+ {
+ Method getHardwareAddressMethod;
+ Method isUpMethod;
+ Method isLoopbackMethod;
+ Method isVirtualMethod;
+ try
+ {
+ getHardwareAddressMethod = NetworkInterface.class.getMethod("getHardwareAddress");
+ isUpMethod = NetworkInterface.class.getMethod("isUp");
+ isLoopbackMethod = NetworkInterface.class.getMethod("isLoopback");
+ isVirtualMethod = NetworkInterface.class.getMethod("isVirtual");
+ }
+ catch (Throwable t)
+ {
+ // not on Java 6 or not enough security permission
+ return null;
+ }
+
+ try
+ {
+ Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
+ while (networkInterfaces.hasMoreElements())
+ {
+ NetworkInterface networkInterface = networkInterfaces.nextElement();
+ boolean up = (Boolean)isUpMethod.invoke(networkInterface);
+ boolean loopback = (Boolean)isLoopbackMethod.invoke(networkInterface);
+ boolean virtual = (Boolean)isVirtualMethod.invoke(networkInterface);
+
+ if (loopback || virtual || !up)
+ {
+ continue;
+ }
+
+ Object res = getHardwareAddressMethod.invoke(networkInterface);
+ if (res != null && res instanceof byte[])
+ {
+ byte[] address = (byte[])res;
+ byte[] paddedAddress = getZeroPaddedSixBytes(address);
+
+ if (isBlackList(address))
+ {
+ continue;
+ }
+
+ if (paddedAddress != null)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("using hardware address " + asString(paddedAddress));
+ }
+ return paddedAddress;
+ }
+ }
+ }
+ }
+ catch (Throwable t)
+ {
+ }
+
+ return null;
+ }
+
+ public final SimpleString generateSimpleStringUUID()
+ {
+ return new SimpleString(generateStringUUID());
+ }
+
+ public final UUID generateUUID()
+ {
+ byte[] address = getAddressBytes();
+
+ UUID uid = generateTimeBasedUUID(address);
+
+ return uid;
+ }
+
+ public final String generateStringUUID()
+ {
+ byte[] address = getAddressBytes();
+
+ if (address == null)
+ {
+ return java.util.UUID.randomUUID().toString();
+ }
+ else
+ {
+ return generateTimeBasedUUID(address).toString();
+ }
+ }
+
+ public final static byte[] getZeroPaddedSixBytes(final byte[] bytes)
+ {
+ if (bytes == null)
+ {
+ return null;
+ }
+ if (bytes.length > 0 && bytes.length <= 6)
+ {
+ if (bytes.length == 6)
+ {
+ return bytes;
+ }
+ else
+ {
+ // pad with zeroes to have a 6-byte array
+ byte[] paddedAddress = new byte[6];
+ System.arraycopy(bytes, 0, paddedAddress, 0, bytes.length);
+ for (int i = bytes.length; i < 6; i++)
+ {
+ paddedAddress[i] = 0;
+ }
+ return paddedAddress;
+ }
+ }
+ return null;
+ }
+
+ // Private -------------------------------------------------------
+
+ private static final boolean isBlackList(final byte[] address)
+ {
+ for (byte[] blackList : BLACK_LIST)
+ {
+ if (Arrays.equals(address, blackList))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private final byte[] getAddressBytes()
+ {
+ if (address == null)
+ {
+ address = getHardwareAddress();
+ if (address == null)
+ {
+ address = generateDummyAddress();
+ }
+ }
+
+ return address;
+ }
+
+ private static final String asString(final byte[] bytes)
+ {
+ if (bytes == null)
+ {
+ return null;
+ }
+
+ String s = "";
+ for (int i = 0; i < bytes.length - 1; i++)
+ {
+ s += Integer.toHexString(bytes[i]) + ":";
+ }
+ s += bytes[bytes.length - 1];
+ return s;
+ }
+}
\ No newline at end of file
Copied: trunk/src/main/org/jboss/messaging/utils/UUIDTimer.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/UUIDTimer.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/UUIDTimer.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/UUIDTimer.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,317 @@
+/* JUG Java Uuid Generator
+ *
+ * Copyright (c) 2002- Tatu Saloranta, tatu.saloranta at iki.fi
+ *
+ * Licensed under the License specified in the file licenses/LICENSE.txt which is
+ * included with the source code.
+ * You may not use this file except in compliance with the License.
+ *
+ * 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.messaging.utils;
+
+import java.util.Random;
+
+/**
+ * UUIDTimer produces the time stamps required for time-based UUIDs. It works as
+ * outlined in the UUID specification, with following implementation:
+ * <ul>
+ * <li>Java classes can only product time stamps with maximum resolution of one
+ * millisecond (at least before JDK 1.5). To compensate, an additional counter
+ * is used, so that more than one UUID can be generated between java clock
+ * updates. Counter may be used to generate up to 10000 UUIDs for each distrinct
+ * java clock value.
+ * <li>Due to even lower clock resolution on some platforms (older Windows
+ * versions use 55 msec resolution), timestamp value can also advanced ahead of
+ * physical value within limits (by default, up 100 millisecond ahead of
+ * reported), iff necessary (ie. 10000 instances created before clock time
+ * advances).
+ * <li>As an additional precaution, counter is initialized not to 0 but to a
+ * random 8-bit number, and each time clock changes, lowest 8-bits of counter
+ * are preserved. The purpose it to make likelyhood of multi-JVM multi-instance
+ * generators to collide, without significantly reducing max. UUID generation
+ * speed. Note though that using more than one generator (from separate JVMs) is
+ * strongly discouraged, so hopefully this enhancement isn't needed. This 8-bit
+ * offset has to be reduced from total max. UUID count to preserve ordering
+ * property of UUIDs (ie. one can see which UUID was generated first for given
+ * UUID generator); the resulting 9500 UUIDs isn't much different from the
+ * optimal choice.
+ * <li>Finally, as of version 2.0 and onwards, optional external timestamp
+ * synchronization can be done. This is done similar to the way UUID
+ * specification suggests; except that since there is no way to lock the whole
+ * system, file-based locking is used. This works between multiple JVMs and Jug
+ * instances.
+ * </ul>
+ * <p>
+ * Some additional assumptions about calculating the timestamp:
+ * <ul>
+ * <li>System.currentTimeMillis() is assumed to give time offset in UTC, or at
+ * least close enough thing to get correct timestamps. The alternate route would
+ * have to go through calendar object, use TimeZone offset to get to UTC, and
+ * then modify. Using currentTimeMillis should be much faster to allow rapid
+ * UUID creation.
+ * <li>Similarly, the constant used for time offset between 1.1.1970 and start
+ * of Gregorian calendar is assumed to be correct (which seems to be the case
+ * when testing with Java calendars).
+ * </ul>
+ * <p>
+ * Note about synchronization: this class is assumed to always be called from a
+ * synchronized context (caller locks on either this object, or a similar timer
+ * lock), and so has no method synchronization.
+ */
+public class UUIDTimer
+{
+ // // // Constants
+
+ /**
+ * Since System.longTimeMillis() returns time from january 1st 1970, and
+ * UUIDs need time from the beginning of gregorian calendar (15-oct-1582),
+ * need to apply the offset:
+ */
+ private final static long kClockOffset = 0x01b21dd213814000L;
+ /**
+ * Also, instead of getting time in units of 100nsecs, we get something with
+ * max resolution of 1 msec... and need the multiplier as well
+ */
+ private final static long kClockMultiplier = 10000;
+ private final static long kClockMultiplierL = 10000L;
+
+ /**
+ * Let's allow "virtual" system time to advance at most 100 milliseconds
+ * beyond actual physical system time, before adding delays.
+ */
+ private final static long kMaxClockAdvance = 100L;
+
+ // // // Configuration
+
+ private final Random mRnd;
+
+ // // // Clock state:
+
+ /**
+ * Additional state information used to protect against anomalous cases
+ * (clock time going backwards, node id getting mixed up). Third byte is
+ * actually used for seeding counter on counter overflow.
+ */
+ private final byte[] mClockSequence = new byte[3];
+
+ /**
+ * Last physical timestamp value <code>System.currentTimeMillis()</code>
+ * returned: used to catch (and report) cases where system clock goes
+ * backwards. Is also used to limit "drifting", that is, amount timestamps
+ * used can differ from the system time value. This value is not guaranteed
+ * to be monotonically increasing.
+ */
+ private long mLastSystemTimestamp = 0L;
+
+ /**
+ * Timestamp value last used for generating a UUID (along with
+ * {@link #mClockCounter}. Usually the same as {@link #mLastSystemTimestamp},
+ * but not always (system clock moved backwards). Note that this value is
+ * guaranteed to be monotonically increasing; that is, at given absolute time
+ * points t1 and t2 (where t2 is after t1), t1 <= t2 will always hold true.
+ */
+ private long mLastUsedTimestamp = 0L;
+
+ /**
+ * Counter used to compensate inadequate resolution of JDK system timer.
+ */
+ private int mClockCounter = 0;
+
+ UUIDTimer(Random rnd)
+ {
+ mRnd = rnd;
+ initCounters(rnd);
+ mLastSystemTimestamp = 0L;
+ // This may get overwritten by the synchronizer
+ mLastUsedTimestamp = 0L;
+ }
+
+ private void initCounters(Random rnd)
+ {
+ /*
+ * Let's generate the clock sequence field now; as with counter, this
+ * reduces likelihood of collisions (as explained in UUID specs)
+ */
+ rnd.nextBytes(mClockSequence);
+ /*
+ * Ok, let's also initialize the counter... Counter is used to make it
+ * slightly less likely that two instances of UUIDGenerator (from separate
+ * JVMs as no more than one can be created in one JVM) would produce
+ * colliding time-based UUIDs. The practice of using multiple generators,
+ * is strongly discouraged, of course, but just in case...
+ */
+ mClockCounter = mClockSequence[2] & 0xFF;
+ }
+
+ public void getTimestamp(byte[] uuidData)
+ {
+ // First the clock sequence:
+ uuidData[UUID.INDEX_CLOCK_SEQUENCE] = mClockSequence[0];
+ uuidData[UUID.INDEX_CLOCK_SEQUENCE + 1] = mClockSequence[1];
+
+ long systime = System.currentTimeMillis();
+
+ /*
+ * Let's first verify that the system time is not going backwards;
+ * independent of whether we can use it:
+ */
+ if (systime < mLastSystemTimestamp)
+ {
+ // Logger.logWarning("System time going backwards! (got value
+ // "+systime+", last "+mLastSystemTimestamp);
+ // Let's write it down, still
+ mLastSystemTimestamp = systime;
+ }
+
+ /*
+ * But even without it going backwards, it may be less than the last one
+ * used (when generating UUIDs fast with coarse clock resolution; or if
+ * clock has gone backwards over reboot etc).
+ */
+ if (systime <= mLastUsedTimestamp)
+ {
+ /*
+ * Can we just use the last time stamp (ok if the counter hasn't hit
+ * max yet)
+ */
+ if (mClockCounter < kClockMultiplier)
+ { // yup, still have room
+ systime = mLastUsedTimestamp;
+ } else
+ { // nope, have to roll over to next value and maybe wait
+ long actDiff = mLastUsedTimestamp - systime;
+ long origTime = systime;
+ systime = mLastUsedTimestamp + 1L;
+
+ // Logger.logWarning("Timestamp over-run: need to reinitialize
+ // random sequence");
+
+ /*
+ * Clock counter is now at exactly the multiplier; no use just
+ * anding its value. So, we better get some random numbers
+ * instead...
+ */
+ initCounters(mRnd);
+
+ /*
+ * But do we also need to slow down? (to try to keep virtual time
+ * close to physical time; ie. either catch up when system clock has
+ * been moved backwards, or when coarse clock resolution has forced
+ * us to advance virtual timer too far)
+ */
+ if (actDiff >= kMaxClockAdvance)
+ {
+ slowDown(origTime, actDiff);
+ }
+ }
+ } else
+ {
+ /*
+ * Clock has advanced normally; just need to make sure counter is reset
+ * to a low value (need not be 0; good to leave a small residual to
+ * further decrease collisions)
+ */
+ mClockCounter &= 0xFF;
+ }
+
+ mLastUsedTimestamp = systime;
+
+ /*
+ * Now, let's translate the timestamp to one UUID needs, 100ns unit offset
+ * from the beginning of Gregorian calendar...
+ */
+ systime *= kClockMultiplierL;
+ systime += kClockOffset;
+
+ // Plus add the clock counter:
+ systime += mClockCounter;
+ // and then increase
+ ++mClockCounter;
+
+ /*
+ * Time fields are nicely split across the UUID, so can't just linearly
+ * dump the stamp:
+ */
+ int clockHi = (int) (systime >>> 32);
+ int clockLo = (int) systime;
+
+ uuidData[UUID.INDEX_CLOCK_HI] = (byte) (clockHi >>> 24);
+ uuidData[UUID.INDEX_CLOCK_HI + 1] = (byte) (clockHi >>> 16);
+ uuidData[UUID.INDEX_CLOCK_MID] = (byte) (clockHi >>> 8);
+ uuidData[UUID.INDEX_CLOCK_MID + 1] = (byte) clockHi;
+
+ uuidData[UUID.INDEX_CLOCK_LO] = (byte) (clockLo >>> 24);
+ uuidData[UUID.INDEX_CLOCK_LO + 1] = (byte) (clockLo >>> 16);
+ uuidData[UUID.INDEX_CLOCK_LO + 2] = (byte) (clockLo >>> 8);
+ uuidData[UUID.INDEX_CLOCK_LO + 3] = (byte) clockLo;
+ }
+
+ /*
+ * /////////////////////////////////////////////////////////// // Private
+ * methods ///////////////////////////////////////////////////////////
+ */
+
+ private final static int MAX_WAIT_COUNT = 50;
+
+ /**
+ * Simple utility method to use to wait for couple of milliseconds, to let
+ * system clock hopefully advance closer to the virtual timestamps used.
+ * Delay is kept to just a millisecond or two, to prevent excessive blocking;
+ * but that should be enough to eventually synchronize physical clock with
+ * virtual clock values used for UUIDs.
+ *
+ * @param msecs
+ * Number of milliseconds to wait for from current time point
+ */
+ private final static void slowDown(long startTime, long actDiff)
+ {
+ /*
+ * First, let's determine how long we'd like to wait. This is based on how
+ * far ahead are we as of now.
+ */
+ long ratio = actDiff / kMaxClockAdvance;
+ long delay;
+
+ if (ratio < 2L)
+ { // 200 msecs or less
+ delay = 1L;
+ } else if (ratio < 10L)
+ { // 1 second or less
+ delay = 2L;
+ } else if (ratio < 600L)
+ { // 1 minute or less
+ delay = 3L;
+ } else
+ {
+ delay = 5L;
+ }
+ // Logger.logWarning("Need to wait for "+delay+" milliseconds; virtual
+ // clock advanced too far in the future");
+ long waitUntil = startTime + delay;
+ int counter = 0;
+ do
+ {
+ try
+ {
+ Thread.sleep(delay);
+ } catch (InterruptedException ie)
+ {
+ }
+ delay = 1L;
+ /*
+ * This is just a sanity check: don't want an "infinite" loop if clock
+ * happened to be moved backwards by, say, an hour...
+ */
+ if (++counter > MAX_WAIT_COUNT)
+ {
+ break;
+ }
+ } while (System.currentTimeMillis() < waitUntil);
+ }
+}
Copied: trunk/src/main/org/jboss/messaging/utils/VariableLatch.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/VariableLatch.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/VariableLatch.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/VariableLatch.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,127 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.AbstractQueuedSynchronizer;
+
+/**
+ *
+ * <p>This class will use the framework provided to by AbstractQueuedSynchronizer.</p>
+ * <p>AbstractQueuedSynchronizer is the framework for any sort of concurrent synchronization, such as Semaphores, events, etc, based on AtomicIntegers.</p>
+ *
+ * <p>The idea is, instead of providing each user specific Latch/Synchronization, java.util.concurrent provides the framework for reuses, based on an AtomicInteger (getState())</p>
+ *
+ * <p>On JBossMessaging we have the requirement of increment and decrement a counter until the user fires a ready event (commit). At that point we just act as a regular countDown.</p>
+ *
+ * <p>Note: This latch is reusable. Once it reaches zero, you can call up again, and reuse it on further waits.</p>
+ *
+ * <p>For example: prepareTransaction will wait for the current completions, and further adds will be called on the latch. Later on when commit is called you can reuse the same latch.</p>
+ *
+ * @author Clebert Suconic
+ * */
+public class VariableLatch
+{
+ /**
+ * Look at the doc and examples provided by AbstractQueuedSynchronizer for more information
+ * @see AbstractQueuedSynchronizer*/
+ @SuppressWarnings("serial")
+ private static class CountSync extends AbstractQueuedSynchronizer
+ {
+ public CountSync()
+ {
+ setState(0);
+ }
+
+ public int getCount()
+ {
+ return getState();
+ }
+
+ @Override
+ public int tryAcquireShared(final int numberOfAqcquires)
+ {
+ return getState() == 0 ? 1 : -1;
+ }
+
+ public void add()
+ {
+ for (;;)
+ {
+ int actualState = getState();
+ int newState = actualState + 1;
+ if (compareAndSetState(actualState, newState))
+ {
+ return;
+ }
+ }
+ }
+
+ @Override
+ public boolean tryReleaseShared(final int numberOfReleases)
+ {
+ for (;;)
+ {
+ int actualState = getState();
+ if (actualState == 0)
+ {
+ return true;
+ }
+
+ int newState = actualState - numberOfReleases;
+
+ if (compareAndSetState(actualState, newState))
+ {
+ return newState == 0;
+ }
+ }
+ }
+ }
+
+ private final CountSync control = new CountSync();
+
+ public int getCount()
+ {
+ return control.getCount();
+ }
+
+ public void up()
+ {
+ control.add();
+ }
+
+ public void down()
+ {
+ control.releaseShared(1);
+ }
+
+ public void waitCompletion() throws InterruptedException
+ {
+ control.acquireSharedInterruptibly(1);
+ }
+
+ public boolean waitCompletion(final long milliseconds) throws InterruptedException
+ {
+ return control.tryAcquireSharedNanos(1, TimeUnit.MILLISECONDS.toNanos(milliseconds));
+ }
+}
Copied: trunk/src/main/org/jboss/messaging/utils/VersionLoader.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/VersionLoader.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/VersionLoader.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/VersionLoader.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.version.Version;
+import org.jboss.messaging.core.version.impl.VersionImpl;
+
+/**
+ * This loads the version info in from a version.properties file.
+ *
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="csuconic at redhat.com">Clebert Suconic</a>
+ */
+public class VersionLoader
+{
+
+ private static final Logger log = Logger.getLogger(VersionLoader.class);
+
+
+ private static Version version;
+
+ static
+ {
+ try
+ {
+ version = load();
+ }
+ catch (Throwable e)
+ {
+ version = null;
+ log.error(e.getMessage(), e);
+ }
+
+ }
+
+ public static Version getVersion()
+ {
+ if (version == null)
+ {
+ throw new RuntimeException("version.properties is not available");
+ }
+
+ return version;
+ }
+
+ private static Version load()
+ {
+ Properties versionProps = new Properties();
+ InputStream in = VersionImpl.class.getClassLoader().getResourceAsStream("version.properties");
+ try
+ {
+ if (in == null)
+ {
+ throw new RuntimeException("version.properties is not available");
+ }
+ try
+ {
+ versionProps.load(in);
+ String versionName = versionProps.getProperty("messaging.version.versionName");
+ int majorVersion = Integer.valueOf(versionProps.getProperty("messaging.version.majorVersion"));
+ int minorVersion = Integer.valueOf(versionProps.getProperty("messaging.version.minorVersion"));
+ int microVersion = Integer.valueOf(versionProps.getProperty("messaging.version.microVersion"));
+ int incrementingVersion = Integer.valueOf(versionProps.getProperty("messaging.version.incrementingVersion"));
+ String versionSuffix = versionProps.getProperty("messaging.version.versionSuffix");
+ return new VersionImpl(versionName,
+ majorVersion,
+ minorVersion,
+ microVersion,
+ incrementingVersion,
+ versionSuffix);
+ }
+ catch (IOException e)
+ {
+ //if we get here then the messaging hasnt been built properly and the version.properties is skewed in some way
+ throw new RuntimeException("unable to load version.properties", e);
+ }
+ }
+ finally
+ {
+ try
+ {
+ in.close();
+ }
+ catch (Throwable ignored)
+ {
+ }
+ }
+
+ }
+}
Copied: trunk/src/main/org/jboss/messaging/utils/XMLUtil.java (from rev 5926, trunk/src/main/org/jboss/messaging/util/XMLUtil.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/XMLUtil.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/utils/XMLUtil.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -0,0 +1,534 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.utils;
+
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Properties;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.jboss.messaging.core.logging.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ * $Id$
+ */
+public class XMLUtil
+{
+ // Constants ------------------------------------------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(XMLUtil.class);
+
+ // Static ---------------------------------------------------------------------------------------
+
+ public static Element stringToElement(String s) throws Exception
+ {
+ return readerToElement(new StringReader(s));
+ }
+
+ public static Element urlToElement(URL url) throws Exception
+ {
+ return readerToElement(new InputStreamReader(url.openStream()));
+ }
+
+ public static String readerToString(Reader r) throws Exception
+ {
+ // Read into string
+ StringBuffer buff = new StringBuffer();
+ int c;
+ while ((c = r.read()) != -1)
+ {
+ buff.append((char)c);
+ }
+ return buff.toString();
+ }
+
+ public static Element readerToElement(Reader r) throws Exception
+ {
+ // Read into string
+ StringBuffer buff = new StringBuffer();
+ int c;
+ while ((c = r.read()) != -1)
+ {
+ buff.append((char)c);
+ }
+
+ // Quick hardcoded replace, FIXME this is a kludge - use regexp to match properly
+ String s = buff.toString();
+ s = doReplace(s, "jboss.messaging.groupname", "MessagingPostOffice");
+ s = doReplace(s, "jboss.messaging.datachanneludpaddress", "228.6.6.6");
+ s = doReplace(s, "jboss.messaging.controlchanneludpaddress", "228.7.7.7");
+ s = doReplace(s, "jboss.messaging.datachanneludpport", "45567");
+ s = doReplace(s, "jboss.messaging.controlchanneludpport", "45568");
+ s = doReplace(s, "jboss.messaging.ipttl", "2");
+ s = doReplace(s, "jboss.messaging.ipttl", "8");
+
+ StringReader sreader = new StringReader(s);
+
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ // see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6529766
+ factory.setNamespaceAware(true);
+ DocumentBuilder parser = factory.newDocumentBuilder();
+ Document doc = parser.parse(new InputSource(sreader));
+ return doc.getDocumentElement();
+ }
+
+ public static String elementToString(Node n)
+ {
+
+ String name = n.getNodeName();
+
+ short type = n.getNodeType();
+
+ if (Node.CDATA_SECTION_NODE == type)
+ {
+ return "<![CDATA[" + n.getNodeValue() + "]]>";
+ }
+
+ if (name.startsWith("#"))
+ {
+ return "";
+ }
+
+ StringBuffer sb = new StringBuffer();
+ sb.append('<').append(name);
+
+ NamedNodeMap attrs = n.getAttributes();
+ if (attrs != null)
+ {
+ for (int i = 0; i < attrs.getLength(); i++)
+ {
+ Node attr = attrs.item(i);
+ sb.append(' ').append(attr.getNodeName()).append("=\"").append(attr.getNodeValue()).append("\"");
+ }
+ }
+
+ String textContent = null;
+ NodeList children = n.getChildNodes();
+
+ if (children.getLength() == 0)
+ {
+ if ((textContent = XMLUtil.getTextContent(n)) != null && !"".equals(textContent))
+ {
+ sb.append(textContent).append("</").append(name).append('>');;
+ }
+ else
+ {
+ sb.append("/>").append('\n');
+ }
+ }
+ else
+ {
+ sb.append('>').append('\n');
+ boolean hasValidChildren = false;
+ for (int i = 0; i < children.getLength(); i++)
+ {
+ String childToString = elementToString(children.item(i));
+ if (!"".equals(childToString))
+ {
+ sb.append(childToString);
+ hasValidChildren = true;
+ }
+ }
+
+ if (!hasValidChildren && ((textContent = XMLUtil.getTextContent(n)) != null))
+ {
+ sb.append(textContent);
+ }
+
+ sb.append("</").append(name).append('>');
+ }
+
+ return sb.toString();
+ }
+
+ private static final Object[] EMPTY_ARRAY = new Object[0];
+
+ /**
+ * This metod is here because Node.getTextContent() is not available in JDK 1.4 and I would like
+ * to have an uniform access to this functionality.
+ *
+ * Note: if the content is another element or set of elements, it returns a string representation
+ * of the hierarchy.
+ *
+ * TODO implementation of this method is a hack. Implement it properly.
+ */
+ public static String getTextContent(Node n)
+ {
+ if (n.hasChildNodes())
+ {
+ StringBuffer sb = new StringBuffer();
+ NodeList nl = n.getChildNodes();
+ for (int i = 0; i < nl.getLength(); i++)
+ {
+ sb.append(XMLUtil.elementToString(nl.item(i)));
+ if (i < nl.getLength() - 1)
+ {
+ sb.append('\n');
+ }
+ }
+
+ String s = sb.toString();
+ if (s.length() != 0)
+ {
+ return s;
+ }
+ }
+
+ Method[] methods = Node.class.getMethods();
+
+ for (int i = 0; i < methods.length; i++)
+ {
+ if ("getTextContent".equals(methods[i].getName()))
+ {
+ Method getTextContext = methods[i];
+ try
+ {
+ return (String)getTextContext.invoke(n, EMPTY_ARRAY);
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to invoke getTextContent() on node " + n, e);
+ return null;
+ }
+ }
+ }
+
+ String textContent = null;
+
+ if (n.hasChildNodes())
+ {
+ NodeList nl = n.getChildNodes();
+ for (int i = 0; i < nl.getLength(); i++)
+ {
+ Node c = nl.item(i);
+ if (c.getNodeType() == Node.TEXT_NODE)
+ {
+ textContent = n.getNodeValue();
+ if (textContent == null)
+ {
+ // TODO This is a hack. Get rid of it and implement this properly
+ String s = c.toString();
+ int idx = s.indexOf("#text:");
+ if (idx != -1)
+ {
+ textContent = s.substring(idx + 6).trim();
+ if (textContent.endsWith("]"))
+ {
+ textContent = textContent.substring(0, textContent.length() - 1);
+ }
+ }
+ }
+ if (textContent == null)
+ {
+ break;
+ }
+ }
+ }
+
+ // TODO This is a hack. Get rid of it and implement this properly
+ String s = n.toString();
+ int i = s.indexOf('>');
+ int i2 = s.indexOf("</");
+ if (i != -1 && i2 != -1)
+ {
+ textContent = s.substring(i + 1, i2);
+ }
+ }
+
+ return textContent;
+ }
+
+ public static void assertEquivalent(Node node, Node node2)
+ {
+ if (node == null)
+ {
+ throw new IllegalArgumentException("the first node to be compared is null");
+ }
+
+ if (node2 == null)
+ {
+ throw new IllegalArgumentException("the second node to be compared is null");
+ }
+
+ if (!node.getNodeName().equals(node2.getNodeName()))
+ {
+ throw new IllegalArgumentException("nodes have different node names");
+ }
+
+ int attrCount = 0;
+ NamedNodeMap attrs = node.getAttributes();
+ if (attrs != null)
+ {
+ attrCount = attrs.getLength();
+ }
+
+ int attrCount2 = 0;
+ NamedNodeMap attrs2 = node2.getAttributes();
+ if (attrs2 != null)
+ {
+ attrCount2 = attrs2.getLength();
+ }
+
+ if (attrCount != attrCount2)
+ {
+ throw new IllegalArgumentException("nodes hava a different number of attributes");
+ }
+
+ outer: for (int i = 0; i < attrCount; i++)
+ {
+ Node n = attrs.item(i);
+ String name = n.getNodeName();
+ String value = n.getNodeValue();
+
+ for (int j = 0; j < attrCount; j++)
+ {
+ Node n2 = attrs2.item(j);
+ String name2 = n2.getNodeName();
+ String value2 = n2.getNodeValue();
+
+ if (name.equals(name2) && value.equals(value2))
+ {
+ continue outer;
+ }
+ }
+ throw new IllegalArgumentException("attribute " + name + "=" + value + " doesn't match");
+ }
+
+ boolean hasChildren = node.hasChildNodes();
+
+ if (hasChildren != node2.hasChildNodes())
+ {
+ throw new IllegalArgumentException("one node has children and the other doesn't");
+ }
+
+ if (hasChildren)
+ {
+ NodeList nl = node.getChildNodes();
+ NodeList nl2 = node2.getChildNodes();
+
+ short[] toFilter = new short[] { Node.TEXT_NODE, Node.ATTRIBUTE_NODE, Node.COMMENT_NODE };
+ List nodes = filter(nl, toFilter);
+ List nodes2 = filter(nl2, toFilter);
+
+ int length = nodes.size();
+
+ if (length != nodes2.size())
+ {
+ throw new IllegalArgumentException("nodes hava a different number of children");
+ }
+
+ for (int i = 0; i < length; i++)
+ {
+ Node n = (Node)nodes.get(i);
+ Node n2 = (Node)nodes2.get(i);
+ assertEquivalent(n, n2);
+ }
+ }
+ }
+
+ public static String stripCDATA(String s)
+ {
+ s = s.trim();
+ if (s.startsWith("<![CDATA["))
+ {
+ s = s.substring(9);
+ int i = s.indexOf("]]>");
+ if (i == -1)
+ {
+ throw new IllegalStateException("argument starts with <![CDATA[ but cannot find pairing ]]>");
+ }
+ s = s.substring(0, i);
+ }
+ return s;
+ }
+
+ public static String replaceSystemProps(String xml)
+ {
+ Properties properties = System.getProperties();
+ Enumeration e = properties.propertyNames();
+ while (e.hasMoreElements())
+ {
+ String key = (String)e.nextElement();
+ String s = "${" + key + "}";
+ if (xml.contains(s))
+ {
+ xml = xml.replace(s, properties.getProperty(key));
+ }
+
+ }
+ return xml;
+ }
+
+ public static long parseLong(final Node elem)
+ {
+ String value = elem.getTextContent().trim();
+
+ try
+ {
+ return Long.parseLong(value);
+ }
+ catch (NumberFormatException e)
+ {
+ throw new IllegalArgumentException("Element " + elem +
+ " requires a valid Long value, but '" +
+ value +
+ "' cannot be parsed as a Long");
+ }
+ }
+
+ public static int parseInt(final Node elem)
+ {
+ String value = elem.getTextContent().trim();
+
+ try
+ {
+ return Integer.parseInt(value);
+ }
+ catch (NumberFormatException e)
+ {
+ throw new IllegalArgumentException("Element " + elem +
+ " requires a valid Integer value, but '" +
+ value +
+ "' cannot be parsed as an Integer");
+ }
+ }
+
+ public static boolean parseBoolean(final Node elem)
+ {
+ String value = elem.getTextContent().trim();
+
+ try
+ {
+ return Boolean.parseBoolean(value);
+ }
+ catch (NumberFormatException e)
+ {
+ throw new IllegalArgumentException("Element " + elem +
+ " requires a valid Boolean value, but '" +
+ value +
+ "' cannot be parsed as a Boolean");
+ }
+ }
+
+ public static double parseDouble(final Node elem)
+ {
+ String value = elem.getTextContent().trim();
+
+ try
+ {
+ return Double.parseDouble(value);
+ }
+ catch (NumberFormatException e)
+ {
+ throw new IllegalArgumentException("Element " + elem +
+ " requires a valid Double value, but '" +
+ value +
+ "' cannot be parsed as a Double");
+ }
+ }
+
+ public static void validate(Node node, String schemaFile) throws Exception
+ {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = factory.newSchema(Thread.currentThread().getContextClassLoader().getResource(schemaFile));
+ Validator validator = schema.newValidator();
+
+ // validate the DOM tree
+ try
+ {
+ validator.validate(new DOMSource(node));
+ }
+ catch (SAXException e)
+ {
+ throw new IllegalStateException("Invalid configuration", e);
+ }
+ }
+
+ // Attributes -----------------------------------------------------------------------------------
+
+ // Constructors ---------------------------------------------------------------------------------
+
+ // Public ---------------------------------------------------------------------------------------
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ private static List filter(NodeList nl, short[] typesToFilter)
+ {
+ List nodes = new ArrayList();
+
+ outer: for (int i = 0; i < nl.getLength(); i++)
+ {
+ Node n = nl.item(i);
+ short type = n.getNodeType();
+ for (int j = 0; j < typesToFilter.length; j++)
+ {
+ if (typesToFilter[j] == type)
+ {
+ continue outer;
+ }
+ }
+ nodes.add(n);
+ }
+ return nodes;
+ }
+
+ // Quick dirty replace - use a reg exp to use true default value
+ private static String doReplace(String s, String propertyName, String defaultValue)
+ {
+ String sysProp = System.getProperty(propertyName);
+
+ s = s.replace("${" + propertyName + ":" + defaultValue + "}", sysProp == null ? defaultValue : sysProp);
+
+ return s;
+ }
+
+ // Inner classes --------------------------------------------------------------------------------
+
+}
Property changes on: trunk/src/main/org/jboss/messaging/utils/XMLUtil.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -49,7 +49,7 @@
import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.jms.client.JBossConnectionFactory;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
import org.jboss.test.messaging.JBMServerTestCase;
import org.jboss.test.messaging.jms.message.SimpleJMSBytesMessage;
import org.jboss.test.messaging.jms.message.SimpleJMSMessage;
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -14,7 +14,7 @@
import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.jms.client.JBossConnectionFactory;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
import org.jboss.test.messaging.JBMServerTestCase;
/**
@@ -47,7 +47,7 @@
// All jms tests should use a specific cg which has blockOnAcknowledge = true and
// both np and p messages are sent synchronously
- List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs =
+ List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs =
new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>();
connectorConfigs.add(new Pair<TransportConfiguration, TransportConfiguration>(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"), null));
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -52,7 +52,7 @@
import org.jboss.messaging.jms.JBossQueue;
import org.jboss.messaging.jms.JBossTopic;
import org.jboss.messaging.jms.client.JBossMessage;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -35,7 +35,7 @@
import javax.naming.InitialContext;
import org.jboss.messaging.jms.client.JBossConnectionFactory;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.UUIDGenerator;
import org.jboss.test.messaging.JBMServerTestCase;
/**
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCReceiver.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCReceiver.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCReceiver.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -28,7 +28,7 @@
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.transaction.impl.XidImpl;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.UUIDGenerator;
/**
*
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCSender.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCSender.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCSender.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -28,7 +28,7 @@
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.transaction.impl.XidImpl;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.UUIDGenerator;
/**
*
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -65,8 +65,8 @@
import org.jboss.messaging.jms.server.management.JMSQueueControlMBean;
import org.jboss.messaging.jms.server.management.SubscriptionInfo;
import org.jboss.messaging.jms.server.management.TopicControlMBean;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
import org.jboss.test.messaging.tools.ConfigurationHelper;
import org.jboss.test.messaging.tools.ServerManagement;
import org.jboss.test.messaging.tools.jboss.MBeanConfigurationElement;
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/MockJBossSecurityManager.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/MockJBossSecurityManager.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/MockJBossSecurityManager.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -35,7 +35,7 @@
import javax.security.auth.message.MessageInfo;
import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.util.JNDIUtil;
+import org.jboss.messaging.utils.JNDIUtil;
import org.jboss.security.AnybodyPrincipal;
import org.jboss.security.AuthenticationManager;
import org.jboss.security.NobodyPrincipal;
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/ServiceContainerConfiguration.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/ServiceContainerConfiguration.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/ServiceContainerConfiguration.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -28,7 +28,7 @@
import java.util.Map;
import java.util.StringTokenizer;
-import org.jboss.messaging.util.XMLUtil;
+import org.jboss.messaging.utils.XMLUtil;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -170,7 +170,7 @@
try
{
- Element root = XMLUtil.readerToElement(reader);
+ Element root = org.jboss.messaging.utils.XMLUtil.readerToElement(reader);
if (!"container".equals(root.getNodeName()))
{
@@ -199,15 +199,15 @@
}
else if ("database".equals(name))
{
- currentDatabase = XMLUtil.getTextContent(n);
+ currentDatabase = org.jboss.messaging.utils.XMLUtil.getTextContent(n);
}
else if ("remoting-transport".equals(name))
{
- currentRemotingTransport = XMLUtil.getTextContent(n);
+ currentRemotingTransport = org.jboss.messaging.utils.XMLUtil.getTextContent(n);
}
else if ("manageConfirmations".equals(name))
{
- currentClusteredMode = Boolean.getBoolean(XMLUtil.getTextContent(n));
+ currentClusteredMode = Boolean.getBoolean(org.jboss.messaging.utils.XMLUtil.getTextContent(n));
}
else
{
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/jboss/MBeanConfigurationElement.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/jboss/MBeanConfigurationElement.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/jboss/MBeanConfigurationElement.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -31,7 +31,7 @@
import javax.management.ObjectName;
import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.util.XMLUtil;
+import org.jboss.messaging.utils.XMLUtil;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -138,7 +138,7 @@
{
configAttribValue = XMLUtil.getTextContent(mbeanConfigNode);
}
- configAttribValue = XMLUtil.stripCDATA(configAttribValue);
+ configAttribValue = org.jboss.messaging.utils.XMLUtil.stripCDATA(configAttribValue);
mbeanConfigAttributes.put(configAttribName, configAttribValue);
}
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/jboss/ServiceDeploymentDescriptor.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/jboss/ServiceDeploymentDescriptor.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/jboss/ServiceDeploymentDescriptor.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -30,7 +30,7 @@
import javax.management.ObjectName;
import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.util.XMLUtil;
+import org.jboss.messaging.utils.XMLUtil;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -61,7 +61,7 @@
public ServiceDeploymentDescriptor(String config) throws Exception
{
- this(XMLUtil.stringToElement(config));
+ this(org.jboss.messaging.utils.XMLUtil.stringToElement(config));
}
public ServiceDeploymentDescriptor(URL descriptorURL) throws Exception
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/util/JNDIUtilTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/util/JNDIUtilTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/util/JNDIUtilTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,7 +24,7 @@
import javax.naming.InitialContext;
import javax.naming.NameNotFoundException;
-import org.jboss.messaging.util.JNDIUtil;
+import org.jboss.messaging.utils.JNDIUtil;
import org.jboss.test.messaging.JBMServerTestCase;
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/util/MBeanConfigurationElementTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/util/MBeanConfigurationElementTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/util/MBeanConfigurationElementTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -25,7 +25,7 @@
import javax.management.ObjectName;
-import org.jboss.messaging.util.XMLUtil;
+import org.jboss.messaging.utils.XMLUtil;
import org.jboss.test.messaging.MessagingTestCase;
import org.jboss.test.messaging.tools.jboss.MBeanConfigurationElement;
import org.w3c.dom.Element;
@@ -68,7 +68,7 @@
" <attribute name=\"SomeName\" value=\"SomeValue\"/>" +
"</mbean>";
- Element e = XMLUtil.stringToElement(s);
+ Element e = org.jboss.messaging.utils.XMLUtil.stringToElement(s);
MBeanConfigurationElement mbeanConfig = new MBeanConfigurationElement(e);
assertEquals(new ObjectName("somedomain:service=SomeService"), mbeanConfig.getObjectName());
@@ -92,7 +92,7 @@
" <attribute name=\"SomeName\">SomeValue</attribute>" +
"</mbean>";
- Element e = XMLUtil.stringToElement(s);
+ Element e = org.jboss.messaging.utils.XMLUtil.stringToElement(s);
MBeanConfigurationElement mbeanConfig = new MBeanConfigurationElement(e);
assertEquals(new ObjectName("somedomain:service=SomeService"), mbeanConfig.getObjectName());
@@ -116,7 +116,7 @@
" <attribute name=\"SomeName\" value=\"SomeValue\">SomeOtherValue</attribute>" +
"</mbean>";
- Element e = XMLUtil.stringToElement(s);
+ Element e = org.jboss.messaging.utils.XMLUtil.stringToElement(s);
MBeanConfigurationElement mbeanConfig = new MBeanConfigurationElement(e);
assertEquals(new ObjectName("somedomain:service=SomeService"), mbeanConfig.getObjectName());
@@ -141,7 +141,7 @@
" <depends>somedomain:somekey=somevalue</depends>" +
"</mbean>";
- Element e = XMLUtil.stringToElement(s);
+ Element e = org.jboss.messaging.utils.XMLUtil.stringToElement(s);
MBeanConfigurationElement mbeanConfig = new MBeanConfigurationElement(e);
assertEquals(new ObjectName("somedomain:service=SomeService"), mbeanConfig.getObjectName());
@@ -186,7 +186,7 @@
" </attribute>" +
"</mbean>";
- Element e = XMLUtil.stringToElement(s);
+ Element e = org.jboss.messaging.utils.XMLUtil.stringToElement(s);
MBeanConfigurationElement mbeanConfig = new MBeanConfigurationElement(e);
Set optionalAttributeNames = mbeanConfig.attributeNames();
@@ -195,7 +195,7 @@
String attributeValue = mbeanConfig.getAttributeValue("xmlattribute");
- Node n = XMLUtil.stringToElement(attributeValue);
+ Node n = org.jboss.messaging.utils.XMLUtil.stringToElement(attributeValue);
assertEquals("something", n.getNodeName());
NodeList nl = n.getChildNodes();
@@ -229,7 +229,7 @@
" </constructor>" +
"</mbean>";
- Element e = XMLUtil.stringToElement(s);
+ Element e = org.jboss.messaging.utils.XMLUtil.stringToElement(s);
MBeanConfigurationElement mbeanConfig = new MBeanConfigurationElement(e);
assertEquals(new ObjectName("somedomain:service=SomeService"), mbeanConfig.getObjectName());
Modified: trunk/tests/src/org/jboss/messaging/tests/concurrent/server/impl/QueueTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/concurrent/server/impl/QueueTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/concurrent/server/impl/QueueTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -34,7 +34,7 @@
import org.jboss.messaging.tests.unit.core.server.impl.fakes.FakeConsumer;
import org.jboss.messaging.tests.unit.core.server.impl.fakes.FakeQueueFactory;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/DuplicateDetectionTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/DuplicateDetectionTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/DuplicateDetectionTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -35,13 +35,12 @@
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.message.impl.MessageImpl;
-import org.jboss.messaging.core.postoffice.impl.DuplicateIDCacheImpl;
import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.core.transaction.impl.XidImpl;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.UUIDGenerator;
/**
* A DuplicateDetectionTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/basic/AutoGroupClientTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/basic/AutoGroupClientTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/basic/AutoGroupClientTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -41,7 +41,7 @@
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/basic/ClientRequestorTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/basic/ClientRequestorTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/basic/ClientRequestorTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -43,7 +43,7 @@
import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A ClientRequestorTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/basic/CoreClientTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/basic/CoreClientTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/basic/CoreClientTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -36,7 +36,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
public class CoreClientTest extends UnitTestCase
{
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkTestBase.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkTestBase.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -35,7 +35,6 @@
import org.jboss.messaging.core.client.ClientProducer;
import org.jboss.messaging.core.client.ClientSession;
import org.jboss.messaging.core.client.ClientSessionFactory;
-import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.message.impl.MessageImpl;
@@ -44,8 +43,8 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.DataConstants;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.DataConstants;
+import org.jboss.messaging.utils.SimpleString;
/**
* A ChunkTestBase
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -49,8 +49,8 @@
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.tests.integration.chunkmessage.mock.MockConnector;
import org.jboss.messaging.tests.integration.chunkmessage.mock.MockConnectorFactory;
-import org.jboss.messaging.util.DataConstants;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.DataConstants;
+import org.jboss.messaging.utils.SimpleString;
/**
* A TestMessageChunk
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -55,7 +55,7 @@
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.ServiceTestBase;
import org.jboss.messaging.tests.util.SpawnedVMSupport;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A test that makes sure that a Messaging server cleans up the associated
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientExitTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientExitTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientExitTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -38,7 +38,7 @@
import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
import org.jboss.messaging.tests.util.SpawnedVMSupport;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A test that makes sure that a Messaging client gracefully exists after the last session is
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/DummyInterceptor.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/DummyInterceptor.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/DummyInterceptor.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -30,7 +30,7 @@
import org.jboss.messaging.core.remoting.Packet;
import org.jboss.messaging.core.remoting.RemotingConnection;
import org.jboss.messaging.core.remoting.impl.wireformat.SessionReceiveMessage;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeReconnectTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeReconnectTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeReconnectTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -43,8 +43,8 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.core.server.cluster.Bridge;
import org.jboss.messaging.core.server.cluster.impl.BridgeImpl;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
/**
* A BridgeReconnectTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeStartTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeStartTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeStartTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -42,8 +42,8 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.core.server.cluster.Bridge;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
/**
* A BridgeStartTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -41,8 +41,8 @@
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
/**
* A BridgeTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/SimpleTransformer.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/SimpleTransformer.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/SimpleTransformer.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -27,7 +27,7 @@
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.core.server.cluster.Transformer;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A SimpleTransformer
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -55,8 +55,8 @@
import org.jboss.messaging.core.server.cluster.ClusterConnection;
import org.jboss.messaging.core.server.cluster.RemoteQueueBinding;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
/**
* A ClusterTestBase
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ActivationTimeoutTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ActivationTimeoutTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ActivationTimeoutTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -44,7 +44,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/AutomaticFailoverWithDiscoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/AutomaticFailoverWithDiscoveryTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/AutomaticFailoverWithDiscoveryTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -46,8 +46,8 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailBackupServerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailBackupServerTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailBackupServerTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -44,7 +44,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverExpiredMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverExpiredMessageTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverExpiredMessageTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -44,7 +44,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverManagementTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverManagementTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverManagementTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -48,7 +48,7 @@
import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverNoSessionsFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverNoSessionsFailoverTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverNoSessionsFailoverTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -41,7 +41,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* Test situation where none of the sessions failover, but a new session is created
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverPreAcknowledgeTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverPreAcknowledgeTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverPreAcknowledgeTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -43,7 +43,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverScheduledMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverScheduledMessageTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverScheduledMessageTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -45,7 +45,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailureOnCreateConnectionTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailureOnCreateConnectionTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailureOnCreateConnectionTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -41,7 +41,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/JustReplicationTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/JustReplicationTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/JustReplicationTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -32,7 +32,7 @@
import org.jboss.messaging.core.client.ClientSessionFactory;
import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A LargeMessageFailoverTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -52,7 +52,7 @@
import org.jboss.messaging.jms.client.JBossBytesMessage;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A MultiThreadRandomFailoverTestBase
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -38,7 +38,7 @@
import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
import org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl;
import org.jboss.messaging.core.remoting.impl.invm.InVMConnector;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A PagingFailoverTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/RandomFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/RandomFailoverTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/RandomFailoverTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -40,7 +40,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A RandomFailoverSoakTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -41,7 +41,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectWithBackupTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectWithBackupTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectWithBackupTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -44,7 +44,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleAutomaticFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleAutomaticFailoverTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleAutomaticFailoverTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -51,7 +51,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleManualFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleManualFailoverTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleManualFailoverTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -48,7 +48,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SplitBrainTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SplitBrainTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SplitBrainTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -48,7 +48,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareAddressControlWrapperTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareAddressControlWrapperTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareAddressControlWrapperTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -34,7 +34,7 @@
import org.jboss.messaging.core.management.AddressControlMBean;
import org.jboss.messaging.core.management.RoleInfo;
import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A ReplicationAwareQueueControlWrapperTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareMessagingServerControlWrapperTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareMessagingServerControlWrapperTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareMessagingServerControlWrapperTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -42,7 +42,7 @@
import org.jboss.messaging.core.management.QueueControlMBean;
import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
import org.jboss.messaging.tests.util.RandomUtil;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A ReplicationAwareQueueControlWrapperTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareQueueControlWrapperTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareQueueControlWrapperTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareQueueControlWrapperTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -58,7 +58,7 @@
import org.jboss.messaging.core.management.QueueControlMBean;
import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
import org.jboss.messaging.tests.util.RandomUtil;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A ReplicationAwareQueueControlWrapperTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/consumer/ConsumerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/consumer/ConsumerTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/consumer/ConsumerTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -37,7 +37,7 @@
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/consumer/RedeliveryConsumerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/consumer/RedeliveryConsumerTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/consumer/RedeliveryConsumerTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -31,7 +31,7 @@
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A RedeliveryConsumerTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/consumer/TransactionDurabilityTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/consumer/TransactionDurabilityTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/consumer/TransactionDurabilityTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -30,10 +30,9 @@
import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
* A TransactionDurabilityTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/discovery/DiscoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/discovery/DiscoveryTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/discovery/DiscoveryTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -37,8 +37,8 @@
import org.jboss.messaging.core.server.cluster.BroadcastGroup;
import org.jboss.messaging.core.server.cluster.impl.BroadcastGroupImpl;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.UUIDGenerator;
/**
* A DiscoveryTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/divert/DivertTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/divert/DivertTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/divert/DivertTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -39,7 +39,7 @@
import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A DivertTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/divert/PersistentDivertTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/divert/PersistentDivertTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/divert/PersistentDivertTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -39,7 +39,7 @@
import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A PersistentDivertTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/http/CoreClientOverHttpTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/http/CoreClientOverHttpTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/http/CoreClientOverHttpTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -36,7 +36,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/JMSFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/JMSFailoverTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/JMSFailoverTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -70,7 +70,7 @@
import org.jboss.messaging.jms.client.JBossConnectionFactory;
import org.jboss.messaging.jms.client.JBossSession;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/consumer/ConsumerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/consumer/ConsumerTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/consumer/ConsumerTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -58,7 +58,7 @@
import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
import org.jboss.messaging.tests.integration.jms.management.NullInitialContext;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/BridgeControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/BridgeControlTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/BridgeControlTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -31,7 +31,7 @@
import org.jboss.messaging.core.config.cluster.BridgeConfiguration;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
/**
* A BridgeControlTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -42,7 +42,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
/**
* A AcceptorControlTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementControlHelper.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementControlHelper.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementControlHelper.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -40,7 +40,7 @@
import org.jboss.messaging.jms.server.management.JMSQueueControlMBean;
import org.jboss.messaging.jms.server.management.JMSServerControlMBean;
import org.jboss.messaging.jms.server.management.TopicControlMBean;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A ManagementControlHelper
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementServiceImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementServiceImplTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementServiceImplTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -56,7 +56,7 @@
import org.jboss.messaging.core.server.impl.ServerMessageImpl;
import org.jboss.messaging.tests.util.RandomUtil;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/*
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/NotificationTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/NotificationTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/NotificationTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -43,7 +43,7 @@
import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A NotificationTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/QueueControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/QueueControlTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/QueueControlTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -44,7 +44,7 @@
import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A QueueControlTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementTestBase.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementTestBase.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -35,7 +35,7 @@
import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A SecurityManagementTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/paging/PageCrashTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/paging/PageCrashTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/paging/PageCrashTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -59,8 +59,8 @@
import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.OrderedExecutorFactory;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.OrderedExecutorFactory;
+import org.jboss.messaging.utils.SimpleString;
/**
* This test will make sure that a failing depage won't cause duplicated messages
@@ -319,7 +319,7 @@
Field factoryField = PagingStoreFactoryNIO.class.getDeclaredField("executorFactory");
factoryField.setAccessible(true);
- OrderedExecutorFactory factory = (OrderedExecutorFactory)factoryField.get(this);
+ OrderedExecutorFactory factory = (org.jboss.messaging.utils.OrderedExecutorFactory)factoryField.get(this);
return new FailingPagingStore(destinationName, settings, factory.getExecutor());
}
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/paging/PagingManagerIntegrationTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/paging/PagingManagerIntegrationTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/paging/PagingManagerIntegrationTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -41,7 +41,7 @@
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.tests.util.RandomUtil;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/paging/PagingServiceIntegrationTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/paging/PagingServiceIntegrationTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/paging/PagingServiceIntegrationTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -41,8 +41,8 @@
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.DataConstants;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.DataConstants;
+import org.jboss.messaging.utils.SimpleString;
/**
* A PagingServiceIntegrationTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/queue/DeadLetterAddressTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/queue/DeadLetterAddressTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/queue/DeadLetterAddressTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -43,7 +43,7 @@
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.core.transaction.impl.XidImpl;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/queue/ExpiryAddressTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/queue/ExpiryAddressTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/queue/ExpiryAddressTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -37,7 +37,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/queue/ExpiryRunnerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/queue/ExpiryRunnerTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/queue/ExpiryRunnerTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -44,7 +44,7 @@
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/queue/MessageGroupingTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/queue/MessageGroupingTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/queue/MessageGroupingTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -45,7 +45,7 @@
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.core.transaction.impl.XidImpl;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/queue/PredefinedQueueTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/queue/PredefinedQueueTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/queue/PredefinedQueueTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -41,7 +41,7 @@
import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/queue/SoloQueueRecoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/queue/SoloQueueRecoveryTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/queue/SoloQueueRecoveryTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -35,7 +35,7 @@
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.core.transaction.impl.XidImpl;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/queue/SoloQueueTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/queue/SoloQueueTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/queue/SoloQueueTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -35,7 +35,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/scheduling/ScheduledMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/scheduling/ScheduledMessageTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/scheduling/ScheduledMessageTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -39,8 +39,8 @@
import org.jboss.messaging.core.transaction.impl.XidImpl;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.UUIDGenerator;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/session/CreateQueueTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/session/CreateQueueTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/session/CreateQueueTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -28,7 +28,7 @@
import org.jboss.messaging.core.client.ClientSession;
import org.jboss.messaging.core.postoffice.Binding;
import org.jboss.messaging.core.settings.impl.AddressSettings;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/session/SendAcknowledgementsTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/session/SendAcknowledgementsTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/session/SendAcknowledgementsTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,7 +24,6 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
import org.jboss.messaging.core.client.ClientMessage;
import org.jboss.messaging.core.client.ClientProducer;
@@ -35,7 +34,7 @@
import org.jboss.messaging.core.message.Message;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A SendAcknowledgementsTest
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSLTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSLTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSLTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -27,7 +27,7 @@
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/wildcard/WildCardRoutingTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/wildcard/WildCardRoutingTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/wildcard/WildCardRoutingTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -33,7 +33,7 @@
import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -42,8 +42,8 @@
import org.jboss.messaging.jms.client.JBossBytesMessage;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.UUIDGenerator;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -33,8 +33,8 @@
import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.UUIDGenerator;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.UUIDGenerator;
+import org.jboss.messaging.utils.SimpleString;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/xa/XaTimeoutTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/xa/XaTimeoutTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/xa/XaTimeoutTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -42,8 +42,8 @@
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.core.transaction.impl.XidImpl;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.UUIDGenerator;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/performance/paging/MeasurePagingMultiThreadTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/performance/paging/MeasurePagingMultiThreadTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/performance/paging/MeasurePagingMultiThreadTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -37,7 +37,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A MeasurePagingMultiThreadTest
Modified: trunk/tests/src/org/jboss/messaging/tests/performance/persistence/FakeBinding.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/performance/persistence/FakeBinding.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/performance/persistence/FakeBinding.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -27,7 +27,7 @@
import org.jboss.messaging.core.postoffice.BindingType;
import org.jboss.messaging.core.server.Bindable;
import org.jboss.messaging.core.server.ServerMessage;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/performance/persistence/FakePostOffice.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/performance/persistence/FakePostOffice.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/performance/persistence/FakePostOffice.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -36,8 +36,8 @@
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.core.server.impl.SendLockImpl;
import org.jboss.messaging.core.transaction.Transaction;
-import org.jboss.messaging.util.ConcurrentHashSet;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.ConcurrentHashSet;
+import org.jboss.messaging.utils.SimpleString;
/**
*
@@ -62,7 +62,7 @@
private ConcurrentHashMap<SimpleString, Binding> bindings = new ConcurrentHashMap<SimpleString, Binding>();
- private ConcurrentHashSet<SimpleString> addresses = new ConcurrentHashSet<SimpleString>();
+ private org.jboss.messaging.utils.ConcurrentHashSet<SimpleString> addresses = new ConcurrentHashSet<SimpleString>();
private volatile boolean started;
Modified: trunk/tests/src/org/jboss/messaging/tests/performance/persistence/StorageManagerTimingTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/performance/persistence/StorageManagerTimingTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/performance/persistence/StorageManagerTimingTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -37,7 +37,7 @@
import org.jboss.messaging.core.server.impl.ServerMessageImpl;
import org.jboss.messaging.integration.transports.mina.IoBufferWrapper;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/stress/failover/PagingFailoverStressTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/stress/failover/PagingFailoverStressTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/stress/failover/PagingFailoverStressTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -34,7 +34,7 @@
import org.jboss.messaging.core.paging.PagingStore;
import org.jboss.messaging.core.remoting.impl.invm.InVMConnector;
import org.jboss.messaging.tests.integration.cluster.failover.PagingFailoverTest;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A PagingFailoverTest
Modified: trunk/tests/src/org/jboss/messaging/tests/stress/paging/PageStressTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/stress/paging/PageStressTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/stress/paging/PageStressTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,7 +24,7 @@
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* This is an integration-tests that will take some time to run. TODO: Maybe this test belongs somewhere else?
Modified: trunk/tests/src/org/jboss/messaging/tests/timing/core/server/impl/QueueImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/timing/core/server/impl/QueueImplTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/timing/core/server/impl/QueueImplTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -38,7 +38,7 @@
import org.jboss.messaging.core.server.impl.QueueImpl;
import org.jboss.messaging.tests.unit.core.server.impl.fakes.FakeConsumer;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/timing/util/TokenBucketLimiterImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/timing/util/TokenBucketLimiterImplTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/timing/util/TokenBucketLimiterImplTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,7 +24,7 @@
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.TokenBucketLimiterImpl;
+import org.jboss.messaging.utils.TokenBucketLimiterImpl;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/timing/util/UTF8Test.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/timing/util/UTF8Test.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/timing/util/UTF8Test.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,7 +24,7 @@
import org.jboss.messaging.integration.transports.netty.ChannelBufferWrapper;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.UTF8Util;
+import org.jboss.messaging.utils.UTF8Util;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/timing/util/VariableLatchTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/timing/util/VariableLatchTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/timing/util/VariableLatchTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -22,7 +22,7 @@
package org.jboss.messaging.tests.timing.util;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.VariableLatch;
+import org.jboss.messaging.utils.VariableLatch;
/**
* @author <a href="csuconic at redhat.com">Clebert Suconic</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ClientSessionImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ClientSessionImplTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ClientSessionImplTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -70,7 +70,7 @@
import org.jboss.messaging.core.remoting.impl.wireformat.SessionXACommitMessage;
import org.jboss.messaging.core.remoting.impl.wireformat.SessionXAResponseMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/client/management/impl/ManagementHelperTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/client/management/impl/ManagementHelperTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/client/management/impl/ManagementHelperTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -37,7 +37,7 @@
import org.jboss.messaging.core.message.Message;
import org.jboss.messaging.tests.util.RandomUtil;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/*
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/ConfigurationImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/ConfigurationImplTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/ConfigurationImplTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -36,7 +36,7 @@
import org.jboss.messaging.core.config.impl.ConfigurationImpl;
import org.jboss.messaging.core.server.JournalType;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/ConfigurationValidationTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/ConfigurationValidationTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/ConfigurationValidationTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,7 +24,7 @@
import org.jboss.messaging.core.config.impl.FileConfiguration;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.XMLUtil;
+import org.jboss.messaging.utils.XMLUtil;
import org.w3c.dom.Element;
/**
@@ -54,7 +54,7 @@
String xml = "<deployment xmlns='urn:jboss:messaging'>"
+ "<configuration></configuration>"
+ "</deployment>";
- Element element = XMLUtil.stringToElement(xml);
+ Element element = org.jboss.messaging.utils.XMLUtil.stringToElement(xml);
assertNotNull(element);
try
{
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/FileConfigurationTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/FileConfigurationTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/FileConfigurationTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,7 +24,7 @@
import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.config.impl.FileConfiguration;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/QueueDeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/QueueDeployerTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/QueueDeployerTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -28,7 +28,6 @@
import org.jboss.messaging.core.deployers.impl.FileDeploymentManager;
import org.jboss.messaging.core.deployers.impl.QueueDeployer;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.XMLUtil;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -60,7 +59,7 @@
+ "<queue name='foo' address='bar' filter='speed > 88' durable='false' />"
+ "</settings>";
- Element rootNode = XMLUtil.stringToElement(xml);
+ Element rootNode = org.jboss.messaging.utils.XMLUtil.stringToElement(xml);
deployer.validate(rootNode);
NodeList queueNodes = rootNode.getElementsByTagName("queue");
assertEquals(1, queueNodes.getLength());
@@ -90,7 +89,7 @@
+ "</settings>"
+ "</deployment>";
- Element rootNode = XMLUtil.stringToElement(xml);
+ Element rootNode = org.jboss.messaging.utils.XMLUtil.stringToElement(xml);
deployer.validate(rootNode);
NodeList queueNodes = rootNode.getElementsByTagName("queue");
assertEquals(2, queueNodes.getLength());
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/AddressSettingsDeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/AddressSettingsDeployerTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/AddressSettingsDeployerTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -29,8 +29,8 @@
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.XMLUtil;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.XMLUtil;
/**
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/BasicSecurityDeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/BasicSecurityDeployerTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/BasicSecurityDeployerTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -27,7 +27,7 @@
import org.jboss.messaging.core.deployers.impl.BasicSecurityDeployer;
import org.jboss.messaging.core.security.JBMUpdateableSecurityManager;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.XMLUtil;
+import org.jboss.messaging.utils.XMLUtil;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/SecurityDeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/SecurityDeployerTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/SecurityDeployerTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -31,7 +31,6 @@
import org.jboss.messaging.core.security.Role;
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.XMLUtil;
import org.w3c.dom.Element;
/**
@@ -70,7 +69,7 @@
public void testSingle() throws Exception
{
- Element e = XMLUtil.stringToElement(conf);
+ Element e = org.jboss.messaging.utils.XMLUtil.stringToElement(conf);
Role role = new Role("durpublisher", true, true, true);
Role role2 = new Role("guest", true, true, false);
Role role3 = new Role("publisher", true, true, false);
@@ -96,8 +95,8 @@
repository.addMatch("topics.testTopic", roles);
repository.addMatch("queues.testQueue", roles);
EasyMock.replay(repository);
- deployer.deploy(XMLUtil.stringToElement(conf));
- deployer.deploy(XMLUtil.stringToElement(conf2));
+ deployer.deploy(org.jboss.messaging.utils.XMLUtil.stringToElement(conf));
+ deployer.deploy(org.jboss.messaging.utils.XMLUtil.stringToElement(conf2));
EasyMock.verify(repository);
}
@@ -106,7 +105,7 @@
HashSet<Role> roles = new HashSet<Role>();
repository.addMatch("queues.testQueue", roles);
EasyMock.replay(repository);
- deployer.deploy(XMLUtil.stringToElement(noRoles));
+ deployer.deploy(org.jboss.messaging.utils.XMLUtil.stringToElement(noRoles));
EasyMock.verify(repository);
}
}
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/XMLDeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/XMLDeployerTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/XMLDeployerTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -28,7 +28,7 @@
import org.jboss.messaging.core.deployers.impl.XmlDeployer;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.XMLUtil;
+import org.jboss.messaging.utils.XMLUtil;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -93,7 +93,7 @@
TestDeployer testDeployer = new TestDeployer();
testDeployer.setElement(e);
testDeployer.deploy(url);
- e = XMLUtil.stringToElement(conf2);
+ e = org.jboss.messaging.utils.XMLUtil.stringToElement(conf2);
testDeployer.setElement(e);
testDeployer.redeploy(url);
assertEquals(testDeployer.getDeployments(), 4);
@@ -113,7 +113,7 @@
TestDeployer testDeployer = new TestDeployer();
testDeployer.setElement(e);
testDeployer.deploy(url);
- e = XMLUtil.stringToElement(conf3);
+ e = org.jboss.messaging.utils.XMLUtil.stringToElement(conf3);
testDeployer.setElement(e);
testDeployer.redeploy(url);
assertEquals(testDeployer.getDeployments(), 2);
@@ -131,7 +131,7 @@
TestDeployer testDeployer = new TestDeployer();
testDeployer.setElement(e);
testDeployer.deploy(url);
- e = XMLUtil.stringToElement(conf4);
+ e = org.jboss.messaging.utils.XMLUtil.stringToElement(conf4);
testDeployer.setElement(e);
testDeployer.redeploy(url);
assertEquals(testDeployer.getDeployments(), 6);
@@ -151,7 +151,7 @@
public void testUndeploy() throws Exception
{
- Element e = XMLUtil.stringToElement(conf1);
+ Element e = org.jboss.messaging.utils.XMLUtil.stringToElement(conf1);
TestDeployer testDeployer = new TestDeployer();
testDeployer.setElement(e);
testDeployer.deploy(url);
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/filter/impl/FilterParserTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/filter/impl/FilterParserTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/filter/impl/FilterParserTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -31,7 +31,7 @@
import org.jboss.messaging.core.filter.impl.Operator;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
Tests of the JavaCC LL(1) parser for the JBoss Messaging filters
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/filter/impl/FilterTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/filter/impl/FilterTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/filter/impl/FilterTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -28,7 +28,7 @@
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.core.server.impl.ServerMessageImpl;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* Tests the compliance with the JBoss Messaging Filter syntax.
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/filter/impl/OperatorTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/filter/impl/OperatorTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/filter/impl/OperatorTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -51,7 +51,7 @@
import org.jboss.messaging.core.filter.impl.Operator;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A OperatorTest
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/AddressControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/AddressControlTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/AddressControlTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -45,7 +45,7 @@
import org.jboss.messaging.core.security.Role;
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/ManagementServiceImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/ManagementServiceImplTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/ManagementServiceImplTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -40,7 +40,7 @@
import org.jboss.messaging.core.management.impl.AddressControl;
import org.jboss.messaging.core.management.impl.ManagementServiceImpl;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/QueueControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/QueueControlTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/QueueControlTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -57,7 +57,7 @@
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/message/impl/MessageImplTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/message/impl/MessageImplTestBase.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/message/impl/MessageImplTestBase.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -43,7 +43,7 @@
import org.jboss.messaging.core.server.impl.ServerMessageImpl;
import org.jboss.messaging.integration.transports.mina.IoBufferWrapper;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PageImplTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PageImplTestBase.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PageImplTestBase.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -36,7 +36,7 @@
import org.jboss.messaging.core.server.impl.ServerMessageImpl;
import org.jboss.messaging.tests.util.RandomUtil;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PagingStoreImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PagingStoreImplTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PagingStoreImplTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -37,7 +37,7 @@
import org.jboss.messaging.core.paging.impl.TestSupportPageStore;
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.tests.unit.core.journal.impl.fakes.FakeSequentialFileFactory;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PagingStoreTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PagingStoreTestBase.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PagingStoreTestBase.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -51,7 +51,7 @@
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.tests.util.RandomUtil;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/persistence/impl/journal/JournalStorageManagerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/persistence/impl/journal/JournalStorageManagerTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/persistence/impl/journal/JournalStorageManagerTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -46,7 +46,7 @@
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.core.transaction.impl.XidImpl;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/AddressImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/AddressImplTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/AddressImplTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,7 +24,7 @@
import org.jboss.messaging.core.postoffice.Address;
import org.jboss.messaging.core.postoffice.impl.AddressImpl;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/PostOfficeImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/PostOfficeImplTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/PostOfficeImplTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -30,7 +30,7 @@
import org.jboss.messaging.core.server.QueueFactory;
import org.jboss.messaging.tests.unit.core.server.impl.fakes.FakeQueueFactory;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/*
* A PostOfficeTest
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/MessagingBufferTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/MessagingBufferTestBase.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/MessagingBufferTestBase.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -34,7 +34,7 @@
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
import org.jboss.messaging.tests.util.RandomUtil;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>.
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/security/impl/SecurityStoreImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/security/impl/SecurityStoreImplTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/security/impl/SecurityStoreImplTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -33,7 +33,7 @@
import org.jboss.messaging.core.server.ServerSession;
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* tests SecurityStoreImpl
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/GroupingRoundRobinDistributionPolicyTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/GroupingRoundRobinDistributionPolicyTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/GroupingRoundRobinDistributionPolicyTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -31,7 +31,7 @@
import org.jboss.messaging.core.server.impl.GroupingRoundRobinDistributor;
import org.jboss.messaging.core.server.impl.RoundRobinDistributor;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/QueueFactoryImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/QueueFactoryImplTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/QueueFactoryImplTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -32,7 +32,7 @@
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/QueueImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/QueueImplTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/QueueImplTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -49,7 +49,7 @@
import org.jboss.messaging.tests.unit.core.server.impl.fakes.FakeConsumer;
import org.jboss.messaging.tests.unit.core.server.impl.fakes.FakeFilter;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* A QueueTest
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/ServerMessageImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/ServerMessageImplTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/ServerMessageImplTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -33,7 +33,7 @@
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.core.server.impl.ServerMessageImpl;
import org.jboss.messaging.tests.unit.core.message.impl.MessageImplTestBase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakeConsumer.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakeConsumer.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakeConsumer.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -29,7 +29,6 @@
import org.jboss.messaging.core.server.Consumer;
import org.jboss.messaging.core.server.HandleStatus;
import org.jboss.messaging.core.server.MessageReference;
-import org.jboss.messaging.util.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakeFilter.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakeFilter.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakeFilter.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,7 +24,7 @@
import org.jboss.messaging.core.filter.Filter;
import org.jboss.messaging.core.server.ServerMessage;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakeQueueFactory.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakeQueueFactory.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakeQueueFactory.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -30,7 +30,7 @@
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.core.server.QueueFactory;
import org.jboss.messaging.core.server.impl.QueueImpl;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/settings/impl/AddressSettingsTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/settings/impl/AddressSettingsTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/settings/impl/AddressSettingsTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -24,7 +24,7 @@
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/jms/JBossTemporaryTopicTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/jms/JBossTemporaryTopicTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/jms/JBossTemporaryTopicTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -40,7 +40,7 @@
import org.jboss.messaging.jms.client.JBossConnection;
import org.jboss.messaging.jms.client.JBossSession;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/jms/JBossTopicTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/jms/JBossTopicTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/jms/JBossTopicTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -26,7 +26,7 @@
import org.jboss.messaging.jms.JBossTopic;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.utils.Pair;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageProducerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageProducerTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageProducerTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -63,7 +63,7 @@
import org.jboss.messaging.jms.client.JBossMessage;
import org.jboss.messaging.jms.client.JBossMessageProducer;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -60,7 +60,7 @@
import org.jboss.messaging.jms.client.JBossStreamMessage;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossQueueBrowserTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossQueueBrowserTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossQueueBrowserTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -41,7 +41,7 @@
import org.jboss.messaging.jms.client.JBossMessage;
import org.jboss.messaging.jms.client.JBossQueueBrowser;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/JMSMessageInfoTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/JMSMessageInfoTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/JMSMessageInfoTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -43,7 +43,7 @@
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.jms.server.management.JMSMessageInfo;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/impl/JMSQueueControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/impl/JMSQueueControlTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/impl/JMSQueueControlTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -56,7 +56,7 @@
import org.jboss.messaging.jms.JBossQueue;
import org.jboss.messaging.jms.server.management.impl.JMSQueueControl;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/util/ConcurrentHashSetTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/util/ConcurrentHashSetTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/util/ConcurrentHashSetTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -27,8 +27,8 @@
import java.util.Iterator;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.ConcurrentHashSet;
-import org.jboss.messaging.util.ConcurrentSet;
+import org.jboss.messaging.utils.ConcurrentHashSet;
+import org.jboss.messaging.utils.ConcurrentSet;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/util/ObjectInputStreamWithClassLoaderTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/util/ObjectInputStreamWithClassLoaderTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/util/ObjectInputStreamWithClassLoaderTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -35,7 +35,7 @@
import java.util.StringTokenizer;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.ObjectInputStreamWithClassLoader;
+import org.jboss.messaging.utils.ObjectInputStreamWithClassLoader;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
@@ -100,7 +100,7 @@
Thread.currentThread().setContextClassLoader(testClassLoader);
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- ObjectInputStreamWithClassLoader ois = new ObjectInputStreamWithClassLoader(bais);
+ org.jboss.messaging.utils.ObjectInputStreamWithClassLoader ois = new ObjectInputStreamWithClassLoader(bais);
Object deserializedObj= ois.readObject();
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/util/SimpleStringTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/util/SimpleStringTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/util/SimpleStringTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -25,8 +25,8 @@
import static org.jboss.messaging.tests.util.RandomUtil.randomString;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.DataConstants;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.DataConstants;
+import org.jboss.messaging.utils.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/util/TimeAndCounterIDGeneratorTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/util/TimeAndCounterIDGeneratorTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/util/TimeAndCounterIDGeneratorTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -25,8 +25,8 @@
import java.util.concurrent.CountDownLatch;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.ConcurrentHashSet;
-import org.jboss.messaging.util.TimeAndCounterIDGenerator;
+import org.jboss.messaging.utils.ConcurrentHashSet;
+import org.jboss.messaging.utils.TimeAndCounterIDGenerator;
/**
* A TimeAndCounterIDGeneratorTest
@@ -160,7 +160,7 @@
public void testWrapID() throws Throwable
{
- final ConcurrentHashSet<Long> hashSet = new ConcurrentHashSet<Long>();
+ final ConcurrentHashSet<Long> hashSet = new org.jboss.messaging.utils.ConcurrentHashSet<Long>();
TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator();
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/util/TypedPropertiesTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/util/TypedPropertiesTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/util/TypedPropertiesTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -38,8 +38,8 @@
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
import org.jboss.messaging.integration.transports.mina.IoBufferWrapper;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.util.TypedProperties;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.TypedProperties;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/util/UTF8Test.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/util/UTF8Test.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/util/UTF8Test.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -34,9 +34,9 @@
import org.jboss.messaging.integration.transports.netty.ChannelBufferWrapper;
import org.jboss.messaging.tests.util.RandomUtil;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.DataConstants;
-import org.jboss.messaging.util.Random;
-import org.jboss.messaging.util.UTF8Util;
+import org.jboss.messaging.utils.DataConstants;
+import org.jboss.messaging.utils.Random;
+import org.jboss.messaging.utils.UTF8Util;
/**
* A UTF8Test
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/util/UUIDGeneratorTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/util/UUIDGeneratorTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/util/UUIDGeneratorTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,7 @@
package org.jboss.messaging.tests.unit.util;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.UUIDGenerator;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/util/UUIDTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/util/UUIDTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/util/UUIDTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -26,7 +26,7 @@
import java.util.Set;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.UUIDGenerator;
+import org.jboss.messaging.utils.UUIDGenerator;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/util/VariableLatchTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/util/VariableLatchTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/util/VariableLatchTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -26,7 +26,7 @@
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.VariableLatch;
+import org.jboss.messaging.utils.VariableLatch;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/util/VersionLoaderTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/util/VersionLoaderTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/util/VersionLoaderTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -28,7 +28,7 @@
import org.jboss.messaging.core.version.Version;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.VersionLoader;
+import org.jboss.messaging.utils.VersionLoader;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/util/XMLUtilTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/util/XMLUtilTest.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/util/XMLUtilTest.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -23,7 +23,7 @@
package org.jboss.messaging.tests.unit.util;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.XMLUtil;
+import org.jboss.messaging.utils.XMLUtil;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -43,9 +43,9 @@
{
String document = "<blah>foo</blah>";
- Element e = XMLUtil.stringToElement(document);
+ Element e = org.jboss.messaging.utils.XMLUtil.stringToElement(document);
- assertEquals("foo", XMLUtil.getTextContent(e));
+ assertEquals("foo", org.jboss.messaging.utils.XMLUtil.getTextContent(e));
}
public void testGetTextContext_2() throws Exception
@@ -54,18 +54,18 @@
Element e = XMLUtil.stringToElement(document);
- assertEquals("foo", XMLUtil.getTextContent(e));
+ assertEquals("foo", org.jboss.messaging.utils.XMLUtil.getTextContent(e));
}
public void testGetTextContext_3() throws Exception
{
String document = "<blah someattribute=\"somevalue\"><a/></blah>";
- Element e = XMLUtil.stringToElement(document);
+ Element e = org.jboss.messaging.utils.XMLUtil.stringToElement(document);
- String s = XMLUtil.getTextContent(e);
+ String s = org.jboss.messaging.utils.XMLUtil.getTextContent(e);
- Element subelement = XMLUtil.stringToElement(s);
+ Element subelement = org.jboss.messaging.utils.XMLUtil.stringToElement(s);
assertEquals("a", subelement.getNodeName());
}
@@ -74,11 +74,11 @@
{
String document = "<blah someattribute=\"somevalue\"><a></a></blah>";
- Element e = XMLUtil.stringToElement(document);
+ Element e = org.jboss.messaging.utils.XMLUtil.stringToElement(document);
- String s = XMLUtil.getTextContent(e);
+ String s = org.jboss.messaging.utils.XMLUtil.getTextContent(e);
- Element subelement = XMLUtil.stringToElement(s);
+ Element subelement = org.jboss.messaging.utils.XMLUtil.stringToElement(s);
assertEquals("a", subelement.getNodeName());
}
@@ -87,11 +87,11 @@
{
String document = "<blah someattribute=\"somevalue\"><a><b/></a></blah>";
- Element e = XMLUtil.stringToElement(document);
+ Element e = org.jboss.messaging.utils.XMLUtil.stringToElement(document);
- String s = XMLUtil.getTextContent(e);
+ String s = org.jboss.messaging.utils.XMLUtil.getTextContent(e);
- Element subelement = XMLUtil.stringToElement(s);
+ Element subelement = org.jboss.messaging.utils.XMLUtil.stringToElement(s);
assertEquals("a", subelement.getNodeName());
NodeList nl = subelement.getChildNodes();
@@ -115,7 +115,7 @@
String s = "<a/>";
String s2 = "<a/>";
- XMLUtil.assertEquivalent(XMLUtil.stringToElement(s), XMLUtil.stringToElement(s2));
+ XMLUtil.assertEquivalent(XMLUtil.stringToElement(s), org.jboss.messaging.utils.XMLUtil.stringToElement(s2));
}
public void testEquivalent_2() throws Exception
@@ -123,7 +123,7 @@
String s = "<a></a>";
String s2 = "<a/>";
- XMLUtil.assertEquivalent(XMLUtil.stringToElement(s), XMLUtil.stringToElement(s2));
+ XMLUtil.assertEquivalent(XMLUtil.stringToElement(s), org.jboss.messaging.utils.XMLUtil.stringToElement(s2));
}
public void testEquivalent_3() throws Exception
@@ -133,7 +133,7 @@
try
{
- XMLUtil.assertEquivalent(XMLUtil.stringToElement(s), XMLUtil.stringToElement(s2));
+ org.jboss.messaging.utils.XMLUtil.assertEquivalent(org.jboss.messaging.utils.XMLUtil.stringToElement(s), XMLUtil.stringToElement(s2));
fail("this should throw exception");
}
catch(IllegalArgumentException e)
@@ -148,7 +148,7 @@
String s = "<a attr1=\"val1\" attr2=\"val2\"/>";
String s2 = "<a attr2=\"val2\" attr1=\"val1\"/>";
- XMLUtil.assertEquivalent(XMLUtil.stringToElement(s), XMLUtil.stringToElement(s2));
+ org.jboss.messaging.utils.XMLUtil.assertEquivalent(org.jboss.messaging.utils.XMLUtil.stringToElement(s), org.jboss.messaging.utils.XMLUtil.stringToElement(s2));
}
public void testEquivalent_5() throws Exception
@@ -156,7 +156,7 @@
String s = "<a><b/></a>";
String s2 = "<a><b/></a>";
- XMLUtil.assertEquivalent(XMLUtil.stringToElement(s), XMLUtil.stringToElement(s2));
+ org.jboss.messaging.utils.XMLUtil.assertEquivalent(org.jboss.messaging.utils.XMLUtil.stringToElement(s), org.jboss.messaging.utils.XMLUtil.stringToElement(s2));
}
public void testEquivalent_6() throws Exception
@@ -164,7 +164,7 @@
String s = "<enclosing><a attr1=\"val1\" attr2=\"val2\"/></enclosing>";
String s2 = "<enclosing><a attr2=\"val2\" attr1=\"val1\"/></enclosing>";
- XMLUtil.assertEquivalent(XMLUtil.stringToElement(s), XMLUtil.stringToElement(s2));
+ org.jboss.messaging.utils.XMLUtil.assertEquivalent(XMLUtil.stringToElement(s), org.jboss.messaging.utils.XMLUtil.stringToElement(s2));
}
public void testEquivalent_7() throws Exception
@@ -174,7 +174,7 @@
try
{
- XMLUtil.assertEquivalent(XMLUtil.stringToElement(s), XMLUtil.stringToElement(s2));
+ org.jboss.messaging.utils.XMLUtil.assertEquivalent(org.jboss.messaging.utils.XMLUtil.stringToElement(s), org.jboss.messaging.utils.XMLUtil.stringToElement(s2));
fail("this should throw exception");
}
catch(IllegalArgumentException e)
@@ -189,22 +189,22 @@
String s = "<a><!-- some comment --><b/><!--some other comment --><c/><!-- blah --></a>";
String s2 = "<a><b/><!--blah blah--><c/></a>";
- XMLUtil.assertEquivalent(XMLUtil.stringToElement(s), XMLUtil.stringToElement(s2));
+ org.jboss.messaging.utils.XMLUtil.assertEquivalent(XMLUtil.stringToElement(s), org.jboss.messaging.utils.XMLUtil.stringToElement(s2));
}
public void testElementToString_1() throws Exception
{
String s = "<a b=\"something\">somethingelse</a>";
- Element e = XMLUtil.stringToElement(s);
- String tostring = XMLUtil.elementToString(e);
- Element convertedAgain = XMLUtil.stringToElement(tostring);
- XMLUtil.assertEquivalent(e, convertedAgain);
+ Element e = org.jboss.messaging.utils.XMLUtil.stringToElement(s);
+ String tostring = org.jboss.messaging.utils.XMLUtil.elementToString(e);
+ Element convertedAgain = org.jboss.messaging.utils.XMLUtil.stringToElement(tostring);
+ org.jboss.messaging.utils.XMLUtil.assertEquivalent(e, convertedAgain);
}
public void testElementToString_2() throws Exception
{
String s = "<a b=\"something\"></a>";
- Element e = XMLUtil.stringToElement(s);
+ Element e = org.jboss.messaging.utils.XMLUtil.stringToElement(s);
String tostring = XMLUtil.elementToString(e);
Element convertedAgain = XMLUtil.stringToElement(tostring);
XMLUtil.assertEquivalent(e, convertedAgain);
@@ -213,19 +213,19 @@
public void testElementToString_3() throws Exception
{
String s = "<a b=\"something\"/>";
- Element e = XMLUtil.stringToElement(s);
+ Element e = org.jboss.messaging.utils.XMLUtil.stringToElement(s);
String tostring = XMLUtil.elementToString(e);
- Element convertedAgain = XMLUtil.stringToElement(tostring);
- XMLUtil.assertEquivalent(e, convertedAgain);
+ Element convertedAgain = org.jboss.messaging.utils.XMLUtil.stringToElement(tostring);
+ org.jboss.messaging.utils.XMLUtil.assertEquivalent(e, convertedAgain);
}
public void testElementToString_4() throws Exception
{
String s = "<a><![CDATA[somedata]]></a>";
- Element e = XMLUtil.stringToElement(s);
+ Element e = org.jboss.messaging.utils.XMLUtil.stringToElement(s);
String tostring = XMLUtil.elementToString(e);
- Element convertedAgain = XMLUtil.stringToElement(tostring);
- XMLUtil.assertEquivalent(e, convertedAgain);
+ Element convertedAgain = org.jboss.messaging.utils.XMLUtil.stringToElement(tostring);
+ org.jboss.messaging.utils.XMLUtil.assertEquivalent(e, convertedAgain);
}
public void testReplaceSystemProperties()
@@ -248,7 +248,7 @@
"</deployment>";
System.setProperty("sysprop1", "test1");
System.setProperty("sysprop2", "content4");
- String replaced = XMLUtil.replaceSystemProps(before);
+ String replaced = org.jboss.messaging.utils.XMLUtil.replaceSystemProps(before);
assertEquals(after, replaced);
}
Modified: trunk/tests/src/org/jboss/messaging/tests/util/RandomUtil.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/util/RandomUtil.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/util/RandomUtil.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -29,7 +29,7 @@
import javax.transaction.xa.Xid;
import org.jboss.messaging.core.transaction.impl.XidImpl;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java 2009-02-25 10:04:34 UTC (rev 5926)
+++ trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java 2009-02-25 11:15:55 UTC (rev 5927)
@@ -53,7 +53,7 @@
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.core.server.impl.ServerMessageImpl;
import org.jboss.messaging.jms.client.JBossTextMessage;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.utils.SimpleString;
/**
*
More information about the jboss-cvs-commits
mailing list