init
This commit is contained in:
+231
@@ -0,0 +1,231 @@
|
|||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.war
|
||||||
|
|
||||||
|
# Eclipse #
|
||||||
|
.metadata
|
||||||
|
bin/
|
||||||
|
tmp/
|
||||||
|
*.tmp
|
||||||
|
*.bak
|
||||||
|
*.swp
|
||||||
|
*~.nib
|
||||||
|
local.properties
|
||||||
|
.settings/
|
||||||
|
.loadpath
|
||||||
|
.recommenders
|
||||||
|
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
|
||||||
|
# External tool builders
|
||||||
|
.externalToolBuilders/
|
||||||
|
|
||||||
|
# Locally stored "Eclipse launch configurations"
|
||||||
|
*.launch
|
||||||
|
|
||||||
|
# PyDev specific (Python IDE for Eclipse)
|
||||||
|
*.pydevproject
|
||||||
|
|
||||||
|
# CDT-specific (C/C++ Development Tooling)
|
||||||
|
.cproject
|
||||||
|
|
||||||
|
# CDT- autotools
|
||||||
|
.autotools
|
||||||
|
|
||||||
|
# Java annotation processor (APT)
|
||||||
|
.factorypath
|
||||||
|
|
||||||
|
# PDT-specific (PHP Development Tools)
|
||||||
|
.buildpath
|
||||||
|
|
||||||
|
# sbteclipse plugin
|
||||||
|
.target
|
||||||
|
|
||||||
|
# Tern plugin
|
||||||
|
.tern-project
|
||||||
|
|
||||||
|
# TeXlipse plugin
|
||||||
|
.texlipse
|
||||||
|
|
||||||
|
# STS (Spring Tool Suite)
|
||||||
|
.springBeans
|
||||||
|
|
||||||
|
# Code Recommenders
|
||||||
|
.recommenders/
|
||||||
|
|
||||||
|
# Annotation Processing
|
||||||
|
.apt_generated/
|
||||||
|
.apt_generated_test/
|
||||||
|
|
||||||
|
# Scala IDE specific (Scala & Java development for Eclipse)
|
||||||
|
.cache-main
|
||||||
|
.scala_dependencies
|
||||||
|
.worksheet
|
||||||
|
|
||||||
|
# Uncomment this line if you wish to ignore the project description file.
|
||||||
|
# Typically, this file would be tracked if it contains build/dependency configurations:
|
||||||
|
#.project
|
||||||
|
### Intellij ###
|
||||||
|
.idea
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
||||||
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
# User-specific stuff
|
||||||
|
.idea/**/workspace.xml
|
||||||
|
.idea/**/tasks.xml
|
||||||
|
.idea/**/usage.statistics.xml
|
||||||
|
.idea/**/dictionaries
|
||||||
|
.idea/**/shelf
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
.idea/**/contentModel.xml
|
||||||
|
|
||||||
|
# Sensitive or high-churn files
|
||||||
|
.idea/**/dataSources/
|
||||||
|
.idea/**/dataSources.ids
|
||||||
|
.idea/**/dataSources.local.xml
|
||||||
|
.idea/**/sqlDataSources.xml
|
||||||
|
.idea/**/dynamic.xml
|
||||||
|
.idea/**/uiDesigner.xml
|
||||||
|
.idea/**/dbnavigator.xml
|
||||||
|
|
||||||
|
# Gradle
|
||||||
|
.idea/**/gradle.xml
|
||||||
|
.idea/**/libraries
|
||||||
|
|
||||||
|
# Gradle and Maven with auto-import
|
||||||
|
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||||
|
# since they will be recreated, and may cause churn. Uncomment if using
|
||||||
|
# auto-import.
|
||||||
|
# .idea/modules.xml
|
||||||
|
# .idea/*.iml
|
||||||
|
# .idea/modules
|
||||||
|
# *.iml
|
||||||
|
# *.ipr
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
cmake-build-*/
|
||||||
|
|
||||||
|
# Mongo Explorer plugin
|
||||||
|
.idea/**/mongoSettings.xml
|
||||||
|
|
||||||
|
# File-based project format
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
out/
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Cursive Clojure plugin
|
||||||
|
.idea/replstate.xml
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
|
||||||
|
# Editor-based Rest Client
|
||||||
|
.idea/httpRequests
|
||||||
|
|
||||||
|
# Android studio 3.1+ serialized cache file
|
||||||
|
.idea/caches/build_file_checksums.ser
|
||||||
|
|
||||||
|
### Intellij Patch ###
|
||||||
|
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
||||||
|
|
||||||
|
# *.iml
|
||||||
|
# modules.xml
|
||||||
|
# .idea/misc.xml
|
||||||
|
# *.ipr
|
||||||
|
|
||||||
|
# Sonarlint plugin
|
||||||
|
.idea/**/sonarlint/
|
||||||
|
|
||||||
|
# SonarQube Plugin
|
||||||
|
.idea/**/sonarIssues.xml
|
||||||
|
|
||||||
|
# Markdown Navigator plugin
|
||||||
|
.idea/**/markdown-navigator.xml
|
||||||
|
.idea/**/markdown-navigator/
|
||||||
|
|
||||||
|
### Java ###
|
||||||
|
# Compiled class file
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Log file
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# BlueJ files
|
||||||
|
*.ctxt
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.war
|
||||||
|
*.nar
|
||||||
|
*.ear
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
*.rar
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
|
||||||
|
### macOS ###
|
||||||
|
# General
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
|
### Gradle ###
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Ignore Gradle GUI config
|
||||||
|
gradle-app.setting
|
||||||
|
|
||||||
|
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||||
|
!gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Cache of project
|
||||||
|
.gradletasknamecache
|
||||||
|
|
||||||
|
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
|
||||||
|
# gradle/wrapper/gradle-wrapper.properties
|
||||||
|
|
||||||
|
### Gradle Patch ###
|
||||||
|
**/build/
|
||||||
|
|
||||||
|
# End of https://www.gitignore.io/api/java,macos,gradle,intellij
|
||||||
|
/EAISIMWeb/
|
||||||
|
/gradle.properties
|
||||||
+108
@@ -0,0 +1,108 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java-library'
|
||||||
|
id 'maven-publish'
|
||||||
|
id 'eclipse-wtp'
|
||||||
|
id 'idea'
|
||||||
|
}
|
||||||
|
group 'com.eactive'
|
||||||
|
version '4.5.1-SNAPSHOT'
|
||||||
|
|
||||||
|
def springVersion = "5.3.27"
|
||||||
|
|
||||||
|
def nexusUrl = "https://nexus.eactive.synology.me:8090"
|
||||||
|
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(8)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compileJava {
|
||||||
|
options.encoding = 'UTF-8'
|
||||||
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
exclude '**/persistence.xml'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
options.encoding = 'UTF-8'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
//implementation project(':elink-online-core')
|
||||||
|
//implementation project(':elink-online-transformer')
|
||||||
|
//implementation project(':elink-online-common')
|
||||||
|
api project(':elink-online-common')
|
||||||
|
|
||||||
|
compileOnly fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|
||||||
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
|
||||||
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = 'eactiveRepository'
|
||||||
|
def releasesRepoUrl = "${nexusUrl}/repository/maven-releases/"
|
||||||
|
def snapshotsRepoUrl = "${nexusUrl}/repository/maven-snapshots/"
|
||||||
|
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
|
||||||
|
credentials(PasswordCredentials)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publications {
|
||||||
|
mavenJava(MavenPublication) {
|
||||||
|
from components.java
|
||||||
|
pom {
|
||||||
|
description = "eLink EMS Client module"
|
||||||
|
licenses {
|
||||||
|
license {
|
||||||
|
name = "Commercial License"
|
||||||
|
url = "http://eactive.co.kr"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||||
|
archiveClassifier = 'sources'
|
||||||
|
from sourceSets.main.allSource
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives sourcesJar
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations.all {
|
||||||
|
resolutionStrategy {
|
||||||
|
// 동적 버전 탐색을 10분 캐시
|
||||||
|
cacheDynamicVersionsFor 10, 'minutes'
|
||||||
|
// 변하는 모듈(Changing Module)을 캐시하지 않음
|
||||||
|
cacheChangingModulesFor 0, 'seconds'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task settingEclipseEncoding {
|
||||||
|
if (project.file('.settings').exists()) {
|
||||||
|
File f = file('.settings/org.eclipse.core.resources.prefs')
|
||||||
|
f.write('eclipse.preferences.version=1\n')
|
||||||
|
f.append('encoding/<project>=utf-8')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//eclipseJdt.finalizedBy settingEclipseEncoding
|
||||||
|
|
||||||
|
eclipse {
|
||||||
|
synchronizationTasks settingEclipseEncoding
|
||||||
|
}
|
||||||
Vendored
BIN
Binary file not shown.
+6
@@ -0,0 +1,6 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
networkTimeout=10000
|
||||||
@@ -0,0 +1,234 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original 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
|
||||||
|
#
|
||||||
|
# https://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.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
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" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
Vendored
+89
@@ -0,0 +1,89 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@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
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@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="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@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 execute
|
||||||
|
|
||||||
|
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 execute
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
: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 %*
|
||||||
|
|
||||||
|
: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
|
||||||
Binary file not shown.
@@ -0,0 +1,11 @@
|
|||||||
|
rootProject.name = 'elink-online-emsclient'
|
||||||
|
|
||||||
|
include 'elink-online-core-jpa'
|
||||||
|
include 'elink-online-core'
|
||||||
|
include 'elink-online-transformer'
|
||||||
|
include 'elink-online-common'
|
||||||
|
|
||||||
|
project (':elink-online-core-jpa').projectDir = new File(settingsDir, "../elink-online-core-jpa")
|
||||||
|
project (':elink-online-core').projectDir = new File(settingsDir, "../elink-online-core")
|
||||||
|
project (':elink-online-transformer').projectDir = new File(settingsDir, "../elink-online-transformer")
|
||||||
|
project (':elink-online-common').projectDir = new File(settingsDir, "../elink-online-common")
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
Class-Path:
|
||||||
|
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package com.eactive.eai.rms.client;
|
||||||
|
|
||||||
|
import java.net.SocketAddress;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.mina.common.IoSession;
|
||||||
|
import org.apache.mina.common.IoSessionRecycler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class SimpleSessionRecycler.
|
||||||
|
*
|
||||||
|
* <ul>
|
||||||
|
* <li>1. Function : IoSession 의 Recycler </li>
|
||||||
|
* <li>2. Summary :SessionRecycler에 의해 Session이 종료 되지 않고 접속 유지를
|
||||||
|
* 하게 된다.</li>
|
||||||
|
* <li>3. Notification :</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @author : $Author: 윤창용 $
|
||||||
|
* @version : $Revision: 1.2 $
|
||||||
|
*/
|
||||||
|
public class SimpleSessionRecycler implements IoSessionRecycler {
|
||||||
|
|
||||||
|
/** The recycle map. */
|
||||||
|
Map<Object, IoSession> recycleMap = new HashMap<Object, IoSession>();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.apache.mina.common.IoSessionRecycler#remove(org.apache.mina.common.IoSession)
|
||||||
|
*/
|
||||||
|
public void remove(IoSession iosession) {
|
||||||
|
recycleMap.remove(iosession);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.apache.mina.common.IoSessionRecycler#recycle(java.net.SocketAddress,
|
||||||
|
* java.net.SocketAddress)
|
||||||
|
*/
|
||||||
|
public IoSession recycle(SocketAddress localAddress,
|
||||||
|
SocketAddress remoteAddress) {
|
||||||
|
return (IoSession) recycleMap.get(generateKey(localAddress,
|
||||||
|
remoteAddress));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.apache.mina.common.IoSessionRecycler#put(org.apache.mina.common.IoSession)
|
||||||
|
*/
|
||||||
|
public void put(IoSession iosession) {
|
||||||
|
Object key = generateKey(iosession);
|
||||||
|
if (!recycleMap.containsKey(key)) {
|
||||||
|
recycleMap.put(key, iosession);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate key.
|
||||||
|
*
|
||||||
|
* @param iosession the iosession
|
||||||
|
*
|
||||||
|
* @return the object
|
||||||
|
*/
|
||||||
|
private Object generateKey(IoSession iosession) {
|
||||||
|
return generateKey(iosession.getLocalAddress(), iosession
|
||||||
|
.getRemoteAddress());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate key.
|
||||||
|
*
|
||||||
|
* @param localAddress the local address
|
||||||
|
* @param remoteAddress the remote address
|
||||||
|
*
|
||||||
|
* @return the object
|
||||||
|
*/
|
||||||
|
private Object generateKey(SocketAddress localAddress,
|
||||||
|
SocketAddress remoteAddress) {
|
||||||
|
List<SocketAddress> key = new ArrayList<SocketAddress>(2);
|
||||||
|
key.add(remoteAddress);
|
||||||
|
key.add(localAddress);
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.eactive.eai.rms.client;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.onl.vo.MonitorDataVo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface SocketClient.
|
||||||
|
* <ul>
|
||||||
|
* <li>1. Function :SocketClient 인터페이스</li>
|
||||||
|
* <li>2. Summary :</li>
|
||||||
|
* <li>3. Notification :</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @author : $Author: 박기섭 $
|
||||||
|
* @version : $Revision: 1.3 $
|
||||||
|
*/
|
||||||
|
public interface SocketClient {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send.
|
||||||
|
*
|
||||||
|
* @param serializable the serializable
|
||||||
|
*/
|
||||||
|
public void send(MonitorDataVo serializable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy.
|
||||||
|
*/
|
||||||
|
public void destroy();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,180 @@
|
|||||||
|
package com.eactive.eai.rms.client;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
|
import java.io.ObjectStreamClass;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.DatagramChannel;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.client.common.AbstractSocketClient;
|
||||||
|
import com.eactive.eai.rms.client.context.RmsProperties;
|
||||||
|
import com.eactive.eai.rms.onl.vo.MonitorDataVo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class SocketClientUdpImpl.
|
||||||
|
* <ul>
|
||||||
|
* <li>1. Function :</li>
|
||||||
|
* <li>2. Summary :</li>
|
||||||
|
* <li>3. Notification :</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @author : $Author: 윤창용 $
|
||||||
|
* @version : $Revision: 1.12 $
|
||||||
|
*/
|
||||||
|
public class SocketClientUdpImpl extends AbstractSocketClient implements
|
||||||
|
InitializingBean {
|
||||||
|
|
||||||
|
/** F/W logger. */
|
||||||
|
private static com.eactive.eai.common.util.Logger logger = com.eactive.eai.common.util.Logger.getLogger(com.eactive.eai.common.util.Logger.LOGGER_CLIENT);
|
||||||
|
|
||||||
|
|
||||||
|
private Set<DatagramChannel> dChannels = new HashSet<DatagramChannel>();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||||
|
*/
|
||||||
|
public synchronized void afterPropertiesSet() throws Exception {
|
||||||
|
if( logger.isDebugEnabled() ) {
|
||||||
|
logger.debug("RMS_DEBUG:start afterPropertiesSet()" );
|
||||||
|
}
|
||||||
|
connect();
|
||||||
|
|
||||||
|
if( logger.isDebugEnabled() ) {
|
||||||
|
logger.debug("RMS_DEBUG:end afterPropertiesSet()" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void connect() throws Exception {
|
||||||
|
logger.info("SocketClientUdpImpl] connection start");
|
||||||
|
destroy();
|
||||||
|
|
||||||
|
String ipString = rmsProperties.getStringProperty(RmsProperties.RMS_SERVER_IP_KEY);
|
||||||
|
int port = rmsProperties.getIntProperty(RmsProperties.RMS_SERVER_PORT_KEY);
|
||||||
|
if (ipString != null) {
|
||||||
|
String[] ips = ipString.split(",");
|
||||||
|
|
||||||
|
if (ips != null && ips.length > 0) {
|
||||||
|
for (int i = 0; i < ips.length; i++) {
|
||||||
|
DatagramChannel ch = null;
|
||||||
|
try{
|
||||||
|
ch = DatagramChannel.open();
|
||||||
|
InetSocketAddress ad = new InetSocketAddress(ips[i], port);
|
||||||
|
ch.connect(ad);
|
||||||
|
logger.info("SocketClientUdpImpl] upd address hostname="+ad.getHostName()+", port="+ad.getPort());
|
||||||
|
}catch(Exception e){
|
||||||
|
if (ch!=null) try{ch.disconnect();}catch(Exception e1){}
|
||||||
|
logger.error("SocketClientUdpImpl] udp connection error "+e.getMessage(),e);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
this.dChannels.add(ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.info("SocketClientUdpImpl] connection end");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.eactive.eai.rms.client.SocketClient#send(com.eactive.eai.rms.vo.MonitorDataVo)
|
||||||
|
*/
|
||||||
|
public void send(final MonitorDataVo vo) {
|
||||||
|
|
||||||
|
// 현재 900k 이지만 테스트 수행수 적정 사이즈로 조정한다.
|
||||||
|
ByteBuffer buffer = ByteBuffer.allocate(1024*10);
|
||||||
|
buffer.position(4);
|
||||||
|
try {
|
||||||
|
try {
|
||||||
|
ObjectOutputStream out = new ObjectOutputStream(asOutputStream(buffer)) {
|
||||||
|
protected void writeClassDescriptor(ObjectStreamClass desc)
|
||||||
|
throws IOException {
|
||||||
|
String className = desc.getName();
|
||||||
|
if (primitiveTypeNames.contains(className)) {
|
||||||
|
write(0);
|
||||||
|
super.writeClassDescriptor(desc);
|
||||||
|
} else {
|
||||||
|
write(1);
|
||||||
|
writeUTF(desc.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
out.writeObject(vo);
|
||||||
|
out.flush();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
int size = buffer.position() - 4;
|
||||||
|
buffer.position(0);
|
||||||
|
buffer.putInt(size);
|
||||||
|
buffer.position(4+size);
|
||||||
|
|
||||||
|
buffer.flip();
|
||||||
|
for (DatagramChannel ch : dChannels) {
|
||||||
|
try{
|
||||||
|
if (ch.isConnected()){
|
||||||
|
buffer.position(0);
|
||||||
|
int written = ch.write(buffer);
|
||||||
|
logger.debug("written="+written);
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("RMS_ERROR : channel write error remote address[" +ch.getRemoteAddress()+"]" ,e);
|
||||||
|
}catch(Throwable t){
|
||||||
|
logger.error("RMS_ERROR : channel write error remote address[" +ch.getRemoteAddress()+"]" ,t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 현재 AIX 의 udp_send buffer size 가 1M 로 설정되어 있음. ( 2009.02.23 )
|
||||||
|
logger.error("RMS_ERROR : UDP 버퍼 사이즈 에러 buffer.limit()=" + buffer.limit() ,e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public OutputStream asOutputStream(final ByteBuffer buffer) {
|
||||||
|
return new OutputStream() {
|
||||||
|
public void write(byte[] b, int off, int len) {
|
||||||
|
buffer.put(b, off, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void write(int b) {
|
||||||
|
buffer.put((byte) b);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void destroy() {
|
||||||
|
for (DatagramChannel ch : dChannels) {
|
||||||
|
if (ch != null) {
|
||||||
|
try {
|
||||||
|
ch.disconnect();
|
||||||
|
} catch(Exception ex) {
|
||||||
|
logger.error("udp destory error="+ex.getMessage(),ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dChannels.removeAll(new HashSet<DatagramChannel>());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Set primitiveTypeNames = new HashSet();
|
||||||
|
|
||||||
|
static {
|
||||||
|
primitiveTypeNames.add("void");
|
||||||
|
primitiveTypeNames.add("boolean");
|
||||||
|
primitiveTypeNames.add("byte");
|
||||||
|
primitiveTypeNames.add("char");
|
||||||
|
primitiveTypeNames.add("short");
|
||||||
|
primitiveTypeNames.add("int");
|
||||||
|
primitiveTypeNames.add("long");
|
||||||
|
primitiveTypeNames.add("float");
|
||||||
|
primitiveTypeNames.add("double");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.eactive.eai.rms.client;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.mina.common.IoSession;
|
||||||
|
import org.apache.mina.handler.demux.DemuxingIoHandler;
|
||||||
|
import org.apache.mina.handler.demux.MessageHandler;
|
||||||
|
import org.apache.mina.util.SessionLog;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.client.handler.IMessageHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class UdpClientSessionHandler.
|
||||||
|
* <ul>
|
||||||
|
* <li>1. Function :EAI Framework으로 부터 송신하는 UDP/IP의 SessionHandler입니다. </li>
|
||||||
|
* <li>2. Summary :</li>
|
||||||
|
* <li>3. Notification :</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @author : $Author: 박기섭 $
|
||||||
|
* @version : $Revision: 1.6 $
|
||||||
|
*/
|
||||||
|
public class UdpClientSessionHandler extends DemuxingIoHandler implements
|
||||||
|
InitializingBean {
|
||||||
|
|
||||||
|
public UdpClientSessionHandler(List<IMessageHandler> handlers) {
|
||||||
|
for (IMessageHandler handler : handlers) {
|
||||||
|
addMessageHandler(handler.targetClass(), (MessageHandler) handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.apache.mina.common.IoHandlerAdapter#sessionOpened(org.apache.mina.common.IoSession)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void sessionOpened(IoSession session) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.apache.mina.common.IoHandlerAdapter#messageSent(org.apache.mina.common.IoSession, java.lang.Object)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void messageSent(IoSession session, Object message) throws Exception {
|
||||||
|
if (SessionLog.isDebugEnabled(session)) {
|
||||||
|
SessionLog.debug(session, "message : " + message + "\n" + session);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.apache.mina.common.IoHandlerAdapter#exceptionCaught(org.apache.mina.common.IoSession, java.lang.Throwable)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void exceptionCaught(IoSession session, Throwable cause) {
|
||||||
|
if (SessionLog.isDebugEnabled(session)) {
|
||||||
|
SessionLog.debug(session, "exceptionCaught", cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.apache.mina.common.IoHandlerAdapter#sessionClosed(org.apache.mina.common.IoSession)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void sessionClosed(IoSession session) throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void afterPropertiesSet() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.eactive.eai.rms.client.agent;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationContextAware;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface AbstractScheduledAgent.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* <ul>
|
||||||
|
* <li>1. Function : 지정된 시간, 주기로 실행 되는 모든 작업에 대한 상위 인터페이스 입니다. </li>
|
||||||
|
* <li>2. Summary :</li>
|
||||||
|
* <li>3. Notification :</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @author : $Author: 윤창용 $
|
||||||
|
* @version : $Revision: 1.2 $
|
||||||
|
*/
|
||||||
|
public abstract class AbstractScheduledAgent implements Runnable,
|
||||||
|
ApplicationContextAware {
|
||||||
|
/** F/W logger. */
|
||||||
|
protected static com.eactive.eai.common.util.Logger logger = com.eactive.eai.common.util.Logger.getLogger(com.eactive.eai.common.util.Logger.LOGGER_CLIENT);
|
||||||
|
|
||||||
|
ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
public void setApplicationContext(ApplicationContext applicationContext)
|
||||||
|
throws BeansException {
|
||||||
|
this.applicationContext = applicationContext;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,381 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.eactive.eai.rms.client.agent;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import com.eactive.eai.adapter.AdapterGroupVO;
|
||||||
|
import com.eactive.eai.adapter.AdapterManager;
|
||||||
|
import com.eactive.eai.adapter.AdapterVO;
|
||||||
|
import com.eactive.eai.common.server.EAIServerManager;
|
||||||
|
import com.eactive.eai.rms.client.SocketClient;
|
||||||
|
import com.eactive.eai.rms.client.dao.AgentAdapterDAO;
|
||||||
|
import com.eactive.eai.rms.onl.vo.AdaptersVO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author cyyun
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AdaptersAgent extends AbstractScheduledAgent {
|
||||||
|
|
||||||
|
private SocketClient socketClient;
|
||||||
|
private final int maxBufferSize = 1024*3; //어뎁터 모니터링 maxBufferSize 이상이면 모니터링 하지 않음 UDP Buffer 문제
|
||||||
|
private AgentAdapterDAO agentAdapterDao;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see java.lang.Runnable#run()
|
||||||
|
*/
|
||||||
|
public void run() {
|
||||||
|
AdaptersVO adaptersVO = (AdaptersVO) applicationContext.getBean("adaptersVO");
|
||||||
|
initAdapter( adaptersVO );
|
||||||
|
checkAdapter( adaptersVO );
|
||||||
|
|
||||||
|
socketClient.send(adaptersVO);
|
||||||
|
|
||||||
|
logger.debug("SEND AdaptersAgent : " + adaptersVO );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSocketClient(SocketClient socketClient) {
|
||||||
|
this.socketClient = socketClient;
|
||||||
|
}
|
||||||
|
public void setAgentAdapterDao(AgentAdapterDAO agentAdapterDao){
|
||||||
|
this.agentAdapterDao = agentAdapterDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdaptersVO getAdapterInfo() {
|
||||||
|
AdaptersVO adapter = new AdaptersVO();
|
||||||
|
|
||||||
|
initAdapter(adapter);
|
||||||
|
checkAdapter(adapter);
|
||||||
|
|
||||||
|
return adapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void initAdapter(AdaptersVO adapter) {
|
||||||
|
// get Adapter manager
|
||||||
|
AdapterManager manager = AdapterManager.getInstance();
|
||||||
|
|
||||||
|
// get Adapter group list
|
||||||
|
HashMap voMap = manager.getAllAdapterGroupVO();
|
||||||
|
|
||||||
|
Iterator it = voMap.keySet().iterator();
|
||||||
|
|
||||||
|
String[] groupNames = new String[voMap.size()];
|
||||||
|
|
||||||
|
for (int i = 0; it.hasNext(); i++) {
|
||||||
|
groupNames[i] = (String) it.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
Arrays.sort(groupNames);
|
||||||
|
|
||||||
|
//송신하는 서버의 정보
|
||||||
|
EAIServerManager serManager = EAIServerManager.getInstance();
|
||||||
|
String localServName = serManager.getLocalServerName();
|
||||||
|
adapter.setDisconAdaptersGroup(localServName);
|
||||||
|
|
||||||
|
//------------------------------------------
|
||||||
|
// 어뎁터 검색 조건에 의해 모니터링 제외 대상을 산정 - 2012.06.14 Edited by Chaesh
|
||||||
|
//------------------------------------------
|
||||||
|
HashMap monitorDisableMap = new HashMap();
|
||||||
|
try {
|
||||||
|
monitorDisableMap = agentAdapterDao.getMonitorUseNoAdapterList();
|
||||||
|
}
|
||||||
|
catch(Exception ex) {
|
||||||
|
logger.error("adapterMonitorPage.jsp - getMonitorUseAdapterList AdapterGroup Select Error. Skip ");
|
||||||
|
}
|
||||||
|
//------------------------------------------
|
||||||
|
// 시간 조건에 의해 모니터링 제외 대상을 산정 - 2012.06.14 Edited by Chaesh
|
||||||
|
//------------------------------------------
|
||||||
|
HashMap monitorTimeConditionMap = new HashMap();
|
||||||
|
try {
|
||||||
|
monitorTimeConditionMap = agentAdapterDao.getMonitorTimeConditionAdapterList();
|
||||||
|
}
|
||||||
|
catch(Exception ex) {
|
||||||
|
logger.error("adapterMonitorPage.jsp - getMonitorUseAdapterList AdapterGroup Select Error. Skip ");
|
||||||
|
}
|
||||||
|
//------------------------------------------
|
||||||
|
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
int weekCount = cal.get(Calendar.DAY_OF_WEEK);
|
||||||
|
|
||||||
|
// 20190214 dhlee
|
||||||
|
// BugFix : 11시 1분의 경우 : 111 -> 1101
|
||||||
|
// String timeCtnt = String.valueOf(cal.get(Calendar.HOUR_OF_DAY)) + String.valueOf(cal.get(Calendar.MINUTE));
|
||||||
|
|
||||||
|
String timeCtnt = String.format("%02d",cal.get(Calendar.HOUR_OF_DAY))
|
||||||
|
+ String.format("%02d", cal.get(Calendar.MINUTE));
|
||||||
|
|
||||||
|
for (int i = 0; i < groupNames.length; i++) {
|
||||||
|
|
||||||
|
// get Adapter group value
|
||||||
|
AdapterGroupVO gvo = manager.getAdapterGroupVO(groupNames[i]);
|
||||||
|
Iterator it2 = null;
|
||||||
|
|
||||||
|
//------------------------------------------
|
||||||
|
// 모니터링 제외 N 어댑터 SKIP. - 2012.06.14
|
||||||
|
//------------------------------------------
|
||||||
|
if(monitorDisableMap !=null && monitorDisableMap.size() > 0) {
|
||||||
|
if(monitorDisableMap.get(groupNames[i]) != null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//------------------------------------------
|
||||||
|
// 모니터링 시간 조건 체크 - 2012.06.14
|
||||||
|
//------------------------------------------
|
||||||
|
if(monitorTimeConditionMap !=null && monitorTimeConditionMap.size() > 0) {
|
||||||
|
String conditionString = (String) monitorTimeConditionMap.get(groupNames[i]);
|
||||||
|
if( conditionString != null) {
|
||||||
|
try {
|
||||||
|
String[] ctntTemp = conditionString.split(",");
|
||||||
|
if ( ctntTemp[0].equals("Y") ) {
|
||||||
|
if ( ctntTemp[2].compareTo(timeCtnt) > 0 || ctntTemp[3].compareTo(timeCtnt) < 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( ctntTemp[1].equals("WEEKDAY") ) {
|
||||||
|
switch ( weekCount ) {
|
||||||
|
case 1 :
|
||||||
|
case 7 :
|
||||||
|
continue;
|
||||||
|
default :
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e){
|
||||||
|
logger.error("Monitoring codition code parse Error - Plz check the rule.",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//------------------------------------------
|
||||||
|
|
||||||
|
if (gvo == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// get Adapter list
|
||||||
|
it2 = gvo.getAdapters();
|
||||||
|
|
||||||
|
for (int j = 0; it2.hasNext(); j++) {
|
||||||
|
|
||||||
|
// get Adapter value
|
||||||
|
AdapterVO vo = (AdapterVO) it2.next();
|
||||||
|
|
||||||
|
if (vo == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// total
|
||||||
|
adapter.total[0]++;
|
||||||
|
if (vo.isStarted())
|
||||||
|
adapter.total[1]++;
|
||||||
|
else
|
||||||
|
adapter.total[2]++;
|
||||||
|
|
||||||
|
if (("SNA").equals(gvo.getType())) {
|
||||||
|
adapter.sna[0]++;
|
||||||
|
if (vo.isStatus())
|
||||||
|
adapter.sna[1]++;
|
||||||
|
else
|
||||||
|
adapter.sna[2]++;
|
||||||
|
} else if (("SOC").equals(gvo.getType())) {
|
||||||
|
adapter.socket[0]++;
|
||||||
|
if (vo.isStatus())
|
||||||
|
adapter.socket[1]++;
|
||||||
|
else
|
||||||
|
adapter.socket[2]++;
|
||||||
|
} else if (("NET").equals(gvo.getType())) {
|
||||||
|
adapter.socket2[0]++;
|
||||||
|
|
||||||
|
if (vo.isStatus())
|
||||||
|
adapter.socket2[1]++;
|
||||||
|
else {
|
||||||
|
adapter.socket2[2]++;
|
||||||
|
//Status 가 false 상태은 어뎁터는 , 로 엮어서 RMS에 송신
|
||||||
|
if ( adapter.getDisconAdaptersGroup().length() < maxBufferSize )
|
||||||
|
adapter.setDisconAdaptersGroup(adapter.getDisconAdaptersGroup() + "," + vo.getAdapterGroupName());
|
||||||
|
}
|
||||||
|
} else if (("WTC").equals(gvo.getType())) {
|
||||||
|
adapter.tuxedo[0]++;
|
||||||
|
if (vo.isStatus())
|
||||||
|
adapter.tuxedo[1]++;
|
||||||
|
else
|
||||||
|
adapter.tuxedo[2]++;
|
||||||
|
} else if (("IMQ").equals(gvo.getType())) {
|
||||||
|
adapter.mq[0]++;
|
||||||
|
if (vo.isStatus())
|
||||||
|
adapter.mq[1]++;
|
||||||
|
else
|
||||||
|
adapter.mq[2]++;
|
||||||
|
} else if (("HTT").equals(gvo.getType()) || ("RST").equals(gvo.getType())) {
|
||||||
|
adapter.http[0]++;
|
||||||
|
if (vo.isStatus())
|
||||||
|
adapter.http[1]++;
|
||||||
|
else
|
||||||
|
adapter.http[2]++;
|
||||||
|
} else if (("EJB").equals(gvo.getType())) {
|
||||||
|
adapter.ejb[0]++;
|
||||||
|
if (vo.isStatus())
|
||||||
|
adapter.ejb[1]++;
|
||||||
|
else
|
||||||
|
adapter.ejb[2]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end of for(j)
|
||||||
|
|
||||||
|
} // end of for(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkAdapter(AdaptersVO adapter) {
|
||||||
|
|
||||||
|
if ((adapter.sna[0] == 0) || (adapter.sna[1] == 0))
|
||||||
|
adapter.sna[3] = 0;
|
||||||
|
else if ((adapter.sna[2] == 0))
|
||||||
|
adapter.sna[3] = 2;
|
||||||
|
else if ((adapter.sna[2] > 0))
|
||||||
|
adapter.sna[3] = 1;
|
||||||
|
|
||||||
|
// SOCKET
|
||||||
|
if ((adapter.socket[0] == 0) || (adapter.socket[1] == 0))
|
||||||
|
adapter.socket[3] = 0;
|
||||||
|
else if ((adapter.socket[2] == 0))
|
||||||
|
adapter.socket[3] = 2;
|
||||||
|
else if ((adapter.socket[2] > 0))
|
||||||
|
adapter.socket[3] = 1;
|
||||||
|
|
||||||
|
// SOCKET2
|
||||||
|
if ((adapter.socket2[0] == 0) || (adapter.socket2[1] == 0))
|
||||||
|
adapter.socket2[3] = 0;
|
||||||
|
else if ((adapter.socket2[2] == 0))
|
||||||
|
adapter.socket2[3] = 2;
|
||||||
|
else if ((adapter.socket2[2] > 0))
|
||||||
|
adapter.socket2[3] = 1;
|
||||||
|
|
||||||
|
// TUXEDO
|
||||||
|
if ((adapter.tuxedo[0] == 0) || (adapter.tuxedo[1] == 0))
|
||||||
|
adapter.tuxedo[3] = 0;
|
||||||
|
else if ((adapter.tuxedo[2] == 0))
|
||||||
|
adapter.tuxedo[3] = 2;
|
||||||
|
else if ((adapter.tuxedo[2] > 0))
|
||||||
|
adapter.tuxedo[3] = 1;
|
||||||
|
|
||||||
|
// MQseries
|
||||||
|
if ((adapter.mq[0] == 0) || (adapter.mq[1] == 0))
|
||||||
|
adapter.mq[3] = 0;
|
||||||
|
else if ((adapter.mq[2] == 0))
|
||||||
|
adapter.mq[3] = 2;
|
||||||
|
else if ((adapter.mq[2] > 0))
|
||||||
|
adapter.mq[3] = 1;
|
||||||
|
|
||||||
|
// HTTP
|
||||||
|
if ((adapter.http[0] == 0) || (adapter.http[1] == 0))
|
||||||
|
adapter.http[3] = 0;
|
||||||
|
else if ((adapter.http[2] == 0))
|
||||||
|
adapter.http[3] = 2;
|
||||||
|
else if ((adapter.http[2] > 0))
|
||||||
|
adapter.http[3] = 1;
|
||||||
|
|
||||||
|
// EJB
|
||||||
|
if ((adapter.ejb[0] == 0) || (adapter.ejb[1] == 0))
|
||||||
|
adapter.ejb[3] = 0;
|
||||||
|
else if ((adapter.ejb[2] == 0))
|
||||||
|
adapter.ejb[3] = 2;
|
||||||
|
else if ((adapter.ejb[2] > 0))
|
||||||
|
adapter.ejb[3] = 1;
|
||||||
|
|
||||||
|
// TOTAL
|
||||||
|
// 1. 에러가 포함되었으면 => 에러
|
||||||
|
// 2. 부분정상 이 포함되었으면 => 부분정상
|
||||||
|
// 3. 전체 정상 이면 => 전체정상
|
||||||
|
if (adapter.sna[3] == 0 || adapter.socket[3] == 0
|
||||||
|
|| adapter.socket2[3] == 0 || adapter.tuxedo[3] == 0
|
||||||
|
|| adapter.mq[3] == 0 || adapter.http[3] == 0
|
||||||
|
|| adapter.ejb[3] == 0) {
|
||||||
|
adapter.total[3] = 0;
|
||||||
|
} else if (adapter.sna[3] == 1 || adapter.socket[3] == 1
|
||||||
|
|| adapter.socket2[3] == 1 || adapter.tuxedo[3] == 1
|
||||||
|
|| adapter.mq[3] == 1 || adapter.http[3] == 1
|
||||||
|
|| adapter.ejb[3] == 1) {
|
||||||
|
adapter.total[3] = 1;
|
||||||
|
} else {
|
||||||
|
adapter.total[3] = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------
|
||||||
|
// 등록된 어댑터가 없는 경우 3으로 설정
|
||||||
|
//--------------------------------------
|
||||||
|
if(adapter.sna [0] == 0 ) adapter.sna[3] = 3 ;
|
||||||
|
if(adapter.socket [0] == 0 ) adapter.socket[3] = 3 ;
|
||||||
|
if(adapter.socket2 [0] == 0 ) adapter.socket2[3] = 3 ;
|
||||||
|
if(adapter.mq [0] == 0 ) adapter.mq[3] = 3 ;
|
||||||
|
if(adapter.http [0] == 0 ) adapter.http[3] = 3 ;
|
||||||
|
if(adapter.ejb [0] == 0 ) adapter.ejb[3] = 3 ;
|
||||||
|
if(adapter.tuxedo [0] == 0 ) adapter.tuxedo[3] = 3 ;
|
||||||
|
//--------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// private HashMap getDisabledAdapterList() throws Exception {
|
||||||
|
// Connection conn = null;
|
||||||
|
// Statement stmt = null;
|
||||||
|
// ResultSet rs = null;
|
||||||
|
// HashMap<String,String> disabledMap = new HashMap<String,String>();
|
||||||
|
//
|
||||||
|
// StringBuffer sb_sql = new StringBuffer();
|
||||||
|
//
|
||||||
|
// sb_sql.append(" select AdptrBzwkGroupName, EAISevrDstcd \n");
|
||||||
|
// sb_sql.append(" from "+ Keys.TABLE_OWNER + "TSEAIAD01 \n");
|
||||||
|
// sb_sql.append(" where EAISevrDstcd IN ( '6', '7', '8', '9' ) \n");
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// conn = getConnection();
|
||||||
|
// stmt = conn.createStatement();
|
||||||
|
// stmt.execute(sb_sql.toString());
|
||||||
|
// rs = stmt.getResultSet();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// while(rs.next()) {
|
||||||
|
// disabledMap.put(rs.getString(1),rs.getString(2));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return disabledMap;
|
||||||
|
// }
|
||||||
|
// catch(Exception e) {
|
||||||
|
// logger.error(e);
|
||||||
|
// throw e;
|
||||||
|
// }
|
||||||
|
// finally {
|
||||||
|
// try {
|
||||||
|
// if(rs != null) rs.close();
|
||||||
|
// if(stmt != null) stmt.close();
|
||||||
|
// if(conn != null) conn.close();
|
||||||
|
// }
|
||||||
|
// catch (SQLException sqle) {
|
||||||
|
// logger.error("SQLException was thrown: " + sqle.getMessage(),sqle);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// Calendar cal = Calendar.getInstance();
|
||||||
|
// int weekCount = cal.get(Calendar.DAY_OF_WEEK);
|
||||||
|
// String timeCtnt = String.format("%02d",cal.get(Calendar.HOUR_OF_DAY))
|
||||||
|
// + String.format("%02d", cal.get(Calendar.MINUTE));
|
||||||
|
//
|
||||||
|
// String timeCtnt2 = String.valueOf(cal.get(Calendar.HOUR_OF_DAY)) + String.valueOf(cal.get(Calendar.MINUTE));
|
||||||
|
//
|
||||||
|
// System.out.println(weekCount);
|
||||||
|
// System.out.println(timeCtnt);
|
||||||
|
// System.out.println(timeCtnt2);
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.eactive.eai.rms.client.agent;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import com.eactive.eai.adapter.AdapterGroupVO;
|
||||||
|
import com.eactive.eai.adapter.AdapterManager;
|
||||||
|
import com.eactive.eai.rms.client.SocketClient;
|
||||||
|
import com.eactive.eai.rms.onl.vo.AdaptersStatusVO;
|
||||||
|
|
||||||
|
public class AdaptersStatusAgent extends AbstractScheduledAgent {
|
||||||
|
|
||||||
|
private SocketClient socketClient;
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
AdaptersStatusVO adaptersStatusVO = (AdaptersStatusVO) applicationContext.getBean("adaptersStatusVO");
|
||||||
|
setAdapters(adaptersStatusVO);
|
||||||
|
socketClient.send(adaptersStatusVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSocketClient(SocketClient socketClient) {
|
||||||
|
this.socketClient = socketClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdaptersStatusVO getAdapterStatusInfo() {
|
||||||
|
AdaptersStatusVO adaptersStatusVO = new AdaptersStatusVO();
|
||||||
|
setAdapters(adaptersStatusVO);
|
||||||
|
return adaptersStatusVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdapters(AdaptersStatusVO adapterStatus) {
|
||||||
|
AdapterManager manager = AdapterManager.getInstance();
|
||||||
|
HashMap<String, AdapterGroupVO> voMap = manager.getAllAdapterGroupVO();
|
||||||
|
|
||||||
|
Iterator<String> it = voMap.keySet().iterator();
|
||||||
|
|
||||||
|
String[] groupNames = new String[voMap.size()];
|
||||||
|
|
||||||
|
for (int i = 0; it.hasNext(); i++) {
|
||||||
|
groupNames[i] = it.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
Arrays.sort(groupNames);
|
||||||
|
|
||||||
|
for (int i = 0; i < groupNames.length; i++) {
|
||||||
|
AdapterGroupVO gvo = manager.getAdapterGroupVO(groupNames[i]);
|
||||||
|
adapterStatus.setAdapter(groupNames[i], gvo.isAlive());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package com.eactive.eai.rms.client.agent;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.client.SocketClient;
|
||||||
|
import com.eactive.eai.rms.client.context.RmsProperties;
|
||||||
|
import com.eactive.eai.rms.client.service.EaiEngineStatusService;
|
||||||
|
import com.eactive.eai.rms.client.service.HostStatusService;
|
||||||
|
import com.eactive.eai.rms.onl.vo.EAIEngineStatusVo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class EaiEngineStatusAgent.
|
||||||
|
* <ul>
|
||||||
|
* <li>1. Function : Eai Engine의 상태정보를 수집 하는 agent</li>
|
||||||
|
* <li>2. Summary :</li>
|
||||||
|
* <li>3. Notification :</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @author : $Author: 박기섭 $
|
||||||
|
* @version : $Revision: 1.2 $
|
||||||
|
*/
|
||||||
|
public class EaiEngineStatusAgent extends AbstractScheduledAgent {
|
||||||
|
|
||||||
|
private EaiEngineStatusService eaiEngineSingleStatusService;
|
||||||
|
private SocketClient socketClient;
|
||||||
|
private HostStatusService hostStatusService;
|
||||||
|
private RmsProperties rmsProperties;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.lang.Runnable#run()
|
||||||
|
*/
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
EAIEngineStatusVo vo = eaiEngineSingleStatusService.getEAIEngineStatus();
|
||||||
|
|
||||||
|
String path = rmsProperties.getStringProperty(RmsProperties.JMS_DISK_SPACE_PATH);
|
||||||
|
|
||||||
|
int percentage = hostStatusService.getDiskPercentage(path);
|
||||||
|
|
||||||
|
vo.setJmsFileStoreUseAge(percentage);
|
||||||
|
|
||||||
|
socketClient.send(vo);
|
||||||
|
logger.debug("SEND EaiEngineStatusAgent : " + vo );
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.getMessage(),e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEaiEngineSingleStatusService(
|
||||||
|
EaiEngineStatusService eaiEngineSingleStatusService) {
|
||||||
|
this.eaiEngineSingleStatusService = eaiEngineSingleStatusService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSocketClient(SocketClient socketClient) {
|
||||||
|
this.socketClient = socketClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHostStatusService(HostStatusService hostStatusService) {
|
||||||
|
this.hostStatusService = hostStatusService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRmsProperties(RmsProperties rmsProperties) {
|
||||||
|
this.rmsProperties = rmsProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.eactive.eai.rms.client.agent;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.client.SocketClient;
|
||||||
|
import com.eactive.eai.rms.client.context.RmsProperties;
|
||||||
|
import com.eactive.eai.rms.client.service.HostStatusService;
|
||||||
|
import com.eactive.eai.rms.onl.vo.HostStatusVo;
|
||||||
|
|
||||||
|
public class HostStatusAgent extends AbstractScheduledAgent {
|
||||||
|
|
||||||
|
private HostStatusService hostStatusService;
|
||||||
|
private RmsProperties rmsProperties;
|
||||||
|
private SocketClient socketClient;
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
String path = rmsProperties.getStringProperty(RmsProperties.DISK_SPACE_PATH, "/fseai");
|
||||||
|
|
||||||
|
HostStatusVo hostStatusVo = (HostStatusVo) applicationContext.getBean("hostStatusVo");
|
||||||
|
|
||||||
|
hostStatusVo.setCpu(hostStatusService.getCpuPercentage());
|
||||||
|
hostStatusVo.setMemory(hostStatusService.getMemoryPercentage());
|
||||||
|
hostStatusVo.setDisk(hostStatusService.getDiskPercentage(path));
|
||||||
|
|
||||||
|
socketClient.send(hostStatusVo);
|
||||||
|
logger.debug("SEND HostStatusAgent : " + hostStatusVo );
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHostStatusService(HostStatusService hostStatusService) {
|
||||||
|
this.hostStatusService = hostStatusService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRmsProperties(RmsProperties rmsProperties) {
|
||||||
|
this.rmsProperties = rmsProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSocketClient(SocketClient socketClient) {
|
||||||
|
this.socketClient = socketClient;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
package com.eactive.eai.rms.client.agent;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.client.SocketClient;
|
||||||
|
import com.eactive.eai.rms.client.context.RmsProperties;
|
||||||
|
import com.eactive.eai.rms.client.service.HostStatusService;
|
||||||
|
import com.eactive.eai.rms.onl.vo.HostStatusVo;
|
||||||
|
import com.eactive.eai.rms.onl.vo.ItsmVo;
|
||||||
|
|
||||||
|
public class ItsmMonitorAgent extends AbstractScheduledAgent {
|
||||||
|
|
||||||
|
private HostStatusService hostStatusService;
|
||||||
|
private RmsProperties rmsProperties;
|
||||||
|
private SocketClient socketClient;
|
||||||
|
|
||||||
|
private HostStatusVo hostStatusVo;
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
// ITSM 에 전송하기 위해 추가로 수집해야 할 리소스
|
||||||
|
// Network I/O, Disk swap
|
||||||
|
|
||||||
|
// ItsmVo itsmVo = (ItsmVo) applicationContext.getBean("itsmVo");
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// String cmd = rmsProperties.getStringProperty(
|
||||||
|
// RmsProperties.ITSM_NET_CMD, "/fsapp/eai/rms_util/nettot");
|
||||||
|
// String tmp[] = hostStatusService.getInOutBps(cmd).split(",");
|
||||||
|
// if (logger.isDebugEnabled()) {
|
||||||
|
// if (tmp == null || "".equals(tmp)) {
|
||||||
|
// logger.debug("hostStatusService.getInOutBps() returned null");
|
||||||
|
// } else {
|
||||||
|
// for (int i = 0; i < tmp.length; i++) {
|
||||||
|
// logger.debug(tmp[i]);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (tmp.length >= 2) {
|
||||||
|
// itsmVo.setIn(tmp[0]);
|
||||||
|
// itsmVo.setOut(tmp[1]);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// cmd = rmsProperties.getStringProperty(RmsProperties.ITSM_DISK_CMD,
|
||||||
|
// "/fsapp/eai/rms_util/disktot");
|
||||||
|
// String tmp2 = hostStatusService.getSwapUsage(cmd);
|
||||||
|
// if (logger.isDebugEnabled()) {
|
||||||
|
// if (tmp2 == null || "".equals(tmp2)) {
|
||||||
|
// logger.debug("hostStatusService.getSwapSize() returned null");
|
||||||
|
// } else {
|
||||||
|
// logger.debug(cmd + " : result=" + tmp2);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (tmp2 != null && !tmp2.equals("")) {
|
||||||
|
// itsmVo.setSwap(tmp2); // 실제는 디스크 SWAP 사용율 이다. ( usage % )
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// itsmVo.setTime(null); // use default
|
||||||
|
//
|
||||||
|
// itsmVo.setCpu("" + hostStatusVo.getCpu());
|
||||||
|
// itsmVo.setDisk("" + hostStatusVo.getDisk());
|
||||||
|
// itsmVo.setMemory("" + hostStatusVo.getMemory());
|
||||||
|
//
|
||||||
|
// socketClient.send(itsmVo);
|
||||||
|
// logger.debug("SEND ItsmMonitorAgent : " + itsmVo );
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// //e.printStackTrace();
|
||||||
|
// logger.error("RMS : (rms_client) Exception !!!",e);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (logger.isDebugEnabled()) {
|
||||||
|
// logger.debug(itsmVo.toString());
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param hostStatusService the hostStatusService to set
|
||||||
|
*/
|
||||||
|
public void setHostStatusService(HostStatusService hostStatusService) {
|
||||||
|
this.hostStatusService = hostStatusService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param rmsProperties the rmsProperties to set
|
||||||
|
*/
|
||||||
|
public void setRmsProperties(RmsProperties rmsProperties) {
|
||||||
|
this.rmsProperties = rmsProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param socketClient the socketClient to set
|
||||||
|
*/
|
||||||
|
public void setSocketClient(SocketClient socketClient) {
|
||||||
|
this.socketClient = socketClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param hostStatusVo the hostStatusVo to set
|
||||||
|
*/
|
||||||
|
public void setHostStatusVo(HostStatusVo hostStatusVo) {
|
||||||
|
this.hostStatusVo = hostStatusVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package com.eactive.eai.rms.client.agent;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.client.context.RmsProperties;
|
||||||
|
import com.eactive.eai.rms.client.service.HostStatusService;
|
||||||
|
import com.eactive.eai.rms.onl.vo.EAIEngineStatusVo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class JmsFileStoreAgent.
|
||||||
|
* <ul>
|
||||||
|
* <li>1. Function :</li>
|
||||||
|
* <li>2. Summary :</li>
|
||||||
|
* <li>3. Notification :</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @author : $Author:
|
||||||
|
* @version : $Revision: 1.4 $
|
||||||
|
*/
|
||||||
|
public class JmsFileStoreAgent extends AbstractScheduledAgent {
|
||||||
|
|
||||||
|
/** The host status service. */
|
||||||
|
private HostStatusService hostStatusService;
|
||||||
|
|
||||||
|
/** The rms properties. */
|
||||||
|
private RmsProperties rmsProperties;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.lang.Runnable#run()
|
||||||
|
*/
|
||||||
|
public void run() {
|
||||||
|
try {String osName = System.getProperty("os.name", "");
|
||||||
|
if(StringUtils.contains(osName.toLowerCase(), "win")) {
|
||||||
|
logger.debug("OS "+osName+ " is skip to check status");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EAIEngineStatusVo vo = (EAIEngineStatusVo) applicationContext.getBean("eaiEngineStatusVo");
|
||||||
|
|
||||||
|
String path = rmsProperties.getStringProperty(RmsProperties.JMS_DISK_SPACE_PATH);
|
||||||
|
|
||||||
|
int percentage = hostStatusService.getDiskPercentage(path);
|
||||||
|
|
||||||
|
vo.setJmsFileStoreUseAge(percentage);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the host status service.
|
||||||
|
*
|
||||||
|
* @param hostStatusService the new host status service
|
||||||
|
*/
|
||||||
|
public void setHostStatusService(HostStatusService hostStatusService) {
|
||||||
|
this.hostStatusService = hostStatusService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the rms properties.
|
||||||
|
*
|
||||||
|
* @param rmsProperties the new rms properties
|
||||||
|
*/
|
||||||
|
public void setRmsProperties(RmsProperties rmsProperties) {
|
||||||
|
this.rmsProperties = rmsProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package com.eactive.eai.rms.client.agent;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import com.eactive.eai.common.util.ContainerUtil;
|
||||||
|
import com.eactive.eai.env.ElinkConfig;
|
||||||
|
import com.eactive.eai.rms.client.SocketClient;
|
||||||
|
import com.eactive.eai.rms.client.context.RmsProperties;
|
||||||
|
import com.eactive.eai.rms.client.service.JMXMonitoring;
|
||||||
|
import com.eactive.eai.rms.client.service.JMXMonitoringFactory;
|
||||||
|
//import com.eactive.eai.rms.client.service.SingleQueueMonitoring;
|
||||||
|
//import com.eactive.eai.rms.client.service.SingleServerMonitoring;
|
||||||
|
import com.eactive.eai.rms.onl.vo.JmsMonitorVo;
|
||||||
|
|
||||||
|
public class JmsQueueAgent extends AbstractScheduledAgent {
|
||||||
|
|
||||||
|
/** The socket client. */
|
||||||
|
private SocketClient socketClient = null;
|
||||||
|
|
||||||
|
/** The RMS Properties */
|
||||||
|
private RmsProperties rmsProperties;
|
||||||
|
|
||||||
|
private Properties adminClientProperties;
|
||||||
|
|
||||||
|
public void setAdminClientProperties(Properties adminClientProperties) {
|
||||||
|
this.adminClientProperties = adminClientProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void run() {
|
||||||
|
logger.debug("JmsQueueAgent ");
|
||||||
|
JmsMonitorVo vo = null ;
|
||||||
|
try {
|
||||||
|
vo = (JmsMonitorVo) applicationContext.getBean("jmsMonitorVo");
|
||||||
|
if( vo == null ) {
|
||||||
|
logger.error("JmsQueueAgent - Can't get bean => jmsMonitorVo");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
HashMap map = getLocalQueueInfo();
|
||||||
|
if( map != null && !map.isEmpty() ) {
|
||||||
|
Iterator it = map.keySet().iterator();
|
||||||
|
while( it.hasNext() ) {
|
||||||
|
String name = (String)it.next();
|
||||||
|
String info[] = (String[])map.get(name);
|
||||||
|
|
||||||
|
if(logger.isDebug()) logger.debug("JmsQueueAgent - Queue Name => "+name);
|
||||||
|
|
||||||
|
vo.setUdpQueueName( name );
|
||||||
|
vo.setUdpInfo( info );
|
||||||
|
|
||||||
|
socketClient.send(vo);
|
||||||
|
logger.debug("SEND JmsQueueAgent : " + vo );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
logger.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap getLocalQueueInfo() throws Exception{
|
||||||
|
|
||||||
|
String instName = rmsProperties.getStringProperty(RmsProperties.EAI_SERVER_INSTANCE_NAME);
|
||||||
|
JMXMonitoring monitoring = JMXMonitoringFactory.createQueueMonitoring(ContainerUtil.get());
|
||||||
|
if (monitoring == null) return new HashMap();
|
||||||
|
monitoring.init(this.adminClientProperties);
|
||||||
|
return (HashMap)monitoring.getState(instName);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
JmsQueueAgent s = new JmsQueueAgent();
|
||||||
|
s.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSocketClient(SocketClient socketClient) {
|
||||||
|
this.socketClient = socketClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRmsProperties(RmsProperties rmsProperties) {
|
||||||
|
this.rmsProperties = rmsProperties;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,176 @@
|
|||||||
|
package com.eactive.eai.rms.client.agent;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.RandomAccessFile;
|
||||||
|
import java.nio.channels.FileChannel;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.client.SocketClient;
|
||||||
|
import com.eactive.eai.rms.client.context.RmsProperties;
|
||||||
|
import com.eactive.eai.rms.onl.vo.SmsVO;
|
||||||
|
|
||||||
|
import org.apache.mina.common.ByteBuffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class SmsAgent.
|
||||||
|
* <ul>
|
||||||
|
* <li>1. Function : SMS내용을 정해진 주기 마다 RMS 서버로 전송 합니다. </li>
|
||||||
|
* <li>2. Summary :</li>
|
||||||
|
* <li>3. Notification :</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @author : $Author: 윤창용 $
|
||||||
|
* @version : $Revision: 1.8 $
|
||||||
|
*/
|
||||||
|
public class SmsAgent extends AbstractScheduledAgent {
|
||||||
|
|
||||||
|
private SocketClient socketClient = null;
|
||||||
|
private RmsProperties rmsProperties;
|
||||||
|
/**
|
||||||
|
* sms log data format
|
||||||
|
* 월일 시간[건수]인스턴스 메시지
|
||||||
|
* 1103 13:56:58.715[1]mcc11 HTTP호출에러|MUTMIAS00000170S1
|
||||||
|
*/
|
||||||
|
public void run() {
|
||||||
|
File logFile = null;
|
||||||
|
RandomAccessFile raf = null;
|
||||||
|
FileChannel fileChannel = null;
|
||||||
|
ByteBuffer buffer = null;
|
||||||
|
SmsVO smsVO = null;
|
||||||
|
try {
|
||||||
|
int maxLine = rmsProperties.getIntProperty(
|
||||||
|
RmsProperties.SMS_AGENT_MAXLINE, 1);
|
||||||
|
|
||||||
|
String DEFAULT_LOG_PATH = rmsProperties.getStringProperty(
|
||||||
|
RmsProperties.DEFAULT_LOG_PATH, "/fslog/eai/");
|
||||||
|
String instanceName = rmsProperties
|
||||||
|
.getStringProperty(RmsProperties.EAI_SERVER_INSTANCE_NAME);
|
||||||
|
String SMS_LOG_FILE = rmsProperties.getStringProperty(RmsProperties.SMS_LOG_FILE, "sms.log");
|
||||||
|
String SMS_LOG_FILE_ENCODING = rmsProperties.getStringProperty(RmsProperties.SMS_LOG_FILE_ENCODE, "UTF-8");
|
||||||
|
|
||||||
|
int bufferSize = maxLine * 100;
|
||||||
|
|
||||||
|
// 마지막 5라인만 보낸다.
|
||||||
|
logFile = new File(DEFAULT_LOG_PATH + instanceName + "/"
|
||||||
|
+ SMS_LOG_FILE);
|
||||||
|
raf = new RandomAccessFile(logFile, "r");
|
||||||
|
fileChannel = raf.getChannel();
|
||||||
|
buffer = ByteBuffer.allocate(bufferSize);
|
||||||
|
|
||||||
|
if (raf.length() <= bufferSize) {
|
||||||
|
// bufferSize 바이트 보다 작으면
|
||||||
|
fileChannel.read(buffer.buf());
|
||||||
|
} else {
|
||||||
|
// bufferSize 바이트 보다 크면 뒤에서 부터 bufferSize 바이트만 읽는다.
|
||||||
|
fileChannel.read(buffer.buf(), raf.length() - bufferSize);
|
||||||
|
buffer.flip();
|
||||||
|
String searchString = System.getProperty("line.separator");
|
||||||
|
int position = findStringPosition(buffer, searchString, SMS_LOG_FILE_ENCODING);
|
||||||
|
if (position != -1) {
|
||||||
|
buffer.position(position + searchString.length() );
|
||||||
|
buffer.compact();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer.flip();
|
||||||
|
|
||||||
|
//String text = buffer.getString(Charset.defaultCharset().newDecoder());
|
||||||
|
String text = buffer.getString(Charset.forName(SMS_LOG_FILE_ENCODING).newDecoder());
|
||||||
|
|
||||||
|
String[] texts = text.split(System.lineSeparator());
|
||||||
|
|
||||||
|
smsVO = (SmsVO) applicationContext.getBean("smsVo");
|
||||||
|
LinkedList<String> list = new LinkedList<String>();
|
||||||
|
|
||||||
|
int currentLine = 0;
|
||||||
|
for (int i = texts.length - 1; i >= 0 && currentLine < maxLine; i--) {
|
||||||
|
currentLine++;
|
||||||
|
if (logger.isDebugEnabled()) {
|
||||||
|
logger.debug(texts[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (texts[i] != null && !texts[i].startsWith("[")) {
|
||||||
|
list.addLast(texts[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
smsVO.setMessage(list);
|
||||||
|
|
||||||
|
socketClient.send(smsVO);
|
||||||
|
logger.debug("SEND SmsAgent : " + smsVO );
|
||||||
|
|
||||||
|
} catch (FileNotFoundException fe) {
|
||||||
|
sendFileNotFoundMessage(logFile);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("SMS 메세지를 수집 하는 중 에러가 발생 하였습니다. ", e);
|
||||||
|
} finally {
|
||||||
|
if (buffer != null) {
|
||||||
|
buffer.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileChannel != null) {
|
||||||
|
try {
|
||||||
|
fileChannel.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (raf != null) {
|
||||||
|
try {
|
||||||
|
raf.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendFileNotFoundMessage(File logFile) {
|
||||||
|
try {
|
||||||
|
// 0702 00:00:08.371
|
||||||
|
SmsVO smsVO = (SmsVO) applicationContext.getBean("smsVo");
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("MMdd HH:mm:ss.SSS");
|
||||||
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
|
list.add(format.format(new Date()) + "SMS 로그 파일을 찾을 수 없습니다 : "
|
||||||
|
+ logFile.getPath());
|
||||||
|
smsVO.setMessage(list);
|
||||||
|
socketClient.send(smsVO);
|
||||||
|
} catch (Exception e) {
|
||||||
|
//e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
SmsAgent s = new SmsAgent();
|
||||||
|
s.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSocketClient(SocketClient socketClient) {
|
||||||
|
this.socketClient = socketClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRmsProperties(RmsProperties rmsProperties) {
|
||||||
|
this.rmsProperties = rmsProperties;
|
||||||
|
}
|
||||||
|
private int findStringPosition(ByteBuffer buffer, String searchString, String encoding) {
|
||||||
|
byte[] searchBytes = searchString.getBytes(Charset.forName(encoding));
|
||||||
|
for (int i = 0; i < buffer.remaining(); i++) {
|
||||||
|
boolean found = true;
|
||||||
|
for (int j = 0; j < searchBytes.length; j++) {
|
||||||
|
if (buffer.get(i + j) != searchBytes[j]) {
|
||||||
|
found = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (found) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
package com.eactive.eai.rms.client.agent;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
import com.eactive.eai.common.monitor.EAIServiceMonitor;
|
||||||
|
import com.eactive.eai.common.monitor.MonitorVO;
|
||||||
|
import com.eactive.eai.rms.client.SocketClient;
|
||||||
|
import com.eactive.eai.rms.onl.vo.TransactionSendVo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class TransactionTrackingAgent.
|
||||||
|
* <ul>
|
||||||
|
* <li>1. Function :</li>
|
||||||
|
* <li>2. Summary :</li>
|
||||||
|
* <li>3. Notification :</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @author : $Author: amjang $
|
||||||
|
* @version : $Revision: 1.4 $
|
||||||
|
*/
|
||||||
|
public class TransactionTrackingAgent extends AbstractScheduledAgent {
|
||||||
|
|
||||||
|
/** The socket client. */
|
||||||
|
private SocketClient socketClient;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.lang.Runnable#run()
|
||||||
|
*/
|
||||||
|
public void run() {
|
||||||
|
EAIServiceMonitor monitor = EAIServiceMonitor.getInstance();
|
||||||
|
sendTransactionOriginData( monitor );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param monitor F/W 의 모니터링 정보
|
||||||
|
*/
|
||||||
|
private void sendTransactionOriginData( EAIServiceMonitor monitor ) {
|
||||||
|
try {
|
||||||
|
// 2010.01.25 YUN -
|
||||||
|
// 만일 오늘 날짜와 모니터링 날짜가 다르면 (거래건수 초기화 수행중 )
|
||||||
|
// 데이터를 전송하지 않는다.
|
||||||
|
// 주의 : Framework.jar 파일의 버전에 추가된 함수를 사용하므로, 함께 배포되어야 한다.
|
||||||
|
DateFormat df = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
TimeZone tz = TimeZone.getTimeZone("Asia/Seoul");
|
||||||
|
df.setTimeZone(tz);
|
||||||
|
|
||||||
|
String today = df.format(new Date());
|
||||||
|
String monDate = monitor.getMonitorDate();
|
||||||
|
if( ! today.equals(monDate) ) {
|
||||||
|
logger.debug("DEBUG_sendTransactionOriginData_today | monDate : " + today + "|" + monDate);
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
TransactionSendVo sendVo = (TransactionSendVo) applicationContext.getBean("transactionSendVo");
|
||||||
|
|
||||||
|
String allBwkClsKey[] = monitor.getAllBwkClsKey();
|
||||||
|
if(allBwkClsKey == null) {
|
||||||
|
logger.debug("DEBUG_sendTransactionOriginData_allBwkClsKey_isNull");
|
||||||
|
return; // 2011.02.27 가비지에 의한 에러처리
|
||||||
|
}
|
||||||
|
for (int bwkClsCount = 0; bwkClsCount < allBwkClsKey.length; bwkClsCount++) {
|
||||||
|
// 서비스 코드별 vo 맵
|
||||||
|
HashMap<String, MonitorVO> voByBwk = monitor.getBwkCls(allBwkClsKey[bwkClsCount]);
|
||||||
|
if(voByBwk == null) logger.debug("DEBUG_sendTransactionOriginData_voByBwk_isNull");
|
||||||
|
if (voByBwk != null) {
|
||||||
|
for( MonitorVO vo : voByBwk.values() ) {
|
||||||
|
if(vo == null) {
|
||||||
|
logger.debug("DEBUG_sendTransactionOriginData_MonitorVO_isNull");
|
||||||
|
continue; // 2011.02.27 가비지에 의한 에러처리
|
||||||
|
}
|
||||||
|
|
||||||
|
sendVo.setCmd("DATA");
|
||||||
|
sendVo.setKey1(allBwkClsKey[bwkClsCount]);
|
||||||
|
sendVo.setKey2(vo.getEaiServiceCode());
|
||||||
|
sendVo.setVo( vo );
|
||||||
|
socketClient.send( sendVo );
|
||||||
|
|
||||||
|
if( logger.isDebugEnabled() ) {
|
||||||
|
logger.debug( "RMS SEND NEW TRANSACTION(" + sendVo.getCmd() + ":key1=" + sendVo.getKey1() + ", key2=" + sendVo.getKey2());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 분할된 데이터 전송이 끝났음을 RMS 서버에 알린다.
|
||||||
|
if( logger.isDebugEnabled() ) {
|
||||||
|
logger.debug( "RMS SEND NEW TRANSACTION(END)" );
|
||||||
|
}
|
||||||
|
|
||||||
|
// cmd 객체에 모니터링 날짜를 담아서 보낸다.
|
||||||
|
sendVo.setKey1(monDate);
|
||||||
|
sendVo.setCmd("END");
|
||||||
|
socketClient.send( sendVo );
|
||||||
|
|
||||||
|
logger.debug("SEND TransactionTrackingAgent : " + sendVo );
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("DEBUG_sendTransactionOriginData_Exception",e);
|
||||||
|
//e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the socket client.
|
||||||
|
*
|
||||||
|
* @param socketClient the new socket client
|
||||||
|
*/
|
||||||
|
public void setSocketClient(SocketClient socketClient) {
|
||||||
|
this.socketClient = socketClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
package com.eactive.eai.rms.client.common;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.client.SocketClient;
|
||||||
|
import com.eactive.eai.rms.client.context.RmsProperties;
|
||||||
|
import com.eactive.eai.rms.onl.vo.MonitorDataVo;
|
||||||
|
|
||||||
|
import org.apache.mina.common.IoConnector;
|
||||||
|
import org.apache.mina.common.IoConnectorConfig;
|
||||||
|
import org.apache.mina.common.IoHandler;
|
||||||
|
import org.apache.mina.common.IoSession;
|
||||||
|
import org.apache.mina.common.ThreadModel;
|
||||||
|
import org.apache.mina.filter.codec.ProtocolCodecFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class AbstractSocketClient.
|
||||||
|
* <ul>
|
||||||
|
* <li>1. Function :</li>
|
||||||
|
* <li>2. Summary :</li>
|
||||||
|
* <li>3. Notification :</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @author : $Author:
|
||||||
|
* @version : $Revision: 1.2 $
|
||||||
|
*/
|
||||||
|
public abstract class AbstractSocketClient implements SocketClient {
|
||||||
|
|
||||||
|
/** The Constant connector. */
|
||||||
|
protected IoConnector connector;
|
||||||
|
|
||||||
|
/** The datagram connector config. */
|
||||||
|
protected IoConnectorConfig connectorConfig;
|
||||||
|
|
||||||
|
/** The protocol codec factory. */
|
||||||
|
protected ProtocolCodecFactory protocolCodecFactory;
|
||||||
|
|
||||||
|
/** The handler. */
|
||||||
|
protected IoHandler handler;
|
||||||
|
|
||||||
|
/** The session. */
|
||||||
|
protected IoSession session;
|
||||||
|
|
||||||
|
/** The monitoring context. */
|
||||||
|
protected RmsProperties rmsProperties;
|
||||||
|
|
||||||
|
/** The thread model. */
|
||||||
|
protected ThreadModel threadModel;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.eactive.eai.rms.client.SocketClient#send(com.eactive.eai.rms.vo.MonitorDataVo)
|
||||||
|
*/
|
||||||
|
public abstract void send(MonitorDataVo serializable);
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.eactive.eai.rms.client.SocketClient#destroy()
|
||||||
|
*/
|
||||||
|
public abstract void destroy();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the protocol codec factory.
|
||||||
|
*
|
||||||
|
* @param protocolCodecFactory the new protocol codec factory
|
||||||
|
*/
|
||||||
|
public void setProtocolCodecFactory(
|
||||||
|
ProtocolCodecFactory protocolCodecFactory) {
|
||||||
|
this.protocolCodecFactory = protocolCodecFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the handler.
|
||||||
|
*
|
||||||
|
* @param handler the new handler
|
||||||
|
*/
|
||||||
|
public void setHandler(IoHandler handler) {
|
||||||
|
this.handler = handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the rms properties.
|
||||||
|
*
|
||||||
|
* @param rmsProperties the new rms properties
|
||||||
|
*/
|
||||||
|
public void setRmsProperties(RmsProperties rmsProperties) {
|
||||||
|
this.rmsProperties = rmsProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the thread model.
|
||||||
|
*
|
||||||
|
* @param threadModel the new thread model
|
||||||
|
*/
|
||||||
|
public void setThreadModel(ThreadModel threadModel) {
|
||||||
|
this.threadModel = threadModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.eactive.eai.rms.client.context;
|
||||||
|
|
||||||
|
import com.eactive.eai.common.server.Keys;
|
||||||
|
|
||||||
|
public class MonitoringContextFactory {
|
||||||
|
|
||||||
|
public MonitoringContextFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void create() {
|
||||||
|
String logPathType = System.getProperty(Keys.SERVER_KEY).substring(0,5)+"G";
|
||||||
|
System.setProperty("logPathType", logPathType);
|
||||||
|
RmsContext.getInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void create(String[] config) {
|
||||||
|
String logPathType = System.getProperty(Keys.SERVER_KEY).substring(0,5)+"G";
|
||||||
|
System.setProperty("logPathType", logPathType);
|
||||||
|
RmsContext.getInstance(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stop() {
|
||||||
|
RmsContext.getInstance().close();;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// try {
|
||||||
|
// Class<?> clazz = Class.forName("com.eactive.eai.rms.client.context.MonitoringContextFactory");
|
||||||
|
//
|
||||||
|
// Object factory = clazz.newInstance();
|
||||||
|
// Method method = clazz.getMethod("create");
|
||||||
|
// method.invoke(factory);
|
||||||
|
//
|
||||||
|
// System.out.println("RMS CLIENT 가 실행 되었습니다. !!!!!");
|
||||||
|
// } catch (Throwable e) {
|
||||||
|
// System.out.println("모니터링 에이전트가 실행 되지 않았습니다.!!!! ");
|
||||||
|
// //e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package com.eactive.eai.rms.client.context;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class RmsContext.
|
||||||
|
* <ul>
|
||||||
|
* <li>1. Function :스프링의 {@link org.springframework.context.support.ClassPathXmlApplicationContext}의 확장 클래스 입니다. </li>
|
||||||
|
* <li>2. Summary :</li>
|
||||||
|
* <li>3. Notification :</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @see org.springframework.context.support.ClassPathXmlApplicationContext
|
||||||
|
* @author : $Author: 박기섭 $
|
||||||
|
* @version : $Revision: 1.6 $
|
||||||
|
*/
|
||||||
|
public class RmsContext extends ClassPathXmlApplicationContext {
|
||||||
|
|
||||||
|
/** The Constant CONFIGLOCATIONS. */
|
||||||
|
private static final String[] CONFIGLOCATIONS = { "com/eactive/eai/rms/client/context/applicationContext-agent.xml" };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Constructor.
|
||||||
|
*
|
||||||
|
* @throws BeansException the beans exception
|
||||||
|
*/
|
||||||
|
private RmsContext() throws BeansException {
|
||||||
|
this(CONFIGLOCATIONS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new agent context.
|
||||||
|
*
|
||||||
|
* @param configlocations the configlocations
|
||||||
|
*
|
||||||
|
* @throws BeansException the beans exception
|
||||||
|
*/
|
||||||
|
private RmsContext(String[] configlocations) throws BeansException {
|
||||||
|
super(configlocations);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The ctx. */
|
||||||
|
private static RmsContext ctx = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the single instance of RmsContext.
|
||||||
|
*
|
||||||
|
* @return single instance of RmsContext
|
||||||
|
*/
|
||||||
|
public static RmsContext getInstance() {
|
||||||
|
if (ctx == null) {
|
||||||
|
synchronized (RmsContext.class) {
|
||||||
|
if (ctx == null) {
|
||||||
|
ctx = new RmsContext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the single instance of RmsContext.
|
||||||
|
*
|
||||||
|
* @param configlocations the configlocations
|
||||||
|
*
|
||||||
|
* @return single instance of RmsContext
|
||||||
|
*/
|
||||||
|
public static RmsContext getInstance(String[] configlocations) {
|
||||||
|
if (ctx == null) {
|
||||||
|
synchronized (RmsContext.class) {
|
||||||
|
if (ctx == null) {
|
||||||
|
ctx = new RmsContext(configlocations);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.eactive.eai.rms.client.context;
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
public class RmsEnvProperties {
|
||||||
|
|
||||||
|
/** The properties. */
|
||||||
|
private Properties properties;
|
||||||
|
|
||||||
|
public void init() throws Exception {
|
||||||
|
InetAddress inetAddress = InetAddress.getLocalHost();
|
||||||
|
String serverIp = inetAddress.getHostAddress();
|
||||||
|
this.properties = new Properties();
|
||||||
|
this.properties.setProperty(RmsProperties.LOCAL_HOST_IP, serverIp);
|
||||||
|
if (Boolean.getBoolean("rms.standalone")){
|
||||||
|
this.properties.setProperty(RmsProperties.LOCAL_HOST_NAME, System.getProperty("rms.hostname"));
|
||||||
|
}else{
|
||||||
|
this.properties.setProperty(RmsProperties.LOCAL_HOST_NAME, inetAddress.getHostName());
|
||||||
|
}
|
||||||
|
this.properties.setProperty("standalone", String.valueOf(Boolean.getBoolean("rms.standalone")));
|
||||||
|
this.properties.putAll(System.getProperties());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.eactive.eai.rms.client.context.RmsProperties#getProperties()
|
||||||
|
*/
|
||||||
|
public Properties getProperties() {
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.eactive.eai.rms.client.context.RmsProperties#refresh()
|
||||||
|
*/
|
||||||
|
public void refresh() throws Exception {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.eactive.eai.rms.client.context.RmsProperties#setProperties(java.util.Properties)
|
||||||
|
*/
|
||||||
|
public void setProperties(Properties properties) {
|
||||||
|
this.properties = properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
package com.eactive.eai.rms.client.context;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import com.eactive.eai.common.server.Keys;
|
||||||
|
import com.eactive.eai.rms.client.dao.RmsPropertiesDAO;
|
||||||
|
|
||||||
|
public interface RmsProperties {
|
||||||
|
|
||||||
|
/** The Constant LOCAL_MBEAN_SERVER_ID. */
|
||||||
|
public static final String LOCAL_MBEAN_SERVER_ID = "LOCAL_MBEAN_SERVER_ID";
|
||||||
|
|
||||||
|
/** The Constant LOCAL_MBEAN_SERVER_PASSWORD. */
|
||||||
|
public static final String LOCAL_MBEAN_SERVER_PASSWORD = "LOCAL_MBEAN_SERVER_PASSWORD";
|
||||||
|
|
||||||
|
/** The Constant LOCAL_MBEAN_SERVER_PORT. */
|
||||||
|
public static final String LOCAL_MBEAN_SERVER_PORT = "LOCAL_MBEAN_SERVER_PORT";
|
||||||
|
|
||||||
|
/** The Constant LOCAL_MBEAN_SERVER_PORT. */
|
||||||
|
public static final String LOCAL_MBEAN_SERVER_IP = "LOCAL_MBEAN_SERVER_IP";
|
||||||
|
|
||||||
|
/** The Constant LOCAL_HOST_NAME. */
|
||||||
|
public static final String LOCAL_HOST_NAME = "LOCAL_HOST_NAME";
|
||||||
|
|
||||||
|
/** The Constant LOCAL_HOST_IP. */
|
||||||
|
public static final String LOCAL_HOST_IP = "LOCAL_HOST_IP";
|
||||||
|
|
||||||
|
/** The Constant SUBJECT_LOGIN. */
|
||||||
|
public static final String SUBJECT_LOGIN = "SUBJECT_LOGIN";
|
||||||
|
|
||||||
|
/** The Constant JMS_DISK_SPACE_PATH. */
|
||||||
|
public static final String JMS_DISK_SPACE_PATH = "JMS_DISK_SPACE_PATH";
|
||||||
|
|
||||||
|
/** The Constant RMS_SERVER_IP_KEY. RMS UDP SERVER의 접속 아이피 */
|
||||||
|
public static final String RMS_SERVER_IP_KEY = "SERVER_IP";
|
||||||
|
|
||||||
|
/** The Constant RMS_SERVER_PORT_KEY. RMS UDP SERVER의 접속 포트 */
|
||||||
|
public static final String RMS_SERVER_PORT_KEY = "SERVER_PORT";
|
||||||
|
|
||||||
|
/** The Constant EAI_SERVER_INSTANCE_NAME. */
|
||||||
|
public static final String EAI_SERVER_INSTANCE_NAME = Keys.SERVER_KEY;
|
||||||
|
|
||||||
|
/** The Constant DISK_SPACE_PATH. */
|
||||||
|
public static final String DISK_SPACE_PATH = "DISK_SPACE_PATH";
|
||||||
|
|
||||||
|
/** The Constant SMS_AGENT_MAXLINE. */
|
||||||
|
public static final String SMS_AGENT_MAXLINE = "SMS_AGENT_MAXLINE";
|
||||||
|
|
||||||
|
/** The Constant DEFAULT_LOG_PATH. */
|
||||||
|
public static final String DEFAULT_LOG_PATH = "DEFAULT_LOG_PATH";
|
||||||
|
|
||||||
|
/** The Constant SMS_LOG_FILE. */
|
||||||
|
public static final String SMS_LOG_FILE = "SMS_LOG_FILE";
|
||||||
|
|
||||||
|
public static final String SMS_LOG_FILE_ENCODE = "SMS_LOG_FILE_ENCODE";
|
||||||
|
|
||||||
|
/** The Constant ITSM_DISK_CMD. */
|
||||||
|
public static final String ITSM_DISK_CMD = "ITSM_DISK_CMD";
|
||||||
|
|
||||||
|
/** The Constant ITSM_NET_CMD. */
|
||||||
|
public static final String ITSM_NET_CMD = "ITSM_NET_CMD";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inits the.
|
||||||
|
*
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
public abstract void init() throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the properties.
|
||||||
|
*
|
||||||
|
* @return the properties
|
||||||
|
*/
|
||||||
|
public abstract Properties getProperties();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refresh.
|
||||||
|
*
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
public abstract void refresh() throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the properties.
|
||||||
|
*
|
||||||
|
* @param properties the new properties
|
||||||
|
*/
|
||||||
|
public abstract void setProperties(Properties properties);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the rts context dao.
|
||||||
|
*
|
||||||
|
* @param rmsPropertiesDAO the new rts context dao
|
||||||
|
*/
|
||||||
|
public abstract void setRmsPropertiesDao(RmsPropertiesDAO rmsPropertiesDAO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the string property.
|
||||||
|
*
|
||||||
|
* @param propertyName the property name
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public abstract String getStringProperty(String propertyName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the string property.
|
||||||
|
*
|
||||||
|
* @param propertyName the property name
|
||||||
|
* @param defaultString the default string
|
||||||
|
*
|
||||||
|
* @return the string property
|
||||||
|
*/
|
||||||
|
public abstract String getStringProperty(String propertyName, String defaultString);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the int property.
|
||||||
|
*
|
||||||
|
* @param propertyName the property name
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public abstract int getIntProperty(String propertyName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the int property.
|
||||||
|
*
|
||||||
|
* @param propertyName the property name
|
||||||
|
* @param defaultInt the default int
|
||||||
|
*
|
||||||
|
* @return the int property
|
||||||
|
*/
|
||||||
|
public abstract int getIntProperty(String propertyName, int defaultInt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the long property.
|
||||||
|
*
|
||||||
|
* @param propertyName the property name
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public abstract long getLongProperty(String propertyName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the long property.
|
||||||
|
*
|
||||||
|
* @param propertyName the property name
|
||||||
|
* @param defaultLong the default long
|
||||||
|
*
|
||||||
|
* @return the long property
|
||||||
|
*/
|
||||||
|
public abstract long getLongProperty(String propertyName, long defaultLong);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the boolean property.
|
||||||
|
*
|
||||||
|
* @param propertyName the property name
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public abstract boolean getBooleanProperty(String propertyName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the boolean property.
|
||||||
|
*
|
||||||
|
* @param propertyName the property name
|
||||||
|
* @param defaultBoolean the default boolean
|
||||||
|
*
|
||||||
|
* @return the boolean property
|
||||||
|
*/
|
||||||
|
public abstract boolean getBooleanProperty(String propertyName, boolean defaultBoolean);
|
||||||
|
}
|
||||||
@@ -0,0 +1,225 @@
|
|||||||
|
package com.eactive.eai.rms.client.context;
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import com.eactive.eai.common.server.Keys;
|
||||||
|
import com.eactive.eai.rms.client.dao.RmsPropertiesDAO;
|
||||||
|
import com.eactive.eai.rms.client.util.ContainerUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class RmsPropertiesImpl.
|
||||||
|
* <ul>
|
||||||
|
* <li>1. Function :모니터링시 필요한 정보를 로딩 한때 이 클래스를 사용 합니다. </li>
|
||||||
|
* <li>2. Summary :Monitoring 프로퍼티 그룹과 Monitoring{IP} 형태의 프로퍼티 그룹의 모든 프로퍼티
|
||||||
|
* 그리고 {@link System#getProperties()} 에 존재하는 모든 프로퍼티를 로딩 합니다. </li>
|
||||||
|
* <li>3. Notification :</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @see com.eactive.eai.rms.client.dao.RmsPropertiesDAO#getProperties(String)
|
||||||
|
* @author : $Author: 윤창용 $
|
||||||
|
* @version : $Revision: 1.10 $
|
||||||
|
*/
|
||||||
|
public class RmsPropertiesImpl implements RmsProperties {
|
||||||
|
|
||||||
|
/** F/W logger. */
|
||||||
|
private static com.eactive.eai.common.util.Logger logger = com.eactive.eai.common.util.Logger.getLogger(com.eactive.eai.common.util.Logger.LOGGER_CLIENT);
|
||||||
|
|
||||||
|
|
||||||
|
/** The rms properties dao. */
|
||||||
|
private RmsPropertiesDAO rmsPropertiesDAO;
|
||||||
|
|
||||||
|
/** The properties. */
|
||||||
|
private Properties properties;
|
||||||
|
|
||||||
|
/** The server ip. */
|
||||||
|
private String serverIp;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.eactive.eai.rms.client.context.Test#init()
|
||||||
|
*/
|
||||||
|
public void init() throws Exception {
|
||||||
|
InetAddress inetAddress = InetAddress.getLocalHost();
|
||||||
|
serverIp = inetAddress.getHostAddress();
|
||||||
|
this.properties = rmsPropertiesDAO.getProperties();
|
||||||
|
this.properties.setProperty(LOCAL_HOST_IP, serverIp);
|
||||||
|
if (Boolean.getBoolean("rms.standalone")){
|
||||||
|
this.properties.setProperty(LOCAL_HOST_NAME, System.getProperty("rms.hostname"));
|
||||||
|
}else{
|
||||||
|
this.properties.setProperty(LOCAL_HOST_NAME, inetAddress.getHostName());
|
||||||
|
}
|
||||||
|
this.properties.setProperty("standalone", String.valueOf(Boolean.getBoolean("rms.standalone")));
|
||||||
|
this.properties.putAll(System.getProperties());
|
||||||
|
this.setLocalMbeanPort(this.properties, System.getProperty(Keys.SERVER_KEY));
|
||||||
|
|
||||||
|
if (logger.isInfoEnabled()) {
|
||||||
|
printProperties();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setLocalMbeanPort(Properties props, String eaiInstName) {
|
||||||
|
if (props.getProperty(LOCAL_MBEAN_SERVER_PORT) == null) {
|
||||||
|
|
||||||
|
String port = rmsPropertiesDAO.getLocalMBeanServerPort();
|
||||||
|
props.setProperty(LOCAL_MBEAN_SERVER_PORT, port);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the agent infomation for print.
|
||||||
|
*
|
||||||
|
* @param sb the sb
|
||||||
|
* @param text the text
|
||||||
|
*/
|
||||||
|
private void addAgentInfomationForPrint(StringBuilder sb, String text) {
|
||||||
|
sb.append("# ").append(text).append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the agent infomation for print.
|
||||||
|
*
|
||||||
|
* @param sb the sb
|
||||||
|
* @param id the id
|
||||||
|
* @param value the value
|
||||||
|
*/
|
||||||
|
private void addAgentInfomationForPrint(StringBuilder sb, String id,
|
||||||
|
String value) {
|
||||||
|
sb.append("# ").append(id).append("\t: ").append(value).append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the line for print.
|
||||||
|
*
|
||||||
|
* @param sb the sb
|
||||||
|
*/
|
||||||
|
private void addLineForPrint(StringBuilder sb) {
|
||||||
|
sb.append("###################################").append(
|
||||||
|
"############################################").append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints the system properties.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private void printProperties() {
|
||||||
|
|
||||||
|
String javaVersion = System.getProperty("java.version");
|
||||||
|
String javaVender = System.getProperty("java.vendor");
|
||||||
|
String was = ContainerUtil.getString();
|
||||||
|
|
||||||
|
if (logger.isInfoEnabled()) {
|
||||||
|
StringBuilder sb = new StringBuilder(1024);
|
||||||
|
addLineForPrint(sb.append("\n"));
|
||||||
|
addAgentInfomationForPrint(sb, "MONITORING AGENT_INFOMATION");
|
||||||
|
addAgentInfomationForPrint(sb, "VERSION", "");
|
||||||
|
addAgentInfomationForPrint(sb, "WAS", was);
|
||||||
|
addAgentInfomationForPrint(sb, "JDK VENDER", javaVender);
|
||||||
|
addAgentInfomationForPrint(sb, "JDK VERSION", javaVersion);
|
||||||
|
addAgentInfomationForPrint(sb, "SERVER IP", serverIp);
|
||||||
|
addLineForPrint(sb);
|
||||||
|
logger.info(sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Iterator it = properties.keySet().iterator(); it.hasNext();) {
|
||||||
|
String key = (String) it.next();
|
||||||
|
logger.info(key + "=" + properties.getProperty(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.eactive.eai.rms.client.context.RmsProperties#getProperties()
|
||||||
|
*/
|
||||||
|
public Properties getProperties() {
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.eactive.eai.rms.client.context.RmsProperties#refresh()
|
||||||
|
*/
|
||||||
|
public void refresh() throws Exception {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.eactive.eai.rms.client.context.RmsProperties#setProperties(java.util.Properties)
|
||||||
|
*/
|
||||||
|
public void setProperties(Properties properties) {
|
||||||
|
this.properties = properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.eactive.eai.rms.client.context.RmsProperties#setRmsPropertiesDao(com.eactive.eai.rms.client.dao.RmsPropertiesDAO)
|
||||||
|
*/
|
||||||
|
public void setRmsPropertiesDao(RmsPropertiesDAO rmsPropertiesDAO) {
|
||||||
|
this.rmsPropertiesDAO = rmsPropertiesDAO;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.eactive.eai.rms.client.context.RmsProperties#getStringProperty(java.lang.String)
|
||||||
|
*/
|
||||||
|
public String getStringProperty(String propertyName) {
|
||||||
|
return properties.getProperty(propertyName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.eactive.eai.rms.client.context.RmsProperties#getStringProperty(java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
public String getStringProperty(String propertyName, String defaultString) {
|
||||||
|
String value = getStringProperty(propertyName);
|
||||||
|
return value != null ? value : defaultString;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.eactive.eai.rms.client.context.RmsProperties#getIntProperty(java.lang.String)
|
||||||
|
*/
|
||||||
|
public int getIntProperty(String propertyName) {
|
||||||
|
String prop = properties.getProperty(propertyName);
|
||||||
|
return prop == null ? 0 : new Integer(prop.trim()).intValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.eactive.eai.rms.client.context.RmsProperties#getIntProperty(java.lang.String, int)
|
||||||
|
*/
|
||||||
|
public int getIntProperty(String propertyName, int defaultInt) {
|
||||||
|
String prop = properties.getProperty(propertyName);
|
||||||
|
return prop == null ? defaultInt : new Integer(prop.trim()).intValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.eactive.eai.rms.client.context.RmsProperties#getLongProperty(java.lang.String)
|
||||||
|
*/
|
||||||
|
public long getLongProperty(String propertyName) {
|
||||||
|
String prop = properties.getProperty(propertyName);
|
||||||
|
return prop == null ? 0 : new Long(prop.trim()).longValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.eactive.eai.rms.client.context.RmsProperties#getLongProperty(java.lang.String, long)
|
||||||
|
*/
|
||||||
|
public long getLongProperty(String propertyName, long defaultLong) {
|
||||||
|
String prop = properties.getProperty(propertyName);
|
||||||
|
return prop == null ? defaultLong : new Long(prop.trim()).longValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.eactive.eai.rms.client.context.RmsProperties#getBooleanProperty(java.lang.String)
|
||||||
|
*/
|
||||||
|
public boolean getBooleanProperty(String propertyName) {
|
||||||
|
String prop = properties.getProperty(propertyName);
|
||||||
|
return prop == null ? false : new Boolean(prop.trim()).booleanValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.eactive.eai.rms.client.context.RmsProperties#getBooleanProperty(java.lang.String, boolean)
|
||||||
|
*/
|
||||||
|
public boolean getBooleanProperty(String propertyName,
|
||||||
|
boolean defaultBoolean) {
|
||||||
|
String prop = properties.getProperty(propertyName);
|
||||||
|
return prop == null ? defaultBoolean : new Boolean(prop.trim())
|
||||||
|
.booleanValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.eactive.eai.rms.client.context;
|
||||||
|
|
||||||
|
public class StandAlone {
|
||||||
|
|
||||||
|
private static final String config = "com/eactive/eai/rms/client/context/applicationContext-agent-standalone.xml";
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
System.setProperty("inst.Name","EAIDSG_i11");
|
||||||
|
System.setProperty("eai.tableowner","INST2");
|
||||||
|
System.setProperty("rms.standalone","true");
|
||||||
|
System.setProperty("rms.hostname","ieadad01");
|
||||||
|
|
||||||
|
RmsContext.getInstance(new String[] { config });
|
||||||
|
// System.out.println("RMS CLIENT START !!!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
package com.eactive.eai.rms.client.dao;
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.springframework.jdbc.core.support.JdbcDaoSupport;
|
||||||
|
|
||||||
|
import com.eactive.eai.common.dao.Keys;
|
||||||
|
import com.eactive.eai.rms.client.context.RmsProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* 1. 기능 : 모니터링 관리 화면의 프로퍼티 관리 화면에서 입력한 내용들을 로딩 합니다.
|
||||||
|
* 2. 처리 개요 : RMS_PROPS 프로퍼티 그룹과 RMS_PROPS{INSTANCE_NAME} 형태의 프로퍼티 그룹의 모든 프로퍼티를 로딩 합니다.
|
||||||
|
* -
|
||||||
|
* 3. 주의사항 :
|
||||||
|
* </pre>
|
||||||
|
* @author :
|
||||||
|
* @version : $Revision: 1.10 $
|
||||||
|
* @since : rts 1.0
|
||||||
|
*/
|
||||||
|
public class AgentAdapterDAO extends JdbcDaoSupport {
|
||||||
|
|
||||||
|
/** F/W logger. */
|
||||||
|
private static com.eactive.eai.common.util.Logger logger = com.eactive.eai.common.util.Logger.getLogger(com.eactive.eai.common.util.Logger.LOGGER_CLIENT);
|
||||||
|
|
||||||
|
|
||||||
|
private String tableOwner = null;
|
||||||
|
private boolean standalone = false;
|
||||||
|
private String instanceName = null;
|
||||||
|
|
||||||
|
public AgentAdapterDAO() {
|
||||||
|
tableOwner = System.getProperty("eai.tableowner");
|
||||||
|
standalone = Boolean.getBoolean("rms.standalone");
|
||||||
|
|
||||||
|
if (standalone) {
|
||||||
|
try {
|
||||||
|
instanceName = InetAddress.getLocalHost().getHostAddress();
|
||||||
|
} catch (UnknownHostException e) {
|
||||||
|
//e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
instanceName = System
|
||||||
|
.getProperty(RmsProperties.EAI_SERVER_INSTANCE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (logger.isDebugEnabled()) {
|
||||||
|
logger.debug("CURRENT RMS INSTANCE NAME : " + instanceName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap getMonitorUseNoAdapterList() throws Exception {
|
||||||
|
HashMap<String,String> monitorDisableMap = new HashMap<String,String>();
|
||||||
|
|
||||||
|
StringBuffer query = new StringBuffer();
|
||||||
|
|
||||||
|
query.append(" select AdptrBzwkGroupName, MoniUseYn \n");
|
||||||
|
query.append(" from "+ tableOwner + ".TSEAIAD01 \n");
|
||||||
|
query.append(" where MoniUseYn = 'N' \n");
|
||||||
|
|
||||||
|
try {
|
||||||
|
List adapterList = this.getJdbcTemplate().queryForList(query.toString());
|
||||||
|
|
||||||
|
if (adapterList != null) {
|
||||||
|
for (Iterator it = adapterList.iterator(); it.hasNext();) {
|
||||||
|
Map tmp = (Map) it.next();
|
||||||
|
String name = (String) tmp.get("AdptrBzwkGroupName");
|
||||||
|
String val = (String) tmp.get("MoniUseYn");
|
||||||
|
monitorDisableMap.put(name,val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return monitorDisableMap;
|
||||||
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
logger.error(e.toString(),e);
|
||||||
|
//e.printStackTrace();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public HashMap getMonitorTimeConditionAdapterList() throws Exception {
|
||||||
|
HashMap<String,String> monitorDisableMap = new HashMap<String,String>();
|
||||||
|
|
||||||
|
StringBuffer query = new StringBuffer();
|
||||||
|
|
||||||
|
query.append(" select AdptrBzwkGroupName, MoniCndnCtnt \n");
|
||||||
|
query.append(" from "+ tableOwner + ".TSEAIAD01 \n");
|
||||||
|
query.append(" where MoniUseYn = 'Y' and MoniCndnCtnt != '' and MoniCndnCtnt != 'N,EVERY,0000,2359'\n");
|
||||||
|
|
||||||
|
try {
|
||||||
|
List adapterList = this.getJdbcTemplate().queryForList(query.toString());
|
||||||
|
|
||||||
|
if (adapterList != null) {
|
||||||
|
for (Iterator it = adapterList.iterator(); it.hasNext();) {
|
||||||
|
Map tmp = (Map) it.next();
|
||||||
|
String name = (String) tmp.get("AdptrBzwkGroupName");
|
||||||
|
String val = (String) tmp.get("MoniUseYn");
|
||||||
|
monitorDisableMap.put(name,val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return monitorDisableMap;
|
||||||
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
logger.error(e.toString(),e);
|
||||||
|
//e.printStackTrace();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.eactive.eai.rms.client.dao;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface RmsPropertiesDAO.
|
||||||
|
* <ul>
|
||||||
|
* <li>1. Function :모니터링 관리 화면의 프로퍼티 관리 화면에서 입력한 내용들을 로딩 합니다. </li>
|
||||||
|
* <li>2. Summary :Monitoring 프로퍼티 그룹과 Monitoring{IP} 형태의 프로퍼티 그룹의 모든 프로퍼티를 로딩 합니다. </li>
|
||||||
|
* <li>3. Notification :</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @author : $Author: 박기섭 $
|
||||||
|
* @version : $Revision: 1.4 $
|
||||||
|
*/
|
||||||
|
public interface RmsPropertiesDAO {
|
||||||
|
|
||||||
|
public Properties getProperties();
|
||||||
|
|
||||||
|
public String getLocalMBeanServerPort();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
package com.eactive.eai.rms.client.dao;
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.springframework.dao.DataAccessException;
|
||||||
|
import org.springframework.jdbc.core.support.JdbcDaoSupport;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.client.context.RmsProperties;
|
||||||
|
import com.eactive.eai.rms.client.util.QueryBuffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* 1. 기능 : 모니터링 관리 화면의 프로퍼티 관리 화면에서 입력한 내용들을 로딩 합니다.
|
||||||
|
* 2. 처리 개요 : RMS_PROPS 프로퍼티 그룹과 RMS_PROPS{INSTANCE_NAME} 형태의 프로퍼티 그룹의 모든 프로퍼티를 로딩 합니다.
|
||||||
|
* -
|
||||||
|
* 3. 주의사항 :
|
||||||
|
* </pre>
|
||||||
|
* @author : 박기섭
|
||||||
|
* @version : $Revision: 1.10 $
|
||||||
|
* @since : rts 1.0
|
||||||
|
*/
|
||||||
|
public class RmsPropertiesDAOImpl extends JdbcDaoSupport implements
|
||||||
|
RmsPropertiesDAO {
|
||||||
|
|
||||||
|
/** F/W logger. */
|
||||||
|
private static com.eactive.eai.common.util.Logger logger = com.eactive.eai.common.util.Logger.getLogger(com.eactive.eai.common.util.Logger.LOGGER_CLIENT);
|
||||||
|
|
||||||
|
|
||||||
|
private String tableOwner = null;
|
||||||
|
private boolean standalone = false;
|
||||||
|
private String instanceName = null;
|
||||||
|
|
||||||
|
public RmsPropertiesDAOImpl() {
|
||||||
|
tableOwner = System.getProperty("eai.tableowner");
|
||||||
|
standalone = Boolean.getBoolean("rms.standalone");
|
||||||
|
|
||||||
|
if (standalone) {
|
||||||
|
try {
|
||||||
|
instanceName = InetAddress.getLocalHost().getHostAddress();
|
||||||
|
} catch (UnknownHostException e) {
|
||||||
|
//e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
instanceName = System
|
||||||
|
.getProperty(RmsProperties.EAI_SERVER_INSTANCE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (logger.isDebugEnabled()) {
|
||||||
|
logger.debug("CURRENT RMS INSTANCE NAME : " + instanceName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public Properties getProperties() {
|
||||||
|
final Properties properties = new Properties();
|
||||||
|
QueryBuffer query = new QueryBuffer();
|
||||||
|
|
||||||
|
try {
|
||||||
|
query.append(" SELECT Prpty2Val ");
|
||||||
|
query.append(" , PrptyName ");
|
||||||
|
query.append(" FROM " + tableOwner + ".TSEAICM03 ");
|
||||||
|
query.append(" WHERE PrptyGroupName='RMS_PROPS' ");
|
||||||
|
|
||||||
|
List commonPropertiesList = this.getJdbcTemplate().queryForList(
|
||||||
|
query.toString());
|
||||||
|
|
||||||
|
if (commonPropertiesList != null) {
|
||||||
|
for (Iterator it = commonPropertiesList.iterator(); it
|
||||||
|
.hasNext();) {
|
||||||
|
Map tmp = (Map) it.next();
|
||||||
|
String name = (String) tmp.get("PrptyName");
|
||||||
|
String val = (String) tmp.get("Prpty2Val");
|
||||||
|
properties.setProperty(name, val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query.delete(0, query.length());
|
||||||
|
|
||||||
|
query.append(" SELECT PrptyName ");
|
||||||
|
query.append(" , Prpty2Val ");
|
||||||
|
query.append(" FROM " + tableOwner + ".TSEAICM03 ");
|
||||||
|
query.append(" WHERE PrptyGroupName='RMS_PROPS{"+ instanceName + "}'");
|
||||||
|
|
||||||
|
List propertiesList = this.getJdbcTemplate().queryForList(
|
||||||
|
query.toString());
|
||||||
|
|
||||||
|
if (propertiesList != null) {
|
||||||
|
for (Iterator it = propertiesList.iterator(); it.hasNext();) {
|
||||||
|
Map tmp = (Map) it.next();
|
||||||
|
String name = (String) tmp.get("PrptyName");
|
||||||
|
String val = (String) tmp.get("Prpty2Val");
|
||||||
|
properties.setProperty(name, val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (DataAccessException e) {
|
||||||
|
logger.error(e.toString());
|
||||||
|
}
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLocalMBeanServerPort() {
|
||||||
|
QueryBuffer buffer = new QueryBuffer();
|
||||||
|
buffer.append(" SELECT SevrLsnPortName ");
|
||||||
|
buffer.append(" FROM " + tableOwner + ".TSEAISY02 ");
|
||||||
|
buffer.append(" WHERE EAISevrInstncName = ? ");
|
||||||
|
|
||||||
|
return (String) this.getJdbcTemplate().queryForObject(
|
||||||
|
buffer.toString(), new Object[] { instanceName }, String.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.eactive.eai.rms.client.handler;
|
||||||
|
|
||||||
|
import org.apache.mina.handler.demux.MessageHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <ul>
|
||||||
|
* <li>1. Function : IMessageHandler는 socket으로 부터 수신 받은
|
||||||
|
* 객체에 대한 Handler의 인터페이스 입니다. </li>
|
||||||
|
* <li>2. Summary :a) 객체가 수신 되었을 때 인터페이스를 구현한 객체가 처리할
|
||||||
|
* {@link IMessageHandler#targetClass()}를 구현 한다. <br/>
|
||||||
|
* b) /WEB-INF/applicationContext-udp.xml 의 "protocolHandler" ({@link UdpServerSessionHandler}})
|
||||||
|
* 에 등록 한다. <br />
|
||||||
|
* c) 객체를 처리 할 로직이 들어가는 {@link MessageHandler#messageReceived(org.apache.mina.common.IoSession, Object)}
|
||||||
|
* 메서드를 을 구현 한다.
|
||||||
|
* </li>
|
||||||
|
* <li>3. Notification :</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @author $Author: 박기섭 $
|
||||||
|
* @version $Revision: 1.4 $
|
||||||
|
*/
|
||||||
|
public interface IMessageHandler extends
|
||||||
|
MessageHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 처리 대상이 되는 클래스를 리턴.
|
||||||
|
*
|
||||||
|
* @return Class
|
||||||
|
*/
|
||||||
|
public Class<?> targetClass();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.eactive.eai.rms.client.handler;//package com.eactive.eai.rms.client.handler;
|
||||||
|
//
|
||||||
|
//import com.eactive.eai.rms.onl.vo.LogConfigurationCommand;
|
||||||
|
//
|
||||||
|
//import kr.co.kpl.org.apache.log4j.Logger;
|
||||||
|
//import org.apache.mina.common.IoSession;
|
||||||
|
//
|
||||||
|
//public class LogConfigurationCommandHandler implements IMessageHandler {
|
||||||
|
//
|
||||||
|
// private static final Logger logger = Logger.getLogger(LogConfigurationCommandHandler.class);
|
||||||
|
//
|
||||||
|
// public Class<LogConfigurationCommand> targetClass() {
|
||||||
|
// return LogConfigurationCommand.class;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void messageReceived(IoSession session, Object message)
|
||||||
|
// throws Exception {
|
||||||
|
//
|
||||||
|
// LogConfigurationCommand command = (LogConfigurationCommand) message;
|
||||||
|
//
|
||||||
|
// LogConfigurer configurer = new LogConfigurer();
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// switch (command.getCommand()) {
|
||||||
|
// case LogConfigurationCommand.VIEW_COMMAND:
|
||||||
|
// command.setCategoryMap(configurer.view());
|
||||||
|
// break;
|
||||||
|
// case LogConfigurationCommand.EDIT_COMMAND:
|
||||||
|
// configurer.edit(command.getLogCategorys(),
|
||||||
|
// command.getLogCategoryLevels(),
|
||||||
|
// command.getLogDetailCategorys(),
|
||||||
|
// command.getLogDetailCategoryLevels(),
|
||||||
|
// command.getForeceLevel(), command.getForceDetailLevel());
|
||||||
|
// break;
|
||||||
|
// case LogConfigurationCommand.DETAIL_COMMAND:
|
||||||
|
// command.setCategoryMap(configurer.detail(command.getLogCategory()));
|
||||||
|
// break;
|
||||||
|
// case LogConfigurationCommand.NEW_LOGGER_COMMAND:
|
||||||
|
// configurer.newLogger(command.getLogCategory());
|
||||||
|
// break;
|
||||||
|
// case 0:
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// command.setCommand(LogConfigurationCommand.PROCESS_OK_COMMAND);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// logger.error(this, e);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// session.write(command);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
package com.eactive.eai.rms.client.handler;//package com.eactive.eai.rms.client.handler;
|
||||||
|
//
|
||||||
|
//import java.util.Enumeration;
|
||||||
|
//import java.util.Map;
|
||||||
|
//import java.util.SortedMap;
|
||||||
|
//import java.util.TreeMap;
|
||||||
|
//
|
||||||
|
//import kr.co.kpl.org.apache.log4j.Category;
|
||||||
|
//import kr.co.kpl.org.apache.log4j.Level;
|
||||||
|
//import kr.co.kpl.org.apache.log4j.Logger;
|
||||||
|
//
|
||||||
|
//public class LogConfigurer {
|
||||||
|
//
|
||||||
|
// @SuppressWarnings("unchecked")
|
||||||
|
// public Map<String, Integer> view() {
|
||||||
|
// Enumeration e = Logger.getRootLogger()
|
||||||
|
// .getLoggerRepository()
|
||||||
|
// .getCurrentLoggers();
|
||||||
|
//
|
||||||
|
// SortedMap<String, Integer> categorys = new TreeMap<String, Integer>();
|
||||||
|
//
|
||||||
|
// for (; e.hasMoreElements();) {
|
||||||
|
// Logger x = (Logger) e.nextElement();
|
||||||
|
// Category parent = x.getParent();
|
||||||
|
// String parentName = parent.getName();
|
||||||
|
// Level parentLevel = parent.getLevel();
|
||||||
|
//
|
||||||
|
// if (parentLevel == null) {
|
||||||
|
// parentLevel = Level.ERROR;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// categorys.put(parentName, parentLevel.toInt());
|
||||||
|
// }
|
||||||
|
// return categorys;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void edit(String[] category, String[] categoryLevel,
|
||||||
|
// String[] detailCategory, String[] detailCategoryLevel,
|
||||||
|
// String foreceLevel, String forceDetailLevel) {
|
||||||
|
//
|
||||||
|
// if (category != null) {
|
||||||
|
// for (int i = 0; i < category.length; i++) {
|
||||||
|
// parentUpdate(category[i], categoryLevel[i], foreceLevel);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (detailCategory != null) {
|
||||||
|
// for (int i = 0; i < detailCategory.length; i++) {
|
||||||
|
// categoryUpdate(detailCategory[i], detailCategoryLevel[i],
|
||||||
|
// forceDetailLevel);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @SuppressWarnings("unchecked")
|
||||||
|
// private void parentUpdate(String category, String level, String foreceLevel) {
|
||||||
|
//
|
||||||
|
// if (foreceLevel != null && !foreceLevel.trim().equals("")) {
|
||||||
|
// level = foreceLevel;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Enumeration e = Logger.getRootLogger()
|
||||||
|
// .getLoggerRepository()
|
||||||
|
// .getCurrentLoggers();
|
||||||
|
//
|
||||||
|
// for (; e.hasMoreElements();) {
|
||||||
|
// Logger logger = (Logger) e.nextElement();
|
||||||
|
// Category parent = logger.getParent();
|
||||||
|
// if (parent.getName() != null && parent.getName().equals(category)) {
|
||||||
|
// parent.setLevel(Level.toLevel(level));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @SuppressWarnings("unchecked")
|
||||||
|
// private void categoryUpdate(String category, String level, String forceLevel) {
|
||||||
|
//
|
||||||
|
// if (forceLevel != null && !forceLevel.trim().equals("")) {
|
||||||
|
// level = forceLevel;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Enumeration e = Logger.getRootLogger()
|
||||||
|
// .getLoggerRepository()
|
||||||
|
// .getCurrentLoggers();
|
||||||
|
//
|
||||||
|
// for (; e.hasMoreElements();) {
|
||||||
|
// Logger logger = (Logger) e.nextElement();
|
||||||
|
// String p = logger.getName();
|
||||||
|
// if (p != null && p.equals(category)) {
|
||||||
|
// logger.setLevel(Level.toLevel(level));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @SuppressWarnings("unchecked")
|
||||||
|
// public Map<String, Integer> detail(String parent) {
|
||||||
|
//
|
||||||
|
// if (parent == null) {
|
||||||
|
// return new TreeMap<String, Integer>();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Enumeration e = Logger.getRootLogger()
|
||||||
|
// .getLoggerRepository()
|
||||||
|
// .getCurrentLoggers();
|
||||||
|
//
|
||||||
|
// SortedMap<String, Integer> details = new TreeMap<String, Integer>();
|
||||||
|
// for (; e.hasMoreElements();) {
|
||||||
|
// Logger logger = (Logger) e.nextElement();
|
||||||
|
// String loggerName = logger.getName();
|
||||||
|
//
|
||||||
|
// if (loggerName != null && loggerName.startsWith(parent)
|
||||||
|
// && !loggerName.equals(parent)) {
|
||||||
|
// if (logger.getEffectiveLevel() != null) {
|
||||||
|
// details.put(loggerName, new Integer(
|
||||||
|
// logger.getEffectiveLevel().toInt()));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return details;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void newLogger(String newLogger) {
|
||||||
|
// Logger logger = Logger.getLogger(newLogger);
|
||||||
|
// Logger.getLogger(newLogger + ".createdlogger");
|
||||||
|
// logger.setLevel(Level.ERROR);
|
||||||
|
// logger.debug("ignored");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.eactive.eai.rms.client.handler;//package com.eactive.eai.rms.client.handler;
|
||||||
|
//
|
||||||
|
//import org.apache.mina.common.IoSession;
|
||||||
|
//
|
||||||
|
//import org.springframework.context.ApplicationContext;
|
||||||
|
//import org.springframework.context.ApplicationContextAware;
|
||||||
|
//import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||||
|
//
|
||||||
|
//import com.eactive.eai.rms.onl.vo.RefreshCommand;
|
||||||
|
//
|
||||||
|
//public class RefreshCommandHandler implements IMessageHandler,
|
||||||
|
// ApplicationContextAware {
|
||||||
|
//
|
||||||
|
// private ApplicationContext applicationContext;
|
||||||
|
//
|
||||||
|
// public void setApplicationContext(ApplicationContext applicationContext) {
|
||||||
|
// this.applicationContext = applicationContext;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public Class<?> targetClass() {
|
||||||
|
// return RefreshCommand.class;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void messageReceived(IoSession session, Object message)
|
||||||
|
// throws Exception {
|
||||||
|
//
|
||||||
|
// ClassPathXmlApplicationContext applicationContext = (ClassPathXmlApplicationContext) this.applicationContext;
|
||||||
|
// applicationContext.refresh();
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
package com.eactive.eai.rms.client.service;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationContextAware;
|
||||||
|
|
||||||
|
import com.eactive.eai.common.util.ContainerUtil;
|
||||||
|
import com.eactive.eai.rms.client.context.RmsProperties;
|
||||||
|
import com.eactive.eai.rms.onl.vo.EAIEngineStatusVo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* 1. 기능 : EAI Engine의 상태를 조회 합니다.
|
||||||
|
* 2. 처리 개요 :
|
||||||
|
* -
|
||||||
|
* 3. 주의사항 :
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author : 박기섭
|
||||||
|
* @version : $Revision: 1.9 $
|
||||||
|
* @since : rts 1.0
|
||||||
|
*/
|
||||||
|
public class EaiEngineStatusService implements ApplicationContextAware {
|
||||||
|
|
||||||
|
/** F/W logger. */
|
||||||
|
private static com.eactive.eai.common.util.Logger logger = com.eactive.eai.common.util.Logger.getLogger(com.eactive.eai.common.util.Logger.LOGGER_CLIENT);
|
||||||
|
|
||||||
|
|
||||||
|
/** The application context. */
|
||||||
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
private RmsProperties rmsProperties;
|
||||||
|
|
||||||
|
private Properties adminClientProperties;
|
||||||
|
|
||||||
|
public void setAdminClientProperties(Properties adminClientProperties) {
|
||||||
|
this.adminClientProperties = adminClientProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProperties(RmsProperties rmsProperties) {
|
||||||
|
this.rmsProperties = rmsProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new eai engine status service.
|
||||||
|
*/
|
||||||
|
public EaiEngineStatusService() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the eAI engine status.
|
||||||
|
*
|
||||||
|
* @return the eAI engine status
|
||||||
|
*
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
public EAIEngineStatusVo getEAIEngineStatus() throws Exception {
|
||||||
|
|
||||||
|
EAIEngineStatusVo eaiEngineStatusVo = (EAIEngineStatusVo) applicationContext.getBean("eaiEngineStatusVo");
|
||||||
|
try {
|
||||||
|
setServerStatus(eaiEngineStatusVo);
|
||||||
|
this.setJVMRuntimeStatus(eaiEngineStatusVo);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
return eaiEngineStatusVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the server status.
|
||||||
|
*
|
||||||
|
* @param status the status
|
||||||
|
* @param serverMBean the server m bean
|
||||||
|
* @param serverName the server name
|
||||||
|
*/
|
||||||
|
private void setServerStatus(EAIEngineStatusVo status) {
|
||||||
|
|
||||||
|
String instName = rmsProperties.getStringProperty(RmsProperties.EAI_SERVER_INSTANCE_NAME);
|
||||||
|
status.setServerName(instName);
|
||||||
|
|
||||||
|
int state = 0;
|
||||||
|
try {
|
||||||
|
JMXMonitoring monitoring = JMXMonitoringFactory.createServerMonitoring(ContainerUtil.get());
|
||||||
|
//JMX가 없을경우 무조건 정상
|
||||||
|
if (monitoring == null) {
|
||||||
|
status.setServerState(Integer.toString(2));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
monitoring.init(this.adminClientProperties);
|
||||||
|
state = (int)monitoring.getState(instName);
|
||||||
|
status.setServerState(Integer.toString(state));
|
||||||
|
} catch (Exception e) {
|
||||||
|
status.setServerState(Integer.toString(state));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the jvm runtime status.
|
||||||
|
*
|
||||||
|
* @param status the status
|
||||||
|
* @param serverRuntimeMBean the server runtime m bean
|
||||||
|
*/
|
||||||
|
private void setJVMRuntimeStatus(EAIEngineStatusVo status) {
|
||||||
|
Runtime runtime = Runtime.getRuntime();
|
||||||
|
|
||||||
|
status.setHeapFreeCurrent(runtime.freeMemory());
|
||||||
|
status.setHeapSizeCurrent(runtime.totalMemory());
|
||||||
|
status.setHeapSizeMax(runtime.maxMemory());
|
||||||
|
|
||||||
|
long precent = (((status.getHeapSizeMax() - status.getHeapSizeCurrent()) + status.getHeapFreeCurrent()) * 100)
|
||||||
|
/ status.getHeapSizeMax();
|
||||||
|
|
||||||
|
status.setHeapFreePercent(new Long(precent).intValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
|
||||||
|
*/
|
||||||
|
public void setApplicationContext(ApplicationContext applicationContext) {
|
||||||
|
this.applicationContext = applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,217 @@
|
|||||||
|
package com.eactive.eai.rms.client.service;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.client.util.CommandParser;
|
||||||
|
import com.eactive.eai.rms.client.util.CommandUtils;
|
||||||
|
import com.eactive.eai.rms.client.util.WindowsSystemMon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class HostStatusService.
|
||||||
|
* <ul>
|
||||||
|
* <li>1. Function :</li>
|
||||||
|
* <li>2. Summary :</li>
|
||||||
|
* <li>3. Notification :</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author : $Author: 박기섭 $
|
||||||
|
* @version : $Revision: 1.7 $
|
||||||
|
*/
|
||||||
|
public class HostStatusService implements InitializingBean {
|
||||||
|
|
||||||
|
/** F/W logger. */
|
||||||
|
private static com.eactive.eai.common.util.Logger logger = com.eactive.eai.common.util.Logger.getLogger(com.eactive.eai.common.util.Logger.LOGGER_CLIENT);
|
||||||
|
|
||||||
|
static final boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase().startsWith("windows") ? true : false;
|
||||||
|
|
||||||
|
private int TOTAL_MEMORY = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the cpu percentage.
|
||||||
|
*
|
||||||
|
* @return the cpu percentage
|
||||||
|
*/
|
||||||
|
public int getCpuPercentage() {
|
||||||
|
|
||||||
|
int result = 0;
|
||||||
|
try {
|
||||||
|
if (IS_WINDOWS){
|
||||||
|
return WindowsSystemMon.getCpuPercentage();
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] command = { "/bin/sh", "-c", "vmstat 1 2 | awk 'BEGIN{n=0;}{if(++n==4) { printf((100-$15));}}'" };
|
||||||
|
|
||||||
|
CommandParser parser = new CommandParser() {
|
||||||
|
public Object parse(String string) {
|
||||||
|
int result = 0;
|
||||||
|
try {
|
||||||
|
result = Integer.parseInt(string.trim());
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
result = (Integer) CommandUtils.processExec(command, parser);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the disk percentage.
|
||||||
|
*
|
||||||
|
* @param path the path
|
||||||
|
*
|
||||||
|
* @return the disk percentage
|
||||||
|
*/
|
||||||
|
public int getDiskPercentage(String path) {
|
||||||
|
int result = 0;
|
||||||
|
try {
|
||||||
|
if (IS_WINDOWS){
|
||||||
|
return WindowsSystemMon.getDiskPercentage();
|
||||||
|
}
|
||||||
|
|
||||||
|
String command[] = new String[] {
|
||||||
|
"/bin/sh",
|
||||||
|
"-c",
|
||||||
|
"df -k " + path + " | awk 'BEGIN{n=0;}{if(++n==2) { printf($5);}}'" };
|
||||||
|
|
||||||
|
CommandParser parser = new CommandParser() {
|
||||||
|
|
||||||
|
public Object parse(String string) {
|
||||||
|
int result = 0;
|
||||||
|
int psercentIndex = 0;
|
||||||
|
try {
|
||||||
|
psercentIndex = string.indexOf("%");
|
||||||
|
result = Integer.parseInt(string.substring(0, psercentIndex));
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
result = (Integer) CommandUtils.processExec(command, parser);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn(e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the memory percentage.
|
||||||
|
*
|
||||||
|
* @return the memory percentage
|
||||||
|
*/
|
||||||
|
public int getMemoryPercentage() {
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (IS_WINDOWS){
|
||||||
|
return WindowsSystemMon.getMemoryPercentage();
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] command = { "/bin/sh", "-c", "cat /proc/meminfo | egrep 'MemFree:|SwapFree' | awk 'BEGIN{t=0;}{t+=$2;}END {print t;}'" };
|
||||||
|
|
||||||
|
CommandParser parser = new CommandParser() {
|
||||||
|
public Object parse(String string) {
|
||||||
|
int result = 0;
|
||||||
|
try {
|
||||||
|
result = Integer.parseInt(string.trim()) / 1024;
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int freeMB = (Integer) CommandUtils.processExec(command, parser);
|
||||||
|
result = (TOTAL_MEMORY - freeMB) * 100 / TOTAL_MEMORY;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (logger.isDebugEnabled()) {
|
||||||
|
logger.debug("getMemoryPercentage RESULT : " + result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 시스템의 전체 메모리 값을 구한다.
|
||||||
|
*
|
||||||
|
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||||
|
*/
|
||||||
|
public void afterPropertiesSet() throws Exception {
|
||||||
|
if (IS_WINDOWS){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
/*
|
||||||
|
* 시스템의 전체 메모리 값을 구한다.
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
[elink@dmccap01 ~]$ cat /proc/meminfo | grep MemTotal
|
||||||
|
MemTotal: 28597244 kB
|
||||||
|
*/
|
||||||
|
String[] commandRealMemory = { "/bin/sh", "-c", "cat /proc/meminfo | grep MemTotal | awk '{printf($2)}'" };
|
||||||
|
|
||||||
|
|
||||||
|
CommandParser realParser = new CommandParser() {
|
||||||
|
public Object parse(String string) {
|
||||||
|
int realMemoryMB = 0;
|
||||||
|
try {
|
||||||
|
realMemoryMB = Integer.parseInt(string) / 1024;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn(this, e);
|
||||||
|
}
|
||||||
|
return realMemoryMB;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
String[] commandPage = { "/bin/sh", "-c", "cat /proc/meminfo | grep SwapTotal | awk '{printf($2)}' " };
|
||||||
|
CommandParser pageParser = new CommandParser() {
|
||||||
|
|
||||||
|
public Object parse(String string) {
|
||||||
|
int pageMB = 0;
|
||||||
|
try {
|
||||||
|
pageMB = Integer.parseInt(string) / 1024;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn(this, e);
|
||||||
|
}
|
||||||
|
return pageMB;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Integer realMemoryMB = (Integer) CommandUtils.processExec(
|
||||||
|
commandRealMemory, realParser);
|
||||||
|
|
||||||
|
Integer pageMB = (Integer) CommandUtils.processExec(commandPage,
|
||||||
|
pageParser);
|
||||||
|
|
||||||
|
this.TOTAL_MEMORY = realMemoryMB + pageMB;
|
||||||
|
|
||||||
|
if (logger.isDebugEnabled()) {
|
||||||
|
logger.debug("TOTAL MEMORY : " + TOTAL_MEMORY);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
HostStatusService service = new HostStatusService();
|
||||||
|
service.afterPropertiesSet();
|
||||||
|
System.out.println("CPU : " + service.getCpuPercentage());
|
||||||
|
System.out.println("MEMORY : " + service.getMemoryPercentage());
|
||||||
|
System.out.println("DISK(/log) : " + service.getDiskPercentage("/log"));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.eactive.eai.rms.client.service;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
public interface JMXMonitoring
|
||||||
|
{
|
||||||
|
public void init (Properties properties) throws Exception;
|
||||||
|
public Object getState(String instance) throws Exception;
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.eactive.eai.rms.client.service;
|
||||||
|
|
||||||
|
import com.eactive.eai.common.util.ContainerUtil;
|
||||||
|
import com.eactive.eai.env.ElinkConfig;
|
||||||
|
import com.eactive.eai.rms.client.service.activemq.SingleQueueMonitoringForActiveMq;
|
||||||
|
import com.eactive.eai.rms.client.service.weblogic.SingleQueueMonitoringForWebLogic;
|
||||||
|
import com.eactive.eai.rms.client.service.weblogic.SingleServerMonitoringForWebLogic;
|
||||||
|
import com.eactive.eai.rms.client.service.websphere.SingleQueueMonitoringForWebSphere;
|
||||||
|
import com.eactive.eai.rms.client.service.websphere.SingleServerMonitoringForWebSphere;
|
||||||
|
|
||||||
|
public class JMXMonitoringFactory
|
||||||
|
{
|
||||||
|
private JMXMonitoringFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JMXMonitoring createServerMonitoring(int type) throws Exception {
|
||||||
|
if (ContainerUtil.WEBLOGIC == type ){
|
||||||
|
return SingleServerMonitoringForWebLogic.getInstance();
|
||||||
|
}else if (ContainerUtil.WEBSPHERE == type ){
|
||||||
|
return SingleServerMonitoringForWebSphere.getInstance();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public static JMXMonitoring createQueueMonitoring(int type) throws Exception {
|
||||||
|
if(ElinkConfig.isUseInternalQueue()) {
|
||||||
|
return SingleQueueMonitoringForActiveMq.getInstance();
|
||||||
|
}
|
||||||
|
if (ContainerUtil.WEBLOGIC == type ){
|
||||||
|
return SingleQueueMonitoringForWebLogic.getInstance();
|
||||||
|
}else if (ContainerUtil.WEBSPHERE == type ){
|
||||||
|
return SingleQueueMonitoringForWebSphere.getInstance();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
+82
@@ -0,0 +1,82 @@
|
|||||||
|
package com.eactive.eai.rms.client.service.activemq;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.management.ObjectName;
|
||||||
|
|
||||||
|
import org.apache.activemq.broker.BrokerService;
|
||||||
|
import org.apache.activemq.broker.jmx.BrokerViewMBean;
|
||||||
|
import org.apache.activemq.broker.jmx.QueueViewMBean;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.client.service.JMXMonitoring;
|
||||||
|
|
||||||
|
public class SingleQueueMonitoringForActiveMq implements JMXMonitoring {
|
||||||
|
|
||||||
|
private static SingleQueueMonitoringForActiveMq monitoring;
|
||||||
|
|
||||||
|
public static SingleQueueMonitoringForActiveMq getInstance() {
|
||||||
|
if (monitoring == null) {
|
||||||
|
synchronized (SingleQueueMonitoringForActiveMq.class) {
|
||||||
|
if (monitoring == null) {
|
||||||
|
monitoring = new SingleQueueMonitoringForActiveMq();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return monitoring;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Properties properties) throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getState(String instName) throws Exception {
|
||||||
|
LinkedHashMap<String, String[]> result = new LinkedHashMap<String, String[]>();
|
||||||
|
BrokerService brokerService = new BrokerService();
|
||||||
|
brokerService.getManagementContext().setCreateConnector(false);
|
||||||
|
ObjectName brokerViewMBean = null;
|
||||||
|
try {
|
||||||
|
brokerViewMBean = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost");
|
||||||
|
BrokerViewMBean borkerProxy = (BrokerViewMBean) brokerService.getManagementContext()
|
||||||
|
.newProxyInstance(brokerViewMBean, BrokerViewMBean.class, true);
|
||||||
|
ObjectName[] queues = borkerProxy.getQueues();
|
||||||
|
for (ObjectName queue : queues) {
|
||||||
|
QueueViewMBean proxy = (QueueViewMBean) brokerService.getManagementContext().newProxyInstance(queue,
|
||||||
|
QueueViewMBean.class, true);
|
||||||
|
String queueName = proxy.getName();
|
||||||
|
long l = proxy.getQueueSize();
|
||||||
|
result.put(queueName, getCount(queueName, l));
|
||||||
|
}
|
||||||
|
} catch (java.lang.reflect.UndeclaredThrowableException i) {
|
||||||
|
;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String[] getCount(String queueName, long depth) throws Exception {
|
||||||
|
String[] info = new String[9];
|
||||||
|
info[0] = queueName;
|
||||||
|
info[1] = "queue";// jmsDestinationRuntimes[j].getDestinationType();
|
||||||
|
info[2] = "0";// jmsDestinationRuntimes[j].getConsumersCurrentCount();
|
||||||
|
info[3] = "0";// jmsDestinationRuntimes[j].getConsumersHighCount();
|
||||||
|
info[4] = "0";// jmsDestinationRuntimes[j].getConsumersTotalCount();
|
||||||
|
info[5] = Long.toString(depth);
|
||||||
|
info[6] = "0";// jmsDestinationRuntimes[j].getMessagesHighCount();
|
||||||
|
info[7] = "0";// jmsDestinationRuntimes[j].getMessagesPendingCount();
|
||||||
|
info[8] = "0";// jmsDestinationRuntimes[j].getMessagesReceivedCount();
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
SingleQueueMonitoringForActiveMq monitoring = new SingleQueueMonitoringForActiveMq();
|
||||||
|
Properties properties = new Properties();
|
||||||
|
|
||||||
|
monitoring.init(properties);
|
||||||
|
System.out.println(monitoring.getState(""));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+128
@@ -0,0 +1,128 @@
|
|||||||
|
package com.eactive.eai.rms.client.service.weblogic;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Hashtable;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.management.MBeanServerConnection;
|
||||||
|
import javax.management.ObjectName;
|
||||||
|
import javax.management.remote.JMXConnector;
|
||||||
|
import javax.management.remote.JMXConnectorFactory;
|
||||||
|
import javax.management.remote.JMXServiceURL;
|
||||||
|
import javax.naming.Context;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.client.service.JMXMonitoring;
|
||||||
|
|
||||||
|
public class SingleQueueMonitoringForWebLogic implements JMXMonitoring {
|
||||||
|
// private static MBeanServerConnection connection;
|
||||||
|
// private static JMXConnector connector;
|
||||||
|
private String hostname ;
|
||||||
|
private String portString ;
|
||||||
|
private String username ;
|
||||||
|
private String password ;
|
||||||
|
|
||||||
|
|
||||||
|
private static SingleQueueMonitoringForWebLogic monitoring;
|
||||||
|
|
||||||
|
public static SingleQueueMonitoringForWebLogic getInstance(){
|
||||||
|
if(monitoring == null) {
|
||||||
|
synchronized(SingleQueueMonitoringForWebLogic.class) {
|
||||||
|
if(monitoring == null) {
|
||||||
|
monitoring = new SingleQueueMonitoringForWebLogic();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return monitoring;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Properties properties) throws Exception {
|
||||||
|
hostname = properties.getProperty("LOCAL_MBEAN_SERVER_IP");
|
||||||
|
portString = properties.getProperty("LOCAL_MBEAN_SERVER_PORT");
|
||||||
|
username = properties.getProperty("LOCAL_MBEAN_SERVER_ID");
|
||||||
|
password = properties.getProperty("LOCAL_MBEAN_SERVER_PASSWORD");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getState(String instName) throws Exception {
|
||||||
|
LinkedHashMap<String,String[]> result = new LinkedHashMap<String,String[]>();
|
||||||
|
JMXConnector connector = null;
|
||||||
|
MBeanServerConnection connection =null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
String protocol ="t3";
|
||||||
|
Integer portInteger = Integer.valueOf(portString);
|
||||||
|
int port = portInteger.intValue();
|
||||||
|
String jndiroot = "/jndi/";
|
||||||
|
String mserver = "weblogic.management.mbeanservers.domainruntime";
|
||||||
|
JMXServiceURL serviceURL = new JMXServiceURL(protocol, hostname, port, jndiroot + mserver);
|
||||||
|
Hashtable h = new Hashtable();
|
||||||
|
h.put(Context.SECURITY_PRINCIPAL, username);
|
||||||
|
h.put(Context.SECURITY_CREDENTIALS, password);
|
||||||
|
h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "weblogic.management.remote");
|
||||||
|
connector = JMXConnectorFactory.connect(serviceURL,h);
|
||||||
|
connection = connector.getMBeanServerConnection();
|
||||||
|
|
||||||
|
ObjectName serviceRuntime = new ObjectName("com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean,Location="+instName);
|
||||||
|
ObjectName serverRuntime = (ObjectName)connection.getAttribute(serviceRuntime, "ServerRuntime") ;
|
||||||
|
ObjectName jmsRuntime = (ObjectName)connection.getAttribute(serverRuntime, "JMSRuntime") ;
|
||||||
|
ObjectName[] jmsServers = (ObjectName[])connection.getAttribute(jmsRuntime, "JMSServers") ;
|
||||||
|
|
||||||
|
HashMap<String,Long> queue = new HashMap<String,Long>();
|
||||||
|
|
||||||
|
for(ObjectName jmsServer : jmsServers){
|
||||||
|
String name = jmsServer.getKeyProperty("Name");
|
||||||
|
if (name == null) continue;
|
||||||
|
|
||||||
|
if(name.startsWith("JMSServer")){
|
||||||
|
ObjectName[] destinations = (ObjectName[])connection.getAttribute(jmsServer, "Destinations");
|
||||||
|
for(ObjectName destination : destinations){
|
||||||
|
String queueName = destination.getKeyProperty("Name");
|
||||||
|
if (queueName.contains("!")){
|
||||||
|
queueName = queueName.substring(queueName.indexOf("!")+1);
|
||||||
|
}
|
||||||
|
if (queueName.contains("Topic")) continue;
|
||||||
|
|
||||||
|
Long queueDepth = (Long) connection.getAttribute(destination, "MessagesCurrentCount");
|
||||||
|
queue.put(queueName, queueDepth);
|
||||||
|
// System.out.println("Queue : " + queueName +" Depth : " + queueDepth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(String queueName : queue.keySet()){
|
||||||
|
result.put(queueName, getCount(queueName, queue.get(queueName) ));
|
||||||
|
}
|
||||||
|
}finally{
|
||||||
|
if (connector != null){try{connector.close();}catch(Exception e){}}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
private String[] getCount(String queueName, long depth) throws Exception{
|
||||||
|
String[] info = new String[9];
|
||||||
|
info[0] = queueName;
|
||||||
|
info[1] = "queue";//jmsDestinationRuntimes[j].getDestinationType();
|
||||||
|
info[2] = "0";//jmsDestinationRuntimes[j].getConsumersCurrentCount();
|
||||||
|
info[3] = "0";//jmsDestinationRuntimes[j].getConsumersHighCount();
|
||||||
|
info[4] = "0";//jmsDestinationRuntimes[j].getConsumersTotalCount();
|
||||||
|
info[5] = Long.toString(depth);
|
||||||
|
info[6] = "0";//jmsDestinationRuntimes[j].getMessagesHighCount();
|
||||||
|
info[7] = "0";//jmsDestinationRuntimes[j].getMessagesPendingCount();
|
||||||
|
info[8] = "0";//jmsDestinationRuntimes[j].getMessagesReceivedCount();
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
public static void main(String[] args)throws Exception{
|
||||||
|
SingleQueueMonitoringForWebLogic monitoring = new SingleQueueMonitoringForWebLogic();
|
||||||
|
Properties properties = new Properties();
|
||||||
|
properties.put("LOCAL_MBEAN_SERVER_IP", "172.16.131.11");
|
||||||
|
properties.put("LOCAL_MBEAN_SERVER_PORT", "30100");
|
||||||
|
properties.put("LOCAL_MBEAN_SERVER_ID", "epostadm");
|
||||||
|
properties.put("LOCAL_MBEAN_SERVER_PASSWORD", "welcome1!");
|
||||||
|
|
||||||
|
monitoring.init(properties);
|
||||||
|
System.out.println(monitoring.getState("mccSvr11"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+91
@@ -0,0 +1,91 @@
|
|||||||
|
package com.eactive.eai.rms.client.service.weblogic;
|
||||||
|
|
||||||
|
import java.util.Hashtable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.management.MBeanServerConnection;
|
||||||
|
import javax.management.ObjectName;
|
||||||
|
import javax.management.remote.JMXConnector;
|
||||||
|
import javax.management.remote.JMXConnectorFactory;
|
||||||
|
import javax.management.remote.JMXServiceURL;
|
||||||
|
import javax.naming.Context;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.client.service.JMXMonitoring;
|
||||||
|
|
||||||
|
public class SingleServerMonitoringForWebLogic implements JMXMonitoring {
|
||||||
|
// private static MBeanServerConnection connection;
|
||||||
|
// private static JMXConnector connector;
|
||||||
|
private String hostname ;
|
||||||
|
private String portString ;
|
||||||
|
private String username ;
|
||||||
|
private String password ;
|
||||||
|
|
||||||
|
private static SingleServerMonitoringForWebLogic monitoring;
|
||||||
|
|
||||||
|
public static SingleServerMonitoringForWebLogic getInstance(){
|
||||||
|
if(monitoring == null) {
|
||||||
|
synchronized(SingleServerMonitoringForWebLogic.class) {
|
||||||
|
if(monitoring == null) {
|
||||||
|
monitoring = new SingleServerMonitoringForWebLogic();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return monitoring;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Properties properties) throws Exception {
|
||||||
|
hostname = properties.getProperty("LOCAL_MBEAN_SERVER_IP");
|
||||||
|
portString = properties.getProperty("LOCAL_MBEAN_SERVER_PORT");
|
||||||
|
username = properties.getProperty("LOCAL_MBEAN_SERVER_ID");
|
||||||
|
password = properties.getProperty("LOCAL_MBEAN_SERVER_PASSWORD");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getState(String instName) throws Exception {
|
||||||
|
JMXConnector connector = null;
|
||||||
|
MBeanServerConnection connection =null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
String protocol ="t3";
|
||||||
|
Integer portInteger = Integer.valueOf(portString);
|
||||||
|
int port = portInteger.intValue();
|
||||||
|
String jndiroot = "/jndi/";
|
||||||
|
String mserver = "weblogic.management.mbeanservers.domainruntime";
|
||||||
|
JMXServiceURL serviceURL = new JMXServiceURL(protocol, hostname, port, jndiroot + mserver);
|
||||||
|
Hashtable h = new Hashtable();
|
||||||
|
h.put(Context.SECURITY_PRINCIPAL, username);
|
||||||
|
h.put(Context.SECURITY_CREDENTIALS, password);
|
||||||
|
h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "weblogic.management.remote");
|
||||||
|
connector = JMXConnectorFactory.connect(serviceURL,h);
|
||||||
|
connection = connector.getMBeanServerConnection();
|
||||||
|
|
||||||
|
|
||||||
|
ObjectName service = new ObjectName("com.bea:Name=DomainRuntimeService,Type=weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean");
|
||||||
|
ObjectName[] servers = (ObjectName[])connection.getAttribute(service, "ServerRuntimes");
|
||||||
|
for(ObjectName server : servers){
|
||||||
|
String name = server.getKeyProperty("Name");
|
||||||
|
if (name == null) continue;
|
||||||
|
if (name.equals(instName)){
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}finally{
|
||||||
|
if (connector != null){try{connector.close();}catch(Exception e){}}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
public static void main(String[] args)throws Exception{
|
||||||
|
SingleServerMonitoringForWebLogic monitoring = new SingleServerMonitoringForWebLogic();
|
||||||
|
Properties properties = new Properties();
|
||||||
|
properties.put("LOCAL_MBEAN_SERVER_IP", "172.16.131.21");
|
||||||
|
properties.put("LOCAL_MBEAN_SERVER_PORT", "30100");
|
||||||
|
properties.put("LOCAL_MBEAN_SERVER_ID", "epostadm");
|
||||||
|
properties.put("LOCAL_MBEAN_SERVER_PASSWORD", "welcome1!");
|
||||||
|
|
||||||
|
monitoring.init(properties);
|
||||||
|
System.out.println(monitoring.getState("mcuSvr11"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+191
@@ -0,0 +1,191 @@
|
|||||||
|
package com.eactive.eai.rms.client.service.websphere;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.client.service.JMXMonitoring;
|
||||||
|
|
||||||
|
//import java.security.PrivilegedAction;
|
||||||
|
//import java.util.Collections;
|
||||||
|
//import java.util.Comparator;
|
||||||
|
//import java.util.HashMap;
|
||||||
|
//import java.util.Iterator;
|
||||||
|
//import java.util.LinkedHashMap;
|
||||||
|
//import java.util.List;
|
||||||
|
//import java.util.Properties;
|
||||||
|
//import java.util.Set;
|
||||||
|
//import java.util.stream.Collectors;
|
||||||
|
//
|
||||||
|
//import javax.management.Attribute;
|
||||||
|
//import javax.management.AttributeList;
|
||||||
|
//import javax.management.ObjectName;
|
||||||
|
//import javax.security.auth.Subject;
|
||||||
|
//import javax.security.auth.callback.CallbackHandler;
|
||||||
|
//import javax.security.auth.login.LoginContext;
|
||||||
|
//
|
||||||
|
//import com.ibm.websphere.management.AdminClient;
|
||||||
|
//import com.ibm.websphere.management.AdminClientFactory;
|
||||||
|
//import com.ibm.websphere.security.auth.WSSubject;
|
||||||
|
//import com.ibm.websphere.security.auth.callback.WSCallbackHandlerImpl;
|
||||||
|
//
|
||||||
|
public class SingleQueueMonitoringForWebSphere implements JMXMonitoring{
|
||||||
|
// public static AdminClient ac = null;
|
||||||
|
//
|
||||||
|
// private static Boolean isSubjectLogin ;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// private static Properties properties ;
|
||||||
|
private static SingleQueueMonitoringForWebSphere monitoring;
|
||||||
|
public static SingleQueueMonitoringForWebSphere getInstance(){
|
||||||
|
if(monitoring == null) {
|
||||||
|
synchronized(SingleQueueMonitoringForWebSphere.class) {
|
||||||
|
if(monitoring == null) {
|
||||||
|
monitoring = new SingleQueueMonitoringForWebSphere();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return monitoring;
|
||||||
|
}
|
||||||
|
|
||||||
|
private SingleQueueMonitoringForWebSphere() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(Properties properties) throws Exception {
|
||||||
|
// if (ac == null) {
|
||||||
|
// synchronized(SingleQueueMonitoring.class){
|
||||||
|
// this.properties = properties;
|
||||||
|
// Object obj = properties.get("isSubjectLogin");
|
||||||
|
// if (obj == null){
|
||||||
|
// this.isSubjectLogin = false;
|
||||||
|
// }else {
|
||||||
|
// if (obj instanceof String){
|
||||||
|
// this.isSubjectLogin = Boolean.parseBoolean((String)obj);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (ac== null){
|
||||||
|
// ac = AdminClientFactory.createAdminClient(properties);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
// private static Object doAsAdmin(PrivilegedAction action) throws Exception {
|
||||||
|
// return WSSubject.doAs(getLoginSubject(), action);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private static Subject getLoginSubject() throws Exception {
|
||||||
|
// CallbackHandler callbackHandler = new WSCallbackHandlerImpl(properties.getProperty(AdminClient.USERNAME), null,
|
||||||
|
// properties.getProperty(AdminClient.PASSWORD));
|
||||||
|
// LoginContext loginContext;
|
||||||
|
// try {
|
||||||
|
// loginContext = new LoginContext("WSLogin", callbackHandler);
|
||||||
|
// loginContext.login();
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// throw new RuntimeException(e.getMessage());
|
||||||
|
// }
|
||||||
|
// return loginContext.getSubject();
|
||||||
|
// }
|
||||||
|
// private Set<ObjectName> getQueueListObjectNames(String serverName) throws Exception {
|
||||||
|
// final ObjectName objectName = new ObjectName("WebSphere:type=SIBQueuePoint,process="+serverName+",*");
|
||||||
|
//// final QueryExp queryExp = Query.eq(Query.attr("process"), Query.value(serverName));
|
||||||
|
//
|
||||||
|
// PrivilegedAction action = new PrivilegedAction(){
|
||||||
|
// @Override
|
||||||
|
// public Object run() {
|
||||||
|
// try {
|
||||||
|
// return ac.queryNames(objectName, null);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// //e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// Set<ObjectName> objectNameSet = null;
|
||||||
|
// if(isSubjectLogin){
|
||||||
|
// objectNameSet = (Set) doAsAdmin(action);
|
||||||
|
// }else{
|
||||||
|
// objectNameSet = (Set) action.run();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return objectNameSet;
|
||||||
|
// }
|
||||||
|
// private HashMap<String,String[]> getCount(ObjectName objectName) throws Exception{
|
||||||
|
// String process = objectName.getKeyProperty("process");
|
||||||
|
// String name = objectName.getKeyProperty("name").replaceAll("."+process, "");
|
||||||
|
//
|
||||||
|
// HashMap<String,String[]> result = new HashMap<String,String[]>();
|
||||||
|
// PrivilegedAction action = new PrivilegedAction(){
|
||||||
|
// @Override
|
||||||
|
// public Object run() {
|
||||||
|
// try {
|
||||||
|
// return ac.getAttributes(objectName, new String[] { "depth" });
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// //e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// AttributeList attrList = null;
|
||||||
|
// if(isSubjectLogin){
|
||||||
|
// attrList = (AttributeList) doAsAdmin(action);
|
||||||
|
// }else{
|
||||||
|
// attrList = (AttributeList) action.run();
|
||||||
|
// }
|
||||||
|
// if (attrList == null){
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
// Iterator it = attrList.iterator();
|
||||||
|
// while(it.hasNext()){
|
||||||
|
// Attribute a = (Attribute)it.next();
|
||||||
|
// if ("depth".equals(a.getName())){
|
||||||
|
// if (a.getValue() instanceof Long ){
|
||||||
|
// Long l = (Long)a.getValue();
|
||||||
|
// String[] info = new String[9];
|
||||||
|
// info[0] = name;
|
||||||
|
// info[1] = "queue";//jmsDestinationRuntimes[j].getDestinationType();
|
||||||
|
// info[2] = "0";//jmsDestinationRuntimes[j].getConsumersCurrentCount();
|
||||||
|
// info[3] = "0";//jmsDestinationRuntimes[j].getConsumersHighCount();
|
||||||
|
// info[4] = "0";//jmsDestinationRuntimes[j].getConsumersTotalCount();
|
||||||
|
// info[5] = Long.toString(l);
|
||||||
|
// info[6] = "0";//jmsDestinationRuntimes[j].getMessagesHighCount();
|
||||||
|
// info[7] = "0";//jmsDestinationRuntimes[j].getMessagesPendingCount();
|
||||||
|
// info[8] = "0";//jmsDestinationRuntimes[j].getMessagesReceivedCount();
|
||||||
|
// result.put(name, info);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
public Object getState(String serverName) throws Exception {
|
||||||
|
LinkedHashMap<String,String[]> result = new LinkedHashMap<String,String[]>();
|
||||||
|
// Set<ObjectName> objectNames = getQueueListObjectNames(serverName);
|
||||||
|
// if (objectNames == null){
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// List<ObjectName> list = objectNames.stream().collect(Collectors.toList());
|
||||||
|
// Collections.sort(list, new Comparator<ObjectName>() {
|
||||||
|
// @Override
|
||||||
|
// public int compare(ObjectName o1, ObjectName o2) {
|
||||||
|
// String s1 = (String) o1.getKeyProperty("name");
|
||||||
|
// String s2 = (String) o2.getKeyProperty("name");
|
||||||
|
// return s1.compareTo(s2);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// for(ObjectName objectName : list){
|
||||||
|
// String name = objectName.getKeyProperty("name");
|
||||||
|
// if (name.startsWith("_")){
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// HashMap<String,String[]> m = getCount(objectName);
|
||||||
|
// result.putAll(m);
|
||||||
|
// }
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+184
@@ -0,0 +1,184 @@
|
|||||||
|
package com.eactive.eai.rms.client.service.websphere;
|
||||||
|
|
||||||
|
//import java.security.PrivilegedAction;
|
||||||
|
//import java.util.Iterator;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.management.ObjectName;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.client.service.JMXMonitoring;
|
||||||
|
//import java.util.Set;
|
||||||
|
//
|
||||||
|
//import javax.management.Attribute;
|
||||||
|
//import javax.management.AttributeList;
|
||||||
|
//import javax.management.ObjectName;
|
||||||
|
//import javax.management.Query;
|
||||||
|
//import javax.management.QueryExp;
|
||||||
|
//import javax.security.auth.Subject;
|
||||||
|
//import javax.security.auth.callback.CallbackHandler;
|
||||||
|
//import javax.security.auth.login.LoginContext;
|
||||||
|
//
|
||||||
|
//import com.ibm.websphere.management.AdminClient;
|
||||||
|
//import com.ibm.websphere.management.AdminClientFactory;
|
||||||
|
//import com.ibm.websphere.security.auth.WSSubject;
|
||||||
|
//import com.ibm.websphere.security.auth.callback.WSCallbackHandlerImpl;
|
||||||
|
//
|
||||||
|
public class SingleServerMonitoringForWebSphere implements JMXMonitoring {
|
||||||
|
// public static AdminClient ac = null;
|
||||||
|
//
|
||||||
|
// private static Boolean isSubjectLogin ;
|
||||||
|
// private static Properties properties ;
|
||||||
|
|
||||||
|
private static SingleServerMonitoringForWebSphere monitoring;
|
||||||
|
|
||||||
|
public static SingleServerMonitoringForWebSphere getInstance(){
|
||||||
|
if(monitoring == null) {
|
||||||
|
synchronized(SingleServerMonitoringForWebSphere.class) {
|
||||||
|
if(monitoring == null) {
|
||||||
|
monitoring = new SingleServerMonitoringForWebSphere();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return monitoring;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(Properties properties) throws Exception {
|
||||||
|
// if (ac == null) {
|
||||||
|
// synchronized(SingleServerMonitoring.class){
|
||||||
|
// this.properties = properties;
|
||||||
|
// Object obj = properties.get("isSubjectLogin");
|
||||||
|
// if (obj == null){
|
||||||
|
// this.isSubjectLogin = false;
|
||||||
|
// }else {
|
||||||
|
// if (obj instanceof String){
|
||||||
|
// this.isSubjectLogin = Boolean.parseBoolean((String)obj);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (ac== null){
|
||||||
|
// ac = AdminClientFactory.createAdminClient(properties);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
// private static Object doAsAdmin(PrivilegedAction action) throws Exception {
|
||||||
|
// return WSSubject.doAs(getLoginSubject(), action);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private static Subject getLoginSubject() throws Exception {
|
||||||
|
// CallbackHandler callbackHandler = new WSCallbackHandlerImpl(properties.getProperty(AdminClient.USERNAME), null,
|
||||||
|
// properties.getProperty(AdminClient.PASSWORD));
|
||||||
|
// LoginContext loginContext;
|
||||||
|
// try {
|
||||||
|
// loginContext = new LoginContext("WSLogin", callbackHandler);
|
||||||
|
// loginContext.login();
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// throw new RuntimeException(e.getMessage());
|
||||||
|
// }
|
||||||
|
// return loginContext.getSubject();
|
||||||
|
// }
|
||||||
|
// private ObjectName getServerObjectNames(String serverName) throws Exception {
|
||||||
|
// final ObjectName objectName = new ObjectName("WebSphere:type=Server,*");
|
||||||
|
// final QueryExp queryExp = Query.eq(Query.attr("name"), Query.value(serverName));
|
||||||
|
//
|
||||||
|
// PrivilegedAction action = new PrivilegedAction(){
|
||||||
|
// @Override
|
||||||
|
// public Object run() {
|
||||||
|
// try {
|
||||||
|
// return ac.queryNames(objectName, queryExp);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// //e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// Set<ObjectName> objectNameSet = null;
|
||||||
|
// if(isSubjectLogin){
|
||||||
|
// objectNameSet = (Set) doAsAdmin(action);
|
||||||
|
// }else{
|
||||||
|
// objectNameSet = (Set) action.run();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (objectNameSet != null) {
|
||||||
|
// for(ObjectName o : objectNameSet){
|
||||||
|
// return o;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// private int getServerStatus(ObjectName objectName) throws Exception{
|
||||||
|
// PrivilegedAction action = new PrivilegedAction(){
|
||||||
|
// @Override
|
||||||
|
// public Object run() {
|
||||||
|
// try {
|
||||||
|
// return ac.getAttributes(objectName, new String[] { "state" });
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// //e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// AttributeList attrList = null;
|
||||||
|
// if(isSubjectLogin){
|
||||||
|
// attrList = (AttributeList) doAsAdmin(action);
|
||||||
|
// }else{
|
||||||
|
// attrList = (AttributeList) action.run();
|
||||||
|
// }
|
||||||
|
// if (attrList == null){
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
// Iterator it = attrList.iterator();
|
||||||
|
// while(it.hasNext()){
|
||||||
|
// Attribute a = (Attribute)it.next();
|
||||||
|
// if ("state".equals(a.getName())){
|
||||||
|
// if (a.getValue() instanceof String ){
|
||||||
|
// if ("STARTED".equals((String)a.getValue())){
|
||||||
|
// return 2;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
public Object getState(String serverName) throws Exception {
|
||||||
|
// ObjectName objectName = getServerObjectNames(serverName);
|
||||||
|
// if (objectName == null){
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
// try{
|
||||||
|
// return getServerStatus(objectName);
|
||||||
|
// }catch(Exception e){
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static void main(String[] args) throws Exception{
|
||||||
|
// String serverIp = "192.168.68.21"; //개발서버-일괄
|
||||||
|
// String port = "9809";//RMI // 관리콘솔 -> System administration -> Deployment manager -> Ports -> Bootstrap Address
|
||||||
|
// String loginId = "wasadm"; // 관리콘솔 로그인 ID
|
||||||
|
// String password = "system01"; // 콴리콘솔 로그인 PASSWORD
|
||||||
|
//
|
||||||
|
// Properties props = new Properties();
|
||||||
|
// props.put(AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_RMI);
|
||||||
|
// props.put(AdminClient.CONNECTOR_SECURITY_ENABLED, false);
|
||||||
|
// props.put(AdminClient.CONNECTOR_HOST, serverIp);
|
||||||
|
// props.put(AdminClient.CONNECTOR_PORT, port);
|
||||||
|
// props.put(AdminClient.USERNAME, loginId);
|
||||||
|
// props.put(AdminClient.PASSWORD, password);
|
||||||
|
// props.put("isSubjectLogin", false);
|
||||||
|
//
|
||||||
|
// SingleServerMonitoring m = new SingleServerMonitoring().getInstance();
|
||||||
|
// m.init(props);
|
||||||
|
//
|
||||||
|
// System.out.println(m.getState("EAIDS02_i01"));
|
||||||
|
//
|
||||||
|
// SingleServerMonitoring m2 = new SingleServerMonitoring().getInstance();
|
||||||
|
// m2.init(props);
|
||||||
|
// System.out.println(m.getState("EAIBS01_i01"));
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
+97
@@ -0,0 +1,97 @@
|
|||||||
|
package com.eactive.eai.rms.client.util;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.FactoryBean;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.client.context.RmsProperties;
|
||||||
|
//import com.ibm.websphere.management.AdminClient;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class MBeanServerFactoryBeanUtil.
|
||||||
|
* <ul>
|
||||||
|
* <li>1. Function :WebLogic의 MBeanServer를 생성 합니다. </li>
|
||||||
|
* <li>2. Summary :</li>
|
||||||
|
* <li>3. Notification :</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @author : $Author: amjang $
|
||||||
|
* @version : $Revision: 1.3 $
|
||||||
|
*/
|
||||||
|
public class AdminClinetPropertiesFactoryBeanUtil implements FactoryBean, InitializingBean {
|
||||||
|
|
||||||
|
/** F/W logger. */
|
||||||
|
private static com.eactive.eai.common.util.Logger logger = com.eactive.eai.common.util.Logger.getLogger(com.eactive.eai.common.util.Logger.LOGGER_CLIENT);
|
||||||
|
|
||||||
|
|
||||||
|
/** The monitoring properties. */
|
||||||
|
private RmsProperties rmsProperties;
|
||||||
|
|
||||||
|
/** The properties. */
|
||||||
|
private Properties properties = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the monitoring properties.
|
||||||
|
*
|
||||||
|
* @param rmsProperties the new monitoring properties
|
||||||
|
*/
|
||||||
|
public void setRmsProperties(RmsProperties rmsProperties) {
|
||||||
|
this.rmsProperties = rmsProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void afterPropertiesSet() {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inits the.
|
||||||
|
*/
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
try {
|
||||||
|
String serverIp = rmsProperties.getStringProperty(RmsProperties.LOCAL_MBEAN_SERVER_IP);
|
||||||
|
String port = rmsProperties.getStringProperty(RmsProperties.LOCAL_MBEAN_SERVER_PORT);
|
||||||
|
String loginId = rmsProperties.getStringProperty(RmsProperties.LOCAL_MBEAN_SERVER_ID);
|
||||||
|
String password = rmsProperties.getStringProperty(RmsProperties.LOCAL_MBEAN_SERVER_PASSWORD);
|
||||||
|
String subjectLogin = rmsProperties.getStringProperty(RmsProperties.SUBJECT_LOGIN);
|
||||||
|
|
||||||
|
Properties props = new Properties();
|
||||||
|
if (ContainerUtil.get() == ContainerUtil.WEBSPHERE ){
|
||||||
|
// props.put(AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_RMI);
|
||||||
|
// props.put(AdminClient.CONNECTOR_SECURITY_ENABLED, ""+false);
|
||||||
|
// props.put(AdminClient.CONNECTOR_HOST, serverIp);
|
||||||
|
// props.put(AdminClient.CONNECTOR_PORT, port);
|
||||||
|
// props.put(AdminClient.USERNAME, loginId);
|
||||||
|
// props.put(AdminClient.PASSWORD, password);
|
||||||
|
props.put("isSubjectLogin", subjectLogin);
|
||||||
|
|
||||||
|
}else if (ContainerUtil.get() == ContainerUtil.WEBLOGIC ){
|
||||||
|
props.put(RmsProperties.LOCAL_MBEAN_SERVER_IP, serverIp);
|
||||||
|
props.put(RmsProperties.LOCAL_MBEAN_SERVER_PORT, port);
|
||||||
|
props.put(RmsProperties.LOCAL_MBEAN_SERVER_ID, loginId);
|
||||||
|
props.put(RmsProperties.LOCAL_MBEAN_SERVER_PASSWORD, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.properties = props;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("Could not make AdminClient Properties : " + e.getMessage(),e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Object getObject() {
|
||||||
|
return this.properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Class<Properties> getObjectType() {
|
||||||
|
return Properties.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSingleton() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.eactive.eai.rms.client.util;
|
||||||
|
|
||||||
|
public interface CommandParser {
|
||||||
|
|
||||||
|
public Object parse(String string);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package com.eactive.eai.rms.client.util;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
|
|
||||||
|
public class CommandUtils {
|
||||||
|
|
||||||
|
/** F/W logger. */
|
||||||
|
private static com.eactive.eai.common.util.Logger logger = com.eactive.eai.common.util.Logger.getLogger(com.eactive.eai.common.util.Logger.LOGGER_CLIENT);
|
||||||
|
|
||||||
|
|
||||||
|
public static Object processExec(String[] command, CommandParser parser) {
|
||||||
|
|
||||||
|
if (logger.isDebugEnabled()) {
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder("command를 실행 합니다. command : ");
|
||||||
|
for (int i = 0; i < command.length; i++) {
|
||||||
|
sb.append(command[i]).append(",");
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.debug(sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
String lineStr = null;
|
||||||
|
BufferedReader br = null;
|
||||||
|
Process process = null;
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
InputStreamReader inputStreamReader = null;
|
||||||
|
InputStream inputStream = null;
|
||||||
|
|
||||||
|
Object result = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
process = new ProcessBuilder(command).start();
|
||||||
|
|
||||||
|
inputStream = process.getInputStream();
|
||||||
|
inputStreamReader = new InputStreamReader(inputStream);
|
||||||
|
|
||||||
|
br = new BufferedReader(new InputStreamReader(
|
||||||
|
process.getInputStream()));
|
||||||
|
|
||||||
|
process.waitFor();
|
||||||
|
|
||||||
|
while ((lineStr = br.readLine()) != null) {
|
||||||
|
sb.append(lineStr).append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
result = parser.parse(sb.toString().trim());
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn("command 실행 도중 에러 발생 : " + e.getMessage());
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
if (inputStream != null) {
|
||||||
|
try {
|
||||||
|
inputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (inputStreamReader != null) {
|
||||||
|
try {
|
||||||
|
inputStreamReader.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (br != null) {
|
||||||
|
try {
|
||||||
|
br.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (process != null) {
|
||||||
|
try {
|
||||||
|
process.destroy();
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
package com.eactive.eai.rms.client.util;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.eactive.eai.common.server.Keys;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class ContainerUtil.
|
||||||
|
* <ul>
|
||||||
|
* <li>1. Function :현재 기동되는 컨테이너를 식별 합니다. </li>
|
||||||
|
* <li>2. Summary :</li>
|
||||||
|
* <li>3. Notification :</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @author : $Author: 박기섭 $
|
||||||
|
* @version : $Revision: 1.3 $
|
||||||
|
*/
|
||||||
|
public class ContainerUtil {
|
||||||
|
|
||||||
|
/** The Constant UNKNOWN. */
|
||||||
|
public static final int UNKNOWN = 0;
|
||||||
|
|
||||||
|
/** The Constant TOMCAT. */
|
||||||
|
public static final int TOMCAT = 1;
|
||||||
|
|
||||||
|
/** The Constant RESIN. */
|
||||||
|
public static final int RESIN = 2;
|
||||||
|
|
||||||
|
/** The Constant ORION. */
|
||||||
|
public static final int ORION = 3;
|
||||||
|
|
||||||
|
/** The Constant OC4J. */
|
||||||
|
public static final int OC4J = 3;
|
||||||
|
|
||||||
|
/** The Constant ORACLE_AS. */
|
||||||
|
public static final int ORACLE_AS = 3;
|
||||||
|
|
||||||
|
/** The Constant WEBLOGIC. */
|
||||||
|
public static final int WEBLOGIC = 4;
|
||||||
|
|
||||||
|
/** The Constant HPAS. */
|
||||||
|
public static final int HPAS = 5;
|
||||||
|
|
||||||
|
/** The Constant JRUN. */
|
||||||
|
public static final int JRUN = 6;
|
||||||
|
|
||||||
|
/** The Constant WEBSPHERE. */
|
||||||
|
public static final int WEBSPHERE = 7;
|
||||||
|
|
||||||
|
/** The Constant JEUS. */
|
||||||
|
public static final int JEUS = 8;
|
||||||
|
|
||||||
|
/** The result. */
|
||||||
|
private static int result;
|
||||||
|
|
||||||
|
/** The Constant containerString. */
|
||||||
|
private static final Map<String, String> containerString = new HashMap<String, String>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
|
||||||
|
initServerString();
|
||||||
|
|
||||||
|
String weblogic = System.getProperty(Keys.SERVER_KEY);
|
||||||
|
String tomcat = System.getProperty("server.loader");
|
||||||
|
String jeus = System.getProperty("jeus.home");
|
||||||
|
|
||||||
|
if (tomcat != null && tomcat.startsWith("${catalina.home}")) {
|
||||||
|
result = TOMCAT;
|
||||||
|
} else if (weblogic != null && !weblogic.trim().equals("")) {
|
||||||
|
result = WEBLOGIC;
|
||||||
|
} else if (jeus != null && !jeus.trim().equals("")) {
|
||||||
|
result = JEUS;
|
||||||
|
} else {
|
||||||
|
result = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inits the server string.
|
||||||
|
*/
|
||||||
|
private static void initServerString() {
|
||||||
|
containerString.put(String.valueOf(TOMCAT), "TOMCAT");
|
||||||
|
containerString.put(String.valueOf(WEBLOGIC), "WEBLOGIC");
|
||||||
|
containerString.put(String.valueOf(JEUS), "JEUS");
|
||||||
|
containerString.put(String.valueOf(ORACLE_AS), "ORACLE_AS");
|
||||||
|
containerString.put(String.valueOf(WEBSPHERE), "WEBSPHERE");
|
||||||
|
containerString.put(String.valueOf(UNKNOWN), "UNKNOWN");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the string.
|
||||||
|
*
|
||||||
|
* @param container the container
|
||||||
|
*
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
public static String getString(int container) {
|
||||||
|
return (String) containerString.get(String.valueOf(container));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the string.
|
||||||
|
*
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
public static String getString() {
|
||||||
|
return getString(get());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Container.
|
||||||
|
*
|
||||||
|
* 다음과 같은 형태로 사용 합니다. {@code
|
||||||
|
* if (ContainerUtil.get() == ContainerUtil.WEBLOGIC) {
|
||||||
|
* ...
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @return int Container
|
||||||
|
*/
|
||||||
|
public static int get() {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,260 @@
|
|||||||
|
package com.eactive.eai.rms.client.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class QueryBuffer.
|
||||||
|
* StringBuilder 이다. Query를 작성시 사용한다. StringBuffer와 같다. append 시 뒤에 \n 를 추가해준다.
|
||||||
|
* <ul>
|
||||||
|
* <li>1. Function :</li>
|
||||||
|
* <li>2. Summary :</li>
|
||||||
|
* <li>3. Notification :</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @author : $Author: 박기섭 $
|
||||||
|
* @version : $Revision: 1.2 $
|
||||||
|
*/
|
||||||
|
public class QueryBuffer {
|
||||||
|
|
||||||
|
/** The sb buffer. */
|
||||||
|
private StringBuilder sbBuffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new query buffer.
|
||||||
|
*/
|
||||||
|
public QueryBuffer() {
|
||||||
|
sbBuffer = new StringBuilder(2048);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new query buffer.
|
||||||
|
*
|
||||||
|
* @param sQuery the s query
|
||||||
|
*/
|
||||||
|
public QueryBuffer(String sQuery) {
|
||||||
|
sbBuffer = new StringBuilder(2048);
|
||||||
|
sbBuffer.append(sQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new query buffer.
|
||||||
|
*
|
||||||
|
* @param length the length
|
||||||
|
*/
|
||||||
|
public QueryBuffer(int length) {
|
||||||
|
sbBuffer = new StringBuilder(length);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 해당 쿼리를 page 가능하게 바꿔준다.
|
||||||
|
*
|
||||||
|
* @param currentPage :
|
||||||
|
* 현재 가져오려는 page
|
||||||
|
* @param pageSize :
|
||||||
|
* 한번에 보여지는 page size
|
||||||
|
*
|
||||||
|
* @return paging 된 쿼리
|
||||||
|
*
|
||||||
|
* @throws Exception *
|
||||||
|
*/
|
||||||
|
public String getPagingQuery(int currentPage, int pageSize) {
|
||||||
|
|
||||||
|
QueryBuffer pagingQuery = new QueryBuffer();
|
||||||
|
|
||||||
|
if (currentPage == 0) {
|
||||||
|
currentPage = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pageSize == 0) {
|
||||||
|
pageSize = 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 첫번째 페이지[currentPage:1] firstRow : 1 lastRow : pageSize
|
||||||
|
*
|
||||||
|
* 두번째 페이지[currentPage:2] firstRow : pageSize + 1 lastRow : 2 * pageSize
|
||||||
|
*/
|
||||||
|
int firstRow = pageSize * (currentPage - 1) + 1;
|
||||||
|
int lastRow = firstRow + pageSize - 1;
|
||||||
|
pagingQuery.append("SELECT * ");
|
||||||
|
pagingQuery.append("FROM ( ");
|
||||||
|
pagingQuery.append(" SELECT A.*, ROWNUM AS R ");
|
||||||
|
pagingQuery.append(" FROM ( ");
|
||||||
|
pagingQuery.append(this);
|
||||||
|
pagingQuery.append(" ) A ");
|
||||||
|
pagingQuery.append(" WHERE ROWNUM <= ").append(
|
||||||
|
String.valueOf(lastRow));
|
||||||
|
pagingQuery.append(" ) B ");
|
||||||
|
pagingQuery.append("WHERE R >= ").append(String.valueOf(firstRow));
|
||||||
|
|
||||||
|
return pagingQuery.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the paging query.
|
||||||
|
*
|
||||||
|
* @param currentPage the current page
|
||||||
|
*
|
||||||
|
* @return String - 페이징 적용된 쿼리
|
||||||
|
*/
|
||||||
|
public String getPagingQuery(int currentPage) {
|
||||||
|
return getPagingQuery(currentPage, 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete.
|
||||||
|
*
|
||||||
|
* @param start the start
|
||||||
|
* @param end the end
|
||||||
|
*/
|
||||||
|
public void delete(int start, int end) {
|
||||||
|
this.sbBuffer.delete(start, end);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Length.
|
||||||
|
*
|
||||||
|
* @return the int
|
||||||
|
*/
|
||||||
|
public int length() {
|
||||||
|
return this.sbBuffer.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append.
|
||||||
|
*
|
||||||
|
* @param sQuery the s query
|
||||||
|
*
|
||||||
|
* @return the query buffer
|
||||||
|
*/
|
||||||
|
public QueryBuffer append(String sQuery) {
|
||||||
|
sbBuffer.append(" \n").append(sQuery);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append.
|
||||||
|
*
|
||||||
|
* @param sQuery the s query
|
||||||
|
*
|
||||||
|
* @return the query buffer
|
||||||
|
*/
|
||||||
|
public QueryBuffer append(int sQuery) {
|
||||||
|
sbBuffer.append(sQuery);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append.
|
||||||
|
*
|
||||||
|
* @param sQuery the s query
|
||||||
|
*
|
||||||
|
* @return the query buffer
|
||||||
|
*/
|
||||||
|
public QueryBuffer append(long sQuery) {
|
||||||
|
sbBuffer.append(sQuery);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append.
|
||||||
|
*
|
||||||
|
* @param sQuery the s query
|
||||||
|
*
|
||||||
|
* @return the query buffer
|
||||||
|
*/
|
||||||
|
public QueryBuffer append(char sQuery) {
|
||||||
|
sbBuffer.append(sQuery);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append.
|
||||||
|
*
|
||||||
|
* @param sQuery the s query
|
||||||
|
*
|
||||||
|
* @return the query buffer
|
||||||
|
*/
|
||||||
|
public QueryBuffer append(char[] sQuery) {
|
||||||
|
sbBuffer.append(sQuery);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append.
|
||||||
|
*
|
||||||
|
* @param sQuery the s query
|
||||||
|
*
|
||||||
|
* @return the query buffer
|
||||||
|
*/
|
||||||
|
public QueryBuffer append(double sQuery) {
|
||||||
|
sbBuffer.append(sQuery);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append.
|
||||||
|
*
|
||||||
|
* @param sQuery the s query
|
||||||
|
*
|
||||||
|
* @return the query buffer
|
||||||
|
*/
|
||||||
|
public QueryBuffer append(boolean sQuery) {
|
||||||
|
sbBuffer.append(sQuery);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append.
|
||||||
|
*
|
||||||
|
* @param sQuery the s query
|
||||||
|
*
|
||||||
|
* @return the query buffer
|
||||||
|
*/
|
||||||
|
public QueryBuffer append(QueryBuffer sQuery) {
|
||||||
|
sbBuffer.append(sQuery);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append.
|
||||||
|
*
|
||||||
|
* @param sQuery the s query
|
||||||
|
*
|
||||||
|
* @return the query buffer
|
||||||
|
*/
|
||||||
|
public QueryBuffer append(float sQuery) {
|
||||||
|
sbBuffer.append(sQuery);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert.
|
||||||
|
*
|
||||||
|
* @param offset the offset
|
||||||
|
* @param query the query
|
||||||
|
*
|
||||||
|
* @return the query buffer
|
||||||
|
*/
|
||||||
|
public QueryBuffer insert(int offset, String query) {
|
||||||
|
sbBuffer.insert(offset, query);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert.
|
||||||
|
*
|
||||||
|
* @param offset the offset
|
||||||
|
* @param query the query
|
||||||
|
*
|
||||||
|
* @return the query buffer
|
||||||
|
*/
|
||||||
|
public QueryBuffer insert(int offset, QueryBuffer query) {
|
||||||
|
sbBuffer.insert(offset, query);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return sbBuffer.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package com.eactive.eai.rms.client.util;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.lang.management.ManagementFactory;
|
||||||
|
import java.lang.management.OperatingSystemMXBean;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
|
||||||
|
// use for windows demo
|
||||||
|
public class WindowsSystemMon {
|
||||||
|
private static double getBeanMonitoringValue(OperatingSystemMXBean oBean, String methodName) {
|
||||||
|
double doubleValue = 0;
|
||||||
|
for (Method method : oBean.getClass().getDeclaredMethods()) {
|
||||||
|
method.setAccessible(true);
|
||||||
|
if (method.getName().startsWith(methodName) && Modifier.isPublic(method.getModifiers())) {
|
||||||
|
Object value;
|
||||||
|
try {
|
||||||
|
value = method.invoke(oBean);
|
||||||
|
if (value != null) {
|
||||||
|
if (value instanceof Double)
|
||||||
|
doubleValue = (Double) value;
|
||||||
|
if (value instanceof Long)
|
||||||
|
doubleValue = ((Long) value).doubleValue();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} catch (Exception e) {
|
||||||
|
value = e;
|
||||||
|
} // try
|
||||||
|
// System.out.println(method.getName() + " = " + value);
|
||||||
|
} // if
|
||||||
|
} // for
|
||||||
|
return doubleValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void printSystemUsage() {
|
||||||
|
OperatingSystemMXBean osBean = ManagementFactory.getOperatingSystemMXBean();
|
||||||
|
System.out.println(
|
||||||
|
"CPU Usage : " + String.format("%.2f", getBeanMonitoringValue(osBean, "getSystemCpuLoad") * 100));
|
||||||
|
System.out.println(
|
||||||
|
"CPU Usage : " + String.format("%.2f", getBeanMonitoringValue(osBean, "getCpuLoad") * 100));
|
||||||
|
System.out.println(
|
||||||
|
"CPU JVM Usage : " + String.format("%.2f", getBeanMonitoringValue(osBean, "getProcessCpuLoad") * 100));
|
||||||
|
System.out.println("Memory Free Space G : " + String.format("%.2f",
|
||||||
|
getBeanMonitoringValue(osBean, "getFreePhysicalMemorySize") / 1024 / 1024 / 1024));
|
||||||
|
System.out.println("Memory Total Space G : " + String.format("%.2f",
|
||||||
|
getBeanMonitoringValue(osBean, "getTotalPhysicalMemorySize") / 1024 / 1024 / 1024));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getCpuPercentage() {
|
||||||
|
try {
|
||||||
|
OperatingSystemMXBean osBean = ManagementFactory.getOperatingSystemMXBean();
|
||||||
|
int cpu = new Double(getBeanMonitoringValue(osBean, "getSystemCpuLoad") * 100).intValue();
|
||||||
|
return cpu;
|
||||||
|
}
|
||||||
|
catch(Exception ex) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getDiskPercentage(){
|
||||||
|
String rootDrive = System.getProperty("user.dir");
|
||||||
|
File root = new File(rootDrive);
|
||||||
|
|
||||||
|
double free = (double)root.getFreeSpace();
|
||||||
|
double total = (double)root.getTotalSpace();
|
||||||
|
double tmp = (free / total) * 100;
|
||||||
|
return (int)Math.round(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getMemoryPercentage() {
|
||||||
|
try {
|
||||||
|
OperatingSystemMXBean osBean = ManagementFactory.getOperatingSystemMXBean();
|
||||||
|
double total = getBeanMonitoringValue(osBean, "getTotalPhysicalMemorySize");
|
||||||
|
double free = getBeanMonitoringValue(osBean, "getFreePhysicalMemorySize");
|
||||||
|
int memUsed = new Double((total-free)/total * 100).intValue();
|
||||||
|
return memUsed;
|
||||||
|
}
|
||||||
|
catch(Exception ex) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// printSystemUsage();
|
||||||
|
System.out.println("getCpuPercentage = " + getCpuPercentage());
|
||||||
|
System.out.println("getMemoryPercentage = " + getMemoryPercentage());
|
||||||
|
System.out.println("getDiskPercentage = " + getDiskPercentage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!DOCTYPE beans PUBLIC
|
||||||
|
"-//SPRING//DTD BEAN//EN"
|
||||||
|
"http://www.springframework.org/dtd/spring-beans.dtd" >
|
||||||
|
|
||||||
|
<beans>
|
||||||
|
<bean
|
||||||
|
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||||
|
<property name="properties">
|
||||||
|
<bean factory-bean="rmsProperties"
|
||||||
|
factory-method="getProperties">
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="txProxyAbstract" abstract="true"
|
||||||
|
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
|
||||||
|
<property name="transactionManager">
|
||||||
|
<ref bean="transactionManager" />
|
||||||
|
</property>
|
||||||
|
<property name="transactionAttributes">
|
||||||
|
<props>
|
||||||
|
<prop key="*">PROPAGATION_REQUIRED, readOnly</prop>
|
||||||
|
</props>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="transactionManager"
|
||||||
|
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||||
|
<property name="dataSource" ref="dataSource"></property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
|
||||||
|
destroy-method="close">
|
||||||
|
<property name="driverClassName" value="com.ibm.db2.jcc.DB2Driver" />
|
||||||
|
<property name="url" value="jdbc:db2://192.168.241.87:26500/DSEAIT01" />
|
||||||
|
<property name="username" value="sqb000" />
|
||||||
|
<property name="password" value="Ebss01!!" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
</beans>
|
||||||
|
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE beans PUBLIC
|
||||||
|
"-//SPRING//DTD BEAN//EN"
|
||||||
|
"http://www.springframework.org/dtd/spring-beans.dtd" >
|
||||||
|
<beans>
|
||||||
|
<bean
|
||||||
|
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||||
|
<property name="properties">
|
||||||
|
<bean factory-bean="rmsEnvProperties"
|
||||||
|
factory-method="getProperties">
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
참고사항
|
||||||
|
rmsProperties 를 사용하면서 ${eai.jdbc.Name} 을 사용하면 문제가 발생함
|
||||||
|
rmsProperties에서는 내부에서 DB를 사용하기 때문
|
||||||
|
해결방법
|
||||||
|
1. rmsEnvProperties 를 추가 하고 ${eai.jdbc.Name} 를 쓰는 방법(rmsProperties에서 DB 조회하는부분 삭제)
|
||||||
|
2. #{systemProperties['eai.jdbc.Name']} 를 쓰는 방법
|
||||||
|
-->
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="rmsEnvProperties"
|
||||||
|
class="com.eactive.eai.rms.client.context.RmsEnvProperties"
|
||||||
|
init-method="init">
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="dataSource" class="com.eactive.eai.common.util.JndiObjectFactoryBeanForElink">
|
||||||
|
<!--<property name="jndiName" value="jdbc/IECI_JDBCPool1"/>-->
|
||||||
|
<property name="jndiName" value="${eai.jdbc.Name}"/>
|
||||||
|
</bean>
|
||||||
|
</beans>
|
||||||
+510
@@ -0,0 +1,510 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE beans PUBLIC
|
||||||
|
"-//SPRING//DTD BEAN//EN"
|
||||||
|
"http://www.springframework.org/dtd/spring-beans-2.0.dtd" >
|
||||||
|
<beans>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="adminClientProperties"
|
||||||
|
name="adminClientProperties"
|
||||||
|
class="com.eactive.eai.rms.client.util.AdminClinetPropertiesFactoryBeanUtil">
|
||||||
|
<property
|
||||||
|
name="rmsProperties"
|
||||||
|
ref="rmsProperties"></property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="rmsProperties"
|
||||||
|
class="com.eactive.eai.rms.client.context.RmsPropertiesImpl"
|
||||||
|
init-method="init">
|
||||||
|
<property
|
||||||
|
name="rmsPropertiesDao"
|
||||||
|
ref="rmsPropertiesDAO"></property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="socketClient"
|
||||||
|
class="com.eactive.eai.rms.client.SocketClientUdpImpl">
|
||||||
|
<property
|
||||||
|
name="rmsProperties"
|
||||||
|
ref="rmsProperties" />
|
||||||
|
<property
|
||||||
|
name="handler"
|
||||||
|
ref="sessionHandler"></property>
|
||||||
|
<property
|
||||||
|
name="protocolCodecFactory">
|
||||||
|
<bean
|
||||||
|
class="org.apache.mina.filter.codec.serialization.ObjectSerializationCodecFactory" />
|
||||||
|
</property>
|
||||||
|
<property
|
||||||
|
name="threadModel">
|
||||||
|
<bean
|
||||||
|
class="org.apache.mina.integration.spring.ExecutorThreadModelFactoryBean">
|
||||||
|
<property
|
||||||
|
name="serviceName"
|
||||||
|
value="RMS_CLIENT" />
|
||||||
|
<property
|
||||||
|
name="executor">
|
||||||
|
<bean
|
||||||
|
class="org.apache.mina.integration.spring.ThreadPoolExecutorFactoryBean">
|
||||||
|
<property
|
||||||
|
name="corePoolSize"
|
||||||
|
value="6" />
|
||||||
|
<property
|
||||||
|
name="maxPoolSize"
|
||||||
|
value="15" />
|
||||||
|
<property
|
||||||
|
name="keepAliveSeconds"
|
||||||
|
value="30" />
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="sessionHandler"
|
||||||
|
class="com.eactive.eai.rms.client.UdpClientSessionHandler">
|
||||||
|
<constructor-arg>
|
||||||
|
<list>
|
||||||
|
<!--
|
||||||
|
<bean
|
||||||
|
class="com.eactive.eai.rms.client.handler.RefreshCommandHandler">
|
||||||
|
</bean>
|
||||||
|
<bean
|
||||||
|
class="com.eactive.eai.rms.client.handler.LogConfigurationCommandHandler">
|
||||||
|
</bean>
|
||||||
|
-->
|
||||||
|
</list>
|
||||||
|
</constructor-arg>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="abstractVo"
|
||||||
|
abstract="true">
|
||||||
|
<property
|
||||||
|
name="instanceName"
|
||||||
|
value="${inst.Name}"></property>
|
||||||
|
<property
|
||||||
|
name="hostName"
|
||||||
|
value="${LOCAL_HOST_NAME}"></property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="adaptersVO"
|
||||||
|
class="com.eactive.eai.rms.onl.vo.AdaptersVO"
|
||||||
|
parent="abstractVo"
|
||||||
|
scope="prototype">
|
||||||
|
<property
|
||||||
|
name="category"
|
||||||
|
value="com.eactive.eai.rms.onl.vo.AdaptersVO">
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="adaptersStatusVO"
|
||||||
|
class="com.eactive.eai.rms.onl.vo.AdaptersStatusVO"
|
||||||
|
parent="abstractVo"
|
||||||
|
scope="singleton">
|
||||||
|
<property
|
||||||
|
name="category"
|
||||||
|
value="com.eactive.eai.rms.onl.vo.AdaptersStatusVO">
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="eaiEngineStatusVo"
|
||||||
|
parent="abstractVo"
|
||||||
|
scope="singleton"
|
||||||
|
class="com.eactive.eai.rms.onl.vo.EAIEngineStatusVo">
|
||||||
|
<property
|
||||||
|
name="category"
|
||||||
|
value="com.eactive.eai.rms.onl.vo.EAIEngineStatusVo">
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="transactionTrackingVo"
|
||||||
|
parent="abstractVo"
|
||||||
|
class="com.eactive.eai.rms.onl.vo.TransactionTrackingVo"
|
||||||
|
scope="prototype">
|
||||||
|
<property
|
||||||
|
name="category"
|
||||||
|
value="com.eactive.eai.rms.onl.vo.TransactionTrackingVo">
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="transactionSendVo"
|
||||||
|
parent="abstractVo"
|
||||||
|
class="com.eactive.eai.rms.onl.vo.TransactionSendVo"
|
||||||
|
scope="prototype">
|
||||||
|
<property
|
||||||
|
name="category"
|
||||||
|
value="com.eactive.eai.rms.onl.vo.TransactionSendVo">
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="smsVo"
|
||||||
|
parent="abstractVo"
|
||||||
|
class="com.eactive.eai.rms.onl.vo.SmsVO"
|
||||||
|
scope="prototype">
|
||||||
|
<property
|
||||||
|
name="category"
|
||||||
|
value="com.eactive.eai.rms.onl.vo.SmsVO" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="jmsMonitorVo"
|
||||||
|
parent="abstractVo"
|
||||||
|
class="com.eactive.eai.rms.onl.vo.JmsMonitorVo"
|
||||||
|
scope="prototype">
|
||||||
|
<property
|
||||||
|
name="category"
|
||||||
|
value="com.eactive.eai.rms.onl.vo.JmsMonitorVo" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="hostStatusVo"
|
||||||
|
parent="abstractVo"
|
||||||
|
class="com.eactive.eai.rms.onl.vo.HostStatusVo"
|
||||||
|
scope="singleton">
|
||||||
|
<property
|
||||||
|
name="category"
|
||||||
|
value="com.eactive.eai.rms.onl.vo.HostStatusVo">
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="itsmVo"
|
||||||
|
parent="abstractVo"
|
||||||
|
class="com.eactive.eai.rms.onl.vo.ItsmVo"
|
||||||
|
scope="prototype">
|
||||||
|
<property
|
||||||
|
name="category"
|
||||||
|
value="com.eactive.eai.rms.onl.vo.ItsmVo">
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="adaptersTriger"
|
||||||
|
parent="triggerAbstract">
|
||||||
|
<property
|
||||||
|
name="repeatInterval"
|
||||||
|
value="5000"></property>
|
||||||
|
<property
|
||||||
|
name="jobDetail">
|
||||||
|
<bean
|
||||||
|
parent="jobDetailAbstract">
|
||||||
|
<property
|
||||||
|
name="targetMethod"
|
||||||
|
value="run"></property>
|
||||||
|
<property
|
||||||
|
name="targetObject">
|
||||||
|
<bean
|
||||||
|
id="adaptersAgent"
|
||||||
|
class="com.eactive.eai.rms.client.agent.AdaptersAgent">
|
||||||
|
<property
|
||||||
|
name="socketClient"
|
||||||
|
ref="socketClient"></property>
|
||||||
|
<property
|
||||||
|
name="agentAdapterDao"
|
||||||
|
ref="agentAdapterDAO"></property>
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="adaptersStatusTriger"
|
||||||
|
parent="triggerAbstract">
|
||||||
|
<property
|
||||||
|
name="repeatInterval"
|
||||||
|
value="5000"></property>
|
||||||
|
<property name="jobDetail">
|
||||||
|
<bean parent="jobDetailAbstract">
|
||||||
|
<property name="targetMethod" value="run"></property>
|
||||||
|
<property name="targetObject">
|
||||||
|
<bean id="adaptersStatusAgent" class="com.eactive.eai.rms.client.agent.AdaptersStatusAgent">
|
||||||
|
<property name="socketClient" ref="socketClient"></property>
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="eaiEngineSingleStatusService"
|
||||||
|
class="com.eactive.eai.rms.client.service.EaiEngineStatusService">
|
||||||
|
<property
|
||||||
|
name="adminClientProperties"
|
||||||
|
ref="adminClientProperties"></property>
|
||||||
|
<property
|
||||||
|
name="properties"
|
||||||
|
ref="rmsProperties"></property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="eaiEngineStatusTriger"
|
||||||
|
parent="triggerAbstract">
|
||||||
|
<property
|
||||||
|
name="repeatInterval"
|
||||||
|
value="5000"></property>
|
||||||
|
<property
|
||||||
|
name="jobDetail">
|
||||||
|
<bean
|
||||||
|
parent="jobDetailAbstract">
|
||||||
|
<property
|
||||||
|
name="targetMethod"
|
||||||
|
value="run"></property>
|
||||||
|
<property
|
||||||
|
name="targetObject">
|
||||||
|
<bean
|
||||||
|
id="eaiEngineStatusAgent"
|
||||||
|
class="com.eactive.eai.rms.client.agent.EaiEngineStatusAgent">
|
||||||
|
<property
|
||||||
|
name="socketClient"
|
||||||
|
ref="socketClient"></property>
|
||||||
|
<property
|
||||||
|
name="eaiEngineSingleStatusService"
|
||||||
|
ref="eaiEngineSingleStatusService">
|
||||||
|
</property>
|
||||||
|
<property
|
||||||
|
name="hostStatusService"
|
||||||
|
ref="hostStatusService">
|
||||||
|
</property>
|
||||||
|
<property
|
||||||
|
name="rmsProperties"
|
||||||
|
ref="rmsProperties"></property>
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="jmsFileStoreJobTrigger"
|
||||||
|
parent="triggerAbstract">
|
||||||
|
<description>
|
||||||
|
</description>
|
||||||
|
<property
|
||||||
|
name="repeatInterval"
|
||||||
|
value="60000"></property>
|
||||||
|
<property
|
||||||
|
name="jobDetail">
|
||||||
|
<bean
|
||||||
|
parent="jobDetailAbstract">
|
||||||
|
<description>Job Detail</description>
|
||||||
|
<property
|
||||||
|
name="targetObject">
|
||||||
|
<bean
|
||||||
|
id="jmsQueueStatusAgent"
|
||||||
|
class="com.eactive.eai.rms.client.agent.JmsFileStoreAgent">
|
||||||
|
<property
|
||||||
|
name="rmsProperties">
|
||||||
|
<ref
|
||||||
|
bean="rmsProperties" />
|
||||||
|
</property>
|
||||||
|
<property
|
||||||
|
name="hostStatusService"
|
||||||
|
ref="hostStatusService">
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="smsAgentTrigger"
|
||||||
|
parent="triggerAbstract">
|
||||||
|
<property
|
||||||
|
name="repeatInterval"
|
||||||
|
value="5000"></property>
|
||||||
|
<property
|
||||||
|
name="jobDetail">
|
||||||
|
<bean
|
||||||
|
parent="jobDetailAbstract">
|
||||||
|
<property
|
||||||
|
name="targetObject"
|
||||||
|
ref="smsAgent" />
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="smsAgent"
|
||||||
|
class="com.eactive.eai.rms.client.agent.SmsAgent">
|
||||||
|
<property
|
||||||
|
name="socketClient"
|
||||||
|
ref="socketClient"></property>
|
||||||
|
<property
|
||||||
|
name="rmsProperties"
|
||||||
|
ref="rmsProperties"></property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="jmsQueueAgentTrigger"
|
||||||
|
parent="triggerAbstract">
|
||||||
|
<property
|
||||||
|
name="repeatInterval"
|
||||||
|
value="5000"></property>
|
||||||
|
<property
|
||||||
|
name="jobDetail">
|
||||||
|
<bean
|
||||||
|
parent="jobDetailAbstract">
|
||||||
|
<property
|
||||||
|
name="targetObject"
|
||||||
|
ref="jmsQueueAgent" />
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="jmsQueueAgent"
|
||||||
|
class="com.eactive.eai.rms.client.agent.JmsQueueAgent">
|
||||||
|
<property
|
||||||
|
name="socketClient"
|
||||||
|
ref="socketClient"></property>
|
||||||
|
<property
|
||||||
|
name="rmsProperties"
|
||||||
|
ref="rmsProperties"></property>
|
||||||
|
<property
|
||||||
|
name="adminClientProperties"
|
||||||
|
ref="adminClientProperties"></property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="transactionTrackingAgentTrigger"
|
||||||
|
parent="triggerAbstract">
|
||||||
|
<property
|
||||||
|
name="repeatInterval"
|
||||||
|
value="5000"></property>
|
||||||
|
<property
|
||||||
|
name="jobDetail">
|
||||||
|
<bean
|
||||||
|
parent="jobDetailAbstract">
|
||||||
|
<property
|
||||||
|
name="targetObject"
|
||||||
|
ref="transactionTrackingAgent"></property>
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
<bean
|
||||||
|
id="transactionTrackingAgent"
|
||||||
|
class="com.eactive.eai.rms.client.agent.TransactionTrackingAgent">
|
||||||
|
<property
|
||||||
|
name="socketClient"
|
||||||
|
ref="socketClient"></property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="hostStatusAgentTrigger"
|
||||||
|
parent="triggerAbstract">
|
||||||
|
<property
|
||||||
|
name="repeatInterval"
|
||||||
|
value="30000"></property>
|
||||||
|
<property
|
||||||
|
name="jobDetail">
|
||||||
|
<bean
|
||||||
|
parent="jobDetailAbstract">
|
||||||
|
<property
|
||||||
|
name="targetObject"
|
||||||
|
ref="hostStatusAgent"></property>
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="hostStatusAgent"
|
||||||
|
class="com.eactive.eai.rms.client.agent.HostStatusAgent">
|
||||||
|
<property
|
||||||
|
name="socketClient"
|
||||||
|
ref="socketClient"></property>
|
||||||
|
<property
|
||||||
|
name="rmsProperties"
|
||||||
|
ref="rmsProperties"></property>
|
||||||
|
<property
|
||||||
|
name="hostStatusService"
|
||||||
|
ref="hostStatusService"></property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="hostStatusService"
|
||||||
|
class="com.eactive.eai.rms.client.service.HostStatusService">
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="itsmMonitorAgentTrigger"
|
||||||
|
parent="triggerAbstract">
|
||||||
|
<property
|
||||||
|
name="repeatInterval"
|
||||||
|
value="5000"></property>
|
||||||
|
<property
|
||||||
|
name="jobDetail">
|
||||||
|
<bean
|
||||||
|
parent="jobDetailAbstract">
|
||||||
|
<property
|
||||||
|
name="targetObject"
|
||||||
|
ref="itsmMonitorAgent"></property>
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="itsmMonitorAgent"
|
||||||
|
class="com.eactive.eai.rms.client.agent.ItsmMonitorAgent">
|
||||||
|
<property
|
||||||
|
name="socketClient"
|
||||||
|
ref="socketClient"></property>
|
||||||
|
<property
|
||||||
|
name="rmsProperties"
|
||||||
|
ref="rmsProperties"></property>
|
||||||
|
<property
|
||||||
|
name="hostStatusService"
|
||||||
|
ref="hostStatusService"></property>
|
||||||
|
<property
|
||||||
|
name="hostStatusVo"
|
||||||
|
ref="hostStatusVo"></property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="jobDetailAbstract"
|
||||||
|
abstract="true"
|
||||||
|
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
|
||||||
|
<property
|
||||||
|
name="targetMethod">
|
||||||
|
<value>run</value>
|
||||||
|
</property>
|
||||||
|
<property
|
||||||
|
name="concurrent">
|
||||||
|
<value>false</value>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
id="triggerAbstract"
|
||||||
|
abstract="true"
|
||||||
|
class="org.springframework.scheduling.quartz.SimpleTriggerFactoryBean">
|
||||||
|
<property
|
||||||
|
name="startDelay">
|
||||||
|
<value>5000</value>
|
||||||
|
</property>
|
||||||
|
<property
|
||||||
|
name="repeatInterval">
|
||||||
|
<value>30000</value>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- bean
|
||||||
|
class="com.eactive.eai.rms.onl.common.scheduler.SchedulerBeanFactoryProcessor">
|
||||||
|
<property
|
||||||
|
name="scheduler"
|
||||||
|
ref="scheduler"></property>
|
||||||
|
</bean-->
|
||||||
|
</beans>
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE beans PUBLIC
|
||||||
|
"-//SPRING//DTD BEAN//EN"
|
||||||
|
"http://www.springframework.org/dtd/spring-beans.dtd" >
|
||||||
|
<beans>
|
||||||
|
|
||||||
|
|
||||||
|
<bean id="rmsPropertiesDAO"
|
||||||
|
class="com.eactive.eai.rms.client.dao.RmsPropertiesDAOImpl">
|
||||||
|
<property name="dataSource">
|
||||||
|
<ref bean="dataSource" />
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
<bean id="agentAdapterDAO"
|
||||||
|
class="com.eactive.eai.rms.client.dao.AgentAdapterDAO">
|
||||||
|
<property name="dataSource">
|
||||||
|
<ref bean="dataSource" />
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
</beans>
|
||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE beans PUBLIC
|
||||||
|
"-//SPRING//DTD BEAN//EN"
|
||||||
|
"http://www.springframework.org/dtd/spring-beans.dtd" >
|
||||||
|
<beans>
|
||||||
|
|
||||||
|
<bean id="scheduler"
|
||||||
|
class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
|
||||||
|
destroy-method="destroy">
|
||||||
|
<property name="triggers">
|
||||||
|
<list>
|
||||||
|
<!--ref bean="adaptersTriger" /-->
|
||||||
|
<!--ref bean="eaiEngineStatusTriger" / -->
|
||||||
|
<ref bean="hostStatusAgentTrigger" />
|
||||||
|
<!--ref bean="smsAgentTrigger" / -->
|
||||||
|
<!--ref bean="transactionTrackingAgentTrigger" / -->
|
||||||
|
<!--ref bean="jmsFileStoreJobTrigger" / -->
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
<property name="startupDelay" value="10" />
|
||||||
|
<property name="quartzProperties">
|
||||||
|
<props>
|
||||||
|
<prop key="org.quartz.jobStore.class">
|
||||||
|
org.quartz.simpl.RAMJobStore
|
||||||
|
</prop>
|
||||||
|
<prop key="org.quartz.jobStore.misfireThreshold">5000</prop>
|
||||||
|
<prop key="org.quartz.threadPool.class">
|
||||||
|
org.quartz.simpl.SimpleThreadPool
|
||||||
|
</prop>
|
||||||
|
<prop key="org.quartz.threadPool.threadCount">10</prop>
|
||||||
|
<prop key="org.quartz.threadPool.threadPriority">5</prop>
|
||||||
|
<prop key="org.quartz.threadPool.makeThreadsDaemons">true</prop>
|
||||||
|
<prop key="org.quartz.scheduler.skipUpdateCheck">true</prop>
|
||||||
|
</props>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
</beans>
|
||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE beans PUBLIC
|
||||||
|
"-//SPRING//DTD BEAN//EN"
|
||||||
|
"http://www.springframework.org/dtd/spring-beans.dtd" >
|
||||||
|
<beans>
|
||||||
|
|
||||||
|
<bean id="scheduler"
|
||||||
|
class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
|
||||||
|
destroy-method="destroy">
|
||||||
|
<property name="triggers">
|
||||||
|
<list>
|
||||||
|
<ref bean="adaptersTriger" />
|
||||||
|
<ref bean="adaptersStatusTriger" />
|
||||||
|
<ref bean="eaiEngineStatusTriger" />
|
||||||
|
<ref bean="hostStatusAgentTrigger" />
|
||||||
|
<ref bean="smsAgentTrigger" />
|
||||||
|
<ref bean="jmsQueueAgentTrigger" />
|
||||||
|
<ref bean="transactionTrackingAgentTrigger" />
|
||||||
|
<ref bean="jmsFileStoreJobTrigger" />
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
<property name="startupDelay" value="10" />
|
||||||
|
<property name="quartzProperties">
|
||||||
|
<props>
|
||||||
|
<prop key="org.quartz.jobStore.class">
|
||||||
|
org.quartz.simpl.RAMJobStore
|
||||||
|
</prop>
|
||||||
|
<prop key="org.quartz.jobStore.misfireThreshold">5000</prop>
|
||||||
|
<prop key="org.quartz.threadPool.class">
|
||||||
|
org.quartz.simpl.SimpleThreadPool
|
||||||
|
</prop>
|
||||||
|
<prop key="org.quartz.threadPool.threadCount">10</prop>
|
||||||
|
<prop key="org.quartz.threadPool.threadPriority">5</prop>
|
||||||
|
<prop key="org.quartz.threadPool.makeThreadsDaemons">true</prop>
|
||||||
|
<prop key="org.quartz.scheduler.skipUpdateCheck">true</prop>
|
||||||
|
</props>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
</beans>
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE beans PUBLIC
|
||||||
|
"-//SPRING//DTD BEAN//EN"
|
||||||
|
"http://www.springframework.org/dtd/spring-beans.dtd" >
|
||||||
|
<beans>
|
||||||
|
<import resource="applicationContext-agent-datasource-local.xml" />
|
||||||
|
<import resource="applicationContext-agent-jdbc.xml" />
|
||||||
|
<import resource="applicationContext-agent-impl.xml" />
|
||||||
|
<import resource="applicationContext-agent-schaduler-standalone.xml" />
|
||||||
|
</beans>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE beans PUBLIC
|
||||||
|
"-//SPRING//DTD BEAN//EN"
|
||||||
|
"http://www.springframework.org/dtd/spring-beans.dtd" >
|
||||||
|
<beans>
|
||||||
|
<import resource="applicationContext-agent-datasource.xml" />
|
||||||
|
<import resource="applicationContext-agent-jdbc.xml" />
|
||||||
|
<import resource="applicationContext-agent-impl.xml" />
|
||||||
|
<import resource="applicationContext-agent-schaduler.xml" />
|
||||||
|
</beans>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# Set root category priority to DEBUG and its appenders to stdout and R.
|
||||||
|
log4j.rootCategory=DEBUG, stdout
|
||||||
|
log4j.logger.com.eactive.eai.rms=DEBUG
|
||||||
|
|
||||||
|
log4j.appender.stdout=kr.co.kpl.org.apache.log4j.ConsoleAppender
|
||||||
|
log4j.appender.stdout.layout=kr.co.kpl.org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.stdout.layout.ConversionPattern=[%d{dd MMM yyyy HH\:mm\:ss,SSS}] %5p (%F\:%L) - %m%n
|
||||||
|
|
||||||
|
log4j.appender.file=kr.co.kpl.org.apache.log4j.RollingFileAppender
|
||||||
|
log4j.appender.file.File=/fslog/eai/${inst.Name}/ems_client-old.log
|
||||||
|
log4j.appender.file.MaxFileSize=10MB
|
||||||
|
log4j.appender.file.MaxBackupIndex=0
|
||||||
|
log4j.appender.file.layout=kr.co.kpl.org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.file.layout.ConversionPattern=[%d{dd MMM yyyy HH\:mm\:ss,SSS}] %5p (%F\:%L) - %m%n
|
||||||
Reference in New Issue
Block a user