commit 3f167bb28e9ca7dc24286bd04d02b4b20d3c8347 Author: Jarred Li Date: Wed Sep 26 13:48:14 2012 +0800 INTEXT-21 Add Splunk adapter For reference see: https://jira.springsource.org/browse/INTEXT-21 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0c7fdb9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.classpath +.project +.settings/ +.gradle +build +target/ +bin/ +derby.log diff --git a/README.md b/README.md new file mode 100644 index 0000000..511b4c0 --- /dev/null +++ b/README.md @@ -0,0 +1,113 @@ +Spring Integration Splunk Adapter +================================================= + +The SI adapter includes Outbound Channel Adapter and Inbound Channel Adapter. + +Inbound channel adapter : +----------------------------------------------------------------------------- +Inbound channel adapter is used to get data out of Splunk and put into +Spring Integration's channel. There are 5 ways to get data out of Splunk: +* Blocking +* Non blocking +* Saved search +* Realtime +* Export + + +### Blocking search: +~~~~~xml + + + +~~~~~ + +### Non blocking search: +~~~~~xml + + + +~~~~~ + +### Saved search: +~~~~~xml + + + +~~~~~ + +### Realtime search: +~~~~~xml + + + +~~~~~ + +### Export: +~~~~~xml + + + +~~~~~ + +Outbound channel adapter: +---------------------------------------------------------------------------------------------- +Outbound channel adapter is used to put data into Splunk from +channels in Spring Integration. There are 3 kinds of method to put data +* REST(submit) +* stream +* tcp + +### Submit: +~~~~~xml + + + +~~~~~ + +### Stream: +~~~~~xml + + + +~~~~~ + +### tcp +~~~~~xml + + + +~~~~~ + + +Development +----------------- +### To build: + + ./gradlew build + +### To generate Eclipse metadata (.classpath and .project files), do the following: + + ./gradlew eclipse + diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..8123c9d --- /dev/null +++ b/build.gradle @@ -0,0 +1,288 @@ +description = 'Spring Integration Splunk Adapter' + +buildscript { + repositories { + maven { url 'http://repo.springsource.org/plugins-snapshot' } + } + dependencies { + classpath 'org.springframework.build.gradle:docbook-reference-plugin:0.1.5' + } +} + +apply plugin: 'java' +apply from: "${rootProject.projectDir}/publish-maven.gradle" +apply plugin: 'eclipse' +apply plugin: 'idea' + +group = 'org.springframework.integration' + +repositories { + maven { url 'http://repo.springsource.org/libs-milestone' } + maven { url 'http://repo.springsource.org/plugins-release' } // for bundlor +} + +sourceCompatibility=1.5 +targetCompatibility=1.5 + +ext { + cglibVersion = '2.2' + junitVersion = '4.8.2' + log4jVersion = '1.2.12' + mockitoVersion = '1.9.0' + springVersion = '3.1.2.RELEASE' + springIntegrationVersion = '2.1.2.RELEASE' + commonsLangVersion = '2.6' + commonsPoolVersion = '1.6' + splunkVersion = '0.8.0' +} + +// See http://www.gradle.org/docs/current/userguide/dependency_management.html#sub:configurations +// and http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.ConfigurationContainer.html +configurations { + jacoco //Configuration Group used by Sonar to provide Code Coverage using JaCoCo +} + +dependencies { + compile("com.splunk:splunk:$splunkVersion") + compile "org.springframework:spring-beans:$springVersion" + compile "org.springframework:spring-context:$springVersion" + compile "org.springframework:spring-expression:$springVersion" + compile "org.springframework.integration:spring-integration-core:$springIntegrationVersion" + compile "commons-lang:commons-lang:$commonsLangVersion" + compile "commons-pool:commons-pool:$commonsPoolVersion" + + testCompile "org.mockito:mockito-all:$mockitoVersion" + testCompile "org.springframework:spring-test:$springVersion" + testCompile "cglib:cglib-nodep:$cglibVersion" + testCompile "junit:junit-dep:$junitVersion" + testCompile "log4j:log4j:$log4jVersion" + testCompile "org.springframework.integration:spring-integration-stream:$springIntegrationVersion" + jacoco group: "org.jacoco", name: "org.jacoco.agent", version: "0.5.6.201201232323", classifier: "runtime" +} + + +eclipse { + project { + natures += 'org.springframework.ide.eclipse.core.springnature' + } +} + +sourceSets { + test { + resources { + srcDirs = ['src/test/resources', 'src/test/java'] + } + } +} + + + +// enable all compiler warnings; individual projects may customize further +ext.xLintArg = '-Xlint:all' +[compileJava, compileTestJava]*.options*.compilerArgs = [xLintArg] + +test { + // suppress all console output during testing unless running `gradle -i` + logging.captureStandardOutput(LogLevel.INFO) + jvmArgs "-javaagent:${configurations.jacoco.asPath}=destfile=${buildDir}/jacoco.exec,includes=*" +} + +task sourcesJar(type: Jar) { + classifier = 'sources' + from sourceSets.main.allJava +} + +task javadocJar(type: Jar) { + classifier = 'javadoc' + from javadoc +} + +artifacts { + archives sourcesJar + archives javadocJar +} + +apply plugin: 'docbook-reference' + +reference { + sourceDir = file('src/reference/docbook') +} + +apply plugin: 'sonar' + +sonar { + + if (rootProject.hasProperty('sonarHostUrl')) { + server.url = rootProject.sonarHostUrl + } + + database { + if (rootProject.hasProperty('sonarJdbcUrl')) { + url = rootProject.sonarJdbcUrl + } + if (rootProject.hasProperty('sonarJdbcDriver')) { + driverClassName = rootProject.sonarJdbcDriver + } + if (rootProject.hasProperty('sonarJdbcUsername')) { + username = rootProject.sonarJdbcUsername + } + if (rootProject.hasProperty('sonarJdbcPassword')) { + password = rootProject.sonarJdbcPassword + } + } + + project { + dynamicAnalysis = "reuseReports" + withProjectProperties { props -> + props["sonar.core.codeCoveragePlugin"] = "jacoco" + props["sonar.jacoco.reportPath"] = "${buildDir.name}/jacoco.exec" + } + } + + logger.info("Sonar parameters used: server.url='${server.url}'; database.url='${database.url}'; database.driverClassName='${database.driverClassName}'; database.username='${database.username}'") +} + +task api(type: Javadoc) { + group = 'Documentation' + description = 'Generates aggregated Javadoc API documentation.' + title = "${rootProject.description} ${version} API" + options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED + options.author = true + options.header = rootProject.description + options.overview = 'src/api/overview.html' + source subprojects.collect { project -> + project.sourceSets.main.allJava + } + destinationDir = new File(buildDir, "api") + classpath = files(subprojects.collect { project -> + project.sourceSets.main.compileClasspath + }) +} + +task schemaZip(type: Zip) { + group = 'Distribution' + classifier = 'schema' + description = "Builds -${classifier} archive containing all " + + "XSDs for deployment at static.springframework.org/schema." + + subprojects.each { subproject -> + def Properties schemas = new Properties(); + def shortName = subproject.name.replaceFirst("${rootProject.name}-", '') + if (subproject.name.endsWith("-core")) { + shortName = '' + } + + subproject.sourceSets.main.resources.find { + it.path.endsWith('META-INF/spring.schemas') + }?.withInputStream { schemas.load(it) } + + for (def key : schemas.keySet()) { + File xsdFile = subproject.sourceSets.main.resources.find { + it.path.endsWith(schemas.get(key)) + } + assert xsdFile != null + into ("integration/${shortName}") { + from xsdFile.path + } + } + } +} + +task docsZip(type: Zip) { + group = 'Distribution' + classifier = 'docs' + description = "Builds -${classifier} archive containing api and reference " + + "for deployment at static.springframework.org/spring-integration/docs." + + from('src/dist') { + include 'changelog.txt' + } + + from (api) { + into 'api' + } + + from (reference) { + into 'reference' + } +} + +task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) { + group = 'Distribution' + classifier = 'dist' + description = "Builds -${classifier} archive, containing all jars and docs, " + + "suitable for community download page." + + ext.baseDir = "${project.name}-${project.version}"; + + from('src/dist') { + include 'readme.txt' + include 'license.txt' + include 'notice.txt' + into "${baseDir}" + } + + from(zipTree(docsZip.archivePath)) { + into "${baseDir}/docs" + } + + from(zipTree(schemaZip.archivePath)) { + into "${baseDir}/schema" + } + + subprojects.each { subproject -> + into ("${baseDir}/libs") { + from subproject.jar + from subproject.sourcesJar + from subproject.javadocJar + } + } +} + +// Create an optional "with dependencies" distribution. +// Not published by default; only for use when building from source. +task depsZip(type: Zip, dependsOn: distZip) { zipTask -> + group = 'Distribution' + classifier = 'dist-with-deps' + description = "Builds -${classifier} archive, containing everything " + + "in the -${distZip.classifier} archive plus all dependencies." + + from zipTree(distZip.archivePath) + + gradle.taskGraph.whenReady { taskGraph -> + if (taskGraph.hasTask(":${zipTask.name}")) { + def projectNames = rootProject.subprojects*.name + def artifacts = new HashSet() + subprojects.each { subproject -> + subproject.configurations.runtime.resolvedConfiguration.resolvedArtifacts.each { artifact -> + def dependency = artifact.moduleVersion.id + if (!projectNames.contains(dependency.name)) { + artifacts << artifact.file + } + } + } + + zipTask.from(artifacts) { + into "${distZip.baseDir}/deps" + } + } + } +} + +artifacts { + archives distZip + archives docsZip + archives schemaZip +} + +task dist(dependsOn: assemble) { + group = 'Distribution' + description = 'Builds -dist, -docs and -schema distribution archives.' +} + +task wrapper(type: Wrapper) { + description = 'Generates gradlew[.bat] scripts' + gradleVersion = '1.2' +} + +defaultTasks 'build' diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..5364470 --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +version=0.5.0.BUILD-SNAPSHOT diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e3b3376 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..5f2266e --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Sep 28 09:33:09 CST 2012 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=http\://services.gradle.org/distributions/gradle-1.2-bin.zip diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..cf12650 --- /dev/null +++ b/gradlew @@ -0,0 +1,164 @@ +#!/bin/bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" +APP_HOME="`pwd -P`" +cd "$SAVED" + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query businessSystem maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..aec9973 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/publish-maven.gradle b/publish-maven.gradle new file mode 100644 index 0000000..d61474b --- /dev/null +++ b/publish-maven.gradle @@ -0,0 +1,60 @@ +apply plugin: 'maven' + +ext.optionalDeps = [] +ext.providedDeps = [] +ext.optional = { optionalDeps << it } +ext.provided = { providedDeps << it } + +install { + repositories.mavenInstaller { + customizePom(pom, project) + } +} + +def customizePom(pom, gradleProject) { + pom.whenConfigured { generatedPom -> + // respect 'optional' and 'provided' dependencies + gradleProject.optionalDeps.each { dep -> + generatedPom.dependencies.find { it.artifactId == dep.name }?.optional = true + } + gradleProject.providedDeps.each { dep -> + generatedPom.dependencies.find { it.artifactId == dep.name }?.scope = 'provided' + } + + // eliminate test-scoped dependencies (no need in maven central poms) + generatedPom.dependencies.removeAll { dep -> + dep.scope == 'test' + } + + // add all items necessary for maven central publication + generatedPom.project { + name = gradleProject.description + description = gradleProject.description + url = 'https://github.com/SpringSource/spring-integration-extensions' + organization { + name = 'SpringSource' + url = 'http://springsource.org' + } + licenses { + license { + name 'The Apache Software License, Version 2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution 'repo' + } + } + scm { + url = 'https://github.com/SpringSource/spring-integration-extensions' + connection = 'scm:git:git://github.com/SpringSource/spring-integration-extensions' + developerConnection = 'scm:git:git://github.com/SpringSource/spring-integration-extensions' + } + + developers { + developer { + id = 'Jarred' + name = 'Jarred Li' + email = 'leejianwei@126.com' + } + } + } + } +} diff --git a/src/api/overview.html b/src/api/overview.html new file mode 100644 index 0000000..fb0198b --- /dev/null +++ b/src/api/overview.html @@ -0,0 +1,22 @@ + + +This document is the API specification for Spring Integration +
+
+

+ For further API reference and developer documentation, see the + Spring + Integration reference documentation. + That documentation contains more detailed, developer-targeted + descriptions, with conceptual overviews, definitions of terms, + workarounds, and working code examples. +

+ +

+ If you are interested in commercial training, consultancy, and + support for Spring Integration, please visit + http://www.springsource.com +

