diff --git a/spring-integration-splunk/.gitignore b/spring-integration-splunk/.gitignore deleted file mode 100644 index 0c7fdb9..0000000 --- a/spring-integration-splunk/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -.classpath -.project -.settings/ -.gradle -build -target/ -bin/ -derby.log diff --git a/spring-integration-splunk/README.md b/spring-integration-splunk/README.md index 6d2698d..956674b 100644 --- a/spring-integration-splunk/README.md +++ b/spring-integration-splunk/README.md @@ -1,168 +1,4 @@ Spring Integration Splunk Adapter ================================================= -The SI adapter includes Outbound Channel Adapter and Inbound Channel Adapter. - -Inbound channel adapter : ------------------------------------------------------------------------------ -The Inbound channel adapter is used to read data from Splunk and output a message containing the data to a Spring Integration channel. There are 5 ways to get data from 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: ----------------------------------------------------------------------------------------------- - -The Outbound channel adapter is used to write data to Splunk from a Spring Integration message channel. There are 3 types of data writers provided: - -* submit - Use's Splunk's REST API. Appropriate for small or infrequent data loads. Posts data to a named index or the default if not specified. -* index - Streams data to a named index or the default if not specified. -* tcp - Streams data to a tcp port associated with a defined tcp input. - -The outbound channel adapter requires a child *-writer element which defines related attributes: - -### Submit: - -```xml - - - -``` - -### Index: - -```xml - - - -``` - -### TCP - -```xml - - - -``` - -*NOTE: The input must exist and be enabled on the server* - -### Configuring The Splunk Server connection - -```xml - -``` - -Alternatively, you can configure a Splunk Server failover mechanism - -```xml - - - - - - - - - - - - -``` - -Additional server properties include (see [splunk](http://docs.splunk.com/Documentation/Splunk/latest) documentation for details): - -* app -* scheme -* scope -* owner - -The default host is *localhost* and the default port is *8089*. The *timeout* attribute indicates how long to wait for a connection in miliseconds. - - -Development ------------------ -### Build: - - ./gradlew build - -### Import the project to Eclipse: - -To generate Eclipse metadata (e.g., .classpath and .project files), do the following: - - ./gradlew eclipse - +The project is hosted on https://github.com/spring-projects/spring-integration-splunk \ No newline at end of file diff --git a/spring-integration-splunk/build.gradle b/spring-integration-splunk/build.gradle deleted file mode 100644 index d930be6..0000000 --- a/spring-integration-splunk/build.gradle +++ /dev/null @@ -1,270 +0,0 @@ -description = 'Spring Integration Splunk Adapter' - -buildscript { - repositories { - maven { url 'http://repo.spring.io/plugins-release' } - } - dependencies { - classpath 'org.springframework.build.gradle:docbook-reference-plugin:0.2.8' - classpath 'org.springframework.build.gradle:spring-io-plugin:0.0.3.RELEASE' - } -} - -apply plugin: 'java' -apply from: "${rootProject.projectDir}/publish-maven.gradle" -apply plugin: 'eclipse' -apply plugin: 'idea' - -if (project.hasProperty('platformVersion')) { - apply plugin: 'spring-io' - - repositories { - maven { url "https://repo.spring.io/libs-snapshot" } - } - - dependencies { - springIoVersions "io.spring.platform:platform-versions:${platformVersion}@properties" - } -} - -group = 'org.springframework.integration' - -repositories { - maven { url 'http://repo.spring.io/libs-milestone' } -} - -sourceCompatibility=1.6 -targetCompatibility=1.6 - -ext { - linkHomepage = 'https://github.com/spring-projects/spring-integration-extensions' - linkCi = 'https://build.spring.io/browse/INTEXT' - linkIssue = 'https://jira.spring.io/browse/INTEXT' - linkScmUrl = 'https://github.com/spring-projects/spring-integration-extensions' - linkScmConnection = 'https://github.com/spring-projects/spring-integration-extensions.git' - linkScmDevConnection = 'git@github.com:spring-projects/spring-integration-extensions.git' - - shortName = 'splunk' -} - -// 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.integration:spring-integration-core:$springIntegrationVersion" - compile "joda-time:joda-time:$jodaTimeVersion" - compile "commons-pool:commons-pool:$commonsPoolVersion" - - testCompile "org.mockito:mockito-all:$mockitoVersion" - testCompile "org.springframework.integration:spring-integration-test:$springIntegrationVersion" - 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,-options' -[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-runner' - -sonarRunner { - sonarProperties { - property "sonar.jacoco.reportPath", "${buildDir.name}/jacoco.exec" - property "sonar.links.homepage", linkHomepage - property "sonar.links.ci", linkCi - property "sonar.links.issue", linkIssue - property "sonar.links.scm", linkScmUrl - property "sonar.links.scm_dev", linkScmDevConnection - property "sonar.java.coveragePlugin", "jacoco" - } -} - -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." - - def Properties schemas = new Properties(); - - project.sourceSets.main.resources.find { - it.path.endsWith('META-INF/spring.schemas') - }?.withInputStream { schemas.load(it) } - - for (def key : schemas.keySet()) { - File xsdFile = project.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.12' - distributionUrl = "http://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip" -} - -defaultTasks 'build' diff --git a/spring-integration-splunk/gradle.properties b/spring-integration-splunk/gradle.properties deleted file mode 100644 index ac021e5..0000000 --- a/spring-integration-splunk/gradle.properties +++ /dev/null @@ -1,8 +0,0 @@ -splunkVersion=1.3.0 -version=1.2.0.BUILD-SNAPSHOT -commonsPoolVersion=1.6 -springIntegrationVersion=4.0.2.RELEASE -mockitoVersion=1.9.5 -junitVersion=4.11 -log4jVersion=1.2.17 -jodaTimeVersion=2.3 diff --git a/spring-integration-splunk/gradle/wrapper/gradle-wrapper.jar b/spring-integration-splunk/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 0087cd3..0000000 Binary files a/spring-integration-splunk/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/spring-integration-splunk/gradle/wrapper/gradle-wrapper.properties b/spring-integration-splunk/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 3598337..0000000 --- a/spring-integration-splunk/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Fri Jun 06 13:11:01 EEST 2014 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/spring-integration-splunk/gradlew b/spring-integration-splunk/gradlew deleted file mode 100755 index 91a7e26..0000000 --- a/spring-integration-splunk/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env 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 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/spring-integration-splunk/gradlew.bat b/spring-integration-splunk/gradlew.bat deleted file mode 100644 index aec9973..0000000 --- a/spring-integration-splunk/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@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/spring-integration-splunk/publish-maven.gradle b/spring-integration-splunk/publish-maven.gradle deleted file mode 100644 index d61474b..0000000 --- a/spring-integration-splunk/publish-maven.gradle +++ /dev/null @@ -1,60 +0,0 @@ -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/spring-integration-splunk/src/api/overview.html b/spring-integration-splunk/src/api/overview.html deleted file mode 100644 index fb0198b..0000000 --- a/spring-integration-splunk/src/api/overview.html +++ /dev/null @@ -1,22 +0,0 @@ - - -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/spring-integration-splunk/src/dist/changelog.txt b/spring-integration-splunk/src/dist/changelog.txt deleted file mode 100644 index c78641e..0000000 --- a/spring-integration-splunk/src/dist/changelog.txt +++ /dev/null @@ -1,8 +0,0 @@ -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/spring-integration-splunk/src/dist/license.txt b/spring-integration-splunk/src/dist/license.txt deleted file mode 100644 index 261eeb9..0000000 --- a/spring-integration-splunk/src/dist/license.txt +++ /dev/null @@ -1,201 +0,0 @@ - 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/spring-integration-splunk/src/dist/notice.txt b/spring-integration-splunk/src/dist/notice.txt deleted file mode 100644 index f62045a..0000000 --- a/spring-integration-splunk/src/dist/notice.txt +++ /dev/null @@ -1,21 +0,0 @@ - ======================================================================== - == 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/spring-integration-splunk/src/dist/readme.txt b/spring-integration-splunk/src/dist/readme.txt deleted file mode 100644 index 886e33e..0000000 --- a/spring-integration-splunk/src/dist/readme.txt +++ /dev/null @@ -1,13 +0,0 @@ -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/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParser.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParser.java deleted file mode 100644 index b9ccad9..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParser.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2002-2014 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.w3c.dom.Element; - -import org.springframework.beans.BeanMetadataElement; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.RuntimeBeanReference; -import org.springframework.beans.factory.parsing.BeanComponentDefinition; -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.beans.factory.support.ManagedList; -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.SplunkDataReader; -import org.springframework.integration.splunk.support.SplunkServiceFactory; -import org.springframework.util.StringUtils; - -/** - * The Splunk Inbound Channel adapter parser - * - * @author Jarred Li - * @author Olivier Lamy - * @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"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataReaderBuilder, element, "count"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataReaderBuilder, element, "field-list"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataReaderBuilder, element, "search"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataReaderBuilder, element, "saved-search"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataReaderBuilder, element, "owner"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataReaderBuilder, element, "app"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataReaderBuilder, element, "init-earliest-time"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataReaderBuilder, element, "earliest-time"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(splunkDataReaderBuilder, element, "latest-time"); - - // initialize splunk servers references - BeanDefinitionBuilder serviceFactoryBuilder = BeanDefinitionBuilder.genericBeanDefinition(SplunkServiceFactory.class); - - String splunkServerBeanNames = element.getAttribute("splunk-server-ref"); - if (StringUtils.hasText(splunkServerBeanNames)) { - - ManagedList splunkServersList = new ManagedList(); - - for (String splunkServerBeanName : StringUtils.commaDelimitedListToStringArray(splunkServerBeanNames)) { - splunkServersList.add(new RuntimeBeanReference(splunkServerBeanName)); - } - serviceFactoryBuilder.addConstructorArgValue(splunkServersList); - splunkDataReaderBuilder.addConstructorArgValue(serviceFactoryBuilder.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/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/config/xml/SplunkNamespaceHandler.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/config/xml/SplunkNamespaceHandler.java deleted file mode 100644 index c9789e9..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/config/xml/SplunkNamespaceHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParser.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParser.java deleted file mode 100644 index 5194a73..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParser.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 2002-2014 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.w3c.dom.Element; - -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.RuntimeBeanReference; -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.support.ManagedList; -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.SplunkArgsFactoryBean; -import org.springframework.integration.splunk.support.SplunkIndexWriter; -import org.springframework.integration.splunk.support.SplunkServiceFactory; -import org.springframework.integration.splunk.support.SplunkSubmitWriter; -import org.springframework.integration.splunk.support.SplunkTcpWriter; -import org.springframework.util.StringUtils; -import org.springframework.util.xml.DomUtils; - -/** - * The parser for the Splunk Outbound Channel Adapter. - * - * @author Jarred Li - * @author David Turanski - * @author Olivier Lamy - * @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 argsBuilder = BeanDefinitionBuilder.genericBeanDefinition(SplunkArgsFactoryBean.class); - - IntegrationNamespaceUtils.setValueIfAttributeDefined(argsBuilder, element, "source-type"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(argsBuilder, element, "source"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(argsBuilder, element, "host"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(argsBuilder, element, "host-regex"); - - BeanDefinitionBuilder dataWriterBuilder = parseDataWriter(element); - - // initialize splunk servers references - - BeanDefinitionBuilder serviceFactoryBuilder = BeanDefinitionBuilder.genericBeanDefinition(SplunkServiceFactory.class); - - String splunkServerBeanNames = element.getAttribute("splunk-server-ref"); - if (StringUtils.hasText(splunkServerBeanNames)) { - - ManagedList splunkServersList = new ManagedList(); - - for (String splunkServerBeanName : StringUtils.delimitedListToStringArray(splunkServerBeanNames, ";")) { - splunkServersList.add(new RuntimeBeanReference(splunkServerBeanName)); - } - serviceFactoryBuilder.addConstructorArgValue(splunkServersList); - } - - dataWriterBuilder.addConstructorArgValue(serviceFactoryBuilder.getBeanDefinition()); - - - dataWriterBuilder.addConstructorArgValue(argsBuilder.getBeanDefinition()); - - String channelAdapterId = this.resolveId(element, splunkOutboundChannelAdapterBuilder.getRawBeanDefinition(), - parserContext); - String splunkExecutorBeanName = channelAdapterId + ".splunkExecutor"; - String splunkDataWriterBeanName = splunkExecutorBeanName + ".writer"; - - parserContext.registerBeanComponent(new BeanComponentDefinition(dataWriterBuilder.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(); - - } - - private BeanDefinitionBuilder parseDataWriter(Element element) { - BeanDefinitionBuilder dataWriterBuilder = null; - if (DomUtils.getChildElementByTagName(element, "index-writer") != null) { - Element dataWriter = DomUtils.getChildElementByTagName(element, "index-writer"); - dataWriterBuilder = BeanDefinitionBuilder.genericBeanDefinition(SplunkIndexWriter.class); - IntegrationNamespaceUtils.setValueIfAttributeDefined(dataWriterBuilder, dataWriter, "index"); - - } - if (DomUtils.getChildElementByTagName(element, "submit-writer") != null) { - Element dataWriter = DomUtils.getChildElementByTagName(element, "submit-writer"); - dataWriterBuilder = BeanDefinitionBuilder.genericBeanDefinition(SplunkSubmitWriter.class); - IntegrationNamespaceUtils.setValueIfAttributeDefined(dataWriterBuilder, dataWriter, "index"); - } - if (DomUtils.getChildElementByTagName(element, "tcp-writer") != null) { - Element dataWriter = DomUtils.getChildElementByTagName(element, "tcp-writer"); - dataWriterBuilder = BeanDefinitionBuilder.genericBeanDefinition(SplunkTcpWriter.class); - IntegrationNamespaceUtils.setValueIfAttributeDefined(dataWriterBuilder, dataWriter, "port"); - - } - - IntegrationNamespaceUtils.setValueIfAttributeDefined(dataWriterBuilder, element, - IntegrationNamespaceUtils.AUTO_STARTUP); - - return dataWriterBuilder; - } - -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/config/xml/SplunkParserUtils.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/config/xml/SplunkParserUtils.java deleted file mode 100644 index 53cdc7e..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/config/xml/SplunkParserUtils.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/config/xml/SplunkServerParser.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/config/xml/SplunkServerParser.java deleted file mode 100644 index e4d4baf..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/config/xml/SplunkServerParser.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2011-2014 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.w3c.dom.Element; - -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.support.SplunkServer; - -/** - * Splunk server element parser. - * - * The XML element is like this: - *
- * {@code
- * 
- * }
- * 
- * - * @author Jarred Li - * @author Olivier Lamy - * @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"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "timeout"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "checkServiceOnBorrow"); - - } - -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/config/xml/package-info.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/config/xml/package-info.java deleted file mode 100644 index 696859c..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/config/xml/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Provides parser classes to provide Xml namespace support for the Splunk components. - */ -package org.springframework.integration.splunk.config.xml; diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/core/DataReader.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/core/DataReader.java deleted file mode 100644 index 2bbdd2e..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/core/DataReader.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.event.SplunkEvent; - -/** - * Data reader to read Splunk data from the service. - * - * @author Jarred Li - * @since 1.0 - */ -public interface DataReader { - - List read() throws Exception; - -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/core/DataWriter.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/core/DataWriter.java deleted file mode 100644 index 607aa14..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/core/DataWriter.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.event.SplunkEvent; - -/** - * Data writer to write Splunk data into Splunk - * - * @author Jarred Li - * @since 1.0 - * - */ -public interface DataWriter { - - void write(SplunkEvent data) throws Exception; - -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/core/ServiceFactory.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/core/ServiceFactory.java deleted file mode 100644 index e6f7c41..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/core/ServiceFactory.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2002-2013 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 com.splunk.Service; - -/** - * @author David Turanski - * - */ -public interface ServiceFactory { - public Service getService(); -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/core/package-info.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/core/package-info.java deleted file mode 100644 index 158ac78..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/core/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Provides core classes of the Splunk module. - */ -package org.springframework.integration.splunk.core; diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/AcManagementEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/AcManagementEvent.java deleted file mode 100644 index 4a88cd4..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/AcManagementEvent.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.event; - - -/** - * Splunk data entity - * - * @author Jarred Li - * @author Damien Dallimore damien@dtdsoftware.com - * @author David Turanski - * @since 1.0 - * - */ -@SuppressWarnings("serial") -public class AcManagementEvent extends SplunkEvent { - - - /** - * 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"; - - 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); - } -} \ No newline at end of file diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/AuthEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/AuthEvent.java deleted file mode 100644 index 790452f..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/AuthEvent.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -/** - * @author David Turanski - * - */ -@SuppressWarnings("serial") -public class AuthEvent extends SplunkEvent { - // ---------------------------------- - // 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"; - - 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 setAuthAction(String authAction) { - addPair(AUTH_ACTION, authAction); - } -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/DnsEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/DnsEvent.java deleted file mode 100644 index b066360..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/DnsEvent.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -/** - * @author David Turanski - * - */ -@SuppressWarnings("serial") -public class DnsEvent extends SplunkEvent { - // ---------------------------------- - // 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"; - 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); - } - -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/EmailEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/EmailEvent.java deleted file mode 100644 index 17127cb..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/EmailEvent.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -/** - * @author David Turanski - * - */ -@SuppressWarnings("serial") -public class EmailEvent extends SplunkEvent { - // ---------------------------------- - // 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"; - - 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); - } - -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/EndpointProtectionEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/EndpointProtectionEvent.java deleted file mode 100644 index 2049d31..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/EndpointProtectionEvent.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -/** - * @author David Turanski - * - */ -@SuppressWarnings("serial") -public class EndpointProtectionEvent extends SplunkEvent { - - // ---------------------------------- - // 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"; - 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); - } - - -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/FileEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/FileEvent.java deleted file mode 100644 index 6d93864..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/FileEvent.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -/** - * @author David Turanski - * - */ -@SuppressWarnings("serial") -public class FileEvent extends SplunkEvent { - // ---------------------------------- - // 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"; - - 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); - } -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/IntrusionDetectionEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/IntrusionDetectionEvent.java deleted file mode 100644 index 167d274..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/IntrusionDetectionEvent.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -/** - * @author David Turanski - * - */ -@SuppressWarnings("serial") -public class IntrusionDetectionEvent extends SplunkEvent { - - - // ---------------------------------- - // 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"; - 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); - } - -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/MalwareEndpointProtectionEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/MalwareEndpointProtectionEvent.java deleted file mode 100644 index 789c18c..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/MalwareEndpointProtectionEvent.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -/** - * @author David Turanski - * - */ -@SuppressWarnings("serial") -public class MalwareEndpointProtectionEvent extends SplunkEvent { - // ---------------------------------- - // 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"; - - 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); - } - -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/MalwareNetworkProtectionEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/MalwareNetworkProtectionEvent.java deleted file mode 100644 index 8dd4302..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/MalwareNetworkProtectionEvent.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -/** - * @author David Turanski - * - */ -@SuppressWarnings("serial") -public class MalwareNetworkProtectionEvent extends SplunkEvent { - - // ---------------------------------- - // 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"; - - 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); - } -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/NetworkProtectionEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/NetworkProtectionEvent.java deleted file mode 100644 index 88556ec..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/NetworkProtectionEvent.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -/** - * @author David Turanski - * - */ -@SuppressWarnings("serial") -public class NetworkProtectionEvent extends SplunkEvent { - // ---------------------------------- - // 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"; - - 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); - } -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/NetworkTrafficEssEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/NetworkTrafficEssEvent.java deleted file mode 100644 index 97048b6..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/NetworkTrafficEssEvent.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -/** - * @author David Turanski - * - */ -@SuppressWarnings("serial") -public class NetworkTrafficEssEvent extends SplunkEvent { - // ---------------------------------- - // 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"; - - 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); - } - -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/NetworkTrafficGenericEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/NetworkTrafficGenericEvent.java deleted file mode 100644 index bc4b5ff..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/NetworkTrafficGenericEvent.java +++ /dev/null @@ -1,438 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -/** - * @author David Turanski - * - */ -@SuppressWarnings("serial") -public class NetworkTrafficGenericEvent extends SplunkEvent { - // ---------------------------------- - // 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"; - - 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); - } - -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/PacketFilterEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/PacketFilterEvent.java deleted file mode 100644 index 56d2fcb..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/PacketFilterEvent.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -/** - * @author David Turanski - * - */ -@SuppressWarnings("serial") -public class PacketFilterEvent extends SplunkEvent { - - // ---------------------------------- - // 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"; - 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); - } -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/ProxyEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/ProxyEvent.java deleted file mode 100644 index 24e06e3..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/ProxyEvent.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -/** - * @author David Turanski - * - */ -@SuppressWarnings("serial") -public class ProxyEvent extends SplunkEvent { - // ---------------------------------- - // 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"; - - - 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); - } - -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/SplunkEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/SplunkEvent.java deleted file mode 100644 index e3725f6..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/SplunkEvent.java +++ /dev/null @@ -1,580 +0,0 @@ -/* - * 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.event; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeFormatter; -import org.springframework.util.Assert; - -/** - * Splunk data entity - * - * @author Jarred Li - * @author Damien Dallimore damien@dtdsoftware.com - * @author David Turanski - * @since 1.0 - * - */ - -@SuppressWarnings("serial") -public class SplunkEvent implements Serializable { - - /** - * Contents of the event message - */ - private StringBuffer eventMessage; - - /** - * Whether or not to put quotes around values - */ - protected boolean quoteValues = true; - - /** - * Whether or not to add a date to the event string - */ - protected boolean useInternalDate = true; - - /** - * default key value delimiter - */ - protected static final String KVDELIM = "="; - /** - * default pair delimiter - */ - protected static final String PAIRDELIM = " "; - /** - * default quote char - */ - protected static final char QUOTE = '"'; - /** - * default date format is using internal generated date - */ - protected static final String DATEFORMATPATTERN = "yyyy-MM-dd\tHH:mm:ss:SSSZ"; - /** - * Date Formatter - */ - protected static final DateTimeFormatter DATE_FORMATTER = DateTimeFormat.forPattern(DATEFORMATPATTERN); - - /** - * Event prefix fields - */ - protected static final String PREFIX_NAME = "name"; - protected static final String PREFIX_EVENT_ID = "event_id"; - - /** - * Java Throwable type fields - */ - protected static final String THROWABLE_CLASS = "throwable_class"; - protected static final String THROWABLE_MESSAGE = "throwable_message"; - protected static final String THROWABLE_STACKTRACE_ELEMENTS = "stacktrace_elements"; - - protected static final String LINEBREAK = "\n"; - - // ---------------------------------- - // 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"; - // ---------------------------------- - // Update - // ---------------------------------- - - /** - * The name of the installed update. - */ - public static String UPDATE_PACKAGE = "package"; - - /** - * A Constructor to load data from a Map - * @param data the map - */ - public SplunkEvent(Map data) { - this.eventMessage = new StringBuffer(); - for (String key : data.keySet()) { - this.addPair(key, data.get(key)); - } - } - - /** - * A Copy constructor - * @param splunkEvent - */ - public SplunkEvent(SplunkEvent splunkEvent) { - this.eventMessage = splunkEvent.eventMessage; - this.quoteValues = splunkEvent.quoteValues; - this.useInternalDate = splunkEvent.useInternalDate; - } - - /** - * Constructor to create a generic event - * @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 SplunkEvent(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 to create a generic event with the default format - * - * @param eventName the event name - * @param eventID the event ID - */ - public SplunkEvent(String eventName, String eventID) { - - this(eventName, eventID, true, true); - } - - /** - * Default constructor - */ - public SplunkEvent() { - this.eventMessage = new StringBuffer(); - } - - public Map getEventData() { - Map eventData = new HashMap(); - String eventEntries = eventMessage.toString(); - - String[] entries = eventEntries.split(PAIRDELIM); - - String quote = new String(new char[] { QUOTE }); - - for (String entry : entries) { - String[] pair = entry.split(KVDELIM); - - Assert.isTrue(pair.length == 2, String.format("invalid event data [%s]", entry)); - - String key = pair[0].replaceAll(quote, ""); - String value = pair[1].replaceAll(quote, ""); - if ("null".equals(value)) { - value = null; - } - - eventData.put(key, value); - } - 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) { - Assert.notNull(key, "key cannot be null"); - 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(DATE_FORMATTER.print(new Date().getTime())).append(PAIRDELIM) - .append(this.eventMessage); - event = clonedMessage.toString(); - } else - event = eventMessage.toString(); - // trim off trailing pair delim char(s) - String result = event.substring(0, event.length() - PAIRDELIM.length()) + LINEBREAK; - return result; - } - - 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 setUpdatePackage(String updatePackage) { - addPair(UPDATE_PACKAGE, updatePackage); - } -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/SystemCenterEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/SystemCenterEvent.java deleted file mode 100644 index 7ead93c..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/SystemCenterEvent.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -/** - * @author David Turanski - * - */ -@SuppressWarnings("serial") -public class SystemCenterEvent extends SplunkEvent { - // ---------------------------------- - // 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"; - - 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); - } - -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/TrafficEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/TrafficEvent.java deleted file mode 100644 index 14c9207..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/TrafficEvent.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -/** - * @author David Turanski - * - */ -@SuppressWarnings("serial") -public class TrafficEvent extends SplunkEvent { - - // ---------------------------------- - // 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"; - - 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); - } -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/UserInfoUpdateEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/UserInfoUpdateEvent.java deleted file mode 100644 index 45325cc..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/UserInfoUpdateEvent.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -/** - * @author David Turanski - * - */ -@SuppressWarnings("serial") -public class UserInfoUpdateEvent extends SplunkEvent { - // ---------------------------------- - // 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"; - 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); - } - -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/VulnerabilityEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/VulnerabilityEvent.java deleted file mode 100644 index 18d32fc..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/VulnerabilityEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -/** - * @author David Turanski - * - */ -@SuppressWarnings("serial") -public class VulnerabilityEvent extends SplunkEvent { - // ---------------------------------- - // 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"; - - 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); - } -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/WindowsAdminEvent.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/WindowsAdminEvent.java deleted file mode 100644 index 5f5ecd3..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/event/WindowsAdminEvent.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -/** - * @author David Turanski - * - */ -@SuppressWarnings("serial") -public class WindowsAdminEvent extends SplunkEvent { - // ---------------------------------- - // 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 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/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/inbound/SplunkPollingChannelAdapter.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/inbound/SplunkPollingChannelAdapter.java deleted file mode 100644 index 01f4cfd..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/inbound/SplunkPollingChannelAdapter.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.context.IntegrationObjectSupport; -import org.springframework.integration.core.MessageSource; -import org.springframework.integration.splunk.event.SplunkEvent; -import org.springframework.integration.splunk.support.SplunkExecutor; -import org.springframework.integration.support.MessageBuilder; -import org.springframework.messaging.Message; -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/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/inbound/package-info.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/inbound/package-info.java deleted file mode 100644 index f72820a..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/inbound/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Provides inbound Spring Integration Splunk components. - */ -package org.springframework.integration.splunk.inbound; diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/outbound/SplunkOutboundChannelAdapter.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/outbound/SplunkOutboundChannelAdapter.java deleted file mode 100644 index ca5925c..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/outbound/SplunkOutboundChannelAdapter.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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.handler.AbstractReplyProducingMessageHandler; -import org.springframework.integration.splunk.support.SplunkExecutor; -import org.springframework.integration.support.MessageBuilder; -import org.springframework.messaging.Message; -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 Object handleRequestMessage(Message requestMessage) { - final Object result; - result = this.splunkExecutor.write(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/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/outbound/package-info.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/outbound/package-info.java deleted file mode 100644 index 0ce1585..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/outbound/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Provides Spring Integration components for doing outbound operations. - */ -package org.springframework.integration.splunk.outbound; diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/AbstractSplunkDataWriter.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/AbstractSplunkDataWriter.java deleted file mode 100644 index 1d480b9..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/AbstractSplunkDataWriter.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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.IOException; -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.context.SmartLifecycle; -import org.springframework.integration.splunk.core.DataWriter; -import org.springframework.integration.splunk.core.ServiceFactory; -import org.springframework.integration.splunk.event.SplunkEvent; -import org.springframework.util.Assert; - -import com.splunk.Args; -import com.splunk.Service; - -/** - * Base class for {@link DataWriter}s to write data into Splunk. - * - * @author Jarred Li - * @author David Turanski - * @since 1.0 - * - */ -public abstract class AbstractSplunkDataWriter implements DataWriter, SmartLifecycle { - - protected final Log logger = LogFactory.getLog(getClass()); - - protected Socket socket; - - protected Service service; - - protected Args args; - - private boolean running; - - private int phase; - - private boolean autoStartup = true; - - private final ServiceFactory serviceFactory; - - - - protected AbstractSplunkDataWriter(ServiceFactory serviceFactory, Args args) { - Assert.notNull(serviceFactory,"service factory cannot be null"); - this.serviceFactory = serviceFactory; - - Assert.notNull(args, "args cannot be null"); - this.args = args; - } - - public void write(SplunkEvent event) throws Exception { - if (logger.isDebugEnabled()) { - logger.debug("writing event to splunk:" + event); - } - - doWrite(event, socket, service, args); - } - - protected void doWrite(SplunkEvent event, Socket socket, Service service, Args args) throws IOException { - OutputStream ostream = socket.getOutputStream(); - Writer writer = new OutputStreamWriter(ostream, "UTF8"); - writer.write(event.toString()); - writer.flush(); - } - - protected abstract Socket createSocket(Service service) throws IOException; - - - public Args getArgs() { - return args; - } - - /* (non-Javadoc) - * @see org.springframework.context.Lifecycle#start() - */ - public synchronized void start() { - try { - service = serviceFactory.getService(); - socket = createSocket(service); - - } catch (Exception e) { - throw new RuntimeException(e); - } - this.running = true; - } - - /* (non-Javadoc) - * @see org.springframework.context.Lifecycle#stop() - */ - public synchronized void stop() { - if (!running) { - return; - } - try { - if (socket != null) { - socket.close(); - } - } catch (Exception e) { - throw new RuntimeException(e); - } - - this.running = false; - } - - /* (non-Javadoc) - * @see org.springframework.context.Lifecycle#isRunning() - */ - public boolean isRunning() { - return this.running; - } - - /* (non-Javadoc) - * @see org.springframework.context.Phased#getPhase() - */ - public int getPhase() { - return this.phase; - } - - public void setPhase(int phase) { - this.phase = phase; - } - - /* (non-Javadoc) - * @see org.springframework.context.SmartLifecycle#isAutoStartup() - */ - public boolean isAutoStartup() { - return this.autoStartup; - } - - public void setAutoStartup(boolean autoStartup) { - this.autoStartup = autoStartup; - } - - /* (non-Javadoc) - * @see org.springframework.context.SmartLifecycle#stop(java.lang.Runnable) - */ - public synchronized void stop(Runnable callback) { - this.stop(); - callback.run(); - } -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/ArgsBuilder.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/ArgsBuilder.java deleted file mode 100644 index 84d445a..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/ArgsBuilder.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2002-2013 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 com.splunk.Args; - -/** - * Build {@link Args} instance. Supports method chaining - * @author David Turanski - * - */ -public class ArgsBuilder { - - private String sourceType; - private String source; - private String host; - private String hostRegex; - - public Args build() { - 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); - } - return args; - } - - /** - * @param sourceType the sourceType to set - */ - public ArgsBuilder setSourceType(String sourceType) { - this.sourceType = sourceType; - return this; - } - - /** - * @param source the source to set - */ - public ArgsBuilder setSource(String source) { - this.source = source; - return this; - } - - /** - * @param host the host to set - */ - public ArgsBuilder setHost(String host) { - this.host = host; - return this; - } - - /** - * @param hostRegex the hostRegex to set - */ - public ArgsBuilder setHostRegex(String hostRegex) { - this.hostRegex = hostRegex; - return this; - } -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SearchMode.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SearchMode.java deleted file mode 100644 index 641c77d..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SearchMode.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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, SAVEDSEARCH; -} \ No newline at end of file diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkArgsFactoryBean.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkArgsFactoryBean.java deleted file mode 100644 index 2e786d6..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkArgsFactoryBean.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2002-2013 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 com.splunk.Args; - -/** - * {@link FactoryBean} that wraps {@link ArgsBuilder} - * @author David Turanski - * - */ -public class SplunkArgsFactoryBean implements FactoryBean { - private ArgsBuilder argsBuilder = new ArgsBuilder(); - - /* (non-Javadoc) - * @see org.springframework.beans.factory.FactoryBean#getObject() - */ - public Args getObject() throws Exception { - return argsBuilder.build(); - } - - /* (non-Javadoc) - * @see org.springframework.beans.factory.FactoryBean#getObjectType() - */ - public Class getObjectType() { - return Args.class; - } - - /* (non-Javadoc) - * @see org.springframework.beans.factory.FactoryBean#isSingleton() - */ - public boolean isSingleton() { - return true; - } - - /** - * @param host the host to set - */ - public void setHost(String host) { - this.argsBuilder.setHost(host); - } - - /** - * @param hostRegex the hostRegex to set - */ - public void setHostRegex(String hostRegex) { - this.argsBuilder.setHostRegex(hostRegex); - } - - /** - * @param sourceType the sourceType to set - */ - public void setSourceType(String sourceType) { - this.argsBuilder.setSourceType(sourceType); - } - - /** - * @param source the source to set - */ - public void setSource(String source) { - this.argsBuilder.setSource(source); - } -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkDataReader.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkDataReader.java deleted file mode 100644 index 0eb626f..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkDataReader.java +++ /dev/null @@ -1,453 +0,0 @@ -/* - * Copyright 2011-2014 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 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; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.springframework.beans.factory.InitializingBean; -import org.springframework.integration.splunk.core.DataReader; -import org.springframework.integration.splunk.core.ServiceFactory; -import org.springframework.integration.splunk.event.SplunkEvent; -import org.springframework.util.Assert; -import org.springframework.util.StringUtils; - -/** - * 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 - * @author Olivier Lamy - * @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 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; - - private final ServiceFactory serviceFactory; - - public SplunkDataReader(ServiceFactory serviceFactory) { - this.serviceFactory = serviceFactory; - } - - 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 this.mode; - } - - public int getCount() { - return this.count; - } - - public String getFieldList() { - return this.fieldList; - } - - public String getSearch() { - return this.search; - } - - public String getEarliestTime() { - return this.earliestTime; - } - - public String getLatestTime() { - return this.latestTime; - } - - public String getSavedSearch() { - return this.savedSearch; - } - - public String getOwner() { - return this.owner; - } - - public String getInitEarliestTime() { - return this.initEarliestTime; - } - - public String getApp() { - return this.app; - } - - public List read() throws Exception { - logger.debug("mode:" + this.mode); - switch (this.mode) { - case SAVEDSEARCH: { - return savedSearch(); - } - case BLOCKING: { - return blockingSearch(); - } - case NORMAL: { - return nonBlockingSearch(); - } - case EXPORT: { - return exportSearch(); - } - case REALTIME: { - throw new UnsupportedOperationException("The 'real-time' search isn't supported " + - "because of the infinite Splunk Job nature."); -// 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(this.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() - this.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(this.fieldList)) { - queryArgs.put("field_list", this.fieldList); - } - } - - private String getLatestTime(Calendar startTime, boolean realtime) { - String lTime = null; - if (StringUtils.hasText(this.latestTime)) { - lTime = this.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 (this.lastSuccessfulReadTime == null) { - eTime = this.initEarliestTime; - } else { - if (StringUtils.hasText(earliestTime)) { - eTime = this.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 { - Service service = this.serviceFactory.getService(); - Job job = service.getJobs().create(this.search, queryArgs); - while (!job.isDone()) { - Thread.sleep(2000); - } - return extractData(job); - - } - - 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); - this.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); - this.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); - this.lastSuccessfulReadTime = startTime; - return data; - } - - /** - * @throws Exception - * - */ - private List exportSearch() throws Exception { - logger.debug("export start"); - List result = new ArrayList(); - HashMap data; - SplunkEvent splunkData; - - Args queryArgs = new Args(); - Calendar startTime = Calendar.getInstance(); - populateArgs(queryArgs, startTime, false); - queryArgs.put("output_mode", "xml"); - - Service service = this.serviceFactory.getService(); - InputStream os = service.export(this.search, queryArgs); - ResultsReaderXml resultsReader = new ResultsReaderXml(os); - while ((data = resultsReader.getNextEvent()) != null) { - splunkData = new SplunkEvent(data); - result.add(splunkData); - } - return result; - } - - private List savedSearch() throws Exception { - logger.debug("saved search start"); - - Args queryArgs = new Args(); - queryArgs.put("app", "search"); - if (this.owner != null && this.owner.length() > 0) { - queryArgs.put("owner", this.owner); - } - if (this.app != null && this.app.length() > 0) { - queryArgs.put("app", this.app); - } - - Calendar startTime = Calendar.getInstance(); - - SavedSearch search = null; - Job job = null; - String latestTime = getLatestTime(startTime, false); - String earliestTime = getEarliestTime(startTime, false); - - Service service = this.serviceFactory.getService(); - SavedSearchCollection savedSearches = service.getSavedSearches(queryArgs); - for (SavedSearch s : savedSearches.values()) { - if (s.getName().equals(this.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; - - } - - private List extractData(Job job) throws Exception { - List result = new ArrayList(); - HashMap data; - SplunkEvent splunkData; - ResultsReader resultsReader; - int total = job.getResultCount(); - - if (this.count == 0 || total < this.count) { - InputStream stream = null; - Args outputArgs = new Args(); - outputArgs.put("count", this.count); - outputArgs.put("output_mode", "xml"); - stream = job.getResults(outputArgs); - - resultsReader = new ResultsReaderXml(stream); - while ((data = resultsReader.getNextEvent()) != null) { - splunkData = new SplunkEvent(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", this.count); - outputArgs.put("offset", offset); - stream = job.getResults(outputArgs); - resultsReader = new ResultsReaderXml(stream); - while ((data = resultsReader.getNextEvent()) != null) { - splunkData = new SplunkEvent(data); - result.add(splunkData); - } - offset += this.count; - } - } - return result; - } - - public void afterPropertiesSet() throws Exception { - Assert.notNull(this.initEarliestTime, "initial earliest time can not be null"); - } - -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkExecutor.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkExecutor.java deleted file mode 100644 index c638dee..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkExecutor.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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.messaging.MessageHandlingException; -import org.springframework.integration.splunk.core.DataReader; -import org.springframework.integration.splunk.core.DataWriter; -import org.springframework.integration.splunk.event.SplunkEvent; -import org.springframework.messaging.Message; -import org.springframework.messaging.MessagingException; - -/** - * Bundles common core logic for the Splunk components. - * - * @author Jarred Li - * @author David Turanski - * @since 1.0 - * - */ -public class SplunkExecutor { - - private static final Log logger = LogFactory.getLog(SplunkExecutor.class); - - private DataReader reader; - private DataWriter writer; - - /** - * Executes the outbound Splunk Operation. - */ - public Object write(final Message message) { - try { - SplunkEvent payload = (SplunkEvent) 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) { - write(message); - } - - /** - * Execute the Splunk operation. - */ - public List poll() { - logger.debug("poll start:"); - List queryData = null; - try { - queryData = reader.read(); - } 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/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkIndexWriter.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkIndexWriter.java deleted file mode 100644 index d0328d3..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkIndexWriter.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2002-2014 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.IOException; -import java.net.Socket; - -import com.splunk.Args; -import com.splunk.Index; -import com.splunk.Receiver; -import com.splunk.Service; - -import org.springframework.integration.splunk.core.ServiceFactory; -import org.springframework.util.Assert; - -/** - * - * DataWriter to stream data into Splunk using an optional index. If no index specified, - * the main default index is used. - * - * @author Jarred Li - * @author David Turanski - * @author Olivier Lamy - * @since 1.0 - */ -public class SplunkIndexWriter extends AbstractSplunkDataWriter { - - private String index; - - public SplunkIndexWriter(ServiceFactory serviceFactory, Args args) { - super(serviceFactory, args); - } - - @Override - protected Socket createSocket(Service service) throws IOException { - Index indexObject = null; - Receiver receiver = null; - Socket socket = null; - - if (index != null) { - indexObject = service.getIndexes().get(index); - Assert.notNull(indexObject, String.format("cannot find index [%s]", index)); - socket = indexObject.attach(args); - - } - else { - receiver = service.getReceiver(); - socket = receiver.attach(args); - } - if (logger.isDebugEnabled()) { - logger.debug(String.format("created a socket on %s", socket.getRemoteSocketAddress())); - } - return socket; - } - - - public String getIndex() { - return index; - } - - public void setIndex(String index) { - this.index = index; - } - -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkServer.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkServer.java deleted file mode 100644 index af77494..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkServer.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright 2011-2014 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 com.splunk.Service; - -/** - * Splunk server entity - * - * @author Jarred Li - * @author Olivier Lamy - * @since 1.0 - * - */ -public class SplunkServer { - - private String host = Service.DEFAULT_HOST; - - private int port = Service.DEFAULT_PORT; - - private String scheme = Service.DEFAULT_SCHEME; - - private String app; - - private String owner; - - private String username; - - private String password; - - private int timeout; - - /** - * if true the framework will test the connectivity before give back the connection. - */ - private boolean checkServiceOnBorrow = false; - - /** - * @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; - } - - /** - * - * @return the used scheme - */ - public String getScheme() { - return scheme; - } - - /** - * - * @param scheme - */ - public void setScheme(String scheme) { - this.scheme = scheme; - } - - /** - * - * @return the application - */ - public String getApp() { - return app; - } - - /** - * - * @param app - */ - public void setApp(String app) { - this.app = app; - } - - /** - * - * @return the owner - */ - public String getOwner() { - return owner; - } - - /** - * - * @param 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; - } - - /** - * @return the timeout in ms. - */ - public int getTimeout() { - return timeout; - } - - /** - * set the timeout in ms. - * @param timeout - */ - public void setTimeout(int timeout) { - this.timeout = timeout; - } - - /** - * @return {@code true/false} if there is need to check the underlying Splunk Service - * @since 1.1 - */ - public boolean isCheckServiceOnBorrow() { - return checkServiceOnBorrow; - } - - /** - * @param checkServiceOnBorrow the {@code checkServiceOnBorrow} flag - * @since 1.1 - */ - public void setCheckServiceOnBorrow(boolean checkServiceOnBorrow) { - this.checkServiceOnBorrow = checkServiceOnBorrow; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - SplunkServer that = SplunkServer.class.cast(o); - - return port == that.port && host.equals(that.host); - - } - - @Override - public int hashCode() { - int result = host.hashCode(); - result = 31 * result + port; - return result; - } - - @Override - public String toString() { - return "SplunkServer{" + - "host='" + host + '\'' + - ", port=" + port + - ", scheme='" + scheme + '\'' + - ", app='" + app + '\'' + - '}'; - } -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkServiceFactory.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkServiceFactory.java deleted file mode 100644 index 936cac9..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkServiceFactory.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright 2002-2014 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.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; - -import javax.xml.bind.DatatypeConverter; - -import com.splunk.Service; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.springframework.beans.factory.FactoryBean; -import org.springframework.integration.splunk.core.ServiceFactory; -import org.springframework.util.Assert; - -/** - * A {@link FactoryBean} for creating a {@link Service} - * - * @author David Turanski - * @author Olivier Lamy - */ -public class SplunkServiceFactory implements ServiceFactory { - - private static final Log LOGGER = LogFactory.getLog(SplunkServiceFactory.class); - - private final List splunkServers; - - private final Map servicePerServer = new ConcurrentHashMap(); - - - public SplunkServiceFactory(SplunkServer splunkServer) { - Assert.notNull(splunkServer); - this.splunkServers = Arrays.asList(splunkServer); - } - - /** - * @param splunkServers the {@code List} to build this {@code SplunkServiceFactory} - * @since 1.1 - */ - public SplunkServiceFactory(List splunkServers) { - Assert.notEmpty(splunkServers); - this.splunkServers = new ArrayList(splunkServers); - } - - @Override - public synchronized Service getService() { - return getServiceInternal(); - } - - private Service getServiceInternal() { - - for (SplunkServer splunkServer : splunkServers) { - Service service = servicePerServer.get(splunkServer); - // service already exist and no test on borrow it so simply use it - - if (service != null) { - if (!splunkServer.isCheckServiceOnBorrow() || pingService(service)) { - return service; - } - else { - // fail so try next server - continue; - } - } - - ExecutorService executor = Executors.newSingleThreadExecutor(); - - Callable callable = buildServiceCallable(splunkServer); - - Future future = executor.submit(callable); - - try { - if (splunkServer.getTimeout() > 0) { - service = future.get(splunkServer.getTimeout(), TimeUnit.MILLISECONDS); - } - else { - service = future.get(); - } - - servicePerServer.put(splunkServer, service); - return service; - } - catch (Exception e) { - if (LOGGER.isInfoEnabled()) { - LOGGER.info(String.format("could not connect to Splunk Server @ %s:%d - %s, try next one", - splunkServer.getHost(), splunkServer.getPort(), e.getMessage())); - } - } - } - String message = String.format("could not connect to any of Splunk Servers %s", this.splunkServers); - LOGGER.error(message); - throw new RuntimeException(message); - } - - private Callable buildServiceCallable(SplunkServer splunkServer) { - final 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()); - - String auth = splunkServer.getUsername() + ":" + splunkServer.getPassword(); - String authToken = "Basic " + DatatypeConverter.printBase64Binary(auth.getBytes()); - args.put("token", authToken); - - return new Callable() { - public Service call() - throws Exception { - return Service.connect(args); - } - }; - } - - private boolean pingService(Service service) { - try { - service.getInfo(); - return true; - } - catch (Exception e) { - return false; - } - } - -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkSubmitWriter.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkSubmitWriter.java deleted file mode 100644 index c5e7369..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkSubmitWriter.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - /* - * Copyright 2002-2013 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.IOException; -import java.net.Socket; - -import org.springframework.integration.splunk.core.ServiceFactory; -import org.springframework.integration.splunk.event.SplunkEvent; - -import com.splunk.Args; -import com.splunk.Index; -import com.splunk.Receiver; -import com.splunk.Service; - -/** - * @author David Turanski - * - */ -public class SplunkSubmitWriter extends AbstractSplunkDataWriter { - - private String index; - - /** - * @param serviceFactory - * @param args - */ - public SplunkSubmitWriter(ServiceFactory serviceFactory, Args args) { - super(serviceFactory, args); - } - - /* - * (non-Javadoc) - * - * @see - * org.springframework.integration.splunk.support.SplunkDataWriter#doWrite - * (org.springframework.integration.splunk.event.SplunkEvent, - * java.net.Socket, com.splunk.Service, com.splunk.Args) - */ - @Override - protected void doWrite(SplunkEvent event, Socket socket, Service service, - Args args) throws IOException { - - Index index = getIndex(); - if (index != null) { - index.submit(args, event.toString()); - } else { - Receiver receiver = service.getReceiver(); - receiver.submit(args, event.toString()); - } - } - - /* - * (non-Javadoc) - * - * @see - * org.springframework.integration.splunk.support.SplunkDataWriter#createSocket - * (com.splunk.Service) - */ - @Override - protected Socket createSocket(Service service) throws IOException { - return null; - } - - public void setIndex(String index) { - this.index = index; - } - - private Index getIndex() { - return (index == null) ? null : service.getIndexes().get(index); - } - -} diff --git a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkTcpWriter.java b/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkTcpWriter.java deleted file mode 100644 index 0e10542..0000000 --- a/spring-integration-splunk/src/main/java/org/springframework/integration/splunk/support/SplunkTcpWriter.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2002-2014 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.IOException; -import java.net.Socket; - -import com.splunk.Args; -import com.splunk.Input; -import com.splunk.Service; - -import org.springframework.integration.splunk.core.ServiceFactory; -import org.springframework.util.Assert; - -/** - * - * A {@code org.springframework.integration.splunk.core.DataWriter} - * that creates a socket on a given port - * - * @author David Turanski - * - */ -public class SplunkTcpWriter extends AbstractSplunkDataWriter { - private int port; - - public SplunkTcpWriter(ServiceFactory serviceFactory, Args args) { - super(serviceFactory, args); - } - - @Override - protected Socket createSocket(Service service) throws IOException { - - Input input = service.getInputs().get(String.valueOf(port)); - Assert.notNull(input, "no input defined for port " + port); - Assert.isTrue(!input.isDisabled(),String.format("input on port %d is disabled",port)); - return service.open(port); - } - - /** - * @param port the port to set - */ - public void setPort(int port) { - this.port = port; - } - - -} diff --git a/spring-integration-splunk/src/main/resources/META-INF/spring.handlers b/spring-integration-splunk/src/main/resources/META-INF/spring.handlers deleted file mode 100644 index 4d4111e..0000000 --- a/spring-integration-splunk/src/main/resources/META-INF/spring.handlers +++ /dev/null @@ -1 +0,0 @@ -http\://www.springframework.org/schema/integration/splunk=org.springframework.integration.splunk.config.xml.SplunkNamespaceHandler diff --git a/spring-integration-splunk/src/main/resources/META-INF/spring.schemas b/spring-integration-splunk/src/main/resources/META-INF/spring.schemas deleted file mode 100644 index cc8649e..0000000 --- a/spring-integration-splunk/src/main/resources/META-INF/spring.schemas +++ /dev/null @@ -1,2 +0,0 @@ -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/spring-integration-splunk/src/main/resources/META-INF/spring.tooling b/spring-integration-splunk/src/main/resources/META-INF/spring.tooling deleted file mode 100644 index cf031eb..0000000 --- a/spring-integration-splunk/src/main/resources/META-INF/spring.tooling +++ /dev/null @@ -1,4 +0,0 @@ -# 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/spring-integration-splunk/src/main/resources/org/springframework/integration/splunk/config/xml/spring-integration-splunk-1.0.xsd b/spring-integration-splunk/src/main/resources/org/springframework/integration/splunk/config/xml/spring-integration-splunk-1.0.xsd deleted file mode 100644 index 2de6ff4..0000000 --- a/spring-integration-splunk/src/main/resources/org/springframework/integration/splunk/config/xml/spring-integration-splunk-1.0.xsd +++ /dev/null @@ -1,392 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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. - - - - - - - - - - - Index to write to. - - - - - - - - - - The port corresponding to a tcp Input - - - - - - - - - Defines an outbound Channel Adapter. - - - - - - - - - - Defines a Data Writer for streaming data to an index, or the default index if not specified. - - - - - - - Defines a Data Writer for streaming data to a tcp input port. - - - - - - - Defines a Data Writer to submit data, using the REST interface, to an index, or the default index if not specified. - - - - - - - - - - - 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 - - - - - - - - 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 - - - - - - diff --git a/spring-integration-splunk/src/main/resources/org/springframework/integration/splunk/config/xml/spring-integration-splunk-1.1.xsd b/spring-integration-splunk/src/main/resources/org/springframework/integration/splunk/config/xml/spring-integration-splunk-1.1.xsd deleted file mode 100644 index 4950b83..0000000 --- a/spring-integration-splunk/src/main/resources/org/springframework/integration/splunk/config/xml/spring-integration-splunk-1.1.xsd +++ /dev/null @@ -1,404 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The definition for the Spring Integration Splunk - Inbound Channel Adapter. - - - - - - - - - - - - - - - - - - - - - - - - - - Search mode: normal, blocking, 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. - - - - - - - - - - - Index to write to. - - - - - - - - - - The port corresponding to a tcp Input - - - - - - - - - Defines an outbound Channel Adapter. - - - - - - - - - - Defines a Data Writer for streaming data to an index, or the default index if not specified. - - - - - - - Defines a Data Writer for streaming data to a tcp input port. - - - - - - - Defines a Data Writer to submit data, using the REST interface, to an index, or the default index if not specified. - - - - - - - - - - - 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 - - - - - - - - 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 - - - - - - diff --git a/spring-integration-splunk/src/main/resources/org/springframework/integration/splunk/config/xml/spring-integration-splunk.gif b/spring-integration-splunk/src/main/resources/org/springframework/integration/splunk/config/xml/spring-integration-splunk.gif deleted file mode 100644 index 41b369f..0000000 Binary files a/spring-integration-splunk/src/main/resources/org/springframework/integration/splunk/config/xml/spring-integration-splunk.gif and /dev/null differ diff --git a/spring-integration-splunk/src/reference/docbook/history.xml b/spring-integration-splunk/src/reference/docbook/history.xml deleted file mode 100644 index d8fde4b..0000000 --- a/spring-integration-splunk/src/reference/docbook/history.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - Change History - - - - - - - - - - - - - -
ReleaseDateChanges
0.5.02012.9.28Initial release
-
diff --git a/spring-integration-splunk/src/reference/docbook/images/logo.png b/spring-integration-splunk/src/reference/docbook/images/logo.png deleted file mode 100644 index 8c71c13..0000000 Binary files a/spring-integration-splunk/src/reference/docbook/images/logo.png and /dev/null differ diff --git a/spring-integration-splunk/src/reference/docbook/index.xml b/spring-integration-splunk/src/reference/docbook/index.xml deleted file mode 100644 index 516b920..0000000 --- a/spring-integration-splunk/src/reference/docbook/index.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - 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/spring-integration-splunk/src/reference/docbook/resources.xml b/spring-integration-splunk/src/reference/docbook/resources.xml deleted file mode 100644 index c3ffb46..0000000 --- a/spring-integration-splunk/src/reference/docbook/resources.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - 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/spring-integration-splunk/src/reference/docbook/splunk.xml b/spring-integration-splunk/src/reference/docbook/splunk.xml deleted file mode 100644 index 10da20e..0000000 --- a/spring-integration-splunk/src/reference/docbook/splunk.xml +++ /dev/null @@ -1,218 +0,0 @@ - - - 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/spring-integration-splunk/src/reference/docbook/whats-new.xml b/spring-integration-splunk/src/reference/docbook/whats-new.xml deleted file mode 100644 index cd9d2cd..0000000 --- a/spring-integration-splunk/src/reference/docbook/whats-new.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - 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/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserSavedSearchTests.java b/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserSavedSearchTests.java deleted file mode 100644 index c3f7844..0000000 --- a/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserSavedSearchTests.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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 static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -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); - assertNotNull(adapter); - SplunkDataReader reader = appContext.getBean("splunkInboundChannelAdapter.splunkExecutor.reader", - SplunkDataReader.class); - assertNotNull(reader); - - SearchMode mode = SearchMode.SAVEDSEARCH; - assertEquals(mode, reader.getMode()); - - String savedSearch = "savedSearch"; - assertEquals(savedSearch, reader.getSavedSearch()); - - String owner = "admin"; - assertEquals(owner, reader.getOwner()); - - String app = "search"; - assertEquals(app, reader.getApp()); - } - -} diff --git a/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserTests.java b/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserTests.java deleted file mode 100644 index f10daf3..0000000 --- a/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserTests.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.junit.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/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserStreamTests.java b/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserStreamTests.java deleted file mode 100644 index 9e10243..0000000 --- a/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserStreamTests.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2011-2014 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 static org.junit.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.AbstractSplunkDataWriter; -import org.springframework.integration.splunk.support.SplunkIndexWriter; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -/** - * @author Jarred Li - * @author Artem Bilan - * @since 1.0 - * - */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration -public class SplunkOutboundChannelAdapterParserStreamTests { - - @Autowired - private ApplicationContext appContext; - - @Test - public void testParseConsumerElementParserContext() { - Object adapter = appContext.getBean("splunkOutboundChannelAdapter"); - assertNotNull(adapter); - - AbstractSplunkDataWriter writer = appContext.getBean("splunkOutboundChannelAdapter.splunkExecutor.writer", - AbstractSplunkDataWriter.class); - assertNotNull(writer); - assertTrue(writer instanceof SplunkIndexWriter); - assertEquals("foo", ((SplunkIndexWriter) writer).getIndex()); - } - -} diff --git a/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserTests.java b/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserTests.java deleted file mode 100644 index b31fba0..0000000 --- a/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserTests.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 static org.junit.Assert.*; - -import org.junit.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.AbstractSplunkDataWriter; -import org.springframework.integration.splunk.support.SplunkSubmitWriter; -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); - - AbstractSplunkDataWriter writer = appContext.getBean("splunkOutboundChannelAdapter.splunkExecutor.writer", - AbstractSplunkDataWriter.class); - assertNotNull(writer); - - assertTrue(writer instanceof SplunkSubmitWriter); - assertEquals(false,writer.isAutoStartup()); - assertEquals(false,writer.isRunning()); - - String sourceType = "spring-integration"; - assertEquals(sourceType, writer.getArgs().get("sourcetype")); - - String source = "example5"; - assertEquals(source, writer.getArgs().get("source")); - - } - -} diff --git a/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/config/xml/SplunkServerParserTests.java b/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/config/xml/SplunkServerParserTests.java deleted file mode 100644 index 79b0a5a..0000000 --- a/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/config/xml/SplunkServerParserTests.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.junit.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.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/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/event/SplunkEventTests.java b/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/event/SplunkEventTests.java deleted file mode 100644 index bb45fec..0000000 --- a/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/event/SplunkEventTests.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2002-2013 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.event; - -import static org.junit.Assert.assertEquals; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; - -/** - * @author David Turanski - * - */ -public class SplunkEventTests { - @Test - public void testGetEventData() { - Map data = new HashMap(); - data.put("foo", "foo"); - data.put("bar", null); - SplunkEvent event = new SplunkEvent(data); - Map eventData = event.getEventData(); - assertEquals(data.size(),eventData.size()); - for (String key: eventData.keySet()) { - assertEquals(data.get(key),eventData.get(key)); - } - } - public void testGetEventDataEmpty() { - SplunkEvent event = new SplunkEvent( ); - Map eventData = event.getEventData(); - assertEquals(0,eventData.size()); - } - - @Test(expected=RuntimeException.class) - public void testKeyCannotBeNull() { - SplunkEvent event = new SplunkEvent(); - event.addPair(null, "foo"); - } - - @Test - public void testCopyConstructor() { - Map data = new HashMap(); - data.put("foo", "foo"); - data.put("bar", "bar"); - SplunkEvent event = new SplunkEvent(data); - SplunkEvent event2 = new SplunkEvent(event); - assertEquals(event.quoteValues, event2.quoteValues); - assertEquals(event.useInternalDate,event2.useInternalDate); - Map eventData = event.getEventData(); - Map event2Data = event2.getEventData(); - - assertEquals(eventData.size(),event2Data.size()); - for (String key: eventData.keySet()) { - assertEquals(eventData.get(key),event2Data.get(key)); - } - } -} diff --git a/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/inbound/SplunkPollingChannelAdapterTests.java b/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/inbound/SplunkPollingChannelAdapterTests.java deleted file mode 100644 index 9b6ecfa..0000000 --- a/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/inbound/SplunkPollingChannelAdapterTests.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.*; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import org.springframework.integration.splunk.event.SplunkEvent; -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(); - SplunkEvent sd = new SplunkEvent("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/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/outbound/SplunkOutboundChannelAdapterTests.java b/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/outbound/SplunkOutboundChannelAdapterTests.java deleted file mode 100644 index cf4fb5b..0000000 --- a/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/outbound/SplunkOutboundChannelAdapterTests.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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.*; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import org.springframework.integration.splunk.support.SplunkExecutor; -import org.springframework.messaging.Message; - -/** - * @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.write(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/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/support/SplunkDataReaderTests.java b/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/support/SplunkDataReaderTests.java deleted file mode 100644 index 666f9e3..0000000 --- a/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/support/SplunkDataReaderTests.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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.*; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import java.util.Map; - -import com.splunk.Job; -import com.splunk.JobCollection; -import com.splunk.Service; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; - -import org.springframework.core.io.ClassPathResource; -import org.springframework.integration.splunk.core.ServiceFactory; -import org.springframework.integration.splunk.event.SplunkEvent; - -/** - * @author Jarred Li - * @since 1.0 - * - */ -public class SplunkDataReaderTests { - - private SplunkDataReader reader; - - @Before - public void before() { - ServiceFactory serviceFactory =serviceFactory(); - reader = new SplunkDataReader(serviceFactory); - } - - /** - * 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.read(); - 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.read(); - Assert.assertNotNull(data); - Assert.assertEquals(5, data.size()); - } - - - @Ignore - @Test - public void testRealtimeSearch() throws Exception { - reader.setMode(SearchMode.REALTIME); - reader.setSearch("search spring:example"); - List data = reader.read(); - Assert.assertNotNull(data); - Assert.assertEquals(5, data.size()); - } - - private ServiceFactory serviceFactory() { - 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 service = mock(Service.class); - 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); - - ServiceFactory serviceFactory = mock(ServiceFactory.class); - when(serviceFactory.getService()).thenReturn(service); - return serviceFactory; - } -} diff --git a/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/support/SplunkDataWriterTests.java b/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/support/SplunkDataWriterTests.java deleted file mode 100644 index 0e6e63f..0000000 --- a/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/support/SplunkDataWriterTests.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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.eq; -import static org.mockito.Matchers.matches; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.junit.Before; -import org.junit.Test; -import org.springframework.integration.splunk.core.ServiceFactory; -import org.springframework.integration.splunk.event.SplunkEvent; - -import com.splunk.Args; -import com.splunk.Receiver; -import com.splunk.Service; - -/** - * @author Jarred Li - * @since 1.0 - * - */ -public class SplunkDataWriterTests { - - private AbstractSplunkDataWriter writer; - - private static Receiver receiver = mock(Receiver.class); - - private Args args; - - @Before - public void before() throws Exception { - args = new Args(); - writer = new SplunkSubmitWriter(serviceFactory(), args); - writer.start(); - } - - /** - * Test method for {@link org.springframework.integration.splunk.support.AbstractSplunkDataWriter#write(org.springframework.integration.splunk.event.SplunkEvent)}. - * @throws Exception - */ - @Test - public void testWrite() throws Exception { - - SplunkEvent sd = new SplunkEvent("spring", "spring:example"); - sd.setCommonDesc("description"); - writer.write(sd); - - verify(receiver).submit(eq(args), matches(".*spring:example.*\n")); - - writer.stop(); - } - - private ServiceFactory serviceFactory() throws Exception { - ServiceFactory serviceFactory = mock(ServiceFactory.class); - - Service service = mock(Service.class); - service.setToken("token"); - when(service.getReceiver()).thenReturn(receiver); - when(serviceFactory.getService()).thenReturn(service); - return serviceFactory; - } - -} diff --git a/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/support/SplunkExecutorTests.java b/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/support/SplunkExecutorTests.java deleted file mode 100644 index 3434b2f..0000000 --- a/spring-integration-splunk/src/test/java/org/springframework/integration/splunk/support/SplunkExecutorTests.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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.*; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import org.springframework.integration.splunk.core.DataReader; -import org.springframework.integration.splunk.core.DataWriter; -import org.springframework.integration.splunk.event.SplunkEvent; -import org.springframework.integration.support.MessageBuilder; -import org.springframework.messaging.Message; - -/** - * @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 { - SplunkEvent sd = new SplunkEvent("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(); - SplunkEvent sd = new SplunkEvent("spring", "spring:example"); - sd.setCommonDesc("description"); - data.add(sd); - - sd = new SplunkEvent("spring", "spring:example"); - sd.setCommonDesc("description"); - data.add(sd); - when(reader.read()).thenReturn(data); - - List result = executor.poll(); - Assert.assertEquals(2, result.size()); - - } - -} diff --git a/spring-integration-splunk/src/test/resources/log4j.properties b/spring-integration-splunk/src/test/resources/log4j.properties deleted file mode 100644 index 8051ac4..0000000 --- a/spring-integration-splunk/src/test/resources/log4j.properties +++ /dev/null @@ -1,7 +0,0 @@ -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 - -log4j.category.org.springframework.integration.splunk=DEBUG diff --git a/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/SplunkCommon-context.xml b/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/SplunkCommon-context.xml deleted file mode 100644 index 5c6b358..0000000 --- a/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/SplunkCommon-context.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - diff --git a/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserCommon-context.xml b/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserCommon-context.xml deleted file mode 100644 index 7bf4b88..0000000 --- a/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserCommon-context.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - diff --git a/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserSavedSearchTests-context.xml b/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserSavedSearchTests-context.xml deleted file mode 100644 index df88cb2..0000000 --- a/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserSavedSearchTests-context.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - diff --git a/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserTests-context.xml b/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserTests-context.xml deleted file mode 100644 index 65c9f7f..0000000 --- a/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkInboundChannelAdapterParserTests-context.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - diff --git a/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserStreamTests-context.xml b/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserStreamTests-context.xml deleted file mode 100644 index ea38767..0000000 --- a/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserStreamTests-context.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - diff --git a/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserTests-context.xml b/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserTests-context.xml deleted file mode 100644 index aaa2b16..0000000 --- a/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkOutboundChannelAdapterParserTests-context.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - diff --git a/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkServerParserTests-context.xml b/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkServerParserTests-context.xml deleted file mode 100644 index 0860ee1..0000000 --- a/spring-integration-splunk/src/test/resources/org/springframework/integration/splunk/config/xml/SplunkServerParserTests-context.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - diff --git a/spring-integration-splunk/src/test/resources/splunk-data.xml b/spring-integration-splunk/src/test/resources/splunk-data.xml deleted file mode 100644 index c492d7e..0000000 --- a/spring-integration-splunk/src/test/resources/splunk-data.xml +++ /dev/null @@ -1,236 +0,0 @@ - - - - -_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