Applying patch for Jira issue AMQ-656 (adding latest code for openwire-cpp client)

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@397654 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nathan Christopher Mittler 2006-04-27 21:59:28 +00:00
parent cb1d21f0a3
commit a624fcafef
437 changed files with 23401 additions and 14440 deletions

13
openwire-cpp/.cdtproject Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse-cdt version="2.0"?>
<cdtproject id="org.eclipse.cdt.managedbuilder.core.managedMake">
<extension id="org.eclipse.cdt.core.domsourceindexer" point="org.eclipse.cdt.core.CIndexer"/>
<data>
<item id="org.eclipse.cdt.core.pathentry">
<pathentry kind="src" path=""/>
<pathentry kind="out" path=""/>
<pathentry kind="con" path="org.eclipse.cdt.managedbuilder.MANAGED_CONTAINER"/>
</item>
</data>
</cdtproject>

View File

@ -0,0 +1,29 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "activemq-cpp", "activemq-cpp.vcproj", "{E744443B-F34E-4416-B5E1-B04CB39DDFDE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "activemq-test", "activemq-test.vcproj", "{F411832D-FB46-446D-BB50-9A64C33341F9}"
ProjectSection(ProjectDependencies) = postProject
{E744443B-F34E-4416-B5E1-B04CB39DDFDE} = {E744443B-F34E-4416-B5E1-B04CB39DDFDE}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E744443B-F34E-4416-B5E1-B04CB39DDFDE}.Debug|Win32.ActiveCfg = Debug|Win32
{E744443B-F34E-4416-B5E1-B04CB39DDFDE}.Debug|Win32.Build.0 = Debug|Win32
{E744443B-F34E-4416-B5E1-B04CB39DDFDE}.Release|Win32.ActiveCfg = Release|Win32
{E744443B-F34E-4416-B5E1-B04CB39DDFDE}.Release|Win32.Build.0 = Release|Win32
{F411832D-FB46-446D-BB50-9A64C33341F9}.Debug|Win32.ActiveCfg = Debug|Win32
{F411832D-FB46-446D-BB50-9A64C33341F9}.Debug|Win32.Build.0 = Debug|Win32
{F411832D-FB46-446D-BB50-9A64C33341F9}.Release|Win32.ActiveCfg = Release|Win32
{F411832D-FB46-446D-BB50-9A64C33341F9}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,197 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="activemq-test"
ProjectGUID="{F411832D-FB46-446D-BB50-9A64C33341F9}"
RootNamespace="activemqtest"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="src\main\cpp"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0400"
MinimalRebuild="true"
BasicRuntimeChecks="3"
SmallerTypeCheck="true"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="wsock32.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\src"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="src"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\src\test\cpp\TestListener.cpp"
>
</File>
<File
RelativePath=".\src\test\cpp\TestListener.hpp"
>
</File>
<File
RelativePath=".\src\test\cpp\TestMain.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

117
openwire-cpp/makefile Normal file
View File

@ -0,0 +1,117 @@
SRCDIR = src/main/cpp
MAKESUPPORT_HOME = $(PWD)
LIBOFILES = \
$(OUTDIR)/activemq/BrokerException.o \
$(OUTDIR)/activemq/Connection.o \
$(OUTDIR)/activemq/ConnectionClosedException.o \
$(OUTDIR)/activemq/ConnectionFactory.o \
$(OUTDIR)/activemq/ConsumerClosedException.o \
$(OUTDIR)/activemq/DestinationFilter.o \
$(OUTDIR)/activemq/Dispatcher.o \
$(OUTDIR)/activemq/MessageConsumer.o \
$(OUTDIR)/activemq/MessageConsumerSynchronization.o \
$(OUTDIR)/activemq/MessageProducer.o \
$(OUTDIR)/activemq/Session.o \
$(OUTDIR)/activemq/TransactionContext.o \
\
$(OUTDIR)/activemq/command/AbstractCommand.o \
$(OUTDIR)/activemq/command/ActiveMQBytesMessage.o \
$(OUTDIR)/activemq/command/ActiveMQDestination.o \
$(OUTDIR)/activemq/command/ActiveMQMapMessage.o \
$(OUTDIR)/activemq/command/ActiveMQMessage.o \
$(OUTDIR)/activemq/command/ActiveMQObjectMessage.o \
$(OUTDIR)/activemq/command/ActiveMQQueue.o \
$(OUTDIR)/activemq/command/ActiveMQStreamMessage.o \
$(OUTDIR)/activemq/command/ActiveMQTempQueue.o \
$(OUTDIR)/activemq/command/ActiveMQTempTopic.o \
$(OUTDIR)/activemq/command/ActiveMQTextMessage.o \
$(OUTDIR)/activemq/command/ActiveMQTopic.o \
$(OUTDIR)/activemq/command/BaseCommand.o \
$(OUTDIR)/activemq/command/BrokerError.o \
$(OUTDIR)/activemq/command/BrokerId.o \
$(OUTDIR)/activemq/command/BrokerInfo.o \
$(OUTDIR)/activemq/command/ConnectionError.o \
$(OUTDIR)/activemq/command/ConnectionId.o \
$(OUTDIR)/activemq/command/ConnectionInfo.o \
$(OUTDIR)/activemq/command/ConsumerId.o \
$(OUTDIR)/activemq/command/ConsumerInfo.o \
$(OUTDIR)/activemq/command/ControlCommand.o \
$(OUTDIR)/activemq/command/DataArrayResponse.o \
$(OUTDIR)/activemq/command/DataResponse.o \
$(OUTDIR)/activemq/command/DestinationInfo.o \
$(OUTDIR)/activemq/command/DiscoveryEvent.o \
$(OUTDIR)/activemq/command/ExceptionResponse.o \
$(OUTDIR)/activemq/command/FlushCommand.o \
$(OUTDIR)/activemq/command/IntegerResponse.o \
$(OUTDIR)/activemq/command/JournalQueueAck.o \
$(OUTDIR)/activemq/command/JournalTopicAck.o \
$(OUTDIR)/activemq/command/JournalTrace.o \
$(OUTDIR)/activemq/command/JournalTransaction.o \
$(OUTDIR)/activemq/command/KeepAliveInfo.o \
$(OUTDIR)/activemq/command/LocalTransactionId.o \
$(OUTDIR)/activemq/command/Message.o \
$(OUTDIR)/activemq/command/MessageAck.o \
$(OUTDIR)/activemq/command/MessageDispatch.o \
$(OUTDIR)/activemq/command/MessageDispatchNotification.o \
$(OUTDIR)/activemq/command/MessageId.o \
$(OUTDIR)/activemq/command/ProducerId.o \
$(OUTDIR)/activemq/command/ProducerInfo.o \
$(OUTDIR)/activemq/command/RemoveInfo.o \
$(OUTDIR)/activemq/command/RemoveSubscriptionInfo.o \
$(OUTDIR)/activemq/command/Response.o \
$(OUTDIR)/activemq/command/SessionId.o \
$(OUTDIR)/activemq/command/SessionInfo.o \
$(OUTDIR)/activemq/command/ShutdownInfo.o \
$(OUTDIR)/activemq/command/SubscriptionInfo.o \
$(OUTDIR)/activemq/command/TransactionId.o \
$(OUTDIR)/activemq/command/TransactionInfo.o \
$(OUTDIR)/activemq/command/WireFormatInfo.o \
$(OUTDIR)/activemq/command/XATransactionId.o \
$(OUTDIR)/activemq/command/ActiveMQTempDestination.o \
\
$(OUTDIR)/activemq/protocol/openwire/OpenWireMarshaller.o \
$(OUTDIR)/activemq/protocol/openwire/OpenWireProtocol.o \
\
$(OUTDIR)/activemq/transport/FutureResponse.o \
$(OUTDIR)/activemq/transport/CorrelatorFilter.o \
$(OUTDIR)/activemq/transport/LoggingFilter.o \
$(OUTDIR)/activemq/transport/MutexFilter.o \
$(OUTDIR)/activemq/transport/TransportFactory.o \
$(OUTDIR)/activemq/transport/TransportFilter.o \
\
$(OUTDIR)/activemq/transport/tcp/TcpTransport.o \
\
$(OUTDIR)/cms/CmsException.o \
\
$(OUTDIR)/ppr/io/ByteArrayInputStream.o \
$(OUTDIR)/ppr/io/ByteArrayOutputStream.o \
$(OUTDIR)/ppr/io/DataInputStream.o \
$(OUTDIR)/ppr/io/DataOutputStream.o \
$(OUTDIR)/ppr/io/SocketInputStream.o \
$(OUTDIR)/ppr/io/SocketOutputStream.o \
\
$(OUTDIR)/ppr/net/Socket.o \
$(OUTDIR)/ppr/net/ServerSocket.o \
$(OUTDIR)/ppr/net/Uri.o \
\
$(OUTDIR)/ppr/thread/Thread.o \
\
$(OUTDIR)/ppr/TraceException.o \
$(OUTDIR)/ppr/util/Guid.o \
$(OUTDIR)/ppr/util/Hex.o \
$(OUTDIR)/ppr/util/MapItemHolder.o \
$(OUTDIR)/ppr/util/Time.o \
OUTLIB = $(OUTDIR)/libactivemq.a
EXEOFILES = \
$(OUTDIR)/TestMain.o \
$(OUTDIR)/TestListener.o \
EXELIBS = -lactivemq -lpthread -lstdc++
DEFINES =
include $(MAKESUPPORT_HOME)/makefile.cfg

View File

@ -0,0 +1,14 @@
#
# Compiler specific configuration
#
#
# GCC/G++ debug for Linux
#
CC = g++ -frtti -g -pthread -DDEBUG -D_DEBUG -D_REENTRANT
LD = g++ -g -frtti -pthread
CCFLAGS = -Wall
LDFLAGS = -luuid
OUTDIR = $(MAKESUPPORT_HOME)/out
ARFLAGS =

View File

@ -0,0 +1,15 @@
#
# Compiler specific configuration
#
#
# GCC/G++ release for Linux
#
CC = g++ -frtti -pthread -O3 -DNDEBUG -D_REENTRANT
LD = g++ -frtti -pthread
CCFLAGS = -Wall
LDFLAGS = -luuid
OUTDIR = $(MAKESUPPORT_HOME)/out
ARFLAGS =

View File

@ -0,0 +1,14 @@
#
# Compiler specific configuration
#
#
# GCC/G++ debug for Linux
#
CC = g++ -frtti -g -DDEBUG -D_DEBUG -D_REENTRANT -DMACOSX -Dunix
LD = g++ -g -frtti
CCFLAGS = -Wall
LDFLAGS = -lpthread
OUTDIR = $(MAKESUPPORT_HOME)/out
ARFLAGS =

View File

@ -0,0 +1,15 @@
#
# Compiler specific configuration
#
#
# GCC/G++ release for Linux
#
CC = g++ -frtti -O3 -DNDEBUG -D_REENTRANT -DMACOSX -Dunix
LD = g++ -frtti
CCFLAGS = -Wall
LDFLAGS = -lpthread
OUTDIR = $(MAKESUPPORT_HOME)/out
ARFLAGS =

110
openwire-cpp/makefile.cfg Normal file
View File

@ -0,0 +1,110 @@
CURRENT = $(PWD)
# --- select compiler for structure
# ----------------------------------------------------------
include $(MAKESUPPORT_HOME)/makefile-$(OSTYPE)-$(CONFIG).cfg
# --- set generic commmands
# ----------------------------------------------------------
MV = mv
RM = rm -f
RMR = rm -rf
CP = cp -p
LN = ln -s
LS = ls
CAT = cat
MD = mkdir
AR = ar -r
PURIFY = purify
ECHO = echo
TOUCH = touch
CD = cd
STRIP = strip
# --- set default targets and their handling procedures
# ----------------------------------------------------------
.SILENT:
.KEEP_STATE:
.SUFFIXES:
.SUFFIXES: .cpp .CC
.INIT:
$(ECHO) " -<>- Compiling "$(CURRENT)
.DONE:
$(ECHO) " -<>- Done"
.FAILED:
$(ECHO) " *** Compilation of $(CURRENT) Failed"
$(OUTDIR)/%.o: $(SRCDIR)/%.cpp $(SRCDIR)/%.hpp
$(ECHO) " - "$(CC) "'"$<"'"
$(CC) -o $@ $(DEFINES) $(CCFLAGS) -I$(SRCDIR) \
$(LOCAL_INCLUDE) -c $<
# --- set generic targets and their handling procedures
# ----------------------------------------------------------
all: default
default: \
prepare \
$(LIBOFILES) \
$(OUTLIB) \
postpare
$(OUTLIB): $(LIBOFILES) $(DEPLIBS)
$(ECHO) " - Creating static library file "$@
$(AR) $(ARFLAGS) $@ $(LIBOFILES)
test: $(OUTLIB)
$(ECHO) " - Creating test executable"
$(CC) $(CFLAGS) -I$(SRCDIR) -c $(SRCDIR)/../../test/cpp/TestMain.cpp $(OBJS) -o $(OUTDIR)/TestMain.o
$(CC) $(CFLAGS) -I$(SRCDIR) -c $(SRCDIR)/../../test/cpp/TestListener.cpp $(OBJS) -o $(OUTDIR)/TestListener.o
$(LD) $(LDFLAGS) -o $(OUTDIR)/$@ -L$(OUTDIR) $(EXEOFILES) $(EXELIBS)
clean:
$(ECHO) " - Cleaning up local directory "$(CURRENT)
$(ECHO) " - Removing object files"
$(RM) $(LIBOFILES)
$(ECHO) " - Removing file "$(OUTLIB)
$(RM) $(OUTLIB)
$(ECHO) " - Removing file "$(TESTMAIN)
$(RM) $(OUTDIR)/test
$(RM) *~ *%
$(RM) #*
$(RM) core
$(RM) a.out
prepare:
if test ! -d $(OUTDIR) ; \
then \
$(MD) $(OUTDIR); \
$(MD) $(OUTDIR)/activemq; \
$(MD) $(OUTDIR)/activemq/command; \
$(MD) $(OUTDIR)/activemq/protocol; \
$(MD) $(OUTDIR)/activemq/protocol/openwire; \
$(MD) $(OUTDIR)/activemq/transport; \
$(MD) $(OUTDIR)/activemq/transport/tcp; \
$(MD) $(OUTDIR)/cms; \
$(MD) $(OUTDIR)/ppr; \
$(MD) $(OUTDIR)/ppr/io; \
$(MD) $(OUTDIR)/ppr/net; \
$(MD) $(OUTDIR)/ppr/thread; \
$(MD) $(OUTDIR)/ppr/util; \
fi
postpare:
$(ECHO) "Done."

View File

@ -1,200 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "Connection.hpp"
using namespace apache::activemq::client;
/*
*
*/
Connection::Connection(p<ITransport> transport, p<ConnectionInfo> connectionInfo)
{
this->transport = transport ;
this->connectionInfo = connectionInfo ;
this->connected = false ;
this->transacted = false ;
this->closed = false ;
}
/*
*
*/
Connection::~Connection()
{
}
// --- Attribute methods --------------------------------------------
/*
*
*/
p<ITransport> Connection::getTransport()
{
return transport ;
}
/*
*
*/
void Connection::setTransport(p<ITransport> transport) throw(OpenWireException)
{
this->transport = transport ;
}
/*
*
*/
const char* Connection::getClientId()
{
return connectionInfo->getClientId() ;
}
/*
*
*/
void Connection::setClientId(const char* value)
{
if( connected )
throw OpenWireException("You cannot change the ClientId once a connection is established") ;
connectionInfo->setClientId( value ) ;
}
/*
*
*/
bool Connection::getTransacted()
{
return transacted ;
}
/*
*
*/
void Connection::setTransacted(bool tx)
{
transacted = tx ;
}
/*
*
*/
AcknowledgementMode Connection::getAcknowledgementMode()
{
return acknowledgementMode ;
}
/*
*
*/
void Connection::setAcknowledgementMode(AcknowledgementMode mode)
{
acknowledgementMode = mode ;
}
// --- Operation methods --------------------------------------------
/*
*
*/
p<ISession> Connection::createSession() throw(OpenWireException)
{
return createSession(transacted, acknowledgementMode) ;
}
/*
*
*/
p<ISession> Connection::createSession(bool transacted, AcknowledgementMode mode) throw(OpenWireException)
{
checkConnected() ;
p<SessionInfo> sessionInfo = createSessionInfo(transacted, acknowledgementMode) ;
// Send session info to broker
syncRequest(sessionInfo) ;
p<ISession> session = new Session(this, sessionInfo) ;
sessions.push_back(session) ;
return session ;
}
/*
*
*/
p<Response> Connection::syncRequest(p<ICommand> command) throw(OpenWireException)
{
checkConnected() ;
p<Response> response = transport->request(command) ;
if( response->getCommandType() == ExceptionResponse::TYPE )
{
p<ExceptionResponse> exceptionResponse = (p<ExceptionResponse>&)response ;
p<BrokerError> brokerError = exceptionResponse->getException() ;
string message ;
// Build error message
message.assign("Request failed: ") ;
message.append( brokerError->getExceptionClass()->c_str() ) ;
message.append(", ") ;
message.append( brokerError->getStackTrace()->c_str() ) ;
throw new OpenWireException( message.c_str() ) ;
}
return response ;
}
// --- Implementation methods ---------------------------------------
/*
*
*/
p<SessionInfo> Connection::createSessionInfo(bool transacted, AcknowledgementMode acknowledgementMode)
{
p<SessionInfo> sessionInfo = new SessionInfo() ;
p<SessionId> sessionId = new SessionId() ;
sessionId->setConnectionId ( connectionInfo->getConnectionId()->getValue() ) ;
mutex.lock() ;
sessionId->setValue( ++sessionCounter ) ;
mutex.unlock() ;
sessionInfo->setSessionId( sessionId ) ;
return sessionInfo ;
}
/*
*
*/
void Connection::checkConnected() throw(OpenWireException)
{
if( closed )
throw new ConnectionClosedException("Oops! Connection already closed.") ;
if( !connected )
{
syncRequest((p<ICommand>&)connectionInfo) ;
connected = true ;
}
}

View File

@ -1,100 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef Connection_hpp_
#define Connection_hpp_
#include <list>
#include <string>
#include "ISession.hpp"
#include "IConnection.hpp"
#include "Session.hpp"
#include "OpenWireException.hpp"
#include "ConnectionClosedException.hpp"
#include "command/ExceptionResponse.hpp"
#include "command/ConnectionInfo.hpp"
#include "command/SessionInfo.hpp"
#include "command/SessionId.hpp"
#include "transport/ITransport.hpp"
#include "util/SimpleMutex.hpp"
#include "util/ifr/p.hpp"
// Turn off warning message for ignored exception specification
#ifdef _MSC_VER
#pragma warning( disable : 4290 )
#endif
namespace apache
{
namespace activemq
{
namespace client
{
using namespace std;
using namespace ifr::v1;
using namespace apache::activemq::client::command;
using namespace apache::activemq::client::transport;
using namespace apache::activemq::client::util;
/*
*
*/
class Connection : public IConnection
{
private:
p<ConnectionInfo> connectionInfo;
p<ITransport> transport;
list< p<ISession> > sessions;
bool transacted;
bool connected;
bool closed;
AcknowledgementMode acknowledgementMode;
long sessionCounter;
SimpleMutex mutex;
public:
// Constructors
Connection(p<ITransport> transport, p<ConnectionInfo> connectionInfo) ;
virtual ~Connection() ;
// Attribute methods
virtual AcknowledgementMode getAcknowledgementMode() ;
virtual void setAcknowledgementMode(AcknowledgementMode mode) ;
virtual const char* getClientId() ;
virtual void setClientId(const char* value) ;
virtual bool getTransacted() ;
virtual void setTransacted(bool tx) ;
virtual p<ITransport> getTransport() ;
virtual void setTransport(p<ITransport> transport) throw(OpenWireException) ;
// Operation methods
virtual p<ISession> createSession() throw(OpenWireException) ;
virtual p<ISession> createSession(bool transacted, AcknowledgementMode mode) throw(OpenWireException) ;
virtual p<Response> syncRequest(p<ICommand> command) throw(OpenWireException) ;
protected:
// Implementation methods
p<SessionInfo> createSessionInfo(bool transacted, AcknowledgementMode mode) ;
void checkConnected() throw(OpenWireException) ;
} ;
/* namespace */
}
}
}
#endif /*Connection_hpp_*/

View File

