Ejemplo n.º 1
0
Poco::JSON::Object::Ptr ClusterQueueManagerMapper::suspend()
{
	createCommand(MQCMD_SUSPEND_Q_MGR_CLUSTER);

	// Required parameters
	addParameter<std::string>(MQCA_CLUSTER_NAME, "ClusterName");
	addParameter<std::string>(MQCA_CLUSTER_NAMELIST, "ClusterNamelist");

	// Optional parameters
	addParameter<std::string>(MQCACF_COMMAND_SCOPE, "CommandScope");
	addAttributeList(MQIACF_MODE, "Mode");

	PCF::Vector commandResponse;
	execute(commandResponse);

	if ( commandResponse.size() > 0 )
	{
		PCF::Vector::iterator it = commandResponse.begin();
		if ( (*it)->getReasonCode() != MQRC_NONE )
		{
			return createError(**it);
		}
	}

	return new Poco::JSON::Object();
}
Ejemplo n.º 2
0
Poco::JSON::Array::Ptr ClusterQueueManagerMapper::inquire()
{
	createCommand(MQCMD_INQUIRE_CLUSTER_Q_MGR);

	// Required parameters
	addParameter<std::string>(MQCA_CLUSTER_Q_MGR_NAME, "ClusterQMgrName");

	// Optional parameters
	addParameter<std::string>(MQCACH_CHANNEL_NAME, "ChannelName");
	addParameter<std::string>(MQCA_CLUSTER_NAME, "ClusterName");
	addAttributeList(MQIACF_CLUSTER_Q_MGR_ATTRS, "ClusterQMgrAttrs");
	addParameter<std::string>(MQCACF_COMMAND_SCOPE, "CommandScope");
	addIntegerFilter();
	addStringFilter();

	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;
}
Ejemplo n.º 3
0
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;
}
Ejemplo n.º 4
0
Poco::JSON::Array::Ptr ChannelInitiatorMapper::inquire()
{
	createCommand(MQCMD_INQUIRE_CHANNEL_INIT);

	// Optional parameters
	addParameter<std::string>(MQCACF_COMMAND_SCOPE, "CommandScope");

	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;

		json->add(createJSON(**it));
	}

	return json;
}
Ejemplo n.º 5
0
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;
}
Ejemplo n.º 6
0
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;
}
Ejemplo n.º 7
0
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;
}