1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #include <anna/core/functions.hpp>
10 #include <anna/core/tracing/Logger.hpp>
12 #include <anna/ldap/Response.hpp>
13 #include <anna/ldap/Attribute.hpp>
14 #include <anna/ldap/TimerManager.hpp>
19 ldap::Response::response_pool ldap::Response::st_responses;
21 //----------------------------------------------------------------------------------------
22 // Se invocan desde ldap::Session
23 //----------------------------------------------------------------------------------------
24 ldap::Response* ldap::Response::instance(const ClassCode::_v classCode, const IdMessage idMessage)
25 throw(RuntimeException) {
26 ldap::Response* result = st_responses.create();
27 result->a_classCode = classCode;
28 result->a_idMessage = idMessage;
31 string msg("anna::ldap::Response::instance | ");
32 msg += result->asString();
33 Logger::debug(msg, ANNA_FILE_LOCATION);
38 void ldap::Response::release(ldap::Response* response)
41 st_responses.release(response);
42 } catch(Exception& ex) {
47 ldap::Response::Response() :
48 a_classCode(ClassCode::Undefined),
55 void ldap::Response::clear()
61 for(attribute_iterator ii = attribute_begin(), maxii = attribute_end(); ii != maxii; ii ++)
62 attribute(ii)->clear();
70 void ldap::Response::activateTimer()
71 throw(RuntimeException) {
72 a_timer = TimerManager::instantiate().createTimer(this);
75 void ldap::Response::cancelTimer()
79 TimerManager::instantiate().cancel(a_timer);
80 } catch(RuntimeException& ex) {
88 ldap::Attribute* ldap::Response::createAttribute(const string& name)
89 throw(RuntimeException) {
90 Attribute* result = a_attributes.create();
91 result->setName(name);
95 string ldap::Response::asString() const
97 string result("ldap::Response { ");
98 result += ClassCode::asString(a_classCode);
99 result += functions::asText(" | IdMessage: ", a_idMessage);
101 result += a_resultCode.asString();
102 return result += " }";