@ -1,89 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ConnectionFactory_hpp_
#define ConnectionFactory_hpp_
// Must be included before any STL includes
#include "util/Guid.hpp"
#include <string>
#include "IConnection.hpp"
#include "IConnectionFactory.hpp"
#include "command/ConnectionInfo.hpp"
#include "command/ConnectionId.hpp"
#include "transport/ITransport.hpp"
#include "transport/SocketTransport.hpp"
#include "util/ifr/p.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
using namespace apache::activemq::client::command;
using namespace apache::activemq::client::transport;
using namespace apache::activemq::client::util;
using namespace ifr::v1;
/*
*
*/
class ConnectionFactory : IConnectionFactory
{
private:
p<string> host,
username,
password,
clientId ;
int port ;
public:
// Constructors
ConnectionFactory() ;
ConnectionFactory(const char* host, int port) ;
virtual ~ConnectionFactory() ;
// Attribute methods
virtual p<string> getHost() ;
virtual void setHost(const char* host) ;
virtual int getPort() ;
virtual void setPort(int port) ;
virtual p<string> getUsername() ;
virtual void setUsername(const char* username) ;
virtual p<string> getPassword() ;
virtual void setPassword(const char* password) ;
virtual p<string> getClientId() ;
virtual void setClientId(const char* clientId) ;
// Operation methods
virtual p<IConnection> createConnection() ;
virtual p<IConnection> createConnection(const char* username, const char* password) ;
protected:
// Implementation methods
virtual p<ConnectionInfo> createConnectionInfo(const char* username, const char* password) ;
virtual p<string> createNewConnectionId() ;
virtual p<ITransport> createTransport() ;
} ;
/* namespace */
}
}
}
#endif /*ConnectionFactory_hpp_*/

View File

@ -1,47 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "FutureResponse.hpp"
using namespace apache::activemq::client;
/*
*
*/
FutureResponse::FutureResponse()
{
complete = false ;
response = NULL ;
}
FutureResponse::~FutureResponse()
{
}
p<Response> FutureResponse::getResponse()
{
return response ;
}
void FutureResponse::setResponse(p<Response> response)
{
response = response ;
}
bool FutureResponse::isCompleted()
{
return complete ;
}

View File

@ -1,56 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "MessageConsumer.hpp"
using namespace apache::activemq::client;
/*
*
*/
MessageConsumer::MessageConsumer(p<Session> session, p<ConsumerInfo> producerInfo)
{
this->session = session ;
this->consumerInfo = consumerInfo ;
this->closed = false ;
}
MessageConsumer::~MessageConsumer()
{
session->disposeOf( consumerInfo->getConsumerId() ) ;
}
p<IMessage> MessageConsumer::receive()
{
checkClosed() ;
// TODO
return NULL ;
}
p<IMessage> MessageConsumer::receiveNoWait()
{
checkClosed() ;
// TODO
return NULL ;
}
// Implementation methods ------------------------------------------------
void MessageConsumer::checkClosed() throw(OpenWireException)
{
if( closed )
throw new ConnectionClosedException("Oops! Connection already closed") ;
}

View File

@ -1,74 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MessageConsumer_hpp_
#define MessageConsume_hpp_
#include <string>
#include "IDestination.hpp"
#include "IMessage.hpp"
#include "IMessageConsumer.hpp"
#include "Session.hpp"
#include "OpenWireException.hpp"
#include "ConnectionClosedException.hpp"
#include "command/ConsumerInfo.hpp"
#include "util/ifr/p.hpp"
// Turn off warning message for ignored exception specification
#ifdef _MSC_VER
#pragma warning( disable : 4290 )
#endif
namespace apache
{
namespace activemq
{
namespace client
{
using namespace ifr;
/*
*
*/
class MessageConsumer : public IMessageConsumer
{
private:
p<Session> session ;
p<ConsumerInfo> consumerInfo ;
bool closed ;
public:
MessageConsumer(p<Session> session, p<ConsumerInfo> consumerInfo) ;
virtual ~MessageConsumer() ;
/* TODO
virtual void setMessageListener(p<IMessageListener> listener) ;
virtual p<IMessageListener> getMessageListener() ;
*/
virtual p<IMessage> receive() ;
virtual p<IMessage> receiveNoWait() ;
protected:
void checkClosed() throw(OpenWireException) ;
} ;
/* namespace */
}
}
}
#endif /*IMessageConsumer_hpp_*/

View File

@ -1,43 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "MessageProducer.hpp"
using namespace apache::activemq::client;
/*
*
*/
MessageProducer::MessageProducer(p<Session> session, p<ProducerInfo> producerInfo)
{
this->session = session ;
this->producerInfo = producerInfo ;
}
MessageProducer::~MessageProducer()
{
session->disposeOf( producerInfo->getProducerId() ) ;
}
void MessageProducer::send(p<IMessage> message)
{
send(producerInfo->getDestination(), message) ;
}
void MessageProducer::send(p<IDestination> destination, p<IMessage> message)
{
session->doSend(destination, message) ;
}

View File

@ -1,150 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "Session.hpp"
#include "command/ActiveMQQueue.hpp"
#include "command/ActiveMQTopic.hpp"
#include "command/ActiveMQMessage.hpp"
#include "command/ActiveMQTextMessage.hpp"
#include "command/ProducerInfo.hpp"
#include "command/ConsumerInfo.hpp"
#include "command/MessageAck.hpp"
#include "MessageConsumer.hpp"
#include "MessageProducer.hpp"
#include "Connection.hpp"
using namespace apache::activemq::client;
/*
*
*/
Session::Session(p<Connection> connection, p<SessionInfo> info)
{
this->connection = connection ;
this->sessionInfo = info ;
}
Session::~Session()
{
// De-activate session
disposeOf(sessionInfo->getSessionId()) ; //(IDataStructure*)
}
p<IMessageProducer> Session::createProducer()
{
return createProducer(NULL) ;
}
p<IMessageProducer> Session::createProducer(p<IDestination> destination)
{
p<ProducerInfo> command = createProducerInfo(destination) ;
connection->syncRequest(command) ; //(ICommand*)
p<IMessageProducer> messageProducer = new MessageProducer(this, command) ;
return messageProducer ;
}
void Session::acknowledge(p<IMessage> message)
{
if( ackMode == ClientMode )
{
p<MessageAck> msgAck = new MessageAck() ;
// TODO complete packet
connection->syncRequest(msgAck) ; //(ICommand*)
}
}
p<IMessageConsumer> Session::createConsumer(p<IDestination> destination)
{
return createConsumer(destination, NULL) ;
}
p<IMessageConsumer> Session::createConsumer(p<IDestination> destination, const char* selector)
{
p<ConsumerInfo> command = createConsumerInfo(destination, selector) ;
connection->syncRequest(command) ; //(ICommand*)
p<IMessageConsumer> messageConsumer = new MessageConsumer(this, command) ;
return messageConsumer ;
}
p<IQueue> Session::getQueue(const char* name)
{
p<IQueue> queue = (IQueue*)new ActiveMQQueue(name) ;
return queue ;
}
p<ITopic> Session::getTopic(const char* name)
{
p<ITopic> topic = (ITopic*)new ActiveMQTopic(name) ;
return topic ;
}
p<IMessage> Session::createMessage()
{
p<IMessage> message = (IMessage*)new ActiveMQMessage() ;
return message ;
}
p<ITextMessage> Session::createTextMessage()
{
p<ITextMessage> message = (ITextMessage*)new ActiveMQTextMessage() ;
return message ;
}
p<ITextMessage> Session::createTextMessage(const char* text)
{
p<ITextMessage> message = (ITextMessage*)new ActiveMQTextMessage(text) ;
return message ;
}
void Session::doSend(p<IDestination> destination, p<IMessage> message)
{
p<ActiveMQMessage> command = ActiveMQMessage::transform(message) ;
// TODO complete packet
connection->syncRequest(command) ; //(ICommand*)
}
void Session::disposeOf(p<IDataStructure> objectId)
{
p<RemoveInfo> command = new RemoveInfo() ;
command->setObjectId( objectId ) ;
connection->syncRequest(command) ; //(ICommand*)
}
// Implementation methods ------------------------------------------
p<ConsumerInfo> Session::createConsumerInfo(p<IDestination> destination, const char* selector)
{
p<ConsumerInfo> consumerInfo = new ConsumerInfo() ;
p<ConsumerId> consumerId = new ConsumerId() ;
consumerId->setSessionId( sessionInfo->getSessionId()->getValue() ) ;
mutex.lock() ;
consumerId->setValue( ++consumerCounter ) ;
mutex.unlock() ;
// TODO complete packet
consumerInfo->setConsumerId( consumerId ) ;
return consumerInfo ;
}
p<ProducerInfo> Session::createProducerInfo(p<IDestination> destination)
{
p<ProducerInfo> producerInfo = new ProducerInfo() ;
// TODO complete packet
return producerInfo ;
}

View File

@ -1,81 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef Session_hpp_
#define Session_hpp_
#include <string>
#include "IMessage.hpp"
#include "ISession.hpp"
#include "IConnection.hpp"
#include "command/IDataStructure.hpp"
#include "command/ConsumerInfo.hpp"
#include "command/ProducerInfo.hpp"
#include "command/RemoveInfo.hpp"
#include "command/SessionInfo.hpp"
#include "util/SimpleMutex.hpp"
#include "util/ifr/p.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
using namespace ifr;
using namespace apache::activemq::client::util;
class Connection;
/*
*
*/
class Session : public ISession
{
private:
p<Connection> connection ;
p<SessionInfo> sessionInfo ;
AcknowledgementMode ackMode ;
long consumerCounter ;
SimpleMutex mutex ;
public:
Session(p<Connection> connection, p<SessionInfo> sessionInfo) ;
virtual ~Session() ;
virtual p<IMessageProducer> createProducer() ;
virtual p<IMessageProducer> createProducer(p<IDestination> destination) ;
virtual p<IMessageConsumer> createConsumer(p<IDestination> destination) ;
virtual p<IMessageConsumer> createConsumer(p<IDestination> destination, const char* selector) ;
virtual p<IQueue> getQueue(const char* name) ;
virtual p<ITopic> getTopic(const char* name) ;
virtual p<IMessage> createMessage() ;
virtual p<ITextMessage> createTextMessage() ;
virtual p<ITextMessage> createTextMessage(const char* text) ;
virtual void acknowledge(p<IMessage> message) ;
virtual void doSend(p<IDestination> destination, p<IMessage> message) ;
virtual void disposeOf(p<IDataStructure> objectId) ;
protected:
p<ConsumerInfo> createConsumerInfo(p<IDestination> destination, const char* selector) ;
p<ProducerInfo> createProducerInfo(p<IDestination> destination) ;
} ;
/* namespace */
}
}
}
#endif /*Session_hpp_*/

View File

@ -1,116 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <string.h>
#include "command/AbstractCommand.hpp"
#include "command/ActiveMQMessage.hpp"
#include "command/ActiveMQTextMessage.hpp"
#include "command/MessageAck.hpp"
#include "command/Response.hpp"
#include "command/ConsumerInfo.hpp"
#include "command/ProducerInfo.hpp"
#include "command/BrokerInfo.hpp"
#include "command/ConnectionInfo.hpp"
#include "command/RemoveInfo.hpp"
#include "command/SessionInfo.hpp"
using namespace apache::activemq::client::command;
/*
*
*/
AbstractCommand::AbstractCommand()
{
}
AbstractCommand::~AbstractCommand()
{
}
int AbstractCommand::getCommandType()
{
return 0 ;
}
p<string> AbstractCommand::getCommandTypeAsString(int type)
{
p<string> packetType = new string() ;
switch( type )
{
case ActiveMQMessage::TYPE:
packetType->assign("ACTIVEMQ_MESSAGE") ;
break ;
case ActiveMQTextMessage::TYPE:
packetType->assign("ACTIVEMQ_TEXT_MESSAGE") ;
break ;
// case ActiveMQObjectMessage::TYPE:
// packetType->assign("ACTIVEMQ_OBJECT_MESSAGE") ;
// break ;
// case ActiveMQBytesMessage::TYPE:
// packetType->assign("ACTIVEMQ_BYTES_MESSAGE") ;
// break ;
// case ActiveMQStreamMessage::TYPE:
// packetType->assign("ACTIVEMQ_STREAM_MESSAGE") ;
// break ;
// case ActiveMQMapMessage::TYPE:
// packetType->assign("ACTIVEMQ_MAP_MESSAGE") ;
// break ;
case MessageAck::TYPE:
packetType->assign("ACTIVEMQ_MSG_ACK") ;
break ;
case Response::TYPE:
packetType->assign("RESPONSE") ;
break ;
case ConsumerInfo::TYPE:
packetType->assign("CONSUMER_INFO") ;
break ;
case ProducerInfo::TYPE:
packetType->assign("PRODUCER_INFO") ;
break;
// case TransactionInfo::TYPE:
// packetType->assign("TRANSACTION_INFO") ;
// break ;
case BrokerInfo::TYPE:
packetType->assign("BROKER_INFO") ;
break ;
case ConnectionInfo::TYPE:
packetType->assign("CONNECTION_INFO") ;
break ;
case SessionInfo::TYPE:
packetType->assign("SESSION_INFO") ;
break ;
// case RemoveSubscriptionInfo::TYPE:
// packetType->assign("DURABLE_UNSUBSCRIBE") ;
// break ;
// case IntegerResponse::TYPE:
// packetType->assign("INT_RESPONSE_RECEIPT_INFO") ;
// break ;
// case WireFormatInfo::TYPE:
// packetType->assign("WIRE_FORMAT_INFO") ;
// break ;
case RemoveInfo::TYPE:
packetType->assign("REMOVE_INFO") ;
break ;
// case KeepAliveInfo::TYPE:
// packetType->assign("KEEP_ALIVE") ;
// break ;
default:
packetType->assign("UNDEFINED") ;
break ;
}
return packetType ;
}

View File

@ -1,402 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "command/ActiveMQBytesMessage.hpp"
using namespace apache::activemq::client::command;
/*
*
*/
ActiveMQBytesMessage::ActiveMQBytesMessage()
{
this->body = new char[INITIAL_SIZE] ;
this->bodySize = INITIAL_SIZE ;
this->bodyLength = 0 ;
this->offset = 0 ;
this->readMode = false ;
}
/*
*
*/
ActiveMQBytesMessage::~ActiveMQBytesMessage()
{
}
/*
*
*/
int ActiveMQBytesMessage::getCommandType()
{
return ActiveMQBytesMessage::TYPE ;
}
/*
*
*/
int ActiveMQBytesMessage::getBodyLength()
{
return bodyLength ;
}
/*
*
*/
void ActiveMQBytesMessage::reset()
{
readMode = true ;
offset = 0 ;
}
/*
*
*/
char ActiveMQBytesMessage::readByte() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
// Check for EOF offset
if( offset > bodySize )
throw MessageEOFException() ;
// Read a single byte
return body[offset++] ;
}
/*
*
*/
int ActiveMQBytesMessage::readBytes(char* buffer, int length) throw (MessageNotReadableException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
// Check for EOF offset
if( offset > bodySize )
return -1 ;
// Copy bytes to supplied buffer
for( int i = 0 ; i < length ; i++, offset++ )
{
// Check for body EOF
if( offset > bodySize )
return i ;
buffer[i] = body[offset] ;
}
return length ;
}
/*
*
*/
bool ActiveMQBytesMessage::readBoolean() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
bool value ;
int result ;
// Read a boolean
result = readBytes((char*)&value, sizeof(bool)) ;
// Check for EOF offset
if( result == -1 || result < (int)sizeof(bool) )
throw MessageEOFException() ;
return value ;
}
/*
*
*/
double ActiveMQBytesMessage::readDouble() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
double value ;
int result ;
// Read a double
result = readBytes((char*)&value, sizeof(double)) ;
// Check for EOF offset
if( result == -1 || result < (int)sizeof(double) )
throw MessageEOFException() ;
// Convert from big endian to little endian if necessary
return ntohd(value) ;
}
/*
*
*/
float ActiveMQBytesMessage::readFloat() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
float value ;
int result ;
// Read a float
result = readBytes((char*)&value, sizeof(float)) ;
// Check for EOF offset
if( result == -1 || result < (int)sizeof(float) )
throw MessageEOFException() ;
// Convert from big endian to little endian if necessary
return ntohf(value) ;
}
/*
*
*/
short ActiveMQBytesMessage::readShort() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
short value ;
int result ;
// Read a short
result = readBytes((char*)&value, sizeof(short)) ;
// Check for EOF offset
if( result == -1 || result < (int)sizeof(short) )
throw MessageEOFException() ;
// Convert from big endian to little endian if necessary
return ntohs(value) ;
}
/*
*
*/
int ActiveMQBytesMessage::readInt() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
int value ;
int result ;
// Read an integer
result = readBytes((char*)&value, sizeof(int)) ;
// Check for EOF offset
if( result == -1 || result < (int)sizeof(int) )
throw MessageEOFException() ;
// Convert from big endian to little endian if necessary
return ntohi(value) ;
}
/*
*
*/
long long ActiveMQBytesMessage::readLong() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
long long value ;
int result ;
// Read a long long
result = readBytes((char*)&value, sizeof(long long)) ;
// Check for EOF offset
if( result == -1 || result < (int)sizeof(long long) )
throw MessageEOFException() ;
// Convert from big endian to little endian if necessary
return ntohl(value) ;
}
/*
*
*/
p<string> ActiveMQBytesMessage::readUTF() throw(MessageNotReadableException, MessageEOFException)
{
// TODO
return NULL ;
}
/*
*
*/
void ActiveMQBytesMessage::writeByte(char value) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Check for EOF offset
if( offset > bodySize )
expandBody() ;
// Write a single byte
body[offset++] = value ;
// Update content length
bodyLength = offset ;
}
/*
*
*/
void ActiveMQBytesMessage::writeBytes(char* value, int length) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Copy bytes from supplied buffer
for( int i = 0 ; i < length ; i++, offset++ )
{
// Check for EOF offset
if( offset > bodySize )
expandBody() ;
body[offset] = value[i] ;
}
// Update content length
bodyLength = offset ;
}
/*
*
*/
void ActiveMQBytesMessage::writeBoolean(bool value) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write boolean
writeBytes((char*)&value, sizeof(bool)) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeDouble(double v) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write double, convert from little endian to big endian if necessary
double value = htond(v) ;
writeBytes((char*)&value, sizeof(double)) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeFloat(float v) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write float, convert from little endian to big endian if necessary
float value = htonf(v) ;
writeBytes((char*)&value, sizeof(float)) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeInt(int v) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write integer, convert from little endian to big endian if necessary
int value = htoni(v) ;
writeBytes((char*)&value, sizeof(int)) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeLong(long long v) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write long, convert from little endian to big endian if necessary
long long value = htonl(v) ;
writeBytes((char*)&value, sizeof(long long)) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeShort(short v) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write short, convert from little endian to big endian if necessary
short value = htons(v) ;
writeBytes((char*)&value, sizeof(short)) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeUTF(p<string> value) throw (MessageNotWritableException)
{
// TODO
}
/*
*
*/
void ActiveMQBytesMessage::expandBody()
{
char* newBody ;
int newSize = bodySize + ActiveMQBytesMessage::EXPAND_SIZE ;
// Create new body and copy current contents
newBody = new char[ newSize ] ;
memcpy(newBody, body, bodySize) ;
// Clean up and use new content body
delete [] body ;
body = newBody ;
bodySize = newSize ;
}

View File

@ -1,102 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQBytesMessage_hpp_
#define ActiveMQBytesMessage_hpp_
// Turn off warning message for ignored exception specification
#ifdef _MSC_VER
#pragma warning( disable : 4290 )
#endif
#include <map>
#include <string>
#include "IBytesMessage.hpp"
#include "ActiveMQMessage.hpp"
#include "MessageEOFException.hpp"
#include "MessageNotWritableException.hpp"
#include "util/Endian.hpp"
#include "util/ifr/ap.hpp"
#include "util/ifr/p.hpp"
#include "util/MapItemHolder.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
namespace command
{
using namespace ifr::v1;
using namespace apache::activemq::client::util;
/*
*
*/
class ActiveMQBytesMessage : public ActiveMQMessage, IBytesMessage
{
private:
char* body ;
int bodySize,
bodyLength,
offset ;
bool readMode ;
const static int INITIAL_SIZE = 512 ;
const static int EXPAND_SIZE = 128 ;
public:
const static int TYPE = 24 ;
public:
ActiveMQBytesMessage() ;
virtual ~ActiveMQBytesMessage() ;
virtual int getCommandType() ;
virtual int getBodyLength() ;
virtual void reset() ;
virtual char readByte() throw (MessageNotReadableException, MessageEOFException) ;
virtual int readBytes(char* buffer, int length) throw (MessageNotReadableException) ;
virtual bool readBoolean() throw (MessageNotReadableException, MessageEOFException) ;
virtual double readDouble() throw (MessageNotReadableException, MessageEOFException) ;
virtual float readFloat() throw (MessageNotReadableException, MessageEOFException) ;
virtual int readInt() throw (MessageNotReadableException, MessageEOFException) ;
virtual long long readLong() throw (MessageNotReadableException, MessageEOFException) ;
virtual short readShort() throw (MessageNotReadableException, MessageEOFException) ;
virtual p<string> readUTF() throw (MessageNotReadableException, MessageEOFException) ;
virtual void writeBoolean(bool value) throw (MessageNotWritableException) ;
virtual void writeByte(char value) throw (MessageNotWritableException) ;
virtual void writeBytes(char* value, int length) throw (MessageNotWritableException) ;
virtual void writeDouble(double value) throw (MessageNotWritableException) ;
virtual void writeFloat(float value) throw (MessageNotWritableException) ;
virtual void writeInt(int value) throw (MessageNotWritableException) ;
virtual void writeLong(long long value) throw (MessageNotWritableException) ;
virtual void writeShort(short value) throw (MessageNotWritableException) ;
virtual void writeUTF(p<string> value) throw (MessageNotWritableException) ;
private:
void expandBody() ;
} ;
/* namespace */
}
}
}
}
#endif /*ActiveMQBytesMessage_hpp_*/

