Search in sources :

Example 1 with Parameter

use of org.opennms.protocols.xml.config.Parameter in project opennms by OpenNMS.

the class AbstractXmlCollectionHandler method parseRequest.

/**
     * Parses the request.
     *
     * @param unformattedRequest the unformatted request
     * @param agent the agent
     * @param collectionStep the collection step
     * @param parameters the service parameters
     * @return the request
     * @throws IllegalArgumentException the illegal argument exception
     */
@Override
public Request parseRequest(final NodeDao nodeDao, final Request unformattedRequest, final CollectionAgent agent, final Integer collectionStep, final Map<String, String> parameters) throws IllegalArgumentException {
    if (unformattedRequest == null)
        return null;
    final OnmsNode node = nodeDao.get(agent.getNodeId());
    final Request request = new Request();
    request.setMethod(unformattedRequest.getMethod());
    for (Header header : unformattedRequest.getHeaders()) {
        request.addHeader(header.getName(), parseString(header.getName(), header.getValue(), node, agent.getHostAddress(), collectionStep, parameters));
    }
    for (Parameter param : unformattedRequest.getParameters()) {
        request.addParameter(param.getName(), parseString(param.getName(), param.getValue(), node, agent.getHostAddress(), collectionStep, parameters));
    }
    final Content cnt = unformattedRequest.getContent();
    if (cnt != null)
        request.setContent(new Content(cnt.getType(), parseString("Content", cnt.getData(), node, agent.getHostAddress(), collectionStep, parameters)));
    return request;
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) Header(org.opennms.protocols.xml.config.Header) Content(org.opennms.protocols.xml.config.Content) Request(org.opennms.protocols.xml.config.Request) Parameter(org.opennms.protocols.xml.config.Parameter)

Aggregations

OnmsNode (org.opennms.netmgt.model.OnmsNode)1 Content (org.opennms.protocols.xml.config.Content)1 Header (org.opennms.protocols.xml.config.Header)1 Parameter (org.opennms.protocols.xml.config.Parameter)1 Request (org.opennms.protocols.xml.config.Request)1