init
This commit is contained in:
+235
@@ -0,0 +1,235 @@
|
||||
gradle.properties
|
||||
|
||||
# Package Files #
|
||||
*.war
|
||||
|
||||
src/main/generated
|
||||
|
||||
# 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/
|
||||
/.apt_generated_tests/
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
id 'eclipse-wtp'
|
||||
id 'idea'
|
||||
id 'com.diffplug.eclipse.apt' version '3.41.1'
|
||||
}
|
||||
|
||||
group 'com.eactive'
|
||||
version '4.5.1-SNAPSHOT'
|
||||
|
||||
def springVersion = "5.3.27"
|
||||
//def quartzVersion = "2.2.1"
|
||||
def queryDslVersion = "5.0.0"
|
||||
def hibernateVersion = "5.6.15.Final"
|
||||
|
||||
def nexusUrl = "https://nexus.eactive.synology.me:8090"
|
||||
def generatedJavaDir = "$buildDir/generated/java"
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(8)
|
||||
}
|
||||
}
|
||||
|
||||
compileJava {
|
||||
options.encoding = 'UTF-8'
|
||||
options.compilerArgs += [
|
||||
'-Amapstruct.verbose=false'
|
||||
]
|
||||
sourceSets.main.java { srcDir generatedJavaDir }
|
||||
options.generatedSourceOutputDirectory = project.file(generatedJavaDir)
|
||||
|
||||
aptOptions {
|
||||
processorArgs = [ 'querydsl.generatedAnnotationClass' : 'com.querydsl.core.annotations.Generated' ]
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
exclude '**/persistence.xml'
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
// project > properties > Java Compiler > Annoation Processing
|
||||
annotationProcessor "org.projectlombok:lombok:1.18.28", "org.projectlombok:lombok-mapstruct-binding:0.2.0", "org.mapstruct:mapstruct-processor:1.5.5.Final"
|
||||
annotationProcessor "com.querydsl:querydsl-apt:${queryDslVersion}:jpa", "jakarta.persistence:jakarta.persistence-api:2.2.3", "jakarta.annotation:jakarta.annotation-api:1.3.5"
|
||||
|
||||
api project(':elink-online-core-jpa')
|
||||
|
||||
api group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'
|
||||
api group: 'commons-io', name: 'commons-io', version: '2.11.0'
|
||||
api group: 'commons-beanutils', name: 'commons-beanutils', version: '1.6.1'
|
||||
api "com.rabbitmq:amqp-client:3.6.6"
|
||||
|
||||
api 'ch.qos.logback:logback-classic:1.2.10'
|
||||
api 'ch.qos.logback:logback-core:1.2.10'
|
||||
api 'co.elastic.logging:logback-ecs-encoder:1.5.0'
|
||||
//api 'com.eactive:json-simple-1.1.1-custom:1.2'
|
||||
|
||||
api "org.springframework:spring-context-support:${springVersion}"
|
||||
|
||||
api 'jakarta.interceptor:jakarta.interceptor-api:2.1.0'
|
||||
|
||||
compileOnly group: 'com.ibm.db2', name: 'jcc', version: '11.5.7.0'
|
||||
|
||||
testRuntimeOnly 'com.h2database:h2:2.1.214'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.6.15'
|
||||
}
|
||||
|
||||
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 Core 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
|
||||
}
|
||||
|
||||
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')
|
||||
}
|
||||
}
|
||||
|
||||
task initDirs() {
|
||||
if (!project.file(generatedJavaDir).exists()) {
|
||||
file(generatedJavaDir).mkdirs()
|
||||
}
|
||||
}
|
||||
|
||||
eclipse {
|
||||
synchronizationTasks settingEclipseEncoding, initDirs
|
||||
jdt {
|
||||
apt {
|
||||
genSrcDir = file(generatedJavaDir)
|
||||
}
|
||||
}
|
||||
project {
|
||||
natures = ['org.eclipse.buildship.core.gradleprojectnature',
|
||||
'org.eclipse.jdt.core.javanature',
|
||||
'org.eclipse.wst.common.project.facet.core.nature',
|
||||
'org.eclipse.wst.common.modulecore.ModuleCoreNature',
|
||||
'org.eclipse.jem.workbench.JavaEMFNature']
|
||||
buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
|
||||
buildCommand 'org.eclipse.wst.validation.validationbuilder'
|
||||
buildCommand 'org.eclipse.wst.common.project.facet.core.builder'
|
||||
buildCommand 'org.eclipse.jdt.core.javabuilder'
|
||||
}
|
||||
}
|
||||
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
|
||||
@@ -0,0 +1,12 @@
|
||||
# eLink 온라인 코어 모듈
|
||||
대부분의 온라인 프로젝트들에서 공통으로 참조하는 핵심 라이브러리
|
||||
|
||||
### 추후 목표
|
||||
로직이 있는 부분은 다른 라이브러리로 전환하고 순수 Object와 Logger 정도만 남기는것을 목표로 한다.
|
||||
|
||||
### nexus password
|
||||
대상파일 : gradle.properties
|
||||
```ini
|
||||
eactiveRepositoryUsername={사용자명}
|
||||
eactiveRepositoryPassword={비밀번호}
|
||||
```
|
||||
@@ -0,0 +1,5 @@
|
||||
rootProject.name = 'elink-online-core'
|
||||
|
||||
include 'elink-online-core-jpa'
|
||||
|
||||
project (':elink-online-core-jpa').projectDir = new File(settingsDir, "../elink-online-core-jpa")
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.eactive.eai.agent.command;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Agent에 의해 실행될 Command 를 정의하기 위한 base class
|
||||
* 2. 처리 개요 : Agent에 의해 실행될 Command 를 정의하기 위한 base class
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*
|
||||
*/
|
||||
public abstract class Command implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected String name;
|
||||
protected Object args;
|
||||
|
||||
private static HashMap<String, String> errorCode;
|
||||
|
||||
static {
|
||||
errorCode = new HashMap<>();
|
||||
errorCode.put("RECEAIMCM001", "Command name[{1}] invalid parameter type - {2}");
|
||||
errorCode.put("RECEAIMCM002", "Command name[{1}] execute method error - {2}");
|
||||
}
|
||||
|
||||
public Command() {
|
||||
this.name = this.getClass().getName();
|
||||
}
|
||||
|
||||
public Command(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setArgs(Object args) {
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : command의 business logic method<br>
|
||||
* 2. 처리 개요 : command의 business logic method<br>
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @exception CommandException
|
||||
**/
|
||||
public abstract Object execute() throws CommandException;
|
||||
|
||||
/**
|
||||
* 1. 기능 : 에러 Message 생성
|
||||
* 2. 처리 개요 : 에러코드와 Exception cause로 에러 메시지 생성 3. 주의사항
|
||||
*
|
||||
* @param rspErrorcode EAI 에러코드
|
||||
* @param cause Exception cause
|
||||
* @return String 에러 메시지
|
||||
* @exception CommandException
|
||||
**/
|
||||
protected String makeException(String rspErrorCode, Throwable cause) throws CommandException {
|
||||
String[] msgArgs = new String[2];
|
||||
msgArgs[0] = name;
|
||||
if (cause == null) {
|
||||
msgArgs[1] = args.toString();
|
||||
} else {
|
||||
msgArgs[1] = cause.getMessage();
|
||||
}
|
||||
return makeMessage(errorCode.get(rspErrorCode), msgArgs);
|
||||
}
|
||||
|
||||
private static String makeMessage(String msg, String[] args) {
|
||||
String keyword = null, head = null, tail = null;
|
||||
int idx = -1;
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
keyword = "{" + (i + 1) + "}";
|
||||
idx = msg.indexOf(keyword);
|
||||
if (idx == -1) {
|
||||
continue;
|
||||
}
|
||||
head = msg.substring(0, idx);
|
||||
tail = msg.substring(idx + keyword.length());
|
||||
msg = head + args[i] + tail;
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
package com.eactive.eai.agent.command;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Command Logic을 실행하다 발생될 User Define 오류를 처리하기 위한 Exception class<br>
|
||||
* 2. 처리 개요 : Command Logic을 실행하다 발생될 User Define 오류를 처리하기 위한 Exception class<br>
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*
|
||||
*/
|
||||
public class CommandException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
public CommandException() {
|
||||
super("CommandException is occured.");
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Exception message를 초기화하는 Constructor
|
||||
* 2. 처리 개요 : Exception message를 초기화하는 Constructor
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param msg Exception message
|
||||
**/
|
||||
public CommandException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.eactive.eai.agent.command;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : 공통 command
|
||||
* 2. 처리 개요 :
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*
|
||||
*/
|
||||
public class CommonCommand extends Command {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
public CommonCommand(String name,Object args) {
|
||||
this.name = name;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
public CommonCommand(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
if(this.name == null) {
|
||||
String rspErrorCode = "RECEAIMCM001";
|
||||
String msg = makeException(rspErrorCode, null);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
if (name.indexOf(".") >=0 ){
|
||||
try {
|
||||
this.name = this.name.trim();
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class cl = Class.forName(this.name);
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
Constructor constructor = cl.getConstructor();
|
||||
Object obj = constructor.newInstance();
|
||||
Command c = (Command)obj;
|
||||
c.setArgs(args);
|
||||
return c.execute();
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.error("CommonCommand Exception "+e.getMessage(),e);
|
||||
throw new CommandException(e.getMessage());
|
||||
}
|
||||
}else{
|
||||
String rspErrorCode = "RECEAIMCM001";
|
||||
String msg = makeException(rspErrorCode, null);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.eactive.eai.common;
|
||||
|
||||
public interface EAIKeys
|
||||
{
|
||||
/*
|
||||
거래 요구(0200),
|
||||
재요구(0201)
|
||||
응답(0210)
|
||||
|
||||
취소(0420)
|
||||
취소응답(0430)
|
||||
|
||||
통신망 관리 전문(0800)
|
||||
집계(8000)
|
||||
*/
|
||||
|
||||
public static final String TR_REQ = "0200"; // 거래요구
|
||||
public static final String TR_RE_REQ = "0201"; // 재요구
|
||||
public static final String TR_RES = "0210"; // 응답
|
||||
|
||||
public static final String TR_CANCEL_REQ = "0420"; // 취소
|
||||
public static final String TR_CANCEL_RES = "0430"; // 취소응답
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// 2006.01.04 추가됨
|
||||
//-----------------------------------------------------------
|
||||
public static final String TR_NET_REQ = "0800"; // 통신망전문
|
||||
public static final String TR_NET_RES = "0810"; // 통신망전문응답
|
||||
|
||||
public static final String TR_SYSTEMINFO_REQ = "0700"; // 시스템정보
|
||||
public static final String TR_SYSTEMINFO_RES = "0710"; // 시스템정보응답
|
||||
//-----------------------------------------------------------
|
||||
|
||||
public static final String NET_MGR = "0800"; // 통신망관리 전문
|
||||
public static final String TR_STAT = "8000"; // 집계
|
||||
|
||||
public static final String CALL_MODE_KEY = "mode"; // Process Call Type Key
|
||||
public static final String CALL_MODE_WARMUP = "warmup"; // Warmup Call Value
|
||||
public static final String CALL_COMP_KEY = "compensation_type"; // 보상거래호출 Key
|
||||
public static final String CALL_COMP_VALUE = "compensation_service"; // 보상거래호출 Value
|
||||
|
||||
public static final String CALL_COMP_SVC_SEQ = "compensation_seq"; //보상거래 호출 서비스 처리 번호
|
||||
|
||||
public static final String BID_SEQ = "bid_seq"; //비드메시지 호출 서비스 처리를 위한 seq
|
||||
public static final String BID_IS_PUBLISH = "bid_is_publish"; //비드메시지 호출 서비스 처리를 위한 seq
|
||||
|
||||
public static final String PCOMP_CON_FACTORY = "com.eactive.eai.common.ConnectionFactory";
|
||||
public static final String PCOMP_RES_QUEUE = "com.eactive.eai.pcomp.PCompResQueue";
|
||||
public static final String PCOMP_OUT_RES_QUEUE = "com.eactive.eai.pcomp.PCompOutResQueue";
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.eactive.eai.common;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public interface EAITable
|
||||
{
|
||||
public static final String[] ADAPTER_TYPES ={"SOC","EJB","HTT","JMS","IMQ","IMS", "SNA", "WTC", "WCA", "X25"};
|
||||
public static final String[] ADAPTER_TYPE_NAMES ={"SocketAdapter","EJBAdapter","HttpAdapter","JMSAdapter","MQAdapter","IMSAdapter", "SNAAdapter", "WTCAdapter", "WCAAdapter", "X25Adapter"};
|
||||
|
||||
//migration
|
||||
//public static final String[] EXR_TYPES = {"IN", "OU"};
|
||||
public static final String[] EXR_TYPES = {"I", "O"};
|
||||
public static final String[] EXR_TYPE_NAMES = {"전문고유번호 추출", "응답메시지구분값 추출"};
|
||||
|
||||
public static final String[] EXR_CLASS_TYPES = {"AK", "TR"};
|
||||
public static final String[] EXR_CLASS_TYPE_NAMES = {"ALT-KEY 추출", "추적관리필드 추출"};
|
||||
|
||||
public static final String[] MSG_TYPES = {"ASC", "EBC", "JOB", "FML", "F32", "XML"};
|
||||
public static final String[] MSG_TYPE_NAMES = {"ASCII 전문", "EBCDIC 전문", "Java Object", "FML", "FML32", "XML"};
|
||||
|
||||
public static final String ASCII_TYPE = "ASC";
|
||||
public static final String EBCDIC_TYPE = "EBC";
|
||||
public static final String JAVAOBJECT_TYPE = "JOB";
|
||||
public static final String FML_TYPE = "FML";
|
||||
public static final String FML32_TYPE = "F32";
|
||||
public static final String XML_TYPE = "XML";
|
||||
// public static final String UXML_TYPE = "UXL";
|
||||
public static final String JSON_TYPE = "JSN";
|
||||
// public static final String UJSON_TYPE = "UJN";
|
||||
public static final String ISO8583_TYPE = "I83";
|
||||
// public static final String ISO8583_H2H_TYPE = "H2H";
|
||||
|
||||
/**
|
||||
* EAIMessage의 상수
|
||||
*/
|
||||
public static final String[] SVC_TIME_EXIST = {"0", "1"};
|
||||
public static final String[] SVC_TIME_EXIST_VALUE = {"없음", "있음"}; // 서비스시간유무
|
||||
public static final String[] SVC_SAME_TIME_TYPE = {"SYNC", "ASYN", "ACKO"}; // 서비스동시사용
|
||||
public static final String[] SVC_PROCESS_TYPE = {"SINGLE", "COMPLEX", "PCOMPLEX", "TIMER"}; // 서비스처리유형
|
||||
public static final String[] UNIT_TYPE = {"ONLINE", "BATCH", "FTP"}; // 통합유형
|
||||
public static final String[] START_SVC_CLASSIFICATION = {"TIMER", "EXCEPTION"}; // 기동서비스구분
|
||||
public static final String[] SVC_WHOLE_COL_LOG = {"0", "1"};
|
||||
public static final String[] SVC_WHOLE_COL_LOG_VALUE = {"사용안함", "사용함"}; // 서비스전열로그여부
|
||||
public static final String[] STANDARD_MSG_USAGE = {"0", "1"}; // 표준메시지사용구분
|
||||
public static final String[] STANDARD_MSG_USAGE_VALUE = {"사용안함", "사용함"};
|
||||
public static final String[] SERVER_LOG_LEVEL_TYPE = {"WARNING", "INFO", "DEBUG"};// 서버로그레벨
|
||||
public static final int[] SERVER_LOG_LEVEL = {0, 1, 2};
|
||||
public static final int[] SVC_LOG_LEVEL = {0, 1, 2, 3, 4}; // 서비스로그레벨
|
||||
|
||||
/**
|
||||
* ServiceMessage의 상수
|
||||
*/
|
||||
public static final String[] PSV_ITF_TYPE = {"SYNC", "ASYN", "AKON"}; // 수동인터페이스유형 - PassiveInterfaceType
|
||||
public static final String[] FAIL_OVER_CLS = {"0", "1"};
|
||||
public static final String[] FAIL_OVER_CLS_VALUE = {"사용안함", "사용함"}; // FailOver여부 - FailOverClassification
|
||||
public static final String[] CNV_EXIST_NOT = {"0", "1"};
|
||||
public static final String[] CNV_EXIST_NOT_VALUE = {"없음", "있음"}; // 변환유무 - ConversionExistenceOrNot
|
||||
public static final String[] BS_RSP_CNV_EXIST_NOT = {"0", "1"};
|
||||
public static final String[] BS_RSP_CNV_EXIST_NOT_VALUE = {"없음", "있음"}; // 기본응답변환유무 - BasisResponseConversionExistenceOrNot
|
||||
public static final String[] ERR_RSP_CNV_EXIST_NOT = {"0", "1"}; // 오류응답변환유무
|
||||
public static final String[] ERR_RSP_CNV_EXIST_NOT_VALUE = {"없음", "있음"};
|
||||
public static final String[] RSPNS_DST_CD = {"0", "1"};
|
||||
public static final String[] RSPNS_DST_CD_VALUE = {"오류", "정상"}; // 정상응답(1), 오류응답(0) 여부
|
||||
|
||||
public static final String ALL = "전체서버";
|
||||
/**
|
||||
* KESAMessage의 상수
|
||||
*/
|
||||
public static final String[] C_HEAD_TYPE ={"KJ", "KB", "KT"};
|
||||
|
||||
/**
|
||||
* 플로우라우팅정보 레이어 구분
|
||||
*/
|
||||
public static final String[] LAYER_DSTCD = {"F", "O", "T"};
|
||||
|
||||
/**
|
||||
* 어댑터 입출력 구분 코드
|
||||
*/
|
||||
public static final String[] ADPTR_IO_DSTCD = {"I", "O"};
|
||||
public static final String[] ADPTR_IO_DSTCD_NAMES = {"INBOUND", "OUTBOUND"};
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package com.eactive.eai.common.dao;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
import com.eactive.eai.common.util.ServiceLocator;
|
||||
|
||||
public abstract class BaseDAO {
|
||||
protected Connection conn;
|
||||
protected PreparedStatement preparedStatement;
|
||||
protected String jndiName;
|
||||
static Logger logger;
|
||||
protected static boolean application;
|
||||
|
||||
static {
|
||||
application = false;
|
||||
}
|
||||
|
||||
public BaseDAO() {
|
||||
this.jndiName = Keys.EAI_DATASOURCE;
|
||||
}
|
||||
|
||||
protected void setJNDIName(String jndiDataSource) {
|
||||
this.jndiName = jndiDataSource;
|
||||
}
|
||||
|
||||
protected void connect(String query) throws DAOException {
|
||||
DataSource dataSource = null;
|
||||
try {
|
||||
if (!application) {
|
||||
ServiceLocator sl = ServiceLocator.getInstance();
|
||||
dataSource = sl.getDataSource(jndiName);
|
||||
conn = dataSource.getConnection();
|
||||
} else {
|
||||
if (conn == null || conn.isClosed())
|
||||
conn = getJDBCConnection(query);
|
||||
}
|
||||
preparedStatement = conn.prepareStatement(query);
|
||||
} catch (Exception e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICDA101"), e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void connect(String providerURL, String query) throws DAOException {
|
||||
DataSource dataSource = null;
|
||||
try {
|
||||
ServiceLocator sl = ServiceLocator.getInstance();
|
||||
dataSource = sl.getRemoteDataSource(providerURL, jndiName);
|
||||
if (dataSource == null) {
|
||||
throw new Exception("datasource not found : " + jndiName);
|
||||
}
|
||||
conn = dataSource.getConnection();
|
||||
preparedStatement = conn.prepareStatement(query);
|
||||
} catch (Exception e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICDA101"), e);
|
||||
}
|
||||
}
|
||||
|
||||
protected ResultSet executeQuery() throws DAOException {
|
||||
try {
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
return rs;
|
||||
} catch (SQLException e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICDA102"), e);
|
||||
}
|
||||
}
|
||||
|
||||
protected int executeUpdate() throws DAOException {
|
||||
try {
|
||||
int result = preparedStatement.executeUpdate();
|
||||
return result;
|
||||
} catch (SQLException e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICDA103"), e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void prepareStatement(String query) throws DAOException {
|
||||
try {
|
||||
closeStatement();
|
||||
preparedStatement = conn.prepareStatement(query);
|
||||
} catch (Exception e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICDA104"), e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void disconnect() throws DAOException {
|
||||
closeStatement();
|
||||
closeConnection();
|
||||
}
|
||||
|
||||
protected void closeStatement() throws DAOException {
|
||||
if (preparedStatement != null) {
|
||||
try {
|
||||
preparedStatement.close();
|
||||
} catch (Exception e) {
|
||||
logger.warn("preparedStatement close error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void closeConnection() throws DAOException {
|
||||
try {
|
||||
if (application) {
|
||||
return;
|
||||
}
|
||||
if ((!application) && (conn != null)) {
|
||||
conn.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warn("connection close error");
|
||||
}
|
||||
}
|
||||
|
||||
private Connection getJDBCConnection(String query) throws SQLException {
|
||||
try {
|
||||
InputStream in = this.getClass().getClassLoader()
|
||||
.getResourceAsStream("data/transform/config/config.properties");
|
||||
Properties p = new Properties();
|
||||
|
||||
if (in == null) {
|
||||
throw new SQLException(
|
||||
"BaseDAO] Cannot find the jdbc configuration file. - data/transform/config/config.properties");
|
||||
}
|
||||
|
||||
p.load(in);
|
||||
Class.forName(p.getProperty("jdbc.driver"));
|
||||
|
||||
Connection con = DriverManager.getConnection(p.getProperty("jdbc.url"), p.getProperty("jdbc.username"),
|
||||
p.getProperty("jdbc.password"));
|
||||
|
||||
if (logger.isDebug())
|
||||
logger.debug("BaseDAO ] getJDBCConnection - JDBCConnection URL : " + p.getProperty("jdbc.url"));
|
||||
|
||||
return con;
|
||||
} catch (Exception e) {
|
||||
throw new SQLException("BaseDAO] Cannot create a JDBC Connection. - " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
protected int convertInt(Object o) {
|
||||
if (o instanceof Integer) {
|
||||
return (Integer) o;
|
||||
} else if (o instanceof BigDecimal) {
|
||||
return ((BigDecimal) o).intValue();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
|
||||
package com.eactive.eai.common.dao;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Data Access Object 예외 처리를 정의한 Exception 클래스
|
||||
* 2. 처리 개요 : DAO 예외 처리 정의를 위한 Exception 클래스 이다.
|
||||
* * -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see : 관련 기능을 참조
|
||||
* @since :
|
||||
* :
|
||||
*/
|
||||
public class DAOException extends Exception
|
||||
{
|
||||
String message;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Default Constructor
|
||||
* 2. 처리 개요 : Default Constructor
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
**/
|
||||
public DAOException() {
|
||||
super("DAOException is occured.");
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 오류 메시지를 저장하는 생성자 함수
|
||||
* 2. 처리 개요 : 파라미터의 오류 메시지를 저장한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param msg 오류 메시지
|
||||
**/
|
||||
public DAOException(String msg) {
|
||||
super(msg);
|
||||
this.message = msg;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : 오류 메시지를 저장하는 생성자 함수
|
||||
* 2. 처리 개요 : 파라미터의 오류 메시지를 저장한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param Throwable - 에러
|
||||
**/
|
||||
|
||||
public DAOException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
|
||||
if (Keys.isDB2Include && cause instanceof com.ibm.db2.jcc.DB2Diagnosable) {
|
||||
try {
|
||||
this.message = msg + " | " + ((com.ibm.db2.jcc.DB2Diagnosable) cause).getSqlca().getMessage();
|
||||
} catch(Exception e) {
|
||||
this.message = msg + " | " + cause.getMessage();
|
||||
}
|
||||
} else {
|
||||
this.message = msg;
|
||||
}
|
||||
}
|
||||
|
||||
public DAOException(Throwable cause) {
|
||||
super(cause);
|
||||
|
||||
if (Keys.isDB2Include && cause instanceof com.ibm.db2.jcc.DB2Diagnosable) {
|
||||
try {
|
||||
this.message = ((com.ibm.db2.jcc.DB2Diagnosable) cause).getSqlca().getMessage();
|
||||
} catch(Exception e) {
|
||||
this.message = cause.getMessage();
|
||||
}
|
||||
} else {
|
||||
this.message = cause.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return this.message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String s = getClass().getName();
|
||||
return (this.message != null) ? (s + ": " + this.message) : s;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.eactive.eai.common.dao;
|
||||
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
|
||||
/**
|
||||
* 1. 기능 : DAO 객체를 생성하기 위한 Factory 클래스
|
||||
* 2. 처리 개요 : DAO 객체를 생성하는 Factory 메서드를 정의한다.
|
||||
* * -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see : 관련 기능을 참조
|
||||
* @since :
|
||||
* :
|
||||
*/
|
||||
public class DAOFactory
|
||||
{
|
||||
|
||||
/**
|
||||
* 1. 기능 : Default Contructor
|
||||
* 2. 처리 개요 : Default Contructor
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
**/
|
||||
private DAOFactory() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : DAOFactory 객체를 생성 반환하는 메서드
|
||||
* 2. 처리 개요 : DAOFactory 객체를 생성 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @return DAOFactory
|
||||
**/
|
||||
public static DAOFactory newInstance() {
|
||||
return new DAOFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : BaseDAO 객체를 생성 반환하는 메서드
|
||||
* 2. 처리 개요 : 파라미터의 DAO 객체를 생성 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param daoClassName 생성할 DAO 클래스
|
||||
* @return BaseDAO Data Access Object
|
||||
* @exception 클래스를 찾지 못하거나 객체를 생성하지 못할 경우
|
||||
**/
|
||||
public BaseDAO create(String daoClassName) throws DAOException {
|
||||
Class daoClass = null;
|
||||
try {
|
||||
daoClass = Class.forName(daoClassName);
|
||||
} catch(Exception e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICDA111"));
|
||||
}
|
||||
|
||||
BaseDAO dao = null;
|
||||
try {
|
||||
dao = (BaseDAO)daoClass.newInstance();
|
||||
} catch(Exception e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICDA112"));
|
||||
}
|
||||
|
||||
return dao;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : BaseDAO 객체를 생성 반환하는 메서드
|
||||
* 2. 처리 개요 : 파라미터의 DAO 객체를 생성 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param daoClass 생성할 DAO 클래스
|
||||
* @return BaseDAO Data Access Object
|
||||
* @exception 클래스를 찾지 못하거나 객체를 생성하지 못할 경우
|
||||
**/
|
||||
public BaseDAO create(Class daoClass) throws DAOException {
|
||||
BaseDAO dao = null;
|
||||
try {
|
||||
dao = (BaseDAO)daoClass.newInstance();
|
||||
} catch(Exception e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICDA112"));
|
||||
}
|
||||
|
||||
return dao;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.eactive.eai.common.dao;
|
||||
|
||||
/**
|
||||
* 1. 기능 : DAO에서 사용하는 JDBC DataSource에 대한 JNDI 이름을 정의한 상수 클래스
|
||||
* 2. 처리 개요 : DAO에서 사용하는 JDBC DataSource에 대한 JNDI 이름을 정의한다.
|
||||
* * -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see : 관련 기능을 참조
|
||||
* @since :
|
||||
* :
|
||||
*/
|
||||
public class Keys
|
||||
{
|
||||
public static boolean isDB2Include = false;
|
||||
static {
|
||||
// DB2관련 모듈 유무 판단.
|
||||
try {
|
||||
Class clazz = Class.forName("com.ibm.db2.jcc.DB2Diagnosable");
|
||||
isDB2Include = true;
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
}
|
||||
/**
|
||||
* TABLE 의 OWNER명
|
||||
*/
|
||||
public static final String TABLE_OWNER_KEY = "eai.tableowner";
|
||||
public static final String JDBC_NAME_KEY = "eai.jdbc.Name";
|
||||
public static final String JDBC_NAME_DEFAULT = "jdbc/ElinkDefaultDataSource";
|
||||
|
||||
public static final String OWNER = System.getProperty(TABLE_OWNER_KEY);
|
||||
|
||||
public static final String TABLE_OWNER = OWNER+".";
|
||||
|
||||
/**
|
||||
* EAI 프레임웍에서 사용하는 기본 DataSource에 대한 JNDI 이름
|
||||
*/
|
||||
public static final String EAI_DATASOURCE = System.getProperty(JDBC_NAME_KEY,JDBC_NAME_DEFAULT);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.eactive.eai.common.errorcode;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.common.dao.BaseDAO;
|
||||
import com.eactive.eai.common.dao.DAOException;
|
||||
import com.eactive.eai.common.errorcode.loader.ErrorCodeLoader;
|
||||
import com.eactive.eai.common.errorcode.mapper.ErrorCodeMapper;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
import com.eactive.eai.data.entity.onl.errorcode.ErrorCode;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class ErrorCodeDAO extends BaseDAO {
|
||||
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
private ErrorCodeLoader errorCodeLoader;
|
||||
|
||||
private ErrorCodeMapper errorCodeMapper;
|
||||
|
||||
@Autowired
|
||||
public ErrorCodeDAO(ErrorCodeLoader errorCodeLoader, ErrorCodeMapper errorCodeMapper) {
|
||||
this.errorCodeLoader = errorCodeLoader;
|
||||
this.errorCodeMapper = errorCodeMapper;
|
||||
}
|
||||
|
||||
public Map<String, ErrorCodeVO> getMessages() throws DAOException {
|
||||
try (Stream<ErrorCode> errorCodes = errorCodeLoader.loadAll()) {
|
||||
Map<String, ErrorCodeVO> codeMap = new HashMap<>();
|
||||
|
||||
logger.info("[ @@ Load ErrorCode Configuration - starting >>>>>>>>>>>>>>>>> ]");
|
||||
|
||||
errorCodes.forEach(e -> {
|
||||
ErrorCodeVO vo = errorCodeMapper.toVo(e);
|
||||
codeMap.put(vo.getMsgKey(), vo);
|
||||
});
|
||||
|
||||
logger.info("[>>Load ErrorCode Configuration - ended ]");
|
||||
return codeMap;
|
||||
} catch (Exception e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICCM101"));
|
||||
}
|
||||
}
|
||||
|
||||
public ErrorCodeVO getMessages(String key) throws DAOException {
|
||||
try {
|
||||
ErrorCode code = errorCodeLoader.getById(key);
|
||||
return errorCodeMapper.toVo(code);
|
||||
} catch (Exception e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICCM101"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.eactive.eai.common.errorcode;
|
||||
|
||||
public class ErrorCodeHandler {
|
||||
|
||||
private ErrorCodeHandler() {
|
||||
}
|
||||
|
||||
public static String getMessage(String code) {
|
||||
return ErrorCodeManager.getInstance().getMessage(code);
|
||||
}
|
||||
|
||||
public static String getMessage(String code, String[] args) {
|
||||
String msg = ErrorCodeManager.getInstance().getMessage(code);
|
||||
return makeMessage(msg, args);
|
||||
}
|
||||
|
||||
private static String makeMessage(String msg, String[] args) {
|
||||
String keyword = null;
|
||||
String head = null;
|
||||
String tail = null;
|
||||
int idx = -1;
|
||||
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
keyword = "{" + (i + 1) + "}";
|
||||
idx = msg.indexOf(keyword);
|
||||
if (idx == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
head = msg.substring(0, idx);
|
||||
tail = msg.substring(idx + keyword.length());
|
||||
msg = head + args[i] + tail;
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.eactive.eai.common.errorcode;
|
||||
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.lifecycle.Lifecycle;
|
||||
import com.eactive.eai.common.lifecycle.LifecycleException;
|
||||
import com.eactive.eai.common.lifecycle.LifecycleListener;
|
||||
import com.eactive.eai.common.lifecycle.LifecycleSupport;
|
||||
import com.eactive.eai.common.util.ApplicationContextProvider;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ErrorCodeManager implements Lifecycle {
|
||||
|
||||
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
private Map<String, ErrorCodeVO> messages = new HashMap<>();
|
||||
private LifecycleSupport lifecycle = new LifecycleSupport(this);
|
||||
private boolean started;
|
||||
|
||||
@Autowired
|
||||
private ErrorCodeDAO errorCodeDAO;
|
||||
|
||||
public static ErrorCodeManager getInstance() {
|
||||
return ApplicationContextProvider.getContext().getBean(ErrorCodeManager.class);
|
||||
}
|
||||
|
||||
public void start() throws LifecycleException {
|
||||
if (started)
|
||||
throw new LifecycleException("RECEAICCM201");
|
||||
|
||||
lifecycle.fireLifecycleEvent(STARTING_EVENT, this);
|
||||
messages = null;
|
||||
|
||||
try {
|
||||
init();
|
||||
} catch (Exception e) {
|
||||
throw new LifecycleException(ExceptionUtil.getErrorCode(e, "RECEAICCM202"));
|
||||
}
|
||||
|
||||
started = true;
|
||||
lifecycle.fireLifecycleEvent(STARTED_EVENT, this);
|
||||
}
|
||||
|
||||
private void init() throws Exception {
|
||||
messages = errorCodeDAO.getMessages();
|
||||
}
|
||||
|
||||
public void stop() throws LifecycleException {
|
||||
if (!started)
|
||||
throw new LifecycleException("RECEAICCM203");
|
||||
|
||||
lifecycle.fireLifecycleEvent(STOPING_EVENT, this);
|
||||
messages.clear();
|
||||
started = false;
|
||||
logger.info("ErrorCodeManager] It is stopped.");
|
||||
lifecycle.fireLifecycleEvent(STOPPED_EVENT, this);
|
||||
}
|
||||
|
||||
public boolean isStarted() {
|
||||
return this.started;
|
||||
}
|
||||
|
||||
public String getMessage(String code) {
|
||||
if (code == null)
|
||||
return null;
|
||||
ErrorCodeVO vo = messages.get(code);
|
||||
if (vo == null) {
|
||||
return "EAI 내부 시스템 오류";
|
||||
}
|
||||
String msg = vo.getMsgTxt();
|
||||
return (msg == null) ? "UNDEFINE" : msg;
|
||||
}
|
||||
|
||||
public String getMessageEtc(String code) {
|
||||
if (code == null)
|
||||
return null;
|
||||
ErrorCodeVO vo = messages.get(code);
|
||||
if (vo == null) {
|
||||
return "EAI 내부 시스템 오류";
|
||||
}
|
||||
String msgEtc = vo.getMsgEtc();
|
||||
return (msgEtc == null) ? "UNDEFINE" : msgEtc;
|
||||
}
|
||||
|
||||
public ErrorCodeVO getMessageVO(String code) {
|
||||
if (code == null)
|
||||
return null;
|
||||
return messages.get(code);
|
||||
}
|
||||
|
||||
public void setMessage(ErrorCodeVO vo) {
|
||||
if (vo != null) {
|
||||
messages.put(vo.getMsgKey(), vo);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeMessage(String code) {
|
||||
messages.remove(code);
|
||||
}
|
||||
|
||||
public String[] getAllCodes() {
|
||||
return messages.keySet().toArray(new String[0]);
|
||||
}
|
||||
|
||||
public Map<String, ErrorCodeVO> getAllCodeMessages() {
|
||||
return this.messages;
|
||||
}
|
||||
|
||||
public synchronized void reload() throws Exception {
|
||||
init();
|
||||
}
|
||||
|
||||
public synchronized void reload(String key) throws Exception {
|
||||
ErrorCodeVO vo = errorCodeDAO.getMessages(key);
|
||||
|
||||
if (vo != null) {
|
||||
this.messages.put(key, vo);
|
||||
} else {
|
||||
throw new Exception("CodeMessageManager not found in Database : key[" + key + "]");
|
||||
}
|
||||
}
|
||||
|
||||
public void addLifecycleListener(LifecycleListener listener) {
|
||||
lifecycle.addLifecycleListener(listener);
|
||||
}
|
||||
|
||||
public LifecycleListener[] findLifecycleListeners() {
|
||||
return lifecycle.findLifecycleListeners();
|
||||
}
|
||||
|
||||
public void removeLifecycleListener(LifecycleListener listener) {
|
||||
lifecycle.removeLifecycleListener(listener);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.eactive.eai.common.errorcode;
|
||||
|
||||
import com.eactive.eai.common.util.NullControl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class ErrorCodeVO implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String msgKey; // 메시지[TSEAIMS01.Msg]
|
||||
private String msgTxt; // 메시지내용[TSEAIMS01.MsgCtnt]
|
||||
private String msgEtc; // 조치사항내용[TSEAIMS01.TreatMatrCtnt]
|
||||
|
||||
public ErrorCodeVO() {
|
||||
this("");
|
||||
}
|
||||
|
||||
public ErrorCodeVO(String msgKey) {
|
||||
this(msgKey, "");
|
||||
}
|
||||
|
||||
public ErrorCodeVO(String msgKey, String msgTxt) {
|
||||
this.msgKey = msgKey;
|
||||
this.msgTxt = msgTxt;
|
||||
}
|
||||
|
||||
public void setMsgKey(String msgKey) {
|
||||
this.msgKey = msgKey;
|
||||
}
|
||||
|
||||
public String getMsgKey() {
|
||||
return this.msgKey;
|
||||
}
|
||||
|
||||
public void setMsgTxt(String msgTxt) {
|
||||
this.msgTxt = msgTxt;
|
||||
}
|
||||
|
||||
public String getMsgTxt() {
|
||||
return this.msgTxt;
|
||||
}
|
||||
|
||||
public void setMsgEtc(String msgEtc) {
|
||||
this.msgEtc = msgEtc;
|
||||
}
|
||||
|
||||
public String getMsgEtc() {
|
||||
return NullControl.trimSpace(this.msgEtc);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.eactive.eai.common.errorcode.mapper;
|
||||
|
||||
import org.mapstruct.InheritInverseConfiguration;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
import com.eactive.eai.common.errorcode.ErrorCodeVO;
|
||||
import com.eactive.eai.data.entity.onl.errorcode.ErrorCode;
|
||||
import com.eactive.eai.data.mapper.GenericMapper;
|
||||
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface ErrorCodeMapper extends GenericMapper<ErrorCodeVO, ErrorCode> {
|
||||
|
||||
@Mapping(source = "msg", target = "msgKey")
|
||||
@Mapping(source = "msgctnt", target = "msgTxt")
|
||||
@Mapping(source = "treatmatrctnt", target = "msgEtc")
|
||||
@Override
|
||||
ErrorCodeVO toVo(ErrorCode entity);
|
||||
|
||||
@InheritInverseConfiguration
|
||||
ErrorCode toEntity(ErrorCodeVO vo);
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.eactive.eai.common.exception;
|
||||
|
||||
public interface ExceptionHandleService {
|
||||
/**
|
||||
* 1. 기능 : Exception 발생 시 약속된 메시지 코드를 반환하기 위한 메서드
|
||||
* 2. 처리 개요 : Exception 내 메시지가 메시지 코드 체계인지를 판단해서 메시지 체계이면 Excepiton의 메시지를 반환하고,
|
||||
* 그렇지 않다면 파라미터에 새로 정의한 메시지 코드를 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param cause 발생한 오류
|
||||
* @param code 새로 정의할 메시지 코드
|
||||
* @return 메시지 코드
|
||||
**/
|
||||
public String getErrorCode(Throwable cause, String code);
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Error 코드 및 텍스트를 정의된 포맷으로 만드는 메서드
|
||||
* 2. 처리 개요 : Error 코드 및 텍스트를 정의된 포맷으로 만들어 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param errorCode 에러 코드
|
||||
* @param errorText 에러 텍스트
|
||||
* @return 에러코드와 텍스트
|
||||
**/
|
||||
public String make(String errorCode, String errorText);
|
||||
|
||||
/**
|
||||
* 1. 기능 : Error 코드 및 텍스트를 정의된 포맷으로 만드는 메서드
|
||||
* 2. 처리 개요 : Error 코드 및 텍스트를 정의된 포맷으로 만들어 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param errorCode 에러 코드
|
||||
* @param causeErrorCode 최초 발생한 오류 코드
|
||||
* @param errorText 에러 텍스트
|
||||
* @return 에러코드와 텍스트
|
||||
**/
|
||||
public String make(String errorCode, String causeErrorCode, String errorText);
|
||||
|
||||
/**
|
||||
* 1. 기능 : Error 코드에 대한 텍스트를 정의된 포맷으로 만드는 메서드
|
||||
* 2. 처리 개요 : Error 코드 및 텍스트를 정의된 포맷으로 만들어 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param errorCode 에러 코드
|
||||
* @param args 에러 텍스트에 셋팅할 인수 리스트
|
||||
* @return 에러코드와 텍스트
|
||||
**/
|
||||
public String make(String errorCode, String[] args);
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Error 코드에 대한 텍스트를 정의된 포맷으로 만드는 메서드
|
||||
* 2. 처리 개요 : Error 코드 및 텍스트를 정의된 포맷으로 만들어 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param errorCode 에러 코드
|
||||
* @param causeErrorCode 최초 발생한 오류 코드
|
||||
* @param args 에러 텍스트에 셋팅할 인수 리스트
|
||||
* @return 에러코드와 텍스트
|
||||
**/
|
||||
public String make(String errorCode, String causeErrorCode, String[] args);
|
||||
|
||||
/**
|
||||
* 1. 기능 : Error 코드에 대한 텍스트를 정의된 포맷으로 만드는 메서드
|
||||
* 2. 처리 개요 : Error 코드 및 텍스트를 정의된 포맷으로 만들어 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param cause 발생한 오류
|
||||
* @param errorCode 에러 코드
|
||||
* @param args 에러 텍스트에 셋팅할 인수 리스트
|
||||
* @return 에러코드와 텍스트
|
||||
**/
|
||||
public String make(Throwable cause, String errorCode, String[] args);
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Error 코드에 대한 텍스트를 정의된 포맷으로 만드는 메서드
|
||||
* 2. 처리 개요 : Error 코드 및 텍스트를 정의된 포맷으로 만들어 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param cause 발생한 오류
|
||||
* @param errorCode 에러 코드
|
||||
* @return 에러코드와 텍스트
|
||||
**/
|
||||
public String make(Throwable cause, String errorCode);
|
||||
|
||||
|
||||
public String formatErrorCode( String code );
|
||||
|
||||
public String makeExceptionCause(Throwable cause);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.eactive.eai.common.exception;
|
||||
|
||||
public class ExceptionUtil {
|
||||
private static ExceptionHandleService exceptionHandleService;
|
||||
|
||||
static{
|
||||
try {
|
||||
Class<ExceptionHandleService> exceptionHandleServiceClass = (Class<ExceptionHandleService>) Class.forName("com.eactive.eai.common.exception.ExceptionHandlerServiceImpl");
|
||||
exceptionHandleService = exceptionHandleServiceClass.newInstance();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Exception 발생 시 약속된 메시지 코드를 반환하기 위한 메서드
|
||||
* 2. 처리 개요 : Exception 내 메시지가 메시지 코드 체계인지를 판단해서 메시지 체계이면 Excepiton의 메시지를 반환하고,
|
||||
* 그렇지 않다면 파라미터에 새로 정의한 메시지 코드를 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param cause 발생한 오류
|
||||
* @param code 새로 정의할 메시지 코드
|
||||
* @return 메시지 코드
|
||||
**/
|
||||
public static String getErrorCode(Throwable cause, String code){
|
||||
return exceptionHandleService.getErrorCode(cause, code);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Error 코드 및 텍스트를 정의된 포맷으로 만드는 메서드
|
||||
* 2. 처리 개요 : Error 코드 및 텍스트를 정의된 포맷으로 만들어 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param errorCode 에러 코드
|
||||
* @param errorText 에러 텍스트
|
||||
* @return 에러코드와 텍스트
|
||||
**/
|
||||
public static String make(String errorCode, String errorText){
|
||||
return exceptionHandleService.make(errorCode, errorText);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Error 코드 및 텍스트를 정의된 포맷으로 만드는 메서드
|
||||
* 2. 처리 개요 : Error 코드 및 텍스트를 정의된 포맷으로 만들어 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param errorCode 에러 코드
|
||||
* @param causeErrorCode 최초 발생한 오류 코드
|
||||
* @param errorText 에러 텍스트
|
||||
* @return 에러코드와 텍스트
|
||||
**/
|
||||
public static String make(String errorCode, String causeErrorCode, String errorText){
|
||||
return exceptionHandleService.make(errorCode, causeErrorCode, errorText);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Error 코드에 대한 텍스트를 정의된 포맷으로 만드는 메서드
|
||||
* 2. 처리 개요 : Error 코드 및 텍스트를 정의된 포맷으로 만들어 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param errorCode 에러 코드
|
||||
* @param args 에러 텍스트에 셋팅할 인수 리스트
|
||||
* @return 에러코드와 텍스트
|
||||
**/
|
||||
public static String make(String errorCode, String... args){
|
||||
return exceptionHandleService.make(errorCode, args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Error 코드에 대한 텍스트를 정의된 포맷으로 만드는 메서드
|
||||
* 2. 처리 개요 : Error 코드 및 텍스트를 정의된 포맷으로 만들어 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param errorCode 에러 코드
|
||||
* @param causeErrorCode 최초 발생한 오류 코드
|
||||
* @param args 에러 텍스트에 셋팅할 인수 리스트
|
||||
* @return 에러코드와 텍스트
|
||||
**/
|
||||
public static String make(String errorCode, String causeErrorCode, String[] args){
|
||||
return exceptionHandleService.make(errorCode, causeErrorCode, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Error 코드에 대한 텍스트를 정의된 포맷으로 만드는 메서드
|
||||
* 2. 처리 개요 : Error 코드 및 텍스트를 정의된 포맷으로 만들어 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param cause 발생한 오류
|
||||
* @param errorCode 에러 코드
|
||||
* @param args 에러 텍스트에 셋팅할 인수 리스트
|
||||
* @return 에러코드와 텍스트
|
||||
**/
|
||||
public static String make(Throwable cause, String errorCode, String[] args){
|
||||
return exceptionHandleService.make(cause, errorCode, args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Error 코드에 대한 텍스트를 정의된 포맷으로 만드는 메서드
|
||||
* 2. 처리 개요 : Error 코드 및 텍스트를 정의된 포맷으로 만들어 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param cause 발생한 오류
|
||||
* @param errorCode 에러 코드
|
||||
* @return 에러코드와 텍스트
|
||||
**/
|
||||
public static String make(Throwable cause, String errorCode){
|
||||
return exceptionHandleService.make(cause, errorCode);
|
||||
}
|
||||
|
||||
|
||||
public static String formatErrorCode( String code ){
|
||||
return exceptionHandleService.formatErrorCode(code);
|
||||
}
|
||||
|
||||
public static String makeExceptionCause(Throwable cause){
|
||||
return exceptionHandleService.makeExceptionCause(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.eactive.eai.common.lifecycle;
|
||||
|
||||
//import com.eactive.eai.adapter.AdapterGroupVO;
|
||||
//import com.eactive.eai.adapter.AdapterVO;
|
||||
import com.eactive.eai.common.errorcode.ErrorCodeHandler;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : LifecyclEvent를 수신 처리하는 기본 리스너 클래스
|
||||
* 2. 처리 개요 : LifecycleEvent를 받아 로깅한다.
|
||||
* * -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see : 관련 기능을 참조
|
||||
* @since :
|
||||
* :
|
||||
*/
|
||||
public class DefaultLifecycleListener implements LifecycleListener
|
||||
{
|
||||
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
/**
|
||||
* 1. 기능 : LifecycleEvent를 수신하여 로깅하는 메서드
|
||||
* 2. 처리 개요 : LifecycleEvent를 받아 약속된 포맷으로 Logger를 통해 로깅한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param event Lifecycle의 start, stop Event 정보를 표현한 Value Object
|
||||
**/
|
||||
public void lifecycleEvent(LifecycleEvent event)
|
||||
{
|
||||
Object data = event.getData();
|
||||
if(data==null) {
|
||||
String code = "RWCEAICLC001";
|
||||
if (logger.isWarn()) logger.warn(ExceptionUtil.make(code, ErrorCodeHandler.getMessage(code))+"["+event+"]");
|
||||
return;
|
||||
}
|
||||
|
||||
String type = event.getType();
|
||||
String name = data.getClass().getName();
|
||||
int idx = name.lastIndexOf(".");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append((idx==-1)? name : name.substring(idx+1)).append("] ");
|
||||
sb.append("It is ").append(type).append(".");
|
||||
// if(data instanceof AdapterGroupVO) {
|
||||
// sb.append(" >> ").append(((AdapterGroupVO)data).getName());
|
||||
// } else if(data instanceof AdapterVO) {
|
||||
// sb.append(" >> ").append(((AdapterVO)data).getName());
|
||||
// }
|
||||
if (logger.isDebug()) logger.debug(sb.toString());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
|
||||
|
||||
|
||||
package com.eactive.eai.common.lifecycle;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : 어플리케이션 기동/종료에 따른 비즈니스 로직 처리를 위해 정의한 인터페이스
|
||||
* 2. 처리 개요 : 어플리케이션 기동/종료 및 이벤트 처리를 위한 메서드를 정의한다.
|
||||
* * -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see : 관련 기능을 참조
|
||||
* @since :
|
||||
* :
|
||||
*/
|
||||
public interface Lifecycle {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The LifecycleEvent type for the "component start" event.
|
||||
*/
|
||||
public static final String STARTING_EVENT = "starting";
|
||||
|
||||
|
||||
/**
|
||||
* The LifecycleEvent type for the "component before start" event.
|
||||
*/
|
||||
public static final String STARTED_EVENT = "started";
|
||||
|
||||
|
||||
/**
|
||||
* The LifecycleEvent type for the "component stop" event.
|
||||
*/
|
||||
public static final String STOPING_EVENT = "stoping";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The LifecycleEvent type for the "component after stop" event.
|
||||
*/
|
||||
public static final String STOPPED_EVENT = "stopped";
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Add a LifecycleEvent listener to this component.
|
||||
*
|
||||
* @param listener The listener to add
|
||||
*/
|
||||
public void addLifecycleListener(LifecycleListener listener);
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Get the lifecycle listeners associated with this lifecycle. If this
|
||||
* Lifecycle has no listeners registered, a zero-length array is returned.
|
||||
*/
|
||||
public LifecycleListener[] findLifecycleListeners();
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Remove a LifecycleEvent listener from this component.
|
||||
*
|
||||
* @param listener The listener to remove
|
||||
*/
|
||||
public void removeLifecycleListener(LifecycleListener listener);
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Prepare for the beginning of active use of the public methods of this
|
||||
* component. This method should be called before any of the public
|
||||
* methods of this component are utilized. It should also send a
|
||||
* LifecycleEvent of type START_EVENT to any registered listeners.
|
||||
*
|
||||
* @exception LifecycleException if this component detects a fatal error
|
||||
* that prevents this component from being used
|
||||
*/
|
||||
public void start() throws LifecycleException;
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Gracefully terminate the active use of the public methods of this
|
||||
* component. This method should be the last one called on a given
|
||||
* instance of this component. It should also send a LifecycleEvent
|
||||
* of type STOP_EVENT to any registered listeners.
|
||||
*
|
||||
* @exception LifecycleException if this component detects a fatal error
|
||||
* that needs to be reported
|
||||
*/
|
||||
public void stop() throws LifecycleException;
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : 기동 여부를 반환하느 메서드
|
||||
* 2. 처리 개요 : 기동 여부 변수를 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @return 기동 여부
|
||||
**/
|
||||
public boolean isStarted();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.eactive.eai.common.lifecycle;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.common.dao.BaseDAO;
|
||||
import com.eactive.eai.common.dao.DAOException;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.lifecycle.loader.LifeCycleLoader;
|
||||
import com.eactive.eai.common.lifecycle.mapper.LifeCycleMapper;
|
||||
import com.eactive.eai.data.entity.onl.lifecycle.LifeCycle;
|
||||
|
||||
@Component
|
||||
@Transactional
|
||||
public class LifecycleDAO extends BaseDAO {
|
||||
|
||||
@Autowired
|
||||
private LifeCycleLoader lifeCycleLoader;
|
||||
|
||||
@Autowired
|
||||
private LifeCycleMapper lifeCycleMapper;
|
||||
|
||||
public List<LifecycleVO> getAllLifecycles() throws DAOException {
|
||||
List<LifecycleVO> list = new ArrayList<>();
|
||||
try {
|
||||
List<LifeCycle> lifeCycles = lifeCycleLoader.findAll();
|
||||
|
||||
for (LifeCycle lifeCycle : lifeCycles) {
|
||||
list.add(lifeCycleMapper.toVo(lifeCycle));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICLC101"));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public LifecycleVO getLifecycle(String lifecycleClass) throws DAOException {
|
||||
try {
|
||||
LifeCycle lifeCycle = lifeCycleLoader.getById(lifecycleClass);
|
||||
return lifeCycleMapper.toVo(lifeCycle);
|
||||
} catch (Exception e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICLC103"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
|
||||
|
||||
package com.eactive.eai.common.lifecycle;
|
||||
|
||||
|
||||
import java.util.EventObject;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Lifecycle Event 를 정의한 클래스
|
||||
* 2. 처리 개요 : Lifecycle Event를 표현한 Event 클래스
|
||||
* General event for notifying listeners of significant changes on a component
|
||||
* that implements the Lifecycle interface. In particular, this will be useful
|
||||
* on Containers, where these events replace the ContextInterceptor concept in
|
||||
* Tomcat 3.x.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author : Craig R. McClanahan
|
||||
* @version : $Revision: 1.1 $ $Date: 2008/04/07 06:43:42 $
|
||||
* @see :
|
||||
* @since :
|
||||
* :
|
||||
*/
|
||||
|
||||
public final class LifecycleEvent
|
||||
extends EventObject {
|
||||
|
||||
|
||||
// ----------------------------------------------------------- Constructors
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Construct a new LifecycleEvent with the specified parameters.
|
||||
* 2. 처리 개요 :
|
||||
* - Construct a new LifecycleEvent with the specified parameters.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param lifecycle Component on which this event occurred
|
||||
* @param type Event type (required)
|
||||
**/
|
||||
public LifecycleEvent(Lifecycle lifecycle, String type) {
|
||||
|
||||
this(lifecycle, type, null);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Construct a new LifecycleEvent with the specified parameters.
|
||||
* 2. 처리 개요 :
|
||||
* - Construct a new LifecycleEvent with the specified parameters.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param lifecycle Component on which this event occurred
|
||||
* @param type Event type (required)
|
||||
* @param data Event data (if any)
|
||||
**/
|
||||
public LifecycleEvent(Lifecycle lifecycle, String type, Object data) {
|
||||
|
||||
super(lifecycle);
|
||||
this.lifecycle = lifecycle;
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------- Instance Variables
|
||||
|
||||
|
||||
/**
|
||||
* The event data associated with this event.
|
||||
*/
|
||||
private Object data = null;
|
||||
|
||||
|
||||
/**
|
||||
* The Lifecycle on which this event occurred.
|
||||
*/
|
||||
private Lifecycle lifecycle = null;
|
||||
|
||||
|
||||
/**
|
||||
* The event type this instance represents.
|
||||
*/
|
||||
private String type = null;
|
||||
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Return the event data of this event.
|
||||
* 2. 처리 개요 :
|
||||
* - Return the event data of this event.
|
||||
* 3. 주의사항
|
||||
*
|
||||
**/
|
||||
public Object getData() {
|
||||
|
||||
return (this.data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Return the Lifecycle on which this event occurred.
|
||||
* 2. 처리 개요 :
|
||||
* - Return the Lifecycle on which this event occurred.
|
||||
* 3. 주의사항
|
||||
*
|
||||
**/
|
||||
public Lifecycle getLifecycle() {
|
||||
|
||||
return (this.lifecycle);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Return the event type of this event.
|
||||
* 2. 처리 개요 :
|
||||
* - Return the event type of this event.
|
||||
* 3. 주의사항
|
||||
**/
|
||||
public String getType() {
|
||||
|
||||
return (this.type);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
|
||||
package com.eactive.eai.common.lifecycle;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Lifecycle 예외 처리를 위한 Exception 클래스
|
||||
* 2. 처리 개요 : Lifecycle 예외 처리를 위한 Exception 클래스
|
||||
* * -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see : 관련 기능을 참조
|
||||
* @since :
|
||||
* :
|
||||
*/
|
||||
public final class LifecycleException extends Exception {
|
||||
|
||||
|
||||
//------------------------------------------------------------ Constructors
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Construct a new LifecycleException with no other information.
|
||||
* 2. 처리 개요 : Default Constructor
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
**/
|
||||
public LifecycleException() {
|
||||
|
||||
this(null, null);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Construct a new LifecycleException for the specified message.
|
||||
* 2. 처리 개요 : 파라미터의 예외 발생 원인을 초기화한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param message Message describing this exception
|
||||
**/
|
||||
public LifecycleException(String message) {
|
||||
|
||||
this(message, null);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Construct a new LifecycleException for the specified throwable.
|
||||
* 2. 처리 개요 : 파라미터의 오류(Throwable)을 Wrapper하기 위해 멤버에 초기화 한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param cause Throwable that caused this exception
|
||||
**/
|
||||
public LifecycleException(Throwable cause) {
|
||||
|
||||
this(null, cause);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Construct a new LifecycleException for the specified message and cause.
|
||||
* 2. 처리 개요 : 파라미터의 값을 멤버 변수에 초기화 한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param message Message describing this exception
|
||||
* @param cause Throwable that caused this exception
|
||||
**/
|
||||
public LifecycleException(String message, Throwable cause) {
|
||||
|
||||
super(message, cause);
|
||||
this.message = message;
|
||||
//this.cause = cause;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------ Instance Variables
|
||||
|
||||
|
||||
/**
|
||||
* The error message passed to our constructor (if any)
|
||||
*/
|
||||
protected String message = null;
|
||||
|
||||
|
||||
/**
|
||||
* The underlying exception or error passed to our constructor (if any)
|
||||
*/
|
||||
//protected Throwable cause = null;
|
||||
|
||||
|
||||
//---------------------------------------------------------- Public Methods
|
||||
|
||||
/**
|
||||
* 1. 기능 : Returns the message associated with this exception, if any.
|
||||
* 2. 처리 개요 : 오류 발생 원인을 반환한다.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @return Exception 발생 원인
|
||||
**/
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String getMessage() {
|
||||
return (message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Returns the cause that caused this exception, if any.
|
||||
* 2. 처리 개요 : 발생한 오류를 표현하는 Throwable
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @return 발생한 오류를 표현하는 Throwable
|
||||
**/
|
||||
public Throwable getThrowable() {
|
||||
return getCause();
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Return a formatted string that describes this exception.
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @return
|
||||
**/
|
||||
// public String toString() {
|
||||
//
|
||||
// StringBuffer sb = new StringBuffer("LifecycleException: ");
|
||||
// if (message != null) {
|
||||
// sb.append(message);
|
||||
// if (getCause() != null) {
|
||||
// sb.append(": ");
|
||||
// }
|
||||
// }
|
||||
// if (getCause() != null) {
|
||||
// sb.append(getCause().toString());
|
||||
// }
|
||||
// return (sb.toString());
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
|
||||
|
||||
package com.eactive.eai.common.lifecycle;
|
||||
|
||||
/**
|
||||
* 1. 기능 : LifecyclEvent를 수신하여 비즈니스 로직을 처리하기 위한 Listener 인터페이스
|
||||
* 2. 처리 개요 : LifecycleEvent를 수신하기 위한 Listener 인터페이스를 정의한다.
|
||||
* - Interface defining a listener for significant events (including "component
|
||||
* start" and "component stop" generated by a component that implements the
|
||||
* Lifecycle interface.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see : 관련 기능을 참조
|
||||
* @since :
|
||||
* :
|
||||
*/
|
||||
|
||||
public interface LifecycleListener {
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : LifecycleEvent 발생 시 실행된느 메서드
|
||||
* 2. 처리 개요 : LifecycleEvent 발생 시 실행되는 메서드이다.
|
||||
* - Acknowledge the occurrence of the specified event.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param event LifecycleEvent that has occurred
|
||||
**/
|
||||
public void lifecycleEvent(LifecycleEvent event);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package com.eactive.eai.common.lifecycle;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.eactive.eai.common.errorcode.ErrorCodeHandler;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
@Component
|
||||
public class LifecycleManager implements Lifecycle {
|
||||
|
||||
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
private boolean started = false;
|
||||
private LifecycleSupport lifecycle = new LifecycleSupport(this);
|
||||
|
||||
private List<Lifecycle> lifecycles;
|
||||
|
||||
private List<LifecycleVO> lifecycleVos;
|
||||
|
||||
private LifecycleListener listener;
|
||||
|
||||
@Autowired
|
||||
private LifecycleDAO lifecycleDAO;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
public void start() throws LifecycleException {
|
||||
|
||||
if (started)
|
||||
throw new LifecycleException("RECEAICLC201");
|
||||
|
||||
try {
|
||||
listener = new DefaultLifecycleListener();
|
||||
this.addLifecycleListener(listener);
|
||||
lifecycle.fireLifecycleEvent(STARTING_EVENT, this);
|
||||
|
||||
lifecycles = new ArrayList<>();
|
||||
lifecycleVos = lifecycleDAO.getAllLifecycles();
|
||||
|
||||
Collections.sort(lifecycleVos);
|
||||
|
||||
initalizeLifecycles();
|
||||
|
||||
lifecycle.fireLifecycleEvent(STARTED_EVENT, this);
|
||||
} catch (Exception e) {
|
||||
throw new LifecycleException(ExceptionUtil.getErrorCode(e, "RECEAICLC207"));
|
||||
} finally {
|
||||
started = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void initalizeLifecycles() {
|
||||
for (int i = 0; i < lifecycleVos.size(); i++) {
|
||||
LifecycleVO vo = lifecycleVos.get(i);
|
||||
try {
|
||||
if (vo.getLoadSequence() <= 0) {
|
||||
if (logger.isDebug()) {
|
||||
logger.debug(ExceptionUtil.make("RDCEAICLC205", vo.toString()));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Lifecycle lf = getLifecycleInstance(vo);
|
||||
lf.addLifecycleListener(listener);
|
||||
lf.start();
|
||||
lifecycles.add(lf);
|
||||
|
||||
} catch (Exception e) {
|
||||
String code = "RECEAICLC206";
|
||||
if (logger.isError())
|
||||
logger.error(ExceptionUtil.make(code, ErrorCodeHandler.getMessage(code)), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Lifecycle getLifecycleInstance(LifecycleVO vo)
|
||||
throws ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException,
|
||||
IllegalArgumentException, InvocationTargetException, LifecycleException {
|
||||
if (logger.isInfo()) {
|
||||
logger.info("LifecycleManager] Start ==> " + vo);
|
||||
}
|
||||
Class<?> cl = Class.forName(vo.getLifecycleClass());
|
||||
Object obj = null;
|
||||
try {
|
||||
obj = applicationContext.getBean(cl);
|
||||
} catch (Exception e) {
|
||||
Method m = cl.getDeclaredMethod("getInstance");
|
||||
obj = m.invoke(null);
|
||||
}
|
||||
|
||||
if (obj == null) {
|
||||
throw new LifecycleException("Fail to start the Lifecycle. - " + vo);
|
||||
}
|
||||
|
||||
return (Lifecycle) obj;
|
||||
}
|
||||
|
||||
public void stop() throws LifecycleException {
|
||||
if (!started)
|
||||
throw new LifecycleException("RECEAICLC203");
|
||||
lifecycle.fireLifecycleEvent(STOPING_EVENT, this);
|
||||
|
||||
Lifecycle lf = null;
|
||||
for (int i = lifecycles.size() - 1; i >= 0; i--) {
|
||||
lf = lifecycles.get(i);
|
||||
if (!lf.isStarted())
|
||||
continue;
|
||||
|
||||
String[] msgArgs = new String[1];
|
||||
msgArgs[0] = lf.getClass().getName();
|
||||
if (logger.isDebug())
|
||||
logger.debug(ExceptionUtil.make("RDCEAICLC208", msgArgs));
|
||||
|
||||
try {
|
||||
lf.stop();
|
||||
lf.removeLifecycleListener(listener);
|
||||
} catch (Exception e) {
|
||||
String code = "RECEAICLC209";
|
||||
if (logger.isError())
|
||||
logger.error(ExceptionUtil.make(code, ErrorCodeHandler.getMessage(code)), e);
|
||||
}
|
||||
}
|
||||
|
||||
this.lifecycleVos.clear();
|
||||
this.lifecycles.clear();
|
||||
|
||||
started = false;
|
||||
lifecycle.fireLifecycleEvent(STOPPED_EVENT, this);
|
||||
this.removeLifecycleListener(this.listener);
|
||||
}
|
||||
|
||||
public boolean isStarted() {
|
||||
return this.started;
|
||||
}
|
||||
|
||||
public void addLifecycleListener(LifecycleListener listener) {
|
||||
lifecycle.addLifecycleListener(listener);
|
||||
}
|
||||
|
||||
public LifecycleListener[] findLifecycleListeners() {
|
||||
return lifecycle.findLifecycleListeners();
|
||||
}
|
||||
|
||||
public void removeLifecycleListener(LifecycleListener listener) {
|
||||
lifecycle.removeLifecycleListener(listener);
|
||||
}
|
||||
|
||||
public void addLifecycle(LifecycleVO vo) {
|
||||
lifecycleVos.add(vo);
|
||||
}
|
||||
|
||||
public void removeLifecycle(String lifecycleClass) {
|
||||
if (lifecycleVos == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
lifecycleVos.removeIf(lifecycleVo -> lifecycleClass.equalsIgnoreCase(lifecycleVo.getLifecycleClass()));
|
||||
}
|
||||
|
||||
public List<LifecycleVO> getLifecycleVOList() {
|
||||
return lifecycleVos;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
|
||||
|
||||
|
||||
package com.eactive.eai.common.lifecycle;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 :
|
||||
* 2. 처리 개요 :
|
||||
* * -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see : 관련 기능을 참조
|
||||
* @since :
|
||||
* :
|
||||
*/
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Support class to assist in firing LifecycleEvent notifications to
|
||||
* registered LifecycleListeners.
|
||||
*
|
||||
* @author Craig R. McClanahan
|
||||
* @version $Id: LifecycleSupport.java,v 1.1 2008/04/07 06:43:41 dhlee Exp $
|
||||
*/
|
||||
|
||||
public final class LifecycleSupport implements Serializable {
|
||||
|
||||
|
||||
// ----------------------------------------------------------- Constructors
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 :
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @exception
|
||||
**/
|
||||
/**
|
||||
* Construct a new LifecycleSupport object associated with the specified
|
||||
* Lifecycle component.
|
||||
*
|
||||
* @param lifecycle The Lifecycle component that will be the source
|
||||
* of events that we fire
|
||||
*/
|
||||
public LifecycleSupport(Lifecycle lifecycle) {
|
||||
|
||||
super();
|
||||
this.lifecycle = lifecycle;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------- Instance Variables
|
||||
|
||||
|
||||
/**
|
||||
* The source component for lifecycle events that we will fire.
|
||||
*/
|
||||
private Lifecycle lifecycle = null;
|
||||
|
||||
|
||||
/**
|
||||
* The set of registered LifecycleListeners for event notifications.
|
||||
*/
|
||||
private LifecycleListener listeners[] = new LifecycleListener[0];
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 :
|
||||
* 2. 처리 개요 : Add a lifecycle event listener to this component.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param listener The listener to add
|
||||
*/
|
||||
public void addLifecycleListener(LifecycleListener listener) {
|
||||
|
||||
synchronized (listeners) {
|
||||
LifecycleListener results[] =
|
||||
new LifecycleListener[listeners.length + 1];
|
||||
for (int i = 0; i < listeners.length; i++)
|
||||
results[i] = listeners[i];
|
||||
results[listeners.length] = listener;
|
||||
listeners = results;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 :
|
||||
* 2. 처리 개요 : Get the lifecycle listeners associated with this lifecycle. If this
|
||||
* Lifecycle has no listeners registered, a zero-length array is returned.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
**/
|
||||
public LifecycleListener[] findLifecycleListeners() {
|
||||
|
||||
return listeners;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 :
|
||||
* 2. 처리 개요 : Notify all lifecycle event listeners that a particular event has
|
||||
* occurred for this Container. The default implementation performs
|
||||
* this notification synchronously using the calling thread.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param type Event type
|
||||
* @param data Event data
|
||||
**/
|
||||
public void fireLifecycleEvent(String type, Object data) {
|
||||
|
||||
LifecycleEvent event = new LifecycleEvent(lifecycle, type, data);
|
||||
LifecycleListener interested[] = null;
|
||||
synchronized (listeners) {
|
||||
interested = (LifecycleListener[]) listeners.clone();
|
||||
}
|
||||
for (int i = 0; i < interested.length; i++)
|
||||
interested[i].lifecycleEvent(event);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Remove a lifecycle event listener from this component.
|
||||
* 2. 처리 개요 : Remove a lifecycle event listener from this component.
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param listener The listener to remove
|
||||
**/
|
||||
public void removeLifecycleListener(LifecycleListener listener) {
|
||||
|
||||
synchronized (listeners) {
|
||||
int n = -1;
|
||||
for (int i = 0; i < listeners.length; i++) {
|
||||
if (listeners[i] == listener) {
|
||||
n = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (n < 0)
|
||||
return;
|
||||
LifecycleListener results[] =
|
||||
new LifecycleListener[listeners.length - 1];
|
||||
int j = 0;
|
||||
for (int i = 0; i < listeners.length; i++) {
|
||||
if (i != n)
|
||||
results[j++] = listeners[i];
|
||||
}
|
||||
listeners = results;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.eactive.eai.common.lifecycle;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LifecycleVO implements Serializable, Comparable<LifecycleVO> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String lifecycleClass;
|
||||
|
||||
private int loadSequence;
|
||||
|
||||
private String lifeCyclUseDstcd;
|
||||
|
||||
public LifecycleVO() {
|
||||
this("", -1);
|
||||
}
|
||||
|
||||
public LifecycleVO(String lifecycleClass, int loadSequence) {
|
||||
this.lifecycleClass = lifecycleClass;
|
||||
this.loadSequence = loadSequence;
|
||||
}
|
||||
|
||||
public LifecycleVO(String lifecycleClass, int loadSequence, String lifeCyclUseDstcd) {
|
||||
this.lifecycleClass = lifecycleClass;
|
||||
this.loadSequence = loadSequence;
|
||||
this.lifeCyclUseDstcd = lifeCyclUseDstcd;
|
||||
}
|
||||
|
||||
public int compareTo(LifecycleVO obj) {
|
||||
if (!(obj instanceof LifecycleVO)) {
|
||||
return -1;
|
||||
}
|
||||
LifecycleVO l = obj;
|
||||
return this.getLoadSequence() - l.getLoadSequence();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.eactive.eai.common.lifecycle.mapper;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
import com.eactive.eai.common.lifecycle.LifecycleVO;
|
||||
import com.eactive.eai.data.entity.onl.lifecycle.LifeCycle;
|
||||
import com.eactive.eai.data.mapper.GenericMapper;
|
||||
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface LifeCycleMapper extends GenericMapper<LifecycleVO, LifeCycle> {
|
||||
|
||||
@Mapping(source = "lifecyclclsname", target = "lifecycleClass")
|
||||
@Mapping(source = "lifecyclusedstcd", target = "lifeCyclUseDstcd")
|
||||
@Mapping(source = "lodinseq", target = "loadSequence")
|
||||
@Override
|
||||
LifecycleVO toVo(LifeCycle entity);
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.eactive.eai.common.logger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : EAI에서 처리되는 모든 On-Line 거래를 데이터베이스에 로깅하기 위한
|
||||
* 운영관리 logger 상수 클래스
|
||||
* 2. 처리 개요 :
|
||||
* * - 거래 logger에 필요한 상수를 정의한다.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see : 관련 기능을 참조
|
||||
* @since :
|
||||
*/
|
||||
public interface Keys
|
||||
{
|
||||
/**
|
||||
* EAI 운영관리 Log 기본정보
|
||||
*/
|
||||
public static final String EAI_LOGINFO = "EAILogInfo";
|
||||
|
||||
/**
|
||||
* EAI 운영관리 Log Connection Factory
|
||||
*/
|
||||
public static final String LOG_CONNECTION_FACTORY = "log.connection.factory";
|
||||
/**
|
||||
* EAI 운영관리 Log Queue
|
||||
*/
|
||||
public static final String LOG_QUEUE = "log.queue";
|
||||
|
||||
/**
|
||||
* EAI 운영관리 Log Listener initial count
|
||||
*/
|
||||
// public static final String LOG_LISTENER_INITIAL_COUNT = "log.listener.initial.count";
|
||||
/**
|
||||
* EAI 운영관리 Log Listener maximum count
|
||||
*/
|
||||
// public static final String LOG_LISTENER_MAX_COUNT = "log.listener.max.count";
|
||||
/**
|
||||
* EAI 운영관리 Log Listener 체크 주기
|
||||
*/
|
||||
// public static final String LOG_LISTENER_CHECK_PERIOD = "log.listener.check.period";
|
||||
|
||||
|
||||
/**
|
||||
* 거래로그 sequence
|
||||
*/
|
||||
public static final int LOG_SEQ_1 = 100;
|
||||
public static final int LOG_SEQ_2 = 200;
|
||||
public static final int LOG_SEQ_3 = 300;
|
||||
public static final int LOG_SEQ_4 = 400;
|
||||
|
||||
public static final int LOG_SEQ_9 = 900;
|
||||
|
||||
/**
|
||||
* ALTKEY를 설정하기 위한 Property 키값
|
||||
*/
|
||||
public static final String LOG_ALT_KEY1 = "LOG_ALT_KEY1";
|
||||
public static final String LOG_ALT_KEY2 = "LOG_ALT_KEY2";
|
||||
public static final String LOG_ALT_KEY3 = "LOG_ALT_KEY3";
|
||||
public static final String LOG_ALT_KEY4 = "LOG_ALT_KEY4";
|
||||
public static final String LOG_COMPANY_CODE = "LOG_COMPANY_CODE";
|
||||
public static final String LOG_MSG_LENGTH = "LOG_MSG_LENGTH";
|
||||
|
||||
/**
|
||||
* Outbound에서 정상|오류 메시지에 대한 구분
|
||||
*/
|
||||
public static final String ERROR_MESSAGE = "ERROR_MESSAGE";
|
||||
public static final String TRUE = "TRUE";
|
||||
public static final String FALSE = "FALSE";
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,168 @@
|
||||
package com.eactive.eai.common.monitor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 1. 기능 : 처리내역 통계를 저장
|
||||
* 2. 처리 개요 :
|
||||
* * - MonitorVO에서 해당 키별로 HashMap에 보관
|
||||
* - 스커줄러에 의해 reset되고 reset 전에 DB에 저장함
|
||||
*
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see : 관련 기능을 참조
|
||||
* @since :
|
||||
*/
|
||||
public class StatMonitorLogVO implements Serializable {
|
||||
|
||||
private String ymd;
|
||||
private String hour;
|
||||
private String min;
|
||||
|
||||
private String bzwkDstcd;
|
||||
private String svcName;
|
||||
private String key; // optional
|
||||
private String sevrInstncName;
|
||||
private double prcssTtmVal;
|
||||
private double psvPrcssTtmVal;
|
||||
private double totalPrcssTtmVal;
|
||||
private long wholPrcssNoitm;
|
||||
private long errzNoitm;
|
||||
private long toutNoitm;
|
||||
private long nomalNoitm;
|
||||
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append( "ymd =" + ymd);
|
||||
sb.append("\nhour =" + hour);
|
||||
sb.append("\nmin =" + min);
|
||||
sb.append("\nbzwkDstcd =" + bzwkDstcd);
|
||||
sb.append("\nsvcName =" + svcName);
|
||||
sb.append("\nkey =" + key);
|
||||
sb.append("\nsevrInstncName =" + sevrInstncName);
|
||||
sb.append("\nprcssTtmVal =" + prcssTtmVal);
|
||||
sb.append("\npsvPrcssTtmVal =" + psvPrcssTtmVal);
|
||||
sb.append("\ntotalPrcssTtmVal=" + totalPrcssTtmVal);
|
||||
sb.append("\nwholPrcssNoitm =" + wholPrcssNoitm);
|
||||
sb.append("\nerrzNoitm =" + errzNoitm);
|
||||
sb.append("\ntoutNoitm =" + toutNoitm);
|
||||
sb.append("\nnomalNoitm =" + nomalNoitm);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String getBzwkDstcd() {
|
||||
return bzwkDstcd;
|
||||
}
|
||||
|
||||
public void setBzwkDstcd(String bzwkDstcd) {
|
||||
this.bzwkDstcd = bzwkDstcd;
|
||||
}
|
||||
|
||||
public long getErrzNoitm() {
|
||||
return errzNoitm;
|
||||
}
|
||||
|
||||
public void setErrzNoitm(long errzNoitm) {
|
||||
this.errzNoitm = errzNoitm;
|
||||
}
|
||||
|
||||
public String getHour() {
|
||||
return hour;
|
||||
}
|
||||
|
||||
public void setHour(String hour) {
|
||||
this.hour = hour;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
public void setMin(String min) {
|
||||
this.min = min;
|
||||
}
|
||||
|
||||
public long getNomalNoitm() {
|
||||
return nomalNoitm;
|
||||
}
|
||||
|
||||
public void setNomalNoitm(long nomalNoitm) {
|
||||
this.nomalNoitm = nomalNoitm;
|
||||
}
|
||||
|
||||
public double getPrcssTtmVal() {
|
||||
return prcssTtmVal;
|
||||
}
|
||||
|
||||
public void setPrcssTtmVal(double prcssTtmVal) {
|
||||
this.prcssTtmVal = prcssTtmVal;
|
||||
}
|
||||
|
||||
public double getPsvPrcssTtmVal() {
|
||||
return psvPrcssTtmVal;
|
||||
}
|
||||
|
||||
public void setPsvPrcssTtmVal(double psvPrcssTtmVal) {
|
||||
this.psvPrcssTtmVal = psvPrcssTtmVal;
|
||||
}
|
||||
|
||||
public String getSevrInstncName() {
|
||||
return sevrInstncName;
|
||||
}
|
||||
|
||||
public void setSevrInstncName(String sevrInstncName) {
|
||||
this.sevrInstncName = sevrInstncName;
|
||||
}
|
||||
|
||||
public String getSvcName() {
|
||||
return svcName;
|
||||
}
|
||||
|
||||
public void setSvcName(String svcName) {
|
||||
this.svcName = svcName;
|
||||
}
|
||||
|
||||
public double getTotalPrcssTtmVal() {
|
||||
return totalPrcssTtmVal;
|
||||
}
|
||||
|
||||
public void setTotalPrcssTtmVal(double totalPrcssTtmVal) {
|
||||
this.totalPrcssTtmVal = totalPrcssTtmVal;
|
||||
}
|
||||
|
||||
public long getToutNoitm() {
|
||||
return toutNoitm;
|
||||
}
|
||||
|
||||
public void setToutNoitm(long toutNoitm) {
|
||||
this.toutNoitm = toutNoitm;
|
||||
}
|
||||
|
||||
public long getWholPrcssNoitm() {
|
||||
return wholPrcssNoitm;
|
||||
}
|
||||
|
||||
public void setWholPrcssNoitm(long wholPrcssNoitm) {
|
||||
this.wholPrcssNoitm = wholPrcssNoitm;
|
||||
}
|
||||
|
||||
public String getYmd() {
|
||||
return ymd;
|
||||
}
|
||||
|
||||
public void setYmd(String ymd) {
|
||||
this.ymd = ymd;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
package com.eactive.eai.common.monitor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 1. 기능 : 처리내역 통계를 저장
|
||||
* 2. 처리 개요 :
|
||||
* * - MonitorVO에서 해당 키별로 HashMap에 보관
|
||||
* - 스커줄러에 의해 reset되고 reset 전에 DB에 저장함
|
||||
*
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see : 관련 기능을 참조
|
||||
* @since :
|
||||
*/
|
||||
public class StatMonitorVO implements Serializable {
|
||||
// 정상처리
|
||||
private long cnt100;
|
||||
private long cnt200;
|
||||
private long cnt300;
|
||||
private long cnt400;
|
||||
|
||||
// 에러
|
||||
private long err100;
|
||||
private long err200;
|
||||
private long err300;
|
||||
private long err400;
|
||||
private long err900;
|
||||
|
||||
// 타임아웃
|
||||
private long timeout300;
|
||||
private long timeout400;
|
||||
private long timeout900;
|
||||
|
||||
// 시스템에러 (에러에 간수 포함됨, 중복 count)
|
||||
private long system100;
|
||||
private long system200;
|
||||
private long system300;
|
||||
private long system400;
|
||||
private long system900;
|
||||
|
||||
private double sumOfprocessTime; // 전체처리시간
|
||||
private double psvSumOfPssTime; // 수동처리시간
|
||||
|
||||
public long getCnt100() {
|
||||
return cnt100;
|
||||
}
|
||||
public void setCnt100(long cnt100) {
|
||||
this.cnt100 = cnt100;
|
||||
}
|
||||
public long getCnt200() {
|
||||
return cnt200;
|
||||
}
|
||||
public void setCnt200(long cnt200) {
|
||||
this.cnt200 = cnt200;
|
||||
}
|
||||
public long getCnt300() {
|
||||
return cnt300;
|
||||
}
|
||||
public void setCnt300(long cnt300) {
|
||||
this.cnt300 = cnt300;
|
||||
}
|
||||
public long getCnt400() {
|
||||
return cnt400;
|
||||
}
|
||||
public void setCnt400(long cnt400) {
|
||||
this.cnt400 = cnt400;
|
||||
}
|
||||
public long getErr100() {
|
||||
return err100;
|
||||
}
|
||||
public void setErr100(long err100) {
|
||||
this.err100 = err100;
|
||||
}
|
||||
public long getErr200() {
|
||||
return err200;
|
||||
}
|
||||
public void setErr200(long err200) {
|
||||
this.err200 = err200;
|
||||
}
|
||||
public long getErr300() {
|
||||
return err300;
|
||||
}
|
||||
public void setErr300(long err300) {
|
||||
this.err300 = err300;
|
||||
}
|
||||
public long getErr400() {
|
||||
return err400;
|
||||
}
|
||||
public void setErr400(long err400) {
|
||||
this.err400 = err400;
|
||||
}
|
||||
public long getErr900() {
|
||||
return err900;
|
||||
}
|
||||
public void setErr900(long err900) {
|
||||
this.err900 = err900;
|
||||
}
|
||||
public long getSystem100() {
|
||||
return system100;
|
||||
}
|
||||
public void setSystem100(long system100) {
|
||||
this.system100 = system100;
|
||||
}
|
||||
public long getSystem200() {
|
||||
return system200;
|
||||
}
|
||||
public void setSystem200(long system200) {
|
||||
this.system200 = system200;
|
||||
}
|
||||
public long getSystem300() {
|
||||
return system300;
|
||||
}
|
||||
public void setSystem300(long system300) {
|
||||
this.system300 = system300;
|
||||
}
|
||||
public long getSystem400() {
|
||||
return system400;
|
||||
}
|
||||
public void setSystem400(long system400) {
|
||||
this.system400 = system400;
|
||||
}
|
||||
public long getSystem900() {
|
||||
return system900;
|
||||
}
|
||||
public void setSystem900(long system900) {
|
||||
this.system900 = system900;
|
||||
}
|
||||
public long getTimeout300() {
|
||||
return timeout300;
|
||||
}
|
||||
public void setTimeout300(long timeout300) {
|
||||
this.timeout300 = timeout300;
|
||||
}
|
||||
public long getTimeout400() {
|
||||
return timeout400;
|
||||
}
|
||||
public void setTimeout400(long timeout400) {
|
||||
this.timeout400 = timeout400;
|
||||
}
|
||||
public long getTimeout900() {
|
||||
return timeout900;
|
||||
}
|
||||
public void setTimeout900(long timeout900) {
|
||||
this.timeout900 = timeout900;
|
||||
}
|
||||
public double getPsvSumOfPssTime() {
|
||||
return psvSumOfPssTime;
|
||||
}
|
||||
public void setPsvSumOfPssTime(double psvSumOfPssTime) {
|
||||
this.psvSumOfPssTime = psvSumOfPssTime;
|
||||
}
|
||||
public double getSumOfprocessTime() {
|
||||
return sumOfprocessTime;
|
||||
}
|
||||
public void setSumOfprocessTime(double sumOfprocessTime) {
|
||||
this.sumOfprocessTime = sumOfprocessTime;
|
||||
}
|
||||
|
||||
public void addCount100() {
|
||||
this.cnt100++;
|
||||
}
|
||||
public void addCount200() {
|
||||
this.cnt200++;
|
||||
}
|
||||
public void addCount300() {
|
||||
this.cnt300++;
|
||||
}
|
||||
public void addCount400() {
|
||||
this.cnt400++;
|
||||
}
|
||||
|
||||
public void addErr100() {
|
||||
this.err100++;
|
||||
}
|
||||
public void addErr200() {
|
||||
this.err200++;
|
||||
}
|
||||
public void addErr300() {
|
||||
this.err300++;
|
||||
}
|
||||
public void addErr400() {
|
||||
this.err400++;
|
||||
}
|
||||
public void addErr900() {
|
||||
this.err900++;
|
||||
}
|
||||
|
||||
public void addTimeout300() {
|
||||
this.timeout300++;
|
||||
}
|
||||
public void addTimeout400() {
|
||||
this.timeout400++;
|
||||
}
|
||||
public void addTimeout900() {
|
||||
this.timeout900++;
|
||||
}
|
||||
|
||||
public void addSystem100() {
|
||||
this.system100++;
|
||||
}
|
||||
public void addSystem200() {
|
||||
this.system200++;
|
||||
}
|
||||
public void addSystem300() {
|
||||
this.system300++;
|
||||
}
|
||||
public void addSystem400() {
|
||||
this.system400++;
|
||||
}
|
||||
public void addSystem900() {
|
||||
this.system900++;
|
||||
}
|
||||
|
||||
public void addSumOfprocessTime(double sumOfprocessTime) {
|
||||
this.sumOfprocessTime += sumOfprocessTime;
|
||||
}
|
||||
|
||||
public void addPsvSumOfPssTime(double psvSumOfPssTime) {
|
||||
this.psvSumOfPssTime += psvSumOfPssTime;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("100=" + cnt100);
|
||||
sb.append(",200=" + cnt200);
|
||||
sb.append(",300=" + cnt300);
|
||||
sb.append(",400=" + cnt400);
|
||||
sb.append(",E100=" + err100);
|
||||
sb.append(",E200=" + err200);
|
||||
sb.append(",E300=" + err300);
|
||||
sb.append(",E400=" + err400);
|
||||
sb.append(",E900=" + err900);
|
||||
sb.append(",T300=" + timeout300);
|
||||
sb.append(",T400=" + timeout400);
|
||||
sb.append(",T900=" + timeout900);
|
||||
sb.append(",S100=" + system100);
|
||||
sb.append(",S200=" + system200);
|
||||
sb.append(",S300=" + system300);
|
||||
sb.append(",S400=" + system400);
|
||||
sb.append(",S900=" + system900);
|
||||
sb.append(",sumOfprocessTime=" + sumOfprocessTime);
|
||||
sb.append(",psvSumOfPssTime=" + psvSumOfPssTime);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.eactive.eai.common.property;
|
||||
|
||||
import com.eactive.eai.common.util.LogKeys;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
|
||||
public class FileLoggerPropertyChangeListener implements PropertyChangeListener {
|
||||
|
||||
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
|
||||
PropManager prptManager = PropManager.getInstance();
|
||||
PropGroupVO propGroupVO = (PropGroupVO)evt.getSource();
|
||||
String loggerNames = prptManager.getProperty(LogKeys.LOGGER_INFO, LogKeys.LOGGER_LIST);
|
||||
|
||||
if ( loggerNames != null &&
|
||||
loggerNames.contains( propGroupVO.getName() ) ) {
|
||||
|
||||
if ( logger.isDebugEnabled() ) {
|
||||
logger.debug("FileLoggerPropertyChangeListener propertyChange() " + propGroupVO.getName() );
|
||||
}
|
||||
Logger.setLoggerLevel(propGroupVO.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof FileLoggerPropertyChangeListener;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.eactive.eai.common.property;
|
||||
|
||||
import com.eactive.eai.common.util.NullControl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* 1. 기능 : 프라퍼티 정보를 를 정의한 Java Value Object 클래스
|
||||
* 2. 처리 개요 : 프라퍼티 정보를 정의한다.
|
||||
* * -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see : 관련 기능을 참조
|
||||
* @since :
|
||||
* :
|
||||
*/
|
||||
public class PropGroupVO implements Serializable
|
||||
{
|
||||
private String name; //프라퍼티 그룹명[TSEAICM02.PrptyGroupName]
|
||||
//private String eaiServer; // Migration
|
||||
private String description; //프라퍼티 그룹설명[TSEAICM02.PrptyGroupDesc]
|
||||
private Properties props; //프라퍼티 명, 프라퍼티2값[TSEAICM02.PrptyName, TSEAICM02.Prpty2Val]
|
||||
|
||||
public PropGroupVO() {
|
||||
this("");
|
||||
}
|
||||
|
||||
public PropGroupVO(String name) {
|
||||
this(name,"");
|
||||
}
|
||||
|
||||
public PropGroupVO(String name, String description) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.props = new Properties();
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return NullControl.trimSpace(this.description);
|
||||
}
|
||||
|
||||
public String getProperty(String key) {
|
||||
return (String)props.get(key);
|
||||
}
|
||||
|
||||
public String getProperty(String key, String defaultValue) {
|
||||
String value = (String)props.get(key);
|
||||
return (value==null) ? defaultValue : value;
|
||||
}
|
||||
|
||||
public void addProperty(String key, String value) {
|
||||
props.put(key, value);
|
||||
}
|
||||
|
||||
public void setProperty(String key, String value) {
|
||||
props.put(key,value);
|
||||
}
|
||||
|
||||
public void removeProperty(String key) {
|
||||
props.remove(key);
|
||||
}
|
||||
|
||||
public String[] keys() {
|
||||
Iterator it = this.props.keySet().iterator();
|
||||
String[] propKeys = new String[this.props.size()];
|
||||
for(int i = 0; it.hasNext(); i++){
|
||||
propKeys[i] = (String)it.next();
|
||||
}
|
||||
Arrays.sort(propKeys);
|
||||
return propKeys;
|
||||
}
|
||||
|
||||
public Properties getProperties() {
|
||||
return props;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("PropGroupVO[ name=").append(name);
|
||||
// sb.append(", eaiServer=").append(eaiServer);
|
||||
sb.append(", description=").append(description);
|
||||
sb.append(", Properties=").append(props);
|
||||
sb.append(" ]");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void setProperties(Properties prop){
|
||||
this.props = prop;
|
||||
}
|
||||
// Migration - Start
|
||||
// public void setEaiServer(String eaiServer) {
|
||||
// this.eaiServer = eaiServer;
|
||||
// }
|
||||
//
|
||||
// public String getEaiServer() {
|
||||
// return this.eaiServer;
|
||||
// }
|
||||
// Migration - End
|
||||
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
package com.eactive.eai.common.property;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.eactive.eai.common.dao.DAOException;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.lifecycle.Lifecycle;
|
||||
import com.eactive.eai.common.lifecycle.LifecycleException;
|
||||
import com.eactive.eai.common.lifecycle.LifecycleListener;
|
||||
import com.eactive.eai.common.lifecycle.LifecycleSupport;
|
||||
import com.eactive.eai.common.util.ApplicationContextProvider;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
@Component
|
||||
public class PropManager implements Lifecycle {
|
||||
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
private LifecycleSupport lifecycle = new LifecycleSupport(this);
|
||||
|
||||
private PropertyChangeSupport property = new PropertyChangeSupport(this);
|
||||
|
||||
private Map<String, PropGroupVO> groups = new HashMap<>();
|
||||
|
||||
private boolean started;
|
||||
|
||||
@Autowired
|
||||
private PropertyDAO propertyDAO;
|
||||
|
||||
private PropManager() {
|
||||
}
|
||||
|
||||
public static PropManager getInstance() {
|
||||
return ApplicationContextProvider.getContext().getBean(PropManager.class);
|
||||
}
|
||||
|
||||
public void addPropertyChangeListener(PropertyChangeListener listener) {
|
||||
property.addPropertyChangeListener(listener);
|
||||
}
|
||||
|
||||
public void removePropertyChangeListener(PropertyChangeListener listener) {
|
||||
property.removePropertyChangeListener(listener);
|
||||
}
|
||||
|
||||
private PropertyChangeEvent createEvent(PropGroupVO source, String propertyName, Object oldValue, Object newValue) {
|
||||
return new PropertyChangeEvent(source, propertyName, oldValue, newValue);
|
||||
}
|
||||
|
||||
public boolean isStarted() {
|
||||
return this.started;
|
||||
}
|
||||
|
||||
public void start() throws LifecycleException {
|
||||
if (started)
|
||||
throw new LifecycleException("RECEAICPM201");
|
||||
|
||||
lifecycle.fireLifecycleEvent(STARTING_EVENT, this);
|
||||
|
||||
try {
|
||||
init();
|
||||
} catch (Exception e) {
|
||||
throw new LifecycleException(ExceptionUtil.getErrorCode(e, "RECEAICPM201"));
|
||||
}
|
||||
|
||||
started = true;
|
||||
logger.info("PropManager] It is started.");
|
||||
lifecycle.fireLifecycleEvent(STARTED_EVENT, this);
|
||||
}
|
||||
|
||||
private void init() throws DAOException {
|
||||
this.groups = propertyDAO.getAllProperties();
|
||||
|
||||
}
|
||||
|
||||
public synchronized void reload() throws DAOException {
|
||||
if (logger.isWarn()) {
|
||||
logger.warn("PropManager] reload all Started ...");
|
||||
}
|
||||
init();
|
||||
if (logger.isWarn()) {
|
||||
logger.warn("PropManager] reload all finished ...");
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void reload(String keyName) throws Exception {
|
||||
PropGroupVO vo = propertyDAO.getProperties(keyName);
|
||||
if (vo != null) {
|
||||
this.groups.put(keyName, vo);
|
||||
property.firePropertyChange(createEvent(vo, keyName, null, null));
|
||||
} else {
|
||||
throw new Exception("PropManager not found in Database : key[" + keyName + "]");
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() throws LifecycleException {
|
||||
if (!started)
|
||||
throw new LifecycleException("RECEAICPM203");
|
||||
|
||||
lifecycle.fireLifecycleEvent(STOPING_EVENT, this);
|
||||
|
||||
started = false;
|
||||
logger.info("PropManager] It is stopped.");
|
||||
lifecycle.fireLifecycleEvent(STOPPED_EVENT, this);
|
||||
}
|
||||
|
||||
public void addLifecycleListener(LifecycleListener listener) {
|
||||
lifecycle.addLifecycleListener(listener);
|
||||
}
|
||||
|
||||
public LifecycleListener[] findLifecycleListeners() {
|
||||
return lifecycle.findLifecycleListeners();
|
||||
}
|
||||
|
||||
public void removeLifecycleListener(LifecycleListener listener) {
|
||||
lifecycle.removeLifecycleListener(listener);
|
||||
}
|
||||
|
||||
public void addPropGroupVO(String name, String description) {
|
||||
groups.put(name, new PropGroupVO(name, description));
|
||||
}
|
||||
|
||||
public PropGroupVO getPropGroupVO(String name) {
|
||||
return groups.get(name);
|
||||
}
|
||||
|
||||
public String getProperty(String key) {
|
||||
|
||||
return getProperty(com.eactive.eai.common.server.Keys.DEFAULT_SERVER, key);
|
||||
}
|
||||
|
||||
public String getProperty(String group, String key) {
|
||||
PropGroupVO vo = groups.get(group);
|
||||
if (vo == null)
|
||||
return null;
|
||||
return vo.getProperty(key);
|
||||
}
|
||||
|
||||
public String getProperty(String group, String key, String def) {
|
||||
PropGroupVO vo = groups.get(group);
|
||||
if (vo == null)
|
||||
return def;
|
||||
return vo.getProperty(key, def);
|
||||
}
|
||||
|
||||
public Properties getProperties(String group) {
|
||||
PropGroupVO vo = groups.get(group);
|
||||
if (vo == null)
|
||||
throw new RuntimeException("Cannot find the Property Group in PropManager. - " + group);
|
||||
return vo.getProperties();
|
||||
}
|
||||
|
||||
public boolean isContainProperties(String group) {
|
||||
PropGroupVO vo = groups.get(group);
|
||||
if (vo == null)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setProperty(String group, String key, String value) {
|
||||
PropGroupVO gvo = groups.get(group);
|
||||
String oldValue = gvo.getProperty(key);
|
||||
gvo.setProperty(key, value);
|
||||
|
||||
// EVENET 발생!!
|
||||
if (!oldValue.equals(value)) {
|
||||
property.firePropertyChange(createEvent(gvo, key, oldValue, value));
|
||||
}
|
||||
}
|
||||
|
||||
public void setPropGroupVO(String group, PropGroupVO vo) {
|
||||
groups.put(group, vo);
|
||||
}
|
||||
|
||||
public void removePropGroupVO(String name) {
|
||||
groups.remove(name);
|
||||
}
|
||||
|
||||
public String[] getAllPropGroupNames() {
|
||||
Iterator it = this.groups.keySet().iterator();
|
||||
String[] name = new String[this.groups.size()];
|
||||
for (int i = 0; it.hasNext(); i++) {
|
||||
name[i] = (String) it.next();
|
||||
}
|
||||
|
||||
Arrays.sort(name);
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.eactive.eai.common.property;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.common.dao.BaseDAO;
|
||||
import com.eactive.eai.common.dao.DAOException;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.property.loader.PropGroupLoader;
|
||||
import com.eactive.eai.common.property.mapper.PropGroupMapper;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
import com.eactive.eai.data.entity.onl.property.PropGroup;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class PropertyDAO extends BaseDAO {
|
||||
|
||||
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
@Autowired
|
||||
private PropGroupLoader propGroupLoader;
|
||||
|
||||
@Autowired
|
||||
private PropGroupMapper propGroupMapper;
|
||||
|
||||
public Map<String, PropGroupVO> getAllProperties() throws DAOException {
|
||||
try {
|
||||
List<PropGroup> propGroups = propGroupLoader.findAll();
|
||||
|
||||
Map<String, PropGroupVO> propGroupVoMap = new HashMap<>();
|
||||
|
||||
logger.info("[ @@ Load Properties Configuration - starting >>>>>>>>>>>>>>>>> ]");
|
||||
for (PropGroup propGroup : propGroups) {
|
||||
PropGroupVO propGroupVO = propGroupMapper.toVo(propGroup);
|
||||
propGroupVoMap.put(propGroupVO.getName(), propGroupVO);
|
||||
logger.info("@ " + propGroupVO.toString());
|
||||
}
|
||||
logger.info("[>>Load Properties Configuration - ended ]");
|
||||
|
||||
return propGroupVoMap;
|
||||
} catch (Exception e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICPM101"));
|
||||
}
|
||||
}
|
||||
|
||||
public PropGroupVO getProperties(String grpNm) throws DAOException {
|
||||
try {
|
||||
|
||||
PropGroup propGroup = propGroupLoader.getById(grpNm);
|
||||
PropGroupVO propGroupVO = propGroupMapper.toVo(propGroup);
|
||||
logger.info("@ " + propGroupVO.toString());
|
||||
|
||||
return propGroupVO;
|
||||
} catch (Exception e) {
|
||||
String errorText = ExceptionUtil.make("RECEAICPM103", grpNm);
|
||||
if (logger.isError())
|
||||
logger.error(errorText);
|
||||
throw new DAOException(errorText);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.eactive.eai.common.property;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Login 에서 사용하는 상수를 정의한 Interface
|
||||
* 2. 처리 개요 :
|
||||
* - Login에서 사용하는 상수를 정의한 Interface
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see :
|
||||
* @since :JDK v1.4.2
|
||||
*/
|
||||
public interface PropertyLoginKeys
|
||||
{
|
||||
//로그인 및 로그아웃
|
||||
public static String LOGIN = "LOGIN";
|
||||
public static String LOGIN_SERVICE_ID = "LOGIN_SERVICE_ID";
|
||||
public static String LOGOUT_SERVICE_ID = "LOGOUT_SERVICE_ID";
|
||||
public static String SKIP_SERVICE_ID = "SKIP_SERVICE_ID";
|
||||
public static String LOGIN_VALIDATION_YN = "LOGIN_VALIDATION_YN";
|
||||
public static String LOGIN_DUP_CHECK_YN = "LOGIN_DUP_CHECK_YN";
|
||||
public static String UUID_VALIDATION_YN = "UUID_VALIDATION_YN";
|
||||
|
||||
//메시지 및 코드
|
||||
public static String DUPLICATE_LOGIN_CODE = "DUPLICATE_LOGIN_CODE";
|
||||
public static String DUPLICATE_LOGIN_MSG = "DUPLICATE_LOGIN_MSG";
|
||||
public static String VALIDATION_LOGIN_CODE = "VALIDATION_LOGIN_CODE";
|
||||
public static String VALIDATION_LOGIN_MSG = "VALIDATION_LOGIN_MSG";
|
||||
|
||||
//결과추출항목
|
||||
public static String LOGIN_USER_NM = "LOGIN_USER_NM";
|
||||
public static String LOGIN_BRN_CD = "LOGIN_BRN_CD"; // 소속국
|
||||
public static String LOGIN_BRN_NM = "LOGIN_BRN_NM";
|
||||
public static String LOGIN_ROFC_CD = "LOGIN_ROFC_CD"; //소속청
|
||||
public static String LOGIN_TERMINAL_ID = "LOGIN_TERMINAL_ID"; //터미널ID
|
||||
|
||||
//로그인 로그
|
||||
public static String LOGIN_LOGGING_YN = "LOGIN_LOGGING_YN";
|
||||
|
||||
|
||||
//thread 관련
|
||||
public static String LOGOUT_MAX_THREAD = "LOGOUT_MAX_THREAD";
|
||||
public static String LOGOUT_MAX_QUEUE = "LOGOUT_MAX_QUEUE";
|
||||
|
||||
//개시거래
|
||||
public static String BEGIN = "BEGIN";
|
||||
public static String BEGIN_SERVICE_ID_ATM = "BEGIN_SERVICE_ID_ATM";//자동화기기
|
||||
public static String BEGIN_SERVICE_ID_UNMANNED = "BEGIN_SERVICE_ID_UNMANNED";//공과금무인수납기
|
||||
|
||||
//결과추출항목(표준전문)
|
||||
public static String BEGIN_BRN_CD = "BEGIN_BRN_CD"; // 소속국
|
||||
public static String BEGIN_ROFC_CD = "BEGIN_ROFC_CD"; //소속청
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.eactive.eai.common.property;
|
||||
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class RmsPropPropertyChangeListener implements PropertyChangeListener {
|
||||
|
||||
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
|
||||
PropManager prptManager = PropManager.getInstance();
|
||||
PropGroupVO propGroupVO = (PropGroupVO)evt.getSource();
|
||||
|
||||
if ( propGroupVO != null && "RMS_PROPS".equals(propGroupVO.getName()) ) {
|
||||
|
||||
if ( logger.isDebugEnabled() ) {
|
||||
logger.debug("RmsPropPropertyChangeListener propertyChange() " + propGroupVO.getName() );
|
||||
}
|
||||
try{
|
||||
Class clazz = Class.forName("com.eactive.eai.rms.client.context.RmsContext");
|
||||
//Object factory = clazz.newInstance();
|
||||
Method method = clazz.getMethod("getInstance");
|
||||
//ClassPathXmlApplicationContext context = (ClassPathXmlApplicationContext)method.invoke(null,null);
|
||||
ClassPathXmlApplicationContext context = (ClassPathXmlApplicationContext)method.invoke(null);
|
||||
context.refresh();
|
||||
}catch(Exception e){
|
||||
logger.error("RmsPropPropertyChangeListener propertyChange() error " + propGroupVO.getName() , e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof RmsPropPropertyChangeListener;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.eactive.eai.common.property.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
|
||||
import com.eactive.eai.common.property.PropGroupVO;
|
||||
import com.eactive.eai.common.util.NullControl;
|
||||
import com.eactive.eai.data.entity.onl.property.Prop;
|
||||
import com.eactive.eai.data.entity.onl.property.PropGroup;
|
||||
import com.eactive.eai.data.mapper.BaseMapperConfig;
|
||||
import com.eactive.eai.data.mapper.GenericMapper;
|
||||
|
||||
@Mapper(config = BaseMapperConfig.class)
|
||||
public interface PropGroupMapper extends GenericMapper<PropGroupVO, PropGroup> {
|
||||
|
||||
@Mapping(source = "prptygroupname", target = "name")
|
||||
@Mapping(source = "prptygroupdesc", target = "description")
|
||||
@Mapping(source = "props", target = "properties")
|
||||
@Override
|
||||
PropGroupVO toVo(PropGroup entity);
|
||||
|
||||
default Properties map(List<Prop> props) {
|
||||
Properties properties = new Properties();
|
||||
props.stream().forEach(p -> properties.put(p.getId().getPrptyname(), NullControl.trimSpace(p.getPrpty2val())));
|
||||
return properties;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.eactive.eai.common.seed;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class AnsiX923Padding implements CryptoPaddingImpl {
|
||||
|
||||
/** 패딩 규칙 이름 */
|
||||
private String name = "ANSI-X.923-Padding";
|
||||
|
||||
private final byte PADDING_VALUE = 0x00;
|
||||
|
||||
/**
|
||||
* 요청한 Block Size를 맞추기 위해 Padding을 추가한다.
|
||||
*
|
||||
* @param source
|
||||
* byte[] 패딩을 추가할 bytes
|
||||
* @param blockSize
|
||||
* int block size
|
||||
* @return byte[] 패딩이 추가 된 결과 bytes
|
||||
*/
|
||||
public byte[] addPadding(byte[] source, int blockSize) {
|
||||
int paddingCnt = source.length % blockSize;
|
||||
byte[] paddingResult = null;
|
||||
|
||||
if(paddingCnt != 0) {
|
||||
paddingResult = new byte[source.length + (blockSize - paddingCnt)];
|
||||
|
||||
System.arraycopy(source, 0, paddingResult, 0, source.length);
|
||||
|
||||
// 패딩해야 할 갯수 - 1 (마지막을 제외)까지 0x00 값을 추가한다.
|
||||
int addPaddingCnt = blockSize - paddingCnt;
|
||||
for(int i=0;i<addPaddingCnt;i++) {
|
||||
paddingResult[source.length + i] = PADDING_VALUE;
|
||||
}
|
||||
|
||||
// 마지막 패딩 값은 패딩 된 Count를 추가한다.
|
||||
paddingResult[paddingResult.length - 1] = (byte)addPaddingCnt;
|
||||
} else {
|
||||
paddingResult = source;
|
||||
}
|
||||
|
||||
return paddingResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 요청한 Block Size를 맞추기 위해 추가 된 Padding을 제거한다.
|
||||
*
|
||||
* @param source
|
||||
* byte[] 패딩을 제거할 bytes
|
||||
* @param blockSize
|
||||
* int block size
|
||||
* @return byte[] 패딩이 제거 된 결과 bytes
|
||||
*/
|
||||
public byte[] removePadding(byte[] source, int blockSize) {
|
||||
byte[] paddingResult = null;
|
||||
boolean isPadding = false;
|
||||
|
||||
// 패딩 된 count를 찾는다.
|
||||
int lastValue = source[source.length - 1];
|
||||
if(lastValue < (blockSize )) {
|
||||
int zeroPaddingCount = lastValue - 1;
|
||||
|
||||
for(int i=2;i<(zeroPaddingCount + 2);i++) {
|
||||
if(source[source.length - i] != PADDING_VALUE) {
|
||||
isPadding = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
isPadding = true;
|
||||
} else {
|
||||
// 마지막 값이 block size 보다 클 경우 패딩 된것이 없음.
|
||||
isPadding = false;
|
||||
}
|
||||
|
||||
if(isPadding) {
|
||||
paddingResult = new byte[source.length - lastValue];
|
||||
System.arraycopy(source, 0, paddingResult, 0, paddingResult.length);
|
||||
} else {
|
||||
paddingResult = source;
|
||||
}
|
||||
|
||||
return paddingResult;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.eactive.eai.common.seed;
|
||||
|
||||
/**
|
||||
* A Base64 Encoder/Decoder.
|
||||
*
|
||||
* <p>
|
||||
* This class is used to encode and decode data in Base64 format as described in RFC 1521.
|
||||
*
|
||||
* <p>
|
||||
* This is "Open Source" software and released under the <a href="http://www.gnu.org/licenses/lgpl.html">GNU/LGPL</a> license.<br>
|
||||
* It is provided "as is" without warranty of any kind.<br>
|
||||
* Copyright 2003: Christian d'Heureuse, Inventec Informatik AG, Switzerland.<br>
|
||||
* Home page: <a href="http://www.source-code.biz">www.source-code.biz</a><br>
|
||||
*
|
||||
* <p>
|
||||
* Version history:<br>
|
||||
* 2003-07-22 Christian d'Heureuse (chdh): Module created.<br>
|
||||
* 2005-08-11 chdh: Lincense changed from GPL to LGPL.<br>
|
||||
* 2006-11-21 chdh:<br>
|
||||
* Method encode(String) renamed to encodeString(String).<br>
|
||||
* Method decode(String) renamed to decodeString(String).<br>
|
||||
* New method encode(byte[],int) added.<br>
|
||||
* New method decode(String) added.<br>
|
||||
*/
|
||||
|
||||
public class Base64Coder {
|
||||
|
||||
// Mapping table from 6-bit nibbles to Base64 characters.
|
||||
private static char[] map1 = new char[64];
|
||||
static {
|
||||
int i=0;
|
||||
for (char c='A'; c<='Z'; c++) map1[i++] = c;
|
||||
for (char c='a'; c<='z'; c++) map1[i++] = c;
|
||||
for (char c='0'; c<='9'; c++) map1[i++] = c;
|
||||
map1[i++] = '+'; map1[i++] = '/'; }
|
||||
|
||||
// Mapping table from Base64 characters to 6-bit nibbles.
|
||||
private static byte[] map2 = new byte[128];
|
||||
static {
|
||||
for (int i=0; i<map2.length; i++) map2[i] = -1;
|
||||
for (int i=0; i<64; i++) map2[map1[i]] = (byte)i; }
|
||||
|
||||
/**
|
||||
* Encodes a string into Base64 format.
|
||||
* No blanks or line breaks are inserted.
|
||||
* @param s a String to be encoded.
|
||||
* @return A String with the Base64 encoded data.
|
||||
*/
|
||||
public static String encodeString (String s) {
|
||||
return new String(encode(s.getBytes())); }
|
||||
|
||||
/**
|
||||
* Encodes a byte array into Base64 format.
|
||||
* No blanks or line breaks are inserted.
|
||||
* @param in an array containing the data bytes to be encoded.
|
||||
* @return A character array with the Base64 encoded data.
|
||||
*/
|
||||
public static char[] encode (byte[] in) {
|
||||
return encode(in,in.length); }
|
||||
|
||||
/**
|
||||
* Encodes a byte array into Base64 format.
|
||||
* No blanks or line breaks are inserted.
|
||||
* @param in an array containing the data bytes to be encoded.
|
||||
* @param iLen number of bytes to process in <code>in</code>.
|
||||
* @return A character array with the Base64 encoded data.
|
||||
*/
|
||||
public static char[] encode (byte[] in, int iLen) {
|
||||
int oDataLen = (iLen*4+2)/3; // output length without padding
|
||||
int oLen = ((iLen+2)/3)*4; // output length including padding
|
||||
char[] out = new char[oLen];
|
||||
int ip = 0;
|
||||
int op = 0;
|
||||
while (ip < iLen) {
|
||||
int i0 = in[ip++] & 0xff;
|
||||
int i1 = ip < iLen ? in[ip++] & 0xff : 0;
|
||||
int i2 = ip < iLen ? in[ip++] & 0xff : 0;
|
||||
int o0 = i0 >>> 2;
|
||||
int o1 = ((i0 & 3) << 4) | (i1 >>> 4);
|
||||
int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6);
|
||||
int o3 = i2 & 0x3F;
|
||||
out[op++] = map1[o0];
|
||||
out[op++] = map1[o1];
|
||||
out[op] = op < oDataLen ? map1[o2] : '='; op++;
|
||||
out[op] = op < oDataLen ? map1[o3] : '='; op++; }
|
||||
return out; }
|
||||
|
||||
/**
|
||||
* Decodes a string from Base64 format.
|
||||
* @param s a Base64 String to be decoded.
|
||||
* @return A String containing the decoded data.
|
||||
* @throws IllegalArgumentException if the input is not valid Base64 encoded data.
|
||||
*/
|
||||
public static String decodeString (String s) {
|
||||
return new String(decode(s)); }
|
||||
|
||||
/**
|
||||
* Decodes a byte array from Base64 format.
|
||||
* @param s a Base64 String to be decoded.
|
||||
* @return An array containing the decoded data bytes.
|
||||
* @throws IllegalArgumentException if the input is not valid Base64 encoded data.
|
||||
*/
|
||||
public static byte[] decode (String s) {
|
||||
return decode(s.toCharArray()); }
|
||||
|
||||
/**
|
||||
* Decodes a byte array from Base64 format.
|
||||
* No blanks or line breaks are allowed within the Base64 encoded data.
|
||||
* @param in a character array containing the Base64 encoded data.
|
||||
* @return An array containing the decoded data bytes.
|
||||
* @throws IllegalArgumentException if the input is not valid Base64 encoded data.
|
||||
*/
|
||||
public static byte[] decode (char[] in) {
|
||||
int iLen = in.length;
|
||||
if (iLen%4 != 0) throw new IllegalArgumentException ("Length of Base64 encoded input string is not a multiple of 4.");
|
||||
while (iLen > 0 && in[iLen-1] == '=') iLen--;
|
||||
int oLen = (iLen*3) / 4;
|
||||
byte[] out = new byte[oLen];
|
||||
int ip = 0;
|
||||
int op = 0;
|
||||
while (ip < iLen) {
|
||||
int i0 = in[ip++];
|
||||
int i1 = in[ip++];
|
||||
int i2 = ip < iLen ? in[ip++] : 'A';
|
||||
int i3 = ip < iLen ? in[ip++] : 'A';
|
||||
if (i0 > 127 || i1 > 127 || i2 > 127 || i3 > 127)
|
||||
throw new IllegalArgumentException ("Illegal character in Base64 encoded data.");
|
||||
int b0 = map2[i0];
|
||||
int b1 = map2[i1];
|
||||
int b2 = map2[i2];
|
||||
int b3 = map2[i3];
|
||||
if (b0 < 0 || b1 < 0 || b2 < 0 || b3 < 0)
|
||||
throw new IllegalArgumentException ("Illegal character in Base64 encoded data.");
|
||||
int o0 = ( b0 <<2) | (b1>>>4);
|
||||
int o1 = ((b1 & 0xf)<<4) | (b2>>>2);
|
||||
int o2 = ((b2 & 3)<<6) | b3;
|
||||
out[op++] = (byte)o0;
|
||||
if (op<oLen) out[op++] = (byte)o1;
|
||||
if (op<oLen) out[op++] = (byte)o2; }
|
||||
return out; }
|
||||
|
||||
// Dummy constructor.
|
||||
private Base64Coder() {}
|
||||
|
||||
} // end class Base64Coder
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.eactive.eai.common.seed;
|
||||
|
||||
/**
|
||||
* 암호화에서 블럭 사이즈를 맞추기 위해 사용되는 Padding을 추상화 한 Interface
|
||||
*
|
||||
* Padding Object는 블록 암호화의 특징은 정해진 블록 사이즈를 맞추기 위해 모자란 부분에 대한
|
||||
* Padding을 의미하는데, KISA에서 제공하는 API에는 Padding이 구현되어 있지 않아
|
||||
* ANSI X.923 Padding을 구현하여 사용하였다.
|
||||
*
|
||||
* -- ANSI X.923 Padding
|
||||
* 모자란 부분에 대해 일정한 규칙으로 채우는 것을 Padding이라 하는데, 많은 규칙 중의 하나이다.
|
||||
* 규칙은 간단하다 모자란 byte 수에 대해 패딩되는 가장 마지막 byte는 패딩 된 byte 수를 의미하고
|
||||
* 나머지는 "0x00"으로 채운다.
|
||||
*
|
||||
* 16 byte 블록에서 10 byte에 대한 값을 Padding 한다면
|
||||
* 0xDD 0xDD 0xDD 0xDD 0xDD 0xDD 0xDD 0xDD 0xDD 0xDD 0x00 0x00 0x00 0x00 0x00 0x06
|
||||
* 이 된다.
|
||||
*/
|
||||
public interface CryptoPaddingImpl {
|
||||
|
||||
/**
|
||||
* 요청한 Block Size를 맞추기 위해 Padding을 추가한다.
|
||||
*
|
||||
* @param source
|
||||
* byte[] 패딩을 추가할 bytes
|
||||
* @param blockSize
|
||||
* int block size
|
||||
* @return byte[] 패딩이 추가 된 결과 bytes
|
||||
*/
|
||||
public byte[] addPadding(byte[] source, int blockSize);
|
||||
|
||||
/**
|
||||
* 요청한 Block Size를 맞추기 위해 추가 된 Padding을 제거한다.
|
||||
*
|
||||
* @param source
|
||||
* byte[] 패딩을 제거할 bytes
|
||||
* @param blockSize
|
||||
* int block size
|
||||
* @return byte[] 패딩이 제거 된 결과 bytes
|
||||
*/
|
||||
public byte[] removePadding(byte[] source, int blockSize);
|
||||
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,797 @@
|
||||
package com.eactive.eai.common.seed;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* Seed 블럭암호 API <br />
|
||||
* 한국정보보호진흥원에서 제공하는 Java API를 조금 수정 함. <br />
|
||||
* Padding은 ANSI X.923을 사용 함.
|
||||
*
|
||||
*/
|
||||
|
||||
public class SeedCipher {
|
||||
|
||||
private int SS0[] = { 0x2989a1a8, 0x5858184, 0x16c6d2d4, 0x13c3d3d0,
|
||||
0x14445054, 0x1d0d111c, 0x2c8ca0ac, 0x25052124, 0x1d4d515c,
|
||||
0x3434340, 0x18081018, 0x1e0e121c, 0x11415150, 0x3cccf0fc,
|
||||
0xacac2c8, 0x23436360, 0x28082028, 0x4444044, 0x20002020,
|
||||
0x1d8d919c, 0x20c0e0e0, 0x22c2e2e0, 0x8c8c0c8, 0x17071314,
|
||||
0x2585a1a4, 0xf8f838c, 0x3030300, 0x3b4b7378, 0x3b8bb3b8,
|
||||
0x13031310, 0x12c2d2d0, 0x2ecee2ec, 0x30407070, 0xc8c808c,
|
||||
0x3f0f333c, 0x2888a0a8, 0x32023230, 0x1dcdd1dc, 0x36c6f2f4,
|
||||
0x34447074, 0x2ccce0ec, 0x15859194, 0xb0b0308, 0x17475354,
|
||||
0x1c4c505c, 0x1b4b5358, 0x3d8db1bc, 0x1010100, 0x24042024,
|
||||
0x1c0c101c, 0x33437370, 0x18889098, 0x10001010, 0xcccc0cc,
|
||||
0x32c2f2f0, 0x19c9d1d8, 0x2c0c202c, 0x27c7e3e4, 0x32427270,
|
||||
0x3838380, 0x1b8b9398, 0x11c1d1d0, 0x6868284, 0x9c9c1c8,
|
||||
0x20406060, 0x10405050, 0x2383a3a0, 0x2bcbe3e8, 0xd0d010c,
|
||||
0x3686b2b4, 0x1e8e929c, 0xf4f434c, 0x3787b3b4, 0x1a4a5258,
|
||||
0x6c6c2c4, 0x38487078, 0x2686a2a4, 0x12021210, 0x2f8fa3ac,
|
||||
0x15c5d1d4, 0x21416160, 0x3c3c3c0, 0x3484b0b4, 0x1414140,
|
||||
0x12425250, 0x3d4d717c, 0xd8d818c, 0x8080008, 0x1f0f131c,
|
||||
0x19899198, 0, 0x19091118, 0x4040004, 0x13435350, 0x37c7f3f4,
|
||||
0x21c1e1e0, 0x3dcdf1fc, 0x36467274, 0x2f0f232c, 0x27072324,
|
||||
0x3080b0b0, 0xb8b8388, 0xe0e020c, 0x2b8ba3a8, 0x2282a2a0,
|
||||
0x2e4e626c, 0x13839390, 0xd4d414c, 0x29496168, 0x3c4c707c,
|
||||
0x9090108, 0xa0a0208, 0x3f8fb3bc, 0x2fcfe3ec, 0x33c3f3f0,
|
||||
0x5c5c1c4, 0x7878384, 0x14041014, 0x3ecef2fc, 0x24446064,
|
||||
0x1eced2dc, 0x2e0e222c, 0xb4b4348, 0x1a0a1218, 0x6060204,
|
||||
0x21012120, 0x2b4b6368, 0x26466264, 0x2020200, 0x35c5f1f4,
|
||||
0x12829290, 0xa8a8288, 0xc0c000c, 0x3383b3b0, 0x3e4e727c,
|
||||
0x10c0d0d0, 0x3a4a7278, 0x7474344, 0x16869294, 0x25c5e1e4,
|
||||
0x26062224, 0x808080, 0x2d8da1ac, 0x1fcfd3dc, 0x2181a1a0,
|
||||
0x30003030, 0x37073334, 0x2e8ea2ac, 0x36063234, 0x15051114,
|
||||
0x22022220, 0x38083038, 0x34c4f0f4, 0x2787a3a4, 0x5454144,
|
||||
0xc4c404c, 0x1818180, 0x29c9e1e8, 0x4848084, 0x17879394,
|
||||
0x35053134, 0xbcbc3c8, 0xecec2cc, 0x3c0c303c, 0x31417170,
|
||||
0x11011110, 0x7c7c3c4, 0x9898188, 0x35457174, 0x3bcbf3f8,
|
||||
0x1acad2d8, 0x38c8f0f8, 0x14849094, 0x19495158, 0x2828280,
|
||||
0x4c4c0c4, 0x3fcff3fc, 0x9494148, 0x39093138, 0x27476364, 0xc0c0c0,
|
||||
0xfcfc3cc, 0x17c7d3d4, 0x3888b0b8, 0xf0f030c, 0xe8e828c, 0x2424240,
|
||||
0x23032320, 0x11819190, 0x2c4c606c, 0x1bcbd3d8, 0x2484a0a4,
|
||||
0x34043034, 0x31c1f1f0, 0x8484048, 0x2c2c2c0, 0x2f4f636c,
|
||||
0x3d0d313c, 0x2d0d212c, 0x404040, 0x3e8eb2bc, 0x3e0e323c,
|
||||
0x3c8cb0bc, 0x1c1c1c0, 0x2a8aa2a8, 0x3a8ab2b8, 0xe4e424c,
|
||||
0x15455154, 0x3b0b3338, 0x1cccd0dc, 0x28486068, 0x3f4f737c,
|
||||
0x1c8c909c, 0x18c8d0d8, 0xa4a4248, 0x16465254, 0x37477374,
|
||||
0x2080a0a0, 0x2dcde1ec, 0x6464244, 0x3585b1b4, 0x2b0b2328,
|
||||
0x25456164, 0x3acaf2f8, 0x23c3e3e0, 0x3989b1b8, 0x3181b1b0,
|
||||
0x1f8f939c, 0x1e4e525c, 0x39c9f1f8, 0x26c6e2e4, 0x3282b2b0,
|
||||
0x31013130, 0x2acae2e8, 0x2d4d616c, 0x1f4f535c, 0x24c4e0e4,
|
||||
0x30c0f0f0, 0xdcdc1cc, 0x8888088, 0x16061214, 0x3a0a3238,
|
||||
0x18485058, 0x14c4d0d4, 0x22426260, 0x29092128, 0x7070304,
|
||||
0x33033330, 0x28c8e0e8, 0x1b0b1318, 0x5050104, 0x39497178,
|
||||
0x10809090, 0x2a4a6268, 0x2a0a2228, 0x1a8a9298 };
|
||||
|
||||
private int SS1[] = { 0x38380830, 0xe828c8e0, 0x2c2d0d21, 0xa42686a2,
|
||||
0xcc0fcfc3, 0xdc1eced2, 0xb03383b3, 0xb83888b0, 0xac2f8fa3,
|
||||
0x60204060, 0x54154551, 0xc407c7c3, 0x44044440, 0x6c2f4f63,
|
||||
0x682b4b63, 0x581b4b53, 0xc003c3c3, 0x60224262, 0x30330333,
|
||||
0xb43585b1, 0x28290921, 0xa02080a0, 0xe022c2e2, 0xa42787a3,
|
||||
0xd013c3d3, 0x90118191, 0x10110111, 0x4060602, 0x1c1c0c10,
|
||||
0xbc3c8cb0, 0x34360632, 0x480b4b43, 0xec2fcfe3, 0x88088880,
|
||||
0x6c2c4c60, 0xa82888a0, 0x14170713, 0xc404c4c0, 0x14160612,
|
||||
0xf434c4f0, 0xc002c2c2, 0x44054541, 0xe021c1e1, 0xd416c6d2,
|
||||
0x3c3f0f33, 0x3c3d0d31, 0x8c0e8e82, 0x98188890, 0x28280820,
|
||||
0x4c0e4e42, 0xf436c6f2, 0x3c3e0e32, 0xa42585a1, 0xf839c9f1,
|
||||
0xc0d0d01, 0xdc1fcfd3, 0xd818c8d0, 0x282b0b23, 0x64264662,
|
||||
0x783a4a72, 0x24270723, 0x2c2f0f23, 0xf031c1f1, 0x70324272,
|
||||
0x40024242, 0xd414c4d0, 0x40014141, 0xc000c0c0, 0x70334373,
|
||||
0x64274763, 0xac2c8ca0, 0x880b8b83, 0xf437c7f3, 0xac2d8da1,
|
||||
0x80008080, 0x1c1f0f13, 0xc80acac2, 0x2c2c0c20, 0xa82a8aa2,
|
||||
0x34340430, 0xd012c2d2, 0x80b0b03, 0xec2ecee2, 0xe829c9e1,
|
||||
0x5c1d4d51, 0x94148490, 0x18180810, 0xf838c8f0, 0x54174753,
|
||||
0xac2e8ea2, 0x8080800, 0xc405c5c1, 0x10130313, 0xcc0dcdc1,
|
||||
0x84068682, 0xb83989b1, 0xfc3fcff3, 0x7c3d4d71, 0xc001c1c1,
|
||||
0x30310131, 0xf435c5f1, 0x880a8a82, 0x682a4a62, 0xb03181b1,
|
||||
0xd011c1d1, 0x20200020, 0xd417c7d3, 0x20202, 0x20220222, 0x4040400,
|
||||
0x68284860, 0x70314171, 0x4070703, 0xd81bcbd3, 0x9c1d8d91,
|
||||
0x98198991, 0x60214161, 0xbc3e8eb2, 0xe426c6e2, 0x58194951,
|
||||
0xdc1dcdd1, 0x50114151, 0x90108090, 0xdc1cccd0, 0x981a8a92,
|
||||
0xa02383a3, 0xa82b8ba3, 0xd010c0d0, 0x80018181, 0xc0f0f03,
|
||||
0x44074743, 0x181a0a12, 0xe023c3e3, 0xec2ccce0, 0x8c0d8d81,
|
||||
0xbc3f8fb3, 0x94168692, 0x783b4b73, 0x5c1c4c50, 0xa02282a2,
|
||||
0xa02181a1, 0x60234363, 0x20230323, 0x4c0d4d41, 0xc808c8c0,
|
||||
0x9c1e8e92, 0x9c1c8c90, 0x383a0a32, 0xc0c0c00, 0x2c2e0e22,
|
||||
0xb83a8ab2, 0x6c2e4e62, 0x9c1f8f93, 0x581a4a52, 0xf032c2f2,
|
||||
0x90128292, 0xf033c3f3, 0x48094941, 0x78384870, 0xcc0cccc0,
|
||||
0x14150511, 0xf83bcbf3, 0x70304070, 0x74354571, 0x7c3f4f73,
|
||||
0x34350531, 0x10100010, 0x30303, 0x64244460, 0x6c2d4d61,
|
||||
0xc406c6c2, 0x74344470, 0xd415c5d1, 0xb43484b0, 0xe82acae2,
|
||||
0x8090901, 0x74364672, 0x18190911, 0xfc3ecef2, 0x40004040,
|
||||
0x10120212, 0xe020c0e0, 0xbc3d8db1, 0x4050501, 0xf83acaf2, 0x10101,
|
||||
0xf030c0f0, 0x282a0a22, 0x5c1e4e52, 0xa82989a1, 0x54164652,
|
||||
0x40034343, 0x84058581, 0x14140410, 0x88098981, 0x981b8b93,
|
||||
0xb03080b0, 0xe425c5e1, 0x48084840, 0x78394971, 0x94178793,
|
||||
0xfc3cccf0, 0x1c1e0e12, 0x80028282, 0x20210121, 0x8c0c8c80,
|
||||
0x181b0b13, 0x5c1f4f53, 0x74374773, 0x54144450, 0xb03282b2,
|
||||
0x1c1d0d11, 0x24250521, 0x4c0f4f43, 0, 0x44064642, 0xec2dcde1,
|
||||
0x58184850, 0x50124252, 0xe82bcbe3, 0x7c3e4e72, 0xd81acad2,
|
||||
0xc809c9c1, 0xfc3dcdf1, 0x30300030, 0x94158591, 0x64254561,
|
||||
0x3c3c0c30, 0xb43686b2, 0xe424c4e0, 0xb83b8bb3, 0x7c3c4c70,
|
||||
0xc0e0e02, 0x50104050, 0x38390931, 0x24260622, 0x30320232,
|
||||
0x84048480, 0x68294961, 0x90138393, 0x34370733, 0xe427c7e3,
|
||||
0x24240420, 0xa42484a0, 0xc80bcbc3, 0x50134353, 0x80a0a02,
|
||||
0x84078783, 0xd819c9d1, 0x4c0c4c40, 0x80038383, 0x8c0f8f83,
|
||||
0xcc0ecec2, 0x383b0b33, 0x480a4a42, 0xb43787b3 };
|
||||
|
||||
private int SS2[] = { 0xa1a82989, 0x81840585, 0xd2d416c6, 0xd3d013c3,
|
||||
0x50541444, 0x111c1d0d, 0xa0ac2c8c, 0x21242505, 0x515c1d4d,
|
||||
0x43400343, 0x10181808, 0x121c1e0e, 0x51501141, 0xf0fc3ccc,
|
||||
0xc2c80aca, 0x63602343, 0x20282808, 0x40440444, 0x20202000,
|
||||
0x919c1d8d, 0xe0e020c0, 0xe2e022c2, 0xc0c808c8, 0x13141707,
|
||||
0xa1a42585, 0x838c0f8f, 0x3000303, 0x73783b4b, 0xb3b83b8b,
|
||||
0x13101303, 0xd2d012c2, 0xe2ec2ece, 0x70703040, 0x808c0c8c,
|
||||
0x333c3f0f, 0xa0a82888, 0x32303202, 0xd1dc1dcd, 0xf2f436c6,
|
||||
0x70743444, 0xe0ec2ccc, 0x91941585, 0x3080b0b, 0x53541747,
|
||||
0x505c1c4c, 0x53581b4b, 0xb1bc3d8d, 0x1000101, 0x20242404,
|
||||
0x101c1c0c, 0x73703343, 0x90981888, 0x10101000, 0xc0cc0ccc,
|
||||
0xf2f032c2, 0xd1d819c9, 0x202c2c0c, 0xe3e427c7, 0x72703242,
|
||||
0x83800383, 0x93981b8b, 0xd1d011c1, 0x82840686, 0xc1c809c9,
|
||||
0x60602040, 0x50501040, 0xa3a02383, 0xe3e82bcb, 0x10c0d0d,
|
||||
0xb2b43686, 0x929c1e8e, 0x434c0f4f, 0xb3b43787, 0x52581a4a,
|
||||
0xc2c406c6, 0x70783848, 0xa2a42686, 0x12101202, 0xa3ac2f8f,
|
||||
0xd1d415c5, 0x61602141, 0xc3c003c3, 0xb0b43484, 0x41400141,
|
||||
0x52501242, 0x717c3d4d, 0x818c0d8d, 0x80808, 0x131c1f0f,
|
||||
0x91981989, 0, 0x11181909, 0x40404, 0x53501343, 0xf3f437c7,
|
||||
0xe1e021c1, 0xf1fc3dcd, 0x72743646, 0x232c2f0f, 0x23242707,
|
||||
0xb0b03080, 0x83880b8b, 0x20c0e0e, 0xa3a82b8b, 0xa2a02282,
|
||||
0x626c2e4e, 0x93901383, 0x414c0d4d, 0x61682949, 0x707c3c4c,
|
||||
0x1080909, 0x2080a0a, 0xb3bc3f8f, 0xe3ec2fcf, 0xf3f033c3,
|
||||
0xc1c405c5, 0x83840787, 0x10141404, 0xf2fc3ece, 0x60642444,
|
||||
0xd2dc1ece, 0x222c2e0e, 0x43480b4b, 0x12181a0a, 0x2040606,
|
||||
0x21202101, 0x63682b4b, 0x62642646, 0x2000202, 0xf1f435c5,
|
||||
0x92901282, 0x82880a8a, 0xc0c0c, 0xb3b03383, 0x727c3e4e,
|
||||
0xd0d010c0, 0x72783a4a, 0x43440747, 0x92941686, 0xe1e425c5,
|
||||
0x22242606, 0x80800080, 0xa1ac2d8d, 0xd3dc1fcf, 0xa1a02181,
|
||||
0x30303000, 0x33343707, 0xa2ac2e8e, 0x32343606, 0x11141505,
|
||||
0x22202202, 0x30383808, 0xf0f434c4, 0xa3a42787, 0x41440545,
|
||||
0x404c0c4c, 0x81800181, 0xe1e829c9, 0x80840484, 0x93941787,
|
||||
0x31343505, 0xc3c80bcb, 0xc2cc0ece, 0x303c3c0c, 0x71703141,
|
||||
0x11101101, 0xc3c407c7, 0x81880989, 0x71743545, 0xf3f83bcb,
|
||||
0xd2d81aca, 0xf0f838c8, 0x90941484, 0x51581949, 0x82800282,
|
||||
0xc0c404c4, 0xf3fc3fcf, 0x41480949, 0x31383909, 0x63642747,
|
||||
0xc0c000c0, 0xc3cc0fcf, 0xd3d417c7, 0xb0b83888, 0x30c0f0f,
|
||||
0x828c0e8e, 0x42400242, 0x23202303, 0x91901181, 0x606c2c4c,
|
||||
0xd3d81bcb, 0xa0a42484, 0x30343404, 0xf1f031c1, 0x40480848,
|
||||
0xc2c002c2, 0x636c2f4f, 0x313c3d0d, 0x212c2d0d, 0x40400040,
|
||||
0xb2bc3e8e, 0x323c3e0e, 0xb0bc3c8c, 0xc1c001c1, 0xa2a82a8a,
|
||||
0xb2b83a8a, 0x424c0e4e, 0x51541545, 0x33383b0b, 0xd0dc1ccc,
|
||||
0x60682848, 0x737c3f4f, 0x909c1c8c, 0xd0d818c8, 0x42480a4a,
|
||||
0x52541646, 0x73743747, 0xa0a02080, 0xe1ec2dcd, 0x42440646,
|
||||
0xb1b43585, 0x23282b0b, 0x61642545, 0xf2f83aca, 0xe3e023c3,
|
||||
0xb1b83989, 0xb1b03181, 0x939c1f8f, 0x525c1e4e, 0xf1f839c9,
|
||||
0xe2e426c6, 0xb2b03282, 0x31303101, 0xe2e82aca, 0x616c2d4d,
|
||||
0x535c1f4f, 0xe0e424c4, 0xf0f030c0, 0xc1cc0dcd, 0x80880888,
|
||||
0x12141606, 0x32383a0a, 0x50581848, 0xd0d414c4, 0x62602242,
|
||||
0x21282909, 0x3040707, 0x33303303, 0xe0e828c8, 0x13181b0b,
|
||||
0x1040505, 0x71783949, 0x90901080, 0x62682a4a, 0x22282a0a,
|
||||
0x92981a8a };
|
||||
|
||||
private int SS3[] = { 0x8303838, 0xc8e0e828, 0xd212c2d, 0x86a2a426,
|
||||
0xcfc3cc0f, 0xced2dc1e, 0x83b3b033, 0x88b0b838, 0x8fa3ac2f,
|
||||
0x40606020, 0x45515415, 0xc7c3c407, 0x44404404, 0x4f636c2f,
|
||||
0x4b63682b, 0x4b53581b, 0xc3c3c003, 0x42626022, 0x3333033,
|
||||
0x85b1b435, 0x9212829, 0x80a0a020, 0xc2e2e022, 0x87a3a427,
|
||||
0xc3d3d013, 0x81919011, 0x1111011, 0x6020406, 0xc101c1c,
|
||||
0x8cb0bc3c, 0x6323436, 0x4b43480b, 0xcfe3ec2f, 0x88808808,
|
||||
0x4c606c2c, 0x88a0a828, 0x7131417, 0xc4c0c404, 0x6121416,
|
||||
0xc4f0f434, 0xc2c2c002, 0x45414405, 0xc1e1e021, 0xc6d2d416,
|
||||
0xf333c3f, 0xd313c3d, 0x8e828c0e, 0x88909818, 0x8202828,
|
||||
0x4e424c0e, 0xc6f2f436, 0xe323c3e, 0x85a1a425, 0xc9f1f839,
|
||||
0xd010c0d, 0xcfd3dc1f, 0xc8d0d818, 0xb23282b, 0x46626426,
|
||||
0x4a72783a, 0x7232427, 0xf232c2f, 0xc1f1f031, 0x42727032,
|
||||
0x42424002, 0xc4d0d414, 0x41414001, 0xc0c0c000, 0x43737033,
|
||||
0x47636427, 0x8ca0ac2c, 0x8b83880b, 0xc7f3f437, 0x8da1ac2d,
|
||||
0x80808000, 0xf131c1f, 0xcac2c80a, 0xc202c2c, 0x8aa2a82a,
|
||||
0x4303434, 0xc2d2d012, 0xb03080b, 0xcee2ec2e, 0xc9e1e829,
|
||||
0x4d515c1d, 0x84909414, 0x8101818, 0xc8f0f838, 0x47535417,
|
||||
0x8ea2ac2e, 0x8000808, 0xc5c1c405, 0x3131013, 0xcdc1cc0d,
|
||||
0x86828406, 0x89b1b839, 0xcff3fc3f, 0x4d717c3d, 0xc1c1c001,
|
||||
0x1313031, 0xc5f1f435, 0x8a82880a, 0x4a62682a, 0x81b1b031,
|
||||
0xc1d1d011, 0x202020, 0xc7d3d417, 0x2020002, 0x2222022, 0x4000404,
|
||||
0x48606828, 0x41717031, 0x7030407, 0xcbd3d81b, 0x8d919c1d,
|
||||
0x89919819, 0x41616021, 0x8eb2bc3e, 0xc6e2e426, 0x49515819,
|
||||
0xcdd1dc1d, 0x41515011, 0x80909010, 0xccd0dc1c, 0x8a92981a,
|
||||
0x83a3a023, 0x8ba3a82b, 0xc0d0d010, 0x81818001, 0xf030c0f,
|
||||
0x47434407, 0xa12181a, 0xc3e3e023, 0xcce0ec2c, 0x8d818c0d,
|
||||
0x8fb3bc3f, 0x86929416, 0x4b73783b, 0x4c505c1c, 0x82a2a022,
|
||||
0x81a1a021, 0x43636023, 0x3232023, 0x4d414c0d, 0xc8c0c808,
|
||||
0x8e929c1e, 0x8c909c1c, 0xa32383a, 0xc000c0c, 0xe222c2e,
|
||||
0x8ab2b83a, 0x4e626c2e, 0x8f939c1f, 0x4a52581a, 0xc2f2f032,
|
||||
0x82929012, 0xc3f3f033, 0x49414809, 0x48707838, 0xccc0cc0c,
|
||||
0x5111415, 0xcbf3f83b, 0x40707030, 0x45717435, 0x4f737c3f,
|
||||
0x5313435, 0x101010, 0x3030003, 0x44606424, 0x4d616c2d, 0xc6c2c406,
|
||||
0x44707434, 0xc5d1d415, 0x84b0b434, 0xcae2e82a, 0x9010809,
|
||||
0x46727436, 0x9111819, 0xcef2fc3e, 0x40404000, 0x2121012,
|
||||
0xc0e0e020, 0x8db1bc3d, 0x5010405, 0xcaf2f83a, 0x1010001,
|
||||
0xc0f0f030, 0xa22282a, 0x4e525c1e, 0x89a1a829, 0x46525416,
|
||||
0x43434003, 0x85818405, 0x4101414, 0x89818809, 0x8b93981b,
|
||||
0x80b0b030, 0xc5e1e425, 0x48404808, 0x49717839, 0x87939417,
|
||||
0xccf0fc3c, 0xe121c1e, 0x82828002, 0x1212021, 0x8c808c0c,
|
||||
0xb13181b, 0x4f535c1f, 0x47737437, 0x44505414, 0x82b2b032,
|
||||
0xd111c1d, 0x5212425, 0x4f434c0f, 0, 0x46424406, 0xcde1ec2d,
|
||||
0x48505818, 0x42525012, 0xcbe3e82b, 0x4e727c3e, 0xcad2d81a,
|
||||
0xc9c1c809, 0xcdf1fc3d, 0x303030, 0x85919415, 0x45616425,
|
||||
0xc303c3c, 0x86b2b436, 0xc4e0e424, 0x8bb3b83b, 0x4c707c3c,
|
||||
0xe020c0e, 0x40505010, 0x9313839, 0x6222426, 0x2323032, 0x84808404,
|
||||
0x49616829, 0x83939013, 0x7333437, 0xc7e3e427, 0x4202424,
|
||||
0x84a0a424, 0xcbc3c80b, 0x43535013, 0xa02080a, 0x87838407,
|
||||
0xc9d1d819, 0x4c404c0c, 0x83838003, 0x8f838c0f, 0xcec2cc0e,
|
||||
0xb33383b, 0x4a42480a, 0x87b3b437 };
|
||||
|
||||
private int KC[] = { 0x9e3779b9, 0x3c6ef373, 0x78dde6e6, 0xf1bbcdcc,
|
||||
0xe3779b99, 0xc6ef3733, 0x8dde6e67, 0x1bbcdccf, 0x3779b99e,
|
||||
0x6ef3733c, 0xdde6e678, 0xbbcdccf1, 0x779b99e3, 0xef3733c6,
|
||||
0xde6e678d, 0xbcdccf1b };
|
||||
|
||||
private boolean LITTLE = false;
|
||||
private boolean ENDIAN = LITTLE;
|
||||
private final int NO_ROUNDS = 16;
|
||||
|
||||
/** Seed Block Size (16byte) */
|
||||
private final int SEED_BLOCK_SIZE = 16;
|
||||
|
||||
/** Padding Object */
|
||||
private CryptoPaddingImpl padding = null;
|
||||
|
||||
public SeedCipher() {
|
||||
padding = new AnsiX923Padding();
|
||||
}
|
||||
|
||||
private int getB0(int A) {
|
||||
return 0xff & A;
|
||||
}
|
||||
|
||||
private int getB1(int A) {
|
||||
return 0xff & A >>> 8;
|
||||
}
|
||||
|
||||
private int getB2(int A) {
|
||||
return 0xff & A >>> 16;
|
||||
}
|
||||
|
||||
private int getB3(int A) {
|
||||
return 0xff & A >>> 24;
|
||||
}
|
||||
|
||||
private void EndianChange(int dws[]) {
|
||||
dws[0] = dws[0] >>> 24 | dws[0] << 24 | dws[0] << 8 & 0xff0000
|
||||
| dws[0] >>> 8 & 0xff00;
|
||||
}
|
||||
|
||||
private int EndianChange(int dws) {
|
||||
return dws >>> 24 | dws << 24 | dws << 8 & 0xff0000 | dws >>> 8
|
||||
& 0xff00;
|
||||
}
|
||||
|
||||
private void seedRound(int L0[], int L1[], int R0[], int R1[], int K[]) {
|
||||
long T00 = 0L;
|
||||
long T11 = 0L;
|
||||
int T0 = R0[0] ^ K[0];
|
||||
int T1 = R1[0] ^ K[1];
|
||||
T1 ^= T0;
|
||||
T00 = T0 >= 0 ? T0 : (T0 & 0x7fffffff) | 0xffffffff80000000L;
|
||||
T1 = SS0[getB0(T1)] ^ SS1[getB1(T1)] ^ SS2[getB2(T1)] ^ SS3[getB3(T1)];
|
||||
T11 = T1 >= 0 ? T1 : (T1 & 0x7fffffff) | 0xffffffff80000000L;
|
||||
T00 += T11;
|
||||
T0 = SS0[getB0((int) T00)] ^ SS1[getB1((int) T00)]
|
||||
^ SS2[getB2((int) T00)] ^ SS3[getB3((int) T00)];
|
||||
T00 = T0 >= 0 ? T0 : (T0 & 0x7fffffff) | 0xffffffff80000000L;
|
||||
T11 += T00;
|
||||
T1 = SS0[getB0((int) T11)] ^ SS1[getB1((int) T11)]
|
||||
^ SS2[getB2((int) T11)] ^ SS3[getB3((int) T11)];
|
||||
T11 = T1 >= 0 ? T1 : (T1 & 0x7fffffff) | 0xffffffff80000000L;
|
||||
T00 += T11;
|
||||
L0[0] ^= (int) T00;
|
||||
L1[0] ^= (int) T11;
|
||||
}
|
||||
|
||||
private void seedEncrypt(byte pbData[], int pdwRoundKey[], byte outData[]) {
|
||||
int L0[] = new int[1];
|
||||
int L1[] = new int[1];
|
||||
int R0[] = new int[1];
|
||||
int R1[] = new int[1];
|
||||
L0[0] = 0;
|
||||
L1[0] = 0;
|
||||
R0[0] = 0;
|
||||
R1[0] = 0;
|
||||
int K[] = new int[2];
|
||||
int nCount = 0;
|
||||
L0[0] = pbData[0] & 0xff;
|
||||
L0[0] = L0[0] << 8 ^ pbData[1] & 0xff;
|
||||
L0[0] = L0[0] << 8 ^ pbData[2] & 0xff;
|
||||
L0[0] = L0[0] << 8 ^ pbData[3] & 0xff;
|
||||
L1[0] = pbData[4] & 0xff;
|
||||
L1[0] = L1[0] << 8 ^ pbData[5] & 0xff;
|
||||
L1[0] = L1[0] << 8 ^ pbData[6] & 0xff;
|
||||
L1[0] = L1[0] << 8 ^ pbData[7] & 0xff;
|
||||
R0[0] = pbData[8] & 0xff;
|
||||
R0[0] = R0[0] << 8 ^ pbData[9] & 0xff;
|
||||
R0[0] = R0[0] << 8 ^ pbData[10] & 0xff;
|
||||
R0[0] = R0[0] << 8 ^ pbData[11] & 0xff;
|
||||
R1[0] = pbData[12] & 0xff;
|
||||
R1[0] = R1[0] << 8 ^ pbData[13] & 0xff;
|
||||
R1[0] = R1[0] << 8 ^ pbData[14] & 0xff;
|
||||
R1[0] = R1[0] << 8 ^ pbData[15] & 0xff;
|
||||
if (!ENDIAN) {
|
||||
EndianChange(L0);
|
||||
EndianChange(L1);
|
||||
EndianChange(R0);
|
||||
EndianChange(R1);
|
||||
}
|
||||
K[0] = pdwRoundKey[nCount++];
|
||||
K[1] = pdwRoundKey[nCount++];
|
||||
seedRound(L0, L1, R0, R1, K);
|
||||
K[0] = pdwRoundKey[nCount++];
|
||||
K[1] = pdwRoundKey[nCount++];
|
||||
seedRound(R0, R1, L0, L1, K);
|
||||
K[0] = pdwRoundKey[nCount++];
|
||||
K[1] = pdwRoundKey[nCount++];
|
||||
seedRound(L0, L1, R0, R1, K);
|
||||
K[0] = pdwRoundKey[nCount++];
|
||||
K[1] = pdwRoundKey[nCount++];
|
||||
seedRound(R0, R1, L0, L1, K);
|
||||
K[0] = pdwRoundKey[nCount++];
|
||||
K[1] = pdwRoundKey[nCount++];
|
||||
seedRound(L0, L1, R0, R1, K);
|
||||
K[0] = pdwRoundKey[nCount++];
|
||||
K[1] = pdwRoundKey[nCount++];
|
||||
seedRound(R0, R1, L0, L1, K);
|
||||
K[0] = pdwRoundKey[nCount++];
|
||||
K[1] = pdwRoundKey[nCount++];
|
||||
seedRound(L0, L1, R0, R1, K);
|
||||
K[0] = pdwRoundKey[nCount++];
|
||||
K[1] = pdwRoundKey[nCount++];
|
||||
seedRound(R0, R1, L0, L1, K);
|
||||
K[0] = pdwRoundKey[nCount++];
|
||||
K[1] = pdwRoundKey[nCount++];
|
||||
seedRound(L0, L1, R0, R1, K);
|
||||
K[0] = pdwRoundKey[nCount++];
|
||||
K[1] = pdwRoundKey[nCount++];
|
||||
seedRound(R0, R1, L0, L1, K);
|
||||
K[0] = pdwRoundKey[nCount++];
|
||||
K[1] = pdwRoundKey[nCount++];
|
||||
seedRound(L0, L1, R0, R1, K);
|
||||
K[0] = pdwRoundKey[nCount++];
|
||||
K[1] = pdwRoundKey[nCount++];
|
||||
seedRound(R0, R1, L0, L1, K);
|
||||
|
||||
if (NO_ROUNDS == 16) {
|
||||
K[0] = pdwRoundKey[nCount++];
|
||||
K[1] = pdwRoundKey[nCount++];
|
||||
seedRound(L0, L1, R0, R1, K);
|
||||
K[0] = pdwRoundKey[nCount++];
|
||||
K[1] = pdwRoundKey[nCount++];
|
||||
seedRound(R0, R1, L0, L1, K);
|
||||
K[0] = pdwRoundKey[nCount++];
|
||||
K[1] = pdwRoundKey[nCount++];
|
||||
seedRound(L0, L1, R0, R1, K);
|
||||
K[0] = pdwRoundKey[nCount++];
|
||||
K[1] = pdwRoundKey[nCount++];
|
||||
seedRound(R0, R1, L0, L1, K);
|
||||
}
|
||||
|
||||
if (!ENDIAN) {
|
||||
EndianChange(L0);
|
||||
EndianChange(L1);
|
||||
EndianChange(R0);
|
||||
EndianChange(R1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
outData[i] = (byte) (R0[0] >>> 8 * (3 - i) & 0xff);
|
||||
outData[4 + i] = (byte) (R1[0] >>> 8 * (3 - i) & 0xff);
|
||||
outData[8 + i] = (byte) (L0[0] >>> 8 * (3 - i) & 0xff);
|
||||
outData[12 + i] = (byte) (L1[0] >>> 8 * (3 - i) & 0xff);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void seedDecrypt(byte pbData[], int pdwRoundKey[], byte outData[]) {
|
||||
int L0[] = new int[1];
|
||||
int L1[] = new int[1];
|
||||
int R0[] = new int[1];
|
||||
int R1[] = new int[1];
|
||||
int K[] = new int[2];
|
||||
L0[0] = 0;
|
||||
L1[0] = 0;
|
||||
R0[0] = 0;
|
||||
R1[0] = 0;
|
||||
int nCount = 31;
|
||||
L0[0] = pbData[0] & 0xff;
|
||||
L0[0] = L0[0] << 8 ^ pbData[1] & 0xff;
|
||||
L0[0] = L0[0] << 8 ^ pbData[2] & 0xff;
|
||||
L0[0] = L0[0] << 8 ^ pbData[3] & 0xff;
|
||||
L1[0] = pbData[4] & 0xff;
|
||||
L1[0] = L1[0] << 8 ^ pbData[5] & 0xff;
|
||||
L1[0] = L1[0] << 8 ^ pbData[6] & 0xff;
|
||||
L1[0] = L1[0] << 8 ^ pbData[7] & 0xff;
|
||||
R0[0] = pbData[8] & 0xff;
|
||||
R0[0] = R0[0] << 8 ^ pbData[9] & 0xff;
|
||||
R0[0] = R0[0] << 8 ^ pbData[10] & 0xff;
|
||||
R0[0] = R0[0] << 8 ^ pbData[11] & 0xff;
|
||||
R1[0] = pbData[12] & 0xff;
|
||||
R1[0] = R1[0] << 8 ^ pbData[13] & 0xff;
|
||||
R1[0] = R1[0] << 8 ^ pbData[14] & 0xff;
|
||||
R1[0] = R1[0] << 8 ^ pbData[15] & 0xff;
|
||||
|
||||
if (!ENDIAN) {
|
||||
EndianChange(L0);
|
||||
EndianChange(L1);
|
||||
EndianChange(R0);
|
||||
EndianChange(R1);
|
||||
}
|
||||
|
||||
if (NO_ROUNDS == 16) {
|
||||
K[1] = pdwRoundKey[nCount--];
|
||||
K[0] = pdwRoundKey[nCount--];
|
||||
seedRound(L0, L1, R0, R1, K);
|
||||
K[1] = pdwRoundKey[nCount--];
|
||||
K[0] = pdwRoundKey[nCount--];
|
||||
seedRound(R0, R1, L0, L1, K);
|
||||
K[1] = pdwRoundKey[nCount--];
|
||||
K[0] = pdwRoundKey[nCount--];
|
||||
seedRound(L0, L1, R0, R1, K);
|
||||
K[1] = pdwRoundKey[nCount--];
|
||||
K[0] = pdwRoundKey[nCount--];
|
||||
seedRound(R0, R1, L0, L1, K);
|
||||
}
|
||||
|
||||
K[1] = pdwRoundKey[nCount--];
|
||||
K[0] = pdwRoundKey[nCount--];
|
||||
seedRound(L0, L1, R0, R1, K);
|
||||
K[1] = pdwRoundKey[nCount--];
|
||||
K[0] = pdwRoundKey[nCount--];
|
||||
seedRound(R0, R1, L0, L1, K);
|
||||
K[1] = pdwRoundKey[nCount--];
|
||||
K[0] = pdwRoundKey[nCount--];
|
||||
seedRound(L0, L1, R0, R1, K);
|
||||
K[1] = pdwRoundKey[nCount--];
|
||||
K[0] = pdwRoundKey[nCount--];
|
||||
seedRound(R0, R1, L0, L1, K);
|
||||
K[1] = pdwRoundKey[nCount--];
|
||||
K[0] = pdwRoundKey[nCount--];
|
||||
seedRound(L0, L1, R0, R1, K);
|
||||
K[1] = pdwRoundKey[nCount--];
|
||||
K[0] = pdwRoundKey[nCount--];
|
||||
seedRound(R0, R1, L0, L1, K);
|
||||
K[1] = pdwRoundKey[nCount--];
|
||||
K[0] = pdwRoundKey[nCount--];
|
||||
seedRound(L0, L1, R0, R1, K);
|
||||
K[1] = pdwRoundKey[nCount--];
|
||||
K[0] = pdwRoundKey[nCount--];
|
||||
seedRound(R0, R1, L0, L1, K);
|
||||
K[1] = pdwRoundKey[nCount--];
|
||||
K[0] = pdwRoundKey[nCount--];
|
||||
seedRound(L0, L1, R0, R1, K);
|
||||
K[1] = pdwRoundKey[nCount--];
|
||||
K[0] = pdwRoundKey[nCount--];
|
||||
seedRound(R0, R1, L0, L1, K);
|
||||
K[1] = pdwRoundKey[nCount--];
|
||||
K[0] = pdwRoundKey[nCount--];
|
||||
seedRound(L0, L1, R0, R1, K);
|
||||
K[1] = pdwRoundKey[nCount--];
|
||||
K[0] = pdwRoundKey[nCount];
|
||||
seedRound(R0, R1, L0, L1, K);
|
||||
|
||||
if (!ENDIAN) {
|
||||
EndianChange(L0);
|
||||
EndianChange(L1);
|
||||
EndianChange(R0);
|
||||
EndianChange(R1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
outData[i] = (byte) (R0[0] >>> 8 * (3 - i) & 0xff);
|
||||
outData[4 + i] = (byte) (R1[0] >>> 8 * (3 - i) & 0xff);
|
||||
outData[8 + i] = (byte) (L0[0] >>> 8 * (3 - i) & 0xff);
|
||||
outData[12 + i] = (byte) (L1[0] >>> 8 * (3 - i) & 0xff);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void EncRoundKeyUpdate0(int K[], int A[], int B[], int C[],
|
||||
int D[], int Z) {
|
||||
|
||||
int T0 = A[0];
|
||||
A[0] = A[0] >>> 8 ^ B[0] << 24;
|
||||
B[0] = B[0] >>> 8 ^ T0 << 24;
|
||||
int T00 = (A[0] + C[0]) - KC[Z];
|
||||
int T11 = (B[0] + KC[Z]) - D[0];
|
||||
K[0] = SS0[getB0(T00)] ^ SS1[getB1(T00)] ^ SS2[getB2(T00)] ^ SS3[getB3(T00)];
|
||||
K[1] = SS0[getB0(T11)] ^ SS1[getB1(T11)] ^ SS2[getB2(T11)] ^ SS3[getB3(T11)];
|
||||
}
|
||||
|
||||
private void EncRoundKeyUpdate1(int K[], int A[], int B[], int C[],
|
||||
int D[], int Z) {
|
||||
|
||||
int T0 = C[0];
|
||||
C[0] = C[0] << 8 ^ D[0] >>> 24;
|
||||
D[0] = D[0] << 8 ^ T0 >>> 24;
|
||||
int T00 = (A[0] + C[0]) - KC[Z];
|
||||
int T11 = (B[0] + KC[Z]) - D[0];
|
||||
K[0] = SS0[getB0(T00)] ^ SS1[getB1(T00)] ^ SS2[getB2(T00)] ^ SS3[getB3(T00)];
|
||||
K[1] = SS0[getB0(T11)] ^ SS1[getB1(T11)] ^ SS2[getB2(T11)] ^ SS3[getB3(T11)];
|
||||
}
|
||||
|
||||
private void seedEncRoundKey(int pdwRoundKey[], byte pbUserKey[]) {
|
||||
int A[] = new int[1];
|
||||
int B[] = new int[1];
|
||||
int C[] = new int[1];
|
||||
int D[] = new int[1];
|
||||
int K[] = new int[2];
|
||||
int nCount = 2;
|
||||
A[0] = pbUserKey[0] & 0xff;
|
||||
A[0] = A[0] << 8 ^ pbUserKey[1] & 0xff;
|
||||
A[0] = A[0] << 8 ^ pbUserKey[2] & 0xff;
|
||||
A[0] = A[0] << 8 ^ pbUserKey[3] & 0xff;
|
||||
B[0] = pbUserKey[4] & 0xff;
|
||||
B[0] = B[0] << 8 ^ pbUserKey[5] & 0xff;
|
||||
B[0] = B[0] << 8 ^ pbUserKey[6] & 0xff;
|
||||
B[0] = B[0] << 8 ^ pbUserKey[7] & 0xff;
|
||||
C[0] = pbUserKey[8] & 0xff;
|
||||
C[0] = C[0] << 8 ^ pbUserKey[9] & 0xff;
|
||||
C[0] = C[0] << 8 ^ pbUserKey[10] & 0xff;
|
||||
C[0] = C[0] << 8 ^ pbUserKey[11] & 0xff;
|
||||
D[0] = pbUserKey[12] & 0xff;
|
||||
D[0] = D[0] << 8 ^ pbUserKey[13] & 0xff;
|
||||
D[0] = D[0] << 8 ^ pbUserKey[14] & 0xff;
|
||||
D[0] = D[0] << 8 ^ pbUserKey[15] & 0xff;
|
||||
if (!ENDIAN) {
|
||||
A[0] = EndianChange(A[0]);
|
||||
B[0] = EndianChange(B[0]);
|
||||
C[0] = EndianChange(C[0]);
|
||||
D[0] = EndianChange(D[0]);
|
||||
}
|
||||
int T0 = (A[0] + C[0]) - KC[0];
|
||||
int T1 = (B[0] - D[0]) + KC[0];
|
||||
pdwRoundKey[0] = SS0[getB0(T0)] ^ SS1[getB1(T0)] ^ SS2[getB2(T0)] ^ SS3[getB3(T0)];
|
||||
pdwRoundKey[1] = SS0[getB0(T1)] ^ SS1[getB1(T1)] ^ SS2[getB2(T1)] ^ SS3[getB3(T1)];
|
||||
EncRoundKeyUpdate0(K, A, B, C, D, 1);
|
||||
pdwRoundKey[nCount++] = K[0];
|
||||
pdwRoundKey[nCount++] = K[1];
|
||||
EncRoundKeyUpdate1(K, A, B, C, D, 2);
|
||||
pdwRoundKey[nCount++] = K[0];
|
||||
pdwRoundKey[nCount++] = K[1];
|
||||
EncRoundKeyUpdate0(K, A, B, C, D, 3);
|
||||
pdwRoundKey[nCount++] = K[0];
|
||||
pdwRoundKey[nCount++] = K[1];
|
||||
EncRoundKeyUpdate1(K, A, B, C, D, 4);
|
||||
pdwRoundKey[nCount++] = K[0];
|
||||
pdwRoundKey[nCount++] = K[1];
|
||||
EncRoundKeyUpdate0(K, A, B, C, D, 5);
|
||||
pdwRoundKey[nCount++] = K[0];
|
||||
pdwRoundKey[nCount++] = K[1];
|
||||
EncRoundKeyUpdate1(K, A, B, C, D, 6);
|
||||
pdwRoundKey[nCount++] = K[0];
|
||||
pdwRoundKey[nCount++] = K[1];
|
||||
EncRoundKeyUpdate0(K, A, B, C, D, 7);
|
||||
pdwRoundKey[nCount++] = K[0];
|
||||
pdwRoundKey[nCount++] = K[1];
|
||||
EncRoundKeyUpdate1(K, A, B, C, D, 8);
|
||||
pdwRoundKey[nCount++] = K[0];
|
||||
pdwRoundKey[nCount++] = K[1];
|
||||
EncRoundKeyUpdate0(K, A, B, C, D, 9);
|
||||
pdwRoundKey[nCount++] = K[0];
|
||||
pdwRoundKey[nCount++] = K[1];
|
||||
EncRoundKeyUpdate1(K, A, B, C, D, 10);
|
||||
pdwRoundKey[nCount++] = K[0];
|
||||
pdwRoundKey[nCount++] = K[1];
|
||||
EncRoundKeyUpdate0(K, A, B, C, D, 11);
|
||||
pdwRoundKey[nCount++] = K[0];
|
||||
pdwRoundKey[nCount++] = K[1];
|
||||
if (NO_ROUNDS == 16) {
|
||||
EncRoundKeyUpdate1(K, A, B, C, D, 12);
|
||||
pdwRoundKey[nCount++] = K[0];
|
||||
pdwRoundKey[nCount++] = K[1];
|
||||
EncRoundKeyUpdate0(K, A, B, C, D, 13);
|
||||
pdwRoundKey[nCount++] = K[0];
|
||||
pdwRoundKey[nCount++] = K[1];
|
||||
EncRoundKeyUpdate1(K, A, B, C, D, 14);
|
||||
pdwRoundKey[nCount++] = K[0];
|
||||
pdwRoundKey[nCount++] = K[1];
|
||||
EncRoundKeyUpdate0(K, A, B, C, D, 15);
|
||||
pdwRoundKey[nCount++] = K[0];
|
||||
pdwRoundKey[nCount++] = K[1];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 한국정보보호진흥원 소스에 없는 추가 된 함수로 입력 받은 바이트 데이터를 암호화 하여 리턴한다.
|
||||
*
|
||||
* @param sbuffer
|
||||
* String 평문
|
||||
* @param szKey
|
||||
* byte[] key
|
||||
* @return byte[] 암호화 된 데이터
|
||||
*/
|
||||
public byte[] encrypt(byte[] sbuffer, byte szKey[]) {
|
||||
int sRoundKey[] = new int[32];
|
||||
seedEncRoundKey(sRoundKey, szKey);
|
||||
|
||||
byte[] inDataBuffer = padding.addPadding(sbuffer, SEED_BLOCK_SIZE);
|
||||
byte[] encryptBytes = new byte[inDataBuffer.length];
|
||||
|
||||
int rt = inDataBuffer.length / SEED_BLOCK_SIZE;
|
||||
for (int j = 0; j < rt; j++) {
|
||||
byte sSource[] = new byte[SEED_BLOCK_SIZE];
|
||||
byte sTarget[] = new byte[SEED_BLOCK_SIZE];
|
||||
|
||||
System.arraycopy(inDataBuffer, (j * SEED_BLOCK_SIZE), sSource, 0,
|
||||
SEED_BLOCK_SIZE);
|
||||
seedEncrypt(sSource, sRoundKey, sTarget);
|
||||
|
||||
System.arraycopy(sTarget, 0, encryptBytes, (j * SEED_BLOCK_SIZE),
|
||||
sTarget.length);
|
||||
}
|
||||
|
||||
return encryptBytes;
|
||||
}
|
||||
/**
|
||||
* 한국정보보호진흥원 소스에 없는 추가 된 함수로 입력 받은 바이트 데이터를 암호화 하여 리턴한다.
|
||||
*
|
||||
* @param sbuffer
|
||||
* String 평문
|
||||
* @param szKey
|
||||
* byte[] key
|
||||
* @return byte[] 암호화 된 데이터
|
||||
*/
|
||||
public byte[] encryptForLog(byte[] buffer, byte szKey[]) {
|
||||
byte[] sbuffer = new byte[SEED_BLOCK_SIZE+buffer.length];
|
||||
//길이 byte settting
|
||||
System.arraycopy(getFormatString(buffer.length,SEED_BLOCK_SIZE).getBytes(), 0, sbuffer, 0,SEED_BLOCK_SIZE);
|
||||
//업무데이타 setting
|
||||
System.arraycopy(buffer, 0, sbuffer, SEED_BLOCK_SIZE,buffer.length);
|
||||
|
||||
int sRoundKey[] = new int[32];
|
||||
seedEncRoundKey(sRoundKey, szKey);
|
||||
|
||||
byte[] inDataBuffer = padding.addPadding(sbuffer, SEED_BLOCK_SIZE);
|
||||
byte[] encryptBytes = new byte[inDataBuffer.length];
|
||||
|
||||
int rt = inDataBuffer.length / SEED_BLOCK_SIZE;
|
||||
for (int j = 0; j < rt; j++) {
|
||||
byte sSource[] = new byte[SEED_BLOCK_SIZE];
|
||||
byte sTarget[] = new byte[SEED_BLOCK_SIZE];
|
||||
|
||||
System.arraycopy(inDataBuffer, (j * SEED_BLOCK_SIZE), sSource, 0,
|
||||
SEED_BLOCK_SIZE);
|
||||
seedEncrypt(sSource, sRoundKey, sTarget);
|
||||
|
||||
System.arraycopy(sTarget, 0, encryptBytes, (j * SEED_BLOCK_SIZE),
|
||||
sTarget.length);
|
||||
}
|
||||
|
||||
return encryptBytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 한국정보보호진흥원 소스에 없는 추가 된 함수로 입력 받은 문자열을 암호화 하여 리턴한다.
|
||||
*
|
||||
* @param inData
|
||||
* String 평문
|
||||
* @param szKey
|
||||
* byte[] key
|
||||
* @return byte[] 암호화 된 데이터
|
||||
*/
|
||||
public byte[] encrypt(String inData, byte szKey[]) {
|
||||
return encrypt(inData.getBytes(), szKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 한국정보보호진흥원 소스에 없는 추가 된 함수로 입력 받은 문자열을 특정 Charset으로 변환하여 암호화 하여 리턴한다.
|
||||
*
|
||||
* @param inData
|
||||
* String 평문
|
||||
* @param szKey
|
||||
* byte[] key
|
||||
* @param charset
|
||||
* String String을 byte 데이터로 변환할때 사용할 charset
|
||||
* @return byte[] 암호화 된 데이터
|
||||
*/
|
||||
public byte[] encrypt(String inData, byte szKey[], String charset)
|
||||
throws UnsupportedEncodingException {
|
||||
|
||||
return encrypt(inData.getBytes(charset), szKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 한국정보보호진흥원 소스에 없는 추가 된 함수로 암호화 된 바이트 데이터를 받아서 복호화한다.
|
||||
*
|
||||
* @param encryptBytes
|
||||
* byte[] 암호화 된 바이트 데이터
|
||||
* @param szKey
|
||||
* byte[] key
|
||||
* @return byte[] 복호화 된 바이트 데이터
|
||||
*/
|
||||
public byte[] decrypt(byte[] encryptBytes, byte[] szKey) {
|
||||
int sRoundKey[] = new int[32];
|
||||
byte[] decryptBytes = new byte[encryptBytes.length];
|
||||
seedEncRoundKey(sRoundKey, szKey);
|
||||
int rt = encryptBytes.length / SEED_BLOCK_SIZE;
|
||||
|
||||
byte sSource[] = new byte[SEED_BLOCK_SIZE];
|
||||
byte sTarget[] = new byte[SEED_BLOCK_SIZE];
|
||||
for (int j = 0; j < rt; j++) {
|
||||
System.arraycopy(encryptBytes, (j * SEED_BLOCK_SIZE), sSource, 0 ,SEED_BLOCK_SIZE);
|
||||
seedDecrypt(sSource, sRoundKey, sTarget);
|
||||
System.arraycopy(sTarget, 0, decryptBytes, (j * SEED_BLOCK_SIZE), SEED_BLOCK_SIZE);
|
||||
}
|
||||
|
||||
return padding.removePadding(decryptBytes, SEED_BLOCK_SIZE);
|
||||
}
|
||||
/**
|
||||
* 한국정보보호진흥원 소스에 없는 추가 된 함수로 암호화 된 바이트 데이터를 받아서 복호화한다.
|
||||
*
|
||||
* @param encryptBytes
|
||||
* byte[] 암호화 된 바이트 데이터
|
||||
* @param szKey
|
||||
* byte[] key
|
||||
* @return byte[] 복호화 된 바이트 데이터
|
||||
*/
|
||||
public byte[] decryptForLog(byte[] encryptBytes, byte[] szKey) {
|
||||
int sRoundKey[] = new int[32];
|
||||
byte[] decryptBytes = new byte[encryptBytes.length];
|
||||
seedEncRoundKey(sRoundKey, szKey);
|
||||
int rt = encryptBytes.length / SEED_BLOCK_SIZE;
|
||||
|
||||
byte sSource[] = new byte[SEED_BLOCK_SIZE];
|
||||
byte sTarget[] = new byte[SEED_BLOCK_SIZE];
|
||||
for (int j = 0; j < rt; j++) {
|
||||
System.arraycopy(encryptBytes, (j * SEED_BLOCK_SIZE), sSource, 0 ,SEED_BLOCK_SIZE);
|
||||
seedDecrypt(sSource, sRoundKey, sTarget);
|
||||
System.arraycopy(sTarget, 0, decryptBytes, (j * SEED_BLOCK_SIZE), SEED_BLOCK_SIZE);
|
||||
}
|
||||
byte[] length = new byte[SEED_BLOCK_SIZE];
|
||||
System.arraycopy(decryptBytes,0 , length, 0 ,SEED_BLOCK_SIZE);
|
||||
|
||||
try{
|
||||
int ilength = Integer.parseInt(new String(length));
|
||||
byte[] result = new byte[ilength];
|
||||
System.arraycopy(decryptBytes,SEED_BLOCK_SIZE , result, 0 ,ilength);
|
||||
return result;
|
||||
}catch(NumberFormatException e){
|
||||
return padding.removePadding(decryptBytes, SEED_BLOCK_SIZE);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 한국정보보호진흥원 소스에 없는 추가 된 함수로 암호화 된 바이트 데이터를 받아서 복호화하여 문자열로 반환한다.
|
||||
*
|
||||
* @param encryptBytes
|
||||
* byte[] 암호화 된 바이트 데이터
|
||||
* @param szKey
|
||||
* byte[] key
|
||||
* @return String 복호화 문자열
|
||||
*/
|
||||
public String decryptAsString(byte[] encryptBytes, byte[] szKey) {
|
||||
return new String(decrypt(encryptBytes, szKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* 한국정보보호진흥원 소스에 없는 추가 된 함수로 암호화 된 바이트 데이터를 받아서 복호화하여 지정한 charset으로 문자열로
|
||||
* 반환한다.
|
||||
*
|
||||
* @param encryptBytes
|
||||
* byte[] 암호화 된 바이트 데이터
|
||||
* @param szKey
|
||||
* byte[] key
|
||||
* @param charset
|
||||
* String 복호화 된 바이트 데이터를 문자열로 변환할 때 사용할 Charset
|
||||
* @return String 복호화 문자열
|
||||
*/
|
||||
public String decryptAsString(byte[] encryptBytes, byte[] szKey,
|
||||
String charset) throws UnsupportedEncodingException {
|
||||
|
||||
return new String(decrypt(encryptBytes, szKey), charset);
|
||||
}
|
||||
|
||||
public static java.lang.String getFormatString(int value, int length)
|
||||
{
|
||||
DecimalFormat df = new DecimalFormat("000000000000000000");
|
||||
String fs = df.format((long)value);
|
||||
return fs.substring(fs.length() - length);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.eactive.eai.common.server;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.common.dao.BaseDAO;
|
||||
import com.eactive.eai.common.dao.DAOException;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.server.loader.EAIServerLoader;
|
||||
import com.eactive.eai.common.server.mapper.EAIServerMapper;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
import com.eactive.eai.data.entity.onl.server.EAIServer;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class EAIServerDAO extends BaseDAO {
|
||||
|
||||
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
@Autowired
|
||||
private EAIServerLoader eaiServerEntityService;
|
||||
|
||||
@Autowired
|
||||
private EAIServerMapper eaiServerMapper;
|
||||
|
||||
public Map<String, EAIServerVO> getAllServers() throws DAOException {
|
||||
Map<String, EAIServerVO> map = new HashMap<>();
|
||||
|
||||
try (Stream<EAIServer> eaiServers = eaiServerEntityService.loadAll()){
|
||||
logger.info("[ @@ Load EAIServers Configuration - starting >>>>>>>>>>>>>>>>> ]");
|
||||
|
||||
eaiServers.forEach(e -> {
|
||||
EAIServerVO vo = eaiServerMapper.toVo(e);
|
||||
map.put(vo.getName(), vo);
|
||||
logger.info("@ " + vo.toString());
|
||||
});
|
||||
|
||||
logger.info("[>>Load EAIServers Configuration - ended ]");
|
||||
|
||||
return map;
|
||||
} catch (Exception e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICSM101"));
|
||||
}
|
||||
}
|
||||
|
||||
public EAIServerVO getServer(String name) throws DAOException {
|
||||
try {
|
||||
EAIServer eaiServer = eaiServerEntityService.getById(name);
|
||||
return eaiServerMapper.toVo(eaiServer);
|
||||
} catch (Exception e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICSM105"));
|
||||
}
|
||||
}
|
||||
|
||||
public void addServer(EAIServerVO vo) throws DAOException {
|
||||
try {
|
||||
boolean serverExist = eaiServerEntityService.existsById(vo.getName());
|
||||
|
||||
if (serverExist) {
|
||||
updateServer(vo);
|
||||
} else {
|
||||
EAIServer entity = eaiServerMapper.toEntity(vo);
|
||||
eaiServerEntityService.save(entity);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICSM103"));
|
||||
}
|
||||
}
|
||||
|
||||
public void updateServer(EAIServerVO vo) throws DAOException {
|
||||
try {
|
||||
EAIServer eaiServer = eaiServerEntityService.getById(vo.getName());
|
||||
|
||||
eaiServer.setCloudrouterurl(vo.getRouterUrl());
|
||||
eaiServer.setEaisevrip(vo.getAddress());
|
||||
eaiServer.setFlovrsevrname(vo.getFailoverSvr());
|
||||
eaiServer.setHostname(vo.getHostName());
|
||||
eaiServer.setSevrlsnportname(vo.getPort());
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICSM106"));
|
||||
}
|
||||
}
|
||||
|
||||
public void removeServer(String name) throws DAOException {
|
||||
try {
|
||||
eaiServerEntityService.deleteById(name);
|
||||
} catch (Exception e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICSM107"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,377 @@
|
||||
package com.eactive.eai.common.server;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.eactive.eai.common.dao.DAOException;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.lifecycle.Lifecycle;
|
||||
import com.eactive.eai.common.lifecycle.LifecycleException;
|
||||
import com.eactive.eai.common.lifecycle.LifecycleListener;
|
||||
import com.eactive.eai.common.lifecycle.LifecycleSupport;
|
||||
import com.eactive.eai.common.util.ApplicationContextProvider;
|
||||
import com.ext.eai.common.stdmessage.STDMessageKeys;
|
||||
|
||||
@Component
|
||||
public class EAIServerManager implements Lifecycle {
|
||||
// logger 를 쓰면 상호 참조해서 안됨---중요
|
||||
// private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
private LifecycleSupport lifecycle = new LifecycleSupport(this);
|
||||
|
||||
private boolean started;
|
||||
|
||||
private Map<String, EAIServerVO> servers;
|
||||
|
||||
private boolean isPEAIServer = false;
|
||||
private boolean isDEAIServer = false;
|
||||
private boolean isSEAIServer = false;
|
||||
|
||||
private String serverType = "";
|
||||
private String serverMappingType = "";
|
||||
private String serverName = "";
|
||||
private String systemType = "";
|
||||
private String serverIp = "";
|
||||
private String serverMac = "";
|
||||
|
||||
@Autowired
|
||||
private EAIServerDAO eaiServerDAO;
|
||||
|
||||
private EAIServerManager() {
|
||||
servers = new HashMap<>();
|
||||
|
||||
String sysOperEvirnDstcd = System.getProperty(Keys.EAI_SYSTEMMODE);
|
||||
|
||||
if (sysOperEvirnDstcd == null) {
|
||||
isDEAIServer = true;
|
||||
} else if (sysOperEvirnDstcd.equals(Keys.EAI_PRODUCT)) {
|
||||
isPEAIServer = true;
|
||||
} else if (sysOperEvirnDstcd.equals(Keys.EAI_DEVELOP)) {
|
||||
isDEAIServer = true;
|
||||
} else if (sysOperEvirnDstcd.equals(Keys.EAI_STAGING)) {
|
||||
isSEAIServer = true;
|
||||
}
|
||||
|
||||
InetAddress inetAddress;
|
||||
try {
|
||||
inetAddress = InetAddress.getLocalHost();
|
||||
serverIp = inetAddress.getHostAddress();
|
||||
NetworkInterface network = NetworkInterface.getByInetAddress(inetAddress);
|
||||
serverMac = new String(network.getHardwareAddress());
|
||||
} catch (UnknownHostException ue) {
|
||||
System.out.println("UnknownHostException = " + ue.getMessage());
|
||||
} catch (SocketException e) {
|
||||
System.out.println("SocketException = " + e.getMessage());
|
||||
} catch (Exception e) {
|
||||
System.out.println("Exception = " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static EAIServerManager getInstance() {
|
||||
return ApplicationContextProvider.getContext().getBean(EAIServerManager.class);
|
||||
}
|
||||
|
||||
public String getLocalServerName() {
|
||||
if (this.serverName == null || "".equals(this.serverName)) {
|
||||
this.serverName = System.getProperty(Keys.SERVER_KEY);
|
||||
}
|
||||
return serverName;
|
||||
}
|
||||
|
||||
public String getLocalServerHostName() throws java.net.UnknownHostException {
|
||||
|
||||
return java.net.InetAddress.getLocalHost().getHostName();
|
||||
}
|
||||
|
||||
public String getServerIp() {
|
||||
return serverIp;
|
||||
}
|
||||
|
||||
public void setServerIp(String serverIp) {
|
||||
this.serverIp = serverIp;
|
||||
}
|
||||
|
||||
public String getServerMac() {
|
||||
return serverMac;
|
||||
}
|
||||
|
||||
public void setServerMac(String serverMac) {
|
||||
this.serverMac = serverMac;
|
||||
}
|
||||
|
||||
public EAIServerVO getLocalServer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void start() throws LifecycleException {
|
||||
if (started)
|
||||
throw new LifecycleException("RECEAICSM201");
|
||||
|
||||
lifecycle.fireLifecycleEvent(STARTING_EVENT, this);
|
||||
|
||||
try {
|
||||
|
||||
this.servers = eaiServerDAO.getAllServers();
|
||||
} catch (DAOException e) {
|
||||
throw new LifecycleException(ExceptionUtil.getErrorCode(e, "RECEAICSM202"), e);
|
||||
}
|
||||
started = true;
|
||||
lifecycle.fireLifecycleEvent(STARTED_EVENT, this);
|
||||
}
|
||||
|
||||
public void stop() throws LifecycleException {
|
||||
if (!started)
|
||||
throw new LifecycleException("RECEAICSM203");
|
||||
|
||||
lifecycle.fireLifecycleEvent(STOPING_EVENT, this);
|
||||
|
||||
started = false;
|
||||
lifecycle.fireLifecycleEvent(STOPPED_EVENT, this);
|
||||
}
|
||||
|
||||
public void addLifecycleListener(LifecycleListener listener) {
|
||||
lifecycle.addLifecycleListener(listener);
|
||||
}
|
||||
|
||||
public LifecycleListener[] findLifecycleListeners() {
|
||||
return lifecycle.findLifecycleListeners();
|
||||
}
|
||||
|
||||
public void removeLifecycleListener(LifecycleListener listener) {
|
||||
lifecycle.removeLifecycleListener(listener);
|
||||
}
|
||||
|
||||
public EAIServerVO getEAIServer(String name) {
|
||||
return this.servers.get(name);
|
||||
}
|
||||
|
||||
public boolean isStarted() {
|
||||
return this.started;
|
||||
}
|
||||
|
||||
public void addEAIServer(EAIServerVO vo) {
|
||||
this.servers.put(vo.getName(), vo);
|
||||
}
|
||||
|
||||
public void removeEAIServer(String name) {
|
||||
this.servers.remove(name);
|
||||
}
|
||||
|
||||
public void setEAIServer(EAIServerVO vo) {
|
||||
this.servers.put(vo.getName(), vo);
|
||||
}
|
||||
|
||||
public Map<String, EAIServerVO> getAllServer() {
|
||||
return this.servers;
|
||||
}
|
||||
|
||||
public String[] getAllEaiSvrInstNm() {
|
||||
String[] eaiIns = this.servers.keySet().toArray(new String[0]);
|
||||
Arrays.sort(eaiIns);
|
||||
return eaiIns;
|
||||
}
|
||||
|
||||
public void reloadEAIServer(String name) throws Exception {
|
||||
try {
|
||||
EAIServerVO vo = eaiServerDAO.getServer(name);
|
||||
this.servers.put(vo.getName(), vo);
|
||||
} catch (DAOException e) {
|
||||
throw new LifecycleException(ExceptionUtil.getErrorCode(e, "RECEAICSM202"));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isPEAIServer() {
|
||||
return isPEAIServer;
|
||||
}
|
||||
|
||||
public boolean isTASEnabledEAIServer() {
|
||||
// 영태를 위해 임시로 모두 가능하게 함 (2020-06-16)
|
||||
// 운영반영을 위해 정상로직으로 변경 (2020-09-18)
|
||||
// return true;
|
||||
return !isPEAIServer;
|
||||
}
|
||||
|
||||
public boolean isDEAIServer() {
|
||||
return isDEAIServer;
|
||||
}
|
||||
|
||||
public boolean isSEAIServer() {
|
||||
return isSEAIServer;
|
||||
}
|
||||
|
||||
/**
|
||||
* 서버명에서 인스턴스를 추출
|
||||
*/
|
||||
public String getInstId() {
|
||||
String serverName = getLocalServerName();
|
||||
if (serverName != null) {
|
||||
//return serverName.substring(6);
|
||||
return substrRule(serverName,System.getProperty("eai.server.extractor",""),2);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 서버명에서 그룹명 + 인스턴스를 추출 ex)ieaiserver11 : 결과eai11 eaiSvr11 : 결과eai11
|
||||
*/
|
||||
public String getGroupInstId() {
|
||||
String serverName = getLocalServerName();
|
||||
if (serverName != null) {
|
||||
return getServerType() + getInstId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isMCI() {
|
||||
return Keys.EAI_SYSTEM_TYPE_MCI.equals(getSystemType());
|
||||
}
|
||||
|
||||
public boolean isFEP() {
|
||||
return Keys.EAI_SYSTEM_TYPE_FEP.equals(getSystemType());
|
||||
}
|
||||
|
||||
public boolean isEAI() {
|
||||
return Keys.EAI_SYSTEM_TYPE_EAI.equals(getSystemType());
|
||||
}
|
||||
|
||||
/**
|
||||
* 서버명에서 추출한 type "ieaiserver11".substring(1,4); : 결과 eai
|
||||
* "eaiSvr11".substring(0,3); : 결과 eai
|
||||
*/
|
||||
public String getServerType() {
|
||||
if (this.serverType == null || "".equals(this.serverType)) {
|
||||
String serverName = getLocalServerName();
|
||||
//this.serverType = serverName.substring(0, 3);
|
||||
this.serverType = substrRule(serverName,System.getProperty("eai.server.extractor",""),0);
|
||||
}
|
||||
return this.serverType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 서버명에서 추출한 type "ieaiserver11".substring(1,4); : 결과 eai
|
||||
* "eaiSvr11".substring(0,3); : 결과 eai
|
||||
*
|
||||
* 우체국때문에 추가됨 mcc 인스턴스가 mcd/mci 로 분리 mcu 인스턴스가 mud/mui 로 분리
|
||||
*/
|
||||
public String getServerMappingType() {
|
||||
if (this.serverMappingType == null || "".equals(this.serverMappingType)) {
|
||||
String serverName = getLocalServerName();
|
||||
//String data = serverName.substring(0, 3);
|
||||
String data = substrRule(serverName,System.getProperty("eai.server.extractor",""),1);
|
||||
if ("mcd".equals(data))
|
||||
data = "mcc";
|
||||
else if ("mci".equals(data))
|
||||
data = "mcc";
|
||||
else if ("mud".equals(data))
|
||||
data = "mcu";
|
||||
else if ("mui".equals(data))
|
||||
data = "mcu";
|
||||
this.serverMappingType = data;
|
||||
}
|
||||
return this.serverMappingType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 엔진 성격에 따라 추출한 type -D옵션에 설정된값 MCI/EAI/FEP
|
||||
*/
|
||||
public String getSystemType() {
|
||||
if (this.systemType == null || "".equals(this.systemType)) {
|
||||
this.systemType = System.getProperty(Keys.EAI_SYSTEM_TYPE);
|
||||
}
|
||||
return this.systemType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 사이트에 따른 값으로 conversion한값 D/T/P
|
||||
*/
|
||||
public String getSystemEnvTypeConvert() {
|
||||
String systemEnvType = "";
|
||||
if (EAIServerManager.getInstance().isPEAIServer()) {
|
||||
systemEnvType = STDMessageKeys.OPERATION_ENV_PRODUCT;
|
||||
} else if (EAIServerManager.getInstance().isSEAIServer()) {
|
||||
systemEnvType = STDMessageKeys.OPERATION_ENV_TESTSTAGE;
|
||||
} else if (EAIServerManager.getInstance().isDEAIServer()) {
|
||||
systemEnvType = STDMessageKeys.OPERATION_ENV_DEV;
|
||||
}
|
||||
return systemEnvType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 하나캐피탈 표준전문에서 사용(시스템구분)
|
||||
*/
|
||||
public String getSystemGubun() {
|
||||
// if (EAIServerManager.getInstance().isMCI()) {
|
||||
// return "00";
|
||||
// } else if (EAIServerManager.getInstance().isEAI()) {
|
||||
// return "02";
|
||||
// } else {
|
||||
// return "";
|
||||
// }
|
||||
return getServerType();
|
||||
}
|
||||
|
||||
public Map<String, EAIServerVO> getAllServer(boolean cache) throws DAOException {
|
||||
if (cache) {
|
||||
return this.servers;
|
||||
} else {
|
||||
return eaiServerDAO.getAllServers();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateServer(EAIServerVO vo) throws DAOException {
|
||||
eaiServerDAO.updateServer(vo);
|
||||
}
|
||||
|
||||
public void addServer(EAIServerVO vo) throws DAOException {
|
||||
eaiServerDAO.addServer(vo);
|
||||
|
||||
}
|
||||
public void removeServer(String name) throws DAOException {
|
||||
eaiServerDAO.removeServer(name);
|
||||
|
||||
}
|
||||
public static String substrRule(String data, String rule, int index) {
|
||||
// [serverType],[serverMappingType],[instanceId]
|
||||
if ("".equals(rule)) {
|
||||
rule = "[0,3],[0,3],[6]";
|
||||
}
|
||||
ArrayList<String> d = new ArrayList<String>();
|
||||
|
||||
Matcher matcher = Pattern.compile("\\[[ ]*([\\-,0-9]*)[ ]*\\]").matcher(rule);
|
||||
while (matcher.find()) {
|
||||
d.add(matcher.group(1).trim());
|
||||
}
|
||||
String[] values = d.get(index).split(",");
|
||||
if (values.length == 2) {
|
||||
int offset = Integer.parseInt(values[0]);
|
||||
int length = Integer.parseInt(values[1]);
|
||||
return data.substring(offset, offset + length);
|
||||
} else {
|
||||
if (values[0].startsWith("-")) {
|
||||
int offset = Integer.parseInt(values[0]);
|
||||
return data.substring(data.length() + offset);
|
||||
} else {
|
||||
int offset = Integer.parseInt(values[0]);
|
||||
return data.substring(offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void main(String[] args) throws Exception{
|
||||
System.out.println(substrRule("card-internal-runtime-568fd58554-b2cnk","[5,2],[5,2],[-2]",0));
|
||||
System.out.println(substrRule("card-internal-runtime-568fd58554-b2cnk","[5,2],[5,2],[-2]",1));
|
||||
System.out.println(substrRule("card-internal-runtime-568fd58554-b2cnk","[0,2],[0,2],[-2]",2));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.eactive.eai.common.server;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class EAIServerVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* EAI 서버 리슨 포트
|
||||
*/
|
||||
private String port; //서버리슨포트명[TSEAISY02.SevrLsnPortName]
|
||||
|
||||
/**
|
||||
* EAI 서버 RMI Port
|
||||
*/
|
||||
private String rmiPort;
|
||||
|
||||
/**
|
||||
* rmi RegistryPort 를 만들기 위해서 더해 주는 값
|
||||
*
|
||||
* EAI 서버 리슨 port + plusRmiPort = rmiPort
|
||||
* rmiPort는 rmi RegistryPort 임
|
||||
* 리모트 호출 url ==> rmi://{ip}:{rmi RegistryPort}/xxxxx
|
||||
* 사이트마다 다를수 있음.
|
||||
*/
|
||||
private int plusRmiPort = 1;
|
||||
|
||||
/**
|
||||
* sessionManager에서 쓰기위해
|
||||
* ehcache
|
||||
* localport , remoteport
|
||||
*
|
||||
* ignite
|
||||
* localport : communication port
|
||||
* remoteport : discovery port
|
||||
*/
|
||||
private int plusLocalPort = 4;
|
||||
private int plusRemotePort = 5;
|
||||
|
||||
/**
|
||||
* EAI 서버 장애 시 FAILOVER 서버
|
||||
*/
|
||||
private String failoverSvr; //장애극복서버명[TSEAISY02.FlovrSevrName]
|
||||
|
||||
private String name; // EAI서버인스탄스명[TSEAISY02.EAISevrInstncName]
|
||||
private String address; // EAI서버IP주소[TSEAISY02.EAISevrIP]
|
||||
private String hostNm; // 호스트명[TSEAISY02.HostName]
|
||||
private String routerUrl; // 호스트명[TSEAISY02.routerurl]
|
||||
|
||||
public static final String T3_PROTOCOL = "t3";
|
||||
public static final String HTTP_PROTOCOL = "http";
|
||||
public static final String IIOP_PROTOCOL = "rmi"; // iiop
|
||||
|
||||
public EAIServerVO() {
|
||||
}
|
||||
|
||||
public EAIServerVO(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return this.address;
|
||||
}
|
||||
|
||||
public void setPort(String port) {
|
||||
this.port = port;
|
||||
if (!"*".equals(port)) {
|
||||
try {
|
||||
setRmiPort("" + (Integer.parseInt(port) + plusRmiPort));
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getPort() {
|
||||
return this.port;
|
||||
}
|
||||
|
||||
public void setRmiPort(String port) {
|
||||
this.rmiPort = port;
|
||||
}
|
||||
|
||||
public String getRmiPort() {
|
||||
if (this.rmiPort == null) {
|
||||
this.rmiPort = "" + (Integer.parseInt(this.port) + plusRmiPort);
|
||||
}
|
||||
return this.rmiPort;
|
||||
}
|
||||
|
||||
public void setFailoverSvr(String failoverSvr) {
|
||||
this.failoverSvr = failoverSvr;
|
||||
}
|
||||
|
||||
public String getFailoverSvr() {
|
||||
return this.failoverSvr;
|
||||
}
|
||||
|
||||
public String toURL(String protocol) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(protocol).append(":").append("//");
|
||||
sb.append(address).append(":").append(port);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("EAIServerVO[ name=").append(name);
|
||||
sb.append(", address=").append(address);
|
||||
sb.append(", port=").append(port);
|
||||
sb.append(", failoverSvr=").append(failoverSvr);
|
||||
sb.append(", routerUrl=").append(routerUrl);
|
||||
sb.append(" ]");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void setHostName(String hostNm) {
|
||||
this.hostNm = hostNm;
|
||||
}
|
||||
|
||||
public String getHostName() {
|
||||
return this.hostNm;
|
||||
}
|
||||
|
||||
public String getRouterUrl() {
|
||||
return routerUrl;
|
||||
}
|
||||
|
||||
public void setRouterUrl(String routerUrl) {
|
||||
this.routerUrl = routerUrl;
|
||||
}
|
||||
|
||||
public int getCacheLocalPort(){
|
||||
if(this.port == null) return 0;
|
||||
return Integer.parseInt(this.port) + plusLocalPort;
|
||||
}
|
||||
public int getCacheRemotePort(){
|
||||
if(this.port == null) return 0;
|
||||
return Integer.parseInt(this.port) + plusRemotePort;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.eactive.eai.common.server;
|
||||
|
||||
public class Keys
|
||||
{
|
||||
public static final String DEFAULT_SERVER = "ALL";
|
||||
|
||||
// 운영 서버 이름에 대한 Property Key
|
||||
public static final String SERVER_KEY = "inst.Name";
|
||||
public static final String SERVER_PORT = "inst.Port";
|
||||
|
||||
// 운영 서버 이름에 대한 운영/DR(P), 개발(D), 스테이징(S) Property Key
|
||||
public static final String EAI_SYSTEMMODE = "eai.systemmode";
|
||||
public static final String EAI_PRODUCT = "P";
|
||||
public static final String EAI_DEVELOP = "D";
|
||||
public static final String EAI_STAGING = "S";
|
||||
public static final String EAI_LOCAL = "L"; //mci 로컬거래때문에 생성됨
|
||||
|
||||
// 엔진 성격에 따른 type MCI/FEP/EAI
|
||||
public static final String EAI_SYSTEM_TYPE = "eai.systemtype";
|
||||
|
||||
public static final String EAI_SYSTEM_TYPE_MCI = "MCI";
|
||||
public static final String EAI_SYSTEM_TYPE_EAI = "EAI";
|
||||
public static final String EAI_SYSTEM_TYPE_FEP = "FEP";
|
||||
public static final String EAI_SYSTEM_TYPE_GW = "GW";
|
||||
|
||||
// 내부표준전문 - 채넬공통부여부 (정의하지 않은 경우에는 사용하지 않음)
|
||||
// public static final String USE_CHANNELCONNOM_HEADER = "use.channelheader";
|
||||
|
||||
// EAI 개발 서버 PREFIX Key
|
||||
// public static final String EAI_DSVR = "EAI_DSVR";
|
||||
|
||||
//EAI 스테이징 서버 PREFIX Key
|
||||
// public static final String EAI_TSVR = "EAI_SSVR";
|
||||
|
||||
// EAI 운영 서버 PREFIX Key
|
||||
// public static final String EAI_PSVR = "EAI_PSVR";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.eactive.eai.common.server.mapper;
|
||||
|
||||
import org.mapstruct.InheritInverseConfiguration;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
import com.eactive.eai.common.server.EAIServerVO;
|
||||
import com.eactive.eai.data.entity.onl.server.EAIServer;
|
||||
import com.eactive.eai.data.mapper.GenericMapper;
|
||||
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface EAIServerMapper extends GenericMapper<EAIServerVO, EAIServer> {
|
||||
|
||||
@Mapping(source = "eaisevrinstncname", target = "name")
|
||||
@Mapping(source = "eaisevrip", target = "address")
|
||||
@Mapping(source = "sevrlsnportname", target = "port")
|
||||
@Mapping(source = "flovrsevrname", target = "failoverSvr")
|
||||
@Mapping(source = "hostname", target = "hostName")
|
||||
@Mapping(source = "cloudrouterurl", target = "routerUrl")
|
||||
@Override
|
||||
EAIServerVO toVo(EAIServer entity);
|
||||
|
||||
@InheritInverseConfiguration
|
||||
@Override
|
||||
EAIServer toEntity(EAIServerVO vo);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ApplicationContextProvider implements ApplicationContextAware{
|
||||
|
||||
private static ApplicationContext context;
|
||||
|
||||
public static ApplicationContext getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext ac)
|
||||
throws BeansException {
|
||||
context = ac;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
public class CamelCaseUtil {
|
||||
|
||||
public static String converCamelCase(String strdata, String token) {
|
||||
StringBuffer strbufCamelCase = new StringBuffer();
|
||||
StringTokenizer st = new StringTokenizer(strdata);
|
||||
if (null == strdata || strdata.length() == 0) {
|
||||
return "";
|
||||
}
|
||||
while (st.hasMoreTokens()) {
|
||||
String strWord = st.nextToken(token);
|
||||
strbufCamelCase.append(strWord.substring(0, 1).toUpperCase());
|
||||
if (strWord.length() > 1) {
|
||||
strbufCamelCase.append(strWord.substring(1).toLowerCase());
|
||||
}
|
||||
strbufCamelCase.append("");
|
||||
}
|
||||
return strbufCamelCase.toString();
|
||||
}
|
||||
|
||||
public static String converCamelCaseWithBrace(String strdata, String token) {
|
||||
strdata = strdata.replaceAll("\\{", token);
|
||||
strdata = strdata.replaceAll("\\}", "");
|
||||
|
||||
StringBuilder strbufCamelCase = new StringBuilder();
|
||||
StringTokenizer st = new StringTokenizer(strdata);
|
||||
if (null == strdata || strdata.length() == 0) {
|
||||
return "";
|
||||
}
|
||||
while (st.hasMoreTokens()) {
|
||||
String strWord = st.nextToken(token);
|
||||
strbufCamelCase.append(strWord.substring(0, 1).toUpperCase());
|
||||
if (strWord.length() > 1) {
|
||||
strbufCamelCase.append(strWord.substring(1).toLowerCase());
|
||||
}
|
||||
strbufCamelCase.append("");
|
||||
}
|
||||
return strbufCamelCase.toString();
|
||||
}
|
||||
|
||||
// public static void main(String args[]) throws Exception {
|
||||
// test();
|
||||
// }
|
||||
//
|
||||
// private static void test() throws Exception {
|
||||
// String data = "_CBS_IN_HTT_SyS{BAT}";
|
||||
// System.out.println(converCamelCaseWithBrace(data, "_"));
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.CharacterCodingException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : 해당 Charset으로 Buffer를 decode해 준다.
|
||||
* 2. 처리 개요 :
|
||||
* - Util 클래스로서 필요에 의해서 호출 한다.
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
* @author : 박기섭
|
||||
* @version : $Revision: 1.1 $
|
||||
* @since : rts 1.0
|
||||
*/
|
||||
public class CharsetDecoderUtil {
|
||||
/** nio charset */
|
||||
private Charset charset = null;
|
||||
|
||||
/** nio decoder */
|
||||
private CharsetDecoder decoder = null;
|
||||
|
||||
/**
|
||||
* @param encoding
|
||||
* @spring.constructor-arg value="EUC-KR"
|
||||
*/
|
||||
public CharsetDecoderUtil(String encoding) {
|
||||
this.charset = Charset.forName(encoding);
|
||||
this.decoder = charset.newDecoder();
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 8859_1을 한글코드 (KSC5601)로 변환
|
||||
* @param s 변환을 원하는 문자열
|
||||
* @return 캐릭터 셋이 변환된 문자열
|
||||
*/
|
||||
public static String toKor(String s) {
|
||||
if (s != null) {
|
||||
return changeCode(s, "iso_8859-1", "KSC5601");
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} // end of toKor
|
||||
|
||||
/**
|
||||
* 1. 기능 : charater set 체계를 바꿔주는 메쏘드
|
||||
* ex) ChatSet.changeCode(string, "KSC5601", "iso_8859_1");
|
||||
* @param s 변환을 원하는 문자열
|
||||
* @param s1 현재 캐릭터 셋
|
||||
* @param s2 바뀔 캐릿터 셋
|
||||
* @return 캐릭터 셋이 변환된 문자열
|
||||
*/
|
||||
public static String changeCode(String s, String s1, String s2) {
|
||||
String convString = null;
|
||||
if (s != null) {
|
||||
try {
|
||||
convString = new String(s.getBytes(s1), s2);
|
||||
} catch (Exception exception) {
|
||||
convString = s;
|
||||
}
|
||||
}
|
||||
return convString;
|
||||
} // end of changeCode
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : ByteBuffer를 decode한다.
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
* @author : 박기섭
|
||||
* @version : $Revision: 1.1 $
|
||||
* @since : rts 1.0
|
||||
* @param byteBuffer ByteBuffer
|
||||
* @return string ByteBuffer에 담겨진 값을 문자열로 decode한 값
|
||||
*/
|
||||
public String decode(ByteBuffer buffer) {
|
||||
|
||||
String string = null;
|
||||
// buffer가 null일 경우 return한다.
|
||||
if (buffer == null) {
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
// buffer를 decode한다.
|
||||
string = decoder.decode(buffer).toString();
|
||||
} catch (CharacterCodingException e) {
|
||||
string = "";
|
||||
}
|
||||
// decode한 값이 null일 경우 ""를 리턴 한다.
|
||||
if (string == null) {
|
||||
return "";
|
||||
} else {
|
||||
return string;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
/**
|
||||
* 1. 기능 : 공통부 Header를 EAI에서 생성하거나 삭제해야하는 경우를 위한 Utility Class
|
||||
* 2. 처리 개요 :
|
||||
* - 메시지종류에 따라 헤더를 생성하거나 삭제하는 API를 제공
|
||||
* 3. 주의사항
|
||||
* - AD 의 경우는 S는 ADD, R 는 DELETE
|
||||
* - DA 의 경우는 S는 DELETE, R 는 ADD
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see :
|
||||
* @since :
|
||||
*/
|
||||
public class CommonHeaderUtil
|
||||
{
|
||||
private static final String ADD_DELETE_HEADER = "AD";
|
||||
private static final String DELETE_ADD_HEADER = "DA";
|
||||
|
||||
private static final String MESSAGE_SEND = "S";
|
||||
// private static final String MESSAGE_RECV = "R";
|
||||
|
||||
private static final String HEADER_CYU = "CYU1"; // 연계 - 기관간의 헤더타입
|
||||
private static final int HEADER_CYU_LENGTH = 30; // 연계 - 기관간의 헤더타입
|
||||
/**
|
||||
* Private 생성자
|
||||
* Instance를 생성하지 못함
|
||||
*/
|
||||
private CommonHeaderUtil()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : ASCII Bytes에서 특정길이의 값을 추출하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - byte[] 타입의 메시지에서 툭정위치의 값을 요청길이만큼 얻어낸다.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param message 변환대상 Byte[]
|
||||
* @param sendRecv Message Type (S/R)
|
||||
* @param commandType Command Type (AD/DA)
|
||||
* @param headerType 헤더정보
|
||||
* @return 결과 String 값
|
||||
*/
|
||||
public static byte[] executeHeaderCommand(byte[] message, String sendRecv, String commandType, String headerType)
|
||||
throws Exception {
|
||||
if(ADD_DELETE_HEADER.equals(commandType)) {
|
||||
// Header Type에 맞는 add command 를 실행한다.
|
||||
if( HEADER_CYU.equals(headerType) ) {
|
||||
if(MESSAGE_SEND.equals(sendRecv)) {
|
||||
return addCYUHeaderCommand(message);
|
||||
}
|
||||
else {
|
||||
return deleteHeader(message, HEADER_CYU_LENGTH);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
else if(DELETE_ADD_HEADER.equals(commandType)) {
|
||||
// Header Type에 맞는 delete command 를 실행한다.
|
||||
if( HEADER_CYU.equals(headerType) ) {
|
||||
if(MESSAGE_SEND.equals(sendRecv)) {
|
||||
return deleteHeader(message, HEADER_CYU_LENGTH);
|
||||
}
|
||||
else {
|
||||
return addCYUHeaderCommand(message);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Invalid Command
|
||||
throw new Exception("Invald Command - "+ commandType);
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] deleteHeader(byte[] message, int headerLength) {
|
||||
int msgLength = message.length - headerLength;
|
||||
if(msgLength > 0) {
|
||||
byte[] retHeader = new byte[msgLength];
|
||||
System.arraycopy(message, headerLength, retHeader, 0, retHeader.length);
|
||||
return retHeader;
|
||||
}
|
||||
else {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] addCYUHeaderCommand(byte[] message) {
|
||||
|
||||
String tranOccurPath = "E"; // 거래발생 경로(1)
|
||||
String serverName = "EAISVR1"; // 서버이름(7)
|
||||
String sysMinHMSUnit = ""; // 거래시간(12)
|
||||
String tranSysDstcd = "1"; // 거래처리시스템 구분(1)
|
||||
String tranLogRecrdEonot = "2"; // 거래log Dump 기록유무(1)
|
||||
String Blnk0 = " "; // Filler (8)
|
||||
|
||||
int msgLength = message.length + HEADER_CYU_LENGTH;
|
||||
|
||||
sysMinHMSUnit = StringUtil.stringFormat(DatetimeUtil.getFormattedDate("HHmmssSSS"), false, ' ', 12);
|
||||
|
||||
StringBuffer sb = new StringBuffer(30);
|
||||
sb.append(tranOccurPath);
|
||||
sb.append(serverName);
|
||||
sb.append(sysMinHMSUnit);
|
||||
sb.append(tranSysDstcd);
|
||||
sb.append(tranLogRecrdEonot);
|
||||
sb.append(Blnk0);
|
||||
|
||||
byte[] retHeader = new byte[msgLength];
|
||||
|
||||
System.arraycopy(sb.toString().getBytes(), 0, retHeader, 0, HEADER_CYU_LENGTH);
|
||||
System.arraycopy(message, 0, retHeader, HEADER_CYU_LENGTH, retHeader.length-HEADER_CYU_LENGTH);
|
||||
return retHeader;
|
||||
}
|
||||
|
||||
// public static void main(String args[]) throws Exception {
|
||||
// byte[] msgBytes = "1234567890".getBytes();
|
||||
//
|
||||
// byte[] headerMsg = executeHeaderCommand(msgBytes, "S", ADD_DELETE_HEADER, HEADER_CYU);
|
||||
//
|
||||
// System.out.println("HEADER MSG["+ new String(headerMsg) +"]");
|
||||
// System.out.println("HEADER MSG["+ new String(executeHeaderCommand(headerMsg, "S", DELETE_ADD_HEADER, HEADER_CYU)) +"]");
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
/*
|
||||
* Created on 2005. 2. 26.
|
||||
*
|
||||
*/
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import com.eactive.eai.common.errorcode.ErrorCodeHandler;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* 송수신 메시지 SPEC.
|
||||
* llzz + syncFlag + user data(전문포맷전체를 사용자 DATA로 본다.)
|
||||
* - llzz(2BYTE/4BYTE) UNSIGNED INTEGER로 처리한다. -- ConfigurationContext에 저장
|
||||
* default는 4byte로 한다.
|
||||
* - syncFlag - 'S' - R/R, 'A' - ASYNC, 'K' - ACK ONLY(이 경우, SEVER의 ACK를 받는다.
|
||||
* - llzz+K[ACK|NACK]
|
||||
* - user data,...
|
||||
*
|
||||
*/
|
||||
public class CommonLib {
|
||||
|
||||
public static final char SPACE = ' ';
|
||||
|
||||
public static final char ZERO = '0';
|
||||
|
||||
public static final String EMPTY_STRING = "";
|
||||
|
||||
public static final String EMPTY_STRING_ARRAY[] = new String[0];
|
||||
|
||||
public static final int NEGOTIATING_PROTOCOL = 1;
|
||||
|
||||
public static final int PROCESSING_PROTOCOL = 2;
|
||||
|
||||
public static final byte[] SYNC_PROTOCOL_MESSAGE = "SYNC".getBytes();
|
||||
|
||||
public static final byte[] ASYNC_PROTOCOL_MESSAGE = "ASYN".getBytes();
|
||||
|
||||
public static final byte[] NACK_MESSAGE = "NACK PROTOCOL VIOLATION".getBytes();
|
||||
|
||||
public static final byte[] ACK_MESSAGE = "ACK".getBytes();
|
||||
|
||||
private static final char[] HEX_CHAR_ARRAY = { '0', '1', '2', '3', '4',
|
||||
'5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
||||
|
||||
/**
|
||||
* BYTE ARRAY값을 HEXA STRING으로 변환하여 String을 리턴한다.
|
||||
* @param abyte
|
||||
* @return
|
||||
*/
|
||||
public static String byte2Hex(byte[] abyte) {
|
||||
/*
|
||||
StringBuffer s = new StringBuffer();
|
||||
if (abyte == null)
|
||||
return s.toString();
|
||||
for (int i = 0; i < abyte.length; i++)
|
||||
s.append( Integer.toHexString((abyte[i] & 0xf0) >> 4).toUpperCase() ).append( Integer.toHexString(abyte[i] & 0xf).toUpperCase() );
|
||||
return s.toString();
|
||||
*/
|
||||
|
||||
//-------------------------------------------------
|
||||
// New Logic from cjw
|
||||
//-------------------------------------------------
|
||||
StringBuffer buf = new StringBuffer();
|
||||
int len = abyte.length;
|
||||
|
||||
int high = 0;
|
||||
int low = 0;
|
||||
for (int i = 0; i < len; i++) {
|
||||
high = ((abyte[i] & 0xf0) >> 4);
|
||||
low = (abyte[i] & 0x0f);
|
||||
buf.append(HEX_CHAR_ARRAY[high]);
|
||||
buf.append(HEX_CHAR_ARRAY[low]);
|
||||
}
|
||||
return buf.toString();
|
||||
//-------------------------------------------------
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* HEXA String값을 BYTE ARRAY로 변환한다.
|
||||
* @param s
|
||||
* @return
|
||||
*/
|
||||
public static byte[] hex2Bytes(String s) {
|
||||
byte abyte[] = new byte[s.length() / 2];
|
||||
for (int j = 0; j < abyte.length; j++)
|
||||
abyte[j] = (byte) Integer.parseInt(s.substring(2 * j, 2 * j + 2), 16);
|
||||
return abyte;
|
||||
}
|
||||
|
||||
/**
|
||||
* 주어진 String값을 주어진 길이많큼 Padding/Trim한다.
|
||||
* @param svalue - 입력스트링
|
||||
* @param isRightJustify - true이면 RIGHT JUSTIFY, false이면 LEFT JUSTIFY
|
||||
* @param padding - Padding 문자
|
||||
* @param length - 리턴할 스트링의 바이트수
|
||||
* @return 포맷팅된 String결과
|
||||
*/
|
||||
public static String stringFormat(String svalue, boolean isRightJustify, char padding, int length) {
|
||||
if ( svalue == null ) return svalue;
|
||||
|
||||
StringBuffer mpad = new StringBuffer();
|
||||
StringBuffer fmtStr = new StringBuffer();
|
||||
|
||||
String tvalue = svalue;
|
||||
int pLength = 0;
|
||||
|
||||
pLength = length - svalue.getBytes().length;
|
||||
|
||||
if (pLength == 0)
|
||||
return svalue;
|
||||
else if ( pLength < 0) {
|
||||
byte[] abytes = null;
|
||||
if (isRightJustify) {
|
||||
abytes = (new String( svalue.getBytes(), -(pLength), length)).getBytes();
|
||||
} else {
|
||||
abytes = (new String( svalue.getBytes(), 0, length)).getBytes();
|
||||
}
|
||||
|
||||
if ( abytes.length == length ) {
|
||||
return new String( abytes );
|
||||
} else {
|
||||
tvalue = new String( abytes );
|
||||
pLength = length - tvalue.length();
|
||||
}
|
||||
}
|
||||
|
||||
for(int i =0; i < pLength ; i++) {
|
||||
mpad.append( padding );
|
||||
}
|
||||
|
||||
if ( isRightJustify ) {
|
||||
return fmtStr.append(mpad).append(tvalue).toString();
|
||||
} else {
|
||||
return fmtStr.append(tvalue).append(mpad).toString();
|
||||
}
|
||||
}
|
||||
|
||||
public static java.lang.String getFormatString(long value, int length)
|
||||
{
|
||||
DecimalFormat df = new DecimalFormat("000000000000000000");
|
||||
String fs = df.format( value );
|
||||
return fs.substring(fs.length() - length);
|
||||
}
|
||||
|
||||
public static java.lang.String getFormatString(int value, int length)
|
||||
{
|
||||
DecimalFormat df = new DecimalFormat("000000000000000000");
|
||||
String fs = df.format((long)value);
|
||||
return fs.substring(fs.length() - length);
|
||||
}
|
||||
|
||||
/**
|
||||
* 메시지 비교
|
||||
*/
|
||||
public static boolean compare(byte[] source, byte[] target) {
|
||||
if ( source.length != target.length ) return false;
|
||||
|
||||
for ( int i=0; i < source.length; i++ ) {
|
||||
if ( source[i] != target[i] ) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 송수신전문에 대한 DUMP를 프린트할 수 있는 포맷으로 변환하여 String Array로 리턴한다.
|
||||
* @param bytes
|
||||
* @return
|
||||
*/
|
||||
public static String[] makeDumpFormat(byte[] bytes) {
|
||||
if (bytes == null || bytes.length == 0)
|
||||
return CommonLib.EMPTY_STRING_ARRAY;
|
||||
|
||||
String[] dumps = new String[bytes.length / 16 + ((bytes.length % 16) == 0 ? 4 : 5)];
|
||||
dumps[0] = "/==========.========================================..==================.";
|
||||
dumps[1] = "| Offset | 0 1 2 3 4 5 6 7 8 9 A B C D E F || U S E R D A T A |";
|
||||
dumps[2] = "|----------+----------------------------------------||------------------|";
|
||||
dumps[dumps.length - 1] = "'=========='========================================''==================/";
|
||||
|
||||
int len = 0;
|
||||
byte PERIOD = 0x2E;
|
||||
char aChar = ' ';
|
||||
boolean isDBCS = false;
|
||||
boolean isHalfDBCS = false;
|
||||
|
||||
|
||||
for (int i = 3; i < dumps.length - 1; i++) {
|
||||
|
||||
len = ( ((bytes.length - (i - 2) * 16) >= 0) ? 16 : (bytes.length - (i - 3)*16) );
|
||||
byte[] buf = new byte[len];
|
||||
System.arraycopy( bytes, (i-3)*16, buf, 0, len );
|
||||
StringBuffer strBuf = new StringBuffer();
|
||||
//dumps[i] = EMPTY_STRING;
|
||||
|
||||
// 2010.01.12 remove toUpperCase
|
||||
//strBuf.append("| ").append( stringFormat( new String( Integer.toHexString((i-3)*16) ).toUpperCase(), true, ZERO, 8) ).append(" | ");
|
||||
strBuf.append("| ").append( stringFormat( new String( Integer.toHexString((i-3)*16) ), true, ZERO, 8) ).append(" | ");
|
||||
|
||||
String hexStr = byte2Hex( buf );
|
||||
StringBuffer fmtStr = new StringBuffer();
|
||||
|
||||
int k = hexStr.length()/8 + ((hexStr.length() % 8) == 0 ? 0 : 1);
|
||||
for (int j=0; j < k ; j++) {
|
||||
int l = ((hexStr.length() - (j+1)*8 ) >= 0 ? 8 : (hexStr.length() - j*8 ));
|
||||
fmtStr.append( hexStr.substring(j*8, j*8 + l ) ).append(" ");
|
||||
}
|
||||
|
||||
strBuf.append( stringFormat(fmtStr.toString(), false, SPACE, 39) ).append("|| ");
|
||||
|
||||
k = 0;
|
||||
// 한글 및 특수문자가 깨지게 표시되는 것 을 방지한다.
|
||||
for ( int j=0; j < len; j++) {
|
||||
if ( buf[j] >> 7 == 0 ) {
|
||||
// Single Byte Character
|
||||
if ( isDBCS ) {
|
||||
isDBCS = false;
|
||||
if ( k != 0 && ((k % 2) == 1 )) {
|
||||
buf[j - 1] = PERIOD;
|
||||
}
|
||||
}
|
||||
aChar = (char)buf[j];
|
||||
if ( Character.isWhitespace( aChar ) || Character.isISOControl( aChar ) || buf[j] == 0 ) {
|
||||
buf[j] = PERIOD;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// Double Bytes Character.
|
||||
if ( !isDBCS ) isDBCS = true;
|
||||
if ( j == 0 && isHalfDBCS ) {
|
||||
buf[j] = PERIOD;
|
||||
isDBCS = false;
|
||||
continue;
|
||||
}
|
||||
// To check the DBCS pairwise
|
||||
k++;
|
||||
}
|
||||
if ( isDBCS && ((k%2)==1) ) {
|
||||
buf[ len -1 ] = PERIOD;
|
||||
isHalfDBCS = true;
|
||||
} else {
|
||||
isHalfDBCS = false;
|
||||
}
|
||||
|
||||
dumps[i] = strBuf.append( stringFormat(new String(buf), false, SPACE, 16) ).append(" |").toString();
|
||||
}
|
||||
return dumps;
|
||||
|
||||
}
|
||||
|
||||
public static String getDumpMessage( Object obj ) {
|
||||
byte[] message = null;
|
||||
if(obj instanceof byte[]) {
|
||||
message = (byte[])obj;
|
||||
}
|
||||
else if(obj instanceof String) {
|
||||
message = ((String)obj).getBytes();
|
||||
}
|
||||
String[] dumpMsg = makeDumpFormat( message );
|
||||
StringBuffer dump = new StringBuffer();
|
||||
dump.append("\n");
|
||||
for(int i=0; i < dumpMsg.length; i++) {
|
||||
dump.append( dumpMsg[i] ).append("\n");
|
||||
}
|
||||
|
||||
return dump.toString();
|
||||
}
|
||||
|
||||
public static String getMessage(String msgCode, String[] params) {
|
||||
StringBuffer strBuff = new StringBuffer();
|
||||
strBuff.append("[").append(msgCode).append("] ").append( ErrorCodeHandler.getMessage( msgCode, params ) );
|
||||
return strBuff.toString();
|
||||
}
|
||||
|
||||
public static String getMessage(String msgCode) {
|
||||
StringBuffer strBuff = new StringBuffer();
|
||||
strBuff.append("[").append(msgCode).append("] ").append( ErrorCodeHandler.getMessage( msgCode ) );
|
||||
return strBuff.toString();
|
||||
}
|
||||
|
||||
public static String getDebugMessage(String msgCode, String[] params) {
|
||||
StringBuffer strBuff = new StringBuffer();
|
||||
strBuff.append( ErrorCodeHandler.getMessage( msgCode, params ) );
|
||||
return ErrorCodeHandler.getMessage( msgCode, params );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.eactive.eai.common.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.2 $
|
||||
*/
|
||||
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 Constant JBOSS. */
|
||||
public static final int JBOSS = 9;
|
||||
|
||||
/** 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("weblogic.Name");
|
||||
String tomcat = System.getProperty("catalina.home");
|
||||
String jeus = System.getProperty("jeus.home");
|
||||
String jboss = System.getProperty("program.name");
|
||||
String websphere = System.getProperty("ibm.websphere.internalClassAccessMode");
|
||||
|
||||
if (tomcat != null && !tomcat.trim().equals("")) {
|
||||
result = TOMCAT;
|
||||
} else if (weblogic != null && !weblogic.trim().equals("")) {
|
||||
result = WEBLOGIC;
|
||||
} else if (jeus != null && !jeus.trim().equals("")) {
|
||||
result = JEUS;
|
||||
} else if (jboss != null && jboss.startsWith("JBossTools")) {
|
||||
result = JBOSS;
|
||||
} else if (websphere != null && !websphere.trim().equals("")) {
|
||||
result = WEBSPHERE;
|
||||
} 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(JBOSS), "JBOSS");
|
||||
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;
|
||||
}
|
||||
public static String getInstanceName(){
|
||||
switch(result) {
|
||||
case TOMCAT :
|
||||
case WEBLOGIC :
|
||||
case JEUS :
|
||||
case WEBSPHERE :
|
||||
case JBOSS :
|
||||
case UNKNOWN :
|
||||
return System.getProperty(Keys.SERVER_KEY);
|
||||
default :
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,355 @@
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.TemporalField;
|
||||
import java.time.temporal.WeekFields;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Date, Time 관련 Utility Method 정의
|
||||
* 2. 처리 개요 :
|
||||
*
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see :
|
||||
* @since :
|
||||
*/
|
||||
public final class DatetimeUtil {
|
||||
|
||||
|
||||
private static final DateTimeFormatter SDF_YYMMDDHHMMSS = DateTimeFormatter.ofPattern( "yyMMddHHmmss");
|
||||
// private static final DateTimeFormatter SDF_YYYY = DateTimeFormatter.ofPattern( "yyyy");
|
||||
// private static final DateTimeFormatter SDF_YYYYMM = DateTimeFormatter.ofPattern( "yyyyMM");
|
||||
private static final DateTimeFormatter SDF_YYYYMMDD = DateTimeFormatter.ofPattern( "yyyyMMdd");
|
||||
// private static final DateTimeFormatter SDF_YYYYMMDD_DASH = DateTimeFormatter.ofPattern( "yyyy-MM-dd");
|
||||
// private static final DateTimeFormatter SDF_YYYYMMDD_SLASH = DateTimeFormatter.ofPattern( "yyyy/MM/dd");
|
||||
// private static final DateTimeFormatter SDF_YYYYMMDD_DOT = DateTimeFormatter.ofPattern( "yyyy.MM.dd");
|
||||
// private static final DateTimeFormatter SDF_YYYYMMDDHHMM = DateTimeFormatter.ofPattern( "yyyyMMddHHmm");
|
||||
private static final DateTimeFormatter SDF_YYYYMMDDHHMMSS = DateTimeFormatter.ofPattern( "yyyyMMddHHmmss");
|
||||
// private static final DateTimeFormatter SDF_YYYYMMDDHHMMM_DASH_DOT = DateTimeFormatter.ofPattern( "yyyy-MM-dd hh:mm a");
|
||||
// private static final DateTimeFormatter SDF_YYYYMMDDHHMMSS_NO_MARK = DateTimeFormatter.ofPattern( "yyyyMMddHHmmss");
|
||||
// private static final DateTimeFormatter SDF_YYYYMMDDHHMMSSM_DASH_DOT = DateTimeFormatter.ofPattern( "yyyy-MM-dd hh:mm:ss a");
|
||||
private static final DateTimeFormatter SDF_YYYYMMDDHHMMSSM_DASH = DateTimeFormatter.ofPattern( "yyyy-MM-dd HH:mm:ss");
|
||||
private static final DateTimeFormatter SDF_YYYYMMDDHHMMSSMS_NO_MARK = DateTimeFormatter.ofPattern( "yyyyMMddHHmmssSSS" );
|
||||
private static final DateTimeFormatter SDF_HHMMSS_NO_MARK = DateTimeFormatter.ofPattern( "HHmmss" );
|
||||
// private static final DateTimeFormatter SDF_HHMMSSMS_CEMI_COL = DateTimeFormatter.ofPattern( "HH:mm:ss.SSS" );
|
||||
private static final DateTimeFormatter SDF_YYYYMMDDHHMMSSMS_DASH_CEMI_COL = DateTimeFormatter.ofPattern( "yyyy-MM-dd HH:mm:ss.SSS" );
|
||||
private static final DateTimeFormatter SDF_YYYYMMDDHHMMSSSS_NO_MARK = DateTimeFormatter.ofPattern( "yyyyMMddHHmmssSSS" );
|
||||
private static final DateTimeFormatter SDF_HHMMSSSS_NO_MARK = DateTimeFormatter.ofPattern( "HHmmssSSS" );
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Private 생성자
|
||||
* Instance를 생성하지 못함
|
||||
*/
|
||||
private DatetimeUtil()
|
||||
{
|
||||
|
||||
}
|
||||
private static ZonedDateTime get(){
|
||||
return ZonedDateTime.now();
|
||||
}
|
||||
|
||||
private static ZonedDateTime get(long time){
|
||||
Instant instant = Instant.ofEpochMilli(time);
|
||||
return ZonedDateTime.ofInstant(instant, ZoneId.systemDefault());
|
||||
}
|
||||
private static ZonedDateTime get(Date date){
|
||||
return ZonedDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
|
||||
}
|
||||
/**
|
||||
* 1. 기능 : 현재시간을 yyyyMMddHHmmssSS 형태로 변환
|
||||
* 2. 처리 개요 :
|
||||
* - currentmilisec 를 입력받아 yyyyMMddHHmmssSS 형태로 변환한다.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param timeLong 현재시간 Long
|
||||
* @return String
|
||||
* @exception
|
||||
**/
|
||||
|
||||
public static String getCurrentTime(long timeLong)
|
||||
{
|
||||
return SDF_YYYYMMDDHHMMSSMS_NO_MARK.format(get(timeLong));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : 현재시간 스트링을 YYYYMMDDHHMMSSsss 형식으로 1/1000초까지 얻을 수 있는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - 현재시간을 yyyyMMddHHmmssSS 형태로 변환한다.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @return 1/1000까지 표시한 현재 시간 스트링(예: 20040920162110999)
|
||||
* @exception
|
||||
**/
|
||||
|
||||
public static java.lang.String getCurrentTimeMillis() { // 1/1000 sec.
|
||||
return (SDF_YYYYMMDDHHMMSSMS_NO_MARK).format(get());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : 현재날짜 스트링을 YYYYMMDD 형식으로 얻는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - 현재시간을 yyyyMMddHHmmssSS 형태로 변환한다.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @return 년월만 표시한 현재 날짜 스트링(예: 20040920)
|
||||
* @exception
|
||||
**/
|
||||
public static java.lang.String getCurrentDate() {
|
||||
return (SDF_YYYYMMDD).format(get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 현재시간을 시분초 형식의 스트링으로 얻는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - 현재시간을 yyyyMMddHHmmssSS 형태로 변환한다.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @return 시분초만 표시한 현재 시간 스트링(예: 162027)
|
||||
* @exception
|
||||
**/
|
||||
public static java.lang.String getCurrentTime() {
|
||||
return (SDF_HHMMSS_NO_MARK).format(get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 현재 날짜시간 스트링을 년월일시분초로 가져오는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - 현재 날짜시간 스트링을 년월일시분초로 가져오는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @return 년월일시분초 시간 스트링(예: 20040921194425)
|
||||
* @exception
|
||||
**/
|
||||
public static java.lang.String getCurrentDateTime() {
|
||||
return (SDF_YYYYMMDDHHMMSS).format(get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 형식화된 Date 문자열 리턴하는 메서드
|
||||
* 2. 처리 개요 :
|
||||
* - format은 "YYYYMMDD" 등 자바에서 지원하는 date format을 사용.format의 길이만큼 잘라서 리턴함.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param format "YYYY-MM-DD HH:mm:ss.SSS", SSS는 밀리세컨드 단위
|
||||
* @param day 변환 대상 일자
|
||||
* @return 형식화된 date 문자열
|
||||
* @exception
|
||||
**/
|
||||
public static String getFormattedDate( String format, java.util.Date day )
|
||||
{
|
||||
if ( day == null || format == null )
|
||||
return "";
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);
|
||||
|
||||
String result = formatter.format(get(day));
|
||||
if ( result.length() > format.length() )
|
||||
result = result.substring( 0, format.length() );
|
||||
return result;
|
||||
}
|
||||
public static String getFormattedDate( String format )
|
||||
{
|
||||
if ( format == null )
|
||||
return "";
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);
|
||||
|
||||
String result = formatter.format(get());
|
||||
if ( result.length() > format.length() )
|
||||
result = result.substring( 0, format.length() );
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 현재 요일을 숫자로 리턴하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - 현재 요일을 숫자로 리턴하는 Method
|
||||
* 3. 주의사항
|
||||
* Calander dayofweek
|
||||
* 일(1),월(2),화(3),수(4),목(5),금(6),토(7)
|
||||
*
|
||||
*
|
||||
* @return 현재 요일 숫자
|
||||
* @exception
|
||||
**/
|
||||
public static int getDayOfWeekNum() {
|
||||
TemporalField filedISO = WeekFields.of(Locale.KOREA).dayOfWeek();
|
||||
return get().getDayOfWeek().get(filedISO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 현재 요일을 숫자로 리턴하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - 현재 요일을 숫자로 리턴하는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @return 현재 요일 숫자
|
||||
* @exception
|
||||
**/
|
||||
public static int getDayOfWeekNum(long time) {
|
||||
ZonedDateTime zdt = get(time);
|
||||
TemporalField filedISO = WeekFields.of(Locale.KOREA).dayOfWeek();
|
||||
return zdt.getDayOfWeek().get(filedISO);
|
||||
}
|
||||
|
||||
public static String getCurrentTime12()
|
||||
{
|
||||
return SDF_YYMMDDHHMMSS.format(get());
|
||||
}
|
||||
|
||||
public static String getDate8()
|
||||
{
|
||||
return SDF_YYYYMMDD.format(get());
|
||||
}
|
||||
|
||||
public static String getTime6()
|
||||
{
|
||||
return SDF_HHMMSS_NO_MARK.format(get());
|
||||
}
|
||||
public static String getTime8()
|
||||
{
|
||||
return SDF_HHMMSSSS_NO_MARK.format(get()).substring(0,8);
|
||||
}
|
||||
public static String getDate(int ai_day) {
|
||||
return SDF_YYYYMMDD.format(get().plusDays(ai_day));
|
||||
}
|
||||
public static String getTimeStampString() {
|
||||
return SDF_YYYYMMDDHHMMSSM_DASH.format(get());
|
||||
}
|
||||
public static boolean isDateValue(String srcValue) {
|
||||
try {
|
||||
SDF_YYYYMMDD.parse(srcValue);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isTimeValue(String srcValue) {
|
||||
try {
|
||||
SDF_HHMMSS_NO_MARK.parse(srcValue);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static long getLongTime(String yyyyMMddHHmmssSSS){
|
||||
LocalDateTime zdt = LocalDateTime.parse(yyyyMMddHHmmssSSS, SDF_YYYYMMDDHHMMSSMS_NO_MARK);
|
||||
return zdt.toInstant(OffsetDateTime.now().getOffset()).toEpochMilli();
|
||||
}
|
||||
public static long getLongTimeFormat(String format, String dateString ){
|
||||
LocalDateTime zdt = LocalDateTime.parse(dateString, DateTimeFormatter.ofPattern( format));
|
||||
return zdt.toInstant(OffsetDateTime.now().getOffset()).toEpochMilli();
|
||||
}
|
||||
// private static long getTimeMiliDiff(String inptMsgWritYms, long logTime) {
|
||||
//
|
||||
// long milisecsDiff = 0;
|
||||
// String dateStr = "";
|
||||
//
|
||||
// DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
|
||||
//
|
||||
// try {
|
||||
// if(inptMsgWritYms!= null && inptMsgWritYms.length() >= 17) {
|
||||
// dateStr = inptMsgWritYms.substring(0,17);
|
||||
// }
|
||||
// else {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// LocalDateTime zdt = LocalDateTime.parse(dateStr,fmt);
|
||||
// long time = zdt.toInstant(OffsetDateTime.now().getOffset()).toEpochMilli();
|
||||
//
|
||||
// milisecsDiff = (logTime - time);
|
||||
// }
|
||||
// catch(Exception e) {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// return milisecsDiff;
|
||||
// }
|
||||
public static String getDate(String startDate, int days) throws Exception {
|
||||
|
||||
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
ZonedDateTime zdt = LocalDate.parse(startDate, fmt).plusDays(days).atStartOfDay(ZoneId.systemDefault());
|
||||
return fmt.format(zdt);
|
||||
}
|
||||
|
||||
public static String getCurrentTimeDash(long timeLong){
|
||||
Instant instant = Instant.ofEpochMilli(timeLong);
|
||||
ZonedDateTime zdt = ZonedDateTime.ofInstant(instant, ZoneId.systemDefault());
|
||||
return SDF_YYYYMMDDHHMMSSM_DASH.format(zdt);
|
||||
}
|
||||
|
||||
public static String getCurrentTimeMs(long timeLong){
|
||||
Instant instant = Instant.ofEpochMilli(timeLong);
|
||||
ZonedDateTime zdt = ZonedDateTime.ofInstant(instant, ZoneId.systemDefault());
|
||||
return SDF_YYYYMMDDHHMMSSMS_DASH_CEMI_COL.format(zdt);
|
||||
}
|
||||
|
||||
public static String getCurrentTimeMsNoMark(long timeLong){
|
||||
Instant instant = Instant.ofEpochMilli(timeLong);
|
||||
ZonedDateTime zdt = ZonedDateTime.ofInstant(instant, ZoneId.systemDefault());
|
||||
return SDF_YYYYMMDDHHMMSSSS_NO_MARK.format(zdt);
|
||||
}
|
||||
|
||||
// public static void main(String args[]) throws Exception {
|
||||
// test(String args[]);
|
||||
//}
|
||||
|
||||
//private static void test(String args[]) throws Exception {
|
||||
//
|
||||
//
|
||||
// System.out.println("getCurrentTime = " + getCurrentTime(new Date().getTime()));
|
||||
// System.out.println("getCurrentTimeMillis = "+ getCurrentTimeMillis());
|
||||
// System.out.println("getCurrentDate = " + getCurrentDate());
|
||||
// System.out.println("getCurrentTime = " + getCurrentTime());
|
||||
// System.out.println("getCurrentDateTime = " + getCurrentDateTime());
|
||||
// System.out.println("getDayOfWeekNum = " + getDayOfWeekNum());
|
||||
// System.out.println("getDayOfWeekNum = " + getDayOfWeekNum(new Date().getTime()));
|
||||
// System.out.println("getFormattedDate = " + getFormattedDate("yyyyMMddHHmmssSSS",new Date()));
|
||||
//
|
||||
//// System.out.println("일="+getDayOfWeekNum("yyyyMMdd","20190602"));
|
||||
//// System.out.println("월="+getDayOfWeekNum("yyyyMMdd","20190603"));
|
||||
//// System.out.println("화="+getDayOfWeekNum("yyyyMMdd","20190604"));
|
||||
//// System.out.println("수="+getDayOfWeekNum("yyyyMMdd","20190605"));
|
||||
//// System.out.println("목="+getDayOfWeekNum("yyyyMMdd","20190606"));
|
||||
//// System.out.println("금="+getDayOfWeekNum("yyyyMMdd","20190607"));
|
||||
//// System.out.println("토="+getDayOfWeekNum("yyyyMMdd","20190608"));
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// System.out.println(getCurrentTime12());
|
||||
// System.out.println(getDate8());
|
||||
// System.out.println(getTime6());
|
||||
// System.out.println(getDate(1));
|
||||
// System.out.println(getTimeStampString());
|
||||
// System.out.println("isDateValue = " + isDateValue("20190602"));
|
||||
// System.out.println("isDateValue = " + isDateValue("20191302"));
|
||||
// System.out.println("isTimeValue = " + isTimeValue("121230"));
|
||||
// System.out.println("isTimeValue = " + isTimeValue("126130"));
|
||||
//
|
||||
// Date date = new Date();
|
||||
// System.out.println("getLongTime="+getLongTime(getFormattedDate("yyyyMMddHHmmssSSS",date)));
|
||||
// System.out.println("getLongTime="+date.getTime());
|
||||
//
|
||||
// System.out.println(getFormattedDate("yyyyMMdd",date));
|
||||
// System.out.println(getFormattedDate("HHmmss",date));
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
/**
|
||||
* 1. 기능 : logback 환경을 위한 상수를 정의한 interface
|
||||
* 2. 처리 개요 :
|
||||
*
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see :
|
||||
* @since :
|
||||
*/
|
||||
|
||||
public interface LogKeys
|
||||
{
|
||||
public static final String LOGGER_INFO ="FileLoggerInfo";
|
||||
|
||||
// File Appender
|
||||
public static final String APPENDER_DEFAULT ="FileAppender{DEFAULT}";
|
||||
public static final String APPENDER_SMS ="FileAppender{SMS}";
|
||||
public static final String APPENDER_SIFT ="FileAppender{SIFT}";
|
||||
|
||||
// Logger
|
||||
public static final String LOGGER_DEFAULT_PREFIX ="FileLogger{DEFAULT}";
|
||||
public static final String LOGGER_ESBFW_PREFIX ="FileLogger{ESBFW}";
|
||||
public static final String LOGGER_ADAPTER_PREFIX ="FileLogger{ADAPTER}";
|
||||
public static final String LOGGER_SMS_PREFIX ="FileLogger{SMS}";
|
||||
public static final String LOGGER_TRAN_PREFIX ="FileLogger{TRAN}";
|
||||
public static final String LOGGER_NET_PREFIX ="FileLogger{NET}";
|
||||
public static final String LOGGER_CLIENT_PREFIX ="FileLogger{CLIENT}";
|
||||
public static final String LOGGER_ROOT_PREFIX ="FileLogger{ROOT}";
|
||||
public static final String LOGGER_SIFT_PREFIX ="FileLogger{SIFT}";
|
||||
|
||||
public static final String LOG_DIRECOTRY_PREFIX ="log.directory.prefix";
|
||||
public static final String LOG_DIRECOTRY_SUB ="log.directory.sub";
|
||||
public static final String PATTERN_LAYOUT ="pattern.layout";
|
||||
public static final String LOGGER_LIST ="logger.list";
|
||||
public static final String APPENDER_LIST ="appender.list";
|
||||
|
||||
public static final String ECS_SERVICENAME = "ecs.service.name";
|
||||
public static final String ECS_CONFIG = "elastic.apm.config_file";
|
||||
/**
|
||||
* FileAppender
|
||||
*/
|
||||
public static final String LOG_FILE ="log.file";
|
||||
public static final String DATE_PATTERN ="date.pattern";
|
||||
public static final String APPEND ="append";
|
||||
public static final String MAX_BACKUP_INDEX ="max.backup.index";
|
||||
public static final String ENCODING ="encoding";
|
||||
public static final String COMPRESS_EXT ="compress.ext";
|
||||
|
||||
public static final String ADITIVITY ="aditivity";
|
||||
public static final String LOG_LEVEL ="log.level";
|
||||
public static final String CONSOLE ="console";
|
||||
public static final String APPENDER ="appender";
|
||||
public static final String SMS_INTERVAL = "sms.interval.mi"; // sms logging interval(minute)
|
||||
|
||||
public static final String CONSOLE_APPENDER = "Appender{CONSOLE}";
|
||||
|
||||
public static final String LOG_ON = "on";
|
||||
public static final String LOG_OFF = "off";
|
||||
|
||||
public static final String TRACE = "trace";
|
||||
public static final String DEBUG = "debug";
|
||||
public static final String INFO = "info";
|
||||
public static final String WARN = "warn";
|
||||
public static final String ERROR = "error";
|
||||
public static final String FATAL = "fatal";
|
||||
|
||||
public static final String DISCRIMINATOR = "discriminator";
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,80 @@
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Date, Time 관련 Utility Method 정의
|
||||
* 2. 처리 개요 :
|
||||
*
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see :
|
||||
* @since :
|
||||
*/
|
||||
public final class NullControl {
|
||||
|
||||
|
||||
/**
|
||||
* Private 생성자
|
||||
* Instance를 생성하지 못함
|
||||
*/
|
||||
private NullControl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Null값을 공백으로 변경
|
||||
* 2. 처리 개요 :
|
||||
* - ""나 Null를 입력받아 SPACE로 변환한다.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param "", Null
|
||||
* @return String
|
||||
* @exception
|
||||
**/
|
||||
public static String addSpace(String val)
|
||||
{
|
||||
if(val == null || val.equals("")){
|
||||
val = " ";
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 입력값을 트림하여 화이트스페이스를 없앤다.
|
||||
* 2. 처리 개요 :
|
||||
* - 입력받은 값을 트림하여 리턴한다.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param "", Null
|
||||
* @return String
|
||||
* @exception
|
||||
**/
|
||||
|
||||
public static String trimSpace(String val)
|
||||
{
|
||||
if(val == null || val.equals("")){
|
||||
val = ""; // ""나 Null을 체크하여 트림하여 에러가 발생하지 않도록 한다..
|
||||
}else{
|
||||
val = val.trim();
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
public static String trimSpace2(String val)
|
||||
{
|
||||
if(val == null || val.equals("")){
|
||||
return ""; // ""나 Null을 체크하여 트림하여 에러가 발생하지 않도록 한다..
|
||||
}
|
||||
if (val.trim().length() > 0){
|
||||
return val;
|
||||
}
|
||||
else{
|
||||
return val.trim();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Method;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.commons.io.input.ClassLoaderObjectInputStream;
|
||||
|
||||
import com.eactive.eai.common.errorcode.ErrorCodeHandler;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Object를 처리하는 Utility Class
|
||||
* 2. 처리 개요 :
|
||||
* * -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see : org.apache.commons.beanutils.BeanUtils
|
||||
* @since :
|
||||
* :
|
||||
*/
|
||||
public class ObjectUtil
|
||||
{
|
||||
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
/**
|
||||
* 1. 기능 : Object를 Copy하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - Object를 Copy하는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param input Object
|
||||
* @return Object
|
||||
* @exception
|
||||
**/
|
||||
public static Object deepCopy(Object input) throws IOException {
|
||||
byte[] buff = marshall(input);
|
||||
return unmarshall(buff);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Object를 byte[]로 marshall
|
||||
* 2. 처리 개요 :
|
||||
* - Object를 byte[]로 marshall
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param input Object
|
||||
* @return byte[]
|
||||
* @exception
|
||||
**/
|
||||
public static byte[] marshall(Object input) throws IOException {
|
||||
if(! (input instanceof Serializable) ) {
|
||||
//throw new IOException("ObjectUtil] Marshall Error. Invalid Object Type. - "+input);
|
||||
throw new IOException("RECEAICUL010");
|
||||
}
|
||||
|
||||
ByteArrayOutputStream bos = null;
|
||||
ObjectOutputStream oos = null;
|
||||
try {
|
||||
bos = new ByteArrayOutputStream();
|
||||
oos = new ObjectOutputStream(bos);
|
||||
oos.writeObject((Serializable)input);
|
||||
return bos.toByteArray();
|
||||
} catch(IOException e) {
|
||||
//throw new IOException("ObjectUtil] Marshall Error. - "+e.getMessage());
|
||||
//throw new IOException("RECEAICUL011");
|
||||
throw new IOException(ExceptionUtil.getErrorCode(e,"RECEAICUL011"));
|
||||
} finally {
|
||||
try { if(oos!=null) oos.close(); } catch(Exception e) {}
|
||||
try { if(bos!=null) bos.close(); } catch(Exception e) {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : byte[]를 Object로 unmarshall
|
||||
* 2. 처리 개요 :
|
||||
* - byte[]를 Object로 unmarshall
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param input byte[]
|
||||
* @return Object
|
||||
* @exception
|
||||
**/
|
||||
public static Object unmarshall(byte[] input) throws IOException {
|
||||
ByteArrayInputStream bis = null;
|
||||
ObjectInputStream ois = null;
|
||||
try {
|
||||
bis = new ByteArrayInputStream(input);
|
||||
/* 20210727
|
||||
* ObjectInputStream의 기본 class loader는 Spring Loaded의 classloader에서 로딩한 클래스 목록이 없어 다음과 같은 오류 발생
|
||||
* java.lang.ClassNotFoundException: com.eactive.eai.common.message.ServiceMessage
|
||||
* Windows일 경우에만 ClassLoaderObjectInputStream 사용하도록 함
|
||||
* TODO isWindows의 경우 로컬 개발이라는 명확한 설정인자가 될 수 없음
|
||||
* 추후 로컬 개발이라는 명확한 인자로 변경 요망(tomcat으로 변경)
|
||||
*/
|
||||
// if (Env.isWindows()){
|
||||
if (ContainerUtil.get() == ContainerUtil.TOMCAT){
|
||||
ois = new ClassLoaderObjectInputStream(ObjectUtil.class.getClassLoader(), bis);
|
||||
}else{
|
||||
ois = new ObjectInputStream(bis);
|
||||
}
|
||||
return ois.readObject();
|
||||
} catch(Exception e) {
|
||||
//throw new IOException("ObjectUtil] Unmarshall Error. - "+e.getMessage());
|
||||
//throw new IOException("RECEAICUL012");
|
||||
logger.error("unmarshall error", e);
|
||||
// e.printStackTrace();
|
||||
throw new IOException(ExceptionUtil.getErrorCode(e,"RECEAICUL012"));
|
||||
} finally {
|
||||
try { if(ois!=null) ois.close(); } catch(Exception e) {}
|
||||
try { if(bis!=null) bis.close(); } catch(Exception e) {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : ValueObject형태의 Object의 어트리뷰트(변수)의 값을 추출
|
||||
* 2. 처리 개요 :
|
||||
* - ValueObject형태의 Object의 어트리뷰트(변수)의 값을 추출
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param valueObject
|
||||
* @param varName 변수명
|
||||
* @return Object
|
||||
* @exception
|
||||
**/
|
||||
public static Object getProperty(Object valueObject, String varName) {
|
||||
try {
|
||||
return BeanUtils.getProperty(valueObject, varName);
|
||||
} catch(Exception e) {
|
||||
String msg = ErrorCodeHandler.getMessage("RWCEAICUL013", new String[]{varName, e.getMessage()});
|
||||
if (logger.isWarn()) logger.warn(ExceptionUtil.make("RWCEAICUL013", msg));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
//import com.penta.scpdb.ScpDbAgent;
|
||||
|
||||
/**
|
||||
* 1. 기능 : 암호화 모듈 Utility 제공
|
||||
* 2. 처리 개요 :
|
||||
* - 보안관련 메소드 구현
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see :
|
||||
* @since :
|
||||
* :
|
||||
*/
|
||||
/**
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public final class ScpDbAgentUtil {
|
||||
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
public static String EXT_MODULE = "EXT_MODULE";
|
||||
/**
|
||||
* Private 생성자
|
||||
* Instance를 생성하지 못함
|
||||
*/
|
||||
private ScpDbAgentUtil()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* ScpEncB64 암호화
|
||||
*
|
||||
* @param sInvalid
|
||||
* @return
|
||||
*/
|
||||
public static String ScpEncB64(Properties p, String data, String encode) {
|
||||
String path = p.getProperty("SCP_PATH", "/fsscp/pav/eai/agent0001/scpdb_agent_unix.ini");
|
||||
String key = p.getProperty("SCP_KEY" , "SEC");
|
||||
try {
|
||||
// return new ScpDbAgent().ScpEncB64(path, key, data, encode);
|
||||
} catch (Exception e) {
|
||||
logger.error("ScpDbAgentUtil] scpdb_agent encryption Error - " + e.getMessage());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
public static String ScpDecB64(Properties p, String data, String encode) {
|
||||
String path = p.getProperty("SCP_PATH", "/fsscp/pav/eai/agent0001/scpdb_agent_unix.ini");
|
||||
String key = p.getProperty("SCP_KEY" , "SEC");
|
||||
try {
|
||||
// return new ScpDbAgent().ScpDecB64(path, key, data, encode);
|
||||
} catch (Exception e) {
|
||||
logger.error("ScpDbAgentUtil] scpdb_agent decryption Error - " + e.getMessage());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
// public static void test() throws Exception{
|
||||
//
|
||||
// Properties p = new Properties();
|
||||
// p.put("SCP_PATH", "C:\\BASCP\\scpdb_agent.ini");
|
||||
// p.put("SCP_KEY" , "SEC");
|
||||
// String r =ScpDbAgentUtil.ScpEncB64(p,"abc1111111111111","EUC-KR");
|
||||
// System.out.println(r);
|
||||
// }
|
||||
|
||||
// public static void main(String[] args) throws Exception{
|
||||
// test();
|
||||
//}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NamingException;
|
||||
import javax.sql.DataSource;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
|
||||
public class ServiceLocator {
|
||||
/** Eai Logger */
|
||||
static private Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
/** javax.transaction.UserTransaction */
|
||||
final static String USER_TRANSACTION = "javax.transaction.UserTransaction";
|
||||
/** weblogic.common.T3Services */
|
||||
final static String WEBLOGIC_T3_SERVICES = "weblogic.common.T3Services";
|
||||
/** weblogic.jndi.WLInitialContextFactory */
|
||||
final static String WEBLOGIC_INITIAL_CONTEXT_FACTORY = "weblogic.jndi.WLInitialContextFactory";
|
||||
/** WebLogic t3 url */
|
||||
// protected static String WEBLOGIC_T3_URL;
|
||||
|
||||
/** ServiceLocator singleton object */
|
||||
private static ServiceLocator instance;
|
||||
|
||||
/** JNDI Context object */
|
||||
private InitialContext initial;
|
||||
|
||||
/** caching을 위한 collection object */
|
||||
private Map cache;
|
||||
|
||||
protected ServiceLocator() throws ServiceLocatorException {
|
||||
try {
|
||||
initial = new InitialContext();
|
||||
cache = Collections.synchronizedMap(new HashMap());
|
||||
} catch (NamingException e) {
|
||||
throw new ServiceLocatorException(ExceptionUtil.getErrorCode(e, "RECEAICUL101"));
|
||||
} catch (Exception e) {
|
||||
throw new ServiceLocatorException(ExceptionUtil.getErrorCode(e, "RECEAICUL102"));
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized ServiceLocator getInstance() throws ServiceLocatorException {
|
||||
if (instance == null) {
|
||||
instance = new ServiceLocator();
|
||||
return instance;
|
||||
} else {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public DataSource getDataSource(String dataSourceName) throws ServiceLocatorException {
|
||||
DataSource dataSource = null;
|
||||
|
||||
try {
|
||||
if (cache.containsKey(dataSourceName)) {
|
||||
dataSource = (DataSource) cache.get(dataSourceName);
|
||||
} else {
|
||||
String jndiName = dataSourceName;
|
||||
if (ContainerUtil.get() == ContainerUtil.TOMCAT) {
|
||||
jndiName = "java:comp/env/" + jndiName;
|
||||
}
|
||||
dataSource = (DataSource) initial.lookup(jndiName);
|
||||
cache.put(dataSourceName, dataSource);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ServiceLocatorException(ExceptionUtil.getErrorCode(e, "RECEAICUL103"));
|
||||
}
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
public void putDataSource(String dataSourceName, DataSource dataSource) {
|
||||
cache.put(dataSourceName, dataSource);
|
||||
}
|
||||
|
||||
public DataSource getRemoteDataSource(String providerUrl, String dataSourceName) {
|
||||
DataSource dataSource = null;
|
||||
try {
|
||||
if (cache.containsKey(dataSourceName)) {
|
||||
dataSource = (DataSource) cache.get(dataSourceName);
|
||||
} else {
|
||||
Hashtable env = new Hashtable();
|
||||
env.put(Context.INITIAL_CONTEXT_FACTORY, WEBLOGIC_INITIAL_CONTEXT_FACTORY);
|
||||
env.put(Context.PROVIDER_URL, providerUrl);
|
||||
initial = new InitialContext(env);
|
||||
|
||||
dataSource = (DataSource) initial.lookup(dataSourceName);
|
||||
|
||||
cache.put(dataSourceName, dataSource);
|
||||
}
|
||||
return dataSource;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(ExceptionUtil.getErrorCode(e, "RECEAICUL104"));
|
||||
}
|
||||
}
|
||||
|
||||
public UserTransaction getUserTransaction() throws ServiceLocatorException {
|
||||
UserTransaction userTx = null;
|
||||
try {
|
||||
if (cache.containsKey(USER_TRANSACTION)) {
|
||||
userTx = (UserTransaction) cache.get(USER_TRANSACTION);
|
||||
} else {
|
||||
userTx = (UserTransaction) initial.lookup(USER_TRANSACTION);
|
||||
cache.put(USER_TRANSACTION, userTx);
|
||||
}
|
||||
} catch (NamingException ne) {
|
||||
throw new ServiceLocatorException(ExceptionUtil.getErrorCode(ne, "RECEAICUL107"));
|
||||
} catch (Exception e) {
|
||||
throw new ServiceLocatorException(ExceptionUtil.getErrorCode(e, "RECEAICUL108"));
|
||||
}
|
||||
return userTx;
|
||||
}
|
||||
|
||||
public URL getUrl(String envName) throws ServiceLocatorException {
|
||||
URL url = null;
|
||||
|
||||
try {
|
||||
url = (URL) initial.lookup(envName);
|
||||
} catch (NamingException ne) {
|
||||
throw new ServiceLocatorException(ExceptionUtil.getErrorCode(ne, "RECEAICUL121"));
|
||||
} catch (Exception e) {
|
||||
throw new ServiceLocatorException(ExceptionUtil.getErrorCode(e, "RECEAICUL122"));
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
public boolean getBoolean(String envName) throws ServiceLocatorException {
|
||||
Boolean bool = null;
|
||||
|
||||
try {
|
||||
bool = (Boolean) initial.lookup(envName);
|
||||
} catch (NamingException ne) {
|
||||
throw new ServiceLocatorException(ExceptionUtil.getErrorCode(ne, "RECEAICUL123"));
|
||||
} catch (Exception e) {
|
||||
throw new ServiceLocatorException(ExceptionUtil.getErrorCode(e, "RECEAICUL124"));
|
||||
}
|
||||
return bool.booleanValue();
|
||||
}
|
||||
|
||||
public String getString(String envName) throws ServiceLocatorException {
|
||||
String envEntry = null;
|
||||
|
||||
try {
|
||||
envEntry = (String) initial.lookup(envName);
|
||||
} catch (NamingException ne) {
|
||||
throw new ServiceLocatorException(ExceptionUtil.getErrorCode(ne, "RECEAICUL124"));
|
||||
} catch (Exception e) {
|
||||
throw new ServiceLocatorException(ExceptionUtil.getErrorCode(e, "RECEAICUL124"));
|
||||
}
|
||||
return envEntry;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
/**
|
||||
* ServiceLocator의 예외 처리를 위한 사용자 정의 class<br>
|
||||
*
|
||||
* @since 1.0
|
||||
* @author
|
||||
*/
|
||||
public class ServiceLocatorException extends Exception {
|
||||
/** 발생한 실재 Exception */
|
||||
private Exception exception;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Constructor
|
||||
* 2. 처리 개요 :
|
||||
* - Constructor
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param message Excetpion message
|
||||
* @param Excetpion 발생한 Exception
|
||||
*/
|
||||
public ServiceLocatorException(String message, Exception exception) {
|
||||
super(message);
|
||||
this.exception = exception;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Constructor
|
||||
* 2. 처리 개요 :
|
||||
* - Constructor
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param message Excetpion message
|
||||
*/
|
||||
public ServiceLocatorException(String message) {
|
||||
this(message, null);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Constructor
|
||||
* 2. 처리 개요 :
|
||||
* - Constructor
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param Excetpion 발생한 Exception
|
||||
*/
|
||||
public ServiceLocatorException(Exception exception) {
|
||||
this(null, exception);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 실재 발생한 Exception을 반환하는 method
|
||||
* 2. 처리 개요 :
|
||||
* - 실재 발생한 Exception을 반환하는 method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @return 실재 발생한 Exception
|
||||
*/
|
||||
public Exception getException() {
|
||||
return exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 실재 발생한 Exception을 반환하는 method
|
||||
* 2. 처리 개요 :
|
||||
* - 실재 발생한 Exception을 반환하는 method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @return 실재 발생한 Exception
|
||||
*/
|
||||
public Exception getRootCause() {
|
||||
if (exception instanceof ServiceLocatorException) {
|
||||
return ((ServiceLocatorException) exception).getRootCause();
|
||||
}
|
||||
|
||||
return (exception == null) ? this : exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 실재 발생한 Exception의 toString() method의 결과를 반환하는 method
|
||||
* 2. 처리 개요 :
|
||||
* - 실재 발생한 Exception의 toString() method의 결과를 반환하는 method
|
||||
* 3. 주의사항
|
||||
*/
|
||||
public String toString() {
|
||||
if (exception instanceof ServiceLocatorException) {
|
||||
return ((ServiceLocatorException) exception).toString();
|
||||
}
|
||||
|
||||
return (exception == null)
|
||||
? super.toString() : exception.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,669 @@
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
import java.util.Properties;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Vector;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : String 관련 Utility Class
|
||||
* 2. 처리 개요 :
|
||||
* * - Date, Time 관련 Utility Method 정의
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see : 관련 기능을 참조
|
||||
* @since :
|
||||
* :
|
||||
*/
|
||||
public final class StringUtil {
|
||||
|
||||
// DB가 UTF-8일 경우에 길이계산로직 처리를 위한 시스템설정 값
|
||||
// TheK에서는 DB utf-8을 기본값으로 한다.
|
||||
private static boolean IS_DB_UTF8 = true;
|
||||
|
||||
static {
|
||||
String decodeUTF8 = System.getProperty("db.encode.utf8", "Y");
|
||||
IS_DB_UTF8 = "Y".equalsIgnoreCase(decodeUTF8);
|
||||
}
|
||||
/**
|
||||
* Private 생성자
|
||||
* Instance를 생성하지 못함
|
||||
*/
|
||||
private StringUtil()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : byte array를 원하는 Encoding의 스트링으로 변환하는 Method
|
||||
* 2. 처리 개요 :
|
||||
*
|
||||
* 주요 Character Set( Parameter로 Name또는 Alias 입력 )
|
||||
* Name Alias Description
|
||||
* -------------------- ------------------------------------- ----------------------------
|
||||
* ANSI_X3.4-1968 ASCII, US-ASCII, IBM367, cp367 영문 ASCII
|
||||
* KS_C_5601-1987 KSC_5601 한글 완성형
|
||||
* EUC-KR csEUCKR 한글 조합형
|
||||
* ISO-2022-JP csISO2022JP 일어
|
||||
* ISO-2022-JP-2 csISO2022JP2 일어
|
||||
* GB_2312-80 csISO58GB231280 중국어
|
||||
* ISO_8859-1:1987 ISO_8859-1, ISO-8859-1, IBM819, CP819 영문 라틴1
|
||||
* UTF-8 유니코드(8비트)
|
||||
* UTF-16 유니코드(16비트)
|
||||
|
||||
* 3. 주의사항
|
||||
*
|
||||
* 참고 : http://www.iana.org/assignments/character-sets
|
||||
*
|
||||
* @param bytes 변환대상 byte array
|
||||
* @param charsetName byte array decoding용 character set
|
||||
* @return byte array를 변환한 결과 스트링
|
||||
*/
|
||||
public static java.lang.String bytes2String(byte[] bytes, String charsetName) {
|
||||
StringBuffer strBuffer = new StringBuffer(30);
|
||||
try {
|
||||
strBuffer.append(new String(bytes, charsetName));
|
||||
} catch (UnsupportedEncodingException uee) {
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return strBuffer.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : 헥사스트링(16진수)을 byte arrary로 변환하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - 헥사스트링(16진수)을 byte arrary로 변환하는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param hexStr 변환대상 16진수 스트링
|
||||
* @return 16진수 스트링을 변환한 결과 byte array
|
||||
*/
|
||||
public static byte[] hex2Bytes(String hexStr) {
|
||||
byte retByte[] = new byte[hexStr.length() / 2];
|
||||
for(int j = 0; j < retByte.length; j++)
|
||||
retByte[j] = (byte)Integer.parseInt(hexStr.substring(2 * j, 2 * j + 2), 16);
|
||||
return retByte;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : byte arrary를 헥사스트링(16진수)으로 변환하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - byte arrary를 헥사스트링(16진수)으로 변환하는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param inBytes 변환대상 byte array
|
||||
* @return byte array를 변환한 16진수 결과 스트링
|
||||
*/
|
||||
public static String bytes2Hex(byte inBytes[]) {
|
||||
String s = "";
|
||||
for(int i = 0; i < inBytes.length; i++)
|
||||
s = s + Integer.toHexString((inBytes[i] & 0xf0) >> 4) + Integer.toHexString(inBytes[i] & 0xf);
|
||||
|
||||
return s.toUpperCase();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : String을 헥사스트링(16진수)으로 변환하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - String을 헥사스트링(16진수)으로 변환하는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param inStr 변환대상 스트링
|
||||
* @return 변환대상스트링을 변환한 16진수 결과 스트링
|
||||
*/
|
||||
public static String str2Hex(String inStr) {
|
||||
if ( inStr == null || inStr.equals("") )
|
||||
{
|
||||
return "";
|
||||
}
|
||||
String retStr = bytes2Hex( inStr.getBytes() );
|
||||
return retStr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : 스트링에서 특정 문자 개수를 반환하는 Method(제어문자등이 전송중 누락되었는지 확인할 때 사용)
|
||||
* 2. 처리 개요 :
|
||||
* - 스트링에서 특정 문자 개수를 반환하는 Method(제어문자등이 전송중 누락되었는지 확인할 때 사용)
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param inStr 계수대상 스트링
|
||||
* @param ch 계수할 문자
|
||||
* @return int 계수결과(문자개수)
|
||||
*/
|
||||
public static int getCharCount(String inStr, char ch) {
|
||||
char[] arrChar = inStr.toCharArray();
|
||||
int count = 0;
|
||||
for (int i=0; i < arrChar.length ; i++)
|
||||
if ( arrChar[i] == ch) count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : 구분자가 들어간 스트링을 구분자기준으로 잘라 String Array를 만들어주는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - 구분자가 들어간 스트링을 구분자기준으로 잘라 String Array를 만들어주는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param inStr 대상 스트링
|
||||
* @param delim 잘라낼 때의 기준 구분자
|
||||
* @return 잘라낸 스트링을 담고 있는 String Array
|
||||
*/
|
||||
public static String[] getStrArray(String inStr, String delim) {
|
||||
String[] retStr = null;
|
||||
|
||||
if ( inStr == null || inStr.equals("") ) {
|
||||
return (new String[] {});
|
||||
} else {
|
||||
retStr = inStr.split(delim);
|
||||
}
|
||||
|
||||
return retStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : String 이 null 이면 ""(Null String)을 리턴하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - String 이 null 이면 ""(Null String)을 리턴하는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param inStr 입력 스트링
|
||||
* @return Null 처리된 스트링
|
||||
*/
|
||||
public static String getNullStr( String inStr )
|
||||
{
|
||||
return inStr==null?"":inStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Object가 null 이면 ""(Null String)을 리턴하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - Object가 null 이면 ""(Null String)을 리턴하는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param inObj 입력 Object
|
||||
* @return Null 처리된 스트링
|
||||
*/
|
||||
public static String getNullStr( Object inObj )
|
||||
{
|
||||
return inObj==null?"":(String)inObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 주어진 String값을 주어진 길이많큼 Padding/Trim한다.
|
||||
* 2. 처리 개요 :
|
||||
* - 주어진 String값을 주어진 길이많큼 Padding/Trim한다.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param svalue - 입력스트링
|
||||
* @param isRightJustify - true이면 RIGHT JUSTIFY, false이면 LEFT JUSTIFY
|
||||
* @param padding - Padding 문자
|
||||
* @param length - 리턴할 스트링의 바이트수
|
||||
* @return 포맷팅된 String결과
|
||||
*/
|
||||
public static String stringFormat(String svalue, boolean isRightJustify, char padding, int length) {
|
||||
if ( svalue == null ) return svalue;
|
||||
|
||||
String mpad = new String();
|
||||
int pLength = 0;
|
||||
|
||||
pLength = length - svalue.getBytes().length;
|
||||
|
||||
if (pLength == 0) {
|
||||
return svalue;
|
||||
}
|
||||
else if ( pLength < 0) {
|
||||
byte[] abytes = null;
|
||||
if (isRightJustify) {
|
||||
abytes = (new String( svalue.getBytes(), -(pLength), length)).getBytes();
|
||||
} else {
|
||||
abytes = (new String( svalue.getBytes(), 0, length)).getBytes();
|
||||
}
|
||||
|
||||
if ( abytes.length == length ) {
|
||||
return new String( abytes );
|
||||
} else {
|
||||
svalue = new String( abytes );
|
||||
pLength = length - svalue.length();
|
||||
}
|
||||
}
|
||||
|
||||
for(int i =0; i < pLength ; i++)
|
||||
mpad += padding;
|
||||
|
||||
if ( isRightJustify ) {
|
||||
return (mpad + svalue);
|
||||
} else {
|
||||
return (svalue + mpad);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 주어진 String값을 주어진 길이많큼 자른다.
|
||||
* 2. 처리 개요 :
|
||||
* - 주어진 String값을 주어진 길이많큼 자른다.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param svalue - 입력스트링
|
||||
* @param length - 리턴할 스트링의 바이트수
|
||||
* @return 포맷팅된 String결과와 남은 String
|
||||
*/
|
||||
public static String chunkString(String sValue, int length) {
|
||||
return chunkString(sValue, length, IS_DB_UTF8);
|
||||
}
|
||||
|
||||
public static String[] chunkStringArray(String sValue, int length) {
|
||||
return chunkStringArray(sValue, length, IS_DB_UTF8);
|
||||
}
|
||||
|
||||
public static int getBytesLength(String str) {
|
||||
return getBytesLength(str, IS_DB_UTF8);
|
||||
}
|
||||
|
||||
public static int getBytesLength(String str, boolean isDbUtf8) {
|
||||
int byteLength = 0;
|
||||
String charset = null;
|
||||
if(isDbUtf8) {
|
||||
charset = "utf-8";
|
||||
}
|
||||
else {
|
||||
charset = "ms949";
|
||||
}
|
||||
|
||||
try {
|
||||
byteLength = str.getBytes(charset).length;
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
byteLength = str.getBytes().length;
|
||||
}
|
||||
|
||||
return byteLength;
|
||||
}
|
||||
|
||||
public static String chunkString(String sValue, int length, boolean isDbUtf8) {
|
||||
String charset = "utf-8";
|
||||
|
||||
String chunk = null;
|
||||
|
||||
if(sValue == null) {
|
||||
return sValue;
|
||||
}
|
||||
if(length <= 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
byte[] bytes = null;
|
||||
int sealCharSize = 2;
|
||||
if(isDbUtf8) {
|
||||
charset = "utf-8";
|
||||
sealCharSize = 3;
|
||||
}
|
||||
else {
|
||||
charset = "ms949";
|
||||
sealCharSize = 2;
|
||||
}
|
||||
|
||||
try {
|
||||
bytes = sValue.getBytes(charset);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
bytes = sValue.getBytes();
|
||||
if(Charset.defaultCharset().equals(Charset.forName("utf-8")) ) {
|
||||
sealCharSize = 3;
|
||||
}
|
||||
}
|
||||
|
||||
if(bytes.length <= length) {
|
||||
return sValue;
|
||||
}
|
||||
|
||||
// if only simple characters
|
||||
if(bytes.length == sValue.length()) {
|
||||
return sValue.substring(0, length);
|
||||
}
|
||||
|
||||
char[] cArray = sValue.toCharArray();
|
||||
|
||||
int remainSize = length;
|
||||
|
||||
for(int i = 0; i<cArray.length; i++) {
|
||||
if(cArray[i] < 256) {
|
||||
remainSize -=1;
|
||||
}
|
||||
else {
|
||||
remainSize -= sealCharSize;
|
||||
}
|
||||
|
||||
if(remainSize ==0) {
|
||||
chunk = sValue.substring(0, i+1);
|
||||
break;
|
||||
}
|
||||
else if(remainSize < 0) {
|
||||
chunk = sValue.substring(0, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return chunk;
|
||||
}
|
||||
|
||||
public static String[] chunkStringArray(String sValue, int length, boolean isDbUtf8) {
|
||||
String charset = "utf-8";
|
||||
String[] split = new String[2];
|
||||
|
||||
if(sValue == null) {
|
||||
return split;
|
||||
}
|
||||
if(length <= 0) {
|
||||
return split;
|
||||
}
|
||||
|
||||
byte[] bytes = null;
|
||||
int sealCharSize = 2;
|
||||
if(isDbUtf8) {
|
||||
charset = "utf-8";
|
||||
sealCharSize = 3;
|
||||
}
|
||||
else {
|
||||
charset = "ms949";
|
||||
sealCharSize = 2;
|
||||
}
|
||||
|
||||
try {
|
||||
bytes = sValue.getBytes(charset);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
bytes = sValue.getBytes();
|
||||
if(Charset.defaultCharset().equals(Charset.forName("utf-8")) ) {
|
||||
sealCharSize = 3;
|
||||
}
|
||||
}
|
||||
|
||||
if(bytes.length <= length) {
|
||||
split[0] = sValue;
|
||||
split[1] = "";
|
||||
return split;
|
||||
}
|
||||
|
||||
// if only simple characters
|
||||
if(bytes.length == sValue.length()) {
|
||||
split[0] = sValue.substring(0, length);
|
||||
split[1] = sValue.substring(length);
|
||||
return split;
|
||||
}
|
||||
|
||||
char[] cArray = sValue.toCharArray();
|
||||
|
||||
int remainSize = length;
|
||||
|
||||
for(int i = 0; i<cArray.length; i++) {
|
||||
if(cArray[i] < 256) {
|
||||
remainSize -=1;
|
||||
}
|
||||
else {
|
||||
remainSize -= sealCharSize;
|
||||
}
|
||||
|
||||
if(remainSize ==0) {
|
||||
split[0] = sValue.substring(0, i+1);
|
||||
split[1] = sValue.substring(i+1);
|
||||
break;
|
||||
}
|
||||
else if(remainSize < 0) {
|
||||
split[0] = sValue.substring(0, i);
|
||||
split[1] = sValue.substring(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return split;
|
||||
}
|
||||
/**
|
||||
* 1. 기능 : 주어진 String값을 주어진 길이많큼 똑같이 잘라서 배열에 넣는다.
|
||||
* 2. 처리 개요 :
|
||||
* - 주어진 String값을 주어진 길이많큼 자른다.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param svalue - 입력스트링
|
||||
* @param length - 리턴할 스트링의 바이트수
|
||||
* @return 포맷팅된 String결과의배열
|
||||
*/
|
||||
public static String[] chunkStringTotal(String sValue, int length){
|
||||
String[] data =null;
|
||||
HashMap hm = new HashMap();
|
||||
int i = 0;
|
||||
|
||||
do {
|
||||
data = chunkStringArray(sValue, length);
|
||||
hm.put(Integer.toString(i), data[0]);
|
||||
i++;
|
||||
sValue = data[1];
|
||||
}
|
||||
while (getBytesLength(sValue) > length );
|
||||
|
||||
if (sValue.length() > 0) {
|
||||
hm.put(Integer.toString(i), sValue);
|
||||
}
|
||||
|
||||
String [] result = new String [hm.size()];
|
||||
for (int j = 0; j < hm.size(); j++) {
|
||||
result[j] = (String)hm.get(Integer.toString(j));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 주어진 String값을 delimeter로 나누어 String[]를 생성한다
|
||||
* 2. 처리 개요 :
|
||||
* - 주어진 String값을 delimeter로 나누어 String[]를 생성한다
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param input - 입력스트링
|
||||
* @param delimeter - delimeter
|
||||
* @return 포맷팅된 String결과의배열
|
||||
*/
|
||||
public static String[] stringTokenizer(String input, String delimeter)
|
||||
{
|
||||
StringTokenizer st = new StringTokenizer(input, delimeter);
|
||||
Vector vt = new Vector();
|
||||
|
||||
String temp = null;
|
||||
|
||||
while (st.hasMoreTokens()) {
|
||||
temp = st.nextToken();
|
||||
vt.addElement(temp);
|
||||
}
|
||||
|
||||
String[] out = new String[vt.size()];
|
||||
for ( int i = 0; i < vt.size() ; i ++ ) {
|
||||
out[i] = (String)vt.elementAt(i);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 주어진 String값을 delimeter로 나누어 XML Tag를 추가한다.
|
||||
* 2. 처리 개요 :
|
||||
* - 주어진 String값을 delimeter로 나누어 tag Prefix에 순차값을 생성하여 XML 형태의 String을 생성한다.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param input - 입력스트링
|
||||
* @param delimeter - delimeter
|
||||
* @param tagPrefix - tag Prefix
|
||||
* @return XML형태로 포맷팅된 String결과
|
||||
*/
|
||||
public static String delimeterToXml(String input, String delimeter, String tagPrefix)
|
||||
{
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
if(input == null || input.length() == 0) return "";
|
||||
|
||||
String[] tokens = stringTokenizer(input, delimeter);
|
||||
for(int i=0; i< tokens.length; i++) {
|
||||
sb.append("<" + tagPrefix + (i+1) + ">" + tokens[i] + "</" + tagPrefix + (i+1) + ">");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 주어진 byte[]값을 delimeter로 나누어 XML Tag를 추가한다.
|
||||
* 2. 처리 개요 :
|
||||
* - 주어진 byte[]값을 delimeter로 나누어 tag Prefix에 순차값을 생성하여 XML 형태의 byte[]을 생성한다.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param input - 입력 byte[]
|
||||
* @param delimeter - delimeter
|
||||
* @param tagPrefix - tag Prefix
|
||||
* @return XML형태로 포맷팅된 byte[]결과
|
||||
*/
|
||||
public static byte[] delimeterToXmlBytes(byte[] input, String delimeter, String tagPrefix) {
|
||||
if(input == null) return new byte[0];
|
||||
String xmlStr = delimeterToXml(new String(input), delimeter, tagPrefix);
|
||||
return xmlStr.getBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* return int DigitValue
|
||||
* use number type DB Column
|
||||
*/
|
||||
public static int getDigitValue(String input) {
|
||||
|
||||
String word = NullControl.trimSpace(input);
|
||||
if (word.length() == 0) return 0;
|
||||
|
||||
// loop for each character
|
||||
for (int i=0, n=word.length(); i<n; i++) {
|
||||
if (!Character.isDigit(word.charAt(i))) return 0;
|
||||
}
|
||||
|
||||
return Integer.parseInt(word);
|
||||
}
|
||||
|
||||
public static String toXmlStringValue(String value) {
|
||||
if(value == null) return "";
|
||||
CharBuffer cb = CharBuffer.wrap(value);
|
||||
StringBuffer sb = new StringBuffer();
|
||||
while ( cb.hasRemaining() ) {
|
||||
char tempChar = cb.get();
|
||||
|
||||
if ( tempChar == '"' ) {
|
||||
sb.append(""");
|
||||
} else if ( tempChar == '&' ) {
|
||||
sb.append("&");
|
||||
} else if ( tempChar == '\'' ) {
|
||||
sb.append("'");
|
||||
} else if ( tempChar == '<' ) {
|
||||
sb.append("<");
|
||||
} else if ( tempChar == '>' ) {
|
||||
sb.append(">");
|
||||
} else {
|
||||
sb.append(tempChar);
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String nvlTrim(String str) {
|
||||
return nvlTrim(str, "");
|
||||
}
|
||||
|
||||
public static String nvlTrim(String str, String defaultValue) {
|
||||
if (str == null || str.trim().equals("")) return defaultValue;
|
||||
return str.trim();
|
||||
}
|
||||
|
||||
|
||||
public static String makeBlankString(int size) {
|
||||
if(size <1) return "";
|
||||
StringBuilder sb = new StringBuilder(size);
|
||||
for(int i=0; i<size; i++) sb.append(" ");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private final static Pattern LTRIM = Pattern.compile("^\\s+");
|
||||
private final static Pattern RTRIM = Pattern.compile("\\s+$");
|
||||
|
||||
public static String leftTrim(String str) {
|
||||
if(str == null) return str;
|
||||
return LTRIM.matcher(str).replaceAll("");
|
||||
}
|
||||
|
||||
public static String rightTrim(String str) {
|
||||
if(str == null) return str;
|
||||
return RTRIM.matcher(str).replaceAll("");
|
||||
}
|
||||
|
||||
public static Properties getProperties(String data) {
|
||||
return getProperties(data, ",", "=");
|
||||
}
|
||||
|
||||
public static Properties getProperties(String data, String delim, String keyValueSep) {
|
||||
Properties properties = new Properties();
|
||||
if (StringUtils.isBlank(data)) {
|
||||
return properties;
|
||||
}
|
||||
|
||||
String[] propArr = org.springframework.util.StringUtils.tokenizeToStringArray(data, delim);
|
||||
if (propArr == null) {
|
||||
return properties;
|
||||
}
|
||||
|
||||
for (String prop : propArr) {
|
||||
String[] keyValue = org.springframework.util.StringUtils.tokenizeToStringArray(prop, keyValueSep);
|
||||
if (keyValue.length != 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
properties.put(keyValue[0], keyValue[1]);
|
||||
}
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] argv) {
|
||||
test(argv);
|
||||
}
|
||||
|
||||
|
||||
public static void test(String[] argv) {
|
||||
String test = "12이삼사오";
|
||||
boolean isDBUtf8 = true;
|
||||
String[] chunks = null;
|
||||
|
||||
System.out.println("\n test string:" + test);
|
||||
System.out.println("utf-8 length = " + getBytesLength(test, true));
|
||||
System.out.println("ms949 length = " + getBytesLength(test, false));
|
||||
System.out.println("\n");
|
||||
for(int len=6; len<9; len++) {
|
||||
System.out.println(String.format(">> chunk length=%d, isDBUtf8=%b",len, isDBUtf8));
|
||||
chunks = chunkStringArray(test,len,isDBUtf8);
|
||||
System.out.println("chunk = "+ chunkString(test,len,isDBUtf8));
|
||||
System.out.println("chunks[0] = "+ chunks[0]);
|
||||
System.out.println("chunks[1] = "+ chunks[1]);
|
||||
}
|
||||
|
||||
System.out.println("\n");
|
||||
isDBUtf8 = false;
|
||||
for(int len=6; len<9; len++) {
|
||||
System.out.println(String.format(">> chunk length=%d, isDBUtf8=%b",len, isDBUtf8));
|
||||
chunks = chunkStringArray(test,len,isDBUtf8);
|
||||
System.out.println("chunk = "+ chunkString(test,len,isDBUtf8));
|
||||
System.out.println("chunks[0] = "+ chunks[0]);
|
||||
System.out.println("chunks[1] = "+ chunks[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : EAI서버 Rule 정보를 DB로 부터 로딩해 메모리에 관리하는 Manager 클래스
|
||||
* 2. 처리 개요 : DB Rule 정보에 저장된 필드 추출 Rule 정보를 메모리에 로딩 관리한다.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see : 관련 기능을 참조
|
||||
* @since :
|
||||
* :
|
||||
*/
|
||||
public class SystemUtil
|
||||
{
|
||||
|
||||
private static final String EAI_SYSTEMMODE = "eai.systemmode";
|
||||
private static final String EAI_PRODUCT = "P";
|
||||
private static final String EAI_STAGING = "S";
|
||||
private static final String EAI_DEVELOP = "D";
|
||||
|
||||
//시스템 운영환경 구분코드
|
||||
private static final String SYSOPEREVIRNDSTCD_PRODUCT = "O";
|
||||
private static final String SYSOPEREVIRNDSTCD_STAGING = "S";
|
||||
private static final String SYSOPEREVIRNDSTCD_DEVELOP = "D";
|
||||
|
||||
|
||||
|
||||
public static boolean isProdServer() {
|
||||
String systemMode = System.getProperty(EAI_SYSTEMMODE);
|
||||
|
||||
if (EAI_PRODUCT.equals(systemMode)){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static boolean isDevServer() {
|
||||
String systemMode = System.getProperty(EAI_SYSTEMMODE);
|
||||
|
||||
if (EAI_DEVELOP.equals(systemMode)|| "".equals(systemMode)){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isStagingServer() {
|
||||
String systemMode = System.getProperty(EAI_SYSTEMMODE);
|
||||
|
||||
if (EAI_STAGING.equals(systemMode)){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static String getSysOperEvirnDstcd(){
|
||||
if (isProdServer()){
|
||||
return SYSOPEREVIRNDSTCD_PRODUCT;
|
||||
} else if (isStagingServer()){
|
||||
return SYSOPEREVIRNDSTCD_STAGING;
|
||||
} else if (isDevServer()){
|
||||
return SYSOPEREVIRNDSTCD_DEVELOP;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : java의 타입간의 변환을 위한 공통 Class
|
||||
* 2. 처리 개요 :
|
||||
* * -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see : 관련 기능을 참조
|
||||
* @since :
|
||||
* :
|
||||
*/
|
||||
public class TypeConversion
|
||||
{
|
||||
|
||||
/**
|
||||
* 1. 기능 : byte[]의 특정위치의 값을 short으로 변환하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - byte[]의 특정위치의 값을 short으로 변환하는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param raw byte[]
|
||||
* @param index int
|
||||
* @return short
|
||||
* @exception
|
||||
**/
|
||||
public static short parseShort(byte[] raw, int index)
|
||||
{
|
||||
byte[] buf = new byte[2];
|
||||
System.arraycopy(raw, index, buf, 0, buf.length);
|
||||
return new BigInteger(buf).shortValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : byte[]의 특정위치의 값을 int으로 변환하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - byte[]의 특정위치의 값을 int으로 변환하는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param raw byte[]
|
||||
* @param index int
|
||||
* @return int
|
||||
* @exception
|
||||
**/
|
||||
public static int parseInt(byte[] raw, int index)
|
||||
{
|
||||
byte[] buf = new byte[4];
|
||||
System.arraycopy(raw, index, buf, 0, buf.length);
|
||||
return new BigInteger(buf).intValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : byte[]의 특정위치의 값을 long으로 변환하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - byte[]의 특정위치의 값을 long으로 변환하는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param raw byte[]
|
||||
* @param index int
|
||||
* @return long
|
||||
* @exception
|
||||
**/
|
||||
public static long parseLong(byte[] raw, int index)
|
||||
{
|
||||
byte[] buf = new byte[8];
|
||||
System.arraycopy(raw, index, buf, 0, buf.length);
|
||||
return new BigInteger(buf).longValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : byte[]의 특정위치의 값을 UnsignedLong으로 변환하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - byte[]의 특정위치의 값을 UnsignedLong으로 변환하는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param raw byte[]
|
||||
* @param index int
|
||||
* @return short
|
||||
* @exception
|
||||
**/
|
||||
public static long parseUnsignedLong(byte[] raw, int index)
|
||||
{
|
||||
byte[] buf = new byte[4];
|
||||
System.arraycopy(raw, index, buf, 0, buf.length);
|
||||
return new BigInteger(buf).longValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : byte[]의 특정위치의 값을 String으로 변환하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - byte[]의 특정위치의 값을 String으로 변환하는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param raw byte[]
|
||||
* @param index int
|
||||
* @param len int
|
||||
* @return String
|
||||
* @exception
|
||||
**/
|
||||
public static String parseString(byte[] raw, int index, int len)
|
||||
{
|
||||
return new String(raw, index, len);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : byte[]의 특정위치의 값을 다른 값으로 치환하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - byte[]의 특정위치의 값을 다른 값으로 치환하는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param raw byte[]
|
||||
* @param index int
|
||||
* @param id byte[]
|
||||
* @return byte[]
|
||||
* @exception
|
||||
**/
|
||||
public static byte[] replaceChar(byte[] raw, int index, byte[] id)
|
||||
{
|
||||
raw[index] = id[0];
|
||||
raw[index+1] = id[1];
|
||||
return raw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : byte[]의 특정위치의 값을 short으로 치환하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - byte[]의 특정위치의 값을 short으로 치환하는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param raw byte[]
|
||||
* @param index int
|
||||
* @param sLL short
|
||||
* @return byte[]
|
||||
* @exception
|
||||
**/
|
||||
public static byte[] replaceShort(byte[] raw, int index, short sLL)
|
||||
{
|
||||
|
||||
//System.out.println("<TypeConversion><replaceShort(3)>RECV["+new String(raw)+"]");
|
||||
//System.out.println("<TypeConversion><replaceShort(3)>RECV Length["+raw.length+"]");
|
||||
byte[] buf = short2byte(sLL);
|
||||
//System.out.println("<TypeConversion><replaceShort(3)>RECV["+new String(buf)+"]");
|
||||
//System.out.println("<TypeConversion><replaceShort(3)>RECV Length["+buf.length+"]");
|
||||
raw[index] = buf[0];
|
||||
//System.out.println("<TypeConversion><replaceShort(3)>RECV["+new String(raw)+"]");
|
||||
//System.out.println("<TypeConversion><replaceShort(3)>RECV Length["+raw.length+"]");
|
||||
raw[index+1] = buf[1];
|
||||
//System.out.println("<TypeConversion><replaceShort(3)>RETURN["+new String(raw)+"]");
|
||||
//System.out.println("<TypeConversion><replaceShort(3)>RETURN["+raw.length+"]");
|
||||
return raw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : short를 byte[]로 변환하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - short를 byte[]로 변환하는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param s short
|
||||
* @return byte[]
|
||||
* @exception
|
||||
**/
|
||||
public static final byte[] short2byte( short s )
|
||||
{
|
||||
byte[] dest = new byte[2];
|
||||
dest[1] = (byte)(s & 0xff);
|
||||
dest[0] = (byte)((s>>8) & 0xff);
|
||||
return dest;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : int를 byte[]로 변환하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - int를 byte[]로 변환하는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param i int
|
||||
* @return byte[]
|
||||
* @exception
|
||||
**/
|
||||
public static final byte[] int2byte( int i )
|
||||
{
|
||||
byte[] dest = new byte[4];
|
||||
dest[3] = (byte)(i & 0xff);
|
||||
dest[2] = (byte)((i>>8) & 0xff);
|
||||
dest[1] = (byte)((i>>16) & 0xff);
|
||||
dest[0] = (byte)((i>>24) & 0xff);
|
||||
return dest;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : long를 byte[]로 변환하는 Method
|
||||
* 2. 처리 개요 :
|
||||
* - long를 byte[]로 변환하는 Method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param l long
|
||||
* @return byte[]
|
||||
* @exception
|
||||
**/
|
||||
public static final byte[] long2byte( long l )
|
||||
{
|
||||
byte[] dest = new byte[8];
|
||||
dest[7] = (byte)(l & 0xff);
|
||||
dest[6] = (byte)((l>>8) & 0xff);
|
||||
dest[5] = (byte)((l>>16) & 0xff);
|
||||
dest[4] = (byte)((l>>24) & 0xff);
|
||||
dest[3] = (byte)((l>>32) & 0xff);
|
||||
dest[2] = (byte)((l>>40) & 0xff);
|
||||
dest[1] = (byte)((l>>48) & 0xff);
|
||||
dest[0] = (byte)((l>>56) & 0xff);
|
||||
return dest;
|
||||
}
|
||||
/*******************************************************************
|
||||
* 테스트용 클래스.
|
||||
*/
|
||||
/*
|
||||
static public class Test
|
||||
{
|
||||
public static void main (String[] args) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
short sInit = 730;
|
||||
byte[] bytes = TypeConversion.short2byte(sInit);
|
||||
short sLL = TypeConversion.parseShort(bytes,0);
|
||||
System.out.println("-----Message Old LL : " + sLL);
|
||||
System.out.println("-----Message bytes toString : " + bytes);
|
||||
|
||||
short sNewLL = 152;
|
||||
bytes = TypeConversion.replaceShort(bytes, 0, sNewLL);
|
||||
|
||||
sNewLL = TypeConversion.parseShort(bytes,0);
|
||||
|
||||
System.out.println("-----Message New LL : " + sNewLL);
|
||||
System.out.println("-----Message bytes toString : " + bytes);
|
||||
|
||||
String strMsg = "DA F23456789012345678901234567890123456 ";
|
||||
short minusOne = -1;
|
||||
byte[] bytesMsg = strMsg.getBytes();
|
||||
bytesMsg = TypeConversion.replaceShort(bytesMsg, 47, minusOne);
|
||||
System.out.println("-----minusOne : [" + new String(bytesMsg)+"]");
|
||||
short rtnMinusOne = TypeConversion.parseShort(bytesMsg, 47);
|
||||
System.out.println("-----minusOne : [" + rtnMinusOne+"]");
|
||||
|
||||
bytesMsg = TypeConversion.replaceShort(bytesMsg, 0, sNewLL);
|
||||
System.out.println("-----minusOne : [" + new String(bytesMsg)+"]");
|
||||
|
||||
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,558 @@
|
||||
/*
|
||||
* @(#)UUID.java 1.14 04/07/12
|
||||
*
|
||||
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*/
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* A class that represents an immutable universally unique identifier (UUID). A
|
||||
* UUID represents a 128-bit value.
|
||||
*
|
||||
* <p>
|
||||
* There exist different variants of these global identifiers. The methods of
|
||||
* this class are for manipulating the Leach-Salz variant, although the
|
||||
* constructors allow the creation of any variant of UUID (described below).
|
||||
*
|
||||
* <p>
|
||||
* The layout of a variant 2 (Leach-Salz) UUID is as follows:
|
||||
*
|
||||
* The most significant long consists of the following unsigned fields:
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* 0xFFFFFFFF00000000 time_low
|
||||
* 0x00000000FFFF0000 time_mid
|
||||
* 0x000000000000F000 version
|
||||
* 0x0000000000000FFF time_hi
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* The least significant long consists of the following unsigned fields:
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* 0xC000000000000000 variant
|
||||
* 0x3FFF000000000000 clock_seq
|
||||
* 0x0000FFFFFFFFFFFF node
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* <p>
|
||||
* The variant field contains a value which identifies the layout of the
|
||||
* <tt>UUID</tt>. The bit layout described above is valid only for a
|
||||
* <tt>UUID</tt> with a variant value of 2, which indicates the Leach-Salz
|
||||
* variant.
|
||||
*
|
||||
* <p>
|
||||
* The version field holds a value that describes the type of this <tt>UUID</tt>.
|
||||
* There are four different basic types of UUIDs: time-based, DCE security,
|
||||
* name-based, and randomly generated UUIDs. These types have a version value of
|
||||
* 1, 2, 3 and 4, respectively.
|
||||
*
|
||||
* <p>
|
||||
* For more information including algorithms used to create <tt>UUID</tt>s,
|
||||
* see the Internet-Draft <a
|
||||
* href="http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-03.txt">UUIDs
|
||||
* and GUIDs </a> or the standards body definition at <a
|
||||
* href="http://www.iso.ch/cate/d2229.html">ISO/IEC 11578:1996 </a>.
|
||||
*
|
||||
* @version 1.14, 07/12/04
|
||||
* @since 1.5
|
||||
*/
|
||||
public final class UUID implements java.io.Serializable {
|
||||
/**
|
||||
* Explicit serialVersionUID for interoperability.
|
||||
*/
|
||||
private static final long serialVersionUID = -4856846361193249489L;
|
||||
|
||||
/*
|
||||
* The random number generator used by this class to create random based
|
||||
* UUIDs.
|
||||
*/
|
||||
private static volatile SecureRandom numberGenerator = null;
|
||||
|
||||
/*
|
||||
* The most significant 64 bits of this UUID.
|
||||
*
|
||||
* @serial
|
||||
*/
|
||||
private final long mostSigBits;
|
||||
|
||||
/*
|
||||
* The least significant 64 bits of this UUID.
|
||||
*
|
||||
* @serial
|
||||
*/
|
||||
private final long leastSigBits;
|
||||
|
||||
/*
|
||||
* The version number associated with this UUID. Computed on demand.
|
||||
*/
|
||||
private transient int version = -1;
|
||||
|
||||
/*
|
||||
* The variant number associated with this UUID. Computed on demand.
|
||||
*/
|
||||
private transient int variant = -1;
|
||||
|
||||
/*
|
||||
* The timestamp associated with this UUID. Computed on demand.
|
||||
*/
|
||||
private transient volatile long timestamp = -1;
|
||||
|
||||
/*
|
||||
* The clock sequence associated with this UUID. Computed on demand.
|
||||
*/
|
||||
private transient int sequence = -1;
|
||||
|
||||
/*
|
||||
* The node number associated with this UUID. Computed on demand.
|
||||
*/
|
||||
private transient long node = -1;
|
||||
|
||||
/*
|
||||
* The hashcode of this UUID. Computed on demand.
|
||||
*/
|
||||
private transient int hashCode = -1;
|
||||
|
||||
// Constructors and Factories
|
||||
|
||||
/*
|
||||
* Private constructor which uses a byte array to construct the new UUID.
|
||||
*/
|
||||
private UUID(byte[] data) {
|
||||
long msb = 0;
|
||||
long lsb = 0;
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
msb = (msb << 8) | (data[i] & 0xff);
|
||||
|
||||
for (int i = 8; i < 16; i++)
|
||||
lsb = (lsb << 8) | (data[i] & 0xff);
|
||||
|
||||
this.mostSigBits = msb;
|
||||
this.leastSigBits = lsb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <tt>UUID</tt> using the specified data.
|
||||
* <tt>mostSigBits</tt> is used for the most significant 64 bits of the
|
||||
* <tt>UUID</tt> and <tt>leastSigBits</tt> becomes the least significant
|
||||
* 64 bits of the <tt>UUID</tt>.
|
||||
*
|
||||
* @param mostSigBits
|
||||
* @param leastSigBits
|
||||
*/
|
||||
public UUID(long mostSigBits, long leastSigBits) {
|
||||
this.mostSigBits = mostSigBits;
|
||||
this.leastSigBits = leastSigBits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static factory to retrieve a type 4 (pseudo randomly generated) UUID.
|
||||
*
|
||||
* The <code>UUID</code> is generated using a cryptographically strong
|
||||
* pseudo random number generator.
|
||||
*
|
||||
* @return a randomly generated <tt>UUID</tt>.
|
||||
*/
|
||||
public static UUID randomUUID() {
|
||||
SecureRandom ng = numberGenerator;
|
||||
|
||||
if (ng == null) {
|
||||
numberGenerator = ng = new SecureRandom();
|
||||
}
|
||||
|
||||
byte[] randomBytes = new byte[16];
|
||||
ng.nextBytes(randomBytes);
|
||||
randomBytes[6] &= 0x0f; /* clear version */
|
||||
randomBytes[6] |= 0x40; /* set to version 4 */
|
||||
randomBytes[8] &= 0x3f; /* clear variant */
|
||||
randomBytes[8] |= 0x80; /* set to IETF variant */
|
||||
|
||||
// UUID result = new UUID(randomBytes);
|
||||
|
||||
return new UUID(randomBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Static factory to retrieve a type 3 (name based) <tt>UUID</tt> based on
|
||||
* the specified byte array.
|
||||
*
|
||||
* @param name
|
||||
* a byte array to be used to construct a <tt>UUID</tt>.
|
||||
* @return a <tt>UUID</tt> generated from the specified array.
|
||||
* depricated
|
||||
*/
|
||||
public static UUID nameUUIDFromBytes(byte[] name) {
|
||||
// MessageDigest md;
|
||||
//
|
||||
// try {
|
||||
// md = MessageDigest.getInstance("MD5");
|
||||
// } catch (NoSuchAlgorithmException nsae) {
|
||||
// throw new InternalError("MD5 not supported");
|
||||
// }
|
||||
//
|
||||
// byte[] md5Bytes = md.digest(name);
|
||||
// md5Bytes[6] &= 0x0f; /* clear version */
|
||||
// md5Bytes[6] |= 0x30; /* set to version 3 */
|
||||
// md5Bytes[8] &= 0x3f; /* clear variant */
|
||||
// md5Bytes[8] |= 0x80; /* set to IETF variant */
|
||||
//
|
||||
// return new UUID(md5Bytes);
|
||||
return randomUUID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a <tt>UUID</tt> from the string standard representation as
|
||||
* described in the {@link #toString}method.
|
||||
*
|
||||
* @param name
|
||||
* a string that specifies a <tt>UUID</tt>.
|
||||
* @return a <tt>UUID</tt> with the specified value.
|
||||
* @throws IllegalArgumentException
|
||||
* if name does not conform to the string representation as
|
||||
* described in {@link #toString}.
|
||||
*/
|
||||
public static UUID fromString(String name) {
|
||||
// edited by hskim 2005.01.10 begin
|
||||
// String[] components = name.split("-");
|
||||
java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(name);
|
||||
|
||||
java.util.Vector cs = new java.util.Vector();
|
||||
|
||||
while (tokenizer.hasMoreTokens())
|
||||
cs.add(tokenizer.nextToken());
|
||||
|
||||
String[] components = new String[cs.size()];
|
||||
|
||||
for (int a = 0; a < cs.size(); a++)
|
||||
components[a] = (String) (cs.elementAt(a));
|
||||
|
||||
// edited by hskim 2005.01.10 end
|
||||
if (components.length != 5) {
|
||||
throw new IllegalArgumentException("Invalid UUID string: " + name);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
components[i] = "0x" + components[i];
|
||||
|
||||
long mostSigBits = Long.decode(components[0]).longValue();
|
||||
mostSigBits <<= 16;
|
||||
mostSigBits |= Long.decode(components[1]).longValue();
|
||||
mostSigBits <<= 16;
|
||||
mostSigBits |= Long.decode(components[2]).longValue();
|
||||
|
||||
long leastSigBits = Long.decode(components[3]).longValue();
|
||||
leastSigBits <<= 48;
|
||||
leastSigBits |= Long.decode(components[4]).longValue();
|
||||
|
||||
return new UUID(mostSigBits, leastSigBits);
|
||||
}
|
||||
|
||||
// Field Accessor Methods
|
||||
|
||||
/**
|
||||
* Returns the least significant 64 bits of this UUID's 128 bit value.
|
||||
*
|
||||
* @return the least significant 64 bits of this UUID's 128 bit value.
|
||||
*/
|
||||
public long getLeastSignificantBits() {
|
||||
return leastSigBits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the most significant 64 bits of this UUID's 128 bit value.
|
||||
*
|
||||
* @return the most significant 64 bits of this UUID's 128 bit value.
|
||||
*/
|
||||
public long getMostSignificantBits() {
|
||||
return mostSigBits;
|
||||
}
|
||||
|
||||
/**
|
||||
* The version number associated with this <tt>UUID</tt>. The version
|
||||
* number describes how this <tt>UUID</tt> was generated.
|
||||
*
|
||||
* The version number has the following meaning:
|
||||
* <p>
|
||||
* <ul>
|
||||
* <li>1 Time-based UUID
|
||||
* <li>2 DCE security UUID
|
||||
* <li>3 Name-based UUID
|
||||
* <li>4 Randomly generated UUID
|
||||
* </ul>
|
||||
*
|
||||
* @return the version number of this <tt>UUID</tt>.
|
||||
*/
|
||||
public int version() {
|
||||
if (version < 0) {
|
||||
// Version is bits masked by 0x000000000000F000 in MS long
|
||||
version = (int) ((mostSigBits >> 12) & 0x0f);
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* The variant number associated with this <tt>UUID</tt>. The variant
|
||||
* number describes the layout of the <tt>UUID</tt>.
|
||||
*
|
||||
* The variant number has the following meaning:
|
||||
* <p>
|
||||
* <ul>
|
||||
* <li>0 Reserved for NCS backward compatibility
|
||||
* <li>2 The Leach-Salz variant (used by this class)
|
||||
* <li>6 Reserved, Microsoft Corporation backward compatibility
|
||||
* <li>7 Reserved for future definition
|
||||
* </ul>
|
||||
*
|
||||
* @return the variant number of this <tt>UUID</tt>.
|
||||
*/
|
||||
public int variant() {
|
||||
if (variant < 0) {
|
||||
// This field is composed of a varying number of bits
|
||||
if ((leastSigBits >>> 63) == 0) {
|
||||
variant = 0;
|
||||
} else if ((leastSigBits >>> 62) == 2) {
|
||||
variant = 2;
|
||||
} else {
|
||||
variant = (int) (leastSigBits >>> 61);
|
||||
}
|
||||
}
|
||||
|
||||
return variant;
|
||||
}
|
||||
|
||||
/**
|
||||
* The timestamp value associated with this UUID.
|
||||
*
|
||||
* <p>
|
||||
* The 60 bit timestamp value is constructed from the time_low, time_mid,
|
||||
* and time_hi fields of this <tt>UUID</tt>. The resulting timestamp is
|
||||
* measured in 100-nanosecond units since midnight, October 15, 1582 UTC.
|
||||
* <p>
|
||||
*
|
||||
* The timestamp value is only meaningful in a time-based UUID, which has
|
||||
* version type 1. If this <tt>UUID</tt> is not a time-based UUID then
|
||||
* this method throws UnsupportedOperationException.
|
||||
*
|
||||
* @throws UnsupportedOperationException
|
||||
* if this UUID is not a version 1 UUID.
|
||||
*/
|
||||
public long timestamp() {
|
||||
if (version() != 1) {
|
||||
throw new UnsupportedOperationException("Not a time-based UUID");
|
||||
}
|
||||
|
||||
long result = timestamp;
|
||||
|
||||
if (result < 0) {
|
||||
result = (mostSigBits & 0x0000000000000FFFL) << 48;
|
||||
result |= (((mostSigBits >> 16) & 0xFFFFL) << 32);
|
||||
result |= mostSigBits >>> 32;
|
||||
timestamp = result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* The clock sequence value associated with this UUID.
|
||||
*
|
||||
* <p>
|
||||
* The 14 bit clock sequence value is constructed from the clock sequence
|
||||
* field of this UUID. The clock sequence field is used to guarantee
|
||||
* temporal uniqueness in a time-based UUID.
|
||||
* <p>
|
||||
*
|
||||
* The clockSequence value is only meaningful in a time-based UUID, which
|
||||
* has version type 1. If this UUID is not a time-based UUID then this
|
||||
* method throws UnsupportedOperationException.
|
||||
*
|
||||
* @return the clock sequence of this <tt>UUID</tt>.
|
||||
* @throws UnsupportedOperationException
|
||||
* if this UUID is not a version 1 UUID.
|
||||
*/
|
||||
public int clockSequence() {
|
||||
if (version() != 1) {
|
||||
throw new UnsupportedOperationException("Not a time-based UUID");
|
||||
}
|
||||
|
||||
if (sequence < 0) {
|
||||
sequence = (int) ((leastSigBits & 0x3FFF000000000000L) >>> 48);
|
||||
}
|
||||
|
||||
return sequence;
|
||||
}
|
||||
|
||||
/**
|
||||
* The node value associated with this UUID.
|
||||
*
|
||||
* <p>
|
||||
* The 48 bit node value is constructed from the node field of this UUID.
|
||||
* This field is intended to hold the IEEE 802 address of the machine that
|
||||
* generated this UUID to guarantee spatial uniqueness.
|
||||
* <p>
|
||||
*
|
||||
* The node value is only meaningful in a time-based UUID, which has version
|
||||
* type 1. If this UUID is not a time-based UUID then this method throws
|
||||
* UnsupportedOperationException.
|
||||
*
|
||||
* @return the node value of this <tt>UUID</tt>.
|
||||
* @throws UnsupportedOperationException
|
||||
* if this UUID is not a version 1 UUID.
|
||||
*/
|
||||
public long node() {
|
||||
if (version() != 1) {
|
||||
throw new UnsupportedOperationException("Not a time-based UUID");
|
||||
}
|
||||
|
||||
if (node < 0) {
|
||||
node = leastSigBits & 0x0000FFFFFFFFFFFFL;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
// Object Inherited Methods
|
||||
|
||||
/**
|
||||
* Returns a <code>String</code> object representing this
|
||||
* <code>UUID</code>.
|
||||
*
|
||||
* <p>
|
||||
* The UUID string representation is as described by this BNF :
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* UUID = <time_low> "-" <time_mid> "-"
|
||||
* <time_high_and_version> "-"
|
||||
* <variant_and_sequence> "-"
|
||||
* <node>
|
||||
* time_low = 4*<hexOctet>
|
||||
* time_mid = 2*<hexOctet>
|
||||
* time_high_and_version = 2*<hexOctet>
|
||||
* variant_and_sequence = 2*<hexOctet>
|
||||
* node = 6*<hexOctet>
|
||||
* hexOctet = <hexDigit><hexDigit>
|
||||
* hexDigit =
|
||||
* "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
|
||||
* | "a" | "b" | "c" | "d" | "e" | "f"
|
||||
* | "A" | "B" | "C" | "D" | "E" | "F"
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @return a string representation of this <tt>UUID</tt>.
|
||||
*/
|
||||
public String toString() {
|
||||
return (digits(mostSigBits >> 32, 8) + "-" +
|
||||
digits(mostSigBits >> 16, 4) + "-" + digits(mostSigBits, 4) + "-" +
|
||||
digits(leastSigBits >> 48, 4) + "-" + digits(leastSigBits, 12));
|
||||
}
|
||||
|
||||
/** Returns val represented by the specified number of hex digits. */
|
||||
private static String digits(long val, int digits) {
|
||||
long hi = 1L << (digits * 4);
|
||||
|
||||
return Long.toHexString(hi | (val & (hi - 1))).substring(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a hash code for this <code>UUID</code>.
|
||||
*
|
||||
* @return a hash code value for this <tt>UUID</tt>.
|
||||
*/
|
||||
public int hashCode() {
|
||||
if (hashCode == -1) {
|
||||
hashCode = (int) ((mostSigBits >> 32) ^ mostSigBits ^
|
||||
(leastSigBits >> 32) ^ leastSigBits);
|
||||
}
|
||||
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this object to the specified object. The result is <tt>true</tt>
|
||||
* if and only if the argument is not <tt>null</tt>, is a <tt>UUID</tt>
|
||||
* object, has the same variant, and contains the same value, bit for bit,
|
||||
* as this <tt>UUID</tt>.
|
||||
*
|
||||
* @param obj
|
||||
* the object to compare with.
|
||||
* @return <code>true</code> if the objects are the same;
|
||||
* <code>false</code> otherwise.
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof UUID)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (((UUID) obj).variant() != this.variant()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
UUID id = (UUID) obj;
|
||||
|
||||
return ((mostSigBits == id.mostSigBits) &&
|
||||
(leastSigBits == id.leastSigBits));
|
||||
}
|
||||
|
||||
// Comparison Operations
|
||||
|
||||
/**
|
||||
* Compares this UUID with the specified UUID.
|
||||
*
|
||||
* <p>
|
||||
* The first of two UUIDs follows the second if the most significant field
|
||||
* in which the UUIDs differ is greater for the first UUID.
|
||||
*
|
||||
* @param val
|
||||
* <tt>UUID</tt> to which this <tt>UUID</tt> is to be
|
||||
* compared.
|
||||
* @return -1, 0 or 1 as this <tt>UUID</tt> is less than, equal to, or
|
||||
* greater than <tt>val</tt>.
|
||||
*/
|
||||
public int compareTo(UUID val) {
|
||||
// The ordering is intentionally set up so that the UUIDs
|
||||
// can simply be numerically compared as two numbers
|
||||
return ((this.mostSigBits < val.mostSigBits) ? (-1)
|
||||
: ((this.mostSigBits > val.mostSigBits)
|
||||
? 1
|
||||
: ((this.leastSigBits < val.leastSigBits) ? (-1)
|
||||
: ((this.leastSigBits > val.leastSigBits)
|
||||
? 1 : 0))));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reconstitute the <tt>UUID</tt> instance from a stream (that is,
|
||||
* deserialize it). This is necessary to set the transient fields to their
|
||||
* correct uninitialized value so they will be recomputed on demand.
|
||||
*/
|
||||
// private void readObject(java.io.ObjectInputStream in)
|
||||
// throws java.io.IOException, ClassNotFoundException {
|
||||
// in.defaultReadObject();
|
||||
//
|
||||
// // Set "cached computation" fields to their initial values
|
||||
// version = -1;
|
||||
// variant = -1;
|
||||
// timestamp = -1;
|
||||
// sequence = -1;
|
||||
// node = -1;
|
||||
// hashCode = -1;
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.eactive.eai.common.server.Keys;
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : UUID Generation Class
|
||||
* 2. 처리 개요 :
|
||||
* * -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see : 관련 기능을 참조
|
||||
* @since :
|
||||
* :
|
||||
*/
|
||||
public final class UUIDGenerator {
|
||||
|
||||
private static final DateTimeFormatter SDF_YYYYMMDDHHMMSSMS = DateTimeFormatter.ofPattern( "yyyyMMddHHmmssSSS");
|
||||
|
||||
//public static final int GUID_LENGTH = 38;
|
||||
// public static final int GUID_LENGTH = 33;
|
||||
// public static final int GUID_DATE_POSITION = 3;
|
||||
public static final int GUID_LENGTH = 27; //seq값 제외부분
|
||||
public static final int GUID_DATE_POSITION = 0;
|
||||
public static final int GUID_SEQ_LENGTH = 2;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Private 생성자
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항
|
||||
* - Instance 생성하지 못함
|
||||
**/
|
||||
private UUIDGenerator() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : UUID를 생성하여 스트링으로 리턴하는 메쏘드
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @return 생성된 UUID 스트링
|
||||
**/
|
||||
public static String getUUID() {
|
||||
UUID uuid = UUID.randomUUID();
|
||||
|
||||
return uuid.toString();
|
||||
}
|
||||
|
||||
// // 하나캐피탈 POC
|
||||
// public synchronized static String getGUID(String userId) {
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// sb.append(SDF_YYYYMMDDHHMMSSMS.format(ZonedDateTime.now()));
|
||||
// sb.append(userId);
|
||||
// //sb.append(tranStep);
|
||||
//
|
||||
// return sb.toString();
|
||||
// }
|
||||
|
||||
public synchronized static String getGUID(String systemCode) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(systemCode);
|
||||
sb.append(SDF_YYYYMMDDHHMMSSMS.format(ZonedDateTime.now()));
|
||||
// String guid = systemCode + UNIQUE_NUM;
|
||||
// guid = guid + SDF_YYYYMMDDHHMMSSMS.format(ZonedDateTime.now());
|
||||
sb.append(UNIQUE_NUM);
|
||||
char[] formatSeq = {'0','0','0','0','0','0','0','0'};
|
||||
char[] seqCharArray = String.valueOf(seq).toCharArray();
|
||||
int destPos = formatSeq.length - seqCharArray.length;
|
||||
System.arraycopy(seqCharArray, 0, formatSeq, destPos, seqCharArray.length);
|
||||
|
||||
sb.append(formatSeq);
|
||||
|
||||
// if(seq < 10) {
|
||||
// guid = guid + "00000" + seq;
|
||||
// }
|
||||
// else if(seq < 100) {
|
||||
// guid = guid + "0000" + seq;
|
||||
// }
|
||||
// else if(seq < 1000) {
|
||||
// guid = guid + "000" + seq;
|
||||
// }
|
||||
// else if(seq < 10000) {
|
||||
// guid = guid + "00" + seq;
|
||||
// }
|
||||
// else if(seq < 100000) {
|
||||
// guid = guid + "0" + seq;
|
||||
// }
|
||||
// else {
|
||||
// guid = guid + seq;
|
||||
// }
|
||||
|
||||
seq ++;
|
||||
if(seq > 99999999) {
|
||||
seq = 1;
|
||||
}
|
||||
|
||||
return sb.toString() ;
|
||||
}
|
||||
|
||||
private static String UNIQUE_NUM;
|
||||
private static int seq = 1;
|
||||
static {
|
||||
String uniqueValue = System.getProperty(Keys.SERVER_KEY);
|
||||
if(StringUtils.isBlank(uniqueValue)){
|
||||
try {
|
||||
uniqueValue = java.net.InetAddress.getLocalHost().getHostName();
|
||||
}
|
||||
catch(Exception e) {
|
||||
uniqueValue = "XXXXXXXXXX";
|
||||
}
|
||||
}
|
||||
if(uniqueValue.length() != 10) {
|
||||
uniqueValue = StringUtil.stringFormat(uniqueValue, false, 'X', 10);
|
||||
}else if (uniqueValue.length() > 10){
|
||||
uniqueValue.substring(0, 10);
|
||||
}
|
||||
UNIQUE_NUM = uniqueValue.toUpperCase();
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
// System.out.println(getGUID("user000001"));
|
||||
// System.out.println(new Integer("01"));
|
||||
seq = 99999999;
|
||||
System.out.println(getGUID("MCI"));
|
||||
System.out.println(getGUID("MCI"));
|
||||
long start = System.currentTimeMillis();
|
||||
for (int i = 0; i < 100000000; i++) {
|
||||
char[] seq = String.valueOf(i).toCharArray();
|
||||
char[] formatSeq = {'0','0','0','0','0','0','0','0','0','0'};
|
||||
int destPos = formatSeq.length - seq.length;
|
||||
System.arraycopy(seq, 0, formatSeq, destPos, seq.length);
|
||||
}
|
||||
long end = System.currentTimeMillis() - start;
|
||||
System.out.println("c1 time-" + end);
|
||||
|
||||
start = System.currentTimeMillis();
|
||||
for (int i = 0; i < 100000000; i++) {
|
||||
String formatSeq = StringUtils.leftPad(String.valueOf(i), 10, '0');
|
||||
}
|
||||
end = System.currentTimeMillis() - start;
|
||||
System.out.println("c2 time-" + end);
|
||||
|
||||
// System.out.println(formatSeq);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class XSSUtil {
|
||||
public static final HashMap m = new HashMap();
|
||||
static {
|
||||
m.put(34, """);
|
||||
m.put(60, "<");
|
||||
m.put(62, ">");
|
||||
m.put(38, "&");
|
||||
m.put(162, "¢");
|
||||
m.put(163, "£");
|
||||
m.put(165, "¥");
|
||||
m.put(8364, "€");
|
||||
m.put(167, "§");
|
||||
m.put(169, "©");
|
||||
m.put(174, "®");
|
||||
m.put(8482, "™");
|
||||
}
|
||||
|
||||
public static String escape(String str) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int charSize = str.length();
|
||||
|
||||
for(int i=0; i<charSize;i++) {
|
||||
char c = str.charAt(i);
|
||||
int ascCode = (int)c;
|
||||
|
||||
String replaceCode = (String)m.get(ascCode);
|
||||
if(replaceCode == null) {
|
||||
if(c>0x7F) {
|
||||
sb.append("&#");
|
||||
sb.append(Integer.toString(c, 10));
|
||||
sb.append(";");
|
||||
}
|
||||
else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
else {
|
||||
sb.append(replaceCode);
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.eactive.eai.common.util.logger;
|
||||
|
||||
import ch.qos.logback.classic.pattern.NamedConverter;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
|
||||
public class CustomClassOfCallerConverter extends NamedConverter {
|
||||
protected String getFullyQualifiedName(ILoggingEvent event) {
|
||||
StackTraceElement[] cda = event.getCallerData();
|
||||
if (cda != null && cda.length > 0) {
|
||||
if (cda[0].getFileName().equals("Logger.java") && cda.length > 1) {
|
||||
if (cda[1].getFileName().equals("Logger.java") && cda.length > 2){
|
||||
return cda[2].getClassName();
|
||||
}
|
||||
return cda[1].getClassName();
|
||||
}
|
||||
return cda[0].getClassName();
|
||||
} else {
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.eactive.eai.common.util.logger;
|
||||
|
||||
import ch.qos.logback.classic.pattern.ClassicConverter;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
|
||||
public class CustomFileOfCallerConverter extends ClassicConverter {
|
||||
public String convert(ILoggingEvent le) {
|
||||
StackTraceElement[] cda = le.getCallerData();
|
||||
if (cda != null && cda.length > 0) {
|
||||
if (cda[0].getFileName().equals("Logger.java") && cda.length > 1) {
|
||||
if (cda[1].getFileName().equals("Logger.java") && cda.length > 2){
|
||||
return cda[2].getFileName();
|
||||
}
|
||||
return cda[1].getFileName();
|
||||
}
|
||||
return cda[0].getFileName();
|
||||
} else {
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.eactive.eai.common.util.logger;
|
||||
|
||||
import ch.qos.logback.classic.pattern.ClassicConverter;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
|
||||
public class CustomLineOfCallerConverter extends ClassicConverter {
|
||||
public String convert(ILoggingEvent le) {
|
||||
StackTraceElement[] cda = le.getCallerData();
|
||||
if (cda != null && cda.length > 0) {
|
||||
if (cda[0].getFileName().equals("Logger.java") && cda.length > 1) {
|
||||
if (cda[1].getFileName().equals("Logger.java") && cda.length > 2){
|
||||
return Integer.toString(cda[2].getLineNumber());
|
||||
}
|
||||
return Integer.toString(cda[1].getLineNumber());
|
||||
}
|
||||
return Integer.toString(cda[0].getLineNumber());
|
||||
} else {
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.eactive.eai.common.util.logger;
|
||||
|
||||
import ch.qos.logback.classic.pattern.ClassicConverter;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
|
||||
public class CustomMethodOfCallerConverter extends ClassicConverter {
|
||||
public String convert(ILoggingEvent le) {
|
||||
StackTraceElement[] cda = le.getCallerData();
|
||||
if (cda != null && cda.length > 0) {
|
||||
if (cda[0].getFileName().equals("Logger.java") && cda.length > 1) {
|
||||
if (cda[1].getFileName().equals("Logger.java") && cda.length > 2){
|
||||
return cda[2].getMethodName();
|
||||
}
|
||||
return cda[1].getMethodName();
|
||||
}
|
||||
return cda[0].getMethodName();
|
||||
} else {
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package com.eactive.eai.common.util.logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import ch.qos.logback.classic.pattern.CallerDataConverter;
|
||||
import ch.qos.logback.classic.pattern.ClassOfCallerConverter;
|
||||
import ch.qos.logback.classic.pattern.ContextNameConverter;
|
||||
import ch.qos.logback.classic.pattern.DateConverter;
|
||||
import ch.qos.logback.classic.pattern.EnsureExceptionHandling;
|
||||
import ch.qos.logback.classic.pattern.ExtendedThrowableProxyConverter;
|
||||
import ch.qos.logback.classic.pattern.LevelConverter;
|
||||
import ch.qos.logback.classic.pattern.LineSeparatorConverter;
|
||||
import ch.qos.logback.classic.pattern.LocalSequenceNumberConverter;
|
||||
import ch.qos.logback.classic.pattern.LoggerConverter;
|
||||
import ch.qos.logback.classic.pattern.MDCConverter;
|
||||
import ch.qos.logback.classic.pattern.MarkerConverter;
|
||||
import ch.qos.logback.classic.pattern.MessageConverter;
|
||||
import ch.qos.logback.classic.pattern.MethodOfCallerConverter;
|
||||
import ch.qos.logback.classic.pattern.NopThrowableInformationConverter;
|
||||
import ch.qos.logback.classic.pattern.PropertyConverter;
|
||||
import ch.qos.logback.classic.pattern.RelativeTimeConverter;
|
||||
import ch.qos.logback.classic.pattern.RootCauseFirstThrowableProxyConverter;
|
||||
import ch.qos.logback.classic.pattern.ThreadConverter;
|
||||
import ch.qos.logback.classic.pattern.ThrowableProxyConverter;
|
||||
import ch.qos.logback.classic.pattern.color.HighlightingCompositeConverter;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.core.CoreConstants;
|
||||
import ch.qos.logback.core.pattern.PatternLayoutBase;
|
||||
import ch.qos.logback.core.pattern.color.BlackCompositeConverter;
|
||||
import ch.qos.logback.core.pattern.color.BlueCompositeConverter;
|
||||
import ch.qos.logback.core.pattern.color.BoldBlueCompositeConverter;
|
||||
import ch.qos.logback.core.pattern.color.BoldCyanCompositeConverter;
|
||||
import ch.qos.logback.core.pattern.color.BoldGreenCompositeConverter;
|
||||
import ch.qos.logback.core.pattern.color.BoldMagentaCompositeConverter;
|
||||
import ch.qos.logback.core.pattern.color.BoldRedCompositeConverter;
|
||||
import ch.qos.logback.core.pattern.color.BoldWhiteCompositeConverter;
|
||||
import ch.qos.logback.core.pattern.color.BoldYellowCompositeConverter;
|
||||
import ch.qos.logback.core.pattern.color.CyanCompositeConverter;
|
||||
import ch.qos.logback.core.pattern.color.GrayCompositeConverter;
|
||||
import ch.qos.logback.core.pattern.color.GreenCompositeConverter;
|
||||
import ch.qos.logback.core.pattern.color.MagentaCompositeConverter;
|
||||
import ch.qos.logback.core.pattern.color.RedCompositeConverter;
|
||||
import ch.qos.logback.core.pattern.color.WhiteCompositeConverter;
|
||||
import ch.qos.logback.core.pattern.color.YellowCompositeConverter;
|
||||
import ch.qos.logback.core.pattern.parser.Parser;
|
||||
|
||||
public class CustomPatternLayout extends PatternLayoutBase<ILoggingEvent> {
|
||||
public static final Map<String, String> defaultConverterMap = new HashMap<String,String>();
|
||||
public static final String HEADER_PREFIX = "#logback.classic pattern: ";
|
||||
|
||||
static {
|
||||
defaultConverterMap.putAll(Parser.DEFAULT_COMPOSITE_CONVERTER_MAP);
|
||||
defaultConverterMap.put("d", DateConverter.class.getName());
|
||||
defaultConverterMap.put("date", DateConverter.class.getName());
|
||||
defaultConverterMap.put("r", RelativeTimeConverter.class.getName());
|
||||
defaultConverterMap.put("relative", RelativeTimeConverter.class.getName());
|
||||
defaultConverterMap.put("level", LevelConverter.class.getName());
|
||||
defaultConverterMap.put("le", LevelConverter.class.getName());
|
||||
defaultConverterMap.put("p", LevelConverter.class.getName());
|
||||
defaultConverterMap.put("t", ThreadConverter.class.getName());
|
||||
defaultConverterMap.put("thread", ThreadConverter.class.getName());
|
||||
defaultConverterMap.put("lo", LoggerConverter.class.getName());
|
||||
defaultConverterMap.put("logger", LoggerConverter.class.getName());
|
||||
defaultConverterMap.put("c", LoggerConverter.class.getName());
|
||||
defaultConverterMap.put("m", MessageConverter.class.getName());
|
||||
defaultConverterMap.put("msg", MessageConverter.class.getName());
|
||||
defaultConverterMap.put("message", MessageConverter.class.getName());
|
||||
defaultConverterMap.put("C", CustomClassOfCallerConverter.class.getName());
|
||||
defaultConverterMap.put("class", CustomClassOfCallerConverter.class.getName());
|
||||
defaultConverterMap.put("M", CustomMethodOfCallerConverter.class.getName());
|
||||
defaultConverterMap.put("method", CustomMethodOfCallerConverter.class.getName());
|
||||
defaultConverterMap.put("L", CustomLineOfCallerConverter.class.getName());
|
||||
defaultConverterMap.put("line", CustomLineOfCallerConverter.class.getName());
|
||||
defaultConverterMap.put("F", CustomFileOfCallerConverter.class.getName());
|
||||
defaultConverterMap.put("file", CustomFileOfCallerConverter.class.getName());
|
||||
defaultConverterMap.put("X", MDCConverter.class.getName());
|
||||
defaultConverterMap.put("mdc", MDCConverter.class.getName());
|
||||
defaultConverterMap.put("ex", ThrowableProxyConverter.class.getName());
|
||||
defaultConverterMap.put("exception", ThrowableProxyConverter.class.getName());
|
||||
defaultConverterMap.put("rEx", RootCauseFirstThrowableProxyConverter.class.getName());
|
||||
defaultConverterMap.put("rootException", RootCauseFirstThrowableProxyConverter.class.getName());
|
||||
defaultConverterMap.put("throwable", ThrowableProxyConverter.class.getName());
|
||||
defaultConverterMap.put("xEx", ExtendedThrowableProxyConverter.class.getName());
|
||||
defaultConverterMap.put("xException", ExtendedThrowableProxyConverter.class.getName());
|
||||
defaultConverterMap.put("xThrowable", ExtendedThrowableProxyConverter.class.getName());
|
||||
defaultConverterMap.put("nopex", NopThrowableInformationConverter.class.getName());
|
||||
defaultConverterMap.put("nopexception", NopThrowableInformationConverter.class.getName());
|
||||
defaultConverterMap.put("cn", ContextNameConverter.class.getName());
|
||||
defaultConverterMap.put("contextName", ContextNameConverter.class.getName());
|
||||
defaultConverterMap.put("caller", CallerDataConverter.class.getName());
|
||||
defaultConverterMap.put("marker", MarkerConverter.class.getName());
|
||||
defaultConverterMap.put("property", PropertyConverter.class.getName());
|
||||
defaultConverterMap.put("n", LineSeparatorConverter.class.getName());
|
||||
defaultConverterMap.put("black", BlackCompositeConverter.class.getName());
|
||||
defaultConverterMap.put("red", RedCompositeConverter.class.getName());
|
||||
defaultConverterMap.put("green", GreenCompositeConverter.class.getName());
|
||||
defaultConverterMap.put("yellow", YellowCompositeConverter.class.getName());
|
||||
defaultConverterMap.put("blue", BlueCompositeConverter.class.getName());
|
||||
defaultConverterMap.put("magenta", MagentaCompositeConverter.class.getName());
|
||||
defaultConverterMap.put("cyan", CyanCompositeConverter.class.getName());
|
||||
defaultConverterMap.put("white", WhiteCompositeConverter.class.getName());
|
||||
defaultConverterMap.put("gray", GrayCompositeConverter.class.getName());
|
||||
defaultConverterMap.put("boldRed", BoldRedCompositeConverter.class.getName());
|
||||
defaultConverterMap.put("boldGreen", BoldGreenCompositeConverter.class.getName());
|
||||
defaultConverterMap.put("boldYellow", BoldYellowCompositeConverter.class.getName());
|
||||
defaultConverterMap.put("boldBlue", BoldBlueCompositeConverter.class.getName());
|
||||
defaultConverterMap.put("boldMagenta", BoldMagentaCompositeConverter.class.getName());
|
||||
defaultConverterMap.put("boldCyan", BoldCyanCompositeConverter.class.getName());
|
||||
defaultConverterMap.put("boldWhite", BoldWhiteCompositeConverter.class.getName());
|
||||
defaultConverterMap.put("highlight", HighlightingCompositeConverter.class.getName());
|
||||
defaultConverterMap.put("lsn", LocalSequenceNumberConverter.class.getName());
|
||||
}
|
||||
|
||||
public CustomPatternLayout() {
|
||||
this.postCompileProcessor = new EnsureExceptionHandling();
|
||||
}
|
||||
|
||||
public Map<String, String> getDefaultConverterMap() {
|
||||
return defaultConverterMap;
|
||||
}
|
||||
|
||||
public String doLayout(ILoggingEvent event) {
|
||||
return !this.isStarted() ? CoreConstants.EMPTY_STRING : this.writeLoopOnConverters(event);
|
||||
// if(!this.isStarted()){
|
||||
// return CoreConstants.EMPTY_STRING;
|
||||
// }
|
||||
// String header = this.writeLoopOnConverters(event) + " ";
|
||||
// StringBuilder sb = new StringBuilder(128);
|
||||
// StringBuilder buffer = new StringBuilder();
|
||||
//
|
||||
// for(char c : event.getFormattedMessage().toCharArray()){
|
||||
// switch(c){
|
||||
// case '\r' : continue;
|
||||
// case '\n' :
|
||||
// //System.out.println(">>>>>>>>>>>"+
|
||||
// "buffer="+header+","+buffer.toString());
|
||||
// sb.append(header).append(buffer).append(CoreConstants.LINE_SEPARATOR);
|
||||
// buffer = new StringBuilder();
|
||||
// break;
|
||||
// default : buffer.append(c);
|
||||
// }
|
||||
// }
|
||||
// sb.append(header).append(buffer).append(CoreConstants.LINE_SEPARATOR);
|
||||
// return sb.toString();
|
||||
}
|
||||
|
||||
protected String getPresentationHeaderPrefix() {
|
||||
return HEADER_PREFIX;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.eactive.eai.common.util.logger;
|
||||
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.core.pattern.PatternLayoutEncoderBase;
|
||||
|
||||
public class CustomPatternLayoutEncoder extends PatternLayoutEncoderBase<ILoggingEvent> {
|
||||
public void start() {
|
||||
CustomPatternLayout patternLayout = new CustomPatternLayout();
|
||||
patternLayout.setContext(this.context);
|
||||
patternLayout.setPattern(this.getPattern());
|
||||
patternLayout.setOutputPatternAsHeader(this.outputPatternAsHeader);
|
||||
patternLayout.start();
|
||||
this.layout = patternLayout;
|
||||
super.start();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.eactive.eai.rms.onl.vo;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class AdaptersStatusVO extends MonitorDataVo {
|
||||
|
||||
private static final long serialVersionUID = 7923019414430933138L;
|
||||
|
||||
// initialize in RMS
|
||||
private String service = "";
|
||||
|
||||
private HashMap<String,Boolean> adapters = null;
|
||||
|
||||
public AdaptersStatusVO(){
|
||||
adapters = new HashMap<String,Boolean>();
|
||||
}
|
||||
|
||||
public void setAdapter(String adapterName, Boolean status){
|
||||
adapters.put(adapterName, status);
|
||||
}
|
||||
public boolean getAdapter(String adapterName){
|
||||
if (!adapters.containsKey(adapterName)){
|
||||
return false;
|
||||
}
|
||||
return (Boolean)adapters.get(adapterName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the service
|
||||
*/
|
||||
public String getService() {
|
||||
return service;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param service the service to set
|
||||
*/
|
||||
public void setService(String service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
public HashMap getAdaptersStatus(){
|
||||
return this.adapters;
|
||||
}
|
||||
public String toString(){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("[AdaptersStatusVO:");
|
||||
for(String key : adapters.keySet()){
|
||||
sb.append(key+"="+adapters.get(key)+",");
|
||||
}
|
||||
sb.append("]");
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
package com.eactive.eai.rms.onl.vo;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class AdaptersVO extends MonitorDataVo {
|
||||
|
||||
private static final long serialVersionUID = 7923019414430933138L;
|
||||
|
||||
// initialize in RMS
|
||||
private String service = "";
|
||||
|
||||
// (Total count, running count, stop count, state)
|
||||
|
||||
// SNA 어댑터 : SNA
|
||||
public int[] sna = { 0, 0, 0, 0 };
|
||||
// 소켓 어댑터 : SOC
|
||||
public int[] socket = { 0, 0, 0, 0 };
|
||||
// 소켓2 어댑터 : NET
|
||||
public int[] socket2 = { 0, 0, 0, 0 };
|
||||
// Tuxedo 어댑터 : WTC
|
||||
public int[] tuxedo = { 0, 0, 0, 0 };
|
||||
// MQ 어댑터 : MQ
|
||||
public int[] mq = { 0, 0, 0, 0 };
|
||||
// HTTP 어댑터 : HTT
|
||||
public int[] http = { 0, 0, 0, 0 };
|
||||
// EJB 어댑터 : EJB
|
||||
public int[] ejb = { 0, 0, 0, 0 };
|
||||
|
||||
// 전체 어댑터
|
||||
public int[] total = { 0, 0, 0, 0 };
|
||||
|
||||
// 비정상 어댑터 송신
|
||||
public String disconAdaptersGroup = null;
|
||||
|
||||
public static String getColor(List hostList, String hostName, int status) {
|
||||
|
||||
/* 색상은 host 를 그룹으로 해서 같은 host 는 같은 색상으로 표시한다.
|
||||
* 정상( blue, black ) 에러 ( red ) 로 다시 세분화 된다.
|
||||
* */
|
||||
|
||||
int i = 0;
|
||||
for (i = 0; i < hostList.size(); i++) {
|
||||
Map map = (Map) hostList.get(i);
|
||||
if (hostName.equals((String) map.get("HOSTNAME"))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int step = 0;
|
||||
int size = hostList.size() % 2;
|
||||
if (size == 0) {
|
||||
step = i % 2; // 짝수인 경우 1,2 중 하나
|
||||
} else {
|
||||
step = i % 3; // 홀수인 경우 1,2,3 중 하나
|
||||
}
|
||||
|
||||
return getColor(step, status);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* 대시보드 에서 어댑터 상태에 따른 색상값을 리턴한다.
|
||||
* step 값은 동일 차트 에서 여러개의 어댑터를 표현하기 위함인데,
|
||||
* 현재는 step 1 만 사용함.
|
||||
*/
|
||||
public static String getColor(int step, int status) {
|
||||
String color = "";
|
||||
|
||||
if (step > 2) {
|
||||
step = step % 3;
|
||||
}
|
||||
|
||||
if (step == 0) {
|
||||
if (status == 0) { // 에러
|
||||
color = "#FFA500";
|
||||
} else if (status == 1) { // 부분정상
|
||||
color = "#999999";
|
||||
} else if (status == 2) { // 정상
|
||||
color = "#6666FF";
|
||||
}
|
||||
} else if (step == 1) {
|
||||
if (status == 0) { // 에러
|
||||
color = "#FF6633";
|
||||
} else if (status == 1) { // 부분정상
|
||||
color = "#999999";
|
||||
} else if (status == 2) { // 정상
|
||||
color = "#4488FF";
|
||||
}
|
||||
} else if (step == 2) {
|
||||
if (status == 0) { // 에러
|
||||
color = "#FF4566";
|
||||
} else if (status == 1) { // 부분정상
|
||||
color = "#CCCCCC";
|
||||
} else if (status == 2) { // 정상
|
||||
color = "#9999FF";
|
||||
}
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
public String getColor( int v ) {
|
||||
String ret = "r" ;
|
||||
if( v == 0 )
|
||||
ret = "r" ; // red 에러
|
||||
else if( v == 1 )
|
||||
ret = "g" ; // grey 부분정상
|
||||
else if( v == 2 )
|
||||
ret = "b" ; // blue 정상
|
||||
|
||||
return ret ;
|
||||
}
|
||||
|
||||
public int getSna(int t) {
|
||||
return sna[t];
|
||||
}
|
||||
|
||||
public void setSna(int t, int v) {
|
||||
sna[t] = v;
|
||||
}
|
||||
|
||||
public int getSocket(int t) {
|
||||
return socket[t];
|
||||
}
|
||||
|
||||
public void setSocket(int t, int v) {
|
||||
socket[t] = v;
|
||||
}
|
||||
|
||||
public int getSocket2(int t) {
|
||||
return socket2[t];
|
||||
}
|
||||
|
||||
public void setSocket2(int t, int v) {
|
||||
socket2[t] = v;
|
||||
}
|
||||
|
||||
public int getTuxedo(int t) {
|
||||
return tuxedo[t];
|
||||
}
|
||||
|
||||
public void setTuxedo(int t, int v) {
|
||||
tuxedo[t] = v;
|
||||
}
|
||||
|
||||
public int getMq(int t) {
|
||||
return mq[t];
|
||||
}
|
||||
|
||||
public void setMq(int t, int v) {
|
||||
mq[t] = v;
|
||||
}
|
||||
|
||||
public int getHttp(int t) {
|
||||
return http[t];
|
||||
}
|
||||
|
||||
public void setHttp(int t, int v) {
|
||||
http[t] = v;
|
||||
}
|
||||
|
||||
public int getEjb(int t) {
|
||||
return ejb[t];
|
||||
}
|
||||
|
||||
public void setEjb(int t, int v) {
|
||||
ejb[t] = v;
|
||||
}
|
||||
|
||||
public int getTotal(int t) {
|
||||
return total[t];
|
||||
}
|
||||
|
||||
public void setTotal(int t, int v) {
|
||||
total[t] = v;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the service
|
||||
*/
|
||||
public String getService() {
|
||||
return service;
|
||||
}
|
||||
|
||||
|
||||
public String getDisconAdaptersGroup() {
|
||||
return disconAdaptersGroup;
|
||||
}
|
||||
|
||||
public void setDisconAdaptersGroup(String disconAdaptersGroup) {
|
||||
this.disconAdaptersGroup = disconAdaptersGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param service the service to set
|
||||
*/
|
||||
public void setService(String service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AdaptersVO [service=" + service + ", sna=" + Arrays.toString(sna) + ", socket="
|
||||
+ Arrays.toString(socket) + ", socket2=" + Arrays.toString(socket2) + ", tuxedo="
|
||||
+ Arrays.toString(tuxedo) + ", mq=" + Arrays.toString(mq) + ", http=" + Arrays.toString(http) + ", ejb="
|
||||
+ Arrays.toString(ejb) + ", total=" + Arrays.toString(total) + ", disconAdaptersGroup="
|
||||
+ disconAdaptersGroup + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
package com.eactive.eai.rms.onl.vo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The Class EAIEngineStatusVo.
|
||||
* <ul>
|
||||
* <li>1. Function :</li>
|
||||
* <li>2. Summary :</li>
|
||||
* <li>3. Notification :</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author : $Author: 박기섭 $
|
||||
* @version : $Revision: 1.6 $
|
||||
*/
|
||||
public class EAIEngineStatusVo extends MonitorDataVo {
|
||||
|
||||
private static final long serialVersionUID = -5013332658305212088L;
|
||||
|
||||
public static final int JMS_STATUS_NOMAL = 2;
|
||||
public static final int JMS_STATUS_WARN = 1;
|
||||
public static final int JMS_STATUS_FATAL = 0;
|
||||
public static final String JMS_STATUS_NOMAL_STR = "정상";
|
||||
public static final String JMS_STATUS_WARN_STR = "경고";
|
||||
public static final String JMS_STATUS_FATAL_STR = "장애";
|
||||
|
||||
String service = "";
|
||||
|
||||
// Server State Field
|
||||
private String serverName = null;
|
||||
private int port = 0;
|
||||
private String address = null;
|
||||
private long openSocketsCurrentCount = 0;
|
||||
private int acceptBacklog = 0;
|
||||
|
||||
// TotalState Field
|
||||
private String serverState = null;
|
||||
private int serverStateImage = 0;
|
||||
private int memoryState = 0;
|
||||
private int jmsState = 0;
|
||||
private int ejbState = 0;
|
||||
private int jdbcState = 0;
|
||||
private int jmsFileStoreStatus = 0;
|
||||
|
||||
// QUEUE
|
||||
private int pendingRequestCurrentCount = 0;
|
||||
|
||||
// MEMORY
|
||||
private long heapFreeCurrent = 0;
|
||||
private long heapSizeCurrent = 0;
|
||||
private long heapSizeMax = 0;
|
||||
private int heapFreePercent = 0;
|
||||
|
||||
// JMS
|
||||
private int jmsFileStoreUseAge = 0;
|
||||
|
||||
private List jmsStatusList = null;
|
||||
|
||||
// EJB
|
||||
private List ejbPoolRuntimes = null;
|
||||
|
||||
// JDBC
|
||||
private List jdbcConnectionPoolStateList = null;
|
||||
|
||||
private boolean isAdminServer = false;
|
||||
|
||||
public int getAcceptBacklog() {
|
||||
return acceptBacklog;
|
||||
}
|
||||
|
||||
public void setAcceptBacklog(int acceptBacklog) {
|
||||
this.acceptBacklog = acceptBacklog;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public List getEjbPoolRuntimes() {
|
||||
return ejbPoolRuntimes;
|
||||
}
|
||||
|
||||
public void setEjbPoolRuntimes(List ejbPoolRuntimes) {
|
||||
this.ejbPoolRuntimes = ejbPoolRuntimes;
|
||||
}
|
||||
|
||||
public int getEjbState() {
|
||||
return ejbState;
|
||||
}
|
||||
|
||||
public void setEjbState(int ejbState) {
|
||||
this.ejbState = ejbState;
|
||||
}
|
||||
|
||||
public long getHeapFreeCurrent() {
|
||||
return heapFreeCurrent;
|
||||
}
|
||||
|
||||
public void setHeapFreeCurrent(long heapFreeCurrent) {
|
||||
this.heapFreeCurrent = heapFreeCurrent;
|
||||
}
|
||||
|
||||
public long getHeapSizeCurrent() {
|
||||
return heapSizeCurrent;
|
||||
}
|
||||
|
||||
public void setHeapSizeCurrent(long heapSizeCurrent) {
|
||||
this.heapSizeCurrent = heapSizeCurrent;
|
||||
}
|
||||
|
||||
public boolean isAdminServer() {
|
||||
return isAdminServer;
|
||||
}
|
||||
|
||||
public void setAdminServer(boolean isAdminServer) {
|
||||
this.isAdminServer = isAdminServer;
|
||||
}
|
||||
|
||||
public List getJdbcConnectionPoolStateList() {
|
||||
return jdbcConnectionPoolStateList;
|
||||
}
|
||||
|
||||
public void setJdbcConnectionPoolStateList(List jdbcConnectionPoolStateList) {
|
||||
this.jdbcConnectionPoolStateList = jdbcConnectionPoolStateList;
|
||||
}
|
||||
|
||||
public int getJdbcState() {
|
||||
return jdbcState;
|
||||
}
|
||||
|
||||
public void setJdbcState(int jdbcState) {
|
||||
this.jdbcState = jdbcState;
|
||||
}
|
||||
|
||||
public int getJmsFileStoreStatus() {
|
||||
return jmsFileStoreStatus;
|
||||
}
|
||||
|
||||
public void setJmsFileStoreStatus(int jmsFileStoreStatus) {
|
||||
this.jmsFileStoreStatus = jmsFileStoreStatus;
|
||||
}
|
||||
|
||||
public int getJmsState() {
|
||||
return jmsState;
|
||||
}
|
||||
|
||||
public void setJmsState(int jmsState) {
|
||||
this.jmsState = jmsState;
|
||||
}
|
||||
|
||||
public List getJmsStatusList() {
|
||||
return jmsStatusList;
|
||||
}
|
||||
|
||||
public void setJmsStatusList(List jmsStatusList) {
|
||||
this.jmsStatusList = jmsStatusList;
|
||||
}
|
||||
|
||||
public int getMemoryState() {
|
||||
return memoryState;
|
||||
}
|
||||
|
||||
public void setMemoryState(int memoryState) {
|
||||
this.memoryState = memoryState;
|
||||
}
|
||||
|
||||
public long getOpenSocketsCurrentCount() {
|
||||
return openSocketsCurrentCount;
|
||||
}
|
||||
|
||||
public void setOpenSocketsCurrentCount(long openSocketsCurrentCount) {
|
||||
this.openSocketsCurrentCount = openSocketsCurrentCount;
|
||||
}
|
||||
|
||||
public int getPendingRequestCurrentCount() {
|
||||
return pendingRequestCurrentCount;
|
||||
}
|
||||
|
||||
public void setPendingRequestCurrentCount(int pendingRequestCurrentCount) {
|
||||
this.pendingRequestCurrentCount = pendingRequestCurrentCount;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getServerName() {
|
||||
return serverName;
|
||||
}
|
||||
|
||||
public void setServerName(String serverName) {
|
||||
this.serverName = serverName;
|
||||
}
|
||||
|
||||
public String getServerState() {
|
||||
return serverState;
|
||||
}
|
||||
|
||||
public void setServerState(String serverState) {
|
||||
this.serverState = serverState;
|
||||
}
|
||||
|
||||
public int getServerStateImage() {
|
||||
return serverStateImage;
|
||||
}
|
||||
|
||||
public void setServerStateImage(int serverStateImage) {
|
||||
this.serverStateImage = serverStateImage;
|
||||
}
|
||||
|
||||
public int getJmsFileStoreUseAge() {
|
||||
return jmsFileStoreUseAge;
|
||||
}
|
||||
|
||||
public void setJmsFileStoreUseAge(int jmsFileStoreUseAge) {
|
||||
this.jmsFileStoreUseAge = jmsFileStoreUseAge;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the service
|
||||
*/
|
||||
public String getService() {
|
||||
return service;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param service the service to set
|
||||
*/
|
||||
public void setService(String service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
public long getHeapSizeMax() {
|
||||
return heapSizeMax;
|
||||
}
|
||||
|
||||
public void setHeapSizeMax(long heapSizeMax) {
|
||||
this.heapSizeMax = heapSizeMax;
|
||||
}
|
||||
|
||||
public int getHeapFreePercent() {
|
||||
return heapFreePercent;
|
||||
}
|
||||
|
||||
public void setHeapFreePercent(int heapFreePercent) {
|
||||
this.heapFreePercent = heapFreePercent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EAIEngineStatusVo [service=" + service + ", serverName=" + serverName + ", port=" + port + ", address="
|
||||
+ address + ", openSocketsCurrentCount=" + openSocketsCurrentCount + ", acceptBacklog=" + acceptBacklog
|
||||
+ ", serverState=" + serverState + ", serverStateImage=" + serverStateImage + ", memoryState="
|
||||
+ memoryState + ", jmsState=" + jmsState + ", ejbState=" + ejbState + ", jdbcState=" + jdbcState
|
||||
+ ", jmsFileStoreStatus=" + jmsFileStoreStatus + ", pendingRequestCurrentCount="
|
||||
+ pendingRequestCurrentCount + ", heapFreeCurrent=" + heapFreeCurrent + ", heapSizeCurrent="
|
||||
+ heapSizeCurrent + ", heapSizeMax=" + heapSizeMax + ", heapFreePercent=" + heapFreePercent
|
||||
+ ", jmsFileStoreUseAge=" + jmsFileStoreUseAge + ", jmsStatusList=" + jmsStatusList
|
||||
+ ", ejbPoolRuntimes=" + ejbPoolRuntimes + ", jdbcConnectionPoolStateList="
|
||||
+ jdbcConnectionPoolStateList + ", isAdminServer=" + isAdminServer + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.eactive.eai.rms.onl.vo;
|
||||
|
||||
/**
|
||||
* The Class HostStatusVo.
|
||||
* <ul>
|
||||
* <li>1. Function :HOST의 정보를 구성 하는 VO 모든 값은 Percentage입니다. </li>
|
||||
* <li>2. Summary :</li>
|
||||
* <li>3. Notification :</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author : $Author: 박기섭 $
|
||||
* @version : $Revision: 1.1 $
|
||||
*/
|
||||
public class HostStatusVo extends MonitorDataVo {
|
||||
|
||||
/** The Constant serialVersionUID. */
|
||||
private static final long serialVersionUID = -4047295946876814487L;
|
||||
|
||||
/** The cpu. */
|
||||
private int cpu;
|
||||
|
||||
/** The memory. */
|
||||
private int memory;
|
||||
|
||||
/** The disk. */
|
||||
private int disk;
|
||||
|
||||
/**
|
||||
* Gets the cpu.
|
||||
*
|
||||
* @return the cpu
|
||||
*/
|
||||
public int getCpu() {
|
||||
return cpu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cpu.
|
||||
*
|
||||
* @param cpu the new cpu
|
||||
*/
|
||||
public void setCpu(int cpu) {
|
||||
this.cpu = cpu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the memory.
|
||||
*
|
||||
* @return the memory
|
||||
*/
|
||||
public int getMemory() {
|
||||
return memory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the memory.
|
||||
*
|
||||
* @param memory the new memory
|
||||
*/
|
||||
public void setMemory(int memory) {
|
||||
this.memory = memory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the disk.
|
||||
*
|
||||
* @return the disk
|
||||
*/
|
||||
public int getDisk() {
|
||||
return disk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the disk.
|
||||
*
|
||||
* @param disk the new disk
|
||||
*/
|
||||
public void setDisk(int disk) {
|
||||
this.disk = disk;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HostStatusVo [cpu=" + cpu + ", memory=" + memory + ", disk=" + disk + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
package com.eactive.eai.rms.onl.vo;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
public class ItsmVo extends MonitorDataVo {
|
||||
|
||||
// Monitoring time : YYYYmmddhhmmss
|
||||
private String time ;
|
||||
|
||||
// hostName <- use base class
|
||||
|
||||
// cpu use
|
||||
private String cpu ;
|
||||
|
||||
// memory usage
|
||||
private String memory ;
|
||||
|
||||
// network in bps
|
||||
private String in ;
|
||||
|
||||
// network out bps
|
||||
private String out ;
|
||||
|
||||
// disk swap usage
|
||||
private String swap ;
|
||||
|
||||
// disk useage
|
||||
private String disk ;
|
||||
|
||||
|
||||
// ITSM 서비스별 거래건수 관련 코드 ( 내부:07, 일괄:08, 대외:09, 공동:10 )
|
||||
private String code ;
|
||||
|
||||
// 서비스별 거래건수
|
||||
private int tranCount ;
|
||||
|
||||
// 그룹사코드
|
||||
private String groupCoCd;
|
||||
|
||||
|
||||
public String getGroupCoCd() {
|
||||
return groupCoCd;
|
||||
}
|
||||
|
||||
public void setGroupCoCd(String groupCoCd) {
|
||||
this.groupCoCd = groupCoCd;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the code
|
||||
*/
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param code the code to set
|
||||
*/
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the tranCount
|
||||
*/
|
||||
public int getTranCount() {
|
||||
return tranCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tranCount the tranCount to set
|
||||
*/
|
||||
public void setTranCount(int tranCount) {
|
||||
this.tranCount = tranCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the time
|
||||
*/
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param time the time to set
|
||||
*/
|
||||
public void setTime(String time) {
|
||||
if( time != null ) {
|
||||
this.time = time ;
|
||||
return ;
|
||||
}
|
||||
|
||||
Calendar cal = Calendar.getInstance( );
|
||||
|
||||
|
||||
// 14자리 포맷
|
||||
this.time = String.format("%04d%02d%02d%02d%02d%02d",
|
||||
cal.get(Calendar.YEAR),
|
||||
(cal.get(Calendar.MONTH) + 1),
|
||||
cal.get(Calendar.DAY_OF_MONTH),
|
||||
|
||||
cal.get(Calendar.HOUR_OF_DAY),
|
||||
cal.get(Calendar.MINUTE),
|
||||
cal.get(Calendar.SECOND)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cpu
|
||||
*/
|
||||
public String getCpu() {
|
||||
return cpu;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cpu the cpu to set
|
||||
*/
|
||||
public void setCpu(String cpu) {
|
||||
this.cpu = cpu;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the memory
|
||||
*/
|
||||
public String getMemory() {
|
||||
return memory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param memory the memory to set
|
||||
*/
|
||||
public void setMemory(String memory) {
|
||||
this.memory = memory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the in
|
||||
*/
|
||||
public String getIn() {
|
||||
return in;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param in the in to set
|
||||
*/
|
||||
public void setIn(String in) {
|
||||
this.in = in;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the out
|
||||
*/
|
||||
public String getOut() {
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param out the out to set
|
||||
*/
|
||||
public void setOut(String out) {
|
||||
this.out = out;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the swap
|
||||
*/
|
||||
public String getSwap() {
|
||||
return swap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param swap the swap to set
|
||||
*/
|
||||
public void setSwap(String swap) {
|
||||
this.swap = swap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the disk
|
||||
*/
|
||||
public String getDisk() {
|
||||
return disk;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param disk the disk to set
|
||||
*/
|
||||
public void setDisk(String disk) {
|
||||
this.disk = disk;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
sb.append( "time=" + getTime() );
|
||||
sb.append( ", cpu=" + getCpu() );
|
||||
sb.append( ", memory=" + getMemory() );
|
||||
sb.append( ", in=" + getIn() );
|
||||
sb.append( ", out=" + getOut() );
|
||||
sb.append( ", swap=" + getSwap() );
|
||||
sb.append( ", disk=" + getDisk() );
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.eactive.eai.rms.onl.vo;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class JmsMonitorVo extends MonitorDataVo{
|
||||
|
||||
private HashMap data = new HashMap();
|
||||
|
||||
private String queueName ;
|
||||
private String info[] = new String[9];
|
||||
|
||||
/**
|
||||
* UDP 통신할때 에만 사용한다.
|
||||
* @return the queueName
|
||||
*/
|
||||
public String getUdpQueueName() {
|
||||
return queueName;
|
||||
}
|
||||
|
||||
/**
|
||||
* UDP 통신 할때 에만 사용한다.
|
||||
* @param queueName the queueName to set
|
||||
*/
|
||||
public void setUdpQueueName(String queueName) {
|
||||
this.queueName = queueName;
|
||||
}
|
||||
|
||||
/**
|
||||
* UDP 통신할때 에만 사용한다.
|
||||
* @return the info
|
||||
*/
|
||||
public String[] getUdpInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* UDP 통신할때 에만 사용한다.
|
||||
* @param info the info to set
|
||||
*/
|
||||
public void setUdpInfo(String[] info) {
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 전체 HashMap 데이터를 리턴한다.
|
||||
* @return the data
|
||||
*/
|
||||
public HashMap getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 전체 데이터를 업데이트한다.
|
||||
* @param data the data to set
|
||||
*/
|
||||
public void setData(HashMap data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue name 에 해당하는 정보 리스트를 리턴한다.
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public String[] getJmsVo( String name ) {
|
||||
return (String[])data.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue name 에 해당하는 정보 리스트를 업데이트 한다.
|
||||
* @param name
|
||||
* @param info
|
||||
*/
|
||||
public void setArrayData( String name, String[] info ) {
|
||||
data.put(name, info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "JmsMonitorVo [data=" + data + ", queueName=" + queueName + ", info=" + Arrays.toString(info) + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.eactive.eai.rms.onl.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* The Class MonitorDataVo.
|
||||
* <ul>
|
||||
* <li>1. Function : UDP/IP로 모니터링 서버로 송수신 되는 모든 객체의 super class입니다.</li>
|
||||
* <li>2. Summary :UDP/IP로 모니터링 서버로 송수신 되는 모든 객체는 이 클래스를 상속 받아야 합니다. </li>
|
||||
* <li>3. Notification :</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author : $Author: 박기섭 $
|
||||
* @version : $Revision: 1.2 $
|
||||
*/
|
||||
public abstract class MonitorDataVo implements Serializable {
|
||||
|
||||
/** The hostname. */
|
||||
private String hostName;
|
||||
|
||||
/** The inst name. */
|
||||
private String instanceName;
|
||||
|
||||
/** The category. */
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* Gets the host name.
|
||||
*
|
||||
* @return the host name
|
||||
*/
|
||||
public String getHostName() {
|
||||
return hostName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the host name.
|
||||
*
|
||||
* @param hostName the new host name
|
||||
*/
|
||||
public void setHostName(String hostName) {
|
||||
this.hostName = hostName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the inst name.
|
||||
*
|
||||
* @return the inst name
|
||||
*/
|
||||
public String getInstanceName() {
|
||||
return instanceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the inst name.
|
||||
*
|
||||
* @param instName the new inst name
|
||||
*/
|
||||
public void setInstanceName(String instName) {
|
||||
this.instanceName = instName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the category.
|
||||
*
|
||||
* @return the category
|
||||
*/
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the category.
|
||||
*
|
||||
* @param category the new category
|
||||
*/
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new monitor data vo.
|
||||
*/
|
||||
public MonitorDataVo() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.eactive.eai.rms.onl.vo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SmsVO extends MonitorDataVo {
|
||||
|
||||
/**
|
||||
* {@see com.eactive.eai.rms.common.datasource.ServiceType#getKey()}
|
||||
*/
|
||||
private String service;
|
||||
|
||||
// ¸Þ½ÃÁö
|
||||
private List<String> message;
|
||||
|
||||
/**
|
||||
* @return the service
|
||||
*/
|
||||
public String getService() {
|
||||
return service;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param service
|
||||
* the service to set
|
||||
*/
|
||||
public void setService(String service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the message
|
||||
*/
|
||||
public List<String> getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list
|
||||
* the message to set
|
||||
*/
|
||||
public void setMessage(List<String> list) {
|
||||
this.message = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SmsVO [service=" + service + ", message=" + message + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.eactive.eai.rms.onl.vo;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.eactive.eai.common.monitor.MonitorVO;
|
||||
|
||||
public class TransactionSendVo extends MonitorDataVo {
|
||||
|
||||
private String cmd;
|
||||
|
||||
private String key1;
|
||||
|
||||
private String key2;
|
||||
|
||||
private MonitorVO vo;
|
||||
|
||||
/**
|
||||
* 서버로 부터 수신받은 MonitorVO 객체들은 저장해 두기 위한 임시 저장소
|
||||
* UDP 통신시 에는 NULL 상태 이다.
|
||||
*/
|
||||
private HashMap<String, HashMap<String,MonitorVO>> mapRepo;
|
||||
|
||||
/**
|
||||
* @return the cmd
|
||||
*/
|
||||
public String getCmd() {
|
||||
return cmd;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cmd the cmd to set
|
||||
*/
|
||||
public void setCmd(String cmd) {
|
||||
this.cmd = cmd;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the key1
|
||||
*/
|
||||
public String getKey1() {
|
||||
return key1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key1 the key1 to set
|
||||
*/
|
||||
public void setKey1(String key1) {
|
||||
this.key1 = key1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the key2
|
||||
*/
|
||||
public String getKey2() {
|
||||
return key2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key2 the key2 to set
|
||||
*/
|
||||
public void setKey2(String key2) {
|
||||
this.key2 = key2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vo
|
||||
*/
|
||||
public MonitorVO getVo() {
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vo the vo to set
|
||||
*/
|
||||
public void setVo(MonitorVO vo) {
|
||||
this.vo = vo;
|
||||
}
|
||||
|
||||
public HashMap<String, HashMap<String,MonitorVO>> getMapRepo() {
|
||||
if( mapRepo == null ) {
|
||||
//최초 요청시
|
||||
mapRepo = new HashMap<String, HashMap<String,MonitorVO>>();
|
||||
}
|
||||
return mapRepo;
|
||||
}
|
||||
|
||||
public void setMapRepo( String key1, String key2, MonitorVO vo ) {
|
||||
if( mapRepo == null ) {
|
||||
mapRepo = new HashMap<String, HashMap<String,MonitorVO>>();
|
||||
}
|
||||
|
||||
HashMap<String,MonitorVO> map = mapRepo.get(key1);
|
||||
if( map == null ) {
|
||||
map = new HashMap<String,MonitorVO>();
|
||||
map.put(key2, vo);
|
||||
mapRepo.put(key1, map);
|
||||
} else {
|
||||
map.put(key2, vo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TransactionSendVo [cmd=" + cmd + ", key1=" + key1 + ", key2=" + key2 + ", vo=" + vo + ", mapRepo="
|
||||
+ mapRepo + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.ext.eai.common.stdmessage;
|
||||
|
||||
import com.eactive.eai.common.property.PropManager;
|
||||
|
||||
//. 기능 : STD 표준전문에서 사용하는 상수를 정의
|
||||
public class STDMessageErrorKeys {
|
||||
private static final String STDMESSAGE_ERROR_CODE ="STDMESSAGE_ERROR_CODE";
|
||||
private static final String SUCCESS_CODE ="SUCCESS_CODE";
|
||||
private static final String SUCCESS_MSG ="SUCCESS_MSG";
|
||||
private static final String SYSTEM_ERROR_CODE ="SYSTEM_ERROR_CODE";
|
||||
private static final String SYSTEM_ERROR_MSG ="SYSTEM_ERROR_MSG";
|
||||
private static final String TIMEOUT_ERROR_CODE ="TIMEOUT_ERROR_CODE";
|
||||
private static final String TIMEOUT_ERROR_MSG ="TIMEOUT_ERROR_MSG";
|
||||
private static final String BIZ_ERROR_CODE ="BIZ_ERROR_CODE";
|
||||
private static final String BIZ_ERROR_MSG ="BIZ_ERROR_MSG";
|
||||
private static final String DUP_LOGIN_ERROR_CODE ="DUP_LOGIN_ERROR_CODE";
|
||||
private static final String DUP_LOGIN_ERROR_MSG ="DUP_LOGIN_ERROR_MSG";
|
||||
private static final String NOT_LOGIN_ERROR_CODE ="NOT_LOGIN_ERROR_CODE";
|
||||
private static final String NOT_LOGIN_ERROR_MSG ="NOT_LOGIN_ERROR_MSG";
|
||||
private static final String APPROVE_ERROR_CODE ="APPROVE_ERROR_CODE";
|
||||
private static final String APPROVE_ERROR_MSG ="APPROVE_ERROR_MSG";
|
||||
private static final String APPROVE_NOT_FOUND_ERROR_CODE ="APPROVE_NOT_FOUND_ERROR_CODE";
|
||||
private static final String APPROVE_NOT_FOUND_ERROR_MSG ="APPROVE_NOT_FOUND_ERROR_MSG";
|
||||
private static final String UUID_MISMATCH_ERROR_CODE ="UUID_MISMATCH_ERROR_CODE";
|
||||
private static final String UUID_MISMATCH_ERROR_MSG ="UUID_MISMATCH_ERROR_MSG";
|
||||
private static final String VALID_VALUE_ERROR_CODE ="VALID_VALUE_ERROR_CODE";
|
||||
private static final String VALID_VALUE_ERROR_MSG ="VALID_VALUE_ERROR_MSG";
|
||||
private static final String RATELIMIT_ERROR_CODE ="RATELIMIT_ERROR_CODE";
|
||||
private static final String RATELIMIT_ERROR_MSG ="RATELIMIT_ERROR_MSG";
|
||||
|
||||
//사이트별 에러코드
|
||||
public static String SUCCESS_CODE_VALUE ;//성공코드
|
||||
public static String SUCCESS_MSG_VALUE ;//성공메시지
|
||||
public static String SYSTEM_ERROR_CODE_VALUE ;//시스템 에러코드
|
||||
public static String SYSTEM_ERROR_MSG_VALUE ;//시스템 에러메시지
|
||||
public static String BIZ_ERROR_CODE_VALUE ;//업무 에러코드
|
||||
public static String BIZ_ERROR_MSG_VALUE ;//업무 에러메시지
|
||||
public static String TIMEOUT_ERROR_CODE_VALUE ;//타임아웃 에러코드
|
||||
public static String TIMEOUT_ERROR_MSG_VALUE ;//타임아웃 에러메시지
|
||||
public static String DUP_LOGIN_ERROR_CODE_VALUE ;//중복로그인 에러코드
|
||||
public static String DUP_LOGIN_ERROR_MSG_VALUE ;//중복로그인 에러메시지
|
||||
public static String NOT_LOGIN_ERROR_CODE_VALUE ;//미로그인 에러코드
|
||||
public static String NOT_LOGIN_ERROR_MSG_VALUE ;//미로그인 에러메시지
|
||||
public static String APPROVE_ERROR_CODE_VALUE ;//책임자승인 에러코드
|
||||
public static String APPROVE_ERROR_MSG_VALUE ;//책임자승인 에러메시지
|
||||
public static String APPROVE_NOT_FOUND_ERROR_CODE_VALUE ;//책임자 승인자가 존재하지 않는 에러코드
|
||||
public static String APPROVE_NOT_FOUND_ERROR_MSG_VALUE ;//책임자 승인자가 존재하지 않는 에러메시지
|
||||
public static String UUID_MISMATCH_ERROR_CODE_VALUE ;//UUID가 같지 않은 에러코드
|
||||
public static String UUID_MISMATCH_ERROR_MSG_VALUE ;//UUID가 같지 않은 에러메시지
|
||||
public static String VALID_VALUE_ERROR_CODE_VALUE ;//유효값 에러코드
|
||||
public static String VALID_VALUE_ERROR_MSG_VALUE ;//유효값 에러메시지
|
||||
public static String RATELIMIT_ERROR_CODE_VALUE ;//유량제어 에러코드
|
||||
public static String RATELIMIT_ERROR_MSG_VALUE ;//유량제어 에러메시지
|
||||
|
||||
//기존 오류코드는 900400 과 900401만 사용했음
|
||||
static {
|
||||
PropManager manager = PropManager.getInstance();
|
||||
SUCCESS_CODE_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,SUCCESS_CODE,"900000");
|
||||
SUCCESS_MSG_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,SUCCESS_MSG,"정상 처리되었습니다.");
|
||||
SYSTEM_ERROR_CODE_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,SYSTEM_ERROR_CODE,"900400");
|
||||
SYSTEM_ERROR_MSG_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,SYSTEM_ERROR_MSG,"시스템오류가 발생하였습니다.");
|
||||
TIMEOUT_ERROR_CODE_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,TIMEOUT_ERROR_CODE,"900401");
|
||||
TIMEOUT_ERROR_MSG_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,TIMEOUT_ERROR_MSG,"타임아웃오류가 발생하였습니다.");
|
||||
BIZ_ERROR_CODE_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,BIZ_ERROR_CODE,"900402");
|
||||
BIZ_ERROR_MSG_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,BIZ_ERROR_MSG,"업무오류가 발생하였습니다.");
|
||||
DUP_LOGIN_ERROR_CODE_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,DUP_LOGIN_ERROR_CODE,"900403");
|
||||
DUP_LOGIN_ERROR_MSG_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,DUP_LOGIN_ERROR_MSG,"중복로그인오류가 발생하였습니다.");
|
||||
NOT_LOGIN_ERROR_CODE_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,NOT_LOGIN_ERROR_CODE,"900404");
|
||||
NOT_LOGIN_ERROR_MSG_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,NOT_LOGIN_ERROR_MSG,"미로그인오류가 발생하였습니다.");
|
||||
APPROVE_ERROR_CODE_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,APPROVE_ERROR_CODE,"900405");
|
||||
APPROVE_ERROR_MSG_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,APPROVE_ERROR_MSG,"책임자가 시간내 승인을 하지 않았습니다.");
|
||||
APPROVE_NOT_FOUND_ERROR_CODE_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,APPROVE_NOT_FOUND_ERROR_CODE,"900406");
|
||||
APPROVE_NOT_FOUND_ERROR_MSG_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,APPROVE_NOT_FOUND_ERROR_MSG,"책임자가 승인자가 존재하지 않습니다.");
|
||||
UUID_MISMATCH_ERROR_CODE_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,UUID_MISMATCH_ERROR_CODE,"900407");
|
||||
UUID_MISMATCH_ERROR_MSG_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,UUID_MISMATCH_ERROR_MSG,"MCI 세션ID가 같지않은 오류가 발생하였습니다.");
|
||||
VALID_VALUE_ERROR_CODE_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,VALID_VALUE_ERROR_CODE,"900408");
|
||||
VALID_VALUE_ERROR_MSG_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,VALID_VALUE_ERROR_MSG,"유효값 오류가 발생하였습니다.");
|
||||
RATELIMIT_ERROR_CODE_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,RATELIMIT_ERROR_CODE,"900409");
|
||||
RATELIMIT_ERROR_MSG_VALUE = manager.getProperty(STDMESSAGE_ERROR_CODE,RATELIMIT_ERROR_MSG,"RateLimiter Overflow");
|
||||
}
|
||||
|
||||
private STDMessageErrorKeys() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.ext.eai.common.stdmessage;
|
||||
|
||||
/**
|
||||
* 1. 기능 : STD 표준전문에서 사용하는 상수를 정의
|
||||
* 2. 처리 개요 : STD 표준전문에서 사용하는 상수를 정의
|
||||
* 3. 주의사항 :
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see :
|
||||
* @since :
|
||||
* :
|
||||
*/
|
||||
public interface STDMessageKeys {
|
||||
|
||||
// 내외부 구분코드
|
||||
public static final String DIRECTION_IN = "1";
|
||||
public static final String DIRECTION_INA = "A";
|
||||
public static final String DIRECTION_EX = "2";
|
||||
|
||||
//원거래복원여부
|
||||
public static final String RECOVER_YN_NO = "0";
|
||||
public static final String RECOVER_YN_YES = "1";
|
||||
|
||||
// 전문요청구분코드
|
||||
public static final String SEND_RECV_CD_SEND = "S";
|
||||
public static final String SEND_RECV_CD_RECV = "R";
|
||||
|
||||
//거래처리구분코드
|
||||
public static final String SYNC_ASYNC_CD_SYNC = "S";
|
||||
public static final String SYNC_ASYNC_CD_ASYNC = "A";
|
||||
|
||||
|
||||
public static final String CNTERDSTCD_MAIN = "1";
|
||||
public static final String CNTERDSTCD_DR = "2";
|
||||
|
||||
public static final String OPERATION_ENV_PRODUCT = "O";
|
||||
public static final String OPERATION_ENV_TESTSTAGE = "S";
|
||||
public static final String OPERATION_ENV_DEV = "D";
|
||||
public static final String OPERATION_ENV_DR = "R";
|
||||
public static final String OPERATION_ENV_LOCAL = "L";//로컬
|
||||
public static final String OPERATION_ENV_SIM = "E";//시뮬레이터
|
||||
|
||||
public static final String OUTPUT_TYPE_DEF = "00";
|
||||
public static final String OUTPUT_TYPE_OK = "01";
|
||||
public static final String OUTPUT_TYPE_ERR = "02";
|
||||
|
||||
//응답결과구분코드
|
||||
public static final String RESPONSE_TYPE_CODE_N = "0";//정상(normal)
|
||||
public static final String RESPONSE_TYPE_CODE_E = "1";//오류(error)
|
||||
public static final String RESPONSE_TYPE_CODE_C = "1";//대상시스템연결오류(connect fail)
|
||||
public static final String RESPONSE_TYPE_CODE_T = "1";//타임아웃(timeout)
|
||||
public static final String RESPONSE_TYPE_CODE_F = "1";//시스템오류(fatal)
|
||||
|
||||
|
||||
|
||||
//사이트별 에러코드
|
||||
// public static final String ERROR_CODE_VALUE = "900400";//일반
|
||||
// public static final String TIMEOUT_CODE_VALUE = "900401";//타임아웃
|
||||
public static final String ERROR_CODE_VALUE = "9000400";//일반
|
||||
public static final String TIMEOUT_CODE_VALUE = "9000401";//타임아웃
|
||||
|
||||
// Push 구분자 코드
|
||||
public static final String PUSH_DVSN_CD_S = "S";// Single
|
||||
public static final String PUSH_DVSN_CD_R = "R";// 청단위
|
||||
public static final String PUSH_DVSN_CD_B = "B";// 국단위
|
||||
public static final String PUSH_DVSN_CD_A = "A";// 전체
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.*;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
|
||||
/**
|
||||
* The persistent class for the std_msg_lout database table.
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="std_msg_lout")
|
||||
@NamedQuery(name="StdMsgLout.findAll", query="SELECT s FROM StdMsgLout s")
|
||||
public class StdMsgLout implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Column(name="layout_name", unique=true, nullable=false, length=500)
|
||||
private String layoutName;
|
||||
|
||||
@Column(name="create_datetime", nullable=false)
|
||||
private Timestamp createDatetime;
|
||||
|
||||
@Column(name="layout_desc", length=1000)
|
||||
private String layoutDesc;
|
||||
|
||||
@Column(name="update_datetime", nullable=false)
|
||||
private Timestamp updateDatetime;
|
||||
|
||||
@Column(name="writer_name", nullable=false, length=1000)
|
||||
private String writerName;
|
||||
|
||||
public StdMsgLout() {
|
||||
}
|
||||
|
||||
public String getLayoutName() {
|
||||
return this.layoutName;
|
||||
}
|
||||
|
||||
public void setLayoutName(String layoutName) {
|
||||
this.layoutName = layoutName;
|
||||
}
|
||||
|
||||
public Timestamp getCreateDatetime() {
|
||||
return this.createDatetime;
|
||||
}
|
||||
|
||||
public void setCreateDatetime(Timestamp createDatetime) {
|
||||
this.createDatetime = createDatetime;
|
||||
}
|
||||
|
||||
public String getLayoutDesc() {
|
||||
return this.layoutDesc;
|
||||
}
|
||||
|
||||
public void setLayoutDesc(String layoutDesc) {
|
||||
this.layoutDesc = layoutDesc;
|
||||
}
|
||||
|
||||
public Timestamp getUpdateDatetime() {
|
||||
return this.updateDatetime;
|
||||
}
|
||||
|
||||
public void setUpdateDatetime(Timestamp updateDatetime) {
|
||||
this.updateDatetime = updateDatetime;
|
||||
}
|
||||
|
||||
public String getWriterName() {
|
||||
return this.writerName;
|
||||
}
|
||||
|
||||
public void setWriterName(String writerName) {
|
||||
this.writerName = writerName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.*;
|
||||
|
||||
|
||||
/**
|
||||
* The persistent class for the std_msg_lout_deploy database table.
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="std_msg_lout_deploy")
|
||||
@NamedQuery(name="StdMsgLoutDeploy.findAll", query="SELECT s FROM StdMsgLoutDeploy s")
|
||||
public class StdMsgLoutDeploy implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(name="layout_name", nullable=false, length=500)
|
||||
private String layoutName;
|
||||
|
||||
public StdMsgLoutDeploy() {
|
||||
}
|
||||
|
||||
public String getLayoutName() {
|
||||
return this.layoutName;
|
||||
}
|
||||
|
||||
public void setLayoutName(String layoutName) {
|
||||
this.layoutName = layoutName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.*;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
|
||||
/**
|
||||
* The persistent class for the std_msg_lout_hist database table.
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="std_msg_lout_hist")
|
||||
@NamedQuery(name="StdMsgLoutHist.findAll", query="SELECT s FROM StdMsgLoutHist s")
|
||||
public class StdMsgLoutHist implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Column(name="operation_seq", unique=true, nullable=false)
|
||||
private Integer operationSeq;
|
||||
|
||||
@Column(name="item_list_data", length=2147483647)
|
||||
private String itemListData;
|
||||
|
||||
@Column(name="layout_desc", length=1000)
|
||||
private String layoutDesc;
|
||||
|
||||
@Column(name="layout_name", nullable=false, length=500)
|
||||
private String layoutName;
|
||||
|
||||
@Column(name="operation_datetime", nullable=false)
|
||||
private Timestamp operationDatetime;
|
||||
|
||||
@Column(name="operation_type", nullable=false, length=100)
|
||||
private String operationType;
|
||||
|
||||
@Column(name="operator_name", nullable=false, length=1000)
|
||||
private String operatorName;
|
||||
|
||||
public StdMsgLoutHist() {
|
||||
}
|
||||
|
||||
public Integer getOperationSeq() {
|
||||
return this.operationSeq;
|
||||
}
|
||||
|
||||
public void setOperationSeq(Integer operationSeq) {
|
||||
this.operationSeq = operationSeq;
|
||||
}
|
||||
|
||||
public String getItemListData() {
|
||||
return this.itemListData;
|
||||
}
|
||||
|
||||
public void setItemListData(String itemListData) {
|
||||
this.itemListData = itemListData;
|
||||
}
|
||||
|
||||
public String getLayoutDesc() {
|
||||
return this.layoutDesc;
|
||||
}
|
||||
|
||||
public void setLayoutDesc(String layoutDesc) {
|
||||
this.layoutDesc = layoutDesc;
|
||||
}
|
||||
|
||||
public String getLayoutName() {
|
||||
return this.layoutName;
|
||||
}
|
||||
|
||||
public void setLayoutName(String layoutName) {
|
||||
this.layoutName = layoutName;
|
||||
}
|
||||
|
||||
public Timestamp getOperationDatetime() {
|
||||
return this.operationDatetime;
|
||||
}
|
||||
|
||||
public void setOperationDatetime(Timestamp operationDatetime) {
|
||||
this.operationDatetime = operationDatetime;
|
||||
}
|
||||
|
||||
public String getOperationType() {
|
||||
return this.operationType;
|
||||
}
|
||||
|
||||
public void setOperationType(String operationType) {
|
||||
this.operationType = operationType;
|
||||
}
|
||||
|
||||
public String getOperatorName() {
|
||||
return this.operatorName;
|
||||
}
|
||||
|
||||
public void setOperatorName(String operatorName) {
|
||||
this.operatorName = operatorName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.*;
|
||||
|
||||
|
||||
/**
|
||||
* The persistent class for the std_msg_lout_item database table.
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="std_msg_lout_item")
|
||||
@NamedQuery(name="StdMsgLoutItem.findAll", query="SELECT s FROM StdMsgLoutItem s")
|
||||
public class StdMsgLoutItem implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@EmbeddedId
|
||||
private StdMsgLoutItemPK id;
|
||||
|
||||
@Column(name="array_size", nullable=false)
|
||||
private Integer arraySize;
|
||||
|
||||
@Column(name="data_length")
|
||||
private Integer dataLength;
|
||||
|
||||
@Column(name="data_type", nullable=false)
|
||||
private Integer dataType;
|
||||
|
||||
@Column(name="default_value", length=1000)
|
||||
private String defaultValue;
|
||||
|
||||
@Column(name="field_type", nullable=false)
|
||||
private Integer fieldType;
|
||||
|
||||
@Column(name="item_desc", nullable=false, length=1000)
|
||||
private String itemDesc;
|
||||
|
||||
@Column(name="item_level", nullable=false)
|
||||
private Integer itemLevel;
|
||||
|
||||
@Column(name="item_name", nullable=false, length=500)
|
||||
private String itemName;
|
||||
|
||||
@Column(name="item_type", nullable=false)
|
||||
private Integer itemType;
|
||||
|
||||
@Column(name="ref_field_path", length=1000)
|
||||
private String refFieldPath;
|
||||
|
||||
@Column(name="ref_value", length=1000)
|
||||
private String refValue;
|
||||
|
||||
public StdMsgLoutItem() {
|
||||
}
|
||||
|
||||
public StdMsgLoutItemPK getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(StdMsgLoutItemPK id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getArraySize() {
|
||||
return this.arraySize;
|
||||
}
|
||||
|
||||
public void setArraySize(Integer arraySize) {
|
||||
this.arraySize = arraySize;
|
||||
}
|
||||
|
||||
public Integer getDataLength() {
|
||||
return this.dataLength;
|
||||
}
|
||||
|
||||
public void setDataLength(Integer dataLength) {
|
||||
this.dataLength = dataLength;
|
||||
}
|
||||
|
||||
public Integer getDataType() {
|
||||
return this.dataType;
|
||||
}
|
||||
|
||||
public void setDataType(Integer dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public String getDefaultValue() {
|
||||
return this.defaultValue;
|
||||
}
|
||||
|
||||
public void setDefaultValue(String defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public Integer getFieldType() {
|
||||
return this.fieldType;
|
||||
}
|
||||
|
||||
public void setFieldType(Integer fieldType) {
|
||||
this.fieldType = fieldType;
|
||||
}
|
||||
|
||||
public String getItemDesc() {
|
||||
return this.itemDesc;
|
||||
}
|
||||
|
||||
public void setItemDesc(String itemDesc) {
|
||||
this.itemDesc = itemDesc;
|
||||
}
|
||||
|
||||
public Integer getItemLevel() {
|
||||
return this.itemLevel;
|
||||
}
|
||||
|
||||
public void setItemLevel(Integer itemLevel) {
|
||||
this.itemLevel = itemLevel;
|
||||
}
|
||||
|
||||
public String getItemName() {
|
||||
return this.itemName;
|
||||
}
|
||||
|
||||
public void setItemName(String itemName) {
|
||||
this.itemName = itemName;
|
||||
}
|
||||
|
||||
public Integer getItemType() {
|
||||
return this.itemType;
|
||||
}
|
||||
|
||||
public void setItemType(Integer itemType) {
|
||||
this.itemType = itemType;
|
||||
}
|
||||
|
||||
public String getRefFieldPath() {
|
||||
return this.refFieldPath;
|
||||
}
|
||||
|
||||
public void setRefFieldPath(String refFieldPath) {
|
||||
this.refFieldPath = refFieldPath;
|
||||
}
|
||||
|
||||
public String getRefValue() {
|
||||
return this.refValue;
|
||||
}
|
||||
|
||||
public void setRefValue(String refValue) {
|
||||
this.refValue = refValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* The primary key class for the std_msg_lout_item database table.
|
||||
*
|
||||
*/
|
||||
@Embeddable
|
||||
public class StdMsgLoutItemPK implements Serializable {
|
||||
//default serial version id, required for serializable classes.
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(name="layout_name", unique=true, nullable=false, length=500)
|
||||
private String layoutName;
|
||||
|
||||
@Column(name="item_no", unique=true, nullable=false)
|
||||
private Integer itemNo;
|
||||
|
||||
public StdMsgLoutItemPK() {
|
||||
}
|
||||
public String getLayoutName() {
|
||||
return this.layoutName;
|
||||
}
|
||||
public void setLayoutName(String layoutName) {
|
||||
this.layoutName = layoutName;
|
||||
}
|
||||
public Integer getItemNo() {
|
||||
return this.itemNo;
|
||||
}
|
||||
public void setItemNo(Integer itemNo) {
|
||||
this.itemNo = itemNo;
|
||||
}
|
||||
|
||||
public boolean equals(Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof StdMsgLoutItemPK)) {
|
||||
return false;
|
||||
}
|
||||
StdMsgLoutItemPK castOther = (StdMsgLoutItemPK)other;
|
||||
return
|
||||
this.layoutName.equals(castOther.layoutName)
|
||||
&& this.itemNo.equals(castOther.itemNo);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int hash = 17;
|
||||
hash = hash * prime + this.layoutName.hashCode();
|
||||
hash = hash * prime + this.itemNo.hashCode();
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,329 @@
|
||||
package model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.*;
|
||||
|
||||
|
||||
/**
|
||||
* The persistent class for the tseaiad01 database table.
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="tseaiad01")
|
||||
@NamedQuery(name="Tseaiad01.findAll", query="SELECT t FROM Tseaiad01 t")
|
||||
public class Tseaiad01 implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Column(unique=true, nullable=false, length=50)
|
||||
private String adptrbzwkgroupname;
|
||||
|
||||
@Column(length=200)
|
||||
private String adptrbzwkgroupdesc;
|
||||
|
||||
@Column(length=3)
|
||||
private String adptrcd;
|
||||
|
||||
@Column(length=20)
|
||||
private String adptrinsticode;
|
||||
|
||||
@Column(length=1)
|
||||
private String adptriodstcd;
|
||||
|
||||
@Column(length=3)
|
||||
private String adptrmsgdstcd;
|
||||
|
||||
@Column(length=1)
|
||||
private String adptrmsgptrncd;
|
||||
|
||||
@Column(length=50)
|
||||
private String adptrnickname;
|
||||
|
||||
@Column(length=1)
|
||||
private String adptruseyn;
|
||||
|
||||
@Column(length=30)
|
||||
private String bidinterface;
|
||||
|
||||
@Column(length=100)
|
||||
private String cirnumber;
|
||||
|
||||
@Column(length=20)
|
||||
private String companycodedata;
|
||||
|
||||
@Column(length=1)
|
||||
private String dradptryn;
|
||||
|
||||
@Column(length=4)
|
||||
private String eaibzwkdstcd;
|
||||
|
||||
@Column(length=17)
|
||||
private String eailastamndyms;
|
||||
|
||||
@Column(length=1)
|
||||
private String eaisevrdstcd;
|
||||
|
||||
@Column(length=1)
|
||||
private String kesauseyn;
|
||||
|
||||
@Column(length=30)
|
||||
private String monicndnctnt;
|
||||
|
||||
@Column(length=1)
|
||||
private String moniuseyn;
|
||||
|
||||
@Column(length=20)
|
||||
private String msgencode;
|
||||
|
||||
@Column(length=60)
|
||||
private String osidinstibzwkrsempname;
|
||||
|
||||
@Column(length=12)
|
||||
private String osidinstino;
|
||||
|
||||
@Column(length=50)
|
||||
private String osidinstitelno;
|
||||
|
||||
@Column(length=1)
|
||||
private String osidinstiyn;
|
||||
|
||||
@Column(length=100)
|
||||
private String refclsname;
|
||||
|
||||
@Column(length=1)
|
||||
private String sndrcvhmslogyn;
|
||||
|
||||
@Column(length=1)
|
||||
private String spcfcluuseyn;
|
||||
|
||||
@Column(length=1)
|
||||
private String testmasteryn;
|
||||
|
||||
public Tseaiad01() {
|
||||
}
|
||||
|
||||
public String getAdptrbzwkgroupname() {
|
||||
return this.adptrbzwkgroupname;
|
||||
}
|
||||
|
||||
public void setAdptrbzwkgroupname(String adptrbzwkgroupname) {
|
||||
this.adptrbzwkgroupname = adptrbzwkgroupname;
|
||||
}
|
||||
|
||||
public String getAdptrbzwkgroupdesc() {
|
||||
return this.adptrbzwkgroupdesc;
|
||||
}
|
||||
|
||||
public void setAdptrbzwkgroupdesc(String adptrbzwkgroupdesc) {
|
||||
this.adptrbzwkgroupdesc = adptrbzwkgroupdesc;
|
||||
}
|
||||
|
||||
public String getAdptrcd() {
|
||||
return this.adptrcd;
|
||||
}
|
||||
|
||||
public void setAdptrcd(String adptrcd) {
|
||||
this.adptrcd = adptrcd;
|
||||
}
|
||||
|
||||
public String getAdptrinsticode() {
|
||||
return this.adptrinsticode;
|
||||
}
|
||||
|
||||
public void setAdptrinsticode(String adptrinsticode) {
|
||||
this.adptrinsticode = adptrinsticode;
|
||||
}
|
||||
|
||||
public String getAdptriodstcd() {
|
||||
return this.adptriodstcd;
|
||||
}
|
||||
|
||||
public void setAdptriodstcd(String adptriodstcd) {
|
||||
this.adptriodstcd = adptriodstcd;
|
||||
}
|
||||
|
||||
public String getAdptrmsgdstcd() {
|
||||
return this.adptrmsgdstcd;
|
||||
}
|
||||
|
||||
public void setAdptrmsgdstcd(String adptrmsgdstcd) {
|
||||
this.adptrmsgdstcd = adptrmsgdstcd;
|
||||
}
|
||||
|
||||
public String getAdptrmsgptrncd() {
|
||||
return this.adptrmsgptrncd;
|
||||
}
|
||||
|
||||
public void setAdptrmsgptrncd(String adptrmsgptrncd) {
|
||||
this.adptrmsgptrncd = adptrmsgptrncd;
|
||||
}
|
||||
|
||||
public String getAdptrnickname() {
|
||||
return this.adptrnickname;
|
||||
}
|
||||
|
||||
public void setAdptrnickname(String adptrnickname) {
|
||||
this.adptrnickname = adptrnickname;
|
||||
}
|
||||
|
||||
public String getAdptruseyn() {
|
||||
return this.adptruseyn;
|
||||
}
|
||||
|
||||
public void setAdptruseyn(String adptruseyn) {
|
||||
this.adptruseyn = adptruseyn;
|
||||
}
|
||||
|
||||
public String getBidinterface() {
|
||||
return this.bidinterface;
|
||||
}
|
||||
|
||||
public void setBidinterface(String bidinterface) {
|
||||
this.bidinterface = bidinterface;
|
||||
}
|
||||
|
||||
public String getCirnumber() {
|
||||
return this.cirnumber;
|
||||
}
|
||||
|
||||
public void setCirnumber(String cirnumber) {
|
||||
this.cirnumber = cirnumber;
|
||||
}
|
||||
|
||||
public String getCompanycodedata() {
|
||||
return this.companycodedata;
|
||||
}
|
||||
|
||||
public void setCompanycodedata(String companycodedata) {
|
||||
this.companycodedata = companycodedata;
|
||||
}
|
||||
|
||||
public String getDradptryn() {
|
||||
return this.dradptryn;
|
||||
}
|
||||
|
||||
public void setDradptryn(String dradptryn) {
|
||||
this.dradptryn = dradptryn;
|
||||
}
|
||||
|
||||
public String getEaibzwkdstcd() {
|
||||
return this.eaibzwkdstcd;
|
||||
}
|
||||
|
||||
public void setEaibzwkdstcd(String eaibzwkdstcd) {
|
||||
this.eaibzwkdstcd = eaibzwkdstcd;
|
||||
}
|
||||
|
||||
public String getEailastamndyms() {
|
||||
return this.eailastamndyms;
|
||||
}
|
||||
|
||||
public void setEailastamndyms(String eailastamndyms) {
|
||||
this.eailastamndyms = eailastamndyms;
|
||||
}
|
||||
|
||||
public String getEaisevrdstcd() {
|
||||
return this.eaisevrdstcd;
|
||||
}
|
||||
|
||||
public void setEaisevrdstcd(String eaisevrdstcd) {
|
||||
this.eaisevrdstcd = eaisevrdstcd;
|
||||
}
|
||||
|
||||
public String getKesauseyn() {
|
||||
return this.kesauseyn;
|
||||
}
|
||||
|
||||
public void setKesauseyn(String kesauseyn) {
|
||||
this.kesauseyn = kesauseyn;
|
||||
}
|
||||
|
||||
public String getMonicndnctnt() {
|
||||
return this.monicndnctnt;
|
||||
}
|
||||
|
||||
public void setMonicndnctnt(String monicndnctnt) {
|
||||
this.monicndnctnt = monicndnctnt;
|
||||
}
|
||||
|
||||
public String getMoniuseyn() {
|
||||
return this.moniuseyn;
|
||||
}
|
||||
|
||||
public void setMoniuseyn(String moniuseyn) {
|
||||
this.moniuseyn = moniuseyn;
|
||||
}
|
||||
|
||||
public String getMsgencode() {
|
||||
return this.msgencode;
|
||||
}
|
||||
|
||||
public void setMsgencode(String msgencode) {
|
||||
this.msgencode = msgencode;
|
||||
}
|
||||
|
||||
public String getOsidinstibzwkrsempname() {
|
||||
return this.osidinstibzwkrsempname;
|
||||
}
|
||||
|
||||
public void setOsidinstibzwkrsempname(String osidinstibzwkrsempname) {
|
||||
this.osidinstibzwkrsempname = osidinstibzwkrsempname;
|
||||
}
|
||||
|
||||
public String getOsidinstino() {
|
||||
return this.osidinstino;
|
||||
}
|
||||
|
||||
public void setOsidinstino(String osidinstino) {
|
||||
this.osidinstino = osidinstino;
|
||||
}
|
||||
|
||||
public String getOsidinstitelno() {
|
||||
return this.osidinstitelno;
|
||||
}
|
||||
|
||||
public void setOsidinstitelno(String osidinstitelno) {
|
||||
this.osidinstitelno = osidinstitelno;
|
||||
}
|
||||
|
||||
public String getOsidinstiyn() {
|
||||
return this.osidinstiyn;
|
||||
}
|
||||
|
||||
public void setOsidinstiyn(String osidinstiyn) {
|
||||
this.osidinstiyn = osidinstiyn;
|
||||
}
|
||||
|
||||
public String getRefclsname() {
|
||||
return this.refclsname;
|
||||
}
|
||||
|
||||
public void setRefclsname(String refclsname) {
|
||||
this.refclsname = refclsname;
|
||||
}
|
||||
|
||||
public String getSndrcvhmslogyn() {
|
||||
return this.sndrcvhmslogyn;
|
||||
}
|
||||
|
||||
public void setSndrcvhmslogyn(String sndrcvhmslogyn) {
|
||||
this.sndrcvhmslogyn = sndrcvhmslogyn;
|
||||
}
|
||||
|
||||
public String getSpcfcluuseyn() {
|
||||
return this.spcfcluuseyn;
|
||||
}
|
||||
|
||||
public void setSpcfcluuseyn(String spcfcluuseyn) {
|
||||
this.spcfcluuseyn = spcfcluuseyn;
|
||||
}
|
||||
|
||||
public String getTestmasteryn() {
|
||||
return this.testmasteryn;
|
||||
}
|
||||
|
||||
public void setTestmasteryn(String testmasteryn) {
|
||||
this.testmasteryn = testmasteryn;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.*;
|
||||
|
||||
|
||||
/**
|
||||
* The persistent class for the tseaiad02 database table.
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="tseaiad02")
|
||||
@NamedQuery(name="Tseaiad02.findAll", query="SELECT t FROM Tseaiad02 t")
|
||||
public class Tseaiad02 implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@EmbeddedId
|
||||
private Tseaiad02PK id;
|
||||
|
||||
@Column(length=200)
|
||||
private String adptrdesc;
|
||||
|
||||
@Column(length=300)
|
||||
private String eaisevrinstncname;
|
||||
|
||||
@Column(length=100)
|
||||
private String lstnerclsname;
|
||||
|
||||
@Column(length=50)
|
||||
private String prptygroupname;
|
||||
|
||||
@Column(length=100)
|
||||
private String testclsname;
|
||||
|
||||
public Tseaiad02() {
|
||||
}
|
||||
|
||||
public Tseaiad02PK getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Tseaiad02PK id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAdptrdesc() {
|
||||
return this.adptrdesc;
|
||||
}
|
||||
|
||||
public void setAdptrdesc(String adptrdesc) {
|
||||
this.adptrdesc = adptrdesc;
|
||||
}
|
||||
|
||||
public String getEaisevrinstncname() {
|
||||
return this.eaisevrinstncname;
|
||||
}
|
||||
|
||||
public void setEaisevrinstncname(String eaisevrinstncname) {
|
||||
this.eaisevrinstncname = eaisevrinstncname;
|
||||
}
|
||||
|
||||
public String getLstnerclsname() {
|
||||
return this.lstnerclsname;
|
||||
}
|
||||
|
||||
public void setLstnerclsname(String lstnerclsname) {
|
||||
this.lstnerclsname = lstnerclsname;
|
||||
}
|
||||
|
||||
public String getPrptygroupname() {
|
||||
return this.prptygroupname;
|
||||
}
|
||||
|
||||
public void setPrptygroupname(String prptygroupname) {
|
||||
this.prptygroupname = prptygroupname;
|
||||
}
|
||||
|
||||
public String getTestclsname() {
|
||||
return this.testclsname;
|
||||
}
|
||||
|
||||
public void setTestclsname(String testclsname) {
|
||||
this.testclsname = testclsname;
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user