View File

@ -1,35 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "command/ActiveMQDestination.hpp"
using namespace apache::activemq::client::command;
/*
* Dummy, should be auto-generated
*/
ActiveMQDestination::ActiveMQDestination()
{
}
ActiveMQDestination::ActiveMQDestination( const char* physicalName ){
setPhysicalName( physicalName );
}
ActiveMQDestination::~ActiveMQDestination()
{
}

View File

@ -1,72 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQDestination_hpp_
#define ActiveMQDestination_hpp_
#include "IDestination.hpp"
#include "command/AbstractCommand.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
namespace command
{
using namespace apache::activemq::client;
/*
* Dummy, should be auto-generated.
*/
class ActiveMQDestination : public AbstractCommand, IDestination
{
private:
string physicalName;
public:
enum DestinationType{
ACTIVEMQ_QUEUE,
ACTIVEMQ_TEMP_QUEUE,
ACTIVEMQ_TOPIC,
ACTIVEMQ_TEMP_TOPIC
};
public:
ActiveMQDestination();
ActiveMQDestination( const char* physicalName );
virtual ~ActiveMQDestination() ;
virtual const char* getPhysicalName(){
return physicalName.c_str();
}
virtual void setPhysicalName( const char* name ){
physicalName = name;
}
} ;
/* namespace */
}
}
}
}
#endif /*ActiveMQDestination_hpp_*/

View File

@ -1,91 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQMapMessage_hpp_
#define ActiveMQMapMessage_hpp_
// Turn off warning message for ignored exception specification
#ifdef _MSC_VER
#pragma warning( disable : 4290 )
#endif
#include <map>
#include <string>
#include "ActiveMQMessage.hpp"
#include "IllegalArgumentException.hpp"
#include "MessageFormatException.hpp"
#include "util/ifr/ap.hpp"
#include "util/ifr/p.hpp"
#include "util/MapItemHolder.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
namespace command
{
using namespace ifr::v1;
using namespace apache::activemq::client::util;
/*
*
*/
class ActiveMQMapMessage : public ActiveMQMessage
{
private:
p<string> text ;
map< p<string>, p<MapItemHolder> > contentMap ;
public:
const static int TYPE = 25 ;
public:
ActiveMQMapMessage() ;
virtual ~ActiveMQMapMessage() ;
virtual int getCommandType() ;
virtual bool getBoolean(const char* name) throw (MessageFormatException) ;
virtual void setBoolean(const char* name, bool value) throw (IllegalArgumentException) ;
virtual char getByte(const char* name) throw (MessageFormatException) ;
virtual void setByte(const char* name, char value) throw (IllegalArgumentException) ;
virtual ap<char> getBytes(const char* name) throw (MessageFormatException) ;
virtual void setBytes(const char* name, ap<char> value) throw (IllegalArgumentException) ;
virtual double getDouble(const char* name) throw (MessageFormatException) ;
virtual void setDouble(const char* name, double value) throw (IllegalArgumentException) ;
virtual float getFloat(const char* name) throw (MessageFormatException) ;
virtual void setFloat(const char* name, float value) throw (IllegalArgumentException) ;
virtual int getInt(const char* name) throw (MessageFormatException) ;
virtual void setInt(const char* name, int value) throw (IllegalArgumentException) ;
virtual long long getLong(const char* name) throw (MessageFormatException) ;
virtual void setLong(const char* name, long long value) throw (IllegalArgumentException) ;
virtual short getShort(const char* name) throw (MessageFormatException) ;
virtual void setShort(const char* name, short value) throw (IllegalArgumentException) ;
virtual p<string> getString(const char* name) throw (MessageFormatException) ;
virtual void setString(const char* name, p<string> value) throw (IllegalArgumentException) ;
virtual ap<string> getMapNames() ;
virtual bool itemExists(const char* name) ;
} ;
/* namespace */
}
}
}
}
#endif /*ActiveMQMapMessage_hpp_*/

View File

@ -1,50 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "command/ActiveMQMessage.hpp"
using namespace apache::activemq::client::command;
/*
* Dummy, should be auto-generated
*/
ActiveMQMessage::ActiveMQMessage()
{
destination = NULL ;
}
ActiveMQMessage::ActiveMQMessage(const char* name)
{
}
ActiveMQMessage::~ActiveMQMessage()
{
}
p<IDestination> ActiveMQMessage::getFromDestination()
{
return destination ;
}
void ActiveMQMessage::setFromDestination(p<IDestination> destination)
{
this->destination = destination ;
}
p<ActiveMQMessage> ActiveMQMessage::transform(p<IMessage> message)
{
return (p<ActiveMQMessage>&)message ;
}

View File

@ -1,65 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQMessage_hpp_
#define ActiveMQMessage_hpp_
#include <string>
#include "IDestination.hpp"
#include "IMessage.hpp"
#include "command/Message.hpp"
#include "util/ifr/p.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
namespace command
{
using namespace ifr::v1;
using namespace apache::activemq::client;
/*
* Dummy, should be auto-generated.
*/
class ActiveMQMessage : public Message, IMessage
{
private:
p<IDestination> destination ;
public:
const static int TYPE = 23 ;
public:
ActiveMQMessage() ;
ActiveMQMessage(const char* name) ;
virtual ~ActiveMQMessage() ;
virtual p<IDestination> getFromDestination() ;
virtual void setFromDestination(p<IDestination> destination) ;
static p<ActiveMQMessage> transform(p<IMessage> message) ;
} ;
/* namespace */
}
}
}
}
#endif /*ActiveMQMessage_hpp_*/

View File

@ -1,37 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "command/ActiveMQObjectMessage.hpp"
using namespace apache::activemq::client::command;
/*
*
* Marshalling code for Open Wire Format for ActiveMQObjectMessage
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
ActiveMQObjectMessage::ActiveMQObjectMessage()
{
}
ActiveMQObjectMessage::~ActiveMQObjectMessage()
{
}

View File

@ -1,71 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQObjectMessage_hpp_
#define ActiveMQObjectMessage_hpp_
#include <string>
#include "command/ActiveMQMessage.hpp"
#include "util/ifr/ap.hpp"
#include "util/ifr/p.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
namespace command
{
using namespace ifr::v1;
using namespace std;
using namespace apache::activemq::client;
/*
*
* Marshalling code for Open Wire Format for ActiveMQObjectMessage
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
class ActiveMQObjectMessage : public ActiveMQMessage
{
private:
public:
const static int TYPE = 26;
public:
ActiveMQObjectMessage() ;
virtual ~ActiveMQObjectMessage() ;
virtual int getCommandType() ;
} ;
/* namespace */
}
}
}
}
#endif /*ActiveMQObjectMessage_hpp_*/

View File

@ -1,69 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef BaseCommand_hpp_
#define BaseCommand_hpp_
#include <string>
#include "command/AbstractCommand.hpp"
#include "util/ifr/p.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
namespace command
{
using namespace ifr::v1;
using namespace std;
/*
*
*/
class BaseCommand : public AbstractCommand
{
private:
int commandId ;
bool responseRequired ;
public:
const static int TYPE = 0 ;
public:
BaseCommand() ;
virtual ~BaseCommand() ;
// Equals operator
bool operator== (BaseCommand& other) ;
virtual int getHashCode() ;
virtual int getCommandType() ;
virtual int getCommandId() ;
virtual void setCommandId(int id) ;
virtual bool isResponseRequired() ;
virtual void setResponseRequired(bool required) ;
virtual p<string> toString() ;
};
/* namespace */
}
}
}
}
#endif /*BaseCommand_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ConnectionError_hpp_ #define ConnectionError_hpp_ #include <string> #include "command/BaseCommand.hpp" #include "BrokerError.hpp" #include "command/ConnectionId.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for ConnectionError * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class ConnectionError : public BaseCommand { private: p<BrokerError> exception ; p<ConnectionId> connectionId ; public: const static int TYPE = 16; public: ConnectionError() ; virtual ~ConnectionError() ; virtual int getCommandType() ; virtual p<BrokerError> getException() ; virtual void setException(p<BrokerError> exception) ; virtual p<ConnectionId> getConnectionId() ; virtual void setConnectionId(p<ConnectionId> connectionId) ; } ; /* namespace */ } } } } #endif /*ConnectionError_hpp_*/

View File

@ -1,229 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "command/ConsumerInfo.hpp"
using namespace apache::activemq::client::command;
/*
*
* Marshalling code for Open Wire Format for ConsumerInfo
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
ConsumerInfo::ConsumerInfo()
{
this->consumerId = 0 ;
this->browser = 0 ;
this->destination = 0 ;
this->prefetchSize = 0 ;
this->maximumPendingMessageLimit = 0 ;
this->dispatchAsync = 0 ;
this->selector = 0 ;
this->subcriptionName = 0 ;
this->noLocal = 0 ;
this->exclusive = 0 ;
this->retroactive = 0 ;
this->priority = 0 ;
this->brokerPath = 0 ;
this->additionalPredicate = 0 ;
this->networkSubscription = 0 ;
this->optimizedAcknowledge = 0 ;
}
ConsumerInfo::~ConsumerInfo()
{
}
p<ConsumerId> ConsumerInfo::getConsumerId()
{
return consumerId ;
}
void ConsumerInfo::setConsumerId(p<ConsumerId> consumerId)
{
this->consumerId = consumerId ;
}
bool ConsumerInfo::getBrowser()
{
return browser ;
}
void ConsumerInfo::setBrowser(bool browser)
{
this->browser = browser ;
}
p<ActiveMQDestination> ConsumerInfo::getDestination()
{
return destination ;
}
void ConsumerInfo::setDestination(p<ActiveMQDestination> destination)
{
this->destination = destination ;
}
int ConsumerInfo::getPrefetchSize()
{
return prefetchSize ;
}
void ConsumerInfo::setPrefetchSize(int prefetchSize)
{
this->prefetchSize = prefetchSize ;
}
int ConsumerInfo::getMaximumPendingMessageLimit()
{
return maximumPendingMessageLimit ;
}
void ConsumerInfo::setMaximumPendingMessageLimit(int maximumPendingMessageLimit)
{
this->maximumPendingMessageLimit = maximumPendingMessageLimit ;
}
bool ConsumerInfo::getDispatchAsync()
{
return dispatchAsync ;
}
void ConsumerInfo::setDispatchAsync(bool dispatchAsync)
{
this->dispatchAsync = dispatchAsync ;
}
p<string> ConsumerInfo::getSelector()
{
return selector ;
}
void ConsumerInfo::setSelector(p<string> selector)
{
this->selector = selector ;
}
p<string> ConsumerInfo::getSubcriptionName()
{
return subcriptionName ;
}
void ConsumerInfo::setSubcriptionName(p<string> subcriptionName)
{
this->subcriptionName = subcriptionName ;
}
bool ConsumerInfo::getNoLocal()
{
return noLocal ;
}
void ConsumerInfo::setNoLocal(bool noLocal)
{
this->noLocal = noLocal ;
}
bool ConsumerInfo::getExclusive()
{
return exclusive ;
}
void ConsumerInfo::setExclusive(bool exclusive)
{
this->exclusive = exclusive ;
}
bool ConsumerInfo::getRetroactive()
{
return retroactive ;
}
void ConsumerInfo::setRetroactive(bool retroactive)
{
this->retroactive = retroactive ;
}
char ConsumerInfo::getPriority()
{
return priority ;
}
void ConsumerInfo::setPriority(char priority)
{
this->priority = priority ;
}
ap<BrokerId> ConsumerInfo::getBrokerPath()
{
return brokerPath ;
}
void ConsumerInfo::setBrokerPath(ap<BrokerId> brokerPath)
{
this->brokerPath = brokerPath ;
}
p<BooleanExpression> ConsumerInfo::getAdditionalPredicate()
{
return additionalPredicate ;
}
void ConsumerInfo::setAdditionalPredicate(p<BooleanExpression> additionalPredicate)
{
this->additionalPredicate = additionalPredicate ;
}
bool ConsumerInfo::getNetworkSubscription()
{
return networkSubscription ;
}
void ConsumerInfo::setNetworkSubscription(bool networkSubscription)
{
this->networkSubscription = networkSubscription ;
}
bool ConsumerInfo::getOptimizedAcknowledge()
{
return optimizedAcknowledge ;
}
void ConsumerInfo::setOptimizedAcknowledge(bool optimizedAcknowledge)
{
this->optimizedAcknowledge = optimizedAcknowledge ;
}

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ControlCommand_hpp_ #define ControlCommand_hpp_ #include <string> #include "command/BaseCommand.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for ControlCommand * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class ControlCommand : public BaseCommand { private: p<string> command ; public: const static int TYPE = 14; public: ControlCommand() ; virtual ~ControlCommand() ; virtual int getCommandType() ; virtual p<string> getCommand() ; virtual void setCommand(p<string> command) ; } ; /* namespace */ } } } } #endif /*ControlCommand_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef DataArrayResponse_hpp_ #define DataArrayResponse_hpp_ #include <string> #include "command/Response.hpp" #include "command/IDataStructure.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for DataArrayResponse * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class DataArrayResponse : public Response { private: ap<IDataStructure> data ; public: const static int TYPE = 33; public: DataArrayResponse() ; virtual ~DataArrayResponse() ; virtual int getCommandType() ; virtual ap<IDataStructure> getData() ; virtual void setData(ap<IDataStructure> data) ; } ; /* namespace */ } } } } #endif /*DataArrayResponse_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef DataResponse_hpp_ #define DataResponse_hpp_ #include <string> #include "command/Response.hpp" #include "command/IDataStructure.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for DataResponse * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class DataResponse : public Response { private: p<IDataStructure> data ; public: const static int TYPE = 32; public: DataResponse() ; virtual ~DataResponse() ; virtual int getCommandType() ; virtual p<IDataStructure> getData() ; virtual void setData(p<IDataStructure> data) ; } ; /* namespace */ } } } } #endif /*DataResponse_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef DestinationInfo_hpp_ #define DestinationInfo_hpp_ #include <string> #include "command/BaseCommand.hpp" #include "command/ConnectionId.hpp" #include "command/ActiveMQDestination.hpp" #include "command/BrokerId.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for DestinationInfo * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class DestinationInfo : public BaseCommand { private: p<ConnectionId> connectionId ; p<ActiveMQDestination> destination ; char operationType ; long long timeout ; ap<BrokerId> brokerPath ; public: const static int TYPE = 8; public: DestinationInfo() ; virtual ~DestinationInfo() ; virtual int getCommandType() ; virtual p<ConnectionId> getConnectionId() ; virtual void setConnectionId(p<ConnectionId> connectionId) ; virtual p<ActiveMQDestination> getDestination() ; virtual void setDestination(p<ActiveMQDestination> destination) ; virtual char getOperationType() ; virtual void setOperationType(char operationType) ; virtual long long getTimeout() ; virtual void setTimeout(long long timeout) ; virtual ap<BrokerId> getBrokerPath() ; virtual void setBrokerPath(ap<BrokerId> brokerPath) ; } ; /* namespace */ } } } } #endif /*DestinationInfo_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef DiscoveryEvent_hpp_ #define DiscoveryEvent_hpp_ #include <string> #include "command/BaseDataStructure.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for DiscoveryEvent * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class DiscoveryEvent : public BaseDataStructure { private: p<string> serviceName ; p<string> brokerName ; public: const static int TYPE = 40; public: DiscoveryEvent() ; virtual ~DiscoveryEvent() ; virtual int getCommandType() ; virtual p<string> getServiceName() ; virtual void setServiceName(p<string> serviceName) ; virtual p<string> getBrokerName() ; virtual void setBrokerName(p<string> brokerName) ; } ; /* namespace */ } } } } #endif /*DiscoveryEvent_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef FlushCommand_hpp_ #define FlushCommand_hpp_ #include <string> #include "command/BaseCommand.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for FlushCommand * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class FlushCommand : public BaseCommand { private: public: const static int TYPE = 15; public: FlushCommand() ; virtual ~FlushCommand() ; virtual int getCommandType() ; } ; /* namespace */ } } } } #endif /*FlushCommand_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef IntegerResponse_hpp_ #define IntegerResponse_hpp_ #include <string> #include "command/Response.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for IntegerResponse * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class IntegerResponse : public Response { private: int result ; public: const static int TYPE = 34; public: IntegerResponse() ; virtual ~IntegerResponse() ; virtual int getCommandType() ; virtual int getResult() ; virtual void setResult(int result) ; } ; /* namespace */ } } } } #endif /*IntegerResponse_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef JournalQueueAck_hpp_ #define JournalQueueAck_hpp_ #include <string> #include "command/BaseDataStructure.hpp" #include "command/ActiveMQDestination.hpp" #include "command/MessageAck.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for JournalQueueAck * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class JournalQueueAck : public BaseDataStructure { private: p<ActiveMQDestination> destination ; p<MessageAck> messageAck ; public: const static int TYPE = 52; public: JournalQueueAck() ; virtual ~JournalQueueAck() ; virtual int getCommandType() ; virtual p<ActiveMQDestination> getDestination() ; virtual void setDestination(p<ActiveMQDestination> destination) ; virtual p<MessageAck> getMessageAck() ; virtual void setMessageAck(p<MessageAck> messageAck) ; } ; /* namespace */ } } } } #endif /*JournalQueueAck_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef JournalTopicAck_hpp_ #define JournalTopicAck_hpp_ #include <string> #include "command/BaseDataStructure.hpp" #include "command/ActiveMQDestination.hpp" #include "command/MessageId.hpp" #include "command/TransactionId.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for JournalTopicAck * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class JournalTopicAck : public BaseDataStructure { private: p<ActiveMQDestination> destination ; p<MessageId> messageId ; long long messageSequenceId ; p<string> subscritionName ; p<string> clientId ; p<TransactionId> transactionId ; public: const static int TYPE = 50; public: JournalTopicAck() ; virtual ~JournalTopicAck() ; virtual int getCommandType() ; virtual p<ActiveMQDestination> getDestination() ; virtual void setDestination(p<ActiveMQDestination> destination) ; virtual p<MessageId> getMessageId() ; virtual void setMessageId(p<MessageId> messageId) ; virtual long long getMessageSequenceId() ; virtual void setMessageSequenceId(long long messageSequenceId) ; virtual p<string> getSubscritionName() ; virtual void setSubscritionName(p<string> subscritionName) ; virtual p<string> getClientId() ; virtual void setClientId(p<string> clientId) ; virtual p<TransactionId> getTransactionId() ; virtual void setTransactionId(p<TransactionId> transactionId) ; } ; /* namespace */ } } } } #endif /*JournalTopicAck_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef JournalTrace_hpp_ #define JournalTrace_hpp_ #include <string> #include "command/BaseDataStructure.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for JournalTrace * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class JournalTrace : public BaseDataStructure { private: p<string> message ; public: const static int TYPE = 53; public: JournalTrace() ; virtual ~JournalTrace() ; virtual int getCommandType() ; virtual p<string> getMessage() ; virtual void setMessage(p<string> message) ; } ; /* namespace */ } } } } #endif /*JournalTrace_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef JournalTransaction_hpp_ #define JournalTransaction_hpp_ #include <string> #include "command/BaseDataStructure.hpp" #include "command/TransactionId.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for JournalTransaction * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class JournalTransaction : public BaseDataStructure { private: p<TransactionId> transactionId ; char type ; bool wasPrepared ; public: const static int TYPE = 54; public: JournalTransaction() ; virtual ~JournalTransaction() ; virtual int getCommandType() ; virtual p<TransactionId> getTransactionId() ; virtual void setTransactionId(p<TransactionId> transactionId) ; virtual char getType() ; virtual void setType(char type) ; virtual bool getWasPrepared() ; virtual void setWasPrepared(bool wasPrepared) ; } ; /* namespace */ } } } } #endif /*JournalTransaction_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef KeepAliveInfo_hpp_ #define KeepAliveInfo_hpp_ #include <string> #include "command/BaseCommand.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for KeepAliveInfo * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class KeepAliveInfo : public BaseCommand { private: public: const static int TYPE = 10; public: KeepAliveInfo() ; virtual ~KeepAliveInfo() ; virtual int getCommandType() ; } ; /* namespace */ } } } } #endif /*KeepAliveInfo_hpp_*/

View File

