Пример #1
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;
}
Пример #2
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;
}
Пример #3
0
void HaluClient::slot_sendJSON()
{
    QByteArray postData = createJSON();
    request.setUrl(url);
    request.setHeader(QNetworkRequest::ContentTypeHeader,"application/json");

//    QMessageBox msgBox;
//    msgBox.setText(QString(postData));
//    msgBox.exec();


    networkManager->post(request,postData);
}
Пример #4
0
Poco::JSON::Array::Ptr QueueManagerPing::execute()
{
	PCFCommand::execute();

	Poco::JSON::Array::Ptr json = new Poco::JSON::Array();

	for(PCF::Vector::const_iterator it = begin(); it != end(); it++)
	{
		if ( (*it)->isExtendedResponse() ) // Skip extended response
			continue;

		Poco::JSON::Object::Ptr data = new Poco::JSON::Object();
		json->add(createJSON(**it));
	}

	return json;
}
Poco::JSON::Array::Ptr ChannelAuthenticationRecordInquire::execute()
{
	PCFCommand::execute();

	Poco::JSON::Array::Ptr json = new Poco::JSON::Array();

	for(PCF::Vector::const_iterator it = begin(); it != 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;
}
Пример #6
0
void wdmSystem::flushEvent()
{
    Poco::Mutex::ScopedLock lock(m_mutex);

    for(event_cont::iterator ei=m_events.begin(); ei!=m_events.end(); ++ei) {
        const wdmEventData e = *ei;
        node_cont::iterator ni = m_nodes.find(e.node);
        if(ni!=m_nodes.end()) {
            ni->second->handleEvent(e.toEvent());
        }
    }
    m_events.clear();

    for(json_cont::iterator ji=m_jsons.begin(); ji!=m_jsons.end(); ++ji) {
        wdmJSONRequest &req = **ji;
        createJSON(*req.json, req.nodes, req.num_nodes);
        req.done = true;
    }
    m_jsons.clear();
}
Пример #7
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;
}
Пример #8
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;
}
Пример #9
0
int main(int argc, char* argv[]){
    std::string fileName;
    try{
        // Check if number of arguments imply a filename has not been passed
        if(argc < 2)
            return -1;
        else
            fileName = argv[1]; // Assume the first argument is the file name
       
        std::vector<Transaction> allTransactions; // Create a vector of Transactions
        parseTransactionFile(allTransactions, fileName); // .. and pass it [default by reference] for parsing
        // std::cout << "Size: " << allTransactions.size() << std::endl;
        
        // Create a JSON file of all retrieved Transactions and pass it to a PHP page to carry out the transaction
        std::string jsonTransactions = createJSON( allTransactions );
        std::cout << jsonTransactions;
        
        return 1;
   }catch(std::exception& e){
       std::cout << "Error encountered: " << e.what() << std::endl;
       return -1;
   }
}
Пример #10
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;
}
Пример #11
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;
}