com.splunk.modularinput
Class InputDefinition

java.lang.Object
  extended by com.splunk.modularinput.InputDefinition

public class InputDefinition
extends java.lang.Object

The InputDefinition class encodes the XML defining inputs that Splunk passes to a modular input script as a Java object.


Method Summary
 void addInput(java.lang.String name, java.util.Collection<Parameter> parameters)
          Adds an input to the set of inputs on this InputDefinition.
 boolean equals(java.lang.Object other)
           
 java.lang.String getCheckpointDir()
          Gets the path to which to write checkpoint files for restarting inputs.
 java.lang.String getField(java.lang.String fieldName)
          Gets the name of the field to fetch.
 java.util.Map<java.lang.String,java.util.Map<java.lang.String,Parameter>> getInputs()
           
 java.lang.String getServerHost()
          Gets the name of the server on which this modular input is being run.
 java.lang.String getServerUri()
          Gets the URI to the server on which this modular input is being run.
 java.lang.String getSessionKey()
          Sets a session providing access to splunkd's REST API on this host.
 int hashCode()
           
static InputDefinition parseDefinition(java.io.InputStream stream)
          Parses a stream containing XML into an InputDefinition.
 void setCheckpointDir(java.lang.String checkpointDir)
          Sets the path to which to write checkpoint files.
 void setServerHost(java.lang.String serverHost)
          Sets the name of the server on which this modular input is being run.
 void setServerUri(java.lang.String serverUri)
          Sets the URI to reach the server on which this modular input is being run.
 void setSessionKey(java.lang.String sessionKey)
          Sets a session key that can be used to access splunkd's REST API.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getField

public java.lang.String getField(java.lang.String fieldName)
Gets the name of the field to fetch. In future versions of Splunk, there may be additional fields on the InputDefinition. getField permits access to them in case you are constrained to an old version of the Splunk SDK for Java.

Parameters:
fieldName - The name of the field to fetch.
Returns:
The field.

setServerHost

public void setServerHost(java.lang.String serverHost)
Sets the name of the server on which this modular input is being run.


getServerHost

public java.lang.String getServerHost()
Gets the name of the server on which this modular input is being run.

Returns:
The name of the server on which this modular input is being run.

setServerUri

public void setServerUri(java.lang.String serverUri)
Sets the URI to reach the server on which this modular input is being run.

Parameters:
serverUri - The URI to reach the server on which this modular input is being run.

getServerUri

public java.lang.String getServerUri()
Gets the URI to the server on which this modular input is being run.

Returns:
The URI to the server on which this modular input is being run.

setCheckpointDir

public void setCheckpointDir(java.lang.String checkpointDir)
Sets the path to which to write checkpoint files.

Parameters:
checkpointDir - The path to which to write checkpoint files.

getCheckpointDir

public java.lang.String getCheckpointDir()
Gets the path to which to write checkpoint files for restarting inputs.

Returns:
The path to which to write checkpoint files for restarting inputs.

setSessionKey

public void setSessionKey(java.lang.String sessionKey)
Sets a session key that can be used to access splunkd's REST API.

Parameters:
sessionKey - A session key that can be used to access splunkd's REST API.

getSessionKey

public java.lang.String getSessionKey()
Sets a session providing access to splunkd's REST API on this host.

Returns:
A session key providing access to splunkd's REST API on this host.

addInput

public void addInput(java.lang.String name,
                     java.util.Collection<Parameter> parameters)
Adds an input to the set of inputs on this InputDefinition.

Parameters:
name - The name of this input (e.g., foobar://this-input-name).
parameters - A collection of Parameter objects giving the settings for this input.

getInputs

public java.util.Map<java.lang.String,java.util.Map<java.lang.String,Parameter>> getInputs()
Returns:
A map of all the inputs specified in this InputDefinition.

parseDefinition

public static InputDefinition parseDefinition(java.io.InputStream stream)
                                       throws javax.xml.parsers.ParserConfigurationException,
                                              java.io.IOException,
                                              org.xml.sax.SAXException,
                                              MalformedDataException
Parses a stream containing XML into an InputDefinition.

Parameters:
stream - The stream containing XML to parse.
Returns:
An InputDefinition object.
Throws:
javax.xml.parsers.ParserConfigurationException - If there are errors in setting up the parser (which indicates system configuration issues).
java.io.IOException - If there is an error in reading from the stream.
org.xml.sax.SAXException - When the XML is invalid.
MalformedDataException - When the XML does specify a valid set of inputs.

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object