@ -1,37 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "command/LastPartialCommand.hpp"
using namespace apache::activemq::client::command;
/*
*
* Marshalling code for Open Wire Format for LastPartialCommand
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
LastPartialCommand::LastPartialCommand()
{
}
LastPartialCommand::~LastPartialCommand()
{
}

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef LastPartialCommand_hpp_ #define LastPartialCommand_hpp_ #include <string> #include "command/PartialCommand.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for LastPartialCommand * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class LastPartialCommand : public PartialCommand { private: public: const static int TYPE = 61; public: LastPartialCommand() ; virtual ~LastPartialCommand() ; virtual int getCommandType() ; } ; /* namespace */ } } } } #endif /*LastPartialCommand_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef LocalTransactionId_hpp_ #define LocalTransactionId_hpp_ #include <string> #include "command/TransactionId.hpp" #include "command/ConnectionId.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for LocalTransactionId * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class LocalTransactionId : public TransactionId { private: long long value ; p<ConnectionId> connectionId ; public: const static int TYPE = 111; public: LocalTransactionId() ; virtual ~LocalTransactionId() ; virtual int getCommandType() ; virtual long long getValue() ; virtual void setValue(long long value) ; virtual p<ConnectionId> getConnectionId() ; virtual void setConnectionId(p<ConnectionId> connectionId) ; } ; /* namespace */ } } } } #endif /*LocalTransactionId_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MessageDispatch_hpp_ #define MessageDispatch_hpp_ #include <string> #include "command/BaseCommand.hpp" #include "command/ConsumerId.hpp" #include "command/ActiveMQDestination.hpp" #include "command/Message.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for MessageDispatch * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class MessageDispatch : public BaseCommand { private: p<ConsumerId> consumerId ; p<ActiveMQDestination> destination ; p<Message> message ; int redeliveryCounter ; public: const static int TYPE = 21; public: MessageDispatch() ; virtual ~MessageDispatch() ; virtual int getCommandType() ; virtual p<ConsumerId> getConsumerId() ; virtual void setConsumerId(p<ConsumerId> consumerId) ; virtual p<ActiveMQDestination> getDestination() ; virtual void setDestination(p<ActiveMQDestination> destination) ; virtual p<Message> getMessage() ; virtual void setMessage(p<Message> message) ; virtual int getRedeliveryCounter() ; virtual void setRedeliveryCounter(int redeliveryCounter) ; } ; /* namespace */ } } } } #endif /*MessageDispatch_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MessageDispatchNotification_hpp_ #define MessageDispatchNotification_hpp_ #include <string> #include "command/BaseCommand.hpp" #include "command/ConsumerId.hpp" #include "command/ActiveMQDestination.hpp" #include "command/MessageId.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for MessageDispatchNotification * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class MessageDispatchNotification : public BaseCommand { private: p<ConsumerId> consumerId ; p<ActiveMQDestination> destination ; long long deliverySequenceId ; p<MessageId> messageId ; public: const static int TYPE = 90; public: MessageDispatchNotification() ; virtual ~MessageDispatchNotification() ; virtual int getCommandType() ; virtual p<ConsumerId> getConsumerId() ; virtual void setConsumerId(p<ConsumerId> consumerId) ; virtual p<ActiveMQDestination> getDestination() ; virtual void setDestination(p<ActiveMQDestination> destination) ; virtual long long getDeliverySequenceId() ; virtual void setDeliverySequenceId(long long deliverySequenceId) ; virtual p<MessageId> getMessageId() ; virtual void setMessageId(p<MessageId> messageId) ; } ; /* namespace */ } } } } #endif /*MessageDispatchNotification_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MessageId_hpp_ #define MessageId_hpp_ #include <string> #include "command/BaseDataStructure.hpp" #include "command/ProducerId.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for MessageId * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class MessageId : public BaseDataStructure { private: p<ProducerId> producerId ; long long producerSequenceId ; long long brokerSequenceId ; public: const static int TYPE = 110; public: MessageId() ; virtual ~MessageId() ; virtual int getCommandType() ; virtual p<ProducerId> getProducerId() ; virtual void setProducerId(p<ProducerId> producerId) ; virtual long long getProducerSequenceId() ; virtual void setProducerSequenceId(long long producerSequenceId) ; virtual long long getBrokerSequenceId() ; virtual void setBrokerSequenceId(long long brokerSequenceId) ; } ; /* namespace */ } } } } #endif /*MessageId_hpp_*/

View File

@ -1,61 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "command/NetworkBridgeFilter.hpp"
using namespace apache::activemq::client::command;
/*
*
* Marshalling code for Open Wire Format for NetworkBridgeFilter
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
NetworkBridgeFilter::NetworkBridgeFilter()
{
this->networkTTL = 0 ;
this->networkBrokerId = 0 ;
}
NetworkBridgeFilter::~NetworkBridgeFilter()
{
}
int NetworkBridgeFilter::getNetworkTTL()
{
return networkTTL ;
}
void NetworkBridgeFilter::setNetworkTTL(int networkTTL)
{
this->networkTTL = networkTTL ;
}
p<BrokerId> NetworkBridgeFilter::getNetworkBrokerId()
{
return networkBrokerId ;
}
void NetworkBridgeFilter::setNetworkBrokerId(p<BrokerId> networkBrokerId)
{
this->networkBrokerId = networkBrokerId ;
}

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef NetworkBridgeFilter_hpp_ #define NetworkBridgeFilter_hpp_ #include <string> #include "command/BaseDataStructure.hpp" #include "command/BrokerId.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for NetworkBridgeFilter * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class NetworkBridgeFilter : public BaseDataStructure { private: int networkTTL ; p<BrokerId> networkBrokerId ; public: const static int TYPE = 91; public: NetworkBridgeFilter() ; virtual ~NetworkBridgeFilter() ; virtual int getCommandType() ; virtual int getNetworkTTL() ; virtual void setNetworkTTL(int networkTTL) ; virtual p<BrokerId> getNetworkBrokerId() ; virtual void setNetworkBrokerId(p<BrokerId> networkBrokerId) ; } ; /* namespace */ } } } } #endif /*NetworkBridgeFilter_hpp_*/

View File

@ -1,61 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "command/PartialCommand.hpp"
using namespace apache::activemq::client::command;
/*
*
* Marshalling code for Open Wire Format for PartialCommand
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
PartialCommand::PartialCommand()
{
this->commandId = 0 ;
this->data = 0 ;
}
PartialCommand::~PartialCommand()
{
}
int PartialCommand::getCommandId()
{
return commandId ;
}
void PartialCommand::setCommandId(int commandId)
{
this->commandId = commandId ;
}
ap<char> PartialCommand::getData()
{
return data ;
}
void PartialCommand::setData(ap<char> data)
{
this->data = data ;
}

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef PartialCommand_hpp_ #define PartialCommand_hpp_ #include <string> #include "command/BaseDataStructure.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for PartialCommand * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class PartialCommand : public BaseDataStructure { private: int commandId ; ap<char> data ; public: const static int TYPE = 60; public: PartialCommand() ; virtual ~PartialCommand() ; virtual int getCommandType() ; virtual int getCommandId() ; virtual void setCommandId(int commandId) ; virtual ap<char> getData() ; virtual void setData(ap<char> data) ; } ; /* namespace */ } } } } #endif /*PartialCommand_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef RemoveSubscriptionInfo_hpp_ #define RemoveSubscriptionInfo_hpp_ #include <string> #include "command/BaseCommand.hpp" #include "command/ConnectionId.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for RemoveSubscriptionInfo * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class RemoveSubscriptionInfo : public BaseCommand { private: p<ConnectionId> connectionId ; p<string> subcriptionName ; p<string> clientId ; public: const static int TYPE = 0; public: RemoveSubscriptionInfo() ; virtual ~RemoveSubscriptionInfo() ; virtual int getCommandType() ; virtual p<ConnectionId> getConnectionId() ; virtual void setConnectionId(p<ConnectionId> connectionId) ; virtual p<string> getSubcriptionName() ; virtual void setSubcriptionName(p<string> subcriptionName) ; virtual p<string> getClientId() ; virtual void setClientId(p<string> clientId) ; } ; /* namespace */ } } } } #endif /*RemoveSubscriptionInfo_hpp_*/

View File

@ -1,61 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "command/ReplayCommand.hpp"
using namespace apache::activemq::client::command;
/*
*
* Marshalling code for Open Wire Format for ReplayCommand
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
ReplayCommand::ReplayCommand()
{
this->firstNakNumber = 0 ;
this->lastNakNumber = 0 ;
}
ReplayCommand::~ReplayCommand()
{
}
int ReplayCommand::getFirstNakNumber()
{
return firstNakNumber ;
}
void ReplayCommand::setFirstNakNumber(int firstNakNumber)
{
this->firstNakNumber = firstNakNumber ;
}
int ReplayCommand::getLastNakNumber()
{
return lastNakNumber ;
}
void ReplayCommand::setLastNakNumber(int lastNakNumber)
{
this->lastNakNumber = lastNakNumber ;
}

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ReplayCommand_hpp_ #define ReplayCommand_hpp_ #include <string> #include "command/BaseCommand.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for ReplayCommand * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class ReplayCommand : public BaseCommand { private: int firstNakNumber ; int lastNakNumber ; public: const static int TYPE = 65; public: ReplayCommand() ; virtual ~ReplayCommand() ; virtual int getCommandType() ; virtual int getFirstNakNumber() ; virtual void setFirstNakNumber(int firstNakNumber) ; virtual int getLastNakNumber() ; virtual void setLastNakNumber(int lastNakNumber) ; } ; /* namespace */ } } } } #endif /*ReplayCommand_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ShutdownInfo_hpp_ #define ShutdownInfo_hpp_ #include <string> #include "command/BaseCommand.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for ShutdownInfo * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class ShutdownInfo : public BaseCommand { private: public: const static int TYPE = 11; public: ShutdownInfo() ; virtual ~ShutdownInfo() ; virtual int getCommandType() ; } ; /* namespace */ } } } } #endif /*ShutdownInfo_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef SubscriptionInfo_hpp_ #define SubscriptionInfo_hpp_ #include <string> #include "command/BaseDataStructure.hpp" #include "command/ActiveMQDestination.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for SubscriptionInfo * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class SubscriptionInfo : public BaseDataStructure { private: p<string> clientId ; p<ActiveMQDestination> destination ; p<string> selector ; p<string> subcriptionName ; public: const static int TYPE = 55; public: SubscriptionInfo() ; virtual ~SubscriptionInfo() ; virtual int getCommandType() ; virtual p<string> getClientId() ; virtual void setClientId(p<string> clientId) ; virtual p<ActiveMQDestination> getDestination() ; virtual void setDestination(p<ActiveMQDestination> destination) ; virtual p<string> getSelector() ; virtual void setSelector(p<string> selector) ; virtual p<string> getSubcriptionName() ; virtual void setSubcriptionName(p<string> subcriptionName) ; } ; /* namespace */ } } } } #endif /*SubscriptionInfo_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef TransactionId_hpp_ #define TransactionId_hpp_ #include <string> #include "command/BaseDataStructure.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for TransactionId * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class TransactionId : public BaseDataStructure { private: public: const static int TYPE = 0; public: TransactionId() ; virtual ~TransactionId() ; virtual int getCommandType() ; } ; /* namespace */ } } } } #endif /*TransactionId_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef TransactionInfo_hpp_ #define TransactionInfo_hpp_ #include <string> #include "command/BaseCommand.hpp" #include "command/ConnectionId.hpp" #include "command/TransactionId.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for TransactionInfo * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class TransactionInfo : public BaseCommand { private: p<ConnectionId> connectionId ; p<TransactionId> transactionId ; char type ; public: const static int TYPE = 7; public: TransactionInfo() ; virtual ~TransactionInfo() ; virtual int getCommandType() ; virtual p<ConnectionId> getConnectionId() ; virtual void setConnectionId(p<ConnectionId> connectionId) ; virtual p<TransactionId> getTransactionId() ; virtual void setTransactionId(p<TransactionId> transactionId) ; virtual char getType() ; virtual void setType(char type) ; } ; /* namespace */ } } } } #endif /*TransactionInfo_hpp_*/

View File

@ -1,121 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "command/WireFormatInfo.hpp"
using namespace apache::activemq::client::command;
/*
*
* Marshalling code for Open Wire Format for WireFormatInfo
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
WireFormatInfo::WireFormatInfo()
{
this->magic = 0 ;
this->version = 0 ;
this->cacheEnabled = 0 ;
this->stackTraceEnabled = 0 ;
this->tcpNoDelayEnabled = 0 ;
this->prefixPacketSize = 0 ;
this->tightEncodingEnabled = 0 ;
}
WireFormatInfo::~WireFormatInfo()
{
}
ap<char> WireFormatInfo::getMagic()
{
return magic ;
}
void WireFormatInfo::setMagic(ap<char> magic)
{
this->magic = magic ;
}
int WireFormatInfo::getVersion()
{
return version ;
}
void WireFormatInfo::setVersion(int version)
{
this->version = version ;
}
bool WireFormatInfo::getCacheEnabled()
{
return cacheEnabled ;
}
void WireFormatInfo::setCacheEnabled(bool cacheEnabled)
{
this->cacheEnabled = cacheEnabled ;
}
bool WireFormatInfo::getStackTraceEnabled()
{
return stackTraceEnabled ;
}
void WireFormatInfo::setStackTraceEnabled(bool stackTraceEnabled)
{
this->stackTraceEnabled = stackTraceEnabled ;
}
bool WireFormatInfo::getTcpNoDelayEnabled()
{
return tcpNoDelayEnabled ;
}
void WireFormatInfo::setTcpNoDelayEnabled(bool tcpNoDelayEnabled)
{
this->tcpNoDelayEnabled = tcpNoDelayEnabled ;
}
bool WireFormatInfo::getPrefixPacketSize()
{
return prefixPacketSize ;
}
void WireFormatInfo::setPrefixPacketSize(bool prefixPacketSize)
{
this->prefixPacketSize = prefixPacketSize ;
}
bool WireFormatInfo::getTightEncodingEnabled()
{
return tightEncodingEnabled ;
}
void WireFormatInfo::setTightEncodingEnabled(bool tightEncodingEnabled)
{
this->tightEncodingEnabled = tightEncodingEnabled ;
}

View File

@ -1,99 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef WireFormatInfo_hpp_
#define WireFormatInfo_hpp_
#include <string>
#include "command/AbstractCommand.hpp"
#include "util/ifr/ap.hpp"
#include "util/ifr/p.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
namespace command
{
using namespace ifr::v1;
using namespace std;
using namespace apache::activemq::client;
/*
*
* Marshalling code for Open Wire Format for WireFormatInfo
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
class WireFormatInfo : public AbstractCommand
{
private:
ap<char> magic ;
int version ;
bool cacheEnabled ;
bool stackTraceEnabled ;
bool tcpNoDelayEnabled ;
bool prefixPacketSize ;
bool tightEncodingEnabled ;
public:
const static int TYPE = 1;
public:
WireFormatInfo() ;
virtual ~WireFormatInfo() ;
virtual int getCommandType() ;
virtual ap<char> getMagic() ;
virtual void setMagic(ap<char> magic) ;
virtual int getVersion() ;
virtual void setVersion(int version) ;
virtual bool getCacheEnabled() ;
virtual void setCacheEnabled(bool cacheEnabled) ;
virtual bool getStackTraceEnabled() ;
virtual void setStackTraceEnabled(bool stackTraceEnabled) ;
virtual bool getTcpNoDelayEnabled() ;
virtual void setTcpNoDelayEnabled(bool tcpNoDelayEnabled) ;
virtual bool getPrefixPacketSize() ;
virtual void setPrefixPacketSize(bool prefixPacketSize) ;
virtual bool getTightEncodingEnabled() ;
virtual void setTightEncodingEnabled(bool tightEncodingEnabled) ;
} ;
/* namespace */
}
}
}
}
#endif /*WireFormatInfo_hpp_*/

View File

@ -1 +0,0 @@
/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef XATransactionId_hpp_ #define XATransactionId_hpp_ #include <string> #include "command/TransactionId.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for XATransactionId * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class XATransactionId : public TransactionId { private: int formatId ; ap<char> globalTransactionId ; ap<char> branchQualifier ; public: const static int TYPE = 112; public: XATransactionId() ; virtual ~XATransactionId() ; virtual int getCommandType() ; virtual int getFormatId() ; virtual void setFormatId(int formatId) ; virtual ap<char> getGlobalTransactionId() ; virtual void setGlobalTransactionId(ap<char> globalTransactionId) ; virtual ap<char> getBranchQualifier() ; virtual void setBranchQualifier(ap<char> branchQualifier) ; } ; /* namespace */ } } } } #endif /*XATransactionId_hpp_*/

View File

@ -1,83 +0,0 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "io/SocketBinaryWriter.hpp"
using namespace apache::activemq::client::io;
/*
*
*/
SocketBinaryWriter::SocketBinaryWriter(apr_socket_t* socket)
{
this->socket = socket ;
}
/*
*
*/
SocketBinaryWriter::~SocketBinaryWriter()
{
// no-op
}
void SocketBinaryWriter::close() throw(IOException)
{
// no-op
}
void SocketBinaryWriter::flush() throw(IOException)
{
// no-op
}
/*
*
*/
int SocketBinaryWriter::write(char* buffer, int size) throw(IOException)
{
apr_size_t length, remaining = size ;
apr_status_t rc ;
// Loop until requested number of bytes are read
while( remaining > 0 )
{
// Try to read remaining bytes
length = remaining ;
// Write some bytes to socket
rc = apr_socket_send(socket, buffer, &length) ;
// Adjust buffer pointer and remaining number of bytes
buffer += length ;
remaining -= length ;
// Exit on any error
if( rc != APR_SUCCESS )
{
string message ;
char buf[10] ;
// Construct error message
message.assign("Failed to write to socket. Code = ") ;
sprintf(buf, "%d", rc );
message.append( buf ) ;
throw IOException(__FILE__, __LINE__, message.c_str()) ;
}
}
return (int)size ;
}

View File

@ -1,45 +1,31 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#ifndef IDataStructure_hpp_ #ifndef ActiveMQ_AcknowledgementMode_hpp_
#define IDataStructure_hpp_ #define ActiveMQ_AcknowledgementMode_hpp_
namespace apache namespace apache
{ {
namespace activemq namespace activemq
{ {
namespace client enum AcknowledgementMode {
{ UnknownAckMode, AutoAckMode, ClientAckMode, TransactionalAckMode
namespace command };
{ }
}
/*
* Mockup interface for writing to streams. #endif /*ActiveMQ_AcknowledgementMode_hpp_*/
*/
class IDataStructure
{
public:
virtual ~IDataStructure(){}
virtual int getCommandType() = 0 ;
} ;
/* namespace */
}
}
}
}
#endif /*IDataStructure_hpp_*/

View File

@ -1,46 +1,48 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "BrokerException.hpp" #include "activemq/BrokerException.hpp"
using namespace apache::activemq::client; using namespace apache::activemq;
/* /*
* *
*/ */
BrokerException::BrokerException(p<BrokerError> cause) BrokerException::BrokerException(p<BrokerError> brokerError)
: OpenWireException("") // TODO: Add trace {
{ this->brokerError = brokerError ;
string message ;
// Build exception message
brokerError = cause ; msg.assign( brokerError->getExceptionClass()->c_str() ) ;
msg.append( " : " ) ;
// Build exception message msg.append( brokerError->getMessage()->c_str() ) ;
message.assign("The operation failed: Type: ") ; }
message.append( cause->getExceptionClass()->c_str() ) ;
message.append(" stack: ") ; /*
message.append( cause->getStackTrace()->c_str() ) ; *
} */
p<BrokerError> BrokerException::getBrokerError()
BrokerException::~BrokerException() throw() {
{ return brokerError ;
// no-op }
}
/*
p<BrokerError> BrokerException::getCause() *
{ */
return brokerError ; p<string> BrokerException::getJavaStackTrace()
} {
return brokerError->getStackTrace() ;
}

View File

@ -1,58 +1,54 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#ifndef FutureResponse_hpp_ #ifndef ActiveMQ_BrokerException_hpp_
#define FutureResponse_hpp_ #define ActiveMQ_BrokerException_hpp_
#include <string> #include <string>
#include "command/Response.hpp" #include "activemq/command/BrokerError.hpp"
#include "util/ifr/p.hpp" #include "cms/CmsException.hpp"
#include "ppr/util/ifr/p"
namespace apache
{ namespace apache
namespace activemq {
{ namespace activemq
namespace client {
{ using namespace std;
using namespace ifr::v1; using namespace ifr;
using namespace apache::activemq::client::command; using namespace apache::cms;
using namespace apache::activemq::command;
/*
* Interface for commands. /*
*/ *
class FutureResponse */
{ class BrokerException : public CmsException
private: {
p<Response> response ; private:
bool complete ; p<BrokerError> brokerError ;
public: public:
FutureResponse() ; BrokerException(p<BrokerError> brokerError) ;
virtual ~FutureResponse() ; virtual ~BrokerException() throw() {}
virtual p<Response> getResponse() ; virtual p<BrokerError> getBrokerError() ;
virtual void setResponse(p<Response> response) ; virtual p<string> getJavaStackTrace() ;
virtual bool isCompleted() ; };
// TODO: add notify/wait /* namespace */
} ; }
}
/* namespace */
} #endif /*ActiveMQ_BrokerException_hpp_*/
}
}
#endif /*FutureResponse_hpp_*/

View File

