blob: 2a01c042b55ec0caf1857ae86c461a26d65af718 [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/ExceptionResponse.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 ExceptionResponse
*
*
* 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
*
*/
////////////////////////////////////////////////////////////////////////////////
ExceptionResponse::ExceptionResponse()
{
this->exception = NULL;
}
////////////////////////////////////////////////////////////////////////////////
ExceptionResponse::~ExceptionResponse()
{
delete this->exception;
}
////////////////////////////////////////////////////////////////////////////////
ExceptionResponse* ExceptionResponse::cloneDataStructure() const {
ExceptionResponse* exceptionResponse = new ExceptionResponse();
// Copy the data from the base class or classes
exceptionResponse->copyDataStructure( this );
return exceptionResponse;
}
////////////////////////////////////////////////////////////////////////////////
void ExceptionResponse::copyDataStructure( const DataStructure* src ) {
// Copy the data of the base class or classes
Response::copyDataStructure( src );
const ExceptionResponse* srcPtr = dynamic_cast<const ExceptionResponse*>( src );
if( srcPtr == NULL || src == NULL ) {
throw exceptions::NullPointerException(
__FILE__, __LINE__,
"ExceptionResponse::copyDataStructure - src is NULL or invalid" );
}
if( srcPtr->getException() != NULL ) {
this->setException(
dynamic_cast<BrokerError*>(
srcPtr->getException()->cloneDataStructure() ) );
}
}
////////////////////////////////////////////////////////////////////////////////
unsigned char ExceptionResponse::getDataStructureType() const {
return ExceptionResponse::ID_EXCEPTIONRESPONSE;
}
////////////////////////////////////////////////////////////////////////////////
std::string ExceptionResponse::toString() const {
ostringstream stream;
stream << "Begin Class = ExceptionResponse" << std::endl;
stream << " Value of ExceptionResponse::ID_EXCEPTIONRESPONSE = 31" << std::endl;
stream << " Value of Exception is Below:" << std::endl;
if( this->getException() != NULL ) {
stream << this->getException()->toString() << std::endl;
} else {
stream << " Object is NULL" << std::endl;
}
stream << Response::toString();
stream << "End Class = ExceptionResponse" << std::endl;
return stream.str();
}
////////////////////////////////////////////////////////////////////////////////
bool ExceptionResponse::equals( const DataStructure* value ) const {
const ExceptionResponse* valuePtr = dynamic_cast<const ExceptionResponse*>( value );
if( valuePtr == NULL || value == NULL ) {
return false;
}
if( this->getException() != NULL ) {
if( !this->getException()->equals( valuePtr->getException() ) ) {
return false;
}
} else if( valuePtr->getException() != NULL ) {
return false;
}
if( !Response::equals( value ) ) {
return false;
}
return true;
}
////////////////////////////////////////////////////////////////////////////////
const BrokerError* ExceptionResponse::getException() const {
return exception;
}
////////////////////////////////////////////////////////////////////////////////
BrokerError* ExceptionResponse::getException() {
return exception;
}
////////////////////////////////////////////////////////////////////////////////
void ExceptionResponse::setException(BrokerError* exception ) {
this->exception = exception;
}