Refactored the PartialCommand to make it simpler and make LastPartialCommand not contain binary data

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@384894 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2006-03-10 19:06:53 +00:00
parent c2fc820c48
commit 42a7a36921
6 changed files with 20 additions and 6 deletions

View File

@ -1 +1 @@
/* * 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_*/ /* * 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/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 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 BaseCommand { private: public: const static int TYPE = 61; public: LastPartialCommand() ; virtual ~LastPartialCommand() ; virtual int getCommandType() ; } ; /* namespace */ } } } } #endif /*LastPartialCommand_hpp_*/

View File

@ -30,6 +30,7 @@ using namespace apache::activemq::client::command;
*/ */
PartialCommand::PartialCommand() PartialCommand::PartialCommand()
{ {
this->commandId = 0 ;
this->data = 0 ; this->data = 0 ;
} }
@ -38,6 +39,17 @@ PartialCommand::~PartialCommand()
} }
int PartialCommand::getCommandId()
{
return commandId ;
}
void PartialCommand::setCommandId(int commandId)
{
this->commandId = commandId ;
}
ap<char> PartialCommand::getData() ap<char> PartialCommand::getData()
{ {
return data ; return data ;

View File

@ -1 +1 @@
/* * 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/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 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 BaseCommand { private: ap<char> data ; public: const static int TYPE = 60; public: PartialCommand() ; virtual ~PartialCommand() ; virtual int getCommandType() ; virtual ap<char> getData() ; virtual void setData(ap<char> data) ; } ; /* namespace */ } } } } #endif /*PartialCommand_hpp_*/ /* * 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/AbstractCommand.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 AbstractCommand { 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 +1 @@
/* * 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 LastPartialCommandMarshaller_hpp_ #define LastPartialCommandMarshaller_hpp_ #include <string> #include "command/IDataStructure.hpp" /* we could cut this down - for now include all possible headers */ #include "command/BrokerId.hpp" #include "command/ConnectionId.hpp" #include "command/ConsumerId.hpp" #include "command/ProducerId.hpp" #include "command/SessionId.hpp" #include "io/BinaryReader.hpp" #include "io/BinaryWriter.hpp" #include "command/PartialCommandMarshaller.hpp" #include "util/ifr/p.hpp" #include "protocol/ProtocolFormat.hpp" namespace apache { namespace activemq { namespace client { namespace marshal { using namespace ifr ; using namespace apache::activemq::client::command; using namespace apache::activemq::client::io; using namespace apache::activemq::client::protocol; /* * */ class LastPartialCommandMarshaller : public PartialCommandMarshaller { public: LastPartialCommandMarshaller() ; virtual ~LastPartialCommandMarshaller() ; virtual IDataStructure* createCommand() ; virtual char getDataStructureType() ; virtual void unmarshal(ProtocolFormat& wireFormat, Object o, BinaryReader& dataIn, BooleanStream& bs) ; virtual int marshal1(ProtocolFormat& wireFormat, Object& o, BooleanStream& bs) ; virtual void marshal2(ProtocolFormat& wireFormat, Object& o, BinaryWriter& dataOut, BooleanStream& bs) ; } ; /* namespace */ } } } } #endif /*LastPartialCommandMarshaller_hpp_*/ /* * 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 LastPartialCommandMarshaller_hpp_ #define LastPartialCommandMarshaller_hpp_ #include <string> #include "command/IDataStructure.hpp" /* we could cut this down - for now include all possible headers */ #include "command/BrokerId.hpp" #include "command/ConnectionId.hpp" #include "command/ConsumerId.hpp" #include "command/ProducerId.hpp" #include "command/SessionId.hpp" #include "io/BinaryReader.hpp" #include "io/BinaryWriter.hpp" #include "command/BaseCommandMarshaller.hpp" #include "util/ifr/p.hpp" #include "protocol/ProtocolFormat.hpp" namespace apache { namespace activemq { namespace client { namespace marshal { using namespace ifr ; using namespace apache::activemq::client::command; using namespace apache::activemq::client::io; using namespace apache::activemq::client::protocol; /* * */ class LastPartialCommandMarshaller : public BaseCommandMarshaller { public: LastPartialCommandMarshaller() ; virtual ~LastPartialCommandMarshaller() ; virtual IDataStructure* createCommand() ; virtual char getDataStructureType() ; virtual void unmarshal(ProtocolFormat& wireFormat, Object o, BinaryReader& dataIn, BooleanStream& bs) ; virtual int marshal1(ProtocolFormat& wireFormat, Object& o, BooleanStream& bs) ; virtual void marshal2(ProtocolFormat& wireFormat, Object& o, BinaryWriter& dataOut, BooleanStream& bs) ; } ; /* namespace */ } } } } #endif /*LastPartialCommandMarshaller_hpp_*/

View File