@ -0,0 +1,382 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "activemq/Connection.hpp"
#include "activemq/Session.hpp"
using namespace apache::activemq;
// --- Constructors -------------------------------------------------
/*
*
*/
Connection::Connection(p<ITransport> transport, p<ConnectionInfo> connectionInfo)
{
this->transport = transport ;
this->connectionInfo = connectionInfo ;
this->acknowledgementMode = AutoAckMode ;
this->connected = false ;
this->closed = false ;
this->brokerInfo = NULL ;
this->brokerWireFormat = NULL ;
this->sessionCounter = 0 ;
this->tempDestinationCounter = 0 ;
this->localTransactionCounter = 0 ;
// Hook up as a command listener and start dispatching
transport->setCommandListener(smartify(this)) ;
transport->start() ;
}
/*
*
*/
Connection::~Connection()
{
// Make sure connection is closed
close() ;
}
// --- Attribute methods --------------------------------------------
/*
*
*/
void Connection::setExceptionListener(p<IExceptionListener> listener)
{
this->listener = listener ;
}
/*
*
*/
p<IExceptionListener> Connection::getExceptionListener()
{
return listener ;
}
/*
*
*/
p<ITransport> Connection::getTransport()
{
return transport ;
}
/*
*
*/
void Connection::setTransport(p<ITransport> transport)
{
this->transport = transport ;
}
/*
*
*/
p<string> Connection::getClientId()
{
return connectionInfo->getClientId() ;
}
/*
*
*/
void Connection::setClientId(const char* value) throw (CmsException)
{
if( connected )
throw CmsException("You cannot change the client id once a connection is established") ;
p<string> clientId = new string(value) ;
connectionInfo->setClientId( clientId ) ;
}
/*
*
*/
p<BrokerInfo> Connection::getBrokerInfo()
{
return brokerInfo ;
}
/*
*
*/
p<WireFormatInfo> Connection::getBrokerWireFormat()
{
return brokerWireFormat ;
}
/*
*
*/
AcknowledgementMode Connection::getAcknowledgementMode()
{
return acknowledgementMode ;
}
/*
*
*/
void Connection::setAcknowledgementMode(AcknowledgementMode ackMode)
{
acknowledgementMode = ackMode ;
}
/*
*
*/
p<ConnectionId> Connection::getConnectionId()
{
return connectionInfo->getConnectionId() ;
}
// --- Operation methods --------------------------------------------
/*
*
*/
void Connection::close()
{
if( !closed )
{
list< p<ISession> >::iterator sessionIter ;
// Iterate through all sessions and close them down
for( sessionIter = sessions.begin() ;
sessionIter != sessions.end() ;
sessionIter++ )
{
(*sessionIter)->close() ;
}
// Empty session list
sessions.clear() ;
// Remove connection from broker
disposeOf( getConnectionId() ) ;
// Finally, transmit a shutdown command to broker
transport->oneway( new ShutdownInfo() ) ;
closed = true ;
}
}
/*
*
*/
p<ISession> Connection::createSession() throw(CmsException)
{
return createSession(acknowledgementMode) ;
}
/*
*
*/
p<ISession> Connection::createSession(AcknowledgementMode ackMode) throw(CmsException)
{
p<SessionInfo> sessionInfo = createSessionInfo( ackMode ) ;
// Send session info to broker
syncRequest(sessionInfo) ;
p<ISession> session = new Session(smartify(this), sessionInfo, ackMode) ;
sessions.push_back(session) ;
return session ;
}
/*
* Performs a synchronous request-response with the broker.
*/
p<Response> Connection::syncRequest(p<ICommand> command) throw(CmsException)
{
checkConnected() ;
p<Response> response = transport->request(command) ;
if( response->getDataStructureType() == ExceptionResponse::TYPE )
{
p<ExceptionResponse> exceptionResponse = p_cast<ExceptionResponse> (response) ;
p<BrokerError> brokerError = exceptionResponse->getException() ;
string message ;
// Build error message
message.assign("Request failed: ") ;
message.append( brokerError->getExceptionClass()->c_str() ) ;
message.append(", ") ;
message.append( brokerError->getStackTrace()->c_str() ) ;
// TODO: Change to CMSException()
throw CmsException( message.c_str() ) ;
}
return response ;
}
/*
*
*/
void Connection::oneway(p<ICommand> command) throw(CmsException)
{
checkConnected() ;
transport->oneway(command) ;
}
/*
*
*/
void Connection::disposeOf(p<IDataStructure> dataStructure) throw(CmsException)
{
p<RemoveInfo> command = new RemoveInfo() ;
command->setObjectId( dataStructure ) ;
syncRequest(command) ;
}
/*
* Creates a new temporary destination name.
*/
p<string> Connection::createTemporaryDestinationName()
{
p<string> name = new string() ;
char* buffer = new char[15] ;
{
LOCKED_SCOPE( mutex );
name->assign( connectionInfo->getConnectionId()->getValue()->c_str() ) ;
name->append( ":" ) ;
#ifdef unix
sprintf(buffer, "%lld", ++tempDestinationCounter) ;
#else
sprintf(buffer, "%I64d", ++tempDestinationCounter) ;
#endif
name->append( buffer ) ;
}
return name ;
}
/*
* Creates a new local transaction ID.
*/
p<LocalTransactionId> Connection::createLocalTransactionId()
{
p<LocalTransactionId> id = new LocalTransactionId() ;
id->setConnectionId( getConnectionId() ) ;
{
LOCKED_SCOPE (mutex);
id->setValue( ++localTransactionCounter ) ;
}
return id ;
}
// --- Implementation methods ---------------------------------------
/*
*
*/
p<SessionInfo> Connection::createSessionInfo(AcknowledgementMode ackMode)
{
p<SessionInfo> sessionInfo = new SessionInfo() ;
p<SessionId> sessionId = new SessionId() ;
sessionId->setConnectionId ( connectionInfo->getConnectionId()->getValue() ) ;
{
LOCKED_SCOPE( mutex );
sessionId->setValue( ++sessionCounter ) ;
}
sessionInfo->setSessionId( sessionId ) ;
return sessionInfo ;
}
/*
*
*/
void Connection::checkConnected() throw(CmsException)
{
if( closed )
throw ConnectionClosedException("Oops! Connection already closed.") ;
if( !connected )
{
connected = true ;
// Send the connection info and see if we get an ack/nak
syncRequest( connectionInfo ) ;
}
}
/*
* Handle incoming commands.
*/
void Connection::onCommand(p<ITransport> transport, p<ICommand> command)
{
if( command->getDataStructureType() == MessageDispatch::TYPE )
{
p<MessageDispatch> dispatch = p_cast<MessageDispatch> (command) ;
p<ConsumerId> consumerId = dispatch->getConsumerId() ;
p<MessageConsumer> consumer = NULL ;
list< p<ISession> >::const_iterator tempIter ;
// Iterate through all sessions and check if one has the consumer
for( tempIter = sessions.begin() ;
tempIter != sessions.end() ;
tempIter++ )
{
consumer = p_cast<Session> (*tempIter)->getConsumer(consumerId) ;
// Found a match?
if( consumer != NULL )
break ;
}
if( consumer == NULL )
cout << "ERROR: No such consumer active: " << consumerId->getValue() << endl ;
else
{
p<ActiveMQMessage> message = p_cast<ActiveMQMessage> (dispatch->getMessage()) ;
consumer->dispatch(message) ;
}
}
else if( command->getDataStructureType() == WireFormatInfo::TYPE )
this->brokerWireFormat = p_cast<WireFormatInfo> (command) ;
else if( command->getDataStructureType() == BrokerInfo::TYPE )
this->brokerInfo = p_cast<BrokerInfo> (command) ;
else
cout << "ERROR: Unknown command: " << command->getDataStructureType() << endl ;
}
/*
* Handle incoming broker errors.
*/
void Connection::onError(p<ITransport> transport, exception& error)
{
if( listener != NULL )
this->listener->onException(error) ;
else
cout << "ERROR: Received a broker exception: " << error.what() << endl ;
}

View File

@ -0,0 +1,124 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQ_Connection_hpp_
#define ActiveMQ_Connection_hpp_
#include <iostream>
#include <list>
#include <string>
#include <map>
#include "cms/ISession.hpp"
#include "cms/IConnection.hpp"
#include "cms/IExceptionListener.hpp"
#include "cms/CmsException.hpp"
#include "activemq/ConnectionClosedException.hpp"
#include "activemq/MessageConsumer.hpp"
#include "activemq/command/BrokerInfo.hpp"
#include "activemq/command/WireFormatInfo.hpp"
#include "activemq/command/ExceptionResponse.hpp"
#include "activemq/command/ConnectionInfo.hpp"
#include "activemq/command/LocalTransactionId.hpp"
#include "activemq/command/MessageDispatch.hpp"
#include "activemq/command/SessionInfo.hpp"
#include "activemq/command/SessionId.hpp"
#include "activemq/command/ShutdownInfo.hpp"
#include "activemq/transport/ITransport.hpp"
#include "activemq/transport/ICommandListener.hpp"
#include "ppr/thread/SimpleMutex.hpp"
#include "ppr/util/ifr/p"
// Turn off warning message for ignored exception specification
#ifdef _MSC_VER
#pragma warning( disable : 4290 )
#endif
namespace apache
{
namespace activemq
{
using namespace std;
using namespace ifr;
using namespace apache::cms;
using namespace apache::activemq::command;
using namespace apache::activemq::transport;
using namespace apache::ppr::thread;
using namespace apache::ppr::util;
/*
*
*/
class Connection : public IConnection, public ICommandListener
{
private:
p<ConnectionInfo> connectionInfo ;
p<ITransport> transport ;
p<BrokerInfo> brokerInfo ; // from MQ broker
p<WireFormatInfo> brokerWireFormat ; // from MQ broker
p<IExceptionListener> listener ;
list< p<ISession> > sessions ;
bool connected,
closed ;
AcknowledgementMode acknowledgementMode ;
long long sessionCounter,
tempDestinationCounter,
localTransactionCounter ;
SimpleMutex mutex ;
public:
// Constructors
Connection(p<ITransport> transport, p<ConnectionInfo> connectionInfo) ;
virtual ~Connection() ;
// Attribute methods
virtual void setExceptionListener(p<IExceptionListener> listener) ;
virtual p<IExceptionListener> getExceptionListener() ;
virtual p<ITransport> getTransport() ;
virtual void setTransport(p<ITransport> transport) ;
virtual p<string> getClientId() ;
virtual void setClientId(const char* value) throw (CmsException) ;
virtual p<BrokerInfo> getBrokerInfo() ;
virtual p<WireFormatInfo> getBrokerWireFormat() ;
virtual AcknowledgementMode getAcknowledgementMode() ;
virtual void setAcknowledgementMode(AcknowledgementMode mode) ;
// virtual void addConsumer(p<ConsumerId> consumerId, p<MessageConsumer> messageConsumer) ;
// virtual void removeConsumer(p<ConsumerId> consumerId) ;
virtual p<ConnectionId> getConnectionId() ;
// Operation methods
virtual p<ISession> createSession() throw(CmsException) ;
virtual p<ISession> createSession(AcknowledgementMode mode) throw(CmsException) ;
virtual p<Response> syncRequest(p<ICommand> command) throw(CmsException) ;
virtual void oneway(p<ICommand> command) throw(CmsException) ;
virtual void disposeOf(p<IDataStructure> dataStructure) throw(CmsException) ;
virtual p<string> createTemporaryDestinationName() ;
virtual p<LocalTransactionId> createLocalTransactionId() ;
virtual void close() ;
protected:
// Implementation methods
p<SessionInfo> createSessionInfo(AcknowledgementMode mode) ;
void checkConnected() throw(CmsException) ;
void onCommand(p<ITransport> transport, p<ICommand> command) ;
void onError(p<ITransport> transport, exception& error) ;
} ;
/* namespace */
}
}
#endif /*ActiveMQ_Connection_hpp_*/

View File

@ -1,33 +1,29 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "ConnectionClosedException.hpp" #include "activemq/ConnectionClosedException.hpp"
using namespace apache::activemq::client; using namespace apache::activemq;
/* /*
* *
*/ */
ConnectionClosedException::ConnectionClosedException(const char* message) ConnectionClosedException::ConnectionClosedException(const char* message)
: OpenWireException(message) : CmsException(message)
{ {
// no-op // no-op
} }
ConnectionClosedException::~ConnectionClosedException() throw()
{
// no-op
}

View File

@ -1,44 +1,41 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#ifndef ConnectionClosedException_hpp_ #ifndef ActiveMQ_ConnectionClosedException_hpp_
#define ConnectionClosedException_hpp_ #define ActiveMQ_ConnectionClosedException_hpp_
#include "OpenWireException.hpp" #include "cms/CmsException.hpp"
namespace apache namespace apache
{ {
namespace activemq namespace activemq
{ {
namespace client using namespace apache::cms;
{
/*
/* * Signals that a connection is being used when it is already closed.
* */
*/ class ConnectionClosedException : public CmsException
class ConnectionClosedException : public OpenWireException {
{ public:
public: ConnectionClosedException(const char* message) ;
ConnectionClosedException(const char* message) ; };
virtual ~ConnectionClosedException() throw();
}; /* namespace */
}
/* namespace */ }
}
} #endif /*ActiveMQ_ConnectionClosedException_hpp_*/
}
#endif /*ConnectionClosedException_hpp_*/

View File

@ -14,36 +14,34 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#ifndef MessageNotReadableException_hpp_ #ifndef ActiveMQ_ConnectionException_hpp_
#define MessageNotReadableException_hpp_ #define ActiveMQ_ConnectionException_hpp_
#include "TraceException.hpp" #include "ppr/TraceException.hpp"
namespace apache namespace apache
{ {
namespace activemq namespace activemq
{ {
namespace client using namespace std ;
{ using namespace apache::ppr;
using namespace std ;
/* /*
* Signals that a message is in read-only mode. * Signals that a connection error has occured.
*/ */
class MessageNotReadableException : public TraceException class ConnectionException : public TraceException
{ {
public: public:
MessageNotReadableException() : TraceException() ConnectionException() : TraceException()
{ /* no-op */ } ; { /* no-op */ } ;
MessageNotReadableException(const char *const& msg) : TraceException(msg) ConnectionException(const char *const& msg) : TraceException(msg)
{ /* no-op */ } ; { /* no-op */ } ;
MessageNotReadableException(const char* fileName, int lineNo, const char* msg) : TraceException(msg) ConnectionException(const char* fileName, int lineNo, const char* msg) : TraceException(msg)
{ /* no-op */ } ; { /* no-op */ } ;
} ; } ;
/* namespace */ /* namespace */
}
} }
} }
#endif /*MessageNotReadableException_hpp_*/ #endif /*ActiveMQ_ConnectionException_hpp_*/

View File

@ -1,201 +1,184 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "ConnectionFactory.hpp" #include "activemq/ConnectionFactory.hpp"
#include "Connection.hpp" #include "activemq/Connection.hpp"
#include "activemq/protocol/openwire/OpenWireProtocol.hpp"
using namespace apache::activemq::client; #include "activemq/transport/tcp/TcpTransport.hpp"
/* using namespace apache::activemq;
*
*/ /*
ConnectionFactory::ConnectionFactory() *
{ */
host = new string() ; ConnectionFactory::ConnectionFactory()
host->assign("localhost") ; {
port = 61616 ; // Use default URI
username = new string() ; brokerUri = new Uri ("tcp://localhost:61616?wireFormat=openwire") ;
password = new string() ; username = NULL ;
clientId = new string() ; password = NULL ;
} clientId = Guid::getGuidString() ;
transportFactory = new TransportFactory() ;
/* }
*
*/ /*
ConnectionFactory::ConnectionFactory(const char* host, int port) *
{ */
this->host = new string() ; ConnectionFactory::ConnectionFactory(p<Uri> brokerUri)
this->host->assign(host) ; {
this->port = port ; this->brokerUri = brokerUri;
username = new string() ; username = NULL ;
password = new string() ; password = NULL ;
clientId = new string() ; clientId = Guid::getGuidString() ;
} transportFactory = new TransportFactory() ;
}
/*
*
*/ // --- Attribute methods --------------------------------------------
ConnectionFactory::~ConnectionFactory()
{ /*
} *
*/
p<Uri> ConnectionFactory::getBrokerUri()
// --- Attribute methods -------------------------------------------- {
return brokerUri ;
/* }
*
*/ /*
p<string> ConnectionFactory::getHost() *
{ */
return host ; void ConnectionFactory::setBrokerUri(p<Uri> brokerUri)
} {
this->brokerUri = brokerUri ;
/* }
*
*/ /*
void ConnectionFactory::setHost(const char* host) *
{ */
this->host->assign(host) ; p<string> ConnectionFactory::getUsername()
} {
return username ;
/* }
*
*/ /*
int ConnectionFactory::getPort() *
{ */
return port ; void ConnectionFactory::setUsername(const char* username)
} {
this->username = new string(username) ;
/* }
*
*/ /*
void ConnectionFactory::setPort(int port) *
{ */
port = port ; p<string> ConnectionFactory::getPassword()
} {
return password ;
/* }
*
*/ /*
p<string> ConnectionFactory::getUsername() *
{ */
return username ; void ConnectionFactory::setPassword(const char* password)
} {
this->password = new string(password);
/*
* }
*/
void ConnectionFactory::setUsername(const char* username) /*
{ *
this->username->assign(username) ; */
} p<string> ConnectionFactory::getClientId()
{
/* return clientId ;
* }
*/
p<string> ConnectionFactory::getPassword() /*
{ *
return password ; */
} void ConnectionFactory::setClientId(const char* clientId)
{
/* this->clientId = new string(clientId) ;
* }
*/
void ConnectionFactory::setPassword(const char* password)
{ // --- Operation methods --------------------------------------------
this->password->assign(password) ;
} /*
*
/* */
* p<IConnection> ConnectionFactory::createConnection() throw (ConnectionException)
*/ {
p<string> ConnectionFactory::getClientId() return createConnection( (username != NULL) ? username->c_str() : NULL,
{ (password != NULL) ? password->c_str() : NULL ) ;
return clientId ; }
}
/*
/* *
* */
*/ p<IConnection> ConnectionFactory::createConnection(const char* username, const char* password) throw (ConnectionException)
void ConnectionFactory::setClientId(const char* clientId) {
{ p<ConnectionInfo> connectionInfo ;
this->clientId->assign(clientId) ; p<ITransport> transport ;
} p<Connection> connection ;
// --- Operation methods -------------------------------------------- // Set up a new connection object
connectionInfo = createConnectionInfo(username, password) ;
/* transport = createTransport() ;
* connection = new Connection(transport, connectionInfo) ;
*/ connection->setClientId( clientId->c_str() ) ;
p<IConnection> ConnectionFactory::createConnection()
{ return connection ;
return createConnection(username->c_str(), password->c_str()) ; }
}
/* // --- Implementation methods ---------------------------------------
*
*/ /*
p<IConnection> ConnectionFactory::createConnection(const char* username, const char* password) *
{ */
p<ConnectionInfo> connectionInfo ; p<ConnectionInfo> ConnectionFactory::createConnectionInfo(const char* username, const char* password)
p<ITransport> transport ; {
p<Connection> connection ; p<ConnectionInfo> connectionInfo = new ConnectionInfo() ;
p<ConnectionId> connectionId = new ConnectionId() ;
// Set up a new connection object p<string> uid = (username != NULL) ? new string(username) : NULL ;
connectionInfo = createConnectionInfo(username, password) ; p<string> pwd = (password != NULL) ? new string(password) : NULL ;
transport = createTransport() ;
connection = new Connection(transport, connectionInfo) ; connectionId->setValue( Guid::getGuidString() ) ;
connection->setClientId( clientId->c_str() ) ; connectionInfo->setConnectionId( connectionId ) ;
connectionInfo->setUserName( uid ) ;
return connection ; connectionInfo->setPassword( pwd ) ;
} connectionInfo->setClientId( clientId ) ;
return connectionInfo ;
// --- Implementation methods --------------------------------------- }
/* /*
* *
*/ */
p<ConnectionInfo> ConnectionFactory::createConnectionInfo(const char* username, const char* password) p<ITransport> ConnectionFactory::createTransport() throw (ConnectionException)
{ {
p<ConnectionInfo> connectionInfo = new ConnectionInfo() ; try
p<ConnectionId> connectionId = new ConnectionId() ; {
// Create a transport for given URI
connectionId->setValue( createNewConnectionId()->c_str() ) ; return transportFactory->createTransport( brokerUri ) ;
connectionInfo->setConnectionId( connectionId ) ; }
connectionInfo->setUserName( username ) ; catch( SocketException se )
connectionInfo->setPassword( password ) ; {
throw ConnectionException(__FILE__, __LINE__, "Failed to connect socket") ;
return connectionInfo ; }
} }
/*
*
*/
p<string> ConnectionFactory::createNewConnectionId()
{
return Guid::getGuidString() ;
}
/*
*
*/
p<ITransport> ConnectionFactory::createTransport()
{
p<ITransport> transport = new SocketTransport(host->c_str(), port) ;
return transport ;
}

View File

@ -0,0 +1,88 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQ_ConnectionFactory_hpp_
#define ActiveMQ_ConnectionFactory_hpp_
// Must be included before any STL includes
#include "ppr/util/Guid.hpp"
#include <string>
#include "cms/IConnection.hpp"
#include "cms/IConnectionFactory.hpp"
#include "activemq/ConnectionException.hpp"
#include "activemq/command/ConnectionInfo.hpp"
#include "activemq/command/ConnectionId.hpp"
#include "activemq/protocol/IProtocol.hpp"
#include "activemq/transport/ITransport.hpp"
#include "activemq/transport/ITransportFactory.hpp"
#include "activemq/transport/TransportFactory.hpp"
#include "ppr/net/Uri.hpp"
#include "ppr/util/ifr/p"
namespace apache
{
namespace activemq
{
using namespace apache::activemq::command;
using namespace apache::activemq::protocol;
using namespace apache::activemq::transport;
using namespace apache::ppr::net;
using namespace ifr;
/*
*
*/
class ConnectionFactory : public IConnectionFactory
{
private:
p<Uri> brokerUri ;
p<string> username ;
p<string> password ;
p<string> clientId ;
p<IProtocol> protocol ;
p<ITransportFactory> transportFactory ;
public:
// Constructors
ConnectionFactory() ;
ConnectionFactory(p<Uri> uri) ;
// Attribute methods
virtual p<Uri> getBrokerUri() ;
virtual void setBrokerUri(p<Uri> brokerUri) ;
virtual p<string> getUsername() ;
virtual void setUsername(const char* username) ;
virtual p<string> getPassword() ;
virtual void setPassword(const char* password) ;
virtual p<string> getClientId() ;
virtual void setClientId(const char* clientId) ;
// Operation methods
virtual p<IConnection> createConnection() throw (ConnectionException) ;
virtual p<IConnection> createConnection(const char* username, const char* password) throw (ConnectionException) ;
protected:
// Implementation methods
virtual p<ConnectionInfo> createConnectionInfo(const char* username, const char* password) ;
virtual p<ITransport> createTransport() throw (ConnectionException) ;
} ;
/* namespace */
}
}
#endif /*ActiveMQ_ConnectionFactory_hpp_*/

View File

@ -1,33 +1,29 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "ConsumerClosedException.hpp" #include "activemq/ConsumerClosedException.hpp"
using namespace apache::activemq::client; using namespace apache::activemq;
/* /*
* *
*/ */
ConsumerClosedException::ConsumerClosedException(const char* message) ConsumerClosedException::ConsumerClosedException(const char* message)
: OpenWireException(message) : CmsException(message)
{ {
// no-op // no-op
} }
ConsumerClosedException::~ConsumerClosedException() throw()
{
// no-op
}

View File

@ -1,44 +1,41 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#ifndef ConsumerClosedException_hpp_ #ifndef ActiveMQ_ConsumerClosedException_hpp_
#define ConsumerClosedException_hpp_ #define ActiveMQ_ConsumerClosedException_hpp_
#include "OpenWireException.hpp" #include "cms/CmsException.hpp"
namespace apache namespace apache
{ {
namespace activemq namespace activemq
{ {
namespace client using namespace apache::cms;
{
/*
/* * Signals that a consumer is being used when it is already closed.
* */
*/ class ConsumerClosedException : public CmsException
class ConsumerClosedException : public OpenWireException {
{ public:
public: ConsumerClosedException(const char* message) ;
ConsumerClosedException(const char* message) ; };
virtual ~ConsumerClosedException() throw();
}; /* namespace */
}
/* namespace */ }
}
} #endif /*ActiveMQ_ConsumerClosedException_hpp_*/
}
#endif /*ConsumerClosedException_hpp_*/

View File

@ -1,41 +1,47 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "DestinationFilter.hpp" #include "activemq/DestinationFilter.hpp"
using namespace apache::activemq::client; using namespace apache::activemq;
// Init static constants // Init static constants
const char* DestinationFilter::ANY_DESCENDENT = ">" ; const char* DestinationFilter::ANY_DESCENDENT = ">" ;
const char* DestinationFilter::ANY_CHILD = "*" ; const char* DestinationFilter::ANY_CHILD = "*" ;
/* /*
* *
*/ */
DestinationFilter::DestinationFilter() DestinationFilter::DestinationFilter()
{ {
// no-op
} }
DestinationFilter::~DestinationFilter() /*
{ *
// no-op */
} DestinationFilter::~DestinationFilter()
{
bool DestinationFilter::matches(p<ActiveMQMessage> message) // no-op
{ }
return matches( message->getDestination() ) ;
} /*
*
*/
bool DestinationFilter::matches(p<ActiveMQMessage> message)
{
return matches( message->getDestination() ) ;
}

