示例#1
0
void QueueStatusController::inquire()
{
	Poco::JSON::Object::Ptr pcfParameters;

	if ( data().has("input") && data().isObject("input") )
	{
		pcfParameters = data().getObject("input");
	}
	else
	{
		pcfParameters = new Poco::JSON::Object();
		setData("input", pcfParameters);

		std::vector<std::string> parameters = getParameters();
		// First parameter is queuemanager
		// Second parameter can be a queuename. If this is passed, the
		// query parameter QName or queueName is ignored.
		if ( parameters.size() > 1 )
		{
			pcfParameters->set("QName", parameters[1]);
		}
		else
		{
			// Handle query parameters
			pcfParameters->set("QName", form().get("QName", "*"));
		}

		pcfParameters->set("ExcludeSystem", form().get("ExcludeSystem", "false").compare("true") == 0);
		pcfParameters->set("ExcludeTemp", form().get("ExcludeTemp", "false").compare("true") == 0);

		if ( form().has("CommandScope") )
		{
			pcfParameters->set("CommandScope", form().get("CommandScope"));
		}
		if ( form().has("QSGDisposition") )
		{
			pcfParameters->set("QSGDisposition", form().get("QSGDisposition"));
		}

		if ( form().has("StatusType") ) pcfParameters->set("StatusType", form().get("StatusType"));
		if ( form().has("OpenType") ) pcfParameters->set("OpenType", form().get("OpenType"));

		handleFilterForm(pcfParameters);

		Poco::JSON::Array::Ptr attrs = new Poco::JSON::Array();
		formElementToJSONArray("QStatusAttrs", attrs);
		if ( attrs->size() == 0 ) // Nothing found for QStatusAttrs, try Attrs
		{
			formElementToJSONArray("Attrs", attrs);
		}
		if ( attrs->size() > 0 )
		{
			pcfParameters->set("QStatusAttrs", attrs);
		}

	}

	QueueStatusInquire command(*commandServer(), pcfParameters);
	setData("data", command.execute());
}
示例#2
0
void ServiceController::inquire()
{
	Poco::JSON::Object::Ptr pcfParameters;

	if ( data().has("filter") && data().isObject("filter") )
	{
		pcfParameters = data().getObject("filter");
	}
	else
	{
		pcfParameters = new Poco::JSON::Object();
		set("filter", pcfParameters);

		std::vector<std::string> parameters = getParameters();
		// First parameter is queuemanager
		// Second parameter can be a servicename. If this is passed
		// the query parameter ServiceName is ignored.
		if ( parameters.size() > 1 )
		{
			pcfParameters->set("ServiceName", parameters[1]);
		}
		else
		{
			// Handle query parameters
			std::string serviceNameField;
			if ( form().has("ServiceName") )
			{
				serviceNameField = form().get("ServiceName");
			}
			else if ( form().has("name") )
			{
				serviceNameField = form().get("name");
			}
			if ( serviceNameField.empty() )
			{
				serviceNameField = "*";
			}
			pcfParameters->set("ServiceName", serviceNameField);
		}

		pcfParameters->set("ExcludeSystem", form().get("ExcludeSystem", "false").compare("true") == 0);

		Poco::JSON::Array::Ptr attrs = new Poco::JSON::Array();
		formElementToJSONArray("ServiceAttrs", attrs);
		if ( attrs->size() == 0 ) // Nothing found for ServiceAttrs, try Attrs
		{
			formElementToJSONArray("Attrs", attrs);
		}
		if ( attrs->size() > 0 )
		{
			pcfParameters->set("ServiceAttrs", attrs);
		}

		handleFilterForm(pcfParameters);
	}

	ServiceMapper mapper(*commandServer(), pcfParameters);
	set("services", mapper.inquire());
}
示例#3
0
void ConnectionController::inquire()
{
	Poco::JSON::Object::Ptr pcfParameters;

	if ( data().has("filter") && data().isObject("filter") )
	{
		pcfParameters = data().getObject("filter");
	}
	else
	{
		pcfParameters = new Poco::JSON::Object();
		set("filter", pcfParameters);

		std::vector<std::string> parameters = getParameters();
		// First parameter is queuemanager
		// Second parameter can be a connection id and will result in inquiring
		// only that connection.
		if ( parameters.size() > 1 )
		{
			pcfParameters->set("ConnectionId", parameters[1]);
		}

		Poco::JSON::Array::Ptr attrs = new Poco::JSON::Array();
		formElementToJSONArray("ConnectionAttrs", attrs);
		if ( attrs->size() == 0 ) // Nothing found for ConnectionAttrs, try Attrs
		{
			formElementToJSONArray("Attrs", attrs);
		}
		if ( attrs->size() > 0 )
		{
			pcfParameters->set("ConnectionAttrs", attrs);
		}

		if ( form().has("CommandScope") )
		{
			pcfParameters->set("CommandScope", form().get("CommandScope"));
		}

		if ( form().has("ConnInfoType") )
		{
			pcfParameters->set("ConnInfoType", form().get("ConnInfoType"));
		}

		if ( form().has("URDisposition") )
		{
			pcfParameters->set("URDisposition", form().get("URDisposition"));
		}

		handleFilterForm(pcfParameters);
	}

	ConnectionMapper mapper(*commandServer(), pcfParameters);
	set("connections", mapper.inquire());
}
示例#4
0
void AuthorityServiceController::inquire()
{
	Poco::JSON::Object::Ptr pcfParameters;

	if ( data().has("filter") && data().isObject("filter") )
	{
		pcfParameters = data().getObject("filter");
		// There is a bug in MQCMD_INQUIRE_AUTH_SERVICE, AuthServiceAttrs is required!
		if ( !pcfParameters->has("AuthServiceAttrs") )
		{
			Poco::JSON::Array::Ptr attrs = new Poco::JSON::Array();
			attrs->add("All");
			pcfParameters->set("AuthServiceAttrs", attrs);
		}
	}
	else
	{
		pcfParameters = new Poco::JSON::Object();
		set("filter", pcfParameters);

		Poco::JSON::Array::Ptr attrs = new Poco::JSON::Array();
		formElementToJSONArray("AuthServiceAttrs", attrs);
		if ( attrs->size() == 0 ) // Nothing found for AuthServiceAttrs, try Attrs
		{
			formElementToJSONArray("Attrs", attrs);
		}
		if ( attrs->size() == 0 ) // Default must be specified for this command!
		{
			attrs->add("All");
		}
		pcfParameters->set("AuthServiceAttrs", attrs);

		if ( form().has("ServiceComponent") )
		{
			pcfParameters->set("ServiceComponent", form().get("ServiceComponent"));
		}

		handleFilterForm(pcfParameters);
	}

	AuthorityServiceMapper mapper(*commandServer(), pcfParameters);
	set("authservices", mapper.inquire());
}
示例#5
0
void ChannelController::inquire()
{
	Poco::JSON::Object::Ptr pcfParameters;

	if ( data().has("input") && data().isObject("input") )
	{
		pcfParameters = data().getObject("input");
	}
	else
	{
		pcfParameters = new Poco::JSON::Object();
		setData("input", pcfParameters);

		std::vector<std::string> parameters = getParameters();
		// First parameter is queuemanager
		// Second parameter can be a channelname. If this is passed
		// the query parameter ChannelName is ignored. A third parameter
		// can be used for setting the channel type. This parameter can also
		// be set using the query parameter ChannelType.
		if ( parameters.size() > 1 )
		{
			pcfParameters->set("ChannelName", parameters[1]);
		}
		else
		{
			// Handle query parameters
			pcfParameters->set("ChannelName", form().get("ChannelName", "*"));
		}

		if ( parameters.size() > 2 )
		{
			pcfParameters->set("ChannelType", parameters[2]);
		}
		else if ( form().has("ChannelType") )
		{
			pcfParameters->set("ChannelType", form().get("ChannelType", "All"));
		}

		pcfParameters->set("ExcludeSystem", form().get("ExcludeSystem", "false").compare("true") == 0);

		Poco::JSON::Array::Ptr attrs = new Poco::JSON::Array();
		formElementToJSONArray("ChannelAttrs", attrs);
		if ( attrs->size() == 0 ) // Nothing found for ChannelAttrs, try Attrs
		{
			formElementToJSONArray("Attrs", attrs);
		}
		if ( attrs->size() > 0 )
		{
			pcfParameters->set("ChannelAttrs", attrs);
		}

		if ( form().has("CommandScope") )
		{
			pcfParameters->set("CommandScope", form().get("CommandScope"));
		}

		if ( form().has("QSGDisposition") )
		{
			pcfParameters->set("QSGDisposition", form().get("QSGDisposition"));
		}

		if ( form().has("DefaultChannelDisposition") )
		{
			pcfParameters->set("DefaultChannelDisposition", form().get("DefaultChannelDisposition"));
		}

		handleFilterForm(pcfParameters);
	}

	ChannelInquire command(*commandServer(), pcfParameters);
	setData("data", command.execute());
}
示例#6
0
void SubscriptionController::inquire()
{
	Poco::JSON::Object::Ptr pcfParameters;

	if ( data().has("input") && data().isObject("input") )
	{
		pcfParameters = data().getObject("input");
	}
	else
	{
		pcfParameters = new Poco::JSON::Object();
		setData("input", pcfParameters);

		std::vector<std::string> parameters = getParameters();
		// First parameter is queuemanager
		// Second parameter can be a subname. If this is passed
		// the query parameter subName is ignored.
		if ( parameters.size() > 1 )
		{
			pcfParameters->set("SubName", parameters[1]);
		}
		else
		{
			// Handle query parameters
			pcfParameters->set("SubName", form().get("SubName", "*"));
		}

		if ( form().has("SubId") )
		{
			pcfParameters->set("SubId", form().get("SubId"));
		}

		if ( form().has("SubscriptionType") )
		{
			pcfParameters->set("SubscriptionType", form().get("SubscriptionType"));
		}

		pcfParameters->set("ExcludeSystem", form().get("ExcludeSystem", "false").compare("true") == 0);

		Poco::JSON::Array::Ptr attrs = new Poco::JSON::Array();
		formElementToJSONArray("SubAttrs", attrs);
		if ( attrs->size() == 0 ) // Nothing found for SubAttrs, try Attrs
		{
			formElementToJSONArray("Attrs", attrs);
		}
		if ( attrs->size() > 0 )
		{
			pcfParameters->set("SubAttrs", attrs);
		}

		if ( form().has("CommandScope") )
		{
			pcfParameters->set("CommandScope", form().get("CommandScope"));
		}

		if ( form().has("Durable") )
		{
			pcfParameters->set("Durable", form().get("Durable"));
		}

		handleFilterForm(pcfParameters);
	}

	SubscriptionInquire command(*commandServer(), pcfParameters);
	setData("data", command.execute());
}
void AuthorityRecordController::inquire()
{
	if ( qmgr()->zos() )
	{
		// Authority records are not supported on z/OS
		setResponseStatus(Poco::Net::HTTPResponse::HTTP_NOT_IMPLEMENTED, "/authrec/inquire not implemented for z/OS");
		return;
	}

	Poco::JSON::Object::Ptr pcfParameters;

	if ( data().has("input") && data().isObject("input") )
	{
		pcfParameters = data().getObject("input");
	}
	else
	{
		pcfParameters = new Poco::JSON::Object();
		setData("input", pcfParameters);

		std::vector<std::string> parameters = getParameters();
		// First parameter is queuemanager
		// Second parameter can be a authentication information name and will result in inquiring
		// only that queue and ignores all query parameters.
		if ( parameters.size() > 1 )
		{
			pcfParameters->set("ProfileName", parameters[1]);
		}
		else
		{
			// Handle query parameters
			if ( form().has("ProfileName") )
			{
				pcfParameters->set("ProfileName", form().get("ProfileName"));
			}
		}

		Poco::JSON::Array::Ptr attrs = new Poco::JSON::Array();
		formElementToJSONArray("ProfileAttrs", attrs);
		if ( attrs->size() == 0 ) // Nothing found for ProfileAttrs, try Attrs
		{
			formElementToJSONArray("Attrs", attrs);
		}
		if ( attrs->size() > 0 )
		{
			pcfParameters->set("ProfileAttrs", attrs);
		}

		Poco::JSON::Array::Ptr jsonOptions = new Poco::JSON::Array();
		pcfParameters->set("Options", jsonOptions);
		for(Poco::Net::NameValueCollection::ConstIterator itOptions = form().find("Options");
			itOptions != form().end() && Poco::icompare(itOptions->first, "Options") == 0;
			++itOptions)
		{
			jsonOptions->add(itOptions->second);
		}

		if ( form().has("ObjectType") ) pcfParameters->set("ObjectType", form().get("ObjectType"));
		if ( form().has("EntityName") ) pcfParameters->set("EntityName", form().get("EntityName"));
		if ( form().has("EntityType") ) pcfParameters->set("EntityType", form().get("EntityType"));
		if ( form().has("ServiceComponent") ) pcfParameters->set("ServiceComponent", form().get("ServiceComponent"));
	}

	AuthorityRecordInquire command(*commandServer(), pcfParameters);
	setData("data", command.execute());
}
示例#8
0
void TopicController::inquire()
{
	Poco::JSON::Object::Ptr pcfParameters;

	if ( data().has("filter") && data().isObject("filter") )
	{
		pcfParameters = data().getObject("filter");
	}
	else
	{
		pcfParameters = new Poco::JSON::Object();
		set("filter", pcfParameters);

		std::vector<std::string> parameters = getParameters();
		// First parameter is queuemanager
		// Second parameter can be a topicname. If this is passed
		// the query parameter topicName is ignored.
		if ( parameters.size() > 1 )
		{
			pcfParameters->set("TopicName", parameters[1]);
		}
		else
		{
			// Handle query parameters
			std::string topicNameField;
			if ( form().has("TopicName") )
			{
				topicNameField = form().get("TopicName");
			}
			else if ( form().has("name") )
			{
				topicNameField = form().get("name");
			}
			if ( topicNameField.empty() )
			{
				topicNameField = "*";
			}
			pcfParameters->set("TopicName", topicNameField);
		}

		pcfParameters->set("ExcludeSystem", form().get("ExcludeSystem", "false").compare("true") == 0);

		if ( form().has("ClusterInfo") )
		{
			std::string clusterInfo = form().get("ClusterInfo");
			pcfParameters->set("ClusterInfo", Poco::icompare(clusterInfo, "true") == 0 ? "true" : "false");
		}

		Poco::JSON::Array::Ptr attrs = new Poco::JSON::Array();
		formElementToJSONArray("TopicAttrs", attrs);
		if ( attrs->size() == 0 ) // Nothing found for TopicAttrs, try Attrs
		{
			formElementToJSONArray("Attrs", attrs);
		}
		if ( attrs->size() > 0 )
		{
			pcfParameters->set("TopicAttrs", attrs);
		}

		if ( form().has("CommandScope") )
		{
			pcfParameters->set("CommandScope", form().get("CommandScope"));
		}

		if ( form().has("QSGDisposition") )
		{
			pcfParameters->set("QSGDisposition", form().get("QSGDisposition"));
		}

		if ( form().has("TopicType") )
		{
			pcfParameters->set("TopicType", form().get("TopicType"));
		}

		handleFilterForm(pcfParameters);
	}

	TopicMapper mapper(*commandServer(), pcfParameters);
	set("topics", mapper.inquire());
}
示例#9
0
void QueueController::inquire()
{
	Poco::JSON::Object::Ptr pcfParameters;

	if ( data().has("input") && data().isObject("input") )
	{
		pcfParameters = data().getObject("input");
	}
	else
	{
		pcfParameters = new Poco::JSON::Object();
		meta().set("input", pcfParameters);

		std::vector<std::string> parameters = getParameters();
		// First parameter is queuemanager
		// Second parameter can be a queuename. If this is passed, the
		// query parameter QName or queueName is ignored.
		if ( parameters.size() > 1 )
		{
			pcfParameters->set("QName", parameters[1]);
		}
		else
		{
			// Handle query parameters
			pcfParameters->set("QName", form().get("QName", "*"));
		}

		if ( form().has("ClusterInfo") )
		{
			std::string clusterInfo = form().get("ClusterInfo");
			pcfParameters->set("ClusterInfo", Poco::icompare(clusterInfo, "true") == 0 ? "true" : "false");
		}

		if ( form().has("ClusterName") )
		{
			pcfParameters->set("ClusterName", form().get("ClusterName"));
		}

		if ( form().has("ClusterNameList") )
		{
			pcfParameters->set("ClusterNamelist", form().get("ClusterNamelist"));
		}

		if ( form().has("CommandScope") )
		{
			pcfParameters->set("CommandScope", form().get("CommandScope"));
		}

		if ( form().has("PageSetId") )
		{
			int pageSetId = 0;
			if ( Poco::NumberParser::tryParse(form().get("PageSetId"), pageSetId) )
			{
				pcfParameters->set("PageSetId", pageSetId);
			}
		}

		if ( form().has("QSGDisposition") )
		{
			pcfParameters->set("QSGDisposition", form().get("QSGDisposition"));
		}

		std::string queueDepthField;
		if ( form().has("CurrentQDepth") )
		{
			queueDepthField = form().get("CurrentQDepth", "");
		}
		else if ( form().has("QueueDepth"))
		{
			queueDepthField = form().get("QueueDepth", "");
		}
		if ( !queueDepthField.empty() )
		{
			int queueDepth = 0;
			if ( Poco::NumberParser::tryParse(queueDepthField, queueDepth) )
			{
				Poco::JSON::Object::Ptr filter = new Poco::JSON::Object();
				filter->set("Parameter", "CurrentQDepth");
				filter->set("Operator", "NLT"); //Not Less##
				filter->set("FilterValue", queueDepth);
				pcfParameters->set("IntegerFilterCommand", filter);
			}
		}

		handleFilterForm(pcfParameters);

		if ( form().has("QueueUsage") )
		{
			pcfParameters->set("Usage", form().get("QueueUsage"));
		}
		else if ( form().has("Usage") )
		{
			pcfParameters->set("Usage", form().get("Usage"));
		}

		if ( form().has("QueueType") )
		{
			pcfParameters->set("QType", form().get("QueueType"));
		}

		pcfParameters->set("ExcludeSystem", form().get("ExcludeSystem", "false").compare("true") == 0);
		pcfParameters->set("ExcludeTemp", form().get("ExcludeTemp", "false").compare("true") == 0);

		Poco::JSON::Array::Ptr attrs = new Poco::JSON::Array();
		formElementToJSONArray("QAttrs", attrs);
		if ( attrs->size() == 0 ) // Nothing found for QAttrs, try Attrs
		{
			formElementToJSONArray("Attrs", attrs);
		}
		if ( attrs->size() > 0 )
		{
			pcfParameters->set("QAttrs", attrs);
		}
	}

	QueueInquire command(*commandServer(), pcfParameters);
	setData("data", command.execute());
}
void AuthenticationInformationController::inquire()
{
    Poco::JSON::Object::Ptr pcfParameters;

    if ( data().has("filter") && data().isObject("filter") )
    {
        pcfParameters = data().getObject("filter");
    }
    else
    {
        pcfParameters = new Poco::JSON::Object();
        set("filter", pcfParameters);

        std::vector<std::string> parameters = getParameters();
        // First parameter is queuemanager
        // Second parameter can be a authentication information name (generic name is allowed)
        if ( parameters.size() > 1 )
        {
            pcfParameters->set("AuthInfoName", parameters[1]);
        }
        else
        {
            // Handle query parameters
            std::string authInfoNameField;
            if ( form().has("AuthInfoName") )
            {
                authInfoNameField = form().get("AuthInfoName");
            }
            else if ( form().has("name") )
            {
                authInfoNameField = form().get("name");
            }
            if ( authInfoNameField.empty() )
            {
                authInfoNameField = "*";
            }
            pcfParameters->set("AuthInfoName", authInfoNameField);
        }

        Poco::JSON::Array::Ptr attrs = new Poco::JSON::Array();
        formElementToJSONArray("AuthInfoAttrs", attrs);
        if ( attrs->size() == 0 ) // Nothing found for AuthInfoAttrs, try Attrs
        {
            formElementToJSONArray("Attrs", attrs);
        }
        if ( attrs->size() > 0 )
        {
            pcfParameters->set("AuthInfoAttrs", attrs);
        }

        if ( form().has("AuthInfoType") )
        {
            pcfParameters->set("AuthInfoType", form().get("AuthInfoType"));
        }

        if ( form().has("CommandScope") )
        {
            pcfParameters->set("CommandScope", form().get("CommandScope"));
        }

        if ( form().has("QSGDisposition") )
        {
            pcfParameters->set("QSGDisposition", form().get("QSGDisposition"));
        }

        pcfParameters->set("ExcludeSystem", form().get("ExcludeSystem", "false").compare("true") == 0);

        handleFilterForm(pcfParameters);
    }

    AuthenticationInformationMapper mapper(*commandServer(), pcfParameters);
    set("authinfos", mapper.inquire());
}