Poco::JSON::Array::Ptr ConnectionMapper::inquire() { createCommand(MQCMD_INQUIRE_CONNECTION); // Required parameters if ( _input->has("ConnectionId") ) { std::string hexId = _input->get("ConnectionId"); if ( hexId.length() > MQ_CONNECTION_ID_LENGTH ) { hexId.erase(MQ_CONNECTION_ID_LENGTH); } Buffer::Ptr id = new Buffer(hexId); pcf()->addParameter(MQBACF_CONNECTION_ID, id); } else { Buffer::Ptr id = new Buffer(MQ_CONNECTION_ID_LENGTH); // Empty buffer memset(id->data(), 0, MQ_CONNECTION_ID_LENGTH); pcf()->addParameter(MQBACF_GENERIC_CONNECTION_ID, id); } // Optional parameters //TODO: ByteStringFilter addParameter<std::string>(MQCACF_COMMAND_SCOPE, "CommandScope"); addAttributeList(MQIACF_CONNECTION_ATTRS, "ConnectionAttrs"); addParameterNumFromString(MQIACF_CONN_INFO_TYPE, "ConnInfoType"); addIntegerFilter(); addStringFilter(); addParameterNumFromString(MQIA_UR_DISP, "URDisposition"); if ( ! _input->has("ConnectionAttrs") ) { // It seems that this is not set by default, so we do // it ourselves. MQLONG attrs[] = { MQIACF_ALL }; pcf()->addParameterList(MQIACF_CONNECTION_ATTRS, attrs, 1); } PCF::Vector commandResponse; execute(commandResponse); Poco::JSON::Array::Ptr json = new Poco::JSON::Array(); for(PCF::Vector::iterator it = commandResponse.begin(); it != commandResponse.end(); it++) { if ( (*it)->getReasonCode() != MQRC_NONE ) // Skip errors (2035 not authorized for example) continue; if ( (*it)->isExtendedResponse() ) // Skip extended response continue; json->add(createJSON(**it)); } return json; }
ChannelAuthenticationRecordInquire::ChannelAuthenticationRecordInquire(CommandServer& commandServer, Poco::JSON::Object::Ptr input) : PCFCommand(commandServer, MQCMD_INQUIRE_CHLAUTH_RECS, "ChannelAuthenticationRecord", input) { // Required Parameters addParameter<std::string>(MQCACH_CHANNEL_NAME, "ChannelName"); // Optional Parameters addParameter<std::string>(MQCACH_CONNECTION_NAME, "ConnectionName"); // addByteStringFilter() // TODO? addAttributeList(MQIACF_CHANNEL_ATTRS, "ChannelAuthAttrs"); addParameter<std::string>(MQCACH_CLIENT_USER_ID, "ClientUserIdentifier"); addParameter<std::string>(MQCACF_COMMAND_SCOPE, "CommandScope"); addIntegerFilter(); addParameterNumFromString(MQIACH_MATCH, "Match"); addParameter<std::string>(MQCA_REMOTE_Q_MGR_NAME, "RemoteQmgrName"); addParameter<std::string>(MQCACH_SSL_CERT_ISSUER_NAME, "SSLCertIssuer"); addParameter<std::string>(MQCACH_SSL_PEER_NAME, "SSLPeer"); addStringFilter(); addParameterNumFromString(MQIACF_CHLAUTH_TYPE, "Type"); }
QueueRemove::QueueRemove(CommandServer& commandServer, Poco::JSON::Object::Ptr input) : PCFSimpleCommand(commandServer, MQCMD_DELETE_Q, "Queue", input) { // Required Parameters addParameter<std::string>(MQCA_Q_NAME, "QName"); // Optional Parameters std::string authrec = input->optValue<std::string>("Authrec", "No"); if ( Poco::icompare(authrec, "Yes") == 0 ) { pcf()->addParameter(MQIACF_REMOVE_AUTHREC, MQRAR_YES); } addParameter<std::string>(MQCACF_COMMAND_SCOPE, "CommandScope"); std::string purge = input->optValue<std::string>("Purge", "No"); if ( Poco::icompare(authrec, "Yes") == 0 ) { pcf()->addParameter(MQIACF_PURGE, MQPO_YES); } addParameterNumFromString(MQIA_QSG_DISP, "QSGDisposition"); addParameterNumFromString(MQIA_Q_TYPE, "QType"); }
Poco::JSON::Array::Ptr ChannelStatusMapper::inquire() { createCommand(MQCMD_INQUIRE_CHANNEL_STATUS); // Required parameters addParameter<std::string>(MQCACH_CHANNEL_NAME, "ChannelName"); // Optional parameters addParameterNumFromString(MQIACH_CHANNEL_DISP, "ChannelDisposition"); addParameter<std::string>(MQCACH_CLIENT_ID, "ClientIdentifier"); addAttributeList(MQIACH_CHANNEL_INSTANCE_ATTRS, "ChannelInstanceAttrs"); addParameterNumFromString(MQIACH_CHANNEL_INSTANCE_TYPE, "ChannelInstanceType"); addParameter<std::string>(MQCACF_COMMAND_SCOPE, "CommandScope"); addParameter<std::string>(MQCACH_CONNECTION_NAME, "ConnectionName"); addIntegerFilter(); addStringFilter(); addParameter<std::string>(MQCACH_XMIT_Q_NAME, "XmitQName"); PCF::Vector commandResponse; execute(commandResponse); Poco::JSON::Array::Ptr json = new Poco::JSON::Array(); for(PCF::Vector::iterator it = commandResponse.begin(); it != commandResponse.end(); it++) { if ( (*it)->isExtendedResponse() ) // Skip Extended Response continue; if ( (*it)->getReasonCode() != MQRC_NONE ) // Skip errors (2035 not authorized for example) continue; json->add(createJSON(**it)); } return json; }
Poco::JSON::Array::Ptr ProcessMapper::inquire() { createCommand(MQCMD_INQUIRE_PROCESS); // Required parameters addParameter<std::string>(MQCA_PROCESS_NAME, "ProcessName"); // Optional parameters addParameter<std::string>(MQCACF_COMMAND_SCOPE, "CommandScope"); addIntegerFilter(); addAttributeList(MQIACF_PROCESS_ATTRS, "ProcessAttrs"); addParameterNumFromString(MQIA_QSG_DISP, "QSGDisposition"); addStringFilter(); PCF::Vector commandResponse; execute(commandResponse); bool excludeSystem = _input->optValue("ExcludeSystem", false); Poco::JSON::Array::Ptr json = new Poco::JSON::Array(); for(PCF::Vector::iterator it = commandResponse.begin(); it != commandResponse.end(); it++) { if ( (*it)->getReasonCode() != MQRC_NONE ) // Skip errors (2035 not authorized for example) continue; if ( (*it)->isExtendedResponse() ) // Skip extended response continue; std::string processName = (*it)->getParameterString(MQCA_PROCESS_NAME); if ( excludeSystem && processName.compare(0, 7, "SYSTEM.") == 0 ) { continue; } json->add(createJSON(**it)); } return json; }
Poco::JSON::Array::Ptr AuthorityRecordMapper::inquire() { createCommand(MQCMD_INQUIRE_AUTH_RECS); // Required parameters MQLONG options = 0; Poco::JSON::Array::Ptr optionsValue = _input->getArray("Options"); if ( !optionsValue.isNull() ) { for(Poco::JSON::Array::ValueVec::const_iterator it = optionsValue->begin(); it != optionsValue->end(); ++it) { std::string value = *it; if ( value.compare("Name All Matching") == 0 ) { options |= MQAUTHOPT_NAME_ALL_MATCHING; } else if ( value.compare("Name Explicit") == 0 ) { options |= MQAUTHOPT_NAME_EXPLICIT; } else if ( value.compare("Entity Explicit") == 0 ) { options |= MQAUTHOPT_ENTITY_EXPLICIT; } else if ( value.compare("Entity Set") == 0 ) { options |= MQAUTHOPT_ENTITY_SET; } else if ( value.compare("Name As Wildcard") == 0 ) { options |= MQAUTHOPT_NAME_AS_WILDCARD; } } pcf()->addParameter(MQIACF_AUTH_OPTIONS, options); } // When no ProfileName is passed, set to empty string if ( !_input->has("ProfileName") ) _input->set("ProfileName", ""); addParameter<std::string>(MQCACF_AUTH_PROFILE_NAME, "ProfileName"); addParameterNumFromString(MQIACF_OBJECT_TYPE, "ObjectType"); // Optional parameters addParameter<std::string>(MQCACF_ENTITY_NAME, "EntityName"); addParameterNumFromString(MQIACF_ENTITY_TYPE, "EntityType"); addAttributeList(MQIACF_AUTH_PROFILE_ATTRS, "ProfileAttrs"); addParameter<std::string>(MQCACF_SERVICE_COMPONENT, "ServiceComponent"); PCF::Vector commandResponse; execute(commandResponse); Poco::JSON::Array::Ptr json = new Poco::JSON::Array(); for(PCF::Vector::iterator it = commandResponse.begin(); it != commandResponse.end(); it++) { if ( (*it)->isExtendedResponse() ) // Skip extended response continue; if ( (*it)->getReasonCode() != MQRC_NONE ) // Skip errors (2035 not authorized for example) continue; json->add(createJSON(**it)); } return json; }