View File

@ -1,55 +1,52 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#ifndef DestinationFilter_hpp_ #ifndef ActiveMQ_DestinationFilter_hpp_
#define DestinationFilter_hpp_ #define ActiveMQ_DestinationFilter_hpp_
#include "command/ActiveMQMessage.hpp" #include "activemq/command/ActiveMQMessage.hpp"
#include "command/ActiveMQDestination.hpp" #include "activemq/command/ActiveMQDestination.hpp"
#include "util/ifr/p.hpp" #include "ppr/util/ifr/p"
namespace apache namespace apache
{ {
namespace activemq namespace activemq
{ {
namespace client using namespace ifr;
{ using namespace apache::activemq::command;
using namespace ifr::v1;
using namespace apache::activemq::client::command; /*
*
/* */
* class DestinationFilter
*/ {
class DestinationFilter public:
{ const static char* ANY_DESCENDENT ;
public: const static char* ANY_CHILD ;
const static char* ANY_DESCENDENT ;
const static char* ANY_CHILD ; public:
DestinationFilter() ;
public: virtual ~DestinationFilter() ;
DestinationFilter() ;
virtual ~DestinationFilter() ; virtual bool matches(p<ActiveMQMessage> message) ;
virtual bool matches(p<ActiveMQDestination> destination) = 0 ;
virtual bool matches(p<ActiveMQMessage> message) ; };
virtual bool matches(p<ActiveMQDestination> destination) = 0 ;
}; /* namespace */
}
/* namespace */ }
}
} #endif /*ActiveMQ_DestinationFilter_hpp_*/
}
#endif /*DestinationFilter_hpp_*/

View File

@ -0,0 +1,140 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "activemq/Dispatcher.hpp"
using namespace apache::activemq;
/*
*
*/
Dispatcher::Dispatcher()
{
dispatchQueue = new queue< p<IMessage> > ;
redeliverList = new list< p<IMessage> > ;
}
/*
*
*/
void Dispatcher::redeliverRolledBackMessages()
{
LOCKED_SCOPE (mutex);
p<queue< p<IMessage> > > replacementQueue = new queue< p<IMessage> > ;
//(dispatchQueue->size() + redeliverList->size() ) ;
// Copy all messages to be redelivered to the new queue
while( !redeliverList->empty() )
{
replacementQueue->push( redeliverList->front() ) ;
redeliverList->pop_front() ;
}
// Copy all messages to be dispatched to the new queue
while( dispatchQueue->size() > 0 )
{
// Get first element in queue
p<IMessage> element = p_cast<IMessage> (dispatchQueue->front()) ;
// Remove first element from queue
dispatchQueue->pop() ;
// Add element to the new queue
replacementQueue->push(element) ;
}
// Switch to the new queue
dispatchQueue = replacementQueue ;
semaphore.notify() ;
}
/*
*
*/
void Dispatcher::redeliver(p<IMessage> message)
{
LOCKED_SCOPE (mutex);
redeliverList->push_back(message) ;
}
/*
*
*/
void Dispatcher::enqueue(p<IMessage> message)
{
LOCKED_SCOPE (mutex);
dispatchQueue->push(message) ;
semaphore.notify() ;
}
/*
*
*/
p<IMessage> Dispatcher::dequeueNoWait()
{
p<IMessage> msg = NULL ;
{
LOCKED_SCOPE (mutex);
if( dispatchQueue->size() > 0 )
{
msg = p_cast<IMessage> (dispatchQueue->front()) ;
dispatchQueue->pop() ;
}
}
return msg ;
}
/*
*
*/
p<IMessage> Dispatcher::dequeue(int timeout)
{
p<IMessage> msg = NULL ;
{
LOCKED_SCOPE (mutex);
if( dispatchQueue->size() == 0 )
semaphore.wait(timeout) ;
if( dispatchQueue->size() > 0 )
{
msg = p_cast<IMessage> (dispatchQueue->front()) ;
dispatchQueue->pop() ;
}
}
return msg ;
}
/*
*
*/
p<IMessage> Dispatcher::dequeue()
{
p<IMessage> msg = NULL ;
{
LOCKED_SCOPE (mutex);
msg = p_cast<IMessage> (dispatchQueue->front()) ;
dispatchQueue->pop() ;
}
return msg ;
}

View File

@ -0,0 +1,65 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQ_Dispatcher_hpp_
#define ActiveMQ_Dispatcher_hpp_
#include <string>
#include <list>
#include <queue>
#include "cms/IMessage.hpp"
#include "activemq/command/Response.hpp"
#include "ppr/thread/SimpleMutex.hpp"
#include "ppr/thread/Semaphore.hpp"
#include "ppr/util/ifr/p"
namespace apache
{
namespace activemq
{
using namespace ifr;
using namespace apache::activemq::command;
using namespace apache::cms;
using namespace apache::ppr::thread;
/*
* Handles the multi-threaded dispatching between transport and consumers.
*/
class Dispatcher
{
private:
p<queue< p<IMessage> > > dispatchQueue ;
p<list< p<IMessage> > > redeliverList ;
SimpleMutex mutex ;
Semaphore semaphore ;
public:
Dispatcher() ;
virtual ~Dispatcher() {}
virtual void redeliverRolledBackMessages() ;
virtual void redeliver(p<IMessage> message) ;
virtual void enqueue(p<IMessage> message) ;
virtual p<IMessage> dequeueNoWait() ;
virtual p<IMessage> dequeue(int timeout) ;
virtual p<IMessage> dequeue() ;
} ;
/* namespace */
}
}
#endif /*ActiveMQ_Dispatcher_hpp_*/

View File

@ -0,0 +1,45 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQ_IAcknowledger_hpp_
#define ActiveMQ_IAcknowledger_hpp_
#include "ppr/util/ifr/p"
namespace apache
{
namespace activemq
{
namespace command
{
class ActiveMQMessage ;
}
using namespace ifr;
using namespace apache::activemq::command;
/*
* Interface for message acknowledgers.
*/
struct IAcknowledger : Interface
{
virtual void acknowledge(p<ActiveMQMessage> message) = 0 ;
} ;
/* namespace */
}
}
#endif /*ActiveMQ_IAcknowledger_hpp_*/

View File

@ -0,0 +1,42 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQ_ICommand_hpp_
#define ActiveMQ_ICommand_hpp_
#include "activemq/IDataStructure.hpp"
namespace apache
{
namespace activemq
{
/*
* An OpenWire command
*/
struct ICommand : IDataStructure
{
virtual int getCommandId() = 0;
virtual void setCommandId(int value) = 0;
virtual bool getResponseRequired() = 0;
virtual void setResponseRequired(bool value) = 0;
};
/* namespace */
}
}
#endif /*ActiveMQ_ICommand_hpp_*/

View File

@ -0,0 +1,51 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQ_IDataStructure_hpp_
#define ActiveMQ_IDataStructure_hpp_
#include "ppr/io/IOutputStream.hpp"
#include "ppr/io/IInputStream.hpp"
#include "ppr/util/ifr/p"
namespace apache
{
namespace activemq
{
namespace protocol
{
struct IMarshaller ;
}
using namespace ifr;
using namespace apache::activemq::protocol;
using namespace apache::ppr::io;
/*
* An OpenWire data structure.
*/
struct IDataStructure : Interface
{
virtual unsigned char getDataStructureType() = 0 ;
virtual bool isMarshallAware() = 0 ;
virtual int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) = 0 ;
virtual void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) = 0 ;
} ;
/* namespace */
}
}
#endif /*ActiveMQ_IDataStructure_hpp_*/

View File

@ -0,0 +1,47 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQ_ISynchronization_hpp_
#define ActiveMQ_ISynchronization_hpp_
#include "ppr/util/ifr/p"
namespace apache
{
namespace activemq
{
using namespace ifr;
/*
*
*/
struct ISynchronization : Interface
{
// Called before a commit
virtual void beforeCommit() = 0 ;
// Called after a commit
virtual void afterCommit() = 0 ;
// Called after a transaction rollback
virtual void afterRollback() = 0 ;
} ;
/* namespace */
}
}
#endif /*ActiveMQ_ISynchronization_hpp_*/

View File

@ -0,0 +1,33 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQ_MessageAckType_hpp_
#define ActiveMQ_MessageAckType_hpp_
namespace apache
{
namespace activemq
{
enum MessageAckType
{
DeliveredAck = 0,
PoisonAck = 1,
ConsumedAck = 2
} ;
}
}
#endif /*ActiveMQ_MessageAckType_hpp_*/

View File

@ -0,0 +1,307 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "activemq/MessageConsumer.hpp"
#include "activemq/Session.hpp"
using namespace apache::activemq;
/*
*
*/
MessageConsumer::MessageConsumer(p<Session> session, p<ConsumerInfo> consumerInfo, AcknowledgementMode acknowledgementMode)
{
this->session = session ;
this->consumerInfo = consumerInfo ;
this->acknowledgementMode = acknowledgementMode ;
this->dispatcher = new Dispatcher() ;
this->listener = NULL ;
this->closed = false ;
this->maximumRedeliveryCount = 10 ;
this->redeliveryTimeout = 500 ;
}
/*
*
*/
MessageConsumer::~MessageConsumer()
{
// Make sure consumer is closed
close() ;
}
// Attribute methods ------------------------------------------------
/*
*
*/
void MessageConsumer::setMessageListener(p<IMessageListener> listener)
{
this->listener = listener ;
}
/*
*
*/
p<IMessageListener> MessageConsumer::getMessageListener()
{
return listener ;
}
/*
*
*/
p<ConsumerId> MessageConsumer::getConsumerId()
{
return consumerInfo->getConsumerId() ;
}
/*
*
*/
void MessageConsumer::setMaximumRedeliveryCount(int count)
{
this->maximumRedeliveryCount = count ;
}
/*
*
*/
int MessageConsumer::getMaximumRedeliveryCount()
{
return maximumRedeliveryCount ;
}
/*
*
*/
void MessageConsumer::setRedeliveryTimeout(int timeout)
{
this->redeliveryTimeout = timeout ;
}
/*
*
*/
int MessageConsumer::getRedeliveryTimeout()
{
return redeliveryTimeout ;
}
// Operation methods ------------------------------------------------
/*
*
*/
p<IMessage> MessageConsumer::receive()
{
checkClosed() ;
return autoAcknowledge( dispatcher->dequeue() ) ;
}
/*
*
*/
p<IMessage> MessageConsumer::receive(int timeout)
{
checkClosed() ;
return autoAcknowledge( dispatcher->dequeue(timeout) ) ;
}
/*
*
*/
p<IMessage> MessageConsumer::receiveNoWait()
{
checkClosed() ;
return autoAcknowledge( dispatcher->dequeueNoWait() ) ;
}
/*
*
*/
void MessageConsumer::redeliverRolledBackMessages()
{
dispatcher->redeliverRolledBackMessages() ;
}
/*
* Transport callback that handles messages dispatching
*/
void MessageConsumer::dispatch(p<IMessage> message)
{
dispatcher->enqueue(message) ;
// Activate background dispatch thread if async listener is set up
if( listener != NULL )
session->dispatch() ;
}
/*
*
*/
void MessageConsumer::dispatchAsyncMessages()
{
while( listener != NULL )
{
p<IMessage> message = dispatcher->dequeueNoWait() ;
if( message != NULL )
{
listener->onMessage(message) ;
// Auto acknowledge message if selected
autoAcknowledge(message) ;
}
else
break ;
}
}
/*
* IAcknowledger callback method.
*/
void MessageConsumer::acknowledge(p<ActiveMQMessage> message)
{
doClientAcknowledge(message) ;
}
/*
*
*/
void MessageConsumer::close()
{
if( !closed )
{
closed = true ;
// De-register consumer from broker
session->getConnection()->disposeOf( consumerInfo->getConsumerId() ) ;
// Reset internal state (prevent cyclic references)
session = NULL ;
}
}
// Implementation methods ------------------------------------------------
/*
*
*/
void MessageConsumer::checkClosed() throw(CmsException)
{
if( closed )
throw ConnectionClosedException("Oops! Connection already closed") ;
}
/*
*
*/
p<IMessage> MessageConsumer::autoAcknowledge(p<IMessage> message)
{
try
{
// Is the message an ActiveMQMessage? (throws bad_cast otherwise)
p<ActiveMQMessage> activeMessage = p_dyncast<ActiveMQMessage> (message) ;
// Register the handler for client acknowledgment
activeMessage->setAcknowledger( smartify(this) ) ;
if( acknowledgementMode != ClientAckMode )
doAcknowledge(activeMessage) ;
}
catch( bad_cast& bc )
{
// ignore
}
return message ;
}
/*
*
*/
void MessageConsumer::doClientAcknowledge(p<ActiveMQMessage> message)
{
if( acknowledgementMode == ClientAckMode )
doAcknowledge(message);
}
/*
*
*/
void MessageConsumer::doAcknowledge(p<Message> message)
{
p<MessageAck> ack = createMessageAck(message) ;
//cout << "Sending Ack: " << ack->getAckType() << endl ;
session->getConnection()->syncRequest(ack) ;
}
/*
*
*/
p<MessageAck> MessageConsumer::createMessageAck(p<Message> message)
{
p<MessageAck> ack = new MessageAck() ;
// Set ack properties
ack->setAckType( ConsumedAck ) ;
ack->setConsumerId( consumerInfo->getConsumerId() ) ;
ack->setDestination( message->getDestination() ) ;
ack->setFirstMessageId( message->getMessageId() ) ;
ack->setLastMessageId( message->getMessageId() ) ;
ack->setMessageCount( 1 ) ;
if( session->isTransacted() )
{
session->doStartTransaction() ;
ack->setTransactionId( session->getTransactionContext()->getTransactionId() ) ;
session->getTransactionContext()->addSynchronization( new MessageConsumerSynchronization(smartify(this), message) ) ;
}
return ack ;
}
/*
*
*/
void MessageConsumer::afterRollback(p<ActiveMQMessage> message)
{
// Try redeliver of the message again
message->setRedeliveryCounter( message->getRedeliveryCounter() + 1 ) ;
// Check if redeliver count has exceeded maximum
if( message->getRedeliveryCounter() > maximumRedeliveryCount )
{
// Send back a poisoned pill
p<MessageAck> ack = new MessageAck() ;
ack->setAckType( PoisonAck ) ;
ack->setConsumerId( consumerInfo->getConsumerId() ) ;
ack->setDestination( message->getDestination() ) ;
ack->setFirstMessageId( message->getMessageId() ) ;
ack->setLastMessageId( message->getMessageId() ) ;
ack->setMessageCount( 1 ) ;
session->getConnection()->oneway(ack) ;
}
else
{
dispatcher->redeliver(message) ;
// Re-dispatch the message at some point in the future
if( listener != NULL )
session->dispatch( redeliveryTimeout ) ;
}
}

View File

@ -0,0 +1,102 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQ_MessageConsumer_hpp_
#define ActiveMQ_MessageConsumer_hpp_
#include <string>
#include "cms/IDestination.hpp"
#include "cms/IMessage.hpp"
#include "cms/IMessageConsumer.hpp"
#include "cms/IMessageListener.hpp"
#include "cms/CmsException.hpp"
#include "activemq/AcknowledgementMode.hpp"
#include "activemq/MessageAckType.hpp"
#include "activemq/Dispatcher.hpp"
#include "activemq/IAcknowledger.hpp"
#include "activemq/MessageConsumerSynchronization.hpp"
#include "activemq/ConnectionClosedException.hpp"
#include "activemq/command/ConsumerInfo.hpp"
#include "activemq/command/Message.hpp"
#include "activemq/command/ActiveMQMessage.hpp"
#include "activemq/command/MessageAck.hpp"
#include "ppr/util/ifr/p"
#include "ppr/thread/Thread.hpp"
// Turn off warning message for ignored exception specification
#ifdef _MSC_VER
#pragma warning( disable : 4290 )
#endif
namespace apache
{
namespace activemq
{
using namespace ifr;
using namespace apache::cms;
using namespace apache::ppr::thread;
class Session ;
/*
*
*/
class MessageConsumer : public IMessageConsumer, public IAcknowledger
{
private:
p<Session> session ;
p<ConsumerInfo> consumerInfo ;
p<Dispatcher> dispatcher ;
p<IMessageListener> listener ;
AcknowledgementMode acknowledgementMode ;
bool closed ;
int maximumRedeliveryCount,
redeliveryTimeout ;
public:
MessageConsumer(p<Session> session, p<ConsumerInfo> consumerInfo, AcknowledgementMode acknowledgementMode) ;
virtual ~MessageConsumer() ;
virtual void setMessageListener(p<IMessageListener> listener) ;
virtual p<IMessageListener> getMessageListener() ;
virtual p<ConsumerId> getConsumerId() ;
virtual void setMaximumRedeliveryCount(int count) ;
virtual int getMaximumRedeliveryCount() ;
virtual void setRedeliveryTimeout(int timeout) ;
virtual int getRedeliveryTimeout() ;
virtual p<IMessage> receive() ;
virtual p<IMessage> receive(int timeout) ;
virtual p<IMessage> receiveNoWait() ;
virtual void redeliverRolledBackMessages() ;
virtual void dispatch(p<IMessage> message) ;
virtual void dispatchAsyncMessages() ;
virtual void afterRollback(p<ActiveMQMessage> message) ;
virtual void acknowledge(p<ActiveMQMessage> message) ;
virtual void close() ;
protected:
void checkClosed() throw(CmsException) ;
p<IMessage> autoAcknowledge(p<IMessage> message) ;
void doClientAcknowledge(p<ActiveMQMessage> message) ;
void doAcknowledge(p<Message> message) ;
p<MessageAck> createMessageAck(p<Message> message) ;
} ;
/* namespace */
}
}
#endif /*ActiveMQ_IMessageConsumer_hpp_*/

