blob: a380df588f2e54e560b9ccec7c5308e9eeb9d0f0 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <activemq/connector/openwire/commands/DestinationInfo.h>
#include <activemq/exceptions/NullPointerException.h>
using namespace std;
using namespace activemq;
using namespace activemq::exceptions;
using namespace activemq::connector;
using namespace activemq::connector::openwire;
using namespace activemq::connector::openwire::commands;
/*
*
* Command and marshaling code for OpenWire format for DestinationInfo
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Java Classes in the
* activemq-core module
*
*/
////////////////////////////////////////////////////////////////////////////////
DestinationInfo::DestinationInfo()
{
this->connectionId = NULL;
this->destination = NULL;
this->operationType = 0;
this->timeout = 0;
}
////////////////////////////////////////////////////////////////////////////////
DestinationInfo::~DestinationInfo()
{
delete this->connectionId;
delete this->destination;
for( size_t ibrokerPath = 0; ibrokerPath < brokerPath.size(); ++ibrokerPath ) {
delete brokerPath[ibrokerPath];
}
}
////////////////////////////////////////////////////////////////////////////////
DestinationInfo* DestinationInfo::cloneDataStructure() const {
DestinationInfo* destinationInfo = new DestinationInfo();
// Copy the data from the base class or classes
destinationInfo->copyDataStructure( this );
return destinationInfo;
}
////////////////////////////////////////////////////////////////////////////////
void DestinationInfo::copyDataStructure( const DataStructure* src ) {
// Copy the data of the base class or classes
BaseCommand<transport::Command>::copyDataStructure( src );
const DestinationInfo* srcPtr = dynamic_cast<const DestinationInfo*>( src );
if( srcPtr == NULL || src == NULL ) {
throw exceptions::NullPointerException(
__FILE__, __LINE__,
"DestinationInfo::copyDataStructure - src is NULL or invalid" );
}
if( srcPtr->getConnectionId() != NULL ) {
this->setConnectionId(
dynamic_cast<ConnectionId*>(
srcPtr->getConnectionId()->cloneDataStructure() ) );
}
if( srcPtr->getDestination() != NULL ) {
this->setDestination(
dynamic_cast<ActiveMQDestination*>(
srcPtr->getDestination()->cloneDataStructure() ) );
}
this->setOperationType( srcPtr->getOperationType() );
this->setTimeout( srcPtr->getTimeout() );
for( size_t ibrokerPath = 0; ibrokerPath < srcPtr->getBrokerPath().size(); ++ibrokerPath ) {
if( srcPtr->getBrokerPath()[ibrokerPath] != NULL ) {
this->getBrokerPath().push_back(
dynamic_cast<BrokerId*>(
srcPtr->getBrokerPath()[ibrokerPath]->cloneDataStructure() ) );
} else {
this->getBrokerPath().push_back( NULL );
}
}
}
////////////////////////////////////////////////////////////////////////////////
unsigned char DestinationInfo::getDataStructureType() const {
return DestinationInfo::ID_DESTINATIONINFO;
}
////////////////////////////////////////////////////////////////////////////////
std::string DestinationInfo::toString() const {
ostringstream stream;
stream << "Begin Class = DestinationInfo" << std::endl;
stream << " Value of DestinationInfo::ID_DESTINATIONINFO = 8" << std::endl;
stream << " Value of ConnectionId is Below:" << std::endl;
if( this->getConnectionId() != NULL ) {
stream << this->getConnectionId()->toString() << std::endl;
} else {
stream << " Object is NULL" << std::endl;
}
stream << " Value of Destination is Below:" << std::endl;
if( this->getDestination() != NULL ) {
stream << this->getDestination()->toString() << std::endl;
} else {
stream << " Object is NULL" << std::endl;
}
stream << " Value of OperationType = " << (int)this->getOperationType() << std::endl;
stream << " Value of Timeout = " << this->getTimeout() << std::endl;
for( size_t ibrokerPath = 0; ibrokerPath < this->getBrokerPath().size(); ++ibrokerPath ) {
stream << " Value of BrokerPath[" << ibrokerPath << "] is Below:" << std::endl;
if( this->getBrokerPath()[ibrokerPath] != NULL ) {
stream << this->getBrokerPath()[ibrokerPath]->toString() << std::endl;
} else {
stream << " Object is NULL" << std::endl;
}
}
stream << BaseCommand<transport::Command>::toString();
stream << "End Class = DestinationInfo" << std::endl;
return stream.str();
}
////////////////////////////////////////////////////////////////////////////////
bool DestinationInfo::equals( const DataStructure* value ) const {
const DestinationInfo* valuePtr = dynamic_cast<const DestinationInfo*>( value );
if( valuePtr == NULL || value == NULL ) {
return false;
}
if( this->getConnectionId() != NULL ) {
if( !this->getConnectionId()->equals( valuePtr->getConnectionId() ) ) {
return false;
}
} else if( valuePtr->getConnectionId() != NULL ) {
return false;
}
if( this->getDestination() != NULL ) {
if( !this->getDestination()->equals( valuePtr->getDestination() ) ) {
return false;
}
} else if( valuePtr->getDestination() != NULL ) {
return false;
}
if( this->getOperationType() != valuePtr->getOperationType() ) {
return false;
}
if( this->getTimeout() != valuePtr->getTimeout() ) {
return false;
}
for( size_t ibrokerPath = 0; ibrokerPath < this->getBrokerPath().size(); ++ibrokerPath ) {
if( this->getBrokerPath()[ibrokerPath] != NULL ) {
if( !this->getBrokerPath()[ibrokerPath]->equals( valuePtr->getBrokerPath()[ibrokerPath] ) ) {
return false;
}
} else if( valuePtr->getBrokerPath()[ibrokerPath] != NULL ) {
return false;
}
}
if( !BaseCommand<transport::Command>::equals( value ) ) {
return false;
}
return true;
}
////////////////////////////////////////////////////////////////////////////////
const ConnectionId* DestinationInfo::getConnectionId() const {
return connectionId;
}
////////////////////////////////////////////////////////////////////////////////
ConnectionId* DestinationInfo::getConnectionId() {
return connectionId;
}
////////////////////////////////////////////////////////////////////////////////
void DestinationInfo::setConnectionId(ConnectionId* connectionId ) {
this->connectionId = connectionId;
}
////////////////////////////////////////////////////////////////////////////////
const ActiveMQDestination* DestinationInfo::getDestination() const {
return destination;
}
////////////////////////////////////////////////////////////////////////////////
ActiveMQDestination* DestinationInfo::getDestination() {
return destination;
}
////////////////////////////////////////////////////////////////////////////////
void DestinationInfo::setDestination(ActiveMQDestination* destination ) {
this->destination = destination;
}
////////////////////////////////////////////////////////////////////////////////
unsigned char DestinationInfo::getOperationType() const {
return operationType;
}
////////////////////////////////////////////////////////////////////////////////
void DestinationInfo::setOperationType(unsigned char operationType ) {
this->operationType = operationType;
}
////////////////////////////////////////////////////////////////////////////////
long long DestinationInfo::getTimeout() const {
return timeout;
}
////////////////////////////////////////////////////////////////////////////////
void DestinationInfo::setTimeout(long long timeout ) {
this->timeout = timeout;
}
////////////////////////////////////////////////////////////////////////////////
const std::vector<BrokerId*>& DestinationInfo::getBrokerPath() const {
return brokerPath;
}
////////////////////////////////////////////////////////////////////////////////
std::vector<BrokerId*>& DestinationInfo::getBrokerPath() {
return brokerPath;
}
////////////////////////////////////////////////////////////////////////////////
void DestinationInfo::setBrokerPath(const std::vector<BrokerId*>& brokerPath ) {
this->brokerPath = brokerPath;
}