Example #1
0
void Parent::doMethod (string& methodName, const ::qpid::types::Variant::Map& inMap, ::qpid::types::Variant::Map& outMap, const string& userId)
{
    Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD;
    std::string          text;


    if (methodName == "create_child") {
        ArgsParentCreate_child ioArgs;
        ::qpid::types::Variant::Map::const_iterator _i;
        if ((_i = inMap.find("name")) != inMap.end()) {
            ioArgs.i_name = (_i->second).getString();
        } else {
            ioArgs.i_name = "";
        }
        bool allow = coreObject->AuthorizeMethod(METHOD_CREATE_CHILD, ioArgs, userId);
        if (allow)
            status = coreObject->ManagementMethod (METHOD_CREATE_CHILD, ioArgs, text);
        else
            status = Manageable::STATUS_FORBIDDEN;
        outMap["_status_code"] = (uint32_t) status;
        outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
        outMap["childRef"] = ::qpid::types::Variant(ioArgs.o_childRef);
        return;
    }

    outMap["_status_code"] = (uint32_t) status;
    outMap["_status_text"] = Manageable::StatusText(status, text);
}
Example #2
0
void Parent::mapDecodeValues (const ::qpid::types::Variant::Map& _map)
{
    ::qpid::types::Variant::Map::const_iterator _i;
    Mutex::ScopedLock mutex(accessLock);

    if ((_i = _map.find("name")) != _map.end()) {
        name = (_i->second).getString();
    } else {
        name = "";
    }

}
Example #3
0
void Journal::mapDecodeValues (const ::qpid::types::Variant::Map& _map)
{
    ::qpid::types::Variant::Map::const_iterator _i;
    Mutex::ScopedLock mutex(accessLock);

    if ((_i = _map.find("queueRef")) != _map.end()) {
        queueRef = _i->second;
    }
    if ((_i = _map.find("name")) != _map.end()) {
        name = (_i->second).getString();
    }
    if ((_i = _map.find("directory")) != _map.end()) {
        directory = (_i->second).getString();
    }
    if ((_i = _map.find("bdbDir")) != _map.end()) {
        bdbDir = (_i->second).getString();
    }
    if ((_i = _map.find("num_jfiles")) != _map.end()) {
        num_jfiles = _i->second;
    }

}
Example #4
0
void TestObject::mapDecodeValues (const ::qpid::types::Variant::Map& _map)
{
    ::qpid::types::Variant::Map::const_iterator _i;
    Mutex::ScopedLock mutex(accessLock);

    if ((_i = _map.find("string1")) != _map.end()) {
        string1 = (_i->second).getString();
    } else {
        string1 = "";
    }
    if ((_i = _map.find("bool1")) != _map.end()) {
        bool1 = _i->second;
    } else {
        bool1 = false;
    }
    if ((_i = _map.find("map1")) != _map.end()) {
        map1 = (_i->second).asMap();
    } else {
        map1 = ::qpid::types::Variant::Map();
    }

}
Example #5
0
void Acl::mapDecodeValues (const ::qpid::types::Variant::Map& _map)
{
    ::qpid::types::Variant::Map::const_iterator _i;
    Mutex::ScopedLock mutex(accessLock);

    if ((_i = _map.find("brokerRef")) != _map.end()) {
        brokerRef = _i->second;
    } else {
        brokerRef = ::qpid::management::ObjectId();
    }
    if ((_i = _map.find("policyFile")) != _map.end()) {
        policyFile = (_i->second).getString();
    } else {
        policyFile = "";
    }
    if ((_i = _map.find("enforcingAcl")) != _map.end()) {
        enforcingAcl = _i->second;
    } else {
        enforcingAcl = false;
    }
    if ((_i = _map.find("transferAcl")) != _map.end()) {
        transferAcl = _i->second;
    } else {
        transferAcl = false;
    }
    if ((_i = _map.find("lastAclLoad")) != _map.end()) {
        lastAclLoad = _i->second;
    } else {
        lastAclLoad = 0;
    }
    if ((_i = _map.find("maxConnections")) != _map.end()) {
        maxConnections = _i->second;
    } else {
        maxConnections = 0;
    }
    if ((_i = _map.find("maxConnectionsPerIp")) != _map.end()) {
        maxConnectionsPerIp = _i->second;
    } else {
        maxConnectionsPerIp = 0;
    }
    if ((_i = _map.find("maxConnectionsPerUser")) != _map.end()) {
        maxConnectionsPerUser = _i->second;
    } else {
        maxConnectionsPerUser = 0;
    }

}
Example #6
0
void Queue::mapDecodeValues (const ::qpid::types::Variant::Map& _map)
{
    ::qpid::types::Variant::Map::const_iterator _i;
    Mutex::ScopedLock mutex(accessLock);

    bool _found;

    if ((_i = _map.find("vhostRef")) != _map.end()) {
        vhostRef = _i->second;
    } else {
        vhostRef = ::qpid::management::ObjectId();
    }
    if ((_i = _map.find("name")) != _map.end()) {
        name = (_i->second).getString();
    } else {
        name = "";
    }
    if ((_i = _map.find("durable")) != _map.end()) {
        durable = _i->second;
    } else {
        durable = false;
    }
    if ((_i = _map.find("autoDelete")) != _map.end()) {
        autoDelete = _i->second;
    } else {
        autoDelete = false;
    }
    if ((_i = _map.find("exclusive")) != _map.end()) {
        exclusive = _i->second;
    } else {
        exclusive = false;
    }
    if ((_i = _map.find("arguments")) != _map.end()) {
        arguments = (_i->second).asMap();
    } else {
        arguments = ::qpid::types::Variant::Map();
    }
    _found = false;
    if ((_i = _map.find("altExchange")) != _map.end()) {
        altExchange = _i->second;
        _found = true;
    } else {
        altExchange = ::qpid::management::ObjectId();
    }
    if (_found) {
        presenceMask[presenceByte_altExchange] |= presenceMask_altExchange;
    }

}
Example #7
0
bool Interconnects::createObject(Broker& broker, const std::string& type, const std::string& name, const qpid::types::Variant::Map& properties,
                                 const std::string& /*userId*/, const std::string& /*connectionId*/)
{
    if (type == DOMAIN_TYPE) {
        qpid::sys::ScopedLock<qpid::sys::Mutex> l(lock);
        DomainMap::iterator i = domains.find(name);
        if (i == domains.end()) {
            boost::shared_ptr<Domain> domain(new Domain(name, properties, broker));
            domains[name] = domain;
            if (domain->isDurable()) broker.getStore().create(*domain);
            return true;
        } else {
            return false;
        }
    } else if (type == INCOMING_TYPE || type == OUTGOING_TYPE) {
        QPID_LOG(notice, "Creating interconnect " << name << ", " << properties);
        boost::shared_ptr<Domain> domain;
        {
            qpid::sys::ScopedLock<qpid::sys::Mutex> l(lock);
            qpid::types::Variant::Map::const_iterator p = properties.find(DOMAIN_TYPE);
            if (p != properties.end()) {
                std::string domainName = p->second;
                DomainMap::iterator i = domains.find(domainName);
                if (i != domains.end()) {
                    domain = i->second;
                } else {
                    throw qpid::Exception(QPID_MSG("No such domain: " << domainName));
                }
            } else {
                throw qpid::Exception(QPID_MSG("Domain must be specified"));
            }
        }
        domain->connect(type == INCOMING_TYPE, name, properties, *context);
        return true;
    } else {
        return false;
    }
}
Example #8
0
void Broker::doMethod (string& methodName, const ::qpid::types::Variant::Map& inMap, ::qpid::types::Variant::Map& outMap, const string& userId)
{
    Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD;
    std::string          text;


    if (methodName == "echo") {
        ArgsBrokerEcho ioArgs;
        ::qpid::types::Variant::Map::const_iterator _i;
        if ((_i = inMap.find("sequence")) != inMap.end()) {
            ioArgs.io_sequence = _i->second;
        } else {
            ioArgs.io_sequence = 0;
        }
        if ((_i = inMap.find("body")) != inMap.end()) {
            ioArgs.io_body = (_i->second).getString();
        } else {
            ioArgs.io_body = "";
        }
        bool allow = coreObject->AuthorizeMethod(METHOD_ECHO, ioArgs, userId);
        if (allow)
            status = coreObject->ManagementMethod (METHOD_ECHO, ioArgs, text);
        else
            status = Manageable::STATUS_FORBIDDEN;
        outMap["_status_code"] = (uint32_t) status;
        outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
        outMap["sequence"] = ::qpid::types::Variant(ioArgs.io_sequence);
        outMap["body"] = ::qpid::types::Variant(ioArgs.io_body);
        return;
    }

    if (methodName == "connect") {
        ArgsBrokerConnect ioArgs;
        ::qpid::types::Variant::Map::const_iterator _i;
        if ((_i = inMap.find("host")) != inMap.end()) {
            ioArgs.i_host = (_i->second).getString();
        } else {
            ioArgs.i_host = "";
        }
        if ((_i = inMap.find("port")) != inMap.end()) {
            ioArgs.i_port = _i->second;
        } else {
            ioArgs.i_port = 0;
        }
        if ((_i = inMap.find("durable")) != inMap.end()) {
            ioArgs.i_durable = _i->second;
        } else {
            ioArgs.i_durable = false;
        }
        if ((_i = inMap.find("authMechanism")) != inMap.end()) {
            ioArgs.i_authMechanism = (_i->second).getString();
        } else {
            ioArgs.i_authMechanism = "";
        }
        if ((_i = inMap.find("username")) != inMap.end()) {
            ioArgs.i_username = (_i->second).getString();
        } else {
            ioArgs.i_username = "";
        }
        if ((_i = inMap.find("password")) != inMap.end()) {
            ioArgs.i_password = (_i->second).getString();
        } else {
            ioArgs.i_password = "";
        }
        if ((_i = inMap.find("transport")) != inMap.end()) {
            ioArgs.i_transport = (_i->second).getString();
        } else {
            ioArgs.i_transport = "";
        }
        bool allow = coreObject->AuthorizeMethod(METHOD_CONNECT, ioArgs, userId);
        if (allow)
            status = coreObject->ManagementMethod (METHOD_CONNECT, ioArgs, text);
        else
            status = Manageable::STATUS_FORBIDDEN;
        outMap["_status_code"] = (uint32_t) status;
        outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
        return;
    }

    if (methodName == "queueMoveMessages") {
        ArgsBrokerQueueMoveMessages ioArgs;
        ::qpid::types::Variant::Map::const_iterator _i;
        if ((_i = inMap.find("srcQueue")) != inMap.end()) {
            ioArgs.i_srcQueue = (_i->second).getString();
        } else {
            ioArgs.i_srcQueue = "";
        }
        if ((_i = inMap.find("destQueue")) != inMap.end()) {
            ioArgs.i_destQueue = (_i->second).getString();
        } else {
            ioArgs.i_destQueue = "";
        }
        if ((_i = inMap.find("qty")) != inMap.end()) {
            ioArgs.i_qty = _i->second;
        } else {
            ioArgs.i_qty = 0;
        }
        if ((_i = inMap.find("filter")) != inMap.end()) {
            ioArgs.i_filter = (_i->second).asMap();
        } else {
            ioArgs.i_filter = ::qpid::types::Variant::Map();
        }
        bool allow = coreObject->AuthorizeMethod(METHOD_QUEUEMOVEMESSAGES, ioArgs, userId);
        if (allow)
            status = coreObject->ManagementMethod (METHOD_QUEUEMOVEMESSAGES, ioArgs, text);
        else
            status = Manageable::STATUS_FORBIDDEN;
        outMap["_status_code"] = (uint32_t) status;
        outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
        return;
    }

    if (methodName == "setLogLevel") {
        ArgsBrokerSetLogLevel ioArgs;
        ::qpid::types::Variant::Map::const_iterator _i;
        if ((_i = inMap.find("level")) != inMap.end()) {
            ioArgs.i_level = (_i->second).getString();
        } else {
            ioArgs.i_level = "";
        }
        bool allow = coreObject->AuthorizeMethod(METHOD_SETLOGLEVEL, ioArgs, userId);
        if (allow)
            status = coreObject->ManagementMethod (METHOD_SETLOGLEVEL, ioArgs, text);
        else
            status = Manageable::STATUS_FORBIDDEN;
        outMap["_status_code"] = (uint32_t) status;
        outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
        return;
    }

    if (methodName == "getLogLevel") {
        ArgsBrokerGetLogLevel ioArgs;
        ::qpid::types::Variant::Map::const_iterator _i;
        bool allow = coreObject->AuthorizeMethod(METHOD_GETLOGLEVEL, ioArgs, userId);
        if (allow)
            status = coreObject->ManagementMethod (METHOD_GETLOGLEVEL, ioArgs, text);
        else
            status = Manageable::STATUS_FORBIDDEN;
        outMap["_status_code"] = (uint32_t) status;
        outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
        outMap["level"] = ::qpid::types::Variant(ioArgs.o_level);
        return;
    }

    if (methodName == "getTimestampConfig") {
        ArgsBrokerGetTimestampConfig ioArgs;
        ::qpid::types::Variant::Map::const_iterator _i;
        bool allow = coreObject->AuthorizeMethod(METHOD_GETTIMESTAMPCONFIG, ioArgs, userId);
        if (allow)
            status = coreObject->ManagementMethod (METHOD_GETTIMESTAMPCONFIG, ioArgs, text);
        else
            status = Manageable::STATUS_FORBIDDEN;
        outMap["_status_code"] = (uint32_t) status;
        outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
        outMap["receive"] = ::qpid::types::Variant(ioArgs.o_receive);
        return;
    }

    if (methodName == "setTimestampConfig") {
        ArgsBrokerSetTimestampConfig ioArgs;
        ::qpid::types::Variant::Map::const_iterator _i;
        if ((_i = inMap.find("receive")) != inMap.end()) {
            ioArgs.i_receive = _i->second;
        } else {
            ioArgs.i_receive = false;
        }
        bool allow = coreObject->AuthorizeMethod(METHOD_SETTIMESTAMPCONFIG, ioArgs, userId);
        if (allow)
            status = coreObject->ManagementMethod (METHOD_SETTIMESTAMPCONFIG, ioArgs, text);
        else
            status = Manageable::STATUS_FORBIDDEN;
        outMap["_status_code"] = (uint32_t) status;
        outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
        return;
    }

    if (methodName == "create") {
        ArgsBrokerCreate ioArgs;
        ::qpid::types::Variant::Map::const_iterator _i;
        if ((_i = inMap.find("type")) != inMap.end()) {
            ioArgs.i_type = (_i->second).getString();
        } else {
            ioArgs.i_type = "";
        }
        if ((_i = inMap.find("name")) != inMap.end()) {
            ioArgs.i_name = (_i->second).getString();
        } else {
            ioArgs.i_name = "";
        }
        if ((_i = inMap.find("properties")) != inMap.end()) {
            ioArgs.i_properties = (_i->second).asMap();
        } else {
            ioArgs.i_properties = ::qpid::types::Variant::Map();
        }
        if ((_i = inMap.find("strict")) != inMap.end()) {
            ioArgs.i_strict = _i->second;
        } else {
            ioArgs.i_strict = false;
        }
        bool allow = coreObject->AuthorizeMethod(METHOD_CREATE, ioArgs, userId);
        if (allow)
            status = coreObject->ManagementMethod (METHOD_CREATE, ioArgs, text);
        else
            status = Manageable::STATUS_FORBIDDEN;
        outMap["_status_code"] = (uint32_t) status;
        outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
        return;
    }

    if (methodName == "delete") {
        ArgsBrokerDelete ioArgs;
        ::qpid::types::Variant::Map::const_iterator _i;
        if ((_i = inMap.find("type")) != inMap.end()) {
            ioArgs.i_type = (_i->second).getString();
        } else {
            ioArgs.i_type = "";
        }
        if ((_i = inMap.find("name")) != inMap.end()) {
            ioArgs.i_name = (_i->second).getString();
        } else {
            ioArgs.i_name = "";
        }
        if ((_i = inMap.find("options")) != inMap.end()) {
            ioArgs.i_options = (_i->second).asMap();
        } else {
            ioArgs.i_options = ::qpid::types::Variant::Map();
        }
        bool allow = coreObject->AuthorizeMethod(METHOD_DELETE, ioArgs, userId);
        if (allow)
            status = coreObject->ManagementMethod (METHOD_DELETE, ioArgs, text);
        else
            status = Manageable::STATUS_FORBIDDEN;
        outMap["_status_code"] = (uint32_t) status;
        outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
        return;
    }

    if (methodName == "query") {
        ArgsBrokerQuery ioArgs;
        ::qpid::types::Variant::Map::const_iterator _i;
        if ((_i = inMap.find("type")) != inMap.end()) {
            ioArgs.i_type = (_i->second).getString();
        } else {
            ioArgs.i_type = "";
        }
        if ((_i = inMap.find("name")) != inMap.end()) {
            ioArgs.i_name = (_i->second).getString();
        } else {
            ioArgs.i_name = "";
        }
        bool allow = coreObject->AuthorizeMethod(METHOD_QUERY, ioArgs, userId);
        if (allow)
            status = coreObject->ManagementMethod (METHOD_QUERY, ioArgs, text);
        else
            status = Manageable::STATUS_FORBIDDEN;
        outMap["_status_code"] = (uint32_t) status;
        outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
        outMap["results"] = ::qpid::types::Variant(ioArgs.o_results);
        return;
    }

    outMap["_status_code"] = (uint32_t) status;
    outMap["_status_text"] = Manageable::StatusText(status, text);
}
Example #9
0
void Broker::mapDecodeValues (const ::qpid::types::Variant::Map& _map)
{
    ::qpid::types::Variant::Map::const_iterator _i;
    Mutex::ScopedLock mutex(accessLock);

    bool _found;

    if ((_i = _map.find("name")) != _map.end()) {
        name = (_i->second).getString();
    } else {
        name = "";
    }
    if ((_i = _map.find("systemRef")) != _map.end()) {
        systemRef = _i->second;
    } else {
        systemRef = ::qpid::management::ObjectId();
    }
    if ((_i = _map.find("port")) != _map.end()) {
        port = _i->second;
    } else {
        port = 0;
    }
    if ((_i = _map.find("workerThreads")) != _map.end()) {
        workerThreads = _i->second;
    } else {
        workerThreads = 0;
    }
    if ((_i = _map.find("connBacklog")) != _map.end()) {
        connBacklog = _i->second;
    } else {
        connBacklog = 0;
    }
    if ((_i = _map.find("stagingThreshold")) != _map.end()) {
        stagingThreshold = _i->second;
    } else {
        stagingThreshold = 0;
    }
    if ((_i = _map.find("mgmtPublish")) != _map.end()) {
        mgmtPublish = _i->second;
    } else {
        mgmtPublish = false;
    }
    if ((_i = _map.find("mgmtPubInterval")) != _map.end()) {
        mgmtPubInterval = _i->second;
    } else {
        mgmtPubInterval = 0;
    }
    if ((_i = _map.find("version")) != _map.end()) {
        version = (_i->second).getString();
    } else {
        version = "";
    }
    _found = false;
    if ((_i = _map.find("dataDir")) != _map.end()) {
        dataDir = (_i->second).getString();
        _found = true;
    } else {
        dataDir = "";
    }
    if (_found) {
        presenceMask[presenceByte_dataDir] |= presenceMask_dataDir;
    }

}
Example #10
0
void Queue::doMethod (string& methodName, const ::qpid::types::Variant::Map& inMap, ::qpid::types::Variant::Map& outMap, const string& userId)
{
    Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD;
    std::string          text;


    if (methodName == "purge") {
        ArgsQueuePurge ioArgs;
        ::qpid::types::Variant::Map::const_iterator _i;
        if ((_i = inMap.find("request")) != inMap.end()) {
            ioArgs.i_request = _i->second;
        } else {
            ioArgs.i_request = 0;
        }
        if ((_i = inMap.find("filter")) != inMap.end()) {
            ioArgs.i_filter = (_i->second).asMap();
        } else {
            ioArgs.i_filter = ::qpid::types::Variant::Map();
        }
        bool allow = coreObject->AuthorizeMethod(METHOD_PURGE, ioArgs, userId);
        if (allow)
            status = coreObject->ManagementMethod (METHOD_PURGE, ioArgs, text);
        else
            status = Manageable::STATUS_FORBIDDEN;
        outMap["_status_code"] = (uint32_t) status;
        outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
        return;
    }

    if (methodName == "reroute") {
        ArgsQueueReroute ioArgs;
        ::qpid::types::Variant::Map::const_iterator _i;
        if ((_i = inMap.find("request")) != inMap.end()) {
            ioArgs.i_request = _i->second;
        } else {
            ioArgs.i_request = 0;
        }
        if ((_i = inMap.find("useAltExchange")) != inMap.end()) {
            ioArgs.i_useAltExchange = _i->second;
        } else {
            ioArgs.i_useAltExchange = false;
        }
        if ((_i = inMap.find("exchange")) != inMap.end()) {
            ioArgs.i_exchange = (_i->second).getString();
        } else {
            ioArgs.i_exchange = "";
        }
        if ((_i = inMap.find("filter")) != inMap.end()) {
            ioArgs.i_filter = (_i->second).asMap();
        } else {
            ioArgs.i_filter = ::qpid::types::Variant::Map();
        }
        bool allow = coreObject->AuthorizeMethod(METHOD_REROUTE, ioArgs, userId);
        if (allow)
            status = coreObject->ManagementMethod (METHOD_REROUTE, ioArgs, text);
        else
            status = Manageable::STATUS_FORBIDDEN;
        outMap["_status_code"] = (uint32_t) status;
        outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
        return;
    }

    outMap["_status_code"] = (uint32_t) status;
    outMap["_status_text"] = Manageable::StatusText(status, text);
}
Example #11
0
void Acl::doMethod (string& methodName, const ::qpid::types::Variant::Map& inMap, ::qpid::types::Variant::Map& outMap, const string& userId)
{
    Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD;
    std::string          text;


    if (methodName == "reloadACLFile") {
        ::qpid::management::ArgsNone ioArgs;
        bool allow = coreObject->AuthorizeMethod(METHOD_RELOADACLFILE, ioArgs, userId);
        if (allow)
            status = coreObject->ManagementMethod (METHOD_RELOADACLFILE, ioArgs, text);
        else
            status = Manageable::STATUS_FORBIDDEN;
        outMap["_status_code"] = (uint32_t) status;
        outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
        return;
    }

    if (methodName == "Lookup") {
        ArgsAclLookup ioArgs;
        ::qpid::types::Variant::Map::const_iterator _i;
        if ((_i = inMap.find("userId")) != inMap.end()) {
            ioArgs.i_userId = (_i->second).getString();
        } else {
            ioArgs.i_userId = "";
        }
        if ((_i = inMap.find("action")) != inMap.end()) {
            ioArgs.i_action = (_i->second).getString();
        } else {
            ioArgs.i_action = "";
        }
        if ((_i = inMap.find("object")) != inMap.end()) {
            ioArgs.i_object = (_i->second).getString();
        } else {
            ioArgs.i_object = "";
        }
        if ((_i = inMap.find("objectName")) != inMap.end()) {
            ioArgs.i_objectName = (_i->second).getString();
        } else {
            ioArgs.i_objectName = "";
        }
        if ((_i = inMap.find("propertyMap")) != inMap.end()) {
            ioArgs.i_propertyMap = (_i->second).asMap();
        } else {
            ioArgs.i_propertyMap = ::qpid::types::Variant::Map();
        }
        bool allow = coreObject->AuthorizeMethod(METHOD_LOOKUP, ioArgs, userId);
        if (allow)
            status = coreObject->ManagementMethod (METHOD_LOOKUP, ioArgs, text);
        else
            status = Manageable::STATUS_FORBIDDEN;
        outMap["_status_code"] = (uint32_t) status;
        outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
        outMap["result"] = ::qpid::types::Variant(ioArgs.o_result);
        return;
    }

    if (methodName == "LookupPublish") {
        ArgsAclLookupPublish ioArgs;
        ::qpid::types::Variant::Map::const_iterator _i;
        if ((_i = inMap.find("userId")) != inMap.end()) {
            ioArgs.i_userId = (_i->second).getString();
        } else {
            ioArgs.i_userId = "";
        }
        if ((_i = inMap.find("exchangeName")) != inMap.end()) {
            ioArgs.i_exchangeName = (_i->second).getString();
        } else {
            ioArgs.i_exchangeName = "";
        }
        if ((_i = inMap.find("routingKey")) != inMap.end()) {
            ioArgs.i_routingKey = (_i->second).getString();
        } else {
            ioArgs.i_routingKey = "";
        }
        bool allow = coreObject->AuthorizeMethod(METHOD_LOOKUPPUBLISH, ioArgs, userId);
        if (allow)
            status = coreObject->ManagementMethod (METHOD_LOOKUPPUBLISH, ioArgs, text);
        else
            status = Manageable::STATUS_FORBIDDEN;
        outMap["_status_code"] = (uint32_t) status;
        outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
        outMap["result"] = ::qpid::types::Variant(ioArgs.o_result);
        return;
    }

    outMap["_status_code"] = (uint32_t) status;
    outMap["_status_text"] = Manageable::StatusText(status, text);
}
Example #12
0
void Connection::mapDecodeValues (const ::qpid::types::Variant::Map& _map)
{
    ::qpid::types::Variant::Map::const_iterator _i;
    Mutex::ScopedLock mutex(accessLock);

    bool _found;

    if ((_i = _map.find("vhostRef")) != _map.end()) {
        vhostRef = _i->second;
    } else {
        vhostRef = ::qpid::management::ObjectId();
    }
    if ((_i = _map.find("address")) != _map.end()) {
        address = (_i->second).getString();
    } else {
        address = "";
    }
    if ((_i = _map.find("incoming")) != _map.end()) {
        incoming = _i->second;
    } else {
        incoming = false;
    }
    if ((_i = _map.find("SystemConnection")) != _map.end()) {
        SystemConnection = _i->second;
    } else {
        SystemConnection = false;
    }
    if ((_i = _map.find("userProxyAuth")) != _map.end()) {
        userProxyAuth = _i->second;
    } else {
        userProxyAuth = false;
    }
    if ((_i = _map.find("federationLink")) != _map.end()) {
        federationLink = _i->second;
    } else {
        federationLink = false;
    }
    if ((_i = _map.find("authIdentity")) != _map.end()) {
        authIdentity = (_i->second).getString();
    } else {
        authIdentity = "";
    }
    _found = false;
    if ((_i = _map.find("remoteProcessName")) != _map.end()) {
        remoteProcessName = (_i->second).getString();
        _found = true;
    } else {
        remoteProcessName = "";
    }
    if (_found) {
        presenceMask[presenceByte_remoteProcessName] |= presenceMask_remoteProcessName;
    }
    _found = false;
    if ((_i = _map.find("remotePid")) != _map.end()) {
        remotePid = _i->second;
        _found = true;
    } else {
        remotePid = 0;
    }
    if (_found) {
        presenceMask[presenceByte_remotePid] |= presenceMask_remotePid;
    }
    _found = false;
    if ((_i = _map.find("remoteParentPid")) != _map.end()) {
        remoteParentPid = _i->second;
        _found = true;
    } else {
        remoteParentPid = 0;
    }
    if (_found) {
        presenceMask[presenceByte_remoteParentPid] |= presenceMask_remoteParentPid;
    }
    if ((_i = _map.find("shadow")) != _map.end()) {
        shadow = _i->second;
    } else {
        shadow = false;
    }
    if ((_i = _map.find("saslMechanism")) != _map.end()) {
        saslMechanism = (_i->second).getString();
    } else {
        saslMechanism = "";
    }
    if ((_i = _map.find("saslSsf")) != _map.end()) {
        saslSsf = _i->second;
    } else {
        saslSsf = 0;
    }

}