View File

@ -0,0 +1,60 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "activemq/MessageConsumerSynchronization.hpp"
#include "activemq/MessageConsumer.hpp"
using namespace apache::activemq;
/*
*
*/
MessageConsumerSynchronization::MessageConsumerSynchronization(p<MessageConsumer> consumer, p<Message> message)
{
this->consumer = consumer ;
this->message = message ;
}
/*
*
*/
MessageConsumerSynchronization::~MessageConsumerSynchronization()
{
}
/*
*
*/
void MessageConsumerSynchronization::beforeCommit()
{
// no-op
}
/*
*
*/
void MessageConsumerSynchronization::afterCommit()
{
// no-op
}
/*
*
*/
void MessageConsumerSynchronization::afterRollback()
{
consumer->afterRollback( p_cast<ActiveMQMessage> (message)) ;
}

View File

@ -0,0 +1,54 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQ_MessageConsumerSynchronization_hpp_
#define ActiveMQ_MessageConsumerSynchronization_hpp_
#include "activemq/ISynchronization.hpp"
#include "activemq/command/ActiveMQMessage.hpp"
#include "activemq/command/Message.hpp"
#include "ppr/util/ifr/p"
namespace apache
{
namespace activemq
{
using namespace ifr;
class MessageConsumer;
/*
*
*/
class MessageConsumerSynchronization : public ISynchronization
{
private:
p<MessageConsumer> consumer ;
p<Message> message ;
public:
MessageConsumerSynchronization(p<MessageConsumer> consumer, p<Message> message) ;
~MessageConsumerSynchronization() ;
virtual void beforeCommit() ;
virtual void afterCommit() ;
virtual void afterRollback() ;
} ;
/* namespace */
}
}
#endif /*ActiveMQ_MessageConsumerSynchronization_hpp_*/

View File

@ -0,0 +1,179 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "activemq/MessageProducer.hpp"
#include "activemq/Session.hpp"
using namespace apache::activemq;
// Constructors -----------------------------------------------------
/*
*
*/
MessageProducer::MessageProducer(p<Session> session, p<ProducerInfo> producerInfo)
{
this->session = session ;
this->producerInfo = producerInfo ;
this->priority = DEFAULT_PRIORITY ;
this->timeToLive = DEFAULT_TIMETOLIVE ;
this->messageCounter = 0 ;
this->persistent = false ;
this->disableMessageID = false ;
this->disableMessageTimestamp = false ;
this->closed = false ;
}
/*
*
*/
MessageProducer::~MessageProducer()
{
// Make sure the producer is closed
close() ;
}
// Attribute methods ------------------------------------------------
bool MessageProducer::getPersistent()
{
return persistent ;
}
void MessageProducer::setPersistent(bool persistent)
{
this->persistent = persistent ;
}
long long MessageProducer::getTimeToLive()
{
return timeToLive ;
}
void MessageProducer::getTimeToLive(long long ttl)
{
this->timeToLive = ttl ;
}
int MessageProducer::getPriority()
{
return priority ;
}
void MessageProducer::getPriority(int priority)
{
this->priority = priority ;
}
bool MessageProducer::getDisableMessageID()
{
return disableMessageID ;
}
void MessageProducer::getDisableMessageID(bool disable)
{
this->disableMessageID = disable ;
}
bool MessageProducer::getDisableMessageTimestamp()
{
return disableMessageTimestamp ;
}
void MessageProducer::getDisableMessageTimestamp(bool disable)
{
this->disableMessageTimestamp = disable ;
}
// Operation methods ------------------------------------------------
/*
*
*/
void MessageProducer::send(p<IMessage> message)
{
send(producerInfo->getDestination(), message, DEFAULT_PRIORITY, DEFAULT_TIMETOLIVE) ;
}
/*
*
*/
void MessageProducer::send(p<IDestination> destination, p<IMessage> message)
{
send(destination, message, DEFAULT_PRIORITY, DEFAULT_TIMETOLIVE) ;
}
/*
*
*/
void MessageProducer::send(p<IDestination> destination, p<IMessage> message, char priority, long long timeToLive)
{
p<MessageId> msgId = new MessageId() ;
msgId->setProducerId( producerInfo->getProducerId() ) ;
// Acquire next sequence id
{
LOCKED_SCOPE (mutex);
msgId->setProducerSequenceId( ++messageCounter ) ;
}
// Configure the message
p<ActiveMQMessage> activeMessage = p_dyncast<ActiveMQMessage> (message) ;
activeMessage->setMessageId( msgId ) ;
activeMessage->setProducerId( producerInfo->getProducerId() ) ;
activeMessage->setDestination( p_dyncast<ActiveMQDestination> (destination) ) ;
activeMessage->setPriority(priority) ;
if( session->isTransacted() )
{
session->doStartTransaction() ;
activeMessage->setTransactionId( session->getTransactionContext()->getTransactionId() ) ;
}
// Set time values if not disabled
if( !this->disableMessageTimestamp )
{
long long timestamp = Time::getCurrentTimeMillis() ;
// Set message time stamp/expiration
activeMessage->setTimestamp(timestamp) ;
if( timeToLive > 0 )
activeMessage->setExpiration( timestamp + timeToLive ) ;
}
// Finally, transmit the message
session->doSend(destination, message) ;
}
/*
*
*/
void MessageProducer::close()
{
if( !closed )
{
closed = true ;
// De-register producer from broker
session->getConnection()->disposeOf( producerInfo->getProducerId() ) ;
// Reset internal state (prevent cyclic references)
session = NULL ;
}
}

View File

@ -0,0 +1,91 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQ_MessageProducer_hpp_
#define ActiveMQ_MessageProducer_hpp_
#include <string>
#include "cms/IDestination.hpp"
#include "cms/IMessage.hpp"
#include "cms/IMessageProducer.hpp"
#include "activemq/command/ProducerInfo.hpp"
#include "ppr/thread/SimpleMutex.hpp"
#include "ppr/util/Time.hpp"
#include "ppr/util/ifr/p"
namespace apache
{
namespace activemq
{
using namespace ifr;
using namespace apache::cms;
using namespace apache::activemq::command;
using namespace apache::ppr;
using namespace apache::ppr::thread;
class Session ;
/*
*
*/
class MessageProducer : public IMessageProducer
{
private:
p<Session> session ;
p<ProducerInfo> producerInfo ;
SimpleMutex mutex ;
int priority ;
long long messageCounter,
timeToLive ;
bool closed,
persistent,
disableMessageID,
disableMessageTimestamp ;
// Default message values
const static char DEFAULT_PRIORITY = 4 ;
const static long long DEFAULT_TIMETOLIVE = 0 ;
public:
MessageProducer(p<Session> session, p<ProducerInfo> producerInfo) ;
virtual ~MessageProducer() ;
// Attribute methods
virtual bool getPersistent() ;
virtual void setPersistent(bool persistent) ;
virtual long long getTimeToLive() ;
virtual void getTimeToLive(long long ttl) ;
virtual int getPriority() ;
virtual void getPriority(int priority) ;
virtual bool getDisableMessageID() ;
virtual void getDisableMessageID(bool disable) ;
virtual bool getDisableMessageTimestamp() ;
virtual void getDisableMessageTimestamp(bool disable) ;
// Operation methods
virtual void send(p<IMessage> message) ;
virtual void send(p<IDestination> destination, p<IMessage> message) ;
virtual void send(p<IDestination> destination, p<IMessage> message, char priority, long long timeToLive) ;
virtual void close() ;
private:
long long getCurrentTimeMillis() ;
} ;
/* namespace */
}
}
#endif /*ActiveMQ_MessageProducer_hpp_*/

View File

@ -0,0 +1,508 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "activemq/Session.hpp"
#include "activemq/command/ActiveMQDestination.hpp"
#include "activemq/command/ActiveMQQueue.hpp"
#include "activemq/command/ActiveMQTopic.hpp"
#include "activemq/command/ActiveMQTempQueue.hpp"
#include "activemq/command/ActiveMQTempTopic.hpp"
#include "activemq/command/ActiveMQMessage.hpp"
#include "activemq/command/ActiveMQBytesMessage.hpp"
#include "activemq/command/ActiveMQMapMessage.hpp"
#include "activemq/command/ActiveMQTextMessage.hpp"
#include "activemq/command/ProducerInfo.hpp"
#include "activemq/command/ConsumerInfo.hpp"
#include "activemq/command/MessageAck.hpp"
#include "activemq/MessageConsumer.hpp"
#include "activemq/MessageProducer.hpp"
#include "activemq/Connection.hpp"
using namespace apache::activemq;
// Constructors -----------------------------------------------------
/*
*
*/
Session::Session(p<Connection> connection, p<SessionInfo> info, AcknowledgementMode ackMode)
{
this->connection = connection ;
this->sessionInfo = info ;
this->ackMode = ackMode ;
this->prefetchSize = 1000 ;
this->consumerCounter = 0 ;
this->producerCounter = 0 ;
this->transactionContext = new TransactionContext(smartify(this)) ;
this->dispatchThread = new DispatchThread(smartify(this)) ;
this->closed = false ;
// Activate backround dispatch thread
dispatchThread->start() ;
}
/*
*
*/
Session::~Session()
{
// Make sure session is closed
close() ;
}
// Attribute methods ------------------------------------------------
/*
*
*/
bool Session::isTransacted()
{
return ( ackMode == TransactionalAckMode ) ? true : false ;
}
/*
*
*/
p<Connection> Session::getConnection()
{
return connection ;
}
/*
*
*/
p<SessionId> Session::getSessionId()
{
return sessionInfo->getSessionId() ;
}
/*
*
*/
p<TransactionContext> Session::getTransactionContext()
{
return transactionContext ;
}
/*
*
*/
p<MessageConsumer> Session::getConsumer(p<ConsumerId> consumerId)
{
map<long long, p<MessageConsumer> >::iterator tempIter ;
// Check if key exists in map
tempIter = consumers.find( consumerId->getValue() ) ;
if( tempIter == consumers.end() )
return NULL ;
else
return tempIter->second ;
}
/*
*
*/
p<MessageProducer> Session::getProducer(p<ProducerId> producerId)
{
map<long long, p<MessageProducer> >::iterator tempIter ;
// Check if key exists in map
tempIter = producers.find( producerId->getValue() ) ;
if( tempIter == producers.end() )
return NULL ;
else
return tempIter->second ;
}
// Operation methods ------------------------------------------------
/*
*
*/
p<IMessageProducer> Session::createProducer()
{
return createProducer(NULL) ;
}
/*
*
*/
p<IMessageProducer> Session::createProducer(p<IDestination> destination)
{
p<ProducerInfo> command = createProducerInfo(destination) ;
p<ProducerId> producerId = command->getProducerId() ;
try
{
p<MessageProducer> producer = new MessageProducer(smartify(this), command) ;
// Save the producer
producers[ producerId->getValue() ] = producer ;
// Register producer with broker
connection->syncRequest(command) ;
return producer ;
}
catch( exception e )
{
// Make sure producer was removed
producers[ producerId->getValue() ] = NULL ;
throw e ;
}
}
/*
*
*/
p<IMessageConsumer> Session::createConsumer(p<IDestination> destination)
{
return createConsumer(destination, NULL) ;
}
/*
*
*/
p<IMessageConsumer> Session::createConsumer(p<IDestination> destination, const char* selector)
{
p<ConsumerInfo> command = createConsumerInfo(destination, selector) ;
p<ConsumerId> consumerId = command->getConsumerId() ;
try
{
p<MessageConsumer> consumer = new MessageConsumer(smartify(this), command, ackMode) ;
// Save the consumer first in case message dispatching starts immediately
consumers[ consumerId->getValue() ] = consumer ;
// Register consumer with broker
connection->syncRequest(command) ;
return consumer ;
}
catch( exception e )
{
// Make sure consumer was removed
consumers[ consumerId->getValue() ] = NULL ;
throw e ;
}
}
p<IMessageConsumer> Session::createDurableConsumer(p<ITopic> destination, const char* name, const char* selector, bool noLocal)
{
p<ConsumerInfo> command = createConsumerInfo(destination, selector) ;
p<ConsumerId> consumerId = command->getConsumerId() ;
p<string> subscriptionName = new string(name) ;
command->setSubcriptionName( subscriptionName ) ;
command->setNoLocal( noLocal ) ;
try
{
p<MessageConsumer> consumer = new MessageConsumer(smartify(this), command, ackMode) ;
// Save the consumer first in case message dispatching starts immediately
consumers[ consumerId->getValue() ] = consumer ;
// Register consumer with broker
connection->syncRequest(command) ;
return consumer ;
}
catch( exception e )
{
// Make sure consumer was removed
consumers[ consumerId->getValue() ] = NULL ;
throw e ;
}
}
/*
*
*/
p<IQueue> Session::getQueue(const char* name)
{
p<IQueue> queue = new ActiveMQQueue(name) ;
return queue ;
}
/*
*
*/
p<ITopic> Session::getTopic(const char* name)
{
p<ITopic> topic = new ActiveMQTopic(name) ;
return topic ;
}
/*
*
*/
p<ITemporaryQueue> Session::createTemporaryQueue()
{
p<ITemporaryQueue> queue = new ActiveMQTempQueue( connection->createTemporaryDestinationName()->c_str() ) ;
return queue ;
}
/*
*
*/
p<ITemporaryTopic> Session::createTemporaryTopic()
{
p<ITemporaryTopic> topic = new ActiveMQTempTopic( connection->createTemporaryDestinationName()->c_str() ) ;
return topic ;
}
/*
*
*/
p<IMessage> Session::createMessage()
{
p<IMessage> message = new ActiveMQMessage() ;
configure(message) ;
return message ;
}
/*
*
*/
p<IBytesMessage> Session::createBytesMessage()
{
p<IBytesMessage> message = new ActiveMQBytesMessage() ;
configure(message) ;
return message ;
}
/*
*
*/
p<IBytesMessage> Session::createBytesMessage(char* body, int size)
{
p<IBytesMessage> message = new ActiveMQBytesMessage( body, size ) ;
configure(message) ;
return message ;
}
/*
*
*/
p<IMapMessage> Session::createMapMessage()
{
p<IMapMessage> message = new ActiveMQMapMessage() ;
configure(message) ;
return message ;
}
/*
*
*/
p<ITextMessage> Session::createTextMessage()
{
p<ITextMessage> message = new ActiveMQTextMessage() ;
configure(message) ;
return message ;
}
/*
*
*/
p<ITextMessage> Session::createTextMessage(const char* text)
{
p<ITextMessage> message = new ActiveMQTextMessage(text) ;
configure(message) ;
return message ;
}
/*
*
*/
void Session::commit() throw(CmsException)
{
if( !isTransacted() )
throw CmsException("You cannot perform a commit on a non-transacted session. Acknowlegement mode is: " + ackMode) ;
transactionContext->commit() ;
}
/*
*
*/
void Session::rollback() throw(CmsException)
{
if( !isTransacted() )
throw CmsException("You cannot perform a rollback on a non-transacted session. Acknowlegement mode is: " + ackMode) ;
transactionContext->rollback() ;
map<long long, p<MessageConsumer> >::const_iterator tempIter ;
// Ensure all the consumers redeliver any rolled back messages
for( tempIter = consumers.begin() ;
tempIter != consumers.end() ;
tempIter++ )
{
((*tempIter).second)->redeliverRolledBackMessages() ;
}
}
/*
*
*/
void Session::doSend(p<IDestination> destination, p<IMessage> message)
{
p<ActiveMQMessage> command = p_dyncast<ActiveMQMessage> (message) ;
// TODO complete packet
connection->syncRequest(command) ;
}
/*
* Starts a new transaction
*/
void Session::doStartTransaction()
{
if( isTransacted() )
transactionContext->begin() ;
}
/*
*
*/
void Session::dispatch(int delay)
{
if( delay > 0 )
dispatchThread->sleep(delay) ;
dispatchThread->wakeup() ;
}
/*
*
*/
void Session::dispatchAsyncMessages()
{
// Ensure that only 1 thread dispatches messages in a consumer at once
LOCKED_SCOPE (mutex);
map<long long, p<MessageConsumer> >::const_iterator tempIter ;
// Iterate through each consumer created by this session
// ensuring that they have all pending messages dispatched
for( tempIter = consumers.begin() ;
tempIter != consumers.end() ;
tempIter++ )
{
((*tempIter).second)->dispatchAsyncMessages() ;
}
}
/*
*
*/
void Session::close()
{
if( !closed )
{
map<long long, p<MessageConsumer> >::iterator consumerIter ;
map<long long, p<MessageProducer> >::iterator producerIter ;
// Iterate through all consumers and close them down
for( consumerIter = consumers.begin() ;
consumerIter != consumers.end() ;
consumerIter++ )
{
consumerIter->second->close() ;
consumerIter->second = NULL ;
}
// Iterate through all producers and close them down
for( producerIter = producers.begin() ;
producerIter != producers.end() ;
producerIter++ )
{
producerIter->second->close() ;
producerIter->second = NULL ;
}
// De-register session from broker
connection->disposeOf( sessionInfo->getSessionId() ) ;
// Clean up
connection = NULL ;
closed = true ;
}
}
// Implementation methods ------------------------------------------
/*
*
*/
p<ConsumerInfo> Session::createConsumerInfo(p<IDestination> destination, const char* selector)
{
p<ConsumerInfo> consumerInfo = new ConsumerInfo() ;
p<ConsumerId> consumerId = new ConsumerId() ;
consumerId->setConnectionId( sessionInfo->getSessionId()->getConnectionId() ) ;
consumerId->setSessionId( sessionInfo->getSessionId()->getValue() ) ;
{
LOCKED_SCOPE (mutex);
consumerId->setValue( ++consumerCounter ) ;
}
p<string> sel = ( selector == NULL ) ? NULL : new string(selector) ;
// TODO complete packet
consumerInfo->setConsumerId( consumerId ) ;
consumerInfo->setDestination( p_dyncast<ActiveMQDestination> (destination) ) ; //ActiveMQDestination::transform(destination) ) ;
consumerInfo->setSelector( sel ) ;
consumerInfo->setPrefetchSize( this->prefetchSize ) ;
return consumerInfo ;
}
/*
*
*/
p<ProducerInfo> Session::createProducerInfo(p<IDestination> destination)
{
p<ProducerInfo> producerInfo = new ProducerInfo() ;
p<ProducerId> producerId = new ProducerId() ;
producerId->setConnectionId( sessionInfo->getSessionId()->getConnectionId() ) ;
producerId->setSessionId( sessionInfo->getSessionId()->getValue() ) ;
{
LOCKED_SCOPE (mutex);
producerId->setValue( ++producerCounter ) ;
}
// TODO complete packet
producerInfo->setProducerId( producerId ) ;
producerInfo->setDestination( p_dyncast<ActiveMQDestination> (destination) ) ; //ActiveMQDestination::transform(destination) ) ;
return producerInfo ;
}
/*
* Configures the message command.
*/
void Session::configure(p<IMessage> message)
{
// TODO:
}

View File