+
+ + diff --git a/src/dist/changelog.txt b/src/dist/changelog.txt new file mode 100644 index 0000000..c78641e --- /dev/null +++ b/src/dist/changelog.txt @@ -0,0 +1,8 @@ +Spring Integration Splunk Adapter CHANGELOG +========================================= + +Features in version 1.0.0 + +1. Inbound channel adapter with 5 different ways to search data: bloking, normal(non-blocking), realtime, export, saved search. + +2. Outbound channel adapter with 3 ways to push event data: Stream, tcp, REST diff --git a/src/dist/license.txt b/src/dist/license.txt new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/src/dist/license.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/src/dist/notice.txt b/src/dist/notice.txt new file mode 100644 index 0000000..f62045a --- /dev/null +++ b/src/dist/notice.txt @@ -0,0 +1,21 @@ + ======================================================================== + == NOTICE file corresponding to section 4 d of the Apache License, == + == Version 2.0, in this case for the Spring Integration distribution. == + ======================================================================== + + This product includes software developed by + the Apache Software Foundation (http://www.apache.org). + + The end-user documentation included with a redistribution, if any, + must include the following acknowledgement: + + "This product includes software developed by the Spring Framework + Project (http://www.springframework.org)." + + Alternatively, this acknowledgement may appear in the software itself, + if and wherever such third-party acknowledgements normally appear. + + The names "Spring", "Spring Framework", and "Spring Integration" must + not be used to endorse or promote products derived from this software + without prior written permission. For written permission, please contact + enquiries@springsource.com. diff --git a/src/dist/readme.txt b/src/dist/readme.txt new file mode 100644 index 0000000..886e33e --- /dev/null +++ b/src/dist/readme.txt @@ -0,0 +1,13 @@ +Spring Integration Splunk Adapter +----------------------------------- + +To find out what has changed since any earlier releases, see 'changelog.txt'. + +Please consult the documentation located within the 'docs/reference' directory +of this release and also visit the official Spring Integration home at +http://www.springsource.org/spring-integration + +There you will find links to the forum, issue tracker, and several other resources. + +See https://github.com/SpringSource/spring-integration#readme for additional +information including instructions on building from source. diff --git a/src/main/java/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParser.java b/src/main/java/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParser.java new file mode 100644 index 0000000..c25d161 --- /dev/null +++ b/src/main/java/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParser.java @@ -0,0 +1,103 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.splunk.config.xml; + +import org.springframework.beans.BeanMetadataElement; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.parsing.BeanComponentDefinition; +import org.springframework.beans.factory.support.BeanDefinitionBuilder; +import org.springframework.beans.factory.xml.ParserContext; +import org.springframework.integration.config.xml.AbstractPollingInboundChannelAdapterParser; +import org.springframework.integration.config.xml.IntegrationNamespaceUtils; +import org.springframework.integration.splunk.inbound.SplunkPollingChannelAdapter; +import org.springframework.integration.splunk.support.ConnectionFactoryFactoryBean; +import org.springframework.integration.splunk.support.SplunkConnectionFactory; +import org.springframework.integration.splunk.support.SplunkDataReader; +import org.springframework.util.StringUtils; +import org.w3c.dom.Element; + +/** + * The Splunk Inbound Channel adapter parser + * + * @author Jarred Li + * @since 1.0 + * + */ +public class SplunkInboundChannelAdapterParser extends AbstractPollingInboundChannelAdapterParser { + + + protected BeanMetadataElement parseSource(Element element, ParserContext parserContext) { + + BeanDefinitionBuilder splunkPollingChannelAdapterBuilder = BeanDefinitionBuilder.genericBeanDefinition(SplunkPollingChannelAdapter.class); + + BeanDefinitionBuilder splunkExecutorBuilder = SplunkParserUtils.getSplunkExecutorBuilder(element, parserContext); + + BeanDefinitionBuilder splunkDataReaderBuilder = BeanDefinitionBuilder.genericBeanDefinition(SplunkDataReader.class); + IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataReaderBuilder, element, "mode"); + String count = element.getAttribute("count"); + if (StringUtils.hasText(count)) { + splunkDataReaderBuilder.addPropertyValue("count", count); + } + + IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataReaderBuilder, element, "fieldList"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataReaderBuilder, element, "search"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataReaderBuilder, element, "savedSearch"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataReaderBuilder, element, "owner"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataReaderBuilder, element, "app"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataReaderBuilder, element, "initEarliestTime"); + + String earliestTime = element.getAttribute("earliestTime"); + if (StringUtils.hasText(earliestTime)) { + splunkDataReaderBuilder.addPropertyValue("earliestTime", earliestTime); + } + + String latestTime = element.getAttribute("latestTime"); + if (StringUtils.hasText(latestTime)) { + splunkDataReaderBuilder.addPropertyValue("latestTime", latestTime); + } + + + BeanDefinitionBuilder connectionFactoryBuilder = BeanDefinitionBuilder.genericBeanDefinition(SplunkConnectionFactory.class); + + String splunkServerBeanName = element.getAttribute("splunk-server-ref"); + if (StringUtils.hasText(splunkServerBeanName)) { + connectionFactoryBuilder.addConstructorArgReference(splunkServerBeanName); + } + + BeanDefinitionBuilder connectionFactoryFactoryBeanBuilder = BeanDefinitionBuilder.genericBeanDefinition(ConnectionFactoryFactoryBean.class); + connectionFactoryFactoryBeanBuilder.addConstructorArgValue(connectionFactoryBuilder.getBeanDefinition()); + connectionFactoryFactoryBeanBuilder.addConstructorArgValue(element.getAttribute("pool-server-connection")); + splunkDataReaderBuilder.addConstructorArgValue(connectionFactoryFactoryBeanBuilder.getBeanDefinition()); + + String channelAdapterId = this.resolveId(element, splunkPollingChannelAdapterBuilder.getRawBeanDefinition(), + parserContext); + String splunkExecutorBeanName = channelAdapterId + ".splunkExecutor"; + String splunkDataReaderBeanName = splunkExecutorBeanName + ".reader"; + + parserContext.registerBeanComponent(new BeanComponentDefinition(splunkDataReaderBuilder.getBeanDefinition(), + splunkDataReaderBeanName)); + splunkExecutorBuilder.addPropertyReference("reader", splunkDataReaderBeanName); + + BeanDefinition splunkExecutorBuilderBeanDefinition = splunkExecutorBuilder.getBeanDefinition(); + parserContext.registerBeanComponent(new BeanComponentDefinition(splunkExecutorBuilderBeanDefinition, + splunkExecutorBeanName)); + + splunkPollingChannelAdapterBuilder.addConstructorArgReference(splunkExecutorBeanName); + + return splunkPollingChannelAdapterBuilder.getBeanDefinition(); + } + +} diff --git a/src/main/java/org/springframework/integration/splunk/config/xml/SplunkNamespaceHandler.java b/src/main/java/org/springframework/integration/splunk/config/xml/SplunkNamespaceHandler.java new file mode 100644 index 0000000..c9789e9 --- /dev/null +++ b/src/main/java/org/springframework/integration/splunk/config/xml/SplunkNamespaceHandler.java @@ -0,0 +1,37 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.splunk.config.xml; + +import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler; + +/** + * The namespace handler for the Splunk namespace + * + * @author Jarred Li + * @since 1.0 + * + */ +public class SplunkNamespaceHandler extends AbstractIntegrationNamespaceHandler { + + /* (non-Javadoc) + * @see org.springframework.beans.factory.xml.NamespaceHandler#init() + */ + public void init() { + registerBeanDefinitionParser("server", new SplunkServerParser()); + this.registerBeanDefinitionParser("inbound-channel-adapter", new SplunkInboundChannelAdapterParser()); + this.registerBeanDefinitionParser("outbound-channel-adapter", new SplunkOutboundChannelAdapterParser()); + } +} diff --git a/src/main/java/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParser.java b/src/main/java/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParser.java new file mode 100644 index 0000000..634e052 --- /dev/null +++ b/src/main/java/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParser.java @@ -0,0 +1,97 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.splunk.config.xml; + +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.parsing.BeanComponentDefinition; +import org.springframework.beans.factory.support.AbstractBeanDefinition; +import org.springframework.beans.factory.support.BeanDefinitionBuilder; +import org.springframework.beans.factory.xml.ParserContext; +import org.springframework.integration.config.xml.AbstractOutboundChannelAdapterParser; +import org.springframework.integration.config.xml.IntegrationNamespaceUtils; +import org.springframework.integration.splunk.outbound.SplunkOutboundChannelAdapter; +import org.springframework.integration.splunk.support.ConnectionFactoryFactoryBean; +import org.springframework.integration.splunk.support.SplunkDataWriter; +import org.springframework.integration.splunk.support.SplunkConnectionFactory; +import org.springframework.util.StringUtils; +import org.w3c.dom.Element; + +/** + * The parser for the Splunk Outbound Channel Adapter. + * + * @author Jarred Li + * @since 1.0 + * + */ +public class SplunkOutboundChannelAdapterParser extends AbstractOutboundChannelAdapterParser { + + @Override + protected boolean shouldGenerateId() { + return false; + } + + @Override + protected boolean shouldGenerateIdAsFallback() { + return true; + } + + @Override + protected AbstractBeanDefinition parseConsumer(Element element, ParserContext parserContext) { + + BeanDefinitionBuilder splunkOutboundChannelAdapterBuilder = BeanDefinitionBuilder.genericBeanDefinition(SplunkOutboundChannelAdapter.class); + BeanDefinitionBuilder splunkExecutorBuilder = SplunkParserUtils.getSplunkExecutorBuilder(element, parserContext); + + BeanDefinitionBuilder splunkDataWriterBuilder = BeanDefinitionBuilder.genericBeanDefinition(SplunkDataWriter.class); + IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataWriterBuilder, element, "sourceType"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataWriterBuilder, element, "source"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataWriterBuilder, element, "index"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataWriterBuilder, element, "ingest"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataWriterBuilder, element, "tcpPort"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataWriterBuilder, element, "host"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataWriterBuilder, element, "hostRegex"); + BeanDefinitionBuilder connectionFactoryBuilder = BeanDefinitionBuilder.genericBeanDefinition(SplunkConnectionFactory.class); + + String splunkServerBeanName = element.getAttribute("splunk-server-ref"); + if (StringUtils.hasText(splunkServerBeanName)) { + connectionFactoryBuilder.addConstructorArgReference(splunkServerBeanName); + } + + BeanDefinitionBuilder connectionFactoryFactoryBeanBuilder = BeanDefinitionBuilder.genericBeanDefinition(ConnectionFactoryFactoryBean.class); + connectionFactoryFactoryBeanBuilder.addConstructorArgValue(connectionFactoryBuilder.getBeanDefinition()); + connectionFactoryFactoryBeanBuilder.addConstructorArgValue(element.getAttribute("pool-server-connection")); + splunkDataWriterBuilder.addConstructorArgValue(connectionFactoryFactoryBeanBuilder.getBeanDefinition()); + + String channelAdapterId = this.resolveId(element, splunkOutboundChannelAdapterBuilder.getRawBeanDefinition(), + parserContext); + String splunkExecutorBeanName = channelAdapterId + ".splunkExecutor"; + String splunkDataWriterBeanName = splunkExecutorBeanName + ".writer"; + + parserContext.registerBeanComponent(new BeanComponentDefinition(splunkDataWriterBuilder.getBeanDefinition(), + splunkDataWriterBeanName)); + splunkExecutorBuilder.addPropertyReference("writer", splunkDataWriterBeanName); + + BeanDefinition splunkExecutorBuilderBeanDefinition = splunkExecutorBuilder.getBeanDefinition(); + parserContext.registerBeanComponent(new BeanComponentDefinition(splunkExecutorBuilderBeanDefinition, + splunkExecutorBeanName)); + + splunkOutboundChannelAdapterBuilder.addConstructorArgReference(splunkExecutorBeanName); + splunkOutboundChannelAdapterBuilder.addPropertyValue("producesReply", Boolean.FALSE); + + return splunkOutboundChannelAdapterBuilder.getBeanDefinition(); + + } + +} diff --git a/src/main/java/org/springframework/integration/splunk/config/xml/SplunkParserUtils.java b/src/main/java/org/springframework/integration/splunk/config/xml/SplunkParserUtils.java new file mode 100644 index 0000000..53cdc7e --- /dev/null +++ b/src/main/java/org/springframework/integration/splunk/config/xml/SplunkParserUtils.java @@ -0,0 +1,60 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.splunk.config.xml; + +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.support.BeanDefinitionBuilder; +import org.springframework.beans.factory.xml.ParserContext; +import org.springframework.integration.splunk.support.SplunkExecutor; +import org.springframework.util.Assert; +import org.w3c.dom.Element; + +/** + * Contains various utility methods for parsing Splunk Adapter + * specific namesspace elements as well as for the generation of the + * respective {@link BeanDefinition}s. + * + * @author Jarred Li + * @since 1.0 + * + */ +public final class SplunkParserUtils { + + /** Prevent instantiation. */ + private SplunkParserUtils() { + throw new AssertionError(); + } + + /** + * Create a new {@link BeanDefinitionBuilder} for the class {@link SplunkExecutor}. + * Initialize the wrapped {@link SplunkExecutor} with common properties. + * + * @param element Must not be null + * @param parserContext Must not be null + * @return The BeanDefinitionBuilder for the SplunkExecutor + */ + public static BeanDefinitionBuilder getSplunkExecutorBuilder(final Element element, final ParserContext parserContext) { + + Assert.notNull(element, "The provided element must not be null."); + Assert.notNull(parserContext, "The provided parserContext must not be null."); + + final BeanDefinitionBuilder splunkExecutorBuilder = BeanDefinitionBuilder.genericBeanDefinition(SplunkExecutor.class); + + return splunkExecutorBuilder; + + } + +} diff --git a/src/main/java/org/springframework/integration/splunk/config/xml/SplunkServerParser.java b/src/main/java/org/springframework/integration/splunk/config/xml/SplunkServerParser.java new file mode 100644 index 0000000..cca86e0 --- /dev/null +++ b/src/main/java/org/springframework/integration/splunk/config/xml/SplunkServerParser.java @@ -0,0 +1,63 @@ +/* + * Copyright 2011-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.splunk.config.xml; + +import org.springframework.beans.factory.support.BeanDefinitionBuilder; +import org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser; +import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate; +import org.springframework.beans.factory.xml.ParserContext; +import org.springframework.integration.config.xml.IntegrationNamespaceUtils; +import org.springframework.integration.splunk.entity.SplunkServer; +import org.w3c.dom.Element; + +/** + * Splunk server element parser. + * + * The XML element is like this: + *
+ * {@code
+ * 
+ * }
+ *
+ * @author Jarred Li
+ * @since 1.0
+ *
+ */
+public class SplunkServerParser extends AbstractSimpleBeanDefinitionParser {
+
+	@Override
+	public Class getBeanClass(Element element) {
+		return SplunkServer.class;
+	}
+
+	@Override
+	protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
+		super.doParse(element, parserContext, builder);
+		IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element,
+				BeanDefinitionParserDelegate.SCOPE_ATTRIBUTE);
+		IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "host");
+		IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "port");
+		IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "scheme");
+		IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "app");
+		IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "owner");
+		IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "userName");
+		IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "password");
+
+	}
+
+
+}
diff --git a/src/main/java/org/springframework/integration/splunk/config/xml/package-info.java b/src/main/java/org/springframework/integration/splunk/config/xml/package-info.java
new file mode 100644
index 0000000..696859c
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/config/xml/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Provides parser classes to provide Xml namespace support for the Splunk components.
+ */
+package org.springframework.integration.splunk.config.xml;
diff --git a/src/main/java/org/springframework/integration/splunk/core/Connection.java b/src/main/java/org/springframework/integration/splunk/core/Connection.java
new file mode 100644
index 0000000..eebcffe
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/core/Connection.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2011-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.splunk.core;
+
+
+/**
+ * Connection to Splunk service
+ *
+ * @author Jarred Li
+ * @since 1.0
+ *
+ */
+public interface Connection {
+
+	T getTarget();
+
+	void close();
+
+	boolean isOpen();
+
+}
diff --git a/src/main/java/org/springframework/integration/splunk/core/ConnectionFactory.java b/src/main/java/org/springframework/integration/splunk/core/ConnectionFactory.java
new file mode 100644
index 0000000..d69ccdc
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/core/ConnectionFactory.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2011-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.splunk.core;
+
+/**
+ * Factory pattern to create Connection
+ *
+ * @author Jarred Li
+ * @since 1.0
+ *
+ */
+public interface ConnectionFactory {
+
+	Connection getConnection() throws Exception;
+
+}
diff --git a/src/main/java/org/springframework/integration/splunk/core/DataReader.java b/src/main/java/org/springframework/integration/splunk/core/DataReader.java
new file mode 100644
index 0000000..aef7b68
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/core/DataReader.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2011-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.splunk.core;
+
+import java.util.List;
+
+import org.springframework.integration.splunk.entity.SplunkData;
+
+/**
+ * Data reader to read Splunk data from the service.
+ *
+ * @author Jarred Li
+ * @since 1.0
+ */
+public interface DataReader {
+
+	List search() throws Exception;
+
+}
diff --git a/src/main/java/org/springframework/integration/splunk/core/DataWriter.java b/src/main/java/org/springframework/integration/splunk/core/DataWriter.java
new file mode 100644
index 0000000..69154b5
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/core/DataWriter.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2011-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.splunk.core;
+
+import org.springframework.integration.splunk.entity.SplunkData;
+
+/**
+ * Data writer to write Splunk data into Splunk
+ *
+ * @author Jarred Li
+ * @since 1.0
+ *
+ */
+public interface DataWriter {
+
+	void write(SplunkData data) throws Exception;
+
+}
diff --git a/src/main/java/org/springframework/integration/splunk/core/package-info.java b/src/main/java/org/springframework/integration/splunk/core/package-info.java
new file mode 100644
index 0000000..158ac78
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/core/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Provides core classes of the Splunk module.
+ */
+package org.springframework.integration.splunk.core;
diff --git a/src/main/java/org/springframework/integration/splunk/entity/SplunkData.java b/src/main/java/org/springframework/integration/splunk/entity/SplunkData.java
new file mode 100644
index 0000000..782f806
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/entity/SplunkData.java
@@ -0,0 +1,2274 @@
+/*
+ * Copyright 2011-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.splunk.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Map;
+
+import org.apache.commons.lang.time.FastDateFormat;
+
+/**
+ * Splunk data entity
+ *
+ * @author Jarred Li
+ * @author Damien Dallimore damien@dtdsoftware.com
+ * @since 1.0
+ *
+ */
+public class SplunkData implements Serializable {
+
+	private static final long serialVersionUID = -7369254824093658523L;
+
+
+	private Map eventData;
+
+	/**
+	 * Contents of the event message
+	 */
+	private StringBuffer eventMessage;
+
+	/**
+	 * Whether or not to put quotes around values
+	 */
+	private boolean quoteValues = true;
+
+	/**
+	 * Whether or not to add a date to the event string
+	 */
+	private boolean useInternalDate = true;
+
+	/**
+	 * default key value delimiter
+	 */
+	private static final String KVDELIM = "=";
+	/**
+	 * default pair delimiter
+	 */
+	private static final String PAIRDELIM = " ";
+	/**
+	 * default quote char
+	 */
+	private static final char QUOTE = '"';
+	/**
+	 * default date format is using internal generated date
+	 */
+	private static final String DATEFORMATPATTERN = "yyyy-MM-dd HH:mm:ss:SSSZ";
+	/**
+	 * Date Formatter instance
+	 */
+	private static FastDateFormat DATEFORMATTER = FastDateFormat.getInstance(DATEFORMATPATTERN);
+
+	/**
+	 * Event prefix fields
+	 */
+	private static final String PREFIX_NAME = "name";
+	private static final String PREFIX_EVENT_ID = "event_id";
+
+	/**
+	 * Java Throwable type fields
+	 */
+	private static final String THROWABLE_CLASS = "throwable_class";
+	private static final String THROWABLE_MESSAGE = "throwable_message";
+	private static final String THROWABLE_STACKTRACE_ELEMENTS = "stacktrace_elements";
+
+	/**
+	 * Splunk Common Information Model(CIM) Fields
+	 */
+
+	// ------------------
+	// Account management
+	// ------------------
+
+	/**
+	 * The domain containing the user that is affected by the account management
+	 * event.
+	 */
+	public static String AC_MANAGEMENT_DEST_NT_DOMAIN = "dest_nt_domain";
+	/**
+	 * Description of the account management change performed.
+	 */
+	public static String AC_MANAGEMENT_SIGNATURE = "signature";
+	/**
+	 * The NT source of the destination. In the case of an account management
+	 * event, this is the domain that contains the user that generated the
+	 * event.
+	 */
+	public static String AC_MANAGEMENT_SRC_NT_DOMAIN = "src_nt_domain";
+
+	// ----------------------------------
+	// Authentication - Access protection
+	// ----------------------------------
+
+	/**
+	 * The action performed on the resource. success, failure
+	 */
+	public static String AUTH_ACTION = "action";
+	/**
+	 * The application involved in the event (such as ssh, spunk, win:local).
+	 */
+	public static String AUTH_APP = "app";
+	/**
+	 * The target involved in the authentication. If your field is named
+	 * dest_host, dest_ip, dest_ipv6, or dest_nt_host you can alias it as dest
+	 * to make it CIM-compliant.
+	 */
+	public static String AUTH_DEST = "dest";
+	/**
+	 * The source involved in the authentication. In the case of endpoint
+	 * protection authentication the src is the client. If your field is named
+	 * src_host, src_ip, src_ipv6, or src_nt_host you can alias it as src to
+	 * make it CIM-compliant.. It is required for all events dealing with
+	 * endpoint protection (Authentication, change analysis, malware, system
+	 * center, and update). Note: Do not confuse this with the event source or
+	 * sourcetype fields.
+	 */
+	public static String AUTH_SRC = "src";
+	/**
+	 * In privilege escalation events, src_user represents the user who
+	 * initiated the privilege escalation.
+	 */
+	public static String AUTH_SRC_USER = "src_user";
+	/**
+	 * The name of the user involved in the event, or who initiated the event.
+	 * For authentication privilege escalation events this should represent the
+	 * user targeted by the escalation.
+	 */
+	public static String AUTH_USER = "user";
+
+	// ----------------------------------
+	// Change analysis - Endpoint protection
+	// ----------------------------------
+
+	/**
+	 * The action performed on the resource.
+	 */
+	public static String CHANGE_ENDPOINT_PROTECTION_ACTION = "action";
+	/**
+	 * The type of change discovered in the change analysis event.
+	 */
+	public static String CHANGE_ENDPOINT_PROTECTION_CHANGE_TYPE = "change_type";
+	/**
+	 * The host that was affected by the change. If your field is named
+	 * dest_host,dest_ip,dest_ipv6, or dest_nt_host you can alias it as dest to
+	 * make it CIM-compliant.
+	 */
+	public static String CHANGE_ENDPOINT_PROTECTION_DEST = "dest";
+	/**
+	 * The hash signature of the modified resource.
+	 */
+	public static String CHANGE_ENDPOINT_PROTECTION_HASH = "hash";
+	/**
+	 * The group ID of the modified resource.
+	 */
+	public static String CHANGE_ENDPOINT_PROTECTION_GID = "gid";
+	/**
+	 * Indicates whether or not the modified resource is a directory.
+	 */
+	public static String CHANGE_ENDPOINT_PROTECTION_ISDR = "isdr";
+	/**
+	 * The permissions mode of the modified resource.
+	 */
+	public static String CHANGE_ENDPOINT_PROTECTION_MODE = "mode";
+	/**
+	 * The modification time of the modified resource.
+	 */
+	public static String CHANGE_ENDPOINT_PROTECTION_MODTIME = "modtime";
+	/**
+	 * The file path of the modified resource.
+	 */
+	public static String CHANGE_ENDPOINT_PROTECTION_PATH = "path";
+	/**
+	 * The size of the modified resource.
+	 */
+	public static String CHANGE_ENDPOINT_PROTECTION_SIZE = "size";
+	/**
+	 * The user ID of the modified resource.
+	 */
+	public static String CHANGE_ENDPOINT_PROTECTION_UID = "uid";
+
+	// ----------------------------------
+	// Change analysis - Network protection
+	// ----------------------------------
+
+	/**
+	 * The type of change observed.
+	 */
+	public static String CHANGE_NETWORK_PROTECTION_ACTION = "action";
+	/**
+	 * The command that initiated the change.
+	 */
+	public static String CHANGE_NETWORK_PROTECTION_COMMAND = "command";
+	/**
+	 * The device that is directly affected by the change.
+	 */
+	public static String CHANGE_NETWORK_PROTECTION_DVC = "dvc";
+	/**
+	 * The user that initiated the change.
+	 */
+	public static String CHANGE_NETWORK_PROTECTION_USER = "user";
+
+	// ----------------------------------
+	// Common event fields
+	// ----------------------------------
+
+	/**
+	 * A device-specific classification provided as part of the event.
+	 */
+	public static String COMMON_CATEGORY = "category";
+	/**
+	 * A device-specific classification provided as part of the event.
+	 */
+	public static String COMMON_COUNT = "count";
+	/**
+	 * The free-form description of a particular event.
+	 */
+	public static String COMMON_DESC = "desc";
+	/**
+	 * The name of a given DHCP pool on a DHCP server.
+	 */
+	public static String COMMON_DHCP_POOL = "dhcp_pool";
+	/**
+	 * The amount of time the event lasted.
+	 */
+	public static String COMMON_DURATION = "duration";
+	/**
+	 * The fully qualified domain name of the device transmitting or recording
+	 * the log record.
+	 */
+	public static String COMMON_DVC_HOST = "dvc_host";
+	/**
+	 * The IPv4 address of the device reporting the event.
+	 */
+	public static String COMMON_DVC_IP = "dvc_ip";
+	/**
+	 * The IPv6 address of the device reporting the event.
+	 */
+	public static String COMMON_DVC_IP6 = "dvc_ip6";
+	/**
+	 * The free-form description of the device's physical location.
+	 */
+	public static String COMMON_DVC_LOCATION = "dvc_location";
+	/**
+	 * The MAC (layer 2) address of the device reporting the event.
+	 */
+	public static String COMMON_DVC_MAC = "dvc_mac";
+	/**
+	 * The Windows NT domain of the device recording or transmitting the event.
+	 */
+	public static String COMMON_DVC_NT_DOMAIN = "dvc_nt_domain";
+	/**
+	 * The Windows NT host name of the device recording or transmitting the
+	 * event.
+	 */
+	public static String COMMON_DVC_NT_HOST = "dvc_nt_host";
+	/**
+	 * Time at which the device recorded the event.
+	 */
+	public static String COMMON_DVC_TIME = "dvc_time";
+	/**
+	 * The event's specified end time.
+	 */
+	public static String COMMON_END_TIME = "end_time";
+	/**
+	 * A unique identifier that identifies the event. This is unique to the
+	 * reporting device.
+	 */
+	public static String COMMON_EVENT_ID = "event_id";
+	/**
+	 * The length of the datagram, event, message, or packet.
+	 */
+	public static String COMMON_LENGTH = "length";
+	/**
+	 * The log-level that was set on the device and recorded in the event.
+	 */
+	public static String COMMON_LOG_LEVEL = "log_level";
+	/**
+	 * The name of the event as reported by the device. The name should not
+	 * contain information that's already being parsed into other fields from
+	 * the event, such as IP addresses.
+	 */
+	public static String COMMON_NAME = "name";
+	/**
+	 * An integer assigned by the device operating system to the process
+	 * creating the record.
+	 */
+	public static String COMMON_PID = "pid";
+	/**
+	 * An environment-specific assessment of the event's importance, based on
+	 * elements such as event severity, business function of the affected
+	 * system, or other locally defined variables.
+	 */
+	public static String COMMON_PRIORITY = "priority";
+	/**
+	 * The product that generated the event.
+	 */
+	public static String COMMON_PRODUCT = "product";
+	/**
+	 * The version of the product that generated the event.
+	 */
+	public static String COMMON_PRODUCT_VERSION = "product_version";
+	/**
+	 * The result root cause, such as connection refused, timeout, crash, and so
+	 * on.
+	 */
+	public static String COMMON_REASON = "reason";
+	/**
+	 * The action result. Often is a binary choice: succeeded and failed,
+	 * allowed and denied, and so on.
+	 */
+	public static String COMMON_RESULT = "result";
+	/**
+	 * The severity (or priority) of an event as reported by the originating
+	 * device.
+	 */
+	public static String COMMON_SEVERITY = "severity";
+	/**
+	 * The event's specified start time.
+	 */
+	public static String COMMON_START_TIME = "start_time";
+	/**
+	 * The transaction identifier.
+	 */
+	public static String COMMON_TRANSACTION_ID = "transaction_id";
+	/**
+	 * A uniform record locator (a web address, in other words) included in a
+	 * record.
+	 */
+	public static String COMMON_URL = "url";
+	/**
+	 * The vendor who made the product that generated the event.
+	 */
+	public static String COMMON_VENDOR = "vendor";
+
+	// ----------------------------------
+	// DNS protocol
+	// ----------------------------------
+
+	/**
+	 * The DNS domain that has been queried.
+	 */
+	public static String DNS_DEST_DOMAIN = "dest_domain";
+	/**
+	 * The remote DNS resource record being acted upon.
+	 */
+	public static String DNS_DEST_RECORD = "dest_record";
+	/**
+	 * The DNS zone that is being received by the slave as part of a zone
+	 * transfer.
+	 */
+	public static String DNS_DEST_ZONE = "dest_zone";
+	/**
+	 * The DNS resource record class.
+	 */
+	public static String DNS_RECORD_CLASS = "record_class";
+	/**
+	 * The DNS resource record type.
+	 *
+	 * @see see
+	 *      this Wikipedia article on DNS record types
+	 */
+	public static String DNS_RECORD_TYPE = "record_type";
+	/**
+	 * The local DNS domain that is being queried.
+	 */
+	public static String DNS_SRC_DOMAIN = "src_domain";
+	/**
+	 * The local DNS resource record being acted upon.
+	 */
+	public static String DNS_SRC_RECORD = "src_record";
+	/**
+	 * The DNS zone that is being transferred by the master as part of a zone
+	 * transfer.
+	 */
+	public static String DNS_SRC_ZONE = "src_zone";
+
+	// ----------------------------------
+	// Email tracking
+	// ----------------------------------
+
+	/**
+	 * The person to whom an email is sent.
+	 */
+	public static String EMAIL_RECIPIENT = "recipient";
+	/**
+	 * The person responsible for sending an email.
+	 */
+	public static String EMAIL_SENDER = "sender";
+	/**
+	 * The email subject line.
+	 */
+	public static String EMAIL_SUBJECT = "subject";
+
+	// ----------------------------------
+	// File management
+	// ----------------------------------
+
+	/**
+	 * The time the file (the object of the event) was accessed.
+	 */
+	public static String FILE_ACCESS_TIME = "file_access_time";
+	/**
+	 * The time the file (the object of the event) was created.
+	 */
+	public static String FILE_CREATE_TIME = "file_create_time";
+	/**
+	 * A cryptographic identifier assigned to the file object affected by the
+	 * event.
+	 */
+	public static String FILE_HASH = "file_hash";
+	/**
+	 * The time the file (the object of the event) was altered.
+	 */
+	public static String FILE_MODIFY_TIME = "file_modify_time";
+	/**
+	 * The name of the file that is the object of the event (without location
+	 * information related to local file or directory structure).
+	 */
+	public static String FILE_NAME = "file_name";
+	/**
+	 * The location of the file that is the object of the event, in terms of
+	 * local file and directory structure.
+	 */
+	public static String FILE_PATH = "file_path";
+	/**
+	 * Access controls associated with the file affected by the event.
+	 */
+	public static String FILE_PERMISSION = "file_permission";
+	/**
+	 * The size of the file that is the object of the event. Indicate whether
+	 * Bytes, KB, MB, GB.
+	 */
+	public static String FILE_SIZE = "file_size";
+
+	// ----------------------------------
+	// Intrusion detection
+	// ----------------------------------
+
+	/**
+	 * The category of the triggered signature.
+	 */
+	public static String INTRUSION_DETECTION_CATEGORY = "category";
+	/**
+	 * The destination of the attack detected by the intrusion detection system
+	 * (IDS). If your field is named dest_host, dest_ip, dest_ipv6, or
+	 * dest_nt_host you can alias it as dest to make it CIM-compliant.
+	 */
+	public static String INTRUSION_DETECTION_DEST = "dest";
+	/**
+	 * The device that detected the intrusion event.
+	 */
+	public static String INTRUSION_DETECTION_DVC = "dvc";
+	/**
+	 * The type of IDS that generated the event.
+	 */
+	public static String INTRUSION_DETECTION_IDS_TYPE = "ids_type";
+	/**
+	 * The product name of the vendor technology generating network protection
+	 * data, such as IDP, Providentia, and ASA.
+	 *
+	 * Note: Required for all events dealing with network protection (Change
+	 * analysis, proxy, malware, intrusion detection, packet filtering, and
+	 * vulnerability).
+	 */
+	public static String INTRUSION_DETECTION_PRODUCT = "product";
+	/**
+	 * The severity of the network protection event (such as critical, high,
+	 * medium, low, or informational).
+	 *
+	 * Note: This field is a string. Please use a severity_id field for severity
+	 * ID fields that are integer data types.
+	 */
+	public static String INTRUSION_DETECTION_SEVERITY = "severity";
+	/**
+	 * The name of the intrusion detected on the client (the src), such as
+	 * PlugAndPlay_BO and JavaScript_Obfuscation_Fre.
+	 */
+	public static String INTRUSION_DETECTION_SIGNATURE = "signature";
+	/**
+	 * The source involved in the attack detected by the IDS. If your field is
+	 * named src_host, src_ip, src_ipv6, or src_nt_host you can alias it as src
+	 * to make it CIM-compliant.
+	 */
+	public static String INTRUSION_DETECTION_SRC = "src";
+	/**
+	 * The user involved with the intrusion detection event.
+	 */
+	public static String INTRUSION_DETECTION_USER = "user";
+	/**
+	 * The vendor technology used to generate network protection data, such as
+	 * IDP, Providentia, and ASA.
+	 *
+	 * Note: Required for all events dealing with network protection (Change
+	 * analysis, proxy, malware, intrusion detection, packet filtering, and
+	 * vulnerability).
+	 */
+	public static String INTRUSION_DETECTION_VENDOR = "vendor";
+
+	// ----------------------------------
+	// Malware - Endpoint protection
+	// ----------------------------------
+
+	/**
+	 * The outcome of the infection
+	 */
+	public static String MALWARE_ENDPOINT_PROTECTION_ACTION = "action";
+	/**
+	 * The NT domain of the destination (the dest_bestmatch).
+	 */
+	public static String MALWARE_ENDPOINT_PROTECTION_DEST_NT_DOMAIN = "dest_nt_domain";
+	/**
+	 * The cryptographic hash of the file associated with the malware event
+	 * (such as the malicious or infected file).
+	 */
+	public static String MALWARE_ENDPOINT_PROTECTION_FILE_HASH = "file_hash";
+	/**
+	 * The name of the file involved in the malware event (such as the infected
+	 * or malicious file).
+	 */
+	public static String MALWARE_ENDPOINT_PROTECTION_FILE_NAME = "file_name";
+	/**
+	 * The path of the file involved in the malware event (such as the infected
+	 * or malicious file).
+	 */
+	public static String MALWARE_ENDPOINT_PROTECTION_FILE_PATH = "file_path";
+	/**
+	 * The product name of the vendor technology (the vendor field) that is
+	 * generating malware data (such as Antivirus or EPO).
+	 */
+	public static String MALWARE_ENDPOINT_PROTECTION_PRODUCT = "product";
+	/**
+	 * The product version number of the vendor technology installed on the
+	 * client (such as 10.4.3 or 11.0.2).
+	 */
+	public static String MALWARE_ENDPOINT_PROTECTION_PRODUCT_VERSION = "product_version";
+	/**
+	 * The name of the malware infection detected on the client (the src), such
+	 * as Trojan.Vundo,Spyware.Gaobot,W32.Nimbda).
+	 *
+	 * Note: This field is a string. Please use a signature_id field for
+	 * signature ID fields that are integer data types.
+	 */
+	public static String MALWARE_ENDPOINT_PROTECTION_SIGNATURE = "signature";
+	/**
+	 * The current signature definition set running on the client, such as
+	 * 11hsvx)
+	 */
+	public static String MALWARE_ENDPOINT_PROTECTION_SIGNATURE_VERSION = "signature_version";
+	/**
+	 * The target affected or infected by the malware. If your field is named
+	 * dest_host, dest_ip, dest_ipv6, or dest_nt_host you can alias it as dest
+	 * to make it CIM-compliant.
+	 */
+	public static String MALWARE_ENDPOINT_PROTECTION_DEST = "dest";
+	/**
+	 * The NT domain of the source (the src).
+	 */
+	public static String MALWARE_ENDPOINT_PROTECTION_SRC_NT_DOMAIN = "src_nt_domain";
+	/**
+	 * The name of the user involved in the malware event.
+	 */
+	public static String MALWARE_ENDPOINT_PROTECTION_USER = "user";
+	/**
+	 * The name of the vendor technology generating malware data, such as
+	 * Symantec or McAfee.
+	 */
+	public static String MALWARE_ENDPOINT_PROTECTION_VENDOR = "vendor";
+
+	// ----------------------------------
+	// Malware - Network protection
+	// ----------------------------------
+
+	/**
+	 * The product name of the vendor technology generating network protection
+	 * data, such as IDP, Proventia, and ASA.
+	 *
+	 * Note: Required for all events dealing with network protection (Change
+	 * analysis, proxy, malware, intrusion detection, packet filtering, and
+	 * vulnerability).
+	 */
+	public static String MALWARE_NETWORK_PROTECTION_PRODUCT = "product";
+	/**
+	 * The severity of the network protection event (such as critical, high,
+	 * medium, low, or informational).
+	 *
+	 * Note: This field is a string. Please use a severity_id field for severity
+	 * ID fields that are integer data types.
+	 */
+	public static String MALWARE_NETWORK_PROTECTION_SEVERITY = "severity";
+	/**
+	 * The vendor technology used to generate network protection data, such as
+	 * IDP, Proventia, and ASA.
+	 *
+	 * Note: Required for all events dealing with network protection (Change
+	 * analysis, proxy, malware, intrusion detection, packet filtering, and
+	 * vulnerability).
+	 */
+	public static String MALWARE_NETWORK_PROTECTION_VENDOR = "vendor";
+
+	// ----------------------------------
+	// Network traffic - ESS
+	// ----------------------------------
+
+	/**
+	 * The action of the network traffic.
+	 */
+	public static String NETWORK_TRAFFIC_ESS_ACTION = "action";
+	/**
+	 * The destination port of the network traffic.
+	 */
+	public static String NETWORK_TRAFFIC_ESS_DEST_PORT = "dest_port";
+	/**
+	 * The product name of the vendor technology generating NetworkProtection
+	 * data, such as IDP, Proventia, and ASA.
+	 *
+	 * Note: Required for all events dealing with network protection (Change
+	 * analysis, proxy, malware, intrusion detection, packet filtering, and
+	 * vulnerability).
+	 */
+	public static String NETWORK_TRAFFIC_ESS_PRODUCT = "product";
+	/**
+	 * The source port of the network traffic.
+	 */
+	public static String NETWORK_TRAFFIC_ESS_SRC_PORT = "src_port";
+	/**
+	 * The vendor technology used to generate NetworkProtection data, such as
+	 * IDP, Proventia, and ASA.
+	 *
+	 * Note: Required for all events dealing with network protection (Change
+	 * analysis, proxy, malware, intrusion detection, packet filtering, and
+	 * vulnerability).
+	 */
+	public static String NETWORK_TRAFFIC_ESS_VENDOR = "vendor";
+
+	// ----------------------------------
+	// Network traffic - Generic
+	// ----------------------------------
+
+	/**
+	 * The ISO layer 7 (application layer) protocol, such as HTTP, HTTPS, SSH,
+	 * and IMAP.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_APP_LAYER = "app_layer";
+	/**
+	 * How many bytes this device/interface received.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_BYTES_IN = "bytes_in";
+	/**
+	 * How many bytes this device/interface transmitted.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_BYTES_OUT = "bytes_out";
+	/**
+	 * 802.11 channel number used by a wireless network.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_CHANNEL = "channel";
+	/**
+	 * The Common Vulnerabilities and Exposures (CVE) reference value.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_CVE = "cve";
+	/**
+	 * The destination application being targeted.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_DEST_APP = "dest_app";
+	/**
+	 * The destination command and control service channel.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_DEST_CNC_CHANNEL = "dest_cnc_channel";
+	/**
+	 * The destination command and control service name.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_DEST_CNC_NAME = "dest_cnc_name";
+	/**
+	 * The destination command and control service port.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_DEST_CNC_PORT = "dest_cnc_port";
+	/**
+	 * The country associated with a packet's recipient.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_DEST_COUNTRY = "dest_country";
+	/**
+	 * The fully qualified host name of a packet's recipient. For HTTP sessions,
+	 * this is the host header.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_DEST_HOST = "dest_host";
+	/**
+	 * The interface that is listening remotely or receiving packets locally.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_DEST_INT = "dest_int";
+	/**
+	 * The IPv4 address of a packet's recipient.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_DEST_IP = "dest_ip";
+	/**
+	 * The IPv6 address of a packet's recipient.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_DEST_IPV6 = "dest_ipv6";
+	/**
+	 * The (physical) latitude of a packet's destination.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_DEST_LAT = "dest_lat";
+	/**
+	 * The (physical) longitude of a packet's destination.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_DEST_LONG = "dest_long";
+	/**
+	 * The destination TCP/IP layer 2 Media Access Control (MAC) address of a
+	 * packet's destination.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_DEST_MAC = "dest_mac";
+	/**
+	 * The Windows NT domain containing a packet's destination.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_DEST_NT_DOMAIN = "dest_nt_domain";
+	/**
+	 * The Windows NT host name of a packet's destination.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_DEST_NT_HOST = "dest_nt_host";
+	/**
+	 * TCP/IP port to which a packet is being sent.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_DEST_PORT = "dest_port";
+	/**
+	 * The NATed IPv4 address to which a packet has been sent.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_DEST_TRANSLATED_IP = "dest_translated_ip";
+	/**
+	 * The NATed port to which a packet has been sent.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_DEST_TRANSLATED_PORT = "dest_translated_port";
+	/**
+	 * The numbered Internet Protocol version.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_IP_VERSION = "ip_version";
+	/**
+	 * The network interface through which a packet was transmitted.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_OUTBOUND_INTERFACE = "outbound_interface";
+	/**
+	 * How many packets this device/interface received.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_PACKETS_IN = "packets_in";
+	/**
+	 * How many packets this device/interface transmitted.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_PACKETS_OUT = "packets_out";
+	/**
+	 * The OSI layer 3 (Network Layer) protocol, such as IPv4/IPv6, ICMP, IPsec,
+	 * IGMP or RIP.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_PROTO = "proto";
+	/**
+	 * The session identifier. Multiple transactions build a session.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_SESSION_ID = "session_id";
+	/**
+	 * The 802.11 service set identifier (ssid) assigned to a wireless session.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_SSID = "ssid";
+	/**
+	 * The country from which the packet was sent.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_SRC_COUNTRY = "src_country";
+	/**
+	 * The fully qualified host name of the system that transmitted the packet.
+	 * For Web logs, this is the HTTP client.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_SRC_HOST = "src_host";
+	/**
+	 * The interface that is listening locally or sending packets remotely.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_SRC_INT = "src_int";
+	/**
+	 * The IPv4 address of the packet's source. For Web logs, this is the http
+	 * client.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_SRC_IP = "src_ip";
+	/**
+	 * The IPv6 address of the packet's source.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_SRC_IPV6 = "src_ipv6";
+	/**
+	 * The (physical) latitude of the packet's source.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_SRC_LAT = "src_lat";
+	/**
+	 * The (physical) longitude of the packet's source.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_SRC_LONG = "src_long";
+	/**
+	 * The Media Access Control (MAC) address from which a packet was
+	 * transmitted.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_SRC_MAC = "src_mac";
+	/**
+	 * The Windows NT domain containing the machines that generated the event.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_SRC_NT_DOMAIN = "src_nt_domain";
+	/**
+	 * The Windows NT hostname of the system that generated the event.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_SRC_NT_HOST = "src_nt_host";
+	/**
+	 * The network port from which a packet originated.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_SRC_PORT = "src_port";
+	/**
+	 * The NATed IPv4 address from which a packet has been sent.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_SRC_TRANSLATED_IP = "src_translated_ip";
+	/**
+	 * The NATed network port from which a packet has been sent.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_SRC_TRANSLATED_PORT = "src_translated_port";
+	/**
+	 * The application, process, or OS subsystem that generated the event.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_SYSLOG_ID = "syslog_id";
+	/**
+	 * The criticality of an event, as recorded by UNIX syslog.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_SYSLOG_PRIORITY = "syslog_priority";
+	/**
+	 * The TCP flag(s) specified in the event.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_TCP_FLAG = "tcp_flag";
+	/**
+	 * The hex bit that specifies TCP 'type of service'
+	 *
+	 * @see Type of
+	 *      Service
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_TOS = "tos";
+	/**
+	 * The transport protocol.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_TRANSPORT = "transport";
+	/**
+	 * The "time to live" of a packet or datagram.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_TTL = "ttl";
+	/**
+	 * The numeric identifier assigned to the virtual local area network (VLAN)
+	 * specified in the record.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_VLAN_ID = "vlan_id";
+	/**
+	 * The name assigned to the virtual local area network (VLAN) specified in
+	 * the record.
+	 */
+	public static String NETWORK_TRAFFIC_GENERIC_VLAN_NAME = "vlan_name";
+
+	// ----------------------------------
+	// Packet filtering
+	// ----------------------------------
+
+	/**
+	 * The action the filtering device (the dvc_bestmatch field) performed on
+	 * the communication.
+	 */
+	public static String PACKET_FILTERING_ACTION = "action";
+	/**
+	 * The IP port of the packet's destination, such as 22.
+	 */
+	public static String PACKET_FILTERING_DEST_PORT = "dest_port";
+	/**
+	 * The direction the packet is traveling.
+	 */
+	public static String PACKET_FILTERING_DIRECTION = "direction";
+	/**
+	 * The name of the packet filtering device. If your field is named dvc_host,
+	 * dvc_ip, or dvc_nt_host you can alias it as dvc to make it CIM-compliant.
+	 */
+	public static String PACKET_FILTERING_DVC = "dvc";
+	/**
+	 * The rule which took action on the packet, such as 143.
+	 */
+	public static String PACKET_FILTERING_RULE = "rule";
+	/**
+	 * The IP port of the packet's source, such as 34541.
+	 */
+	public static String PACKET_FILTERING_SVC_PORT = "svc_port";
+
+	// ----------------------------------
+	// Proxy
+	// ----------------------------------
+
+	/**
+	 * The action taken by the proxy.
+	 */
+	public static String PROXY_ACTION = "action";
+	/**
+	 * The destination of the network traffic (the remote host).
+	 */
+	public static String PROXY_DEST = "dest";
+	/**
+	 * The content-type of the requested HTTP resource.
+	 */
+	public static String PROXY_HTTP_CONTENT_TYPE = "http_content_type";
+	/**
+	 * The HTTP method used to request the resource.
+	 */
+	public static String PROXY_HTTP_METHOD = "http_method";
+	/**
+	 * The HTTP referrer used to request the HTTP resource.
+	 */
+	public static String PROXY_HTTP_REFER = "http_refer";
+	/**
+	 * The HTTP response code.
+	 */
+	public static String PROXY_HTTP_RESPONSE = "http_response";
+	/**
+	 * The user agent used to request the HTTP resource.
+	 */
+	public static String PROXY_HTTP_USER_AGENT = "http_user_agent";
+	/**
+	 * The product name of the vendor technology generating Network Protection
+	 * data, such as IDP, Providentia, and ASA.
+	 */
+	public static String PROXY_PRODUCT = "product";
+	/**
+	 * The source of the network traffic (the client requesting the connection).
+	 */
+	public static String PROXY_SRC = "src";
+	/**
+	 * The HTTP response code indicating the status of the proxy request.
+	 */
+	public static String PROXY_STATUS = "status";
+	/**
+	 * The user that requested the HTTP resource.
+	 */
+	public static String PROXY_USER = "user";
+	/**
+	 * The URL of the requested HTTP resource.
+	 */
+	public static String PROXY_URL = "url";
+	/**
+	 * The vendor technology generating Network Protection data, such as IDP,
+	 * Providentia, and ASA.
+	 */
+	public static String PROXY_VENDOR = "vendor";
+
+	// ----------------------------------
+	// System center
+	// ----------------------------------
+
+	/**
+	 * The running application or service on the system (the src field), such as
+	 * explorer.exe or sshd.
+	 */
+	public static String SYSTEM_CENTER_APP = "app";
+	/**
+	 * The amount of disk space available per drive or mount (the mount field)
+	 * on the system (the src field).
+	 */
+	public static String SYSTEM_CENTER_FREEMBYTES = "FreeMBytes";
+	/**
+	 * The version of operating system installed on the host (the src field),
+	 * such as 6.0.1.4 or 2.6.27.30-170.2.82.fc10.x86_64.
+	 */
+	public static String SYSTEM_CENTER_KERNEL_RELEASE = "kernel_release";
+	/**
+	 * Human-readable version of the SystemUptime value.
+	 */
+	public static String SYSTEM_CENTER_LABEL = "label";
+	/**
+	 * The drive or mount reporting available disk space (the FreeMBytes field)
+	 * on the system (the src field).
+	 */
+	public static String SYSTEM_CENTER_MOUNT = "mount";
+	/**
+	 * The name of the operating system installed on the host (the src), such as
+	 * Microsoft Windows Server 2003 or GNU/Linux).
+	 */
+	public static String SYSTEM_CENTER_OS = "os";
+	/**
+	 * The percentage of processor utilization.
+	 */
+	public static String SYSTEM_CENTER_PERCENTPROCESSORTIME = "PercentProcessorTime";
+	/**
+	 * The setlocaldefs setting from the SE Linux configuration.
+	 */
+	public static String SYSTEM_CENTER_SETLOCALDEFS = "setlocaldefs";
+	/**
+	 * Values from the SE Linux configuration file.
+	 */
+	public static String SYSTEM_CENTER_SELINUX = "selinux";
+	/**
+	 * The SE Linux type (such as targeted).
+	 */
+	public static String SYSTEM_CENTER_SELINUXTYPE = "selinuxtype";
+	/**
+	 * The shell provided to the User Account (the user field) upon logging into
+	 * the system (the src field).
+	 */
+	public static String SYSTEM_CENTER_SHELL = "shell";
+	/**
+	 * The TCP/UDP source port on the system (the src field).
+	 */
+	public static String SYSTEM_CENTER_SRC_PORT = "src_port";
+	/**
+	 * The sshd protocol version.
+	 */
+	public static String SYSTEM_CENTER_SSHD_PROTOCOL = "sshd_protocol";
+	/**
+	 * The start mode of the given service.
+	 */
+	public static String SYSTEM_CENTER_STARTMODE = "Startmode";
+	/**
+	 * The number of seconds since the system (the src) has been "up."
+	 */
+	public static String SYSTEM_CENTER_SYSTEMUPTIME = "SystemUptime";
+	/**
+	 * The total amount of available memory on the system (the src).
+	 */
+	public static String SYSTEM_CENTER_TOTALMBYTES = "TotalMBytes";
+	/**
+	 * The amount of used memory on the system (the src).
+	 */
+	public static String SYSTEM_CENTER_USEDMBYTES = "UsedMBytes";
+	/**
+	 * The User Account present on the system (the src).
+	 */
+	public static String SYSTEM_CENTER_USER = "user";
+	/**
+	 * The number of updates the system (the src) is missing.
+	 */
+	public static String SYSTEM_CENTER_UPDATES = "updates";
+
+	// ----------------------------------
+	// Traffic
+	// ----------------------------------
+
+	/**
+	 * The destination of the network traffic. If your field is named dest_host,
+	 * dest_ip, dest_ipv6, or dest_nt_host you can alias it as dest to make it
+	 * CIM-compliant.
+	 */
+	public static String TRAFFIC_DEST = "dest";
+	/**
+	 * The name of the packet filtering device. If your field is named dvc_host,
+	 * dvc_ip, or dvc_nt_host you can alias it as dvc to make it CIM-compliant.
+	 */
+	public static String TRAFFIC_DVC = "dvc";
+	/**
+	 * The source of the network traffic. If your field is named src_host,
+	 * src_ip, src_ipv6, or src_nt_host you can alias it as src to make it
+	 * CIM-compliant.
+	 */
+	public static String TRAFFIC_SRC = "src";
+
+	// ----------------------------------
+	// Update
+	// ----------------------------------
+
+	/**
+	 * The name of the installed update.
+	 */
+	public static String UPDATE_PACKAGE = "package";
+
+	// ----------------------------------
+	// User information updates
+	// ----------------------------------
+
+	/**
+	 * A user that has been affected by a change. For example, user fflanda
+	 * changed the name of user rhallen, so affected_user=rhallen.
+	 */
+	public static String USER_INFO_UPDATES_AFFECTED_USER = "affected_user";
+	/**
+	 * The user group affected by a change.
+	 */
+	public static String USER_INFO_UPDATES_AFFECTED_USER_GROUP = "affected_user_group";
+	/**
+	 * The identifier of the user group affected by a change.
+	 */
+	public static String USER_INFO_UPDATES_AFFECTED_USER_GROUP_ID = "affected_user_group_id";
+	/**
+	 * The identifier of the user affected by a change.
+	 */
+	public static String USER_INFO_UPDATES_AFFECTED_USER_ID = "affected_user_id";
+	/**
+	 * The security context associated with the user affected by a change.
+	 */
+	public static String USER_INFO_UPDATES_AFFECTED_USER_PRIVILEGE = "affected_user_privilege";
+	/**
+	 * The name of the user affected by the recorded event.
+	 */
+	public static String USER_INFO_UPDATES_USER = "user";
+	/**
+	 * A user group that is the object of an event, expressed in human-readable
+	 * terms.
+	 */
+	public static String USER_INFO_UPDATES_USER_GROUP = "user_group";
+	/**
+	 * The numeric identifier assigned to the user group event object.
+	 */
+	public static String USER_INFO_UPDATES_USER_GROUP_ID = "user_group_id";
+	/**
+	 * The system-assigned identifier for the user affected by an event.
+	 */
+	public static String USER_INFO_UPDATES_USER_ID = "user_id";
+	/**
+	 * The security context associated with the object of an event (the affected
+	 * user).
+	 */
+	public static String USER_INFO_UPDATES_USER_PRIVILEGE = "user_privilege";
+	/**
+	 * The name of the user that is the subject of an event--the user executing
+	 * the action, in other words.
+	 */
+	public static String USER_INFO_UPDATES_USER_SUBJECT = "user_subject";
+	/**
+	 * The ID number of the user that is the subject of an event.
+	 */
+	public static String USER_INFO_UPDATES_USER_SUBJECT_ID = "user_subject_id";
+	/**
+	 * The security context associated with the subject of an event (the user
+	 * causing a change).
+	 */
+	public static String USER_INFO_UPDATES_USER_SUBJECT_PRIVILEGE = "user_subject_privilege";
+
+	// ----------------------------------
+	// Vulnerability
+	// ----------------------------------
+
+	/**
+	 * The category of the discovered vulnerability.
+	 */
+	public static String VULNERABILITY_CATEGORY = "category";
+	/**
+	 * The host with the discovered vulnerability. If your field is named
+	 * dest_host, dest_ip, dest_ipv6, or dest_nt_host you can alias it as dest
+	 * to make it CIM-compliant.
+	 */
+	public static String VULNERABILITY_DEST = "dest";
+	/**
+	 * The operating system of the host containing the vulnerability detected on
+	 * the client (the src field), such as SuSE Security Update, or cups
+	 * security update.
+	 */
+	public static String VULNERABILITY_OS = "os";
+	/**
+	 * The severity of the discovered vulnerability.
+	 */
+	public static String VULNERABILITY_SEVERITY = "severity";
+	/**
+	 * The name of the vulnerability detected on the client (the src field),
+	 * such as SuSE Security Update, or cups security update.
+	 */
+	public static String VULNERABILITY_SIGNATURE = "signature";
+
+	// ----------------------------------
+	// Windows administration
+	// ----------------------------------
+
+	/**
+	 * The object name (associated only with Windows).
+	 */
+	public static String WINDOWS_ADMIN_OBJECT_NAME = "object_name";
+	/**
+	 * The object type (associated only with Windows).
+	 */
+	public static String WINDOWS_ADMIN_OBJECT_TYPE = "object_type";
+	/**
+	 * The object handle (associated only with Windows).
+	 */
+	public static String WINDOWS_ADMIN_OBJECT_HANDLE = "object_handle";
+
+
+	public SplunkData(Map data) {
+		this.eventMessage = new StringBuffer();
+		this.eventData = data;
+		for (String key : data.keySet()) {
+			this.addPair(key, data.get(key));
+		}
+	}
+
+	/**
+	 * Constructor.
+	 *
+	 * @param eventName
+	 *            the event name
+	 * @param eventID
+	 *            the event id
+	 * @param useInternalDate
+	 *            Whether or not to add a date to the event string
+	 * @param quoteValues
+	 *            Whether or not to put quotes around values
+	 */
+	public SplunkData(String eventName, String eventID, boolean useInternalDate, boolean quoteValues) {
+
+		this.eventMessage = new StringBuffer();
+		this.quoteValues = quoteValues;
+		this.useInternalDate = useInternalDate;
+
+		addPair(PREFIX_NAME, eventName);
+		addPair(PREFIX_EVENT_ID, eventID);
+	}
+
+	/**
+	 * Constructor.Will add internally generated date and put quotes around
+	 * values.
+	 *
+	 * @param eventName
+	 *            the event name
+	 * @param eventID
+	 *            the event ID
+	 */
+	public SplunkData(String eventName, String eventID) {
+
+		this(eventName, eventID, true, true);
+	}
+
+	/**
+	 * Default constructor
+	 */
+	public SplunkData() {
+		this.eventMessage = new StringBuffer();
+	}
+
+	/**
+	 * Simple shallow cloning method
+	 */
+	public SplunkData clone() {
+		SplunkData clone = new SplunkData();
+		clone.quoteValues = this.quoteValues;
+		clone.useInternalDate = this.useInternalDate;
+		clone.eventMessage.append(this.eventMessage);
+
+		return clone;
+	}
+
+
+	public Map getEventData() {
+		return eventData;
+	}
+
+	/**
+	 * Add a key value pair
+	 *
+	 * @param key
+	 * @param value
+	 */
+	public void addPair(String key, char value) {
+		addPair(key, String.valueOf(value));
+	}
+
+	/**
+	 * Add a key value pair
+	 *
+	 * @param key
+	 * @param value
+	 */
+	public void addPair(String key, boolean value) {
+		addPair(key, String.valueOf(value));
+	}
+
+	/**
+	 * Add a key value pair
+	 *
+	 * @param key
+	 * @param value
+	 */
+	public void addPair(String key, double value) {
+		addPair(key, String.valueOf(value));
+	}
+
+	/**
+	 * Add a key value pair
+	 *
+	 * @param key
+	 * @param value
+	 */
+	public void addPair(String key, long value) {
+		addPair(key, String.valueOf(value));
+	}
+
+	/**
+	 * Add a key value pair
+	 *
+	 * @param key
+	 * @param value
+	 */
+	public void addPair(String key, int value) {
+		addPair(key, String.valueOf(value));
+	}
+
+	/**
+	 * Add a key value pair
+	 *
+	 * @param key
+	 * @param value
+	 */
+	public void addPair(String key, Object value) {
+		addPair(key, value.toString());
+	}
+
+	/**
+	 * Utility method for formatting Throwable,Error,Exception objects in a more
+	 * linear and Splunk friendly manner than printStackTrace
+	 *
+	 * @param throwable
+	 *            the Throwable object to add to the event
+	 */
+	public void addThrowable(Throwable throwable) {
+
+		addThrowableObject(throwable, -1);
+	}
+
+	/**
+	 * Utility method for formatting Throwable,Error,Exception objects in a more
+	 * linear and Splunk friendly manner than printStackTrace
+	 *
+	 * @param throwable
+	 *            the Throwable object to add to the event
+	 * @param stackTraceDepth
+	 *            maximum number of stacktrace elements to log
+	 */
+	public void addThrowable(Throwable throwable, int stackTraceDepth) {
+
+		addThrowableObject(throwable, stackTraceDepth);
+	}
+
+	/**
+	 * Internal private method for formatting Throwable,Error,Exception objects
+	 * in a more linear and Splunk friendly manner than printStackTrace
+	 *
+	 * @param throwable
+	 *            the Throwable object to add to the event
+	 * @param stackTraceDepth
+	 *            maximum number of stacktrace elements to log, -1 for all
+	 */
+
+	private void addThrowableObject(Throwable throwable, int stackTraceDepth) {
+
+		addPair(THROWABLE_CLASS, throwable.getClass().getCanonicalName());
+		addPair(THROWABLE_MESSAGE, throwable.getMessage());
+		StackTraceElement[] elements = throwable.getStackTrace();
+		StringBuffer sb = new StringBuffer();
+		int depth = 0;
+		for (StackTraceElement element : elements) {
+			depth++;
+			if (stackTraceDepth == -1 || stackTraceDepth >= depth)
+				sb.append(element.toString()).append(",");
+			else
+				break;
+
+		}
+		addPair(THROWABLE_STACKTRACE_ELEMENTS, sb.toString());
+	}
+
+	/**
+	 * Add a key value pair
+	 *
+	 * @param key
+	 * @param value
+	 */
+	public void addPair(String key, String value) {
+
+		if (quoteValues)
+			this.eventMessage.append(key).append(KVDELIM).append(QUOTE).append(value).append(QUOTE).append(PAIRDELIM);
+		else
+			this.eventMessage.append(key).append(KVDELIM).append(value).append(PAIRDELIM);
+
+	}
+
+	@Override
+	/**
+	 * return the completed event message
+	 */
+	public String toString() {
+
+		String event = "";
+
+		if (useInternalDate) {
+			StringBuffer clonedMessage = new StringBuffer();
+			clonedMessage.append(DATEFORMATTER.format(new Date())).append(PAIRDELIM).append(this.eventMessage);
+			event = clonedMessage.toString();
+		}
+		else
+			event = eventMessage.toString();
+		// trim off trailing pair delim char(s)
+		return event.substring(0, event.length() - PAIRDELIM.length());
+	}
+
+	public void setAcManagementDestNtDomain(String acManagementDestNtDomain) {
+		addPair(AC_MANAGEMENT_DEST_NT_DOMAIN, acManagementDestNtDomain);
+	}
+
+	public void setAcManagementSignature(String acManagementSignature) {
+		addPair(AC_MANAGEMENT_SIGNATURE, acManagementSignature);
+	}
+
+	public void setAcManagementSrcNtDomain(String acManagementSrcNtDomain) {
+		addPair(AC_MANAGEMENT_SRC_NT_DOMAIN, acManagementSrcNtDomain);
+	}
+
+	public void setAuthAction(String authAction) {
+		addPair(AUTH_ACTION, authAction);
+	}
+
+	public void setAuthApp(String authApp) {
+		addPair(AUTH_APP, authApp);
+	}
+
+	public void setAuthDest(String authDest) {
+		addPair(AUTH_DEST, authDest);
+	}
+
+	public void setAuthSrc(String authSrc) {
+		addPair(AUTH_SRC, authSrc);
+	}
+
+	public void setAuthSrcUser(String authSrcUser) {
+		addPair(AUTH_SRC_USER, authSrcUser);
+	}
+
+	public void setAuthUser(String authUser) {
+		addPair(AUTH_USER, authUser);
+	}
+
+	public void setChangeEndpointProtectionAction(String changeEndpointProtectionAction) {
+		addPair(CHANGE_ENDPOINT_PROTECTION_ACTION, changeEndpointProtectionAction);
+	}
+
+	public void setChangeEndpointProtectionChangeType(String changeEndpointProtectionChangeType) {
+		addPair(CHANGE_ENDPOINT_PROTECTION_CHANGE_TYPE, changeEndpointProtectionChangeType);
+	}
+
+	public void setChangeEndpointProtectionDest(String changeEndpointProtectionDest) {
+		addPair(CHANGE_ENDPOINT_PROTECTION_DEST, changeEndpointProtectionDest);
+	}
+
+	public void setChangeEndpointProtectionHash(String changeEndpointProtectionHash) {
+		addPair(CHANGE_ENDPOINT_PROTECTION_HASH, changeEndpointProtectionHash);
+	}
+
+	public void setChangeEndpointProtectionGid(long changeEndpointProtectionGid) {
+		addPair(CHANGE_ENDPOINT_PROTECTION_GID, changeEndpointProtectionGid);
+	}
+
+	public void setChangeEndpointProtectionIsdr(boolean changeEndpointProtectionIsdr) {
+		addPair(CHANGE_ENDPOINT_PROTECTION_ISDR, changeEndpointProtectionIsdr);
+	}
+
+	public void setChangeEndpointProtectionMode(long changeEndpointProtectionMode) {
+		addPair(CHANGE_ENDPOINT_PROTECTION_MODE, changeEndpointProtectionMode);
+	}
+
+	public void setChangeEndpointProtectionModtime(String changeEndpointProtectionModtime) {
+		addPair(CHANGE_ENDPOINT_PROTECTION_MODTIME, changeEndpointProtectionModtime);
+	}
+
+	public void setChangeEndpointProtectionPath(String changeEndpointProtectionPath) {
+		addPair(CHANGE_ENDPOINT_PROTECTION_PATH, changeEndpointProtectionPath);
+	}
+
+	public void setChangeEndpointProtectionSize(long changeEndpointProtectionSize) {
+		addPair(CHANGE_ENDPOINT_PROTECTION_SIZE, changeEndpointProtectionSize);
+	}
+
+	public void setChangeEndpointProtectionUid(long changeEndpointProtectionUid) {
+		addPair(CHANGE_ENDPOINT_PROTECTION_UID, changeEndpointProtectionUid);
+	}
+
+	public void setChangeNetworkProtectionAction(String changeNetworkProtectionAction) {
+		addPair(CHANGE_NETWORK_PROTECTION_ACTION, changeNetworkProtectionAction);
+	}
+
+	public void setChangeNetworkProtectionCommand(String changeNetworkProtectionCommand) {
+		addPair(CHANGE_NETWORK_PROTECTION_COMMAND, changeNetworkProtectionCommand);
+	}
+
+	public void setChangeNetworkProtectionDvc(String changeNetworkProtectionDvc) {
+		addPair(CHANGE_NETWORK_PROTECTION_DVC, changeNetworkProtectionDvc);
+	}
+
+	public void setChangeNetworkProtectionUser(String changeNetworkProtectionUser) {
+		addPair(CHANGE_NETWORK_PROTECTION_USER, changeNetworkProtectionUser);
+	}
+
+	public void setCommonCategory(String commonCategory) {
+		addPair(COMMON_CATEGORY, commonCategory);
+	}
+
+	public void setCommonCount(String commonCount) {
+		addPair(COMMON_COUNT, commonCount);
+	}
+
+	public void setCommonDesc(String commonDesc) {
+		addPair(COMMON_DESC, commonDesc);
+	}
+
+	public void setCommonDhcpPool(String commonDhcpPool) {
+		addPair(COMMON_DHCP_POOL, commonDhcpPool);
+	}
+
+	public void setCommonDuration(long commonDuration) {
+		addPair(COMMON_DURATION, commonDuration);
+	}
+
+	public void setCommonDvcHost(String commonDvcHost) {
+		addPair(COMMON_DVC_HOST, commonDvcHost);
+	}
+
+	public void setCommonDvcIp(String commonDvcIp) {
+		addPair(COMMON_DVC_IP, commonDvcIp);
+	}
+
+	public void setCommonDvcIp6(String commonDvcIp6) {
+		addPair(COMMON_DVC_IP6, commonDvcIp6);
+	}
+
+	public void setCommonDvcLocation(String commonDvcLocation) {
+		addPair(COMMON_DVC_LOCATION, commonDvcLocation);
+	}
+
+	public void setCommonDvcMac(String commonDvcMac) {
+		addPair(COMMON_DVC_MAC, commonDvcMac);
+	}
+
+	public void setCommonDvcNtDomain(String commonDvcNtDomain) {
+		addPair(COMMON_DVC_NT_DOMAIN, commonDvcNtDomain);
+	}
+
+	public void setCommonDvcNtHost(String commonDvcNtHost) {
+		addPair(COMMON_DVC_NT_HOST, commonDvcNtHost);
+	}
+
+	public void setCommonDvcTime(long commonDvcTime) {
+		addPair(COMMON_DVC_TIME, commonDvcTime);
+	}
+
+	public void setCommonEndTime(long commonEndTime) {
+		addPair(COMMON_END_TIME, commonEndTime);
+	}
+
+	public void setCommonEventId(long commonEventId) {
+		addPair(COMMON_EVENT_ID, commonEventId);
+	}
+
+	public void setCommonLength(long commonLength) {
+		addPair(COMMON_LENGTH, commonLength);
+	}
+
+	public void setCommonLogLevel(String commonLogLevel) {
+		addPair(COMMON_LOG_LEVEL, commonLogLevel);
+	}
+
+	public void setCommonName(String commonName) {
+		addPair(COMMON_NAME, commonName);
+	}
+
+	public void setCommonPid(long commonPid) {
+		addPair(COMMON_PID, commonPid);
+	}
+
+	public void setCommonPriority(long commonPriority) {
+		addPair(COMMON_PRIORITY, commonPriority);
+	}
+
+	public void setCommonProduct(String commonProduct) {
+		addPair(COMMON_PRODUCT, commonProduct);
+	}
+
+	public void setCommonProductVersion(long commonProductVersion) {
+		addPair(COMMON_PRODUCT_VERSION, commonProductVersion);
+	}
+
+	public void setCommonReason(String commonReason) {
+		addPair(COMMON_REASON, commonReason);
+	}
+
+	public void setCommonResult(String commonResult) {
+		addPair(COMMON_RESULT, commonResult);
+	}
+
+	public void setCommonSeverity(String commonSeverity) {
+		addPair(COMMON_SEVERITY, commonSeverity);
+	}
+
+	public void setCommonStartTime(long commonStartTime) {
+		addPair(COMMON_START_TIME, commonStartTime);
+	}
+
+	public void setCommonTransactionId(String commonTransactionId) {
+		addPair(COMMON_TRANSACTION_ID, commonTransactionId);
+	}
+
+	public void setCommonUrl(String commonUrl) {
+		addPair(COMMON_URL, commonUrl);
+	}
+
+	public void setCommonVendor(String commonVendor) {
+		addPair(COMMON_VENDOR, commonVendor);
+	}
+
+	public void setDnsDestDomain(String dnsDestDomain) {
+		addPair(DNS_DEST_DOMAIN, dnsDestDomain);
+	}
+
+	public void setDnsDestRecord(String dnsDestRecord) {
+		addPair(DNS_DEST_RECORD, dnsDestRecord);
+	}
+
+	public void setDnsDestZone(String dnsDestZone) {
+		addPair(DNS_DEST_ZONE, dnsDestZone);
+	}
+
+	public void setDnsRecordClass(String dnsRecordClass) {
+		addPair(DNS_RECORD_CLASS, dnsRecordClass);
+	}
+
+	public void setDnsRecordType(String dnsRecordType) {
+		addPair(DNS_RECORD_TYPE, dnsRecordType);
+	}
+
+	public void setDnsSrcDomain(String dnsSrcDomain) {
+		addPair(DNS_SRC_DOMAIN, dnsSrcDomain);
+	}
+
+	public void setDnsSrcRecord(String dnsSrcRecord) {
+		addPair(DNS_SRC_RECORD, dnsSrcRecord);
+	}
+
+	public void setDnsSrcZone(String dnsSrcZone) {
+		addPair(DNS_SRC_ZONE, dnsSrcZone);
+	}
+
+	public void setEmailRecipient(String emailRecipient) {
+		addPair(EMAIL_RECIPIENT, emailRecipient);
+	}
+
+	public void setEmailSender(String emailSender) {
+		addPair(EMAIL_SENDER, emailSender);
+	}
+
+	public void setEmailSubject(String emailSubject) {
+		addPair(EMAIL_SUBJECT, emailSubject);
+	}
+
+	public void setFileAccessTime(long fileAccessTime) {
+		addPair(FILE_ACCESS_TIME, fileAccessTime);
+	}
+
+	public void setFileCreateTime(long fileCreateTime) {
+		addPair(FILE_CREATE_TIME, fileCreateTime);
+	}
+
+	public void setFileHash(String fileHash) {
+		addPair(FILE_HASH, fileHash);
+	}
+
+	public void setFileModifyTime(long fileModifyTime) {
+		addPair(FILE_MODIFY_TIME, fileModifyTime);
+	}
+
+	public void setFileName(String fileName) {
+		addPair(FILE_NAME, fileName);
+	}
+
+	public void setFilePath(String filePath) {
+		addPair(FILE_PATH, filePath);
+	}
+
+	public void setFilePermission(String filePermission) {
+		addPair(FILE_PERMISSION, filePermission);
+	}
+
+	public void setFileSize(long fileSize) {
+		addPair(FILE_SIZE, fileSize);
+	}
+
+	public void setIntrusionDetectionCategory(String intrusionDetectionCategory) {
+		addPair(INTRUSION_DETECTION_CATEGORY, intrusionDetectionCategory);
+	}
+
+	public void setIntrusionDetectionDest(String intrusionDetectionDest) {
+		addPair(INTRUSION_DETECTION_DEST, intrusionDetectionDest);
+	}
+
+	public void setIntrusionDetectionDvc(String intrusionDetectionDvc) {
+		addPair(INTRUSION_DETECTION_DVC, intrusionDetectionDvc);
+	}
+
+	public void setIntrusionDetectionIdsType(String intrusionDetectionIdsType) {
+		addPair(INTRUSION_DETECTION_IDS_TYPE, intrusionDetectionIdsType);
+	}
+
+	public void setIntrusionDetectionProduct(String intrusionDetectionProduct) {
+		addPair(INTRUSION_DETECTION_PRODUCT, intrusionDetectionProduct);
+	}
+
+	public void setIntrusionDetectionSeverity(String intrusionDetectionSeverity) {
+		addPair(INTRUSION_DETECTION_SEVERITY, intrusionDetectionSeverity);
+	}
+
+	public void setIntrusionDetectionSignature(String intrusionDetectionSignature) {
+		addPair(INTRUSION_DETECTION_SIGNATURE, intrusionDetectionSignature);
+	}
+
+	public void setIntrusionDetectionSrc(String intrusionDetectionSrc) {
+		addPair(INTRUSION_DETECTION_SRC, intrusionDetectionSrc);
+	}
+
+	public void setIntrusionDetectionUser(String intrusionDetectionUser) {
+		addPair(INTRUSION_DETECTION_USER, intrusionDetectionUser);
+	}
+
+	public void setIntrusionDetectionVendor(String intrusionDetectionVendor) {
+		addPair(INTRUSION_DETECTION_VENDOR, intrusionDetectionVendor);
+	}
+
+	public void setMalwareEndpointProtectionAction(String malwareEndpointProtectionAction) {
+		addPair(MALWARE_ENDPOINT_PROTECTION_ACTION, malwareEndpointProtectionAction);
+	}
+
+	public void setMalwareEndpointProtectionDestNtDomain(String malwareEndpointProtectionDestNtDomain) {
+		addPair(MALWARE_ENDPOINT_PROTECTION_DEST_NT_DOMAIN, malwareEndpointProtectionDestNtDomain);
+	}
+
+	public void setMalwareEndpointProtectionFileHash(String malwareEndpointProtectionFileHash) {
+		addPair(MALWARE_ENDPOINT_PROTECTION_FILE_HASH, malwareEndpointProtectionFileHash);
+	}
+
+	public void setMalwareEndpointProtectionFileName(String malwareEndpointProtectionFileName) {
+		addPair(MALWARE_ENDPOINT_PROTECTION_FILE_NAME, malwareEndpointProtectionFileName);
+	}
+
+	public void setMalwareEndpointProtectionFilePath(String malwareEndpointProtectionFilePath) {
+		addPair(MALWARE_ENDPOINT_PROTECTION_FILE_PATH, malwareEndpointProtectionFilePath);
+	}
+
+	public void setMalwareEndpointProtectionProduct(String malwareEndpointProtectionProduct) {
+		addPair(MALWARE_ENDPOINT_PROTECTION_PRODUCT, malwareEndpointProtectionProduct);
+	}
+
+	public void setMalwareEndpointProtectionProductVersion(String malwareEndpointProtectionProductVersion) {
+		addPair(MALWARE_ENDPOINT_PROTECTION_PRODUCT_VERSION, malwareEndpointProtectionProductVersion);
+	}
+
+	public void setMalwareEndpointProtectionSignature(String malwareEndpointProtectionSignature) {
+		addPair(MALWARE_ENDPOINT_PROTECTION_SIGNATURE, malwareEndpointProtectionSignature);
+	}
+
+	public void setMalwareEndpointProtectionSignatureVersion(String malwareEndpointProtectionSignatureVersion) {
+		addPair(MALWARE_ENDPOINT_PROTECTION_SIGNATURE_VERSION, malwareEndpointProtectionSignatureVersion);
+	}
+
+	public void setMalwareEndpointProtectionDest(String malwareEndpointProtectionDest) {
+		addPair(MALWARE_ENDPOINT_PROTECTION_DEST, malwareEndpointProtectionDest);
+	}
+
+	public void setMalwareEndpointProtectionSrcNtDomain(String malwareEndpointProtectionSrcNtDomain) {
+		addPair(MALWARE_ENDPOINT_PROTECTION_SRC_NT_DOMAIN, malwareEndpointProtectionSrcNtDomain);
+	}
+
+	public void setMalwareEndpointProtectionUser(String malwareEndpointProtectionUser) {
+		addPair(MALWARE_ENDPOINT_PROTECTION_USER, malwareEndpointProtectionUser);
+	}
+
+	public void setMalwareEndpointProtectionVendor(String malwareEndpointProtectionVendor) {
+		addPair(MALWARE_ENDPOINT_PROTECTION_VENDOR, malwareEndpointProtectionVendor);
+	}
+
+	public void setMalwareNetworkProtectionProduct(String malwareNetworkProtectionProduct) {
+		addPair(MALWARE_NETWORK_PROTECTION_PRODUCT, malwareNetworkProtectionProduct);
+	}
+
+	public void setMalwareNetworkProtectionSeverity(String malwareNetworkProtectionSeverity) {
+		addPair(MALWARE_NETWORK_PROTECTION_SEVERITY, malwareNetworkProtectionSeverity);
+	}
+
+	public void setMalwareNetworkProtectionVendor(String malwareNetworkProtectionVendor) {
+		addPair(MALWARE_NETWORK_PROTECTION_VENDOR, malwareNetworkProtectionVendor);
+	}
+
+	public void setNetworkTrafficEssAction(String networkTrafficEssAction) {
+		addPair(NETWORK_TRAFFIC_ESS_ACTION, networkTrafficEssAction);
+	}
+
+	public void setNetworkTrafficEssDestPort(int networkTrafficEssDestPort) {
+		addPair(NETWORK_TRAFFIC_ESS_DEST_PORT, networkTrafficEssDestPort);
+	}
+
+	public void setNetworkTrafficEssProduct(String networkTrafficEssProduct) {
+		addPair(NETWORK_TRAFFIC_ESS_PRODUCT, networkTrafficEssProduct);
+	}
+
+	public void setNetworkTrafficEssSrcPort(int networkTrafficEssSrcPort) {
+		addPair(NETWORK_TRAFFIC_ESS_SRC_PORT, networkTrafficEssSrcPort);
+	}
+
+	public void setNetworkTrafficEssVendor(String networkTrafficEssVendor) {
+		addPair(NETWORK_TRAFFIC_ESS_VENDOR, networkTrafficEssVendor);
+	}
+
+	public void setNetworkTrafficGenericAppLayer(String networkTrafficGenericAppLayer) {
+		addPair(NETWORK_TRAFFIC_GENERIC_APP_LAYER, networkTrafficGenericAppLayer);
+	}
+
+	public void setNetworkTrafficGenericBytesIn(long networkTrafficGenericBytesIn) {
+		addPair(NETWORK_TRAFFIC_GENERIC_BYTES_IN, networkTrafficGenericBytesIn);
+	}
+
+	public void setNetworkTrafficGenericBytesOut(long networkTrafficGenericBytesOut) {
+		addPair(NETWORK_TRAFFIC_GENERIC_BYTES_OUT, networkTrafficGenericBytesOut);
+	}
+
+	public void setNetworkTrafficGenericChannel(String networkTrafficGenericChannel) {
+		addPair(NETWORK_TRAFFIC_GENERIC_CHANNEL, networkTrafficGenericChannel);
+	}
+
+	public void setNetworkTrafficGenericCve(String networkTrafficGenericCve) {
+		addPair(NETWORK_TRAFFIC_GENERIC_CVE, networkTrafficGenericCve);
+	}
+
+	public void setNetworkTrafficGenericDestApp(String networkTrafficGenericDestApp) {
+		addPair(NETWORK_TRAFFIC_GENERIC_DEST_APP, networkTrafficGenericDestApp);
+	}
+
+	public void setNetworkTrafficGenericDestCncChannel(String networkTrafficGenericDestCncChannel) {
+		addPair(NETWORK_TRAFFIC_GENERIC_DEST_CNC_CHANNEL, networkTrafficGenericDestCncChannel);
+	}
+
+	public void setNetworkTrafficGenericDestCncName(String networkTrafficGenericDestCncName) {
+		addPair(NETWORK_TRAFFIC_GENERIC_DEST_CNC_NAME, networkTrafficGenericDestCncName);
+	}
+
+	public void setNetworkTrafficGenericDestCncPort(String networkTrafficGenericDestCncPort) {
+		addPair(NETWORK_TRAFFIC_GENERIC_DEST_CNC_PORT, networkTrafficGenericDestCncPort);
+	}
+
+	public void setNetworkTrafficGenericDestCountry(String networkTrafficGenericDestCountry) {
+		addPair(NETWORK_TRAFFIC_GENERIC_DEST_COUNTRY, networkTrafficGenericDestCountry);
+	}
+
+	public void setNetworkTrafficGenericDestHost(String networkTrafficGenericDestHost) {
+		addPair(NETWORK_TRAFFIC_GENERIC_DEST_HOST, networkTrafficGenericDestHost);
+	}
+
+	public void setNetworkTrafficGenericDestInt(String networkTrafficGenericDestInt) {
+		addPair(NETWORK_TRAFFIC_GENERIC_DEST_INT, networkTrafficGenericDestInt);
+	}
+
+	public void setNetworkTrafficGenericDestIp(String networkTrafficGenericDestIp) {
+		addPair(NETWORK_TRAFFIC_GENERIC_DEST_IP, networkTrafficGenericDestIp);
+	}
+
+	public void setNetworkTrafficGenericDestIpv6(String networkTrafficGenericDestIpv6) {
+		addPair(NETWORK_TRAFFIC_GENERIC_DEST_IPV6, networkTrafficGenericDestIpv6);
+	}
+
+	public void setNetworkTrafficGenericDestLat(int networkTrafficGenericDestLat) {
+		addPair(NETWORK_TRAFFIC_GENERIC_DEST_LAT, networkTrafficGenericDestLat);
+	}
+
+	public void setNetworkTrafficGenericDestLong(int networkTrafficGenericDestLong) {
+		addPair(NETWORK_TRAFFIC_GENERIC_DEST_LONG, networkTrafficGenericDestLong);
+	}
+
+	public void setNetworkTrafficGenericDestMac(String networkTrafficGenericDestMac) {
+		addPair(NETWORK_TRAFFIC_GENERIC_DEST_MAC, networkTrafficGenericDestMac);
+	}
+
+	public void setNetworkTrafficGenericDestNtDomain(String networkTrafficGenericDestNtDomain) {
+		addPair(NETWORK_TRAFFIC_GENERIC_DEST_NT_DOMAIN, networkTrafficGenericDestNtDomain);
+	}
+
+	public void setNetworkTrafficGenericDestNtHost(String networkTrafficGenericDestNtHost) {
+		addPair(NETWORK_TRAFFIC_GENERIC_DEST_NT_HOST, networkTrafficGenericDestNtHost);
+	}
+
+	public void setNetworkTrafficGenericDestPort(int networkTrafficGenericDestPort) {
+		addPair(NETWORK_TRAFFIC_GENERIC_DEST_PORT, networkTrafficGenericDestPort);
+	}
+
+	public void setNetworkTrafficGenericDestTranslatedIp(String networkTrafficGenericDestTranslatedIp) {
+		addPair(NETWORK_TRAFFIC_GENERIC_DEST_TRANSLATED_IP, networkTrafficGenericDestTranslatedIp);
+	}
+
+	public void setNetworkTrafficGenericDestTranslatedPort(int networkTrafficGenericDestTranslatedPort) {
+		addPair(NETWORK_TRAFFIC_GENERIC_DEST_TRANSLATED_PORT, networkTrafficGenericDestTranslatedPort);
+	}
+
+	public void setNetworkTrafficGenericIpVersion(int networkTrafficGenericIpVersion) {
+		addPair(NETWORK_TRAFFIC_GENERIC_IP_VERSION, networkTrafficGenericIpVersion);
+	}
+
+	public void setNetworkTrafficGenericOutboundInterface(String networkTrafficGenericOutboundInterface) {
+		addPair(NETWORK_TRAFFIC_GENERIC_OUTBOUND_INTERFACE, networkTrafficGenericOutboundInterface);
+	}
+
+	public void setNetworkTrafficGenericPacketsIn(long networkTrafficGenericPacketsIn) {
+		addPair(NETWORK_TRAFFIC_GENERIC_PACKETS_IN, networkTrafficGenericPacketsIn);
+	}
+
+	public void setNetworkTrafficGenericPacketsOut(long networkTrafficGenericPacketsOut) {
+		addPair(NETWORK_TRAFFIC_GENERIC_PACKETS_OUT, networkTrafficGenericPacketsOut);
+	}
+
+	public void setNetworkTrafficGenericProto(String networkTrafficGenericProto) {
+		addPair(NETWORK_TRAFFIC_GENERIC_PROTO, networkTrafficGenericProto);
+	}
+
+	public void setNetworkTrafficGenericSessionId(String networkTrafficGenericSessionId) {
+		addPair(NETWORK_TRAFFIC_GENERIC_SESSION_ID, networkTrafficGenericSessionId);
+	}
+
+	public void setNetworkTrafficGenericSsid(String networkTrafficGenericSsid) {
+		addPair(NETWORK_TRAFFIC_GENERIC_SSID, networkTrafficGenericSsid);
+	}
+
+	public void setNetworkTrafficGenericSrcCountry(String networkTrafficGenericSrcCountry) {
+		addPair(NETWORK_TRAFFIC_GENERIC_SRC_COUNTRY, networkTrafficGenericSrcCountry);
+	}
+
+	public void setNetworkTrafficGenericSrcHost(String networkTrafficGenericSrcHost) {
+		addPair(NETWORK_TRAFFIC_GENERIC_SRC_HOST, networkTrafficGenericSrcHost);
+	}
+
+	public void setNetworkTrafficGenericSrcInt(String networkTrafficGenericSrcInt) {
+		addPair(NETWORK_TRAFFIC_GENERIC_SRC_INT, networkTrafficGenericSrcInt);
+	}
+
+	public void setNetworkTrafficGenericSrcIp(String networkTrafficGenericSrcIp) {
+		addPair(NETWORK_TRAFFIC_GENERIC_SRC_IP, networkTrafficGenericSrcIp);
+	}
+
+	public void setNetworkTrafficGenericSrcIpv6(String networkTrafficGenericSrcIpv6) {
+		addPair(NETWORK_TRAFFIC_GENERIC_SRC_IPV6, networkTrafficGenericSrcIpv6);
+	}
+
+	public void setNetworkTrafficGenericSrcLat(int networkTrafficGenericSrcLat) {
+		addPair(NETWORK_TRAFFIC_GENERIC_SRC_LAT, networkTrafficGenericSrcLat);
+	}
+
+	public void setNetworkTrafficGenericSrcLong(int networkTrafficGenericSrcLong) {
+		addPair(NETWORK_TRAFFIC_GENERIC_SRC_LONG, networkTrafficGenericSrcLong);
+	}
+
+	public void setNetworkTrafficGenericSrcMac(String networkTrafficGenericSrcMac) {
+		addPair(NETWORK_TRAFFIC_GENERIC_SRC_MAC, networkTrafficGenericSrcMac);
+	}
+
+	public void setNetworkTrafficGenericSrcNtDomain(String networkTrafficGenericSrcNtDomain) {
+		addPair(NETWORK_TRAFFIC_GENERIC_SRC_NT_DOMAIN, networkTrafficGenericSrcNtDomain);
+	}
+
+	public void setNetworkTrafficGenericSrcNtHost(String networkTrafficGenericSrcNtHost) {
+		addPair(NETWORK_TRAFFIC_GENERIC_SRC_NT_HOST, networkTrafficGenericSrcNtHost);
+	}
+
+	public void setNetworkTrafficGenericSrcPort(int networkTrafficGenericSrcPort) {
+		addPair(NETWORK_TRAFFIC_GENERIC_SRC_PORT, networkTrafficGenericSrcPort);
+	}
+
+	public void setNetworkTrafficGenericSrcTranslatedIp(String networkTrafficGenericSrcTranslatedIp) {
+		addPair(NETWORK_TRAFFIC_GENERIC_SRC_TRANSLATED_IP, networkTrafficGenericSrcTranslatedIp);
+	}
+
+	public void setNetworkTrafficGenericSrcTranslatedPort(int networkTrafficGenericSrcTranslatedPort) {
+		addPair(NETWORK_TRAFFIC_GENERIC_SRC_TRANSLATED_PORT, networkTrafficGenericSrcTranslatedPort);
+	}
+
+	public void setNetworkTrafficGenericSyslogId(String networkTrafficGenericSyslogId) {
+		addPair(NETWORK_TRAFFIC_GENERIC_SYSLOG_ID, networkTrafficGenericSyslogId);
+	}
+
+	public void setNetworkTrafficGenericSyslogPriority(String networkTrafficGenericSyslogPriority) {
+		addPair(NETWORK_TRAFFIC_GENERIC_SYSLOG_PRIORITY, networkTrafficGenericSyslogPriority);
+	}
+
+	public void setNetworkTrafficGenericTcpFlag(String networkTrafficGenericTcpFlag) {
+		addPair(NETWORK_TRAFFIC_GENERIC_TCP_FLAG, networkTrafficGenericTcpFlag);
+	}
+
+	public void setNetworkTrafficGenericTos(String networkTrafficGenericTos) {
+		addPair(NETWORK_TRAFFIC_GENERIC_TOS, networkTrafficGenericTos);
+	}
+
+	public void setNetworkTrafficGenericTransport(String networkTrafficGenericTransport) {
+		addPair(NETWORK_TRAFFIC_GENERIC_TRANSPORT, networkTrafficGenericTransport);
+	}
+
+	public void setNetworkTrafficGenericTtl(int networkTrafficGenericTtl) {
+		addPair(NETWORK_TRAFFIC_GENERIC_TTL, networkTrafficGenericTtl);
+	}
+
+	public void setNetworkTrafficGenericVlanId(long networkTrafficGenericVlanId) {
+		addPair(NETWORK_TRAFFIC_GENERIC_VLAN_ID, networkTrafficGenericVlanId);
+	}
+
+	public void setNetworkTrafficGenericVlanName(String networkTrafficGenericVlanName) {
+		addPair(NETWORK_TRAFFIC_GENERIC_VLAN_NAME, networkTrafficGenericVlanName);
+	}
+
+	public void setPacketFilteringAction(String packetFilteringAction) {
+		addPair(PACKET_FILTERING_ACTION, packetFilteringAction);
+	}
+
+	public void setPacketFilteringDestPort(int packetFilteringDestPort) {
+		addPair(PACKET_FILTERING_DEST_PORT, packetFilteringDestPort);
+	}
+
+	public void setPacketFilteringDirection(String packetFilteringDirection) {
+		addPair(PACKET_FILTERING_DIRECTION, packetFilteringDirection);
+	}
+
+	public void setPacketFilteringDvc(String packetFilteringDvc) {
+		addPair(PACKET_FILTERING_DVC, packetFilteringDvc);
+	}
+
+	public void setPacketFilteringRule(String packetFilteringRule) {
+		addPair(PACKET_FILTERING_RULE, packetFilteringRule);
+	}
+
+	public void setPacketFilteringSvcPort(int packetFilteringSvcPort) {
+		addPair(PACKET_FILTERING_SVC_PORT, packetFilteringSvcPort);
+	}
+
+	public void setProxyAction(String proxyAction) {
+		addPair(PROXY_ACTION, proxyAction);
+	}
+
+	public void setProxyDest(String proxyDest) {
+		addPair(PROXY_DEST, proxyDest);
+	}
+
+	public void setProxyHttpContentType(String proxyHttpContentType) {
+		addPair(PROXY_HTTP_CONTENT_TYPE, proxyHttpContentType);
+	}
+
+	public void setProxyHttpMethod(String proxyHttpMethod) {
+		addPair(PROXY_HTTP_METHOD, proxyHttpMethod);
+	}
+
+	public void setProxyHttpRefer(String proxyHttpRefer) {
+		addPair(PROXY_HTTP_REFER, proxyHttpRefer);
+	}
+
+	public void setProxyHttpResponse(int proxyHttpResponse) {
+		addPair(PROXY_HTTP_RESPONSE, proxyHttpResponse);
+	}
+
+	public void setProxyHttpUserAgent(String proxyHttpUserAgent) {
+		addPair(PROXY_HTTP_USER_AGENT, proxyHttpUserAgent);
+	}
+
+	public void setProxyProduct(String proxyProduct) {
+		addPair(PROXY_PRODUCT, proxyProduct);
+	}
+
+	public void setProxySrc(String proxySrc) {
+		addPair(PROXY_SRC, proxySrc);
+	}
+
+	public void setProxyStatus(int proxyStatus) {
+		addPair(PROXY_STATUS, proxyStatus);
+	}
+
+	public void setProxyUser(String proxyUser) {
+		addPair(PROXY_USER, proxyUser);
+	}
+
+	public void setProxyUrl(String proxyUrl) {
+		addPair(PROXY_URL, proxyUrl);
+	}
+
+	public void setProxyVendor(String proxyVendor) {
+		addPair(PROXY_VENDOR, proxyVendor);
+	}
+
+	public void setSystemCenterApp(String systemCenterApp) {
+		addPair(SYSTEM_CENTER_APP, systemCenterApp);
+	}
+
+	public void setSystemCenterFreembytes(long systemCenterFreembytes) {
+		addPair(SYSTEM_CENTER_FREEMBYTES, systemCenterFreembytes);
+	}
+
+	public void setSystemCenterKernelRelease(String systemCenterKernelRelease) {
+		addPair(SYSTEM_CENTER_KERNEL_RELEASE, systemCenterKernelRelease);
+	}
+
+	public void setSystemCenterLabel(String systemCenterLabel) {
+		addPair(SYSTEM_CENTER_LABEL, systemCenterLabel);
+	}
+
+	public void setSystemCenterMount(String systemCenterMount) {
+		addPair(SYSTEM_CENTER_MOUNT, systemCenterMount);
+	}
+
+	public void setSystemCenterOs(String systemCenterOs) {
+		addPair(SYSTEM_CENTER_OS, systemCenterOs);
+	}
+
+	public void setSystemCenterPercentprocessortime(int systemCenterPercentprocessortime) {
+		addPair(SYSTEM_CENTER_PERCENTPROCESSORTIME, systemCenterPercentprocessortime);
+	}
+
+	public void setSystemCenterSetlocaldefs(int systemCenterSetlocaldefs) {
+		addPair(SYSTEM_CENTER_SETLOCALDEFS, systemCenterSetlocaldefs);
+	}
+
+	public void setSystemCenterSelinux(String systemCenterSelinux) {
+		addPair(SYSTEM_CENTER_SELINUX, systemCenterSelinux);
+	}
+
+	public void setSystemCenterSelinuxtype(String systemCenterSelinuxtype) {
+		addPair(SYSTEM_CENTER_SELINUXTYPE, systemCenterSelinuxtype);
+	}
+
+	public void setSystemCenterShell(String systemCenterShell) {
+		addPair(SYSTEM_CENTER_SHELL, systemCenterShell);
+	}
+
+	public void setSystemCenterSrcPort(int systemCenterSrcPort) {
+		addPair(SYSTEM_CENTER_SRC_PORT, systemCenterSrcPort);
+	}
+
+	public void setSystemCenterSshdProtocol(String systemCenterSshdProtocol) {
+		addPair(SYSTEM_CENTER_SSHD_PROTOCOL, systemCenterSshdProtocol);
+	}
+
+	public void setSystemCenterStartmode(String systemCenterStartmode) {
+		addPair(SYSTEM_CENTER_STARTMODE, systemCenterStartmode);
+	}
+
+	public void setSystemCenterSystemuptime(long systemCenterSystemuptime) {
+		addPair(SYSTEM_CENTER_SYSTEMUPTIME, systemCenterSystemuptime);
+	}
+
+	public void setSystemCenterTotalmbytes(long systemCenterTotalmbytes) {
+		addPair(SYSTEM_CENTER_TOTALMBYTES, systemCenterTotalmbytes);
+	}
+
+	public void setSystemCenterUsedmbytes(long systemCenterUsedmbytes) {
+		addPair(SYSTEM_CENTER_USEDMBYTES, systemCenterUsedmbytes);
+	}
+
+	public void setSystemCenterUser(String systemCenterUser) {
+		addPair(SYSTEM_CENTER_USER, systemCenterUser);
+	}
+
+	public void setSystemCenterUpdates(long systemCenterUpdates) {
+		addPair(SYSTEM_CENTER_UPDATES, systemCenterUpdates);
+	}
+
+	public void setTrafficDest(String trafficDest) {
+		addPair(TRAFFIC_DEST, trafficDest);
+	}
+
+	public void setTrafficDvc(String trafficDvc) {
+		addPair(TRAFFIC_DVC, trafficDvc);
+	}
+
+	public void setTrafficSrc(String trafficSrc) {
+		addPair(TRAFFIC_SRC, trafficSrc);
+	}
+
+	public void setUpdatePackage(String updatePackage) {
+		addPair(UPDATE_PACKAGE, updatePackage);
+	}
+
+	public void setUserInfoUpdatesAffectedUser(String userInfoUpdatesAffectedUser) {
+		addPair(USER_INFO_UPDATES_AFFECTED_USER, userInfoUpdatesAffectedUser);
+	}
+
+	public void setUserInfoUpdatesAffectedUserGroup(String userInfoUpdatesAffectedUserGroup) {
+		addPair(USER_INFO_UPDATES_AFFECTED_USER_GROUP, userInfoUpdatesAffectedUserGroup);
+	}
+
+	public void setUserInfoUpdatesAffectedUserGroupId(int userInfoUpdatesAffectedUserGroupId) {
+		addPair(USER_INFO_UPDATES_AFFECTED_USER_GROUP_ID, userInfoUpdatesAffectedUserGroupId);
+	}
+
+	public void setUserInfoUpdatesAffectedUserId(int userInfoUpdatesAffectedUserId) {
+		addPair(USER_INFO_UPDATES_AFFECTED_USER_ID, userInfoUpdatesAffectedUserId);
+	}
+
+	public void setUserInfoUpdatesAffectedUserPrivilege(String userInfoUpdatesAffectedUserPrivilege) {
+		addPair(USER_INFO_UPDATES_AFFECTED_USER_PRIVILEGE, userInfoUpdatesAffectedUserPrivilege);
+	}
+
+	public void setUserInfoUpdatesUser(String userInfoUpdatesUser) {
+		addPair(USER_INFO_UPDATES_USER, userInfoUpdatesUser);
+	}
+
+	public void setUserInfoUpdatesUserGroup(String userInfoUpdatesUserGroup) {
+		addPair(USER_INFO_UPDATES_USER_GROUP, userInfoUpdatesUserGroup);
+	}
+
+	public void setUserInfoUpdatesUserGroupId(int userInfoUpdatesUserGroupId) {
+		addPair(USER_INFO_UPDATES_USER_GROUP_ID, userInfoUpdatesUserGroupId);
+	}
+
+	public void setUserInfoUpdatesUserId(int userInfoUpdatesUserId) {
+		addPair(USER_INFO_UPDATES_USER_ID, userInfoUpdatesUserId);
+	}
+
+	public void setUserInfoUpdatesUserPrivilege(String userInfoUpdatesUserPrivilege) {
+		addPair(USER_INFO_UPDATES_USER_PRIVILEGE, userInfoUpdatesUserPrivilege);
+	}
+
+	public void setUserInfoUpdatesUserSubject(String userInfoUpdatesUserSubject) {
+		addPair(USER_INFO_UPDATES_USER_SUBJECT, userInfoUpdatesUserSubject);
+	}
+
+	public void setUserInfoUpdatesUserSubjectId(int userInfoUpdatesUserSubjectId) {
+		addPair(USER_INFO_UPDATES_USER_SUBJECT_ID, userInfoUpdatesUserSubjectId);
+	}
+
+	public void setUserInfoUpdatesUserSubjectPrivilege(String userInfoUpdatesUserSubjectPrivilege) {
+		addPair(USER_INFO_UPDATES_USER_SUBJECT_PRIVILEGE, userInfoUpdatesUserSubjectPrivilege);
+	}
+
+	public void setVulnerabilityCategory(String vulnerabilityCategory) {
+		addPair(VULNERABILITY_CATEGORY, vulnerabilityCategory);
+	}
+
+	public void setVulnerabilityDest(String vulnerabilityDest) {
+		addPair(VULNERABILITY_DEST, vulnerabilityDest);
+	}
+
+	public void setVulnerabilityOs(String vulnerabilityOs) {
+		addPair(VULNERABILITY_OS, vulnerabilityOs);
+	}
+
+	public void setVulnerabilitySeverity(String vulnerabilitySeverity) {
+		addPair(VULNERABILITY_SEVERITY, vulnerabilitySeverity);
+	}
+
+	public void setVulnerabilitySignature(String vulnerabilitySignature) {
+		addPair(VULNERABILITY_SIGNATURE, vulnerabilitySignature);
+	}
+
+	public void setWindowsAdminObjectName(String windowsAdminObjectName) {
+		addPair(WINDOWS_ADMIN_OBJECT_NAME, windowsAdminObjectName);
+	}
+
+	public void setWindowsAdminObjectType(String windowsAdminObjectType) {
+		addPair(WINDOWS_ADMIN_OBJECT_TYPE, windowsAdminObjectType);
+	}
+
+	public void setWindowsAdminObjectHandle(String windowsAdminObjectHandle) {
+		addPair(WINDOWS_ADMIN_OBJECT_HANDLE, windowsAdminObjectHandle);
+	}
+
+
+}
diff --git a/src/main/java/org/springframework/integration/splunk/entity/SplunkServer.java b/src/main/java/org/springframework/integration/splunk/entity/SplunkServer.java
new file mode 100644
index 0000000..b8b703b
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/entity/SplunkServer.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2011-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.splunk.entity;
+
+/**
+ * Splunk server entity
+ *
+ * @author Jarred Li
+ * @since 1.0
+ *
+ */
+public class SplunkServer {
+
+	private String host;
+	private int port;
+	private String scheme;
+	private String app;
+	private String owner;
+	private String userName;
+	private String password;
+
+	/**
+	 * @return the host
+	 */
+	public String getHost() {
+		return host;
+	}
+
+	/**
+	 * @param host the host to set
+	 */
+	public void setHost(String host) {
+		this.host = host;
+	}
+
+	/**
+	 * @return the port
+	 */
+	public int getPort() {
+		return port;
+	}
+
+	/**
+	 * @param port the port to set
+	 */
+	public void setPort(int port) {
+		this.port = port;
+	}
+
+	public String getScheme() {
+		return scheme;
+	}
+
+	public void setScheme(String scheme) {
+		this.scheme = scheme;
+	}
+
+	public String getApp() {
+		return app;
+	}
+
+	public void setApp(String app) {
+		this.app = app;
+	}
+
+	public String getOwner() {
+		return owner;
+	}
+
+	public void setOwner(String owner) {
+		this.owner = owner;
+	}
+
+	/**
+	 * @return the userName
+	 */
+	public String getUserName() {
+		return userName;
+	}
+
+	/**
+	 * @param userName the userName to set
+	 */
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
+
+	/**
+	 * @return the password
+	 */
+	public String getPassword() {
+		return password;
+	}
+
+	/**
+	 * @param password the password to set
+	 */
+	public void setPassword(String password) {
+		this.password = password;
+	}
+
+
+
+}
diff --git a/src/main/java/org/springframework/integration/splunk/inbound/SplunkPollingChannelAdapter.java b/src/main/java/org/springframework/integration/splunk/inbound/SplunkPollingChannelAdapter.java
new file mode 100644
index 0000000..c99ed67
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/inbound/SplunkPollingChannelAdapter.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2002-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.splunk.inbound;
+
+import java.util.List;
+
+import org.springframework.integration.Message;
+import org.springframework.integration.context.IntegrationObjectSupport;
+import org.springframework.integration.core.MessageSource;
+import org.springframework.integration.splunk.entity.SplunkData;
+import org.springframework.integration.splunk.support.SplunkExecutor;
+import org.springframework.integration.support.MessageBuilder;
+import org.springframework.util.Assert;
+
+/**
+ * Polling data from Splunk to generate Message
+ *
+ * @author Jarred Li
+ * @since 1.0
+ *
+ */
+public class SplunkPollingChannelAdapter extends IntegrationObjectSupport implements MessageSource> {
+
+	private final SplunkExecutor splunkExecutor;
+
+	/**
+	 * Constructor taking a {@link SplunkExecutor} that provide all required Splunk
+	 * functionality.
+	 *
+	 * @param splunkExecutor Must not be null.
+	 */
+	public SplunkPollingChannelAdapter(SplunkExecutor splunkExecutor) {
+		super();
+		Assert.notNull(splunkExecutor, "splunkExecutor must not be null.");
+		this.splunkExecutor = splunkExecutor;
+	}
+
+	/**
+	 * Check for mandatory attributes
+	 */
+	@Override
+	protected void onInit() throws Exception {
+		super.onInit();
+	}
+
+	/**
+	 * Uses {@link SplunkExecutor#poll()} to executes the Splunk operation.
+	 *
+	 * If {@link SplunkExecutor#poll()} returns null, this method will return
+	 * null. Otherwise, a new {@link Message} is constructed and returned.
+	 */
+	public Message> receive() {
+		List payload = splunkExecutor.poll();
+		if (payload == null) {
+			return null;
+		}
+		return MessageBuilder.withPayload(payload).build();
+	}
+
+	@Override
+	public String getComponentType() {
+		return "splunk:inbound-channel-adapter";
+	}
+
+}
diff --git a/src/main/java/org/springframework/integration/splunk/inbound/package-info.java b/src/main/java/org/springframework/integration/splunk/inbound/package-info.java
new file mode 100644
index 0000000..f72820a
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/inbound/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Provides inbound Spring Integration Splunk components.
+ */
+package org.springframework.integration.splunk.inbound;
diff --git a/src/main/java/org/springframework/integration/splunk/outbound/SplunkOutboundChannelAdapter.java b/src/main/java/org/springframework/integration/splunk/outbound/SplunkOutboundChannelAdapter.java
new file mode 100644
index 0000000..3c78da0
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/outbound/SplunkOutboundChannelAdapter.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2002-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.integration.splunk.outbound;
+
+import org.springframework.integration.Message;
+import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
+import org.springframework.integration.splunk.support.SplunkExecutor;
+import org.springframework.integration.support.MessageBuilder;
+import org.springframework.util.Assert;
+
+
+/**
+ * Handle message and write data into Splunk
+ *
+ * @author Jarred Li
+ * @since 1.0
+ *
+ */
+public class SplunkOutboundChannelAdapter extends AbstractReplyProducingMessageHandler {
+
+	private final SplunkExecutor splunkExecutor;
+	private boolean producesReply = true; //false for outbound-channel-adapter, true for outbound-gateway
+
+	/**
+	 * Constructor taking an {@link SplunkExecutor} that wraps common
+	 * Splunk Operations.
+	 *
+	 * @param splunkExecutor Must not be null
+	 *
+	 */
+	public SplunkOutboundChannelAdapter(SplunkExecutor splunkExecutor) {
+		Assert.notNull(splunkExecutor, "splunkExecutor must not be null.");
+		this.splunkExecutor = splunkExecutor;
+	}
+
+	/**
+	 *
+	 */
+	@Override
+	protected void onInit() {
+		super.onInit();
+	}
+
+	@Override
+	protected Object handleRequestMessage(Message requestMessage) {
+		final Object result;
+		result = this.splunkExecutor.executeOutboundOperation(requestMessage);
+		if (result == null || !producesReply) {
+			return null;
+		}
+		return MessageBuilder.withPayload(result).copyHeaders(requestMessage.getHeaders()).build();
+
+	}
+
+	/**
+	 * If set to 'false', this component will act as an Outbound Channel Adapter.
+	 * If not explicitly set this property will default to 'true'.
+	 *
+	 * @param producesReply Defaults to 'true'.
+	 *
+	 */
+	public void setProducesReply(boolean producesReply) {
+		this.producesReply = producesReply;
+	}
+
+}
diff --git a/src/main/java/org/springframework/integration/splunk/outbound/package-info.java b/src/main/java/org/springframework/integration/splunk/outbound/package-info.java
new file mode 100644
index 0000000..0ce1585
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/outbound/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Provides Spring Integration components for doing outbound operations.
+ */
+package org.springframework.integration.splunk.outbound;
diff --git a/src/main/java/org/springframework/integration/splunk/support/ConnectionFactoryFactoryBean.java b/src/main/java/org/springframework/integration/splunk/support/ConnectionFactoryFactoryBean.java
new file mode 100644
index 0000000..a5c1204
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/support/ConnectionFactoryFactoryBean.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2011-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.splunk.support;
+
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.integration.splunk.core.ConnectionFactory;
+
+/**
+ * Factory bean to create ConnectionFactory.
+ *
+ * @author Jarred Li
+ * @since 1.0
+ *
+ */
+public class ConnectionFactoryFactoryBean implements FactoryBean> {
+
+	private final ConnectionFactory connectionFactory;
+
+	public ConnectionFactoryFactoryBean(ConnectionFactory cf, boolean usePool) {
+		if (usePool) {
+			this.connectionFactory = new PoolingConnectionFactory(cf);
+		}
+		else {
+			this.connectionFactory = cf;
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.springframework.beans.factory.FactoryBean#getObject()
+	 */
+	public ConnectionFactory getObject() throws Exception {
+		return this.connectionFactory;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.springframework.beans.factory.FactoryBean#getObjectType()
+	 */
+	public Class getObjectType() {
+		return connectionFactory.getClass();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.springframework.beans.factory.FactoryBean#isSingleton()
+	 */
+	public boolean isSingleton() {
+		return true;
+	}
+
+}
diff --git a/src/main/java/org/springframework/integration/splunk/support/IngestType.java b/src/main/java/org/springframework/integration/splunk/support/IngestType.java
new file mode 100644
index 0000000..a03f505
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/support/IngestType.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2011-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.splunk.support;
+
+/**
+ * Method of pushing data into Splunk.
+ *
+ * Stream: Establish a connection, keep it open, and stream events until the connection is closed.Better for high volume input.
+ * Tcp: Create raw socket and send event data into the socket
+ * Submit: Send event data into Splunk with HTTP REST api
+ *
+ * @author Jarred Li
+ * @since 1.0
+ *
+ */
+public enum IngestType {
+	stream("stream"), tcp("tcp"), submit("submit");
+
+	private String type;
+
+	IngestType(String ingestType) {
+		this.type = ingestType;
+	}
+
+	public String getIngestType() {
+		return type;
+	}
+}
\ No newline at end of file
diff --git a/src/main/java/org/springframework/integration/splunk/support/PoolingConnectionFactory.java b/src/main/java/org/springframework/integration/splunk/support/PoolingConnectionFactory.java
new file mode 100644
index 0000000..2bf6efe
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/support/PoolingConnectionFactory.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2011-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.splunk.support;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.pool.BasePoolableObjectFactory;
+import org.apache.commons.pool.ObjectPool;
+import org.apache.commons.pool.impl.GenericObjectPool;
+import org.springframework.beans.factory.DisposableBean;
+import org.springframework.integration.splunk.core.Connection;
+import org.springframework.integration.splunk.core.ConnectionFactory;
+
+/**
+ * Pooling ConnectionFactory to pool Connection with Apache Commons Pool.
+ *
+ * @author Jarred Li
+ * @since 1.0
+ *
+ */
+public class PoolingConnectionFactory implements ConnectionFactory, DisposableBean {
+
+	private final Log log = LogFactory.getLog(this.getClass());
+
+	private final ConnectionFactory connectionFactory;
+
+	private ObjectPool> pool;
+
+	public PoolingConnectionFactory(ConnectionFactory f) {
+		this.connectionFactory = f;
+		this.pool = new GenericObjectPool>(new ConnectionPoolableObjectFactory());
+	}
+
+	/* (non-Javadoc)
+	 * @see org.springframework.integration.splunk.core.ServiceFactory#getService()
+	 */
+	public Connection getConnection() throws Exception {
+		return new PooledConnection(this.pool.borrowObject());
+	}
+
+	/* (non-Javadoc)
+	 * @see org.springframework.beans.factory.DisposableBean#destroy()
+	 */
+	public void destroy() throws Exception {
+		pool.clear();
+		pool.close();
+	}
+
+	class ConnectionPoolableObjectFactory extends BasePoolableObjectFactory> {
+
+		/* (non-Javadoc)
+		 * @see org.apache.commons.pool.BasePoolableObjectFactory#makeObject()
+		 */
+		@Override
+		public Connection makeObject() throws Exception {
+			return connectionFactory.getConnection();
+		}
+
+		@Override
+		public void destroyObject(Connection obj) throws Exception {
+			obj.close();
+		}
+
+		/**
+		 * Whether the object is valid or not.
+		 *
+		 * @param obj object to be validated
+		 * @return true
+		 */
+		public boolean validateObject(Connection obj) {
+			return obj.isOpen();
+		}
+
+		/**
+		 *  activate the object
+		 *
+		 *  @param obj ignored
+		 */
+		public void activateObject(Connection obj) throws Exception {
+			obj.isOpen();
+		}
+
+
+	}
+
+	class PooledConnection implements Connection {
+
+		private Connection connection;
+
+		public PooledConnection(Connection con) {
+			this.connection = con;
+		}
+
+		/* (non-Javadoc)l
+		 * @see org.springframework.integration.splunk.core.IService#close()
+		 */
+		public void close() {
+			try {
+				pool.returnObject(connection);
+			} catch (Exception e) {
+				log.warn("failed to return pooled object", e);
+			}
+		}
+
+		/* (non-Javadoc)
+		 * @see org.springframework.integration.splunk.core.IService#isOpen()
+		 */
+		public boolean isOpen() {
+			return connection.isOpen();
+		}
+
+		/* (non-Javadoc)
+		 * @see org.springframework.integration.splunk.core.IService#getService()
+		 */
+		public T getTarget() {
+			return connection.getTarget();
+		}
+
+	}
+
+}
diff --git a/src/main/java/org/springframework/integration/splunk/support/SearchMode.java b/src/main/java/org/springframework/integration/splunk/support/SearchMode.java
new file mode 100644
index 0000000..3d4c62a
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/support/SearchMode.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2011-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.splunk.support;
+
+/**
+ * Search mode supported by Splunk.
+ *
+ * Blocking: Run synchronous search API
+ * Normal: Run asynchronous search API
+ * Realtime: Run the searches which are over a defined real time window
+ * Export: Run synchronously in your code , best way for bulk exports of events from Splunk
+ * Saved: Run predefined searches/parameters that are saved in Splunk in a namespace and you can execute them by name
+ *
+ * @author Jarred Li
+ * @since 1.0
+ *
+ */
+public enum SearchMode {
+	blocking, normal, realtime, export, saved;
+}
\ No newline at end of file
diff --git a/src/main/java/org/springframework/integration/splunk/support/SplunkConnection.java b/src/main/java/org/springframework/integration/splunk/support/SplunkConnection.java
new file mode 100644
index 0000000..233fcc0
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/support/SplunkConnection.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2011-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.splunk.support;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.springframework.integration.splunk.core.Connection;
+import org.springframework.integration.splunk.entity.SplunkServer;
+
+import com.splunk.Service;
+
+/**
+ * Connection to Splunk service
+ *
+ * @author Jarred Li
+ * @since 1.0
+ *
+ */
+public class SplunkConnection implements Connection {
+
+	private Service service;
+
+	public SplunkConnection(SplunkServer splunkServer) {
+		Map args = new HashMap();
+		if (splunkServer.getHost() != null) {
+			args.put("host", splunkServer.getHost());
+		}
+		if (splunkServer.getPort() != 0) {
+			args.put("port", splunkServer.getPort());
+		}
+		if (splunkServer.getScheme() != null) {
+			args.put("scheme", splunkServer.getScheme());
+		}
+		if (splunkServer.getApp() != null) {
+			args.put("app", splunkServer.getApp());
+		}
+		if (splunkServer.getOwner() != null) {
+			args.put("owner", splunkServer.getOwner());
+		}
+
+		args.put("username", splunkServer.getUserName());
+		args.put("password", splunkServer.getPassword());
+		service = Service.connect(args);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.springframework.integration.splunk.core.IService#close()
+	 */
+	public void close() {
+		service.logout();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.springframework.integration.splunk.core.IService#isOpen()
+	 */
+	public boolean isOpen() {
+		boolean result = true;
+		try {
+			service.getApplications();
+		} catch (Throwable t) {
+			result = false;
+		}
+		return result;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.springframework.integration.splunk.core.IService#getService()
+	 */
+	public Service getTarget() {
+		return service;
+	}
+
+}
diff --git a/src/main/java/org/springframework/integration/splunk/support/SplunkConnectionFactory.java b/src/main/java/org/springframework/integration/splunk/support/SplunkConnectionFactory.java
new file mode 100644
index 0000000..5eba652
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/support/SplunkConnectionFactory.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2011-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.splunk.support;
+
+import org.springframework.integration.splunk.core.Connection;
+import org.springframework.integration.splunk.core.ConnectionFactory;
+import org.springframework.integration.splunk.entity.SplunkServer;
+
+import com.splunk.Service;
+
+/**
+ * Factory to create Splunk connection.
+ *
+ * @author Jarred Li
+ * @since 1.0
+ *
+ */
+public class SplunkConnectionFactory implements ConnectionFactory {
+
+	private SplunkServer splunkServer;
+
+	public SplunkConnectionFactory(SplunkServer server) {
+		this.splunkServer = server;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.springframework.integration.splunk.core.ServiceFactory#getService()
+	 */
+	public Connection getConnection() throws Exception {
+		return new SplunkConnection(splunkServer);
+	}
+
+}
diff --git a/src/main/java/org/springframework/integration/splunk/support/SplunkDataReader.java b/src/main/java/org/springframework/integration/splunk/support/SplunkDataReader.java
new file mode 100644
index 0000000..b0fce88
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/support/SplunkDataReader.java
@@ -0,0 +1,470 @@
+/*
+ * Copyright 2011-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.splunk.support;
+
+import java.io.InputStream;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.integration.splunk.core.Connection;
+import org.springframework.integration.splunk.core.ConnectionFactory;
+import org.springframework.integration.splunk.core.DataReader;
+import org.springframework.integration.splunk.entity.SplunkData;
+import org.springframework.util.Assert;
+import org.springframework.util.StringUtils;
+
+import com.splunk.Args;
+import com.splunk.Job;
+import com.splunk.ResultsReader;
+import com.splunk.ResultsReaderXml;
+import com.splunk.SavedSearch;
+import com.splunk.SavedSearchCollection;
+import com.splunk.Service;
+
+/**
+ * Data reader to search data from Splunk.
+ *
+ * There are 5 ways to search data provided by Splunk SDK: saved search, blocking search,
+ * non blocking search, realtime search, export search.
+ *
+ * Splunk search also supports time range search with earliestTime and latestTime.
+ * For the first time start, initEarliestTime is used as earliestTime.
+ * If user does not specify earliestTime and latestTime, latestTime is "now"
+ * earliestTime is the time that last polling is run.
+ *
+ * @author  Jarred Li
+ * @since 1.0
+ *
+ */
+public class SplunkDataReader implements DataReader, InitializingBean {
+
+	private static final String DATE_FORMAT = "MM/dd/yy HH:mm:ss:SSS";
+
+	private static final String SPLUNK_TIME_FORMAT = "%m/%d/%y %H:%M:%S:%3N";
+
+	private static final Log logger = LogFactory.getLog(SplunkDataReader.class);
+
+	private ConnectionFactory connectionFactory;
+
+	private SearchMode mode;
+
+	private int count = 0;
+
+	private String fieldList;
+
+	private String search;
+
+	private String earliestTime;
+
+	private String latestTime;
+
+	private String savedSearch;
+
+	private String owner;
+
+	private String app;
+
+	private String initEarliestTime;
+
+	private transient Calendar lastSuccessfulReadTime;
+
+	public SplunkDataReader(ConnectionFactory f) {
+		this.connectionFactory = f;
+	}
+
+	public void setSearch(String searchStr) {
+		Assert.hasText(searchStr, "search must be neither null nor empty");
+		this.search = searchStr;
+	}
+
+	public void setEarliestTime(String earliestTime) {
+		this.earliestTime = earliestTime;
+	}
+
+	public void setLatestTime(String latestTime) {
+		this.latestTime = latestTime;
+	}
+
+	public void setSavedSearch(String savedSearch) {
+		this.savedSearch = savedSearch;
+	}
+
+	public void setMode(SearchMode mode) {
+		Assert.notNull(mode, "mode must be set");
+		this.mode = mode;
+	}
+
+	public void setCount(int count) {
+		this.count = count;
+	}
+
+	public void setFieldList(String fieldList) {
+		this.fieldList = fieldList;
+	}
+
+	public void setOwner(String owner) {
+		this.owner = owner;
+	}
+
+	public void setApp(String app) {
+		this.app = app;
+	}
+
+	public void setInitEarliestTime(String initEarliestTime) {
+		Assert.notNull(initEarliestTime, "initial earliest time can not be null");
+		this.initEarliestTime = initEarliestTime;
+	}
+
+	public SearchMode getMode() {
+		return mode;
+	}
+
+	public int getCount() {
+		return count;
+	}
+
+	public String getFieldList() {
+		return fieldList;
+	}
+
+	public String getSearch() {
+		return search;
+	}
+
+	public String getEarliestTime() {
+		return earliestTime;
+	}
+
+	public String getLatestTime() {
+		return latestTime;
+	}
+
+	public String getSavedSearch() {
+		return savedSearch;
+	}
+
+	public String getOwner() {
+		return owner;
+	}
+
+	public String getInitEarliestTime() {
+		return initEarliestTime;
+	}
+
+	public String getApp() {
+		return app;
+	}
+
+	public List search() throws Exception {
+		logger.debug("mode:" + mode);
+		switch (mode) {
+		case saved: {
+			return savedSearch();
+		}
+		case blocking: {
+			return blockingSearch();
+		}
+		case normal: {
+			return nonBlockingSearch();
+		}
+		case export: {
+			return exportSearch();
+		}
+		case realtime: {
+			return realtimeSearch();
+		}
+		}
+		return null;
+	}
+
+	/**
+	 * Get the earliestTime of range search.
+	 *
+	 * @param startTime the time where search start
+	 * @param realtime if this is realtime search
+	 *
+	 * @return The time of last successful read if not realtime;
+	 *         Time difference between last successful read and start time;
+	 */
+	private String calculateEarliestTime(Calendar startTime, boolean realtime) {
+		String result = null;
+		if (realtime) {
+			result = calculateEarliestTimeForRealTime(startTime);
+		}
+		DateFormat df = new SimpleDateFormat(DATE_FORMAT);
+		result = df.format(lastSuccessfulReadTime.getTime());
+		return result;
+	}
+
+
+	/**
+	 * get earliest time for realtime search
+	 *
+	 * @param startTime
+	 * @return
+	 */
+	private String calculateEarliestTimeForRealTime(Calendar startTime) {
+		String result = null;
+		long diff = startTime.getTimeInMillis() - lastSuccessfulReadTime.getTimeInMillis();
+		result = "-" + diff / 1000 + "s";
+		return result;
+	}
+
+	private void populateArgs(Args queryArgs, Calendar startTime, boolean realtime) {
+		String earliestTime = getEarliestTime(startTime, realtime);
+		if (StringUtils.hasText(earliestTime)) {
+			queryArgs.put("earliest_time", earliestTime);
+		}
+
+		String latestTime = getLatestTime(startTime, realtime);
+		if (StringUtils.hasText(latestTime)) {
+			queryArgs.put("latest_time", latestTime);
+		}
+
+		queryArgs.put("time_format", SPLUNK_TIME_FORMAT);
+
+		if (StringUtils.hasText(fieldList)) {
+			queryArgs.put("field_list", fieldList);
+		}
+	}
+
+	private String getLatestTime(Calendar startTime, boolean realtime) {
+		String lTime = null;
+		if (StringUtils.hasText(latestTime)) {
+			lTime = latestTime;
+		}
+		else {
+			if (realtime) {
+				lTime = "rt";
+			}
+			else {
+				DateFormat df = new SimpleDateFormat(DATE_FORMAT);
+				lTime = df.format(startTime.getTime());
+			}
+		}
+		return lTime;
+	}
+
+	private String getEarliestTime(Calendar startTime, boolean realtime) {
+		String eTime = null;
+
+		if (lastSuccessfulReadTime == null) {
+			eTime = initEarliestTime;
+		}
+		else {
+			if (StringUtils.hasText(earliestTime)) {
+				eTime = earliestTime;
+			}
+			else {
+				String calculatedEarliestTime = calculateEarliestTime(startTime, realtime);
+				if (calculatedEarliestTime != null) {
+					if (realtime) {
+						eTime = "rt" + calculatedEarliestTime;
+					}
+					else {
+						eTime = calculatedEarliestTime;
+					}
+				}
+			}
+		}
+		return eTime;
+	}
+
+
+	private List runQuery(Args queryArgs) throws Exception {
+		Connection connection = connectionFactory.getConnection();
+		try {
+			Job job = connection.getTarget().getJobs().create(search, queryArgs);
+			while (!job.isDone()) {
+				Thread.sleep(2000);
+			}
+			return extractData(job);
+		} finally {
+			connection.close();
+		}
+	}
+
+	private List blockingSearch() throws Exception {
+		logger.debug("block search start");
+
+		Args queryArgs = new Args();
+		queryArgs.put("exec_mode", "blocking");
+		Calendar startTime = Calendar.getInstance();
+		populateArgs(queryArgs, startTime, false);
+		List data = runQuery(queryArgs);
+		lastSuccessfulReadTime = startTime;
+		return data;
+	}
+
+
+	private List nonBlockingSearch() throws Exception {
+		logger.debug("non block search start");
+
+		Args queryArgs = new Args();
+		queryArgs.put("exec_mode", "normal");
+		Calendar startTime = Calendar.getInstance();
+		populateArgs(queryArgs, startTime, false);
+
+		List data = runQuery(queryArgs);
+		lastSuccessfulReadTime = startTime;
+		return data;
+	}
+
+
+	/**
+	 * @return
+	 * @throws Exception
+	 */
+	private List realtimeSearch() throws Exception {
+		logger.debug("realtime search start");
+
+		Args queryArgs = new Args();
+		queryArgs.put("search_mode", "realtime");
+		Calendar startTime = Calendar.getInstance();
+		populateArgs(queryArgs, startTime, true);
+
+		List data = runQuery(queryArgs);
+		lastSuccessfulReadTime = startTime;
+		return data;
+	}
+
+	/**
+	 * @throws Exception
+	 *
+	 */
+	private List exportSearch() throws Exception {
+		logger.debug("export start");
+		List result = new ArrayList();
+		HashMap data;
+		SplunkData splunkData;
+
+		Args queryArgs = new Args();
+		Calendar startTime = Calendar.getInstance();
+		populateArgs(queryArgs, startTime, false);
+		queryArgs.put("output_mode", "xml");
+
+		Connection connection = connectionFactory.getConnection();
+		try {
+			InputStream os = connection.getTarget().export(search, queryArgs);
+			ResultsReaderXml resultsReader = new ResultsReaderXml(os);
+			while ((data = resultsReader.getNextEvent()) != null) {
+				splunkData = new SplunkData(data);
+				result.add(splunkData);
+			}
+			return result;
+		} finally {
+			connection.close();
+		}
+	}
+
+
+	private List savedSearch() throws Exception {
+		logger.debug("saved search start");
+
+		Args queryArgs = new Args();
+		queryArgs.put("app", "search");
+		if (owner != null && owner.length() > 0) {
+			queryArgs.put("owner", owner);
+		}
+		if (app != null && app.length() > 0) {
+			queryArgs.put("app", app);
+		}
+
+		Calendar startTime = Calendar.getInstance();
+		Connection connection = connectionFactory.getConnection();
+		try {
+			SavedSearch search = null;
+			Job job = null;
+			String latestTime = getLatestTime(startTime, false);
+			String earliestTime = getEarliestTime(startTime, false);
+			SavedSearchCollection savedSearches = connection.getTarget().getSavedSearches(queryArgs);
+			for (SavedSearch s : savedSearches.values()) {
+				if (s.getName().equals(savedSearch)) {
+					search = s;
+				}
+			}
+			if (search != null) {
+				Map args = new HashMap();
+				args.put("force_dispatch", "true");
+				args.put("dispatch.earliest_time", earliestTime);
+				args.put("dispatch.latest_time", latestTime);
+				job = search.dispatch(args);
+			}
+			while (!job.isDone()) {
+				Thread.sleep(2000);
+			}
+			List data = extractData(job);
+			this.lastSuccessfulReadTime = startTime;
+			return data;
+		} finally {
+			connection.close();
+		}
+	}
+
+	private List extractData(Job job) throws Exception {
+		List result = new ArrayList();
+		HashMap data;
+		SplunkData splunkData;
+		ResultsReader resultsReader;
+		int total = job.getResultCount();
+
+		if (count == 0 || total < count) {
+			InputStream stream = null;
+			Args outputArgs = new Args();
+			outputArgs.put("output_mode", "xml");
+			stream = job.getResults(outputArgs);
+
+			resultsReader = new ResultsReaderXml(stream);
+			while ((data = resultsReader.getNextEvent()) != null) {
+				splunkData = new SplunkData(data);
+				result.add(splunkData);
+			}
+		}
+		else {
+			int offset = 0;
+			while (offset < total) {
+				InputStream stream = null;
+				Args outputArgs = new Args();
+				outputArgs.put("output_mode", "xml");
+				outputArgs.put("count", count);
+				outputArgs.put("offset", offset);
+				stream = job.getResults(outputArgs);
+				resultsReader = new ResultsReaderXml(stream);
+				while ((data = resultsReader.getNextEvent()) != null) {
+					splunkData = new SplunkData(data);
+					result.add(splunkData);
+				}
+				offset += count;
+			}
+		}
+		return result;
+	}
+
+	public void afterPropertiesSet() throws Exception {
+		Assert.notNull(initEarliestTime, "initial earliest time can not be null");
+	}
+
+
+
+}
\ No newline at end of file
diff --git a/src/main/java/org/springframework/integration/splunk/support/SplunkDataWriter.java b/src/main/java/org/springframework/integration/splunk/support/SplunkDataWriter.java
new file mode 100644
index 0000000..15a53fe
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/support/SplunkDataWriter.java
@@ -0,0 +1,202 @@
+/*
+ * Copyright 2011-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.splunk.support;
+
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.net.Socket;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.integration.splunk.core.Connection;
+import org.springframework.integration.splunk.core.DataWriter;
+import org.springframework.integration.splunk.core.ConnectionFactory;
+import org.springframework.integration.splunk.entity.SplunkData;
+import org.springframework.util.Assert;
+
+import com.splunk.Args;
+import com.splunk.Index;
+import com.splunk.Receiver;
+import com.splunk.Service;
+
+/**
+ * Data writer to write data into Splunk. There are 3 ways to write data:
+ * REST submit, TCP socket and HTTP stream.
+ *
+ * @author Jarred Li
+ * @since 1.0
+ *
+ */
+public class SplunkDataWriter implements DataWriter, InitializingBean {
+
+	private static final Log logger = LogFactory.getLog(SplunkDataWriter.class);
+
+	private ConnectionFactory connectionFactory;
+
+	private String sourceType;
+
+	private String source;
+
+	private String index;
+
+	private IngestType ingest = IngestType.stream; //tcp, stream, submit
+
+	private int tcpPort;
+
+	private String host;
+
+	private String hostRegex;
+
+	public SplunkDataWriter(ConnectionFactory f) {
+		this.connectionFactory = f;
+	}
+
+	public void write(SplunkData data) throws Exception {
+		logger.debug("write message to splunk:" + data);
+
+		Connection connection = connectionFactory.getConnection();
+		Service service = connection.getTarget();
+		Index indexObject = null;
+		Receiver receiver = null;
+		OutputStream ostream;
+		Socket socket;
+		Writer writer = null;
+
+		Args args = new Args();
+		if (sourceType != null) {
+			args.put("sourcetype", sourceType);
+		}
+		if (source != null) {
+			args.put("source", source);
+		}
+
+		if (host != null) {
+			args.put("host", host);
+		}
+
+		if (hostRegex != null) {
+			args.put("host_regex", hostRegex);
+		}
+
+		try {
+			if (index != null) {
+				indexObject = service.getIndexes().get(index);
+			}
+			else {
+				receiver = service.getReceiver();
+			}
+
+			if ((ingest.equals(IngestType.stream) || ingest.equals(IngestType.tcp))) {
+				if (ingest.equals("stream")) {
+					if (indexObject != null)
+						socket = indexObject.attach(args);
+					else
+						socket = receiver.attach(args);
+				}
+				else {
+					socket = service.open(tcpPort);
+				}
+				ostream = socket.getOutputStream();
+				writer = new OutputStreamWriter(ostream, "UTF8");
+			}
+
+			if ((ingest.equals(IngestType.stream) || ingest.equals(IngestType.tcp))) {
+				writer.write(data.toString());
+				writer.flush();
+				writer.close();
+			}
+			else {
+				if (index != null) {
+					indexObject.submit(args, data.toString());
+				}
+				else {
+					receiver.submit(args, data.toString());
+				}
+			}
+		} finally {
+			connection.close();
+		}
+
+	}
+
+
+	public void setSourceType(String sourceType) {
+		this.sourceType = sourceType;
+	}
+
+	public void setSource(String source) {
+		this.source = source;
+	}
+
+	public void setIndex(String index) {
+		this.index = index;
+	}
+
+	public void setIngest(IngestType ingest) {
+		this.ingest = ingest;
+	}
+
+	public void setTcpPort(int tcpPort) {
+		this.tcpPort = tcpPort;
+	}
+
+	public void setHost(String host) {
+		this.host = host;
+	}
+
+	public void setHostRegex(String hostRegex) {
+		this.hostRegex = hostRegex;
+	}
+
+
+	public String getSourceType() {
+		return sourceType;
+	}
+
+	public String getSource() {
+		return source;
+	}
+
+	public String getIndex() {
+		return index;
+	}
+
+	public IngestType getIngest() {
+		return ingest;
+	}
+
+	public int getTcpPort() {
+		return tcpPort;
+	}
+
+	public String getHost() {
+		return host;
+	}
+
+	public String getHostRegex() {
+		return hostRegex;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
+	 */
+	public void afterPropertiesSet() throws Exception {
+		Assert.notNull(ingest, "You must specify ingest type");
+	}
+
+}
diff --git a/src/main/java/org/springframework/integration/splunk/support/SplunkExecutor.java b/src/main/java/org/springframework/integration/splunk/support/SplunkExecutor.java
new file mode 100644
index 0000000..0dd1b5d
--- /dev/null
+++ b/src/main/java/org/springframework/integration/splunk/support/SplunkExecutor.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2002-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.splunk.support;
+
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.integration.Message;
+import org.springframework.integration.MessageHandlingException;
+import org.springframework.integration.MessagingException;
+import org.springframework.integration.splunk.core.DataReader;
+import org.springframework.integration.splunk.core.DataWriter;
+import org.springframework.integration.splunk.entity.SplunkData;
+
+/**
+ * Bundles common core logic for the Splunk components.
+ *
+ * @author Jarred Li
+ * @since 1.0
+ *
+ */
+public class SplunkExecutor implements InitializingBean {
+
+	private static final Log logger = LogFactory.getLog(SplunkExecutor.class);
+
+	private DataReader reader;
+	private DataWriter writer;
+
+	public SplunkExecutor() {
+	}
+
+	/**
+	 * Verifies and sets the parameters. E.g. initializes the to be used
+	 */
+	public void afterPropertiesSet() {
+
+	}
+
+	/**
+	 * Executes the outbound Splunk Operation.
+	 *
+	 */
+	public Object executeOutboundOperation(final Message message) {
+		try {
+			SplunkData payload = (SplunkData) message.getPayload();
+			writer.write(payload);
+		} catch (Exception e) {
+			String errorMsg = "error in writing data into Splunk";
+			logger.warn(errorMsg, e);
+			throw new MessageHandlingException(message, errorMsg, e);
+		}
+		return null;
+	}
+
+	public void handleMessage(final Message message) {
+		executeOutboundOperation(message);
+	}
+
+	/**
+	 * Execute the Splunk operation.
+	 */
+	public List poll() {
+		logger.debug("poll start:");
+		List queryData = null;
+		try {
+			queryData = reader.search();
+		} catch (Exception e) {
+			String errorMsg = "search Splunk data failed";
+			logger.warn(errorMsg, e);
+			throw new MessagingException(errorMsg, e);
+		}
+		return queryData;
+	}
+
+	public void setReader(DataReader reader) {
+		this.reader = reader;
+	}
+
+	public void setWriter(DataWriter writer) {
+		this.writer = writer;
+	}
+
+
+}
diff --git a/src/main/resources/META-INF/spring.handlers b/src/main/resources/META-INF/spring.handlers
new file mode 100644
index 0000000..4d4111e
--- /dev/null
+++ b/src/main/resources/META-INF/spring.handlers
@@ -0,0 +1 @@
+http\://www.springframework.org/schema/integration/splunk=org.springframework.integration.splunk.config.xml.SplunkNamespaceHandler
diff --git a/src/main/resources/META-INF/spring.schemas b/src/main/resources/META-INF/spring.schemas
new file mode 100644
index 0000000..cc8649e
--- /dev/null
+++ b/src/main/resources/META-INF/spring.schemas
@@ -0,0 +1,2 @@
+http\://www.springframework.org/schema/integration/splunk/spring-integration-splunk-1.0.xsd=org/springframework/integration/splunk/config/xml/spring-integration-splunk-1.0.xsd
+http\://www.springframework.org/schema/integration/splunk/spring-integration-splunk.xsd=org/springframework/integration/splunk/config/xml/spring-integration-splunk-1.0.xsd
diff --git a/src/main/resources/META-INF/spring.tooling b/src/main/resources/META-INF/spring.tooling
new file mode 100644
index 0000000..cf031eb
--- /dev/null
+++ b/src/main/resources/META-INF/spring.tooling
@@ -0,0 +1,4 @@
+# Tooling related information for the integration Splunk namespace
+http\://www.springframework.org/schema/integration/splunk@name=integration Splunk Namespace
+http\://www.springframework.org/schema/integration/splunk@prefix=int-splunk
+http\://www.springframework.org/schema/integration/splunk@icon=org/springframework/integration/splunk/config/xml/spring-integration-splunk.gif
diff --git a/src/main/resources/org/springframework/integration/splunk/config/xml/spring-integration-splunk-1.0.xsd b/src/main/resources/org/springframework/integration/splunk/config/xml/spring-integration-splunk-1.0.xsd
new file mode 100644
index 0000000..c452f4f
--- /dev/null
+++ b/src/main/resources/org/springframework/integration/splunk/config/xml/spring-integration-splunk-1.0.xsd
@@ -0,0 +1,364 @@
+
+
+
+	
+	
+	
+
+	
+		
+	
+
+	
+		
+			
+		
+		
+			
+				
+					
+					
+						
+							
+						
+					
+				
+			
+			
+				
+					
+					
+						
+							
+						
+					
+				
+			
+			
+				
+					
+					
+						
+							
+						
+					
+				
+			
+			
+				
+					
+					
+						
+							
+						
+					
+				
+			
+			
+				
+					
+					
+						
+							
+						
+					
+				
+			
+			
+				
+					
+					
+						
+							
+						
+					
+				
+			
+			
+				
+					
+					
+						
+							
+						
+					
+				
+			
+			
+			
+		
+	
+
+	
+		
+			
+				The definition for the Spring Integration Splunk
+				Inbound Channel Adapter.
+			
+		
+		
+			
+				
+			
+			
+			
+				
+					
+						
+							
+						
+					
+				
+			
+			
+				
+					
+					
+				
+			
+			
+				
+					
+						Search mode: normal, blocking, realtime, export, saved
+					
+				
+			
+			
+				
+					
+						The maximum number of event record to be return
+					
+				
+			
+			
+				
+					
+						A comma-separated list of the fields to return
+					
+				
+			
+			
+				
+					
+						Search String following Splunk syntax.
+					
+				
+			
+			
+				
+					
+						Time modifier for the start of the time window.
+					
+				
+			
+			
+				
+					
+						Time modifier for the  end of the time window.
+					
+				
+			
+						
+				
+					
+						Time modifier for the start of the time window for the first search.
+					
+				
+			
+			
+				
+					
+						Saved search.
+					
+				
+			
+			
+				
+					
+						Owner of the saved search.
+					
+				
+			
+			
+				
+					
+						App of the saved search.
+					
+				
+			
+		
+	
+
+	
+		
+			
+				Defines an outbound Channel Adapter.
+			
+		
+		
+			
+				
+			
+			
+			
+				
+					
+						
+							Channel from which messages will be output.
+							When a message is sent to this channel it will
+							cause the query
+							to
+							be executed.
+						
+						
+							
+						
+					
+				
+			
+			
+				
+					
+						Specifies the order for invocation when this
+						endpoint is connected as a
+						subscriber to a SubscribableChannel.
+					
+				
+			
+			
+				
+					
+						Splunk event source
+					
+				
+			
+			
+				
+					
+						Splunk event source type
+					
+				
+			
+			
+				
+					
+						Splunk index name
+					
+				
+			
+			
+				
+					
+						Splunk ingest method: tcp, streaming, submit. Default stream.
+					
+				
+			
+			
+				
+					
+						Splunk ingest method: tcp, streaming, submit. Default stream.
+					
+				
+			
+			
+				
+					
+						Host where the event occurred
+					
+				
+			
+			
+				
+					
+						Host regex can be provided so Splunk can dynamically extract the host value from the log event
+					
+				
+			
+		
+	
+
+	
+		
+			
+				
+					Identifies the underlying Spring bean definition,
+					which is an
+					instance of either 'EventDrivenConsumer' or
+					'PollingConsumer',
+					depending on whether the component's input
+					channel is a
+					'SubscribableChannel' or 'PollableChannel'.
+				
+			
+		
+		
+			
+				
+					Flag to indicate that the component should start
+					automatically
+					on startup (default true).
+				
+			
+			
+				
+			
+		
+		
+			
+				
+					Splunk Server Bean Name
+				
+			
+		
+		
+			
+				
+					Whether pool the Splunk connection.
+				
+			
+		
+	
+
+
diff --git a/src/main/resources/org/springframework/integration/splunk/config/xml/spring-integration-splunk.gif b/src/main/resources/org/springframework/integration/splunk/config/xml/spring-integration-splunk.gif
new file mode 100644
index 0000000..41b369f
Binary files /dev/null and b/src/main/resources/org/springframework/integration/splunk/config/xml/spring-integration-splunk.gif differ
diff --git a/src/reference/docbook/history.xml b/src/reference/docbook/history.xml
new file mode 100644
index 0000000..d8fde4b
--- /dev/null
+++ b/src/reference/docbook/history.xml
@@ -0,0 +1,20 @@
+
+
+	Change History
+		
+			
+			
+			
+			
+		
+		
+		
+			
+			
+			
+		
+		
+	
ReleaseDateChanges
0.5.02012.9.28Initial release
+
diff --git a/src/reference/docbook/images/logo.png b/src/reference/docbook/images/logo.png new file mode 100644 index 0000000..8c71c13 Binary files /dev/null and b/src/reference/docbook/images/logo.png differ diff --git a/src/reference/docbook/index.xml b/src/reference/docbook/index.xml new file mode 100644 index 0000000..516b920 --- /dev/null +++ b/src/reference/docbook/index.xml @@ -0,0 +1,64 @@ + + + + Spring Integration Splunk Adapter + Splunk Adapter ${version} + Spring Integration + ${version} + + + + + + + + + + + + + + Jarred Li + Mark Pollack + Damien Dallimore + + + © SpringSource Inc., 2012 + + + + + + + What's new? + + + If you are interested in the changes and features, that were introduced in + earlier versions, please take a look at chapter: + + + + + + + + + + Integration Adapters + + + Spring Integration adapter for Splunk includes inbound channel adapter to + read data from Splunk and outbound channel adapter to write data into + Splunk. + + + + + + Appendices + + + + diff --git a/src/reference/docbook/resources.xml b/src/reference/docbook/resources.xml new file mode 100644 index 0000000..c3ffb46 --- /dev/null +++ b/src/reference/docbook/resources.xml @@ -0,0 +1,27 @@ + + + Additional Resources + +
+ Spring Integration Home + + The definitive source of information about Spring Integration is the + Spring Integration Home at + http://www.springsource.org. That site serves as a hub of + information and is the best place to find up-to-date announcements about the project as well as links to + articles, blogs, and new sample applications. + +
+ +
+ Splunk Home + + You can get more information on Splunk from Splunk Home. + + + Splunk SDK API is in Splunk Dev. + +
+ +
diff --git a/src/reference/docbook/splunk.xml b/src/reference/docbook/splunk.xml new file mode 100644 index 0000000..10da20e --- /dev/null +++ b/src/reference/docbook/splunk.xml @@ -0,0 +1,218 @@ + + + Splunk Adapter + + The Spring Integration Splunk Adapter provides outbound and inbound channel adapters: + + + + + + Outbound Channel adapter + + + + + + + Inbound Channel Adapter + + + + + + + To use Spring Integration adapter for Splunk, you have to import the XML namespace. For example, you can + have following XML: + + + + +]]> + + + Meanwhile, you have to define your Splunk server information. For example + you can define server as following: + + + + ... + + ... +]]> + +
+ Outbound Channel Adapter + + Outbound channel adapter is used to put data into Splunk from + channels in Spring Integration. + There are 3 kinds of method to put data: + + + + Submit (HTTP REST) + Stream + Tcp + + + + The main difference between using the REST inputs vs plain TCP/UDP inputs is really + in the Splunk event handling pipeline. + + + + With REST , you have to declare your event meta data (index, source, source type…) + in the HTTP request at the source. You can't really transform the log event anymore + after you have created and sent it to Splunk.Typically though, for people using REST, + this is fine because they are well formatting their log events before sending them + anyway ie: no further processing/transforming and manipulation is required. + You can however still do dynamic search time transforms/filtering on the + data when later searching over it in Splunk. + + + To use outbound channel adapter with submit, you can define the adapter as following: + + +]]> + + + With TCP inputs , you can manipulate and transform the event data in Splunk before + it gets indexed (using entrys in props.conf/transforms.conf). The event meta data + (index, source, source type…) gets declared on the Splunk side when you establish + the TCP/UDP input and can also be dynamically created, so essentially you have + a lot more control over the indexing of the event data.This is generally more + important when you don't control the format of the data at the source and it needs + manipulating/filtering ie: network devices syslogging etc… + + + + To use outbound channel adapter with tcp, you can define the adapter as following: + + +]]> + + + To use outbound channel adapter with stream, you can define the adapter as following: + + + +]]> + +
+ +
+ Inbound Channel Adapter + + Inbound channel adapter is used to get data out of Splunk and put + into Spring Integration's channel. + There are 5 ways to get data out of Splunk: + + + + Blocking + Non blocking + Saved search + Realtime + Export + + + + For more information on the difference, please refer + Splunk SDK + + + + To use bloking inbound channel adapter, you can define the adapter as following: + + + +]]> + + + To use non blocking inbound channel adapter, you can define the adapter as following: + + + +]]> + + + To use saved search inbound channel adapter, you can define the adapter as following: + + + +]]> + + + To use realtime search inbound channel adapter, you can define the adapter as following: + + + +]]> + + To use export inbound channel adapter, you can define the adapter as following: + + + +]]> + + + As Splunk support range search, you can specify the search rage by using + "latestTime", "earliestTime", "initEarliestTime". + + + "initEarliestTime" is the value for "earliestTime" when the application first start. + If you specify "earliestTime" and "latestTime", the poller will only search data + in that range. Otherwise, the range will move forward as time goes. That means, the + "latestTime" is equal to the time where the polling trigger, the "earliestTime" is + equal to the time where the last polling is run. + + + You can get more information on the rage search from + + Splunk. + +
+
diff --git a/src/reference/docbook/whats-new.xml b/src/reference/docbook/whats-new.xml new file mode 100644 index 0000000..cd9d2cd --- /dev/null +++ b/src/reference/docbook/whats-new.xml @@ -0,0 +1,17 @@ + + + What's new? + + The Spring Integration adapter for Splunk includes two adapters: + + + + Inbound Channel Adapter to search data from Splunk. + + + Outbound Channel Adapter to push event data into Splunk. + + + diff --git a/src/test/java/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserSavedSearchTests.java b/src/test/java/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserSavedSearchTests.java new file mode 100644 index 0000000..ba6756a --- /dev/null +++ b/src/test/java/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserSavedSearchTests.java @@ -0,0 +1,69 @@ +/* + * Copyright 2011-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.splunk.config.xml; + +import junit.framework.Assert; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.integration.endpoint.SourcePollingChannelAdapter; +import org.springframework.integration.splunk.support.SearchMode; +import org.springframework.integration.splunk.support.SplunkDataReader; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Jarred Li + * @since 1.0 + * + */ + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration +public class SplunkInboundChannelAdapterParserSavedSearchTests { + + @Autowired + private ApplicationContext appContext; + + /** + * Test method for {@link org.springframework.integration.splunk.config.xml.SplunkInboundChannelAdapterParser#parseSource(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext)}. + */ + @Test + public void testParseSourceElementParserContext() { + SourcePollingChannelAdapter adapter = appContext.getBean("splunkInboundChannelAdapter", + SourcePollingChannelAdapter.class); + Assert.assertNotNull(adapter); + + SplunkDataReader reader = appContext.getBean("splunkInboundChannelAdapter.splunkExecutor.reader", + SplunkDataReader.class); + Assert.assertNotNull(reader); + + SearchMode mode = SearchMode.saved; + Assert.assertEquals(mode, reader.getMode()); + + String savedSearch = "savedSearch"; + Assert.assertEquals(savedSearch, reader.getSavedSearch()); + + String owner = "admin"; + Assert.assertEquals(owner, reader.getOwner()); + + String app = "search"; + Assert.assertEquals(app, reader.getApp()); + } + +} diff --git a/src/test/java/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserTests.java b/src/test/java/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserTests.java new file mode 100644 index 0000000..e3a8f8b --- /dev/null +++ b/src/test/java/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserTests.java @@ -0,0 +1,78 @@ +/* + * Copyright 2011-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.splunk.config.xml; + +import junit.framework.Assert; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.integration.endpoint.SourcePollingChannelAdapter; +import org.springframework.integration.splunk.support.SearchMode; +import org.springframework.integration.splunk.support.SplunkDataReader; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Jarred Li + * @since 1.0 + * + */ + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration +public class SplunkInboundChannelAdapterParserTests { + + @Autowired + private ApplicationContext appContext; + + /** + * Test method for {@link org.springframework.integration.splunk.config.xml.SplunkInboundChannelAdapterParser#parseSource(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext)}. + */ + @Test + //@Ignore + public void testParseSourceElementParserContext() { + SourcePollingChannelAdapter adapter = appContext.getBean("splunkInboundChannelAdapter", + SourcePollingChannelAdapter.class); + Assert.assertNotNull(adapter); + Assert.assertFalse(adapter.isAutoStartup()); + + SplunkDataReader reader = appContext.getBean("splunkInboundChannelAdapter.splunkExecutor.reader", + SplunkDataReader.class); + Assert.assertNotNull(reader); + + String searchString = "search spring:example"; + Assert.assertEquals(searchString, reader.getSearch()); + + SearchMode mode = SearchMode.blocking; + Assert.assertEquals(mode, reader.getMode()); + + String earliestTime = "-1d"; + Assert.assertEquals(earliestTime, reader.getEarliestTime()); + + String latestTime = "now"; + Assert.assertEquals(latestTime, reader.getLatestTime()); + + String initEarliestTime = "-1d"; + Assert.assertEquals(initEarliestTime, reader.getInitEarliestTime()); + + String fieldList = "field1, field2"; + Assert.assertEquals(fieldList, reader.getFieldList()); + + } + +} diff --git a/src/test/java/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserStreamTests.java b/src/test/java/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserStreamTests.java new file mode 100644 index 0000000..5b70423 --- /dev/null +++ b/src/test/java/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserStreamTests.java @@ -0,0 +1,64 @@ +/* + * Copyright 2011-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.splunk.config.xml; + +import junit.framework.Assert; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.integration.splunk.support.IngestType; +import org.springframework.integration.splunk.support.SplunkDataWriter; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Jarred Li + * @since 1.0 + * + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration +public class SplunkOutboundChannelAdapterParserStreamTests { + + @Autowired + private ApplicationContext appContext; + + /** + * Test method for {@link org.springframework.integration.splunk.config.xml.SplunkOutboundChannelAdapterParser#parseConsumer(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext)}. + */ + @Test + public void testParseConsumerElementParserContext() { + Object adapter = appContext.getBean("splunkOutboundChannelAdapter"); + Assert.assertNotNull(adapter); + + SplunkDataWriter writer = appContext.getBean("splunkOutboundChannelAdapter.splunkExecutor.writer", + SplunkDataWriter.class); + Assert.assertNotNull(writer); + + IngestType ingest = IngestType.stream; + Assert.assertEquals(ingest, writer.getIngest()); + + String host = "test.host"; + Assert.assertEquals(host, writer.getHost()); + + String hostRegex = "test.host.*"; + Assert.assertEquals(hostRegex, writer.getHostRegex()); + + } + +} diff --git a/src/test/java/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserTests.java b/src/test/java/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserTests.java new file mode 100644 index 0000000..99dd49b --- /dev/null +++ b/src/test/java/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserTests.java @@ -0,0 +1,65 @@ +/* + * Copyright 2011-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.splunk.config.xml; + +import junit.framework.Assert; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.integration.splunk.support.IngestType; +import org.springframework.integration.splunk.support.SplunkDataWriter; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Jarred Li + * @since 1.0 + * + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration +public class SplunkOutboundChannelAdapterParserTests { + + @Autowired + private ApplicationContext appContext; + + /** + * Test method for {@link org.springframework.integration.splunk.config.xml.SplunkOutboundChannelAdapterParser#parseConsumer(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext)}. + */ + @Test + public void testParseConsumerElementParserContext() { + Object adapter = appContext.getBean("splunkOutboundChannelAdapter"); + Assert.assertNotNull(adapter); + + SplunkDataWriter writer = appContext.getBean("splunkOutboundChannelAdapter.splunkExecutor.writer", + SplunkDataWriter.class); + Assert.assertNotNull(writer); + + String sourceType = "spring-integration"; + Assert.assertEquals(sourceType, writer.getSourceType()); + + String source = "example5"; + Assert.assertEquals(source, writer.getSource()); + + IngestType ingest = IngestType.submit; + Assert.assertEquals(ingest, writer.getIngest()); + + + } + +} diff --git a/src/test/java/org/springframework/integration/splunk/config/xml/SplunkServerParserTests.java b/src/test/java/org/springframework/integration/splunk/config/xml/SplunkServerParserTests.java new file mode 100644 index 0000000..50c26bf --- /dev/null +++ b/src/test/java/org/springframework/integration/splunk/config/xml/SplunkServerParserTests.java @@ -0,0 +1,56 @@ +/* + * Copyright 2011-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.splunk.config.xml; + +import junit.framework.Assert; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.integration.splunk.entity.SplunkServer; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Jarred Li + * @since 1.0 + * + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration +public class SplunkServerParserTests { + + @Autowired + private ApplicationContext appContext; + + /** + * Test method for {@link org.springframework.integration.splunk.config.xml.SplunkServerParser#doParse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext, org.springframework.beans.factory.support.BeanDefinitionBuilder)}. + */ + @Test + public void testDoParseElementParserContextBeanDefinitionBuilder() { + SplunkServer server = appContext.getBean("splunkServer", SplunkServer.class); + + Assert.assertEquals("test.splunk.server", server.getHost()); + Assert.assertEquals(8089, server.getPort()); + Assert.assertEquals("admin", server.getUserName()); + Assert.assertEquals("password", server.getPassword()); + Assert.assertEquals("https", server.getScheme()); + Assert.assertEquals("admin", server.getOwner()); + Assert.assertEquals("search", server.getApp()); + } + +} diff --git a/src/test/java/org/springframework/integration/splunk/inbound/SplunkPollingChannelAdapterTests.java b/src/test/java/org/springframework/integration/splunk/inbound/SplunkPollingChannelAdapterTests.java new file mode 100644 index 0000000..b32b685 --- /dev/null +++ b/src/test/java/org/springframework/integration/splunk/inbound/SplunkPollingChannelAdapterTests.java @@ -0,0 +1,71 @@ +/* + * Copyright 2011-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.splunk.inbound; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; + +import junit.framework.Assert; + +import org.junit.Before; +import org.junit.Test; +import org.springframework.integration.splunk.entity.SplunkData; +import org.springframework.integration.splunk.support.SplunkExecutor; + +/** + * @author Jarred Li + * @since 1.0 + * + */ +public class SplunkPollingChannelAdapterTests { + + private SplunkPollingChannelAdapter inboundAdapter; + + private SplunkExecutor executor; + + @Before + public void init() { + executor = mock(SplunkExecutor.class); + inboundAdapter = new SplunkPollingChannelAdapter(executor); + } + + /** + * Test method for {@link org.springframework.integration.splunk.inbound.SplunkPollingChannelAdapter#receive()}. + */ + @Test + public void testReceive() { + List data = new ArrayList(); + SplunkData sd = new SplunkData("spring", "spring:example"); + sd.setCommonDesc("description"); + data.add(sd); + when(executor.poll()).thenReturn(data); + + List received = inboundAdapter.receive().getPayload(); + Assert.assertEquals(1, received.size()); + } + + /** + * Test method for {@link org.springframework.integration.splunk.inbound.SplunkPollingChannelAdapter#getComponentType()}. + */ + @Test + public void testGetComponentType() { + Assert.assertEquals("splunk:inbound-channel-adapter", inboundAdapter.getComponentType()); + } + +} diff --git a/src/test/java/org/springframework/integration/splunk/outbound/SplunkOutboundChannelAdapterTests.java b/src/test/java/org/springframework/integration/splunk/outbound/SplunkOutboundChannelAdapterTests.java new file mode 100644 index 0000000..dc4fbff --- /dev/null +++ b/src/test/java/org/springframework/integration/splunk/outbound/SplunkOutboundChannelAdapterTests.java @@ -0,0 +1,64 @@ +/* + * Copyright 2011-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.splunk.outbound; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import junit.framework.Assert; + +import org.junit.Before; +import org.junit.Test; +import org.springframework.integration.Message; +import org.springframework.integration.splunk.support.SplunkExecutor; + +/** + * @author Jarred Li + * @since 1.0 + * + */ +public class SplunkOutboundChannelAdapterTests { + + private SplunkOutboundChannelAdapter outboundAdapter; + + private SplunkExecutor executor; + + @Before + public void init() { + executor = mock(SplunkExecutor.class); + outboundAdapter = new SplunkOutboundChannelAdapter(executor); + } + + /** + * Test method for {@link org.springframework.integration.splunk.outbound.SplunkOutboundChannelAdapter#handleRequestMessage(org.springframework.integration.Message)}. + */ + @Test + public void testHandleRequestMessage() { + Message message = null; + when(executor.executeOutboundOperation(message)).thenReturn(null); + + Object ret = outboundAdapter.handleRequestMessage(message); + Assert.assertNull(ret); + } + + /** + * Test method for {@link org.springframework.integration.splunk.outbound.SplunkOutboundChannelAdapter#setProducesReply(boolean)}. + */ + @Test + public void testSetProducesReply() { + outboundAdapter.setProducesReply(false); + } + +} diff --git a/src/test/java/org/springframework/integration/splunk/support/ConnectionFactoryFactoryBeanTests.java b/src/test/java/org/springframework/integration/splunk/support/ConnectionFactoryFactoryBeanTests.java new file mode 100644 index 0000000..9036d79 --- /dev/null +++ b/src/test/java/org/springframework/integration/splunk/support/ConnectionFactoryFactoryBeanTests.java @@ -0,0 +1,88 @@ +/* + * Copyright 2011-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.splunk.support; + +import junit.framework.Assert; + +import org.junit.Test; +import org.springframework.integration.splunk.core.ConnectionFactory; +import org.springframework.integration.splunk.entity.SplunkServer; + +import com.splunk.Service; + +/** + * @author Jarred Li + * @since 1.0 + * + */ +public class ConnectionFactoryFactoryBeanTests { + + private ConnectionFactoryFactoryBean factoryBean; + + + /** + * Test method for {@link org.springframework.integration.splunk.support.ConnectionFactoryFactoryBean#ConnectionFactoryFactoryBean(org.springframework.integration.splunk.core.ConnectionFactory, boolean)}. + * @throws Exception + */ + @Test + public void testConnectionFactoryFactoryBean() throws Exception { + SplunkServer server = new SplunkServer(); + SplunkConnectionFactory factory = new SplunkConnectionFactory(server); + factoryBean = new ConnectionFactoryFactoryBean(factory, false); + + ConnectionFactory generatedByFactoryBean = factoryBean.getObject(); + Assert.assertTrue(generatedByFactoryBean instanceof SplunkConnectionFactory); + + } + + @Test + public void testConnectionFactoryFactoryBean_withPoll() throws Exception { + SplunkServer server = new SplunkServer(); + SplunkConnectionFactory factory = new SplunkConnectionFactory(server); + factoryBean = new ConnectionFactoryFactoryBean(factory, true); + + ConnectionFactory generatedByFactoryBean = factoryBean.getObject(); + Assert.assertTrue(generatedByFactoryBean instanceof PoolingConnectionFactory); + + } + + + /** + * Test method for {@link org.springframework.integration.splunk.support.ConnectionFactoryFactoryBean#getObjectType()}. + */ + @Test + public void testGetObjectType() { + SplunkServer server = new SplunkServer(); + SplunkConnectionFactory factory = new SplunkConnectionFactory(server); + factoryBean = new ConnectionFactoryFactoryBean(factory, true); + + Class clazz = factoryBean.getObjectType(); + Assert.assertEquals(PoolingConnectionFactory.class, clazz); + } + + /** + * Test method for {@link org.springframework.integration.splunk.support.ConnectionFactoryFactoryBean#isSingleton()}. + */ + @Test + public void testIsSingleton() { + SplunkServer server = new SplunkServer(); + SplunkConnectionFactory factory = new SplunkConnectionFactory(server); + factoryBean = new ConnectionFactoryFactoryBean(factory, false); + + Assert.assertTrue(factoryBean.isSingleton()); + } + +} diff --git a/src/test/java/org/springframework/integration/splunk/support/PoolingConnectionFactoryTests.java b/src/test/java/org/springframework/integration/splunk/support/PoolingConnectionFactoryTests.java new file mode 100644 index 0000000..328be7e --- /dev/null +++ b/src/test/java/org/springframework/integration/splunk/support/PoolingConnectionFactoryTests.java @@ -0,0 +1,111 @@ +/* + * Copyright 2011-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.splunk.support; + +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import junit.framework.Assert; + +import org.junit.Before; +import org.junit.Test; +import org.springframework.integration.splunk.core.Connection; +import org.springframework.integration.splunk.core.ConnectionFactory; + +/** + * @author Jarred Li + * @since 1.0 + * + */ +public class PoolingConnectionFactoryTests { + + private ConnectionFactory conFactory; + + private PoolingConnectionFactory poolConFactory; + + @SuppressWarnings("unchecked") + @Before + public void before() { + conFactory = mock(ConnectionFactory.class); + poolConFactory = new PoolingConnectionFactory(conFactory); + } + + + /** + * Test method for {@link org.springframework.integration.splunk.support.PoolingConnectionFactory#getConnection()}. + * @throws Exception + */ + @Test + public void testGetConnection() throws Exception { + @SuppressWarnings("unchecked") + Connection con = mock(Connection.class); + + when(con.getTarget()).thenReturn(new TestEntity("entity1")); + when(conFactory.getConnection()).thenReturn(con); + Connection returnCon = poolConFactory.getConnection(); + TestEntity obj1 = returnCon.getTarget(); + Assert.assertNotNull(obj1); + Assert.assertEquals("entity1", obj1.getName()); + + when(con.getTarget()).thenReturn(new TestEntity("entity2")); + when(conFactory.getConnection()).thenReturn(con); + returnCon = poolConFactory.getConnection(); + TestEntity obj2 = returnCon.getTarget(); + Assert.assertNotNull(obj2); + Assert.assertEquals("entity2", obj2.getName()); + + when(con.getTarget()).thenReturn(new TestEntity("entity3")); + when(conFactory.getConnection()).thenReturn(con); + returnCon = poolConFactory.getConnection(); + TestEntity obj3 = returnCon.getTarget(); + Assert.assertNotNull(obj3); + Assert.assertEquals("entity3", obj3.getName()); + + + } + + /** + * Test method for {@link org.springframework.integration.splunk.support.PoolingConnectionFactory#destroy()}. + * @throws Exception + */ + @Test(expected = IllegalStateException.class) + public void testDestroy() throws Exception { + try { + poolConFactory.destroy(); + } catch (Exception e) { + fail("exception when destoying pool connection factory"); + } + poolConFactory.getConnection(); + } + + public static class TestEntity { + private String name; + + public TestEntity(String n) { + this.name = n; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + } + + +} diff --git a/src/test/java/org/springframework/integration/splunk/support/SplunkDataReaderTests.java b/src/test/java/org/springframework/integration/splunk/support/SplunkDataReaderTests.java new file mode 100644 index 0000000..7fcde9e --- /dev/null +++ b/src/test/java/org/springframework/integration/splunk/support/SplunkDataReaderTests.java @@ -0,0 +1,143 @@ +/* + * Copyright 2011-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.splunk.support; + +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.Map; + +import junit.framework.Assert; + +import org.junit.Before; +import org.junit.Test; +import org.springframework.core.io.ClassPathResource; +import org.springframework.integration.splunk.core.Connection; +import org.springframework.integration.splunk.core.ConnectionFactory; +import org.springframework.integration.splunk.entity.SplunkData; + +import com.splunk.Job; +import com.splunk.JobCollection; +import com.splunk.Service; + +/** + * @author Jarred Li + * @since 1.0 + * + */ +public class SplunkDataReaderTests { + + private SplunkDataReader reader; + + @Before + public void before() { + reader = new SplunkDataReader(new TestConnectioniFactory()); + } + + /** + * Test method for {@link org.springframework.integration.splunk.support.SplunkDataReader#search()}. + * @throws Exception + */ + @Test + public void testBlockingSearch() throws Exception { + reader.setMode(SearchMode.blocking); + reader.setSearch("search spring:example"); + List data = reader.search(); + Assert.assertNotNull(data); + Assert.assertEquals(5, data.size()); + } + + @Test + public void testNonBlockingSearch() throws Exception { + reader.setMode(SearchMode.normal); + reader.setSearch("search spring:example"); + List data = reader.search(); + Assert.assertNotNull(data); + Assert.assertEquals(5, data.size()); + } + + + @Test + public void testRealtimeSearch() throws Exception { + reader.setMode(SearchMode.realtime); + reader.setSearch("search spring:example"); + List data = reader.search(); + Assert.assertNotNull(data); + Assert.assertEquals(5, data.size()); + } + + public static class TestConnectioniFactory implements ConnectionFactory { + + /* (non-Javadoc) + * @see org.springframework.integration.splunk.core.ConnectionFactory#getConnection() + */ + public Connection getConnection() throws Exception { + return new TestConnection(); + } + } + + public static class TestConnection implements Connection { + + private Service service = mock(Service.class); + + /* (non-Javadoc) + * @see org.springframework.integration.splunk.core.Connection#getTarget() + */ + public Service getTarget() { + InputStream is = null; + + try { + is = new ClassPathResource("splunk-data.xml").getInputStream(); + } catch (FileNotFoundException e) { + Assert.fail("can not read splunk data file"); + } catch (IOException e) { + Assert.fail("can not read splunk data file"); + } + + + service.setToken("token"); + JobCollection jobCollection = mock(JobCollection.class); + Job blockingJob = mock(Job.class); + when(blockingJob.isDone()).thenReturn(true); + when(blockingJob.getResultCount()).thenReturn(5); + when(blockingJob.getResults(any(Map.class))).thenReturn(is); + when(jobCollection.create(any(String.class), any(Map.class))).thenReturn(blockingJob); + when(service.getJobs()).thenReturn(jobCollection); + return service; + } + + /* (non-Javadoc) + * @see org.springframework.integration.splunk.core.Connection#close() + */ + public void close() { + + } + + /* (non-Javadoc) + * @see org.springframework.integration.splunk.core.Connection#isOpen() + */ + public boolean isOpen() { + return true; + } + + } + +} diff --git a/src/test/java/org/springframework/integration/splunk/support/SplunkDataWriterTests.java b/src/test/java/org/springframework/integration/splunk/support/SplunkDataWriterTests.java new file mode 100644 index 0000000..7fea6b8 --- /dev/null +++ b/src/test/java/org/springframework/integration/splunk/support/SplunkDataWriterTests.java @@ -0,0 +1,100 @@ +/* + * Copyright 2011-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.splunk.support; + +import static org.mockito.Matchers.*; +import static org.mockito.Mockito.*; + +import org.junit.Before; +import org.junit.Test; +import org.springframework.integration.splunk.core.Connection; +import org.springframework.integration.splunk.core.ConnectionFactory; +import org.springframework.integration.splunk.entity.SplunkData; + +import com.splunk.Args; +import com.splunk.Receiver; +import com.splunk.Service; + +/** + * @author Jarred Li + * @since 1.0 + * + */ +public class SplunkDataWriterTests { + + private SplunkDataWriter writer; + + private static Receiver receiver = mock(Receiver.class); + + @Before + public void before() { + writer = new SplunkDataWriter(new TestConnectioniFactory()); + } + + /** + * Test method for {@link org.springframework.integration.splunk.support.SplunkDataWriter#write(org.springframework.integration.splunk.entity.SplunkData)}. + * @throws Exception + */ + @Test + public void testWrite() throws Exception { + writer.setIngest(IngestType.submit); + + SplunkData sd = new SplunkData("spring", "spring:example"); + sd.setCommonDesc("description"); + writer.write(sd); + Args args = new Args(); + verify(receiver).submit(eq(args), matches(".*spring:example.*")); + } + + public static class TestConnectioniFactory implements ConnectionFactory { + + /* (non-Javadoc) + * @see org.springframework.integration.splunk.core.ConnectionFactory#getConnection() + */ + public Connection getConnection() throws Exception { + return new TestConnection(); + } + } + + public static class TestConnection implements Connection { + + private Service service = mock(Service.class); + + /* (non-Javadoc) + * @see org.springframework.integration.splunk.core.Connection#getTarget() + */ + public Service getTarget() { + service.setToken("token"); + when(service.getReceiver()).thenReturn(receiver); + return service; + } + + /* (non-Javadoc) + * @see org.springframework.integration.splunk.core.Connection#close() + */ + public void close() { + + } + + /* (non-Javadoc) + * @see org.springframework.integration.splunk.core.Connection#isOpen() + */ + public boolean isOpen() { + return true; + } + + } +} diff --git a/src/test/java/org/springframework/integration/splunk/support/SplunkExecutorTests.java b/src/test/java/org/springframework/integration/splunk/support/SplunkExecutorTests.java new file mode 100644 index 0000000..9163964 --- /dev/null +++ b/src/test/java/org/springframework/integration/splunk/support/SplunkExecutorTests.java @@ -0,0 +1,90 @@ +/* + * Copyright 2011-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.splunk.support; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; + +import junit.framework.Assert; + +import org.junit.Before; +import org.junit.Test; +import org.springframework.integration.Message; +import org.springframework.integration.splunk.core.DataReader; +import org.springframework.integration.splunk.core.DataWriter; +import org.springframework.integration.splunk.entity.SplunkData; +import org.springframework.integration.support.MessageBuilder; + +/** + * @author Jarred Li + * @since 1.0 + * + */ +public class SplunkExecutorTests { + + private SplunkExecutor executor; + + private DataReader reader = mock(DataReader.class); + + private DataWriter writer = mock(DataWriter.class); + + @Before + public void before() { + executor = new SplunkExecutor(); + executor.setReader(reader); + executor.setWriter(writer); + } + + + /** + * Test method for {@link org.springframework.integration.splunk.support.SplunkExecutor#handleMessage(org.springframework.integration.Message)}. + * @throws Exception + */ + @Test + public void testHandleMessage() throws Exception { + SplunkData sd = new SplunkData("spring", "spring:example"); + sd.setCommonDesc("description"); + Message message = MessageBuilder.withPayload(sd).build(); + executor.handleMessage(message); + verify(writer).write(sd); + } + + /** + * Test method for {@link org.springframework.integration.splunk.support.SplunkExecutor#poll()}. + * @throws Exception + */ + @Test + public void testPoll() throws Exception { + List data = new ArrayList(); + SplunkData sd = new SplunkData("spring", "spring:example"); + sd.setCommonDesc("description"); + data.add(sd); + + sd = new SplunkData("spring", "spring:example"); + sd.setCommonDesc("description"); + data.add(sd); + when(reader.search()).thenReturn(data); + + List result = executor.poll(); + Assert.assertEquals(2, result.size()); + + } + +} diff --git a/src/test/resources/log4j.properties b/src/test/resources/log4j.properties new file mode 100644 index 0000000..6142a0d --- /dev/null +++ b/src/test/resources/log4j.properties @@ -0,0 +1,5 @@ +log4j.rootCategory=INFO, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss.SSS} %-5p [%t][%c] %m%n diff --git a/src/test/resources/org/springframework/integration/splunk/SplunkCommon-context.xml b/src/test/resources/org/springframework/integration/splunk/SplunkCommon-context.xml new file mode 100644 index 0000000..4cdbdf3 --- /dev/null +++ b/src/test/resources/org/springframework/integration/splunk/SplunkCommon-context.xml @@ -0,0 +1,19 @@ + + + + + + + + + diff --git a/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserCommon-context.xml b/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserCommon-context.xml new file mode 100644 index 0000000..7bf4b88 --- /dev/null +++ b/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserCommon-context.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + diff --git a/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserSavedSearchTests-context.xml b/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserSavedSearchTests-context.xml new file mode 100644 index 0000000..8a0ab3f --- /dev/null +++ b/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserSavedSearchTests-context.xml @@ -0,0 +1,25 @@ + + + + + + + + + + diff --git a/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserTests-context.xml b/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserTests-context.xml new file mode 100644 index 0000000..0bd2da1 --- /dev/null +++ b/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserTests-context.xml @@ -0,0 +1,24 @@ + + + + + + + + + + diff --git a/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserStreamTests-context.xml b/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserStreamTests-context.xml new file mode 100644 index 0000000..3462ff6 --- /dev/null +++ b/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserStreamTests-context.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + diff --git a/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserTests-context.xml b/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserTests-context.xml new file mode 100644 index 0000000..57ec361 --- /dev/null +++ b/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserTests-context.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + diff --git a/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkServerParserTests-context.xml b/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkServerParserTests-context.xml new file mode 100644 index 0000000..e263634 --- /dev/null +++ b/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkServerParserTests-context.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/src/test/resources/splunk-data.xml b/src/test/resources/splunk-data.xml new file mode 100644 index 0000000..c492d7e --- /dev/null +++ b/src/test/resources/splunk-data.xml @@ -0,0 +1,236 @@ + + + + +_cd +_indextime +_raw +_serial +_si +_sourcetype +_subsecond +_time +host +index +linecount +source +sourcetype +splunk_server + + + + + 9:30 + + + 1348478076 + + 2012-09-24 17:19:43:792+0800 name="spring" event_id="spring:example" desc="description" + + 0 + + + jarred-virtual-machine + main + + + spring-integration + + + .792 + + + 2012-09-24T17:19:43.792+08:00 + + + test.host + + + main + + + 1 + + + example5 + + + spring-integration + + + jarred-virtual-machine + + + + + 9:26 + + + 1348478076 + + 2012-09-24 17:19:43:756+0800 name="spring" event_id="spring:example" desc="description" + + 1 + + + jarred-virtual-machine + main + + + spring-integration + + + .756 + + + 2012-09-24T17:19:43.756+08:00 + + + test.host + + + main + + + 1 + + + example5 + + + spring-integration + + + jarred-virtual-machine + + + + + 9:21 + + + 1348464748 + + 2012-09-24 13:37:34:860+0800 name="spring" event_id="spring:example" desc="description" + + 2 + + + jarred-virtual-machine + main + + + spring-integration + + + .860 + + + 2012-09-24T13:37:34.860+08:00 + + + test.host + + + main + + + 1 + + + example5 + + + spring-integration + + + jarred-virtual-machine + + + + + 9:17 + + + 1348464748 + + 2012-09-24 13:37:34:789+0800 name="spring" event_id="spring:example" desc="description" + + 3 + + + jarred-virtual-machine + main + + + spring-integration + + + .789 + + + 2012-09-24T13:37:34.789+08:00 + + + test.host + + + main + + + 1 + + + example5 + + + spring-integration + + + jarred-virtual-machine + + + + + 9:12 + + + 1348464606 + + 2012-09-24 13:35:13:621+0800 name="spring" event_id="spring:example" desc="description" + + 4 + + + jarred-virtual-machine + main + + + spring-integration + + + .621 + + + 2012-09-24T13:35:13.621+08:00 + + + test.host + + + main + + + 1 + + + example5 + + + spring-integration + + + jarred-virtual-machine + + + \ No newline at end of file