@ -56,6 +56,7 @@ void PartialCommandMarshaller::unmarshal(ProtocolFormat& wireFormat, Object o, B
base.unmarshal(wireFormat, o, dataIn, bs); base.unmarshal(wireFormat, o, dataIn, bs);
PartialCommand& info = (PartialCommand&) o; PartialCommand& info = (PartialCommand&) o;
info.setCommandId(dataIn.readInt());
info.setData(tightUnmarshalByteArray(dataIn, bs)); info.setData(tightUnmarshalByteArray(dataIn, bs));
} }
@ -71,7 +72,7 @@ int PartialCommandMarshaller::marshal1(ProtocolFormat& wireFormat, Object& o, Bo
bs.writeBoolean(info.getData()!=null); bs.writeBoolean(info.getData()!=null);
rc += info.getData()==null ? 0 : info.getData().Length+4; rc += info.getData()==null ? 0 : info.getData().Length+4;
return rc + 0; return rc + 1;
} }
/* /*
@ -81,6 +82,7 @@ void PartialCommandMarshaller::marshal2(ProtocolFormat& wireFormat, Object& o, B
base.marshal2(wireFormat, o, dataOut, bs); base.marshal2(wireFormat, o, dataOut, bs);
PartialCommand& info = (PartialCommand&) o; PartialCommand& info = (PartialCommand&) o;
DataStreamMarshaller.writeInt(info.getCommandId(), dataOut);
if(bs.readBoolean()) { if(bs.readBoolean()) {
DataStreamMarshaller.writeInt(info.getData().Length, dataOut); DataStreamMarshaller.writeInt(info.getData().Length, dataOut);
dataOut.write(info.getData()); dataOut.write(info.getData());

View File

@ -1 +1 @@
/* * 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 PartialCommandMarshaller_hpp_ #define PartialCommandMarshaller_hpp_ #include <string> #include "command/IDataStructure.hpp" /* we could cut this down - for now include all possible headers */ #include "command/BrokerId.hpp" #include "command/ConnectionId.hpp" #include "command/ConsumerId.hpp" #include "command/ProducerId.hpp" #include "command/SessionId.hpp" #include "io/BinaryReader.hpp" #include "io/BinaryWriter.hpp" #include "command/BaseCommandMarshaller.hpp" #include "util/ifr/p.hpp" #include "protocol/ProtocolFormat.hpp" namespace apache { namespace activemq { namespace client { namespace marshal { using namespace ifr ; using namespace apache::activemq::client::command; using namespace apache::activemq::client::io; using namespace apache::activemq::client::protocol; /* * */ class PartialCommandMarshaller : public BaseCommandMarshaller { public: PartialCommandMarshaller() ; virtual ~PartialCommandMarshaller() ; virtual IDataStructure* createCommand() ; virtual char getDataStructureType() ; virtual void unmarshal(ProtocolFormat& wireFormat, Object o, BinaryReader& dataIn, BooleanStream& bs) ; virtual int marshal1(ProtocolFormat& wireFormat, Object& o, BooleanStream& bs) ; virtual void marshal2(ProtocolFormat& wireFormat, Object& o, BinaryWriter& dataOut, BooleanStream& bs) ; } ; /* namespace */ } } } } #endif /*PartialCommandMarshaller_hpp_*/ /* * 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 PartialCommandMarshaller_hpp_ #define PartialCommandMarshaller_hpp_ #include <string> #include "command/IDataStructure.hpp" /* we could cut this down - for now include all possible headers */ #include "command/BrokerId.hpp" #include "command/ConnectionId.hpp" #include "command/ConsumerId.hpp" #include "command/ProducerId.hpp" #include "command/SessionId.hpp" #include "io/BinaryReader.hpp" #include "io/BinaryWriter.hpp" #include "command/BaseDataStreamMarshaller.hpp" #include "util/ifr/p.hpp" #include "protocol/ProtocolFormat.hpp" namespace apache { namespace activemq { namespace client { namespace marshal { using namespace ifr ; using namespace apache::activemq::client::command; using namespace apache::activemq::client::io; using namespace apache::activemq::client::protocol; /* * */ class PartialCommandMarshaller : public BaseDataStreamMarshaller { public: PartialCommandMarshaller() ; virtual ~PartialCommandMarshaller() ; virtual IDataStructure* createCommand() ; virtual char getDataStructureType() ; virtual void unmarshal(ProtocolFormat& wireFormat, Object o, BinaryReader& dataIn, BooleanStream& bs) ; virtual int marshal1(ProtocolFormat& wireFormat, Object& o, BooleanStream& bs) ; virtual void marshal2(ProtocolFormat& wireFormat, Object& o, BinaryWriter& dataOut, BooleanStream& bs) ; } ; /* namespace */ } } } } #endif /*PartialCommandMarshaller_hpp_*/