@ -0,0 +1,161 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQ_Session_hpp_
#define ActiveMQ_Session_hpp_
#include <string>
#include <map>
#include "activemq/AcknowledgementMode.hpp"
#include "cms/IMessage.hpp"
#include "cms/IBytesMessage.hpp"
#include "cms/IMapMessage.hpp"
#include "cms/ITextMessage.hpp"
#include "cms/ISession.hpp"
#include "cms/CmsException.hpp"
#include "activemq/IDataStructure.hpp"
#include "activemq/MessageConsumer.hpp"
#include "activemq/MessageProducer.hpp"
#include "activemq/TransactionContext.hpp"
#include "activemq/command/ConsumerInfo.hpp"
#include "activemq/command/ProducerInfo.hpp"
#include "activemq/command/RemoveInfo.hpp"
#include "activemq/command/SessionInfo.hpp"
#include "activemq/command/SessionId.hpp"
#include "ppr/thread/SimpleMutex.hpp"
#include "ppr/thread/Semaphore.hpp"
#include "ppr/thread/Thread.hpp"
#include "ppr/util/ifr/array"
#include "ppr/util/ifr/p"
namespace apache
{
namespace activemq
{
using namespace ifr;
using namespace apache::cms;
using namespace apache::ppr::thread;
using namespace apache::ppr::util;
class Connection;
class DispatchThread;
/*
*
*/
class Session : public ISession
{
private:
p<Connection> connection ;
p<SessionInfo> sessionInfo ;
AcknowledgementMode ackMode ;
p<TransactionContext> transactionContext ;
p<DispatchThread> dispatchThread ;
map<long long, p<MessageConsumer> > consumers ;
map<long long, p<MessageProducer> > producers ;
SimpleMutex mutex ;
long consumerCounter,
producerCounter ;
int prefetchSize ;
bool closed ;
public:
Session(p<Connection> connection, p<SessionInfo> sessionInfo, AcknowledgementMode ackMode) ;
virtual ~Session() ;
// Attribute methods
virtual bool isTransacted() ;
virtual p<Connection> getConnection() ;
virtual p<SessionId> getSessionId() ;
virtual p<TransactionContext> getTransactionContext() ;
virtual p<MessageConsumer> getConsumer(p<ConsumerId> consumerId) ;
virtual p<MessageProducer> getProducer(p<ProducerId> producerId) ;
// Operation methods
virtual void commit() throw(CmsException) ;
virtual void rollback() throw(CmsException) ;
virtual p<IMessageProducer> createProducer() ;
virtual p<IMessageProducer> createProducer(p<IDestination> destination) ;
virtual p<IMessageConsumer> createConsumer(p<IDestination> destination) ;
virtual p<IMessageConsumer> createConsumer(p<IDestination> destination, const char* selector) ;
virtual p<IMessageConsumer> createDurableConsumer(p<ITopic> destination, const char* name, const char* selector, bool noLocal) ;
virtual p<IQueue> getQueue(const char* name) ;
virtual p<ITopic> getTopic(const char* name) ;
virtual p<ITemporaryQueue> createTemporaryQueue() ;
virtual p<ITemporaryTopic> createTemporaryTopic() ;
virtual p<IMessage> createMessage() ;
virtual p<IBytesMessage> createBytesMessage() ;
virtual p<IBytesMessage> createBytesMessage(char* body, int size) ;
virtual p<IMapMessage> createMapMessage() ;
virtual p<ITextMessage> createTextMessage() ;
virtual p<ITextMessage> createTextMessage(const char* text) ;
virtual void doSend(p<IDestination> destination, p<IMessage> message) ;
virtual void doStartTransaction() ;
virtual void dispatch(int delay = 0) ;
virtual void dispatchAsyncMessages() ;
virtual void close() ;
protected:
// Implementation methods
p<ConsumerInfo> createConsumerInfo(p<IDestination> destination, const char* selector) ;
p<ProducerInfo> createProducerInfo(p<IDestination> destination) ;
void configure(p<IMessage> message) ;
} ;
/*
*
*/
class DispatchThread : public Thread
{
public:
p<Session> session ;
Semaphore semaphore ;
bool interrupted ;
DispatchThread(p<Session> session)
{
this->session = session ;
this->interrupted = false ;
}
void interrupt()
{
interrupted = true ;
}
void wakeup()
{
semaphore.notify() ;
}
protected:
virtual void run () throw (p<exception>)
{
while( !interrupted )
{
// Wait for wake-up call
semaphore.wait() ;
session->dispatchAsyncMessages() ;
}
}
} ;
/* namespace */
}
}
#endif /*ActiveMQ_Session_hpp_*/

View File

@ -0,0 +1,149 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "activemq/TransactionContext.hpp"
#include "activemq/Session.hpp"
using namespace apache::activemq;
/*
*
*/
TransactionContext::TransactionContext(p<Session> session)
{
this->session = session ;
this->transactionId = NULL ;
}
/*
*
*/
TransactionContext::~TransactionContext()
{
// no-op
}
/*
*
*/
p<TransactionId> TransactionContext::getTransactionId()
{
return transactionId ;
}
/*
*
*/
void TransactionContext::addSynchronization(p<ISynchronization> synchronization)
{
synchronizations.push_back(synchronization) ;
}
/*
*
*/
void TransactionContext::begin()
{
if( transactionId == NULL )
{
// Create a new local transaction id
transactionId = session->getConnection()->createLocalTransactionId() ;
// Create a new transaction command
p<TransactionInfo> info = new TransactionInfo() ;
info->setConnectionId( session->getConnection()->getConnectionId() ) ;
info->setTransactionId( transactionId ) ;
info->setType( BeginTx ) ;
// Send begin command to broker
session->getConnection()->oneway(info) ;
}
}
/*
*
*/
void TransactionContext::commit()
{
list< p<ISynchronization> >::const_iterator tempIter ;
// Iterate through each synchronization and call beforeCommit()
for( tempIter = synchronizations.begin() ;
tempIter != synchronizations.end() ;
tempIter++ )
{
(*tempIter)->beforeCommit() ;
}
if( transactionId != NULL )
{
// Create a new transaction command
p<TransactionInfo> info = new TransactionInfo() ;
info->setConnectionId( session->getConnection()->getConnectionId() ) ;
info->setTransactionId( transactionId ) ;
info->setType( CommitOnePhaseTx ) ;
// Reset transaction
transactionId = NULL ;
// Send commit command to broker
session->getConnection()->oneway(info) ;
}
// Iterate through each synchronization and call afterCommit()
for( tempIter = synchronizations.begin() ;
tempIter != synchronizations.end() ;
tempIter++ )
{
(*tempIter)->afterCommit() ;
}
// Clear all syncronizations
synchronizations.clear() ;
}
/*
*
*/
void TransactionContext::rollback()
{
if( transactionId != NULL )
{
// Create a new transaction command
p<TransactionInfo> info = new TransactionInfo() ;
info->setConnectionId( session->getConnection()->getConnectionId() ) ;
info->setTransactionId( transactionId ) ;
info->setType( RollbackTx ) ;
// Reset transaction
transactionId = NULL ;
// Send rollback command to broker
session->getConnection()->oneway(info) ;
}
list< p<ISynchronization> >::const_iterator tempIter ;
// Iterate through each synchronization and call afterRollback()
for( tempIter = synchronizations.begin() ;
tempIter != synchronizations.end() ;
tempIter++ )
{
(*tempIter)->afterRollback() ;
}
// Clear all syncronizations
synchronizations.clear() ;
}

View File

@ -0,0 +1,61 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQ_TransactionContext_hpp_
#define ActiveMQ_TransactionContext_hpp_
#include <list>
#include "activemq/ISynchronization.hpp"
#include "activemq/Connection.hpp"
#include "activemq/TransactionType.hpp"
#include "activemq/command/TransactionId.hpp"
#include "activemq/command/TransactionInfo.hpp"
#include "ppr/util/ifr/p"
namespace apache
{
namespace activemq
{
using namespace ifr;
using namespace apache::activemq::command;
class Session;
/*
*
*/
class TransactionContext
{
private:
p<TransactionId> transactionId ;
p<Session> session ;
list< p<ISynchronization> > synchronizations ;
public:
TransactionContext(p<Session> session) ;
virtual ~TransactionContext() ;
virtual p<TransactionId> getTransactionId() ;
virtual void addSynchronization(p<ISynchronization> synchronization) ;
virtual void begin() ;
virtual void commit() ;
virtual void rollback() ;
} ;
/* namespace */
}
}
#endif /*ActiveMQ_TransactionContext_hpp_*/

View File

@ -1,47 +1,38 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#ifndef ICommand_hpp_ #ifndef ActiveMQ_TransactionType_hpp_
#define ICommand_hpp_ #define ActiveMQ_TransactionType_hpp_
#include "command/IDataStructure.hpp" namespace apache
{
namespace apache namespace activemq
{ {
namespace activemq enum TransactionType
{ {
namespace client BeginTx = 0,
{ PrepareTx = 1,
namespace command CommitOnePhaseTx = 2,
{ CommitTwoPhaseTx = 3,
RollbackTx = 4,
/* RecoverTx = 5,
* Interface for commands. ForgetTx = 6,
*/ EndTx = 7
class ICommand : public IDataStructure };
{ }
public: }
virtual ~ICommand(){}
// virtual char getCommandType() = 0 ; #endif /*ActiveMQ_TransactionType_hpp_*/
} ;
/* namespace */
}
}
}
}
#endif /*ICommand_hpp_*/

View File

@ -0,0 +1,270 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <string.h>
#include "activemq/command/AbstractCommand.hpp"
#include "activemq/command/ActiveMQMessage.hpp"
#include "activemq/command/ActiveMQBytesMessage.hpp"
#include "activemq/command/ActiveMQMapMessage.hpp"
#include "activemq/command/ActiveMQObjectMessage.hpp"
#include "activemq/command/ActiveMQStreamMessage.hpp"
#include "activemq/command/ActiveMQTextMessage.hpp"
#include "activemq/command/ActiveMQQueue.hpp"
#include "activemq/command/ConsumerId.hpp"
#include "activemq/command/ProducerId.hpp"
#include "activemq/command/MessageId.hpp"
#include "activemq/command/LocalTransactionId.hpp"
#include "activemq/command/MessageAck.hpp"
#include "activemq/command/MessageDispatch.hpp"
#include "activemq/command/Response.hpp"
#include "activemq/command/ConsumerInfo.hpp"
#include "activemq/command/IntegerResponse.hpp"
#include "activemq/command/ProducerInfo.hpp"
#include "activemq/command/BrokerInfo.hpp"
#include "activemq/command/KeepAliveInfo.hpp"
#include "activemq/command/ConnectionInfo.hpp"
#include "activemq/command/RemoveInfo.hpp"
#include "activemq/command/RemoveSubscriptionInfo.hpp"
#include "activemq/command/SessionInfo.hpp"
#include "activemq/command/TransactionInfo.hpp"
#include "activemq/command/WireFormatInfo.hpp"
#include "activemq/command/BrokerId.hpp"
#include "activemq/command/ShutdownInfo.hpp"
using namespace apache::activemq::command;
/*
*
*/
int AbstractCommand::getCommandId()
{
return commandId ;
}
/*
*
*/
void AbstractCommand::setCommandId(int id)
{
commandId = id ;
}
/*
*
*/
bool AbstractCommand::getResponseRequired()
{
return responseRequired ;
}
/*
*
*/
void AbstractCommand::setResponseRequired(bool value)
{
responseRequired = value ;
}
/*
*
*/
unsigned char AbstractCommand::getDataStructureType()
{
return 0 ;
}
/*
*
*/
bool AbstractCommand::isMarshallAware()
{
return false ;
}
/*
*
*/
int AbstractCommand::marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw(IOException)
{
return 0 ;
}
/*
*
*/
void AbstractCommand::unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw(IOException)
{
}
/*
*
*/
p<IDataStructure> AbstractCommand::createObject(unsigned char type)
{
switch( type )
{
case ActiveMQMessage::TYPE:
return new ActiveMQMessage() ;
case ActiveMQTextMessage::TYPE:
return new ActiveMQTextMessage() ;
case ActiveMQObjectMessage::TYPE:
return new ActiveMQObjectMessage() ;
case ActiveMQBytesMessage::TYPE:
return new ActiveMQBytesMessage() ;
case ActiveMQStreamMessage::TYPE:
return new ActiveMQStreamMessage() ;
case ActiveMQMapMessage::TYPE:
return new ActiveMQMapMessage() ;
case ActiveMQQueue::TYPE:
return new ActiveMQQueue() ;
case ConsumerId::TYPE:
return new ConsumerId() ;
case ProducerId::TYPE:
return new ProducerId() ;
case MessageId::TYPE:
return new MessageId() ;
case LocalTransactionId::TYPE:
return new LocalTransactionId() ;
case MessageAck::TYPE:
return new MessageAck() ;
case MessageDispatch::TYPE:
return new MessageDispatch() ;
case Response::TYPE:
return new Response() ;
case ConsumerInfo::TYPE:
return new ConsumerInfo() ;
case ProducerInfo::TYPE:
return new ProducerInfo() ;
case TransactionInfo::TYPE:
return new TransactionInfo() ;
case BrokerInfo::TYPE:
return new BrokerInfo() ;
case BrokerId::TYPE:
return new BrokerId() ;
case ConnectionInfo::TYPE:
return new ConnectionInfo() ;
case SessionInfo::TYPE:
return new SessionInfo() ;
case RemoveSubscriptionInfo::TYPE:
return new RemoveSubscriptionInfo() ;
case IntegerResponse::TYPE:
return new IntegerResponse() ;
case WireFormatInfo::TYPE:
return new WireFormatInfo() ;
case RemoveInfo::TYPE:
return new RemoveInfo() ;
case KeepAliveInfo::TYPE:
return new KeepAliveInfo() ;
case ShutdownInfo::TYPE:
return new ShutdownInfo() ;
default:
return NULL ;
}
}
/*
*
*/
p<string> AbstractCommand::getDataStructureTypeAsString(unsigned char type)
{
p<string> packetType = new string() ;
switch( type )
{
case ActiveMQMessage::TYPE:
packetType->assign("ACTIVEMQ_MESSAGE") ;
break ;
case ActiveMQTextMessage::TYPE:
packetType->assign("ACTIVEMQ_TEXT_MESSAGE") ;
break ;
case ActiveMQObjectMessage::TYPE:
packetType->assign("ACTIVEMQ_OBJECT_MESSAGE") ;
break ;
case ActiveMQBytesMessage::TYPE:
packetType->assign("ACTIVEMQ_BYTES_MESSAGE") ;
break ;
case ActiveMQStreamMessage::TYPE:
packetType->assign("ACTIVEMQ_STREAM_MESSAGE") ;
break ;
case ActiveMQMapMessage::TYPE:
packetType->assign("ACTIVEMQ_MAP_MESSAGE") ;
break ;
case ActiveMQQueue::TYPE:
packetType->assign("ACTIVEMQ_QUEUE") ;
break ;
case ConsumerId::TYPE:
packetType->assign("CONSUMER_ID") ;
break ;
case ProducerId::TYPE:
packetType->assign("PRODUCER_ID") ;
break ;
case MessageId::TYPE:
packetType->assign("MESSAGE_ID") ;
break ;
case LocalTransactionId::TYPE:
packetType->assign("LOCAL_TRANSACTION_ID") ;
break ;
case MessageAck::TYPE:
packetType->assign("ACTIVEMQ_MSG_ACK") ;
break ;
case MessageDispatch::TYPE:
packetType->assign("ACTIVEMQ_MSG_DISPATCH") ;
break ;
case Response::TYPE:
packetType->assign("RESPONSE") ;
break ;
case ConsumerInfo::TYPE:
packetType->assign("CONSUMER_INFO") ;
break ;
case ProducerInfo::TYPE:
packetType->assign("PRODUCER_INFO") ;
break;
case TransactionInfo::TYPE:
packetType->assign("TRANSACTION_INFO") ;
break ;
case BrokerInfo::TYPE:
packetType->assign("BROKER_INFO") ;
break ;
case ConnectionInfo::TYPE:
packetType->assign("CONNECTION_INFO") ;
break ;
case SessionInfo::TYPE:
packetType->assign("SESSION_INFO") ;
break ;
case RemoveSubscriptionInfo::TYPE:
packetType->assign("DURABLE_UNSUBSCRIBE") ;
break ;
case IntegerResponse::TYPE:
packetType->assign("INT_RESPONSE_RECEIPT_INFO") ;
break ;
case WireFormatInfo::TYPE:
packetType->assign("WIRE_FORMAT_INFO") ;
break ;
case RemoveInfo::TYPE:
packetType->assign("REMOVE_INFO") ;
break ;
case KeepAliveInfo::TYPE:
packetType->assign("KEEP_ALIVE") ;
break ;
case ShutdownInfo::TYPE:
packetType->assign("SHUTDOWN") ;
break ;
default:
packetType->assign("UNDEFINED") ;
break ;
}
return packetType ;
}

View File

@ -0,0 +1,70 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQ_AbstractCommand_hpp_
#define ActiveMQ_AbstractCommand_hpp_
#include <string>
#include "activemq/ICommand.hpp"
#include "activemq/IDataStructure.hpp"
#include "ppr/io/IOutputStream.hpp"
#include "ppr/io/IInputStream.hpp"
#include "ppr/io/IOException.hpp"
#include "ppr/util/ifr/p"
namespace apache
{
namespace activemq
{
namespace command
{
using namespace ifr;
using namespace std;
using namespace apache::activemq;
using namespace apache::ppr::io;
/*
*
*/
class AbstractCommand : public ICommand
{
protected:
int commandId ;
bool responseRequired ;
protected:
AbstractCommand() : commandId (0), responseRequired (false) {}
public:
virtual int getCommandId() ;
virtual void setCommandId(int id) ;
virtual bool getResponseRequired() ;
virtual void setResponseRequired(bool value) ;
virtual unsigned char getDataStructureType() ;
virtual bool isMarshallAware() ;
virtual int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw(IOException) ;
virtual void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw(IOException) ;
static p<IDataStructure> createObject(unsigned char type) ;
static p<string> getDataStructureTypeAsString(unsigned char type) ;
} ;
/* namespace */
}
}
}
#endif /*ActiveMQ_AbstractCommand_hpp_*/

View File

@ -0,0 +1,406 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "activemq/command/ActiveMQBytesMessage.hpp"
using namespace apache::activemq::command;
/*
*
*/
ActiveMQBytesMessage::ActiveMQBytesMessage()
{
this->in = NULL ;
this->out = new ByteArrayOutputStream() ;
this->readMode = false ;
}
/*
*
*/
ActiveMQBytesMessage::ActiveMQBytesMessage(char* body, int size)
{
// Convert body to SP array
array<char> buffer = array<char> (size) ;
memcpy(buffer.c_array(), body, size);
this->in = NULL ;
this->out = new ByteArrayOutputStream(buffer) ;
this->readMode = false ;
}
/*
*
*/
ActiveMQBytesMessage::~ActiveMQBytesMessage()
{
}
/*
*
*/
unsigned char ActiveMQBytesMessage::getDataStructureType()
{
return ActiveMQBytesMessage::TYPE ;
}
/*
*
*/
void ActiveMQBytesMessage::reset()
{
if( !readMode )
{
this->in = new ByteArrayInputStream( out->toArray() ) ;
this->out = NULL ;
this->readMode = true ;
}
}
/*
*
*/
char ActiveMQBytesMessage::readByte() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
try
{
// Read a single byte
return readByte() ;
}
catch( EOFException eof )
{
throw MessageEOFException() ;
}
}
/*
*
*/
int ActiveMQBytesMessage::readBytes(char* buffer, int index, int length) throw (MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
try
{
// Read some bytes
return in->read(buffer, index, length) ;
}
catch( EOFException eof )
{
throw MessageEOFException() ;
}
}
/*
*
*/
bool ActiveMQBytesMessage::readBoolean() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
try
{
// Read a boolean
return in->readBoolean() ;
}
catch( EOFException eof )
{
throw MessageEOFException() ;
}
}
/*
*
*/
double ActiveMQBytesMessage::readDouble() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
try
{
// Read a double
return in->readDouble() ;
}
catch( EOFException eof )
{
throw MessageEOFException() ;
}
}
/*
*
*/
float ActiveMQBytesMessage::readFloat() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
try
{
// Read a float
return in->readFloat() ;
}
catch( EOFException eof )
{
throw MessageEOFException() ;
}
}
/*
*
*/
short ActiveMQBytesMessage::readShort() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
try
{
// Read a short
return in->readShort() ;
}
catch( EOFException eof )
{
throw MessageEOFException() ;
}
}
/*
*
*/
int ActiveMQBytesMessage::readInt() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
try
{
// Read an integer
return in->readInt() ;
}
catch( EOFException eof )
{
throw MessageEOFException() ;
}
}
/*
*
*/
long long ActiveMQBytesMessage::readLong() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
try
{
// Read a long long
return in->readLong() ;
}
catch( EOFException eof )
{
throw MessageEOFException() ;
}
}
/*
*
*/
p<string> ActiveMQBytesMessage::readUTF() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
try
{
// Read a string
return in->readString() ;
}
catch( EOFException eof )
{
throw MessageEOFException() ;
}
}
/*
*
*/
void ActiveMQBytesMessage::writeByte(char value) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write a single byte
out->writeByte(value) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeBytes(char* value, int index, int length) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write some bytes
out->write(value, index, length) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeBoolean(bool value) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write a boolean
out->writeBoolean(value) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeDouble(double value) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write a double
out->writeDouble(value) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeFloat(float value) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write a float
out->writeFloat(value) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeInt(int value) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write an integer
out->writeInt(value) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeLong(long long value) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write a long long
out->writeLong(value) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeShort(short value) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write a short
out->writeShort(value) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeUTF(const char* value) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write a string
p<string> v = new string(value) ;
out->writeString(v) ;
}
/*
*
*/
int ActiveMQBytesMessage::marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException)
{
int size = 0 ;
// Copy body to message content container
if( mode == IMarshaller::MARSHAL_SIZE )
this->content = ( readMode) ? in->toArray() : out->toArray() ;
// size += (int)this->content.size() ;
size += ActiveMQMessage::marshal(marshaller, mode, writer) ;
// Note! Message content marshalling is done in super class
return size ;
}
/*
*
*/
void ActiveMQBytesMessage::unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException)
{
// Note! Message content unmarshalling is done in super class
ActiveMQMessage::unmarshal(marshaller, mode, reader) ;
// Copy body to message content holder
if( mode == IMarshaller::MARSHAL_READ )
{
in = new ByteArrayInputStream( this->content ) ;
out = NULL ;
readMode = true ;
}
}

Some files were not shown because too many files have changed in this diff Show More