Compare commits
No commits in common. "adcefa1bbab0521138353c4ce9ee9d68b4eafa8b" and "f0c1dce2358642ddcc566407631cce98892e34c1" have entirely different histories.
adcefa1bba
...
f0c1dce235
130
build.gradle
130
build.gradle
|
@ -1,130 +0,0 @@
|
|||
apply plugin: 'war'
|
||||
apply plugin: "maven-publish"
|
||||
apply plugin: "signing"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(8)
|
||||
}
|
||||
}
|
||||
|
||||
project.version "2.0.0-SNAPSHOT"
|
||||
group "net.brutex.xservices"
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
|
||||
maven {
|
||||
name = 'LocalRemote'
|
||||
def releasesRepoUrl = 'https://archiva.brutex.net/repository/internal/'
|
||||
def snapshotsRepoUrl = 'https://archiva.brutex.net/repository/snapshots/'
|
||||
url = project.version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
|
||||
allowInsecureProtocol = false
|
||||
credentials {
|
||||
username = mavenuser
|
||||
password = mavenpass
|
||||
}
|
||||
}
|
||||
|
||||
maven {
|
||||
name = 'OSSRH'
|
||||
def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
|
||||
def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
|
||||
url = project.version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
|
||||
credentials {
|
||||
username = ossrhUsername
|
||||
password = ossrhPassword
|
||||
}
|
||||
}
|
||||
|
||||
maven {
|
||||
name = 'brutexGitea'
|
||||
def releasesRepoUrl = 'https://source.brutex.net/api/packages/brutex/maven'
|
||||
def snapshotsRepoUrl = 'https://source.brutex.net/api/packages/brutex/maven'
|
||||
url = project.version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
|
||||
allowInsecureProtocol = false
|
||||
credentials {
|
||||
username = mavenuser
|
||||
password = mavenpass
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('createDist', Zip) {Zip t ->
|
||||
archiveBaseName = project.name
|
||||
archiveVersion = version
|
||||
archiveExtension = "zip"
|
||||
destinationDirectory = new File(project.buildDir, "/distribution/")
|
||||
from war.outputs.files
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly "javax.servlet:javax.servlet-api:4.0.1"
|
||||
compileOnly "javax.ws.rs:javax.ws.rs-api:2.1.1"
|
||||
|
||||
implementation "org.apache.commons:commons-configuration2:2.9.0"
|
||||
implementation "org.apache.commons:commons-lang3:3.12.0"
|
||||
implementation "commons-net:commons-net:3.9.0"
|
||||
implementation "commons-beanutils:commons-beanutils:1.9.4"
|
||||
implementation "org.apache.httpcomponents:httpclient:4.5.14"
|
||||
implementation "org.apache.httpcomponents:fluent-hc:4.5.14"
|
||||
implementation "commons-io:commons-io:2.11.0"
|
||||
|
||||
implementation "org.apache.ant:ant:1.10.13"
|
||||
implementation "org.apache.ant:ant-nodeps:1.8.1"
|
||||
implementation "org.apache.ant:ant-jsch:1.10.13"
|
||||
implementation "org.apache.ant:ant-commons-net:1.10.13"
|
||||
implementation "org.apache.ant:ant-javamail:1.10.13"
|
||||
implementation "org.apache.ant:ant-launcher:1.10.13"
|
||||
|
||||
implementation "org.apache.commons:commons-jcs-core:2.2.1"
|
||||
|
||||
implementation "org.quartz-scheduler:quartz:2.3.2"
|
||||
|
||||
implementation "org.slf4j:slf4j-api:2.0.7"
|
||||
|
||||
runtimeOnly "org.slf4j:slf4j-simple:2.0.7"
|
||||
|
||||
implementation "org.apache.ws.commons.axiom:axiom:1.2.22"
|
||||
implementation "org.apache.ws.commons.axiom:axiom-impl:1.2.22"
|
||||
|
||||
implementation "org.apache.shiro:shiro-core:1.12.0"
|
||||
implementation "org.apache.shiro:shiro-root:1.12.0"
|
||||
implementation "org.apache.shiro:shiro-web:1.12.0"
|
||||
|
||||
implementation "org.apache.cxf:cxf:3.4.10"
|
||||
implementation "org.apache.cxf:cxf-rt-databinding-aegis:3.2.14"
|
||||
|
||||
runtimeOnly "org.apache.cxf:cxf-rt-transports-http:3.2.14"
|
||||
runtimeOnly "org.apache.cxf:cxf-rt-frontend-jaxrs:3.2.14"
|
||||
runtimeOnly "org.apache.cxf:cxf-rt-frontend-jaxws:3.2.14"
|
||||
runtimeOnly "org.apache.cxf:cxf-rt-security:3.2.14"
|
||||
|
||||
|
||||
implementation "rhino:js:1.7R2"
|
||||
|
||||
implementation "org.springframework:spring-core:5.3.29"
|
||||
implementation "org.springframework:spring-context:5.3.29"
|
||||
implementation "org.springframework:spring-web:5.3.29"
|
||||
|
||||
implementation "com.h2database:h2:2.2.222"
|
||||
|
||||
implementation "com.sun.xml.bind:jaxb-impl:2.3.0.1"
|
||||
implementation "com.sun.xml.bind:jaxb-core:2.3.0.1"
|
||||
|
||||
implementation fileTree(dir: "lib/", includes: ["*.jar"])
|
||||
|
||||
annotationProcessor "org.projectlombok:lombok:1.18.28"
|
||||
compileOnly "org.projectlombok:lombok:1.18.28"
|
||||
|
||||
}
|
Binary file not shown.
|
@ -1,7 +0,0 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
|
@ -1,248 +0,0 @@
|
|||
#!/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/HEAD/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
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# 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
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
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
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
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
|
||||
|
||||
|
||||
# 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"'
|
||||
|
||||
# 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 \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# 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" "$@"
|
|
@ -1,92 +0,0 @@
|
|||
@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=.
|
||||
@rem This is normally unused
|
||||
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% equ 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% equ 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!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
|
@ -0,0 +1,146 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
|
||||
license agreements. See the NOTICE file distributed with this work for additional
|
||||
information regarding copyright ownership. The ASF licenses this file to
|
||||
you under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
|
||||
by applicable law or agreed to in writing, software distributed under the
|
||||
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
OF ANY KIND, either express or implied. See the License for the specific
|
||||
language governing permissions and limitations under the License. -->
|
||||
<ivy-module version="2.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
|
||||
<info organisation="Brutex Network" module="XServices" status="integration">
|
||||
</info>
|
||||
|
||||
<configurations >
|
||||
|
||||
<conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>
|
||||
<conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
|
||||
<conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths." extends="master"/>
|
||||
<conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/>
|
||||
<conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"/>
|
||||
<conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases." extends="runtime"/>
|
||||
<conf name="system" visibility="public" description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository."/>
|
||||
<conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/>
|
||||
<conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/>
|
||||
<conf name="optional" visibility="public" description="contains all optional dependencies"/>
|
||||
</configurations>
|
||||
|
||||
|
||||
|
||||
<dependencies defaultconf="master">
|
||||
|
||||
<dependency org="org.apache.commons" name="commons-lang3" rev="3.7"/>
|
||||
<dependency org="org.apache.commons" name="commons-configuration2" rev="2.2" />
|
||||
|
||||
<dependency org="commons-net" name="commons-net" rev="3.2"/>
|
||||
|
||||
<dependency org="org.apache.ant" name="ant" rev="1.8.4"/>
|
||||
<dependency org="org.apache.ant" name="ant-nodeps" rev="1.8.1"/>
|
||||
<dependency org="org.apache.ant" name="ant-jsch" rev="1.8.4"/>
|
||||
<!--<dependency org="ant-contrib" name="ant-contrib" rev="20020829"/>-->
|
||||
<dependency org="org.apache.ant" name="ant-commons-net" rev="1.8.4"/>
|
||||
<dependency org="javax.mail" name="mail" rev="1.4.7"/>
|
||||
<dependency org="org.apache.ant" name="ant-javamail" rev="1.8.1"/>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-jcs-core -->
|
||||
<dependency org="org.apache.commons" name="commons-jcs-core" rev="2.2"/>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-jcs-jcache -->
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-jcs-jcache-extras -->
|
||||
<!--<dependency org="org.apache.commons" name="commons-jcs-jcache" rev="2.2"/>
|
||||
<dependency org="org.apache.commons" name="commons-jcs-jcache-extras" rev="2.2"/>-->
|
||||
|
||||
|
||||
|
||||
<dependency org="org.quartz-scheduler" name="quartz" rev="2.3.0"/>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
|
||||
<dependency org="org.apache.logging.log4j" name="log4j-api" rev="2.11.0"/>
|
||||
<dependency org="org.apache.logging.log4j" name="log4j-core" rev="2.11.0"/>
|
||||
<dependency org="org.apache.logging.log4j" name="log4j-web" rev="2.11.0"/>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-1.2-api -->
|
||||
<dependency org="org.apache.logging.log4j" name="log4j-1.2-api" rev="2.11.0"/>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl -->
|
||||
<dependency org="org.apache.logging.log4j" name="log4j-slf4j-impl" rev="2.11.0" />
|
||||
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
|
||||
<!-- <dependency org="org.slf4j" name="slf4j-api" rev="1.7.25" />-->
|
||||
|
||||
|
||||
|
||||
<dependency org="org.springframework" name="spring-core" rev="5.0.5.RELEASE" conf="master,compile,runtime"/>
|
||||
<dependency org="org.springframework" name="spring-context" rev="5.0.5.RELEASE" conf="master,compile,runtime"/>
|
||||
<dependency org="org.springframework" name="spring-web" rev="5.0.5.RELEASE" conf="master,compile,runtime"/>
|
||||
|
||||
|
||||
<dependency org="commons-beanutils" name="commons-beanutils" rev="1.9.3"/>
|
||||
|
||||
|
||||
|
||||
<dependency org="org.apache.ws.commons.axiom" name="axiom-api" rev="1.2.20" conf="compile,master">
|
||||
<!-- <artifact name="axiom-api" ext="jar"/>-->
|
||||
<exclude name="axiom-api-1.2.20-tests" ext="jar"/>
|
||||
</dependency>
|
||||
<dependency org="org.apache.ws.commons.axiom" name="axiom-impl" rev="1.2.20" conf="master" />
|
||||
|
||||
|
||||
<!--
|
||||
<dependency org="org.codehaus.woodstox" name="woodstox-core-asl" rev="4.4.1"/>
|
||||
<dependency org="org.codehaus.woodstox" name="stax2-api" rev="4.1"/>
|
||||
-->
|
||||
|
||||
|
||||
|
||||
<dependency org="org.apache.shiro" name="shiro-core" rev="1.4.0" />
|
||||
<dependency org="org.apache.shiro" name="shiro-root" rev="1.4.0" />
|
||||
<dependency org="org.apache.shiro" name="shiro-web" rev="1.4.0" />
|
||||
|
||||
|
||||
|
||||
<dependency org="org.apache.cxf" name="cxf-core" rev="3.2.4" conf="master,compile"/>
|
||||
<dependency org="org.apache.cxf" name="cxf-rt-transports-http" rev="3.2.4" conf="master,compile" />
|
||||
<dependency org="org.apache.cxf" name="cxf-rt-databinding-aegis" rev="3.2.4" conf="master,compile"/>
|
||||
<dependency org="org.apache.cxf" name="cxf-rt-frontend-jaxrs" rev="3.2.4" conf="master,compile"/>
|
||||
<dependency org="org.apache.cxf" name="cxf-rt-frontend-jaxws" rev="3.2.4" conf="master,compile"/>
|
||||
<dependency org="org.apache.cxf" name="cxf-rt-security" rev="3.2.4" conf="master,compile"/>
|
||||
<dependency org="org.apache.cxf" name="cxf-rt-ws-security" rev="3.2.4" conf="master,compile"/>
|
||||
|
||||
<!--
|
||||
<dependency org="org.apache.wss4j" name="wss4j" rev="2.2.1" conf="*->compile"/>
|
||||
<dependency org="org.apache.wss4j" name="wss4j-ws-security-common" rev="2.2.1" conf="*->compile"/>
|
||||
-->
|
||||
<dependency org="org.apache.ws.security" name="wss4j" rev="1.6.19"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dependency org="rhino" name="js" rev="1.7R2"/>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api -->
|
||||
<dependency org="javax.ws.rs" name="javax.ws.rs-api" rev="2.1"/>
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
Locally managed libraries
|
||||
-->
|
||||
<dependency org="lib" name="java-unrar" rev="0.3" conf="*->default">
|
||||
<artifact name="java-unrar" type="jar" />
|
||||
</dependency>
|
||||
<dependency org="lib" name="lib.cvsclient" rev="20131001" conf="*->default">
|
||||
<artifact name="lib.cvsclient" type="jar" />
|
||||
</dependency>
|
||||
<dependency org="lib" name="lib.xservices-scmtypes" rev="20131001" conf="*->default">
|
||||
<artifact name="lib.xservices-scmtypes" type="jar" />
|
||||
</dependency>
|
||||
|
||||
|
||||
<conflict manager="latest-revision"/>
|
||||
</dependencies>
|
||||
</ivy-module>
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ivysettings>
|
||||
<settings defaultResolver="defaultchain" />
|
||||
<resolvers>
|
||||
<ibiblio name="apache-maven" m2compatible="true" usepoms="true" root="http://repo.maven.apache.org/maven2/" />
|
||||
<ibiblio name="java" m2compatible="true" usepoms="true" root="http://download.java.net/maven/2/" />
|
||||
|
||||
<filesystem name="local-filesystem">
|
||||
<!-- <ivy pattern="${ivy.settings.dir}/1/[organisation]/[module]/ivys/ivy-[revision].xml"/> -->
|
||||
<artifact pattern="${ivy.settings.dir}/lib/[artifact]-[revision].[ext]" />
|
||||
</filesystem>
|
||||
|
||||
<chain name="defaultchain">
|
||||
<resolver ref="local-filesystem" />
|
||||
<resolver ref="apache-maven" />
|
||||
<resolver ref="java" />
|
||||
|
||||
</chain>
|
||||
</resolvers>
|
||||
|
||||
<modules>
|
||||
<module organisation="javax.transaction" resolver="java" />
|
||||
<module organisation="javax.sql" resolver="java" />
|
||||
</modules>
|
||||
</ivysettings>
|
||||
|
Binary file not shown.
|
@ -0,0 +1,23 @@
|
|||
|
||||
log4j.rootLogger=INFO, A1
|
||||
log4j.appender.A1=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
|
||||
|
||||
# Print the date in ISO 8601 format
|
||||
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c{2} - %m%n
|
||||
|
||||
# Print only messages of level WARN or above in the package com.foo.
|
||||
log4j.logger.net.brutex.xservices=INFO
|
||||
log4j.logger.net.brutex.xservices.ws.rs=DEBUG
|
||||
log4j.logger.net.brutex.xservices.security=DEBUG
|
||||
|
||||
log4j.logger.org.springframework=INFO
|
||||
|
||||
log4j.logger.org.apache.jcs=INFO
|
||||
|
||||
log4j.logger.org.apache.commons=INFO
|
||||
|
||||
log4j.logger.org.apache.axiom=INFO
|
||||
|
||||
log4j.logger.org.apache.shiro=INFO
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="WARN">
|
||||
<Appenders>
|
||||
<Console name="Console" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
|
||||
</Console>
|
||||
|
||||
</Appenders>
|
||||
|
||||
<Loggers>
|
||||
<!-- Log anything else with error level -->
|
||||
<Root level="error">
|
||||
<AppenderRef ref="Console"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
|
@ -17,7 +17,8 @@
|
|||
package net.brutex.xservices.security;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.shiro.authz.Permission;
|
||||
import org.apache.shiro.util.AntPathMatcher;
|
||||
|
||||
|
@ -25,13 +26,14 @@ import org.apache.shiro.util.AntPathMatcher;
|
|||
* @author Brian Rosenberger, bru(at)brutex.de
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
public class DirectoryPermission implements Permission {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
private final String path;
|
||||
|
||||
public DirectoryPermission(String antlikepath) {
|
||||
log.debug(String.format("Creating permission for path '{}'", antlikepath));
|
||||
logger.debug(String.format("Creating permission for path '%s'", antlikepath));
|
||||
path = antlikepath;
|
||||
}
|
||||
|
||||
|
@ -41,13 +43,13 @@ public class DirectoryPermission implements Permission {
|
|||
|
||||
/* is of same type */
|
||||
if(! (p instanceof DirectoryPermission)) {
|
||||
log.debug(String.format("Testing if permission of type '{}' implies permission of type '{}'. Result was '{}'" , this.getClass(), p.getClass(), result));
|
||||
logger.debug(String.format("Testing if permission of type '%s' implies permission of type '%s'. Result was '%s'" , this.getClass(), p.getClass(), result));
|
||||
return result;
|
||||
}
|
||||
|
||||
/* comparing to non null directory */
|
||||
if( ((DirectoryPermission)p).getPath() == null) {
|
||||
log.debug(String.format("Testing if DirectoryPermission '{}' implies permission to 'null'. Result was '{}'" , this.getPath(), result));
|
||||
logger.debug(String.format("Testing if DirectoryPermission '%s' implies permission to 'null'. Result was '%s'" , this.getPath(), result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -55,7 +57,7 @@ public class DirectoryPermission implements Permission {
|
|||
if( (new AntPathMatcher()).matches(path, ((DirectoryPermission)p).getPath()) ) {
|
||||
result = true;
|
||||
}
|
||||
log.debug(String.format("Testing if DirectoryPermission '{}' implies permission to '{}'. Result was '{}'" , this.getPath(), ((DirectoryPermission) p).getPath(), result));
|
||||
logger.debug(String.format("Testing if DirectoryPermission '%s' implies permission to '%s'. Result was '%s'" , this.getPath(), ((DirectoryPermission) p).getPath(), result));
|
||||
|
||||
return result;
|
||||
}
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
package net.brutex.xservices.security;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.brutex.xservices.ws.XmlService;
|
||||
import net.brutex.xservices.ws.rs.FileInfo;
|
||||
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.shiro.authz.Permission;
|
||||
import org.apache.shiro.authz.permission.InvalidPermissionStringException;
|
||||
|
||||
|
@ -28,33 +28,33 @@ import org.apache.shiro.authz.permission.InvalidPermissionStringException;
|
|||
* @author Brian Rosenberger, bru(at)brutex.de
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
public class PermissionResolver implements org.apache.shiro.authz.permission.PermissionResolver {
|
||||
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
private final String DELIMITER = "||";
|
||||
|
||||
@Override
|
||||
public Permission resolvePermission(String permissionString) {
|
||||
log.debug(String.format("Trying to examine new Permission '{}'", permissionString));
|
||||
logger.debug(String.format("Trying to examine new Permission '%s'", permissionString));
|
||||
if(! permissionString.contains(DELIMITER)) {
|
||||
log.error(String.format("Permission '{}' is missing permission class.", permissionString));
|
||||
throw new InvalidPermissionStringException(String.format("Permission '{}' is missing permission class.", permissionString), permissionString);
|
||||
logger.error(String.format("Permission '%s' is missing permission class.", permissionString));
|
||||
throw new InvalidPermissionStringException(String.format("Permission '%s' is missing permission class.", permissionString), permissionString);
|
||||
}
|
||||
int delimiterIndex = permissionString.indexOf(DELIMITER);
|
||||
String value = permissionString.substring(0, delimiterIndex);
|
||||
delimiterIndex = delimiterIndex + DELIMITER.length();
|
||||
switch (value) {
|
||||
case XmlService.SERVICE_NAME:
|
||||
log.debug(String.format("Found '{}' as permission class.", value));
|
||||
logger.debug(String.format("Found '%s' as permission class.", value));
|
||||
return new XmlServicePermission(permissionString.substring( delimiterIndex ));
|
||||
|
||||
case FileInfo.SERVICE_NAME:
|
||||
log.debug(String.format("Found '{}' as permission class.", value));
|
||||
logger.debug(String.format("Found '%s' as permission class.", value));
|
||||
return new DirectoryPermission(permissionString.substring( delimiterIndex ));
|
||||
|
||||
|
||||
default:
|
||||
log.warn(String.format("Permission class '{}' is not defined.", value));
|
||||
logger.warn(String.format("Permission class '%s' is not defined.", value));
|
||||
throw new InvalidPermissionStringException(String.format("Permission class '%s' is not defined.", value), permissionString);
|
||||
}
|
||||
}
|
|
@ -17,14 +17,30 @@
|
|||
|
||||
package net.brutex.xservices.security;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.config.Ini;
|
||||
import org.apache.shiro.realm.text.IniRealm;
|
||||
import org.apache.shiro.util.Nameable;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.apache.catalina.core.ApplicationContext;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
import org.apache.shiro.authz.AuthorizationInfo;
|
||||
import org.apache.shiro.authz.SimpleAuthorizationInfo;
|
||||
import org.apache.shiro.config.Ini;
|
||||
import org.apache.shiro.io.ResourceUtils;
|
||||
import org.apache.shiro.realm.AuthorizingRealm;
|
||||
import org.apache.shiro.realm.text.IniRealm;
|
||||
import org.apache.shiro.realm.text.TextConfigurationRealm;
|
||||
import org.apache.shiro.subject.PrincipalCollection;
|
||||
import org.apache.shiro.util.Nameable;
|
||||
import org.apache.shiro.web.env.IniWebEnvironment;
|
||||
import org.apache.shiro.web.util.WebUtils;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/*
|
||||
|
@ -38,9 +54,10 @@ import java.net.URISyntaxException;
|
|||
/**
|
||||
* The Class XServicesRealm.
|
||||
*/
|
||||
@Slf4j
|
||||
public class XServicesRealm extends IniRealm implements Nameable {
|
||||
|
||||
/** The logger. */
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
/** The name. */
|
||||
private String name;
|
||||
|
@ -70,7 +87,7 @@ public class XServicesRealm extends IniRealm implements Nameable {
|
|||
dir = dir.substring(0, dir.lastIndexOf("WEB-INF"));
|
||||
this.setIni(Ini.fromResourcePath(dir+"/WEB-INF/shiro.ini"));
|
||||
} catch (URISyntaxException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
logger.error(e.getMessage(), e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
@ -16,20 +16,21 @@
|
|||
|
||||
package net.brutex.xservices.security;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.shiro.authz.Permission;
|
||||
|
||||
/**
|
||||
* @author Brian Rosenberger, bru(at)brutex.de
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
public class XmlServicePermission implements Permission {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
private final String permissionString;
|
||||
|
||||
public XmlServicePermission(String permissionString) {
|
||||
log.debug(String.format("Creating permission for '{}'", permissionString));
|
||||
logger.debug(String.format("Creating permission for '%s'", permissionString));
|
||||
this.permissionString = permissionString;
|
||||
}
|
||||
|
||||
|
@ -39,13 +40,13 @@ public class XmlServicePermission implements Permission {
|
|||
|
||||
/* is of same type */
|
||||
if(! (p instanceof XmlServicePermission)) {
|
||||
log.debug(String.format("Testing if permission of type '{}' implies permission of type '{}'. Result was '{}'" , this.getClass(), p.getClass(), result));
|
||||
logger.debug(String.format("Testing if permission of type '%s' implies permission of type '%s'. Result was '%s'" , this.getClass(), p.getClass(), result));
|
||||
return result;
|
||||
}
|
||||
|
||||
/* comparing to non null directory */
|
||||
if( ((XmlServicePermission)p).getPermissionString() == null) {
|
||||
log.debug(String.format("Testing if DirectoryPermission '{}' implies permission to 'null'. Result was '{}'" , permissionString, result));
|
||||
logger.debug(String.format("Testing if DirectoryPermission '%s' implies permission to 'null'. Result was '%s'" , permissionString, result));
|
||||
return result;
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ import javax.xml.bind.annotation.XmlType;
|
|||
@XmlType
|
||||
public class StringMatchType
|
||||
{
|
||||
public final List<StringMatchDetails> stringlist = new ArrayList<StringMatchDetails>();
|
||||
public final List<StringMatchDetails> stringlist = new ArrayList();
|
||||
public int size = 0;
|
||||
|
||||
public synchronized void addStringMatch(StringMatchDetails match)
|
|
@ -30,24 +30,24 @@ import java.sql.Statement;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.quartz.utils.ConnectionProvider;
|
||||
|
||||
/**
|
||||
* @author Brian Rosenberger
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
public class BrutexHSQLQuartzConnectionProvider implements ConnectionProvider {
|
||||
|
||||
private Connection conn = null;
|
||||
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
|
||||
|
||||
public Connection getConnection() throws SQLException {
|
||||
if( conn!= null ) { // Todo: && conn.conn.isValid(5)) {
|
||||
log.debug("Checking tables on pre-exisiting database connection.");
|
||||
logger.debug("Checking tables on pre-exisiting database connection.");
|
||||
checkTables();
|
||||
return conn;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class BrutexHSQLQuartzConnectionProvider implements ConnectionProvider {
|
|||
// Class.forName("org.hsqldb.jdbc.JDBCDriver" );
|
||||
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to load Derby JDBC driver.");
|
||||
logger.fatal("Failed to load Derby JDBC driver.");
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
@ -87,11 +87,6 @@ public class BrutexHSQLQuartzConnectionProvider implements ConnectionProvider {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() throws SQLException {
|
||||
|
||||
}
|
||||
|
||||
private synchronized void recursiveDelete(File dbDir) {
|
||||
File[] files = dbDir.listFiles();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
|
@ -106,9 +101,9 @@ public class BrutexHSQLQuartzConnectionProvider implements ConnectionProvider {
|
|||
}
|
||||
|
||||
private synchronized void checkTables() throws SQLException {
|
||||
log.debug("Checking QUARTZ database schema.");
|
||||
logger.debug("Checking QUARTZ database schema.");
|
||||
if(!isConnected(false)) {
|
||||
log.error("Failed to validate QUARTZ database schema.");
|
||||
logger.error("Failed to validate QUARTZ database schema.");
|
||||
return;
|
||||
}
|
||||
List<String> ddl_list = new ArrayList<String>(11);
|
||||
|
@ -131,7 +126,7 @@ public class BrutexHSQLQuartzConnectionProvider implements ConnectionProvider {
|
|||
for (String tbl : ddl_list) {
|
||||
ResultSet rs = dmd.getTables(null, "APP", tbl, null);
|
||||
if (!rs.next()) {
|
||||
log.debug("Adding DDL for table {}", tbl);
|
||||
logger.log(Level.INFO, "Adding DDL for table "+ tbl);
|
||||
Statement st = conn.createStatement();
|
||||
File ddlFile = new File(ddl + tbl + ".ddl");
|
||||
String create = "";
|
||||
|
@ -142,15 +137,18 @@ public class BrutexHSQLQuartzConnectionProvider implements ConnectionProvider {
|
|||
}
|
||||
create.trim();
|
||||
if( st.execute(create)) {
|
||||
log.debug("Table {} created.", tbl);
|
||||
logger.log(Level.INFO, "Table " + tbl + " created.");
|
||||
}
|
||||
} catch (FileNotFoundException ex) {
|
||||
ex.printStackTrace();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
} catch (SQLException ex) {
|
||||
log.error("Error executing statement {}.",create, ex );
|
||||
logger.log(Level.ERROR, "Error executing statement "+ create );
|
||||
System.out.println(ex.getMessage());
|
||||
}
|
||||
} else {
|
||||
log.trace("Table {} exists.", tbl);
|
||||
logger.trace("Table "+tbl+" exists.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,15 +159,15 @@ public class BrutexHSQLQuartzConnectionProvider implements ConnectionProvider {
|
|||
} else {
|
||||
String t = this.getClass().getClassLoader().getResource("/").toString().substring(6); // WEB-INF/classes
|
||||
t += "../data/db";
|
||||
log.debug("Database directory is set to '{}", t);
|
||||
logger.debug("Database directory is set to '" + t + "'");
|
||||
try {
|
||||
this.conn = DriverManager.getConnection("jdbc:derby:" + t + ";create=true;");
|
||||
} catch (SQLException ex) {
|
||||
log.error(ex.getMessage(), ex);
|
||||
logger.error(ex.getMessage(), ex);
|
||||
if(!fail) {
|
||||
log.warn("Deleting database directory.");
|
||||
logger.warn("Deleting database directory.");
|
||||
recursiveDelete(new File(t));
|
||||
log.warn("Retrying to connect to database.");
|
||||
logger.warn("Retrying to connect to database.");
|
||||
return isConnected(true);
|
||||
} else {
|
||||
return false;
|
||||
|
@ -179,7 +177,11 @@ public class BrutexHSQLQuartzConnectionProvider implements ConnectionProvider {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize() throws SQLException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -30,23 +30,24 @@ import java.sql.Statement;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.quartz.utils.ConnectionProvider;
|
||||
|
||||
/**
|
||||
* @author Brian Rosenberger
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
public class BrutexQuartzConnectionProvider implements ConnectionProvider {
|
||||
|
||||
private Connection conn = null;
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
|
||||
public Connection getConnection() throws SQLException {
|
||||
if( conn!= null) { // Todo: && conn.conn.isValid(5)) {) {
|
||||
log.debug("Checking tables on pre-exisiting database connection.");
|
||||
logger.debug("Checking tables on pre-exisiting database connection.");
|
||||
checkTables();
|
||||
return conn;
|
||||
}
|
||||
|
@ -54,7 +55,7 @@ public class BrutexQuartzConnectionProvider implements ConnectionProvider {
|
|||
// Class.forName("org.hsqldb.jdbc.JDBCDriver" );
|
||||
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to load Derby JDBC driver.");
|
||||
logger.fatal("Failed to load Derby JDBC driver.");
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
@ -86,11 +87,6 @@ public class BrutexQuartzConnectionProvider implements ConnectionProvider {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() throws SQLException {
|
||||
|
||||
}
|
||||
|
||||
private synchronized void recursiveDelete(File dbDir) {
|
||||
File[] files = dbDir.listFiles();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
|
@ -105,9 +101,9 @@ public class BrutexQuartzConnectionProvider implements ConnectionProvider {
|
|||
}
|
||||
|
||||
private synchronized void checkTables() throws SQLException {
|
||||
log.debug("Checking QUARTZ database schema.");
|
||||
logger.debug("Checking QUARTZ database schema.");
|
||||
if(!isConnected(false)) {
|
||||
log.error("Failed to validate QUARTZ database schema.");
|
||||
logger.error("Failed to validate QUARTZ database schema.");
|
||||
return;
|
||||
}
|
||||
List<String> ddl_list = new ArrayList<String>(11);
|
||||
|
@ -130,7 +126,7 @@ public class BrutexQuartzConnectionProvider implements ConnectionProvider {
|
|||
for (String tbl : ddl_list) {
|
||||
ResultSet rs = dmd.getTables(null, "APP", tbl, null);
|
||||
if (!rs.next()) {
|
||||
log.debug("Adding DDL for table {}.", tbl);
|
||||
logger.log(Level.INFO, "Adding DDL for table "+ tbl);
|
||||
Statement st = conn.createStatement();
|
||||
File ddlFile = new File(ddl + tbl + ".ddl");
|
||||
String create = "";
|
||||
|
@ -141,16 +137,18 @@ public class BrutexQuartzConnectionProvider implements ConnectionProvider {
|
|||
}
|
||||
create.trim();
|
||||
if( st.execute(create)) {
|
||||
log.debug("Table {} created.", tbl);
|
||||
logger.log(Level.INFO, "Table " + tbl + " created.");
|
||||
}
|
||||
} catch (FileNotFoundException ex) {
|
||||
ex.printStackTrace();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
} catch (SQLException ex) {
|
||||
log.error("Error executing statement {}", create, ex );
|
||||
logger.log(Level.ERROR, "Error executing statement "+ create );
|
||||
System.out.println(ex.getMessage());
|
||||
}
|
||||
} else {
|
||||
log.trace("Table {} exists.", tbl);
|
||||
logger.trace("Table "+tbl+" exists.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,15 +159,15 @@ public class BrutexQuartzConnectionProvider implements ConnectionProvider {
|
|||
} else {
|
||||
String t = this.getClass().getClassLoader().getResource("/").toString().substring(6); // WEB-INF/classes
|
||||
t += "../data/db";
|
||||
log.debug("Database directory is set to '{}'", t);
|
||||
logger.debug("Database directory is set to '" + t + "'");
|
||||
try {
|
||||
this.conn = DriverManager.getConnection("jdbc:derby:" + t + ";create=true;");
|
||||
} catch (SQLException ex) {
|
||||
log.error(ex.getMessage(), ex);
|
||||
logger.error(ex.getMessage(), ex);
|
||||
if(!fail) {
|
||||
log.warn("Deleting database directory.");
|
||||
logger.warn("Deleting database directory.");
|
||||
recursiveDelete(new File(t));
|
||||
log.warn("Retrying to connect to database.");
|
||||
logger.warn("Retrying to connect to database.");
|
||||
return isConnected(true);
|
||||
} else {
|
||||
return false;
|
||||
|
@ -178,6 +176,12 @@ public class BrutexQuartzConnectionProvider implements ConnectionProvider {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() throws SQLException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,28 +1,28 @@
|
|||
/* */ package net.brutex.xservices.util;
|
||||
/* */
|
||||
/* */ import java.io.File;
|
||||
/* */ import lombok.extern.slf4j.Slf4j;
|
||||
import net.brutex.xservices.types.scm.ItemType;
|
||||
/* */ import net.brutex.xservices.types.scm.ItemType;
|
||||
import net.brutex.xservices.util.CVSRoot;
|
||||
|
||||
import org.apache.commons.configuration2.PropertiesConfiguration;
|
||||
import org.apache.commons.configuration2.builder.fluent.Configurations;
|
||||
import org.apache.commons.configuration2.ex.ConfigurationException;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
/* */ import org.netbeans.lib.cvsclient.Client;
|
||||
/* */ import org.netbeans.lib.cvsclient.admin.StandardAdminHandler;
|
||||
/* */ import org.netbeans.lib.cvsclient.command.CommandAbortedException;
|
||||
/* */ import org.netbeans.lib.cvsclient.command.GlobalOptions;
|
||||
/* */ import org.netbeans.lib.cvsclient.connection.AuthenticationException;
|
||||
/* */ import org.netbeans.lib.cvsclient.connection.PServerConnection;
|
||||
/* */
|
||||
@Slf4j
|
||||
/* */
|
||||
/* */ public class CVSClient
|
||||
/* */ {
|
||||
/* */ private final File configfile;
|
||||
/* */ private final PServerConnection connection;
|
||||
/* */ private final CVSRoot root;
|
||||
/* */ private final GlobalOptions globalOptions;
|
||||
/* 41 */ final Logger logger = LogManager.getLogger();
|
||||
/* */ public final Client client;
|
||||
/* */
|
||||
/* */ public Client getClient()
|
||||
|
@ -61,7 +61,7 @@ import org.apache.commons.configuration2.ex.ConfigurationException;
|
|||
/* */ try {
|
||||
/* 79 */ this.connection.open();
|
||||
/* */ } catch (AuthenticationException ex) {
|
||||
/* 81 */ log.error(ex.getMessage());
|
||||
/* 81 */ this.logger.error(ex.getMessage());
|
||||
/* */ }
|
||||
/* */
|
||||
/* 84 */ this.client = new Client(this.connection, new StandardAdminHandler());
|
|
@ -15,8 +15,6 @@
|
|||
*/
|
||||
package net.brutex.xservices.util;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.FileVisitResult;
|
||||
|
@ -28,6 +26,10 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.brutex.xservices.types.FileInfoType;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
|
@ -35,7 +37,6 @@ import java.util.List;
|
|||
*
|
||||
* @author Brian Rosenberger, bru(at)brutex.de
|
||||
*/
|
||||
@Slf4j
|
||||
public class FileWalker extends SimpleFileVisitor<Path> {
|
||||
|
||||
/** The matcher. */
|
||||
|
@ -50,6 +51,9 @@ public class FileWalker extends SimpleFileVisitor<Path> {
|
|||
/** The pattern. */
|
||||
private final String pattern;
|
||||
|
||||
/** The logger. */
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
|
||||
List<Path> list;
|
||||
|
||||
/**
|
||||
|
@ -74,11 +78,11 @@ public class FileWalker extends SimpleFileVisitor<Path> {
|
|||
*/
|
||||
void find(Path file) {
|
||||
Path name = file.getFileName();
|
||||
log.debug("Compare file '{}' against pattern '{}'.", file, pattern);
|
||||
logger.trace("Compare file " + file.toString() + " against pattern '"+pattern+"'.");
|
||||
total++;
|
||||
if (name != null && matcher.matches(name)) {
|
||||
list.add(file);
|
||||
log.debug("Added file '{}' to the result set.", file);
|
||||
logger.debug("Added file " + file.toString() + " to the result set.");
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +118,7 @@ public class FileWalker extends SimpleFileVisitor<Path> {
|
|||
@Override
|
||||
public FileVisitResult visitFileFailed(Path file,
|
||||
IOException exc) {
|
||||
log.warn("Failed to include file '{}'.", file);
|
||||
logger.warn(String.format("Failed to include file '%s'.", file.toString()));
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
|
|
@ -3,18 +3,14 @@
|
|||
*/
|
||||
package net.brutex.xservices.util;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.configuration2.ex.ConfigurationException;
|
||||
import org.apache.commons.configuration2.PropertiesConfiguration;
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
import org.apache.commons.configuration.PropertiesConfiguration;
|
||||
import org.apache.commons.jcs.JCS;
|
||||
import org.apache.commons.jcs.access.exception.CacheException;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.brutex.mgmt.openair.OpenAirRestConnection;
|
||||
|
||||
|
@ -22,21 +18,18 @@ import net.brutex.mgmt.openair.OpenAirRestConnection;
|
|||
* @author brosenberger
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
public final class OpenAirConnection {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger();
|
||||
|
||||
public static OpenAirRestConnection getOpenAirConnection() {
|
||||
final PropertiesConfiguration props;
|
||||
try {
|
||||
final String config = "../openair.properties";
|
||||
log.info("Loading Open Air connection details from {}", config.toString());
|
||||
logger.info("Loading Open Air connection details from {}", config.toString());
|
||||
final URL configloc = OpenAirConnection.class.getClassLoader().getResource(config);
|
||||
log.debug("Loading Open Air connection details from {}", configloc.toString());
|
||||
|
||||
props = new PropertiesConfiguration();
|
||||
props.read( new InputStreamReader( new BufferedInputStream(configloc.openStream())) );
|
||||
logger.debug("Loading Open Air connection details from {}", configloc.toString());
|
||||
|
||||
props = new PropertiesConfiguration(configloc);
|
||||
final String user = props.getString("user");
|
||||
final String password = props.getString("password");
|
||||
final String company = props.getString("company");
|
||||
|
@ -47,10 +40,11 @@ public final class OpenAirConnection {
|
|||
|
||||
con = new OpenAirRestConnection(JCS.getInstance("OACache"), company, user, password);
|
||||
return con;
|
||||
} catch (CacheException | ConfigurationException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
} catch (CacheException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
} catch (ConfigurationException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
|
@ -23,19 +23,19 @@ import java.util.List;
|
|||
import java.util.concurrent.ExecutorService;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.brutex.xservices.types.scm.ObjectFactory;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* @author Brian Rosenberger, bru(at)brutex.de
|
||||
*
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
|
||||
public class CacheServlet extends HttpServlet
|
||||
{
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
List<File> configfiles = new ArrayList<File>();
|
||||
int cacheinterval;
|
||||
private final ObjectFactory FACTORY = new ObjectFactory();
|
||||
|
@ -54,7 +54,7 @@ public class CacheServlet extends HttpServlet
|
|||
if (name.startsWith("cvs-config-")) {
|
||||
String configfile = getServletContext()
|
||||
.getInitParameter(name);
|
||||
log.info("CVS configuration file: {}", configfile);
|
||||
this.logger.info("CVS configuration file: " + configfile);
|
||||
this.configfiles.add(new File(configfile));
|
||||
}
|
||||
}
|
||||
|
@ -63,8 +63,8 @@ public class CacheServlet extends HttpServlet
|
|||
this.cacheinterval = Integer.parseInt(getServletContext()
|
||||
.getInitParameter("cvs-cache-interval"));
|
||||
} catch (NumberFormatException e) {
|
||||
log.debug("Could not read parameter 'cvs-cache-interval' from web.xml. Using default value '{}' minutes", this.cacheinterval );
|
||||
this.logger.debug("Could not read parameter 'cvs-cache-interval' from web.xml. Using default value '" + this.cacheinterval + "' minutes");
|
||||
}
|
||||
log.info("CacheServlet set to '{}' minutes interval.", this.cacheinterval);
|
||||
this.logger.info("CacheServlet set to " + this.cacheinterval + " minutes interval.");
|
||||
}
|
||||
}
|
|
@ -30,8 +30,6 @@ import javax.servlet.ServletContext;
|
|||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.brutex.xservices.types.scm.ItemListType;
|
||||
import net.brutex.xservices.types.scm.ItemType;
|
||||
import net.brutex.xservices.types.scmfindings.FindingDetailsType;
|
||||
|
@ -45,16 +43,18 @@ import org.apache.commons.configuration2.PropertiesConfiguration;
|
|||
import org.apache.commons.configuration2.builder.fluent.Configurations;
|
||||
import org.apache.commons.configuration2.ex.ConfigurationException;
|
||||
import org.apache.commons.jcs.access.exception.CacheException;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* @author Brian Rosenberger, bru(at)brutex.de
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
|
||||
public class FindingsCacheServlet extends HttpServlet {
|
||||
|
||||
private static final long serialVersionUID = 4041338473949999960L;
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
private final List<File> configfiles = new ArrayList<File>();
|
||||
private final ObjectFactory FACTORY = new ObjectFactory();
|
||||
private ExecutorService executor;
|
||||
|
@ -71,7 +71,7 @@ public class FindingsCacheServlet extends HttpServlet {
|
|||
int i = 1;
|
||||
for(File f: configfiles) {
|
||||
//Initialise configuration bean using default values
|
||||
FindingsConfigBean cbean = new FindingsConfigBean(i);
|
||||
FindingsConfigBean cbean = new FindingsConfigBean(i, LogManager.getLogger("worker-"+i+ "." + this.getClass().getName()));
|
||||
i++;
|
||||
|
||||
|
||||
|
@ -81,9 +81,9 @@ public class FindingsCacheServlet extends HttpServlet {
|
|||
int cacheinterval = Integer.parseInt(getServletContext()
|
||||
.getInitParameter("cvs-cache-interval"));
|
||||
cbean.setCacheinterval(cacheinterval);
|
||||
log.info("FindingsCacheServlet set to "+ cacheinterval + " minutes interval.");
|
||||
logger.info("FindingsCacheServlet set to "+ cacheinterval + " minutes interval.");
|
||||
} catch (NumberFormatException e) {
|
||||
log.warn("Could not read parameter 'cvs-cache-interval' from web.xml. Using default value '"
|
||||
logger.warn("Could not read parameter 'cvs-cache-interval' from web.xml. Using default value '"
|
||||
+ cbean.getCacheinterval()+ "' minutes");
|
||||
}
|
||||
|
||||
|
@ -92,27 +92,27 @@ public class FindingsCacheServlet extends HttpServlet {
|
|||
try {
|
||||
config = configs.properties(f);
|
||||
} catch (ConfigurationException e) {
|
||||
log.error("Could not read parameter file at '"+f.getAbsolutePath()+"'");
|
||||
logger.error("Could not read parameter file at '"+f.getAbsolutePath()+"'");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
File cvsconfig = new File(config.getString("CVSROOTCONFIGFILE"));
|
||||
cbean.setCvsconfig(cvsconfig);
|
||||
FindingsCacheServlet.log.debug("Fetching list of files using '"
|
||||
FindingsCacheServlet.logger.debug("Fetching list of files using '"
|
||||
+ cvsconfig.getAbsolutePath() + "' config file");
|
||||
|
||||
|
||||
List<Object> filepatterns = config.getList("FILESEARCH");
|
||||
cbean.setFilepatterns(filepatterns);
|
||||
FindingsCacheServlet.log.debug("Checking '"
|
||||
FindingsCacheServlet.logger.debug("Checking '"
|
||||
+ filepatterns.size()
|
||||
+ "' patterns for file name and path matching.");
|
||||
|
||||
|
||||
List<Object> contentpatterns = config.getList("CONTENTSEARCH");
|
||||
cbean.setContentpatterns(contentpatterns);
|
||||
FindingsCacheServlet.log.debug("Checking '"
|
||||
FindingsCacheServlet.logger.debug("Checking '"
|
||||
+ contentpatterns.size()
|
||||
+ "' patterns for content matching");
|
||||
|
||||
|
@ -122,7 +122,7 @@ public class FindingsCacheServlet extends HttpServlet {
|
|||
executor.submit(new ThisRunnable(cbean));
|
||||
|
||||
}
|
||||
log.info("FindingsCacheServlet has been initialized.");
|
||||
logger.info("FindingsCacheServlet has been initialized.");
|
||||
|
||||
}
|
||||
|
||||
|
@ -133,14 +133,14 @@ public class FindingsCacheServlet extends HttpServlet {
|
|||
String filename = getServletContext().getInitParameter(
|
||||
"cvs-findings-configuration");
|
||||
if (filename == null) {
|
||||
log.warn("'cvs-findings-configuration' init parameter is not specified.");
|
||||
logger.warn("'cvs-findings-configuration' init parameter is not specified.");
|
||||
return false;
|
||||
}
|
||||
final File findingsconfig = new File(filename);
|
||||
log.info("CVS findings configuration file found at '"
|
||||
logger.info("CVS findings configuration file found at '"
|
||||
+ findingsconfig.getAbsolutePath() + "'");
|
||||
if ((!findingsconfig.canRead()) || (findingsconfig.isDirectory())) {
|
||||
log.info("CVS findings configuration file '"
|
||||
logger.info("CVS findings configuration file '"
|
||||
+ findingsconfig.getAbsolutePath() + "' does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ public class FindingsCacheServlet extends HttpServlet {
|
|||
String name = (String) attributes.nextElement();
|
||||
if (name.startsWith("cvs-config-")) {
|
||||
String configfile = getServletContext().getInitParameter(name);
|
||||
log.info("Adding CVS configuration file: " + configfile);
|
||||
logger.info("Adding CVS configuration file: " + configfile);
|
||||
this.configfiles.add(new File(configfile));
|
||||
}
|
||||
}
|
||||
|
@ -168,12 +168,12 @@ public class FindingsCacheServlet extends HttpServlet {
|
|||
List<File> removelist = new ArrayList<File>();
|
||||
for (File f : configfiles) {
|
||||
if (!f.exists()) {
|
||||
log.warn("CVS configuration file '"
|
||||
logger.warn("CVS configuration file '"
|
||||
+ f.getAbsolutePath()
|
||||
+ "' is specified, but does not exist. Removing from list.");
|
||||
removelist.add(f);
|
||||
} else if (!f.canRead()) {
|
||||
log.warn("CVS configuration file '"
|
||||
logger.warn("CVS configuration file '"
|
||||
+ f.getAbsolutePath()
|
||||
+ "' does exist, but is not readable. Removing from list.");
|
||||
removelist.add(f);
|
||||
|
@ -203,7 +203,7 @@ public class FindingsCacheServlet extends HttpServlet {
|
|||
ObjectFactory FACTORY = new ObjectFactory();
|
||||
FindingsListType findingsList = FACTORY.createFindingsListType();
|
||||
|
||||
FindingsCacheServlet.log.info("Processing '"
|
||||
FindingsCacheServlet.logger.info("Processing '"
|
||||
+ fileslist.getItems().size() + "' files and directories.");
|
||||
|
||||
while (!this.isInterrupted) {
|
||||
|
@ -216,7 +216,7 @@ public class FindingsCacheServlet extends HttpServlet {
|
|||
Object o = iterF.next();
|
||||
if (this.isInterrupted)
|
||||
break;
|
||||
FindingsCacheServlet.log.debug("Scanning filename '"
|
||||
FindingsCacheServlet.logger.debug("Scanning filename '"
|
||||
+ i.getFullname() + "' for pattern '"
|
||||
+ (String) o + "'");
|
||||
p = Pattern.compile((String) o);
|
||||
|
@ -231,17 +231,17 @@ public class FindingsCacheServlet extends HttpServlet {
|
|||
finding.setData(it.getData());
|
||||
finding = copyDetails(finding, i);
|
||||
findingsList.getFindings().add(finding);
|
||||
FindingsCacheServlet.log
|
||||
FindingsCacheServlet.logger
|
||||
.debug("Match found for '"
|
||||
+ i.getFullname() + "'");
|
||||
break;
|
||||
}
|
||||
FindingsCacheServlet.log
|
||||
FindingsCacheServlet.logger
|
||||
.debug("No match found for '" + i.getFullname()
|
||||
+ "'");
|
||||
}
|
||||
}
|
||||
FindingsCacheServlet.log
|
||||
FindingsCacheServlet.logger
|
||||
.debug("Processing file content for '"
|
||||
+ findingsList.getFindings().size()
|
||||
+ "' entries in the list.");
|
||||
|
@ -257,7 +257,7 @@ public class FindingsCacheServlet extends HttpServlet {
|
|||
Object o = iter.next();
|
||||
if (this.isInterrupted)
|
||||
break;
|
||||
FindingsCacheServlet.log
|
||||
FindingsCacheServlet.logger
|
||||
.debug("Scanning file content for file '"
|
||||
+ t.getFullname() + "' for pattern '"
|
||||
+ (String) o + "'");
|
||||
|
@ -293,7 +293,7 @@ public class FindingsCacheServlet extends HttpServlet {
|
|||
fd.getMatchLists().add(gmg);
|
||||
}
|
||||
t.getFindingLists().add(fd);
|
||||
FindingsCacheServlet.log
|
||||
FindingsCacheServlet.logger
|
||||
.debug("Found matching content at index '" + s
|
||||
+ "' in file '" + t.getFullname()
|
||||
+ "' with pattern '" + p1.toString()
|
||||
|
@ -302,7 +302,7 @@ public class FindingsCacheServlet extends HttpServlet {
|
|||
|
||||
if (!isFound) {
|
||||
findingsList.getFindings().remove(t);
|
||||
FindingsCacheServlet.log
|
||||
FindingsCacheServlet.logger
|
||||
.debug("Found matching filename for '"
|
||||
+ t.getFullname()
|
||||
+ "' but content didn't match. Removing.");
|
||||
|
@ -311,24 +311,24 @@ public class FindingsCacheServlet extends HttpServlet {
|
|||
try {
|
||||
instance.getCacheInstance().put(
|
||||
"FINDINGS-" + t.getROOT(), findingsList);
|
||||
FindingsCacheServlet.log
|
||||
FindingsCacheServlet.logger
|
||||
.info("FINDINGS for CVSROOT '" + t.getROOT()
|
||||
+ "' have been updated in cache.");
|
||||
} catch (CacheException e) {
|
||||
FindingsCacheServlet.log.error(e.getMessage(), e);
|
||||
FindingsCacheServlet.logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
try {
|
||||
int cacheinterval = configuration.getCacheinterval();
|
||||
FindingsCacheServlet.log.debug("Now sleeping for '"
|
||||
FindingsCacheServlet.logger.debug("Now sleeping for '"
|
||||
+ cacheinterval + "' minutes");
|
||||
Thread.currentThread();
|
||||
Thread.sleep(cacheinterval * 60000);
|
||||
FindingsCacheServlet.log.debug("Waking up after '"
|
||||
FindingsCacheServlet.logger.debug("Waking up after '"
|
||||
+ cacheinterval + "' minutes of sleep");
|
||||
} catch (InterruptedException e) {
|
||||
this.isInterrupted = true;
|
||||
FindingsCacheServlet.log
|
||||
FindingsCacheServlet.logger
|
||||
.warn("FindingsCacheServlet cache was interrupted. Shutting down.");
|
||||
}
|
||||
}
|
||||
|
@ -361,9 +361,9 @@ public class FindingsCacheServlet extends HttpServlet {
|
|||
executor.shutdown();
|
||||
try {
|
||||
executor.awaitTermination(3, TimeUnit.SECONDS);
|
||||
log.info("Cache Worker Threads have shut down.");
|
||||
logger.info("Cache Worker Threads have shut down.");
|
||||
} catch (InterruptedException e) {
|
||||
log.error("Cache Worker Threads did not terminate within timeout.", e);
|
||||
logger.error("Cache Worker Threads did not terminate within timeout.", e);
|
||||
}
|
||||
super.destroy();
|
||||
}
|
|
@ -16,22 +16,18 @@
|
|||
|
||||
package net.brutex.xservices.util.cache;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* @author Brian Rosenberger, bru(at)brutex.de
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
public class FindingsConfigBean {
|
||||
|
||||
|
||||
private Logger logger;
|
||||
private final int instanceid;
|
||||
|
||||
private File cvsconfig;
|
||||
|
@ -39,10 +35,10 @@ public class FindingsConfigBean {
|
|||
private List<Object> filepatterns;
|
||||
private List<Object> contentpatterns;
|
||||
|
||||
public FindingsConfigBean(int instanceid) {
|
||||
public FindingsConfigBean(int instanceid, Logger logger) {
|
||||
this.instanceid = instanceid;
|
||||
|
||||
log.debug("Initialise FindingsConfigBean instance '" + instanceid + "'");
|
||||
this.logger = logger;
|
||||
logger.debug("Initialise FindingsConfigBean instance '" + instanceid + "'");
|
||||
|
||||
}
|
||||
|
|
@ -18,23 +18,16 @@ package net.brutex.xservices.ws;
|
|||
import javax.jws.WebMethod;
|
||||
import javax.jws.WebParam;
|
||||
import javax.jws.WebService;
|
||||
import javax.jws.soap.SOAPBinding;
|
||||
|
||||
import net.brutex.xservices.types.HostConnection;
|
||||
import net.brutex.xservices.types.HostinfoType;
|
||||
import net.brutex.xservices.types.MailMimeType;
|
||||
import net.brutex.xservices.types.ReturnCode;
|
||||
import net.brutex.xservices.types.RuntimeInfoType;
|
||||
import net.brutex.xservices.types.alfevent.ALFEventResponseType;
|
||||
import net.brutex.xservices.types.alfevent.ALFEventType;
|
||||
import net.brutex.xservices.types.ant.FileSetResource;
|
||||
|
||||
import org.apache.cxf.aegis.type.java5.XmlElement;
|
||||
import org.apache.cxf.aegis.type.java5.XmlReturnType;
|
||||
import org.apache.cxf.annotations.WSDLDocumentation;
|
||||
import org.h2.jdbcx.JdbcConnectionPool;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
/**
|
||||
* Bundles various methods
|
||||
|
@ -43,13 +36,12 @@ import java.math.BigInteger;
|
|||
* @since 0.4.0
|
||||
*/
|
||||
@WebService(targetNamespace = net.brutex.xservices.util.BrutexNamespaces.WS_XSERVICES)
|
||||
//@SOAPBinding(style = SOAPBinding.Style.RPC)
|
||||
@WSDLDocumentation("Various service operations.")
|
||||
public interface MiscService {
|
||||
|
||||
public static final String OPERATION_GETMEMORY = "getMemory";
|
||||
|
||||
@WebMethod(operationName="getHostinfo")
|
||||
@WebMethod(operationName="getHostinfo")
|
||||
@WSDLDocumentation("Get information about a host.")
|
||||
public abstract HostinfoType getHostinfo(@WebParam(name="hostname") @XmlElement(minOccurs="1", nillable=false) String paramString);
|
||||
|
||||
|
@ -68,13 +60,4 @@ public interface MiscService {
|
|||
@WebMethod(operationName="getMemory")
|
||||
@WSDLDocumentation("Get memory and processor information")
|
||||
public abstract RuntimeInfoType getMemory();
|
||||
|
||||
@WebMethod(operationName="lock")
|
||||
@WSDLDocumentation("Get a lock.")
|
||||
public abstract BigInteger lock(@WebParam(name="id") @XmlElement(nillable = false) String id,
|
||||
@WebParam(name="objectId") @XmlElement(nillable = false) String objectId) throws XServicesFault;
|
||||
|
||||
@WebMethod(operationName="", action = "EventNotice")
|
||||
@SOAPBinding(use = SOAPBinding.Use.LITERAL, style = SOAPBinding.Style.DOCUMENT, parameterStyle = SOAPBinding.ParameterStyle.BARE)
|
||||
public abstract ALFEventResponseType mergeALFEvent(@WebParam(name="ALFEventNoticeDoc", targetNamespace = "http://www.eclipse.org/alf/schema/EventBase/1") ALFEventType event) throws XServicesFault;
|
||||
}
|
|
@ -25,8 +25,6 @@ import javax.jws.WebService;
|
|||
import javax.jws.soap.SOAPBinding;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import org.apache.cxf.annotations.WSDLDocumentation;
|
||||
|
||||
import net.brutex.mgmt.api.xml.AnyEntity;
|
||||
import net.brutex.mgmt.api.xml.Customer;
|
||||
import net.brutex.mgmt.api.xml.Project;
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package net.brutex.xservices.ws;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.jws.WebMethod;
|
||||
import javax.jws.WebParam;
|
||||
import javax.jws.WebService;
|
||||
|
@ -79,13 +81,4 @@ public abstract interface StringService
|
|||
@WebParam(name="string") @XmlElement(required=true) String paramString)
|
||||
throws XServicesFault;
|
||||
|
||||
@WebMethod(operationName="handleStringLists")
|
||||
@WSDLDocumentation("Tokenizes all strings and then adds/removes tokens to/ from basestring")
|
||||
public abstract String handleStringLists(
|
||||
@WebParam(name="basestring") @XmlElement(required=true) String paramBaseString,
|
||||
@WebParam(name="addstring") @XmlElement(required=true) String paramAddString,
|
||||
@WebParam(name="removestring") @XmlElement(required=true) String paramRemoveString,
|
||||
@WebParam(name="delimiter") @XmlElement(required=true) String delimiter)
|
||||
throws XServicesFault;
|
||||
|
||||
}
|
|
@ -26,7 +26,15 @@ import java.util.UUID;
|
|||
|
||||
import javax.jws.WebService;
|
||||
|
||||
import org.quartz.*;
|
||||
import org.quartz.JobBuilder;
|
||||
import org.quartz.JobDataMap;
|
||||
import org.quartz.JobDetail;
|
||||
import org.quartz.JobKey;
|
||||
import org.quartz.Scheduler;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.quartz.SimpleTrigger;
|
||||
import org.quartz.Trigger;
|
||||
import org.quartz.TriggerKey;
|
||||
import org.quartz.impl.StdSchedulerFactory;
|
||||
import org.quartz.impl.matchers.GroupMatcher;
|
||||
|
||||
|
@ -140,5 +148,4 @@ public class JobServiceImpl implements JobService {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
/*
|
||||
* Copyright 2013 Brian Rosenberger (Brutex Network)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.brutex.xservices.ws.impl;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.util.Properties;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.jws.WebService;
|
||||
import net.brutex.xservices.types.HostConnection;
|
||||
import net.brutex.xservices.types.HostinfoType;
|
||||
import net.brutex.xservices.types.MailMimeType;
|
||||
import net.brutex.xservices.types.ReturnCode;
|
||||
import net.brutex.xservices.types.RuntimeInfoType;
|
||||
import net.brutex.xservices.types.ant.FileSetResource;
|
||||
import net.brutex.xservices.util.BrutexNamespaces;
|
||||
import net.brutex.xservices.util.RunTask;
|
||||
import net.brutex.xservices.ws.MiscService;
|
||||
|
||||
import org.apache.cxf.annotations.WSDLDocumentation;
|
||||
import org.apache.cxf.annotations.WSDLDocumentationCollection;
|
||||
import org.apache.tools.ant.taskdefs.HostInfo;
|
||||
import org.apache.tools.ant.taskdefs.Sleep;
|
||||
import org.apache.tools.ant.taskdefs.email.EmailTask;
|
||||
|
||||
/**
|
||||
* Implements the web service
|
||||
*
|
||||
* @author Brian Rosenberger, bru@brutex.de
|
||||
*/
|
||||
@WebService(targetNamespace="http://ws.xservices.brutex.net", endpointInterface="net.brutex.xservices.ws.MiscService", serviceName="MiscService")
|
||||
public class MiscServiceImpl
|
||||
implements MiscService
|
||||
{
|
||||
public HostinfoType getHostinfo(String hostname)
|
||||
{
|
||||
HostInfo info = new HostInfo();
|
||||
info.setTaskName("HostInfo");
|
||||
RunTask runner = new RunTask(info);
|
||||
info.setHost(hostname);
|
||||
|
||||
ReturnCode ret = runner.postTask();
|
||||
HostinfoType infotype = new HostinfoType(
|
||||
ret.getProperty("NAME"),
|
||||
ret.getProperty("DOMAIN"),
|
||||
ret.getProperty("ADDR4"),
|
||||
ret.getProperty("ADDR6"));
|
||||
return infotype;
|
||||
}
|
||||
|
||||
public ReturnCode getInfo() {
|
||||
ReturnCode r = new ReturnCode();
|
||||
r.returnCode = 0;
|
||||
|
||||
Properties props = System.getProperties();
|
||||
|
||||
Enumeration e = props.propertyNames();
|
||||
while (e.hasMoreElements())
|
||||
{
|
||||
String propName = (String)e.nextElement();
|
||||
|
||||
String propValue = (String)props.get(propName);
|
||||
r.stdOut = (r.stdOut + propName + ": " + propValue + "\n");
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
public ReturnCode sendMailSimple(HostConnection mailhost, String from, String tolist, String subject, String message)
|
||||
{
|
||||
return sendMail(from, from, tolist, "", "", subject, message,
|
||||
"text/plain", null, mailhost.hostname, mailhost.port,
|
||||
mailhost.user, mailhost.password, "utf-8", false, false);
|
||||
}
|
||||
|
||||
public ReturnCode sendMailSimpleWithAttachment(HostConnection mailhost, String from, String tolist, String subject, String message, FileSetResource res)
|
||||
{
|
||||
return sendMail(from, from, tolist, "", "", subject, message,
|
||||
"text/plain", res, mailhost.hostname, mailhost.port,
|
||||
mailhost.user, mailhost.password, "utf-8", false, false);
|
||||
}
|
||||
|
||||
public ReturnCode sendMail(HostConnection mailhost, String from, String tolist, String cclist, String bcclist, String subject, MailMimeType mimetype, String charset, String message, FileSetResource res, boolean ssl, boolean tls)
|
||||
{
|
||||
return sendMail(from, from, tolist, cclist, bcclist, subject, message,
|
||||
mimetype.value(), res, mailhost.hostname, mailhost.port,
|
||||
mailhost.user, mailhost.password, charset, tls, ssl);
|
||||
}
|
||||
|
||||
public ReturnCode sleep(int minutes, int seconds) {
|
||||
return sleep(0, minutes, seconds, 0);
|
||||
}
|
||||
|
||||
public String generateUUID() {
|
||||
return UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
private ReturnCode sendMail(String from, String replyto, String tolist, String cclist, String bcclist, String subject, String message, String messagemimetype, FileSetResource attachments, String mailhost, int mailport, String user, String password, String charset, boolean tls, boolean ssl)
|
||||
{
|
||||
EmailTask mail = new EmailTask();
|
||||
mail.setTaskName("Mail");
|
||||
RunTask runner = new RunTask(mail);
|
||||
mail.setFrom(from);
|
||||
mail.setReplyTo(replyto);
|
||||
mail.setToList(tolist);
|
||||
mail.setCcList(cclist);
|
||||
mail.setBccList(bcclist);
|
||||
mail.setSubject(subject);
|
||||
mail.setMessage(message);
|
||||
mail.setMessageMimeType(messagemimetype);
|
||||
if (attachments != null) {
|
||||
mail.addFileset(attachments.getAntResource(mail.getProject()));
|
||||
}
|
||||
mail.setMailhost(mailhost);
|
||||
mail.setMailport(mailport);
|
||||
mail.setUser(user);
|
||||
mail.setPassword(password);
|
||||
mail.setCharset(charset);
|
||||
mail.setSSL(ssl);
|
||||
mail.setEnableStartTLS(tls);
|
||||
return runner.postTask();
|
||||
}
|
||||
|
||||
private ReturnCode sleep(int hours, int minutes, int seconds, int milliseconds)
|
||||
{
|
||||
Sleep sleep = new Sleep();
|
||||
sleep.setTaskName("Sleep");
|
||||
RunTask runner = new RunTask(sleep);
|
||||
sleep.setHours(hours);
|
||||
sleep.setMinutes(minutes);
|
||||
sleep.setSeconds(seconds);
|
||||
sleep.setMilliseconds(milliseconds);
|
||||
return runner.postTask();
|
||||
}
|
||||
|
||||
public RuntimeInfoType getMemory() {
|
||||
return new RuntimeInfoType();
|
||||
}
|
||||
}
|
|
@ -15,9 +15,6 @@
|
|||
*/
|
||||
package net.brutex.xservices.ws.impl;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
|
@ -30,12 +27,12 @@ import javax.activation.DataHandler;
|
|||
import javax.jws.WebParam;
|
||||
import javax.jws.WebService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.configuration2.ex.ConfigurationException;
|
||||
import org.apache.commons.configuration2.PropertiesConfiguration;
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
import org.apache.commons.configuration.PropertiesConfiguration;
|
||||
import org.apache.commons.jcs.JCS;
|
||||
import org.apache.commons.jcs.access.exception.CacheException;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.brutex.DocBuilder.DocBuilder;
|
||||
import net.brutex.mgmt.api.generator.JITCompiler;
|
||||
|
@ -60,10 +57,13 @@ import net.brutex.xservices.ws.XServicesFault;
|
|||
* @author Brian Rosenberger
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES, endpointInterface = "net.brutex.xservices.ws.OpenAirProxyService", serviceName = OpenAirProxyService.SERVICE_NAME)
|
||||
public class OpenAirProxyServiceImpl implements OpenAirProxyService {
|
||||
|
||||
/*
|
||||
* Log4j2 Set Up
|
||||
*/
|
||||
private final Logger logger = LogManager.getLogger(OpenAirProxyServiceImpl.class);
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
@ -459,13 +459,12 @@ public class OpenAirProxyServiceImpl implements OpenAirProxyService {
|
|||
final PropertiesConfiguration props;
|
||||
try {
|
||||
final String config = "../openair.properties";
|
||||
log.debug("Loading Open Air connection details from " + this.getClass().getClassLoader().getResource("/")
|
||||
logger.debug("Loading Open Air connection details from " + this.getClass().getClassLoader().getResource("/")
|
||||
+ config);
|
||||
|
||||
final URL configloc = this.getClass().getClassLoader().getResource(config);
|
||||
|
||||
props = new PropertiesConfiguration();
|
||||
props.read( new InputStreamReader( new BufferedInputStream( configloc.openStream() )));
|
||||
props = new PropertiesConfiguration(configloc);
|
||||
final String user = props.getString("user");
|
||||
final String password = props.getString("password");
|
||||
final String company = props.getString("company");
|
||||
|
@ -476,8 +475,11 @@ public class OpenAirProxyServiceImpl implements OpenAirProxyService {
|
|||
|
||||
con = new OpenAirRestConnection(JCS.getInstance("OACache"), company, user, password);
|
||||
return con;
|
||||
} catch (CacheException | ConfigurationException | IOException e) {
|
||||
log.error(e.getMessage());
|
||||
} catch (CacheException e) {
|
||||
logger.error(e);
|
||||
e.printStackTrace();
|
||||
} catch (ConfigurationException e) {
|
||||
logger.error(e);
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
|
@ -16,8 +16,7 @@
|
|||
|
||||
package net.brutex.xservices.ws.impl;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -107,30 +106,6 @@ public class StringServiceImpl
|
|||
return value;
|
||||
}
|
||||
|
||||
public String handleStringLists(String basestring, String addstring, String removestring, String delimiter) throws XServicesFault {
|
||||
StringTokenizer base = new StringTokenizer(basestring, delimiter);
|
||||
StringTokenizer add = new StringTokenizer(addstring, delimiter);
|
||||
StringTokenizer remove = new StringTokenizer(removestring, delimiter);
|
||||
HashSet<String> hset = new HashSet<String>();
|
||||
String result = new String();
|
||||
|
||||
while(base.hasMoreTokens()) {
|
||||
hset.add(base.nextToken().toString() );
|
||||
}
|
||||
while(add.hasMoreTokens()) {
|
||||
hset.add(add.nextToken().toString() );
|
||||
}
|
||||
while(remove.hasMoreTokens()) {
|
||||
hset.remove(remove.nextToken().toString() );
|
||||
}
|
||||
Iterator<String> hsetit = hset.iterator();
|
||||
while(hsetit.hasNext()) {
|
||||
result = result.concat(hsetit.next().toString() + delimiter);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private int getFlags(String flags) {
|
||||
int allflags = 0;
|
||||
if (flags.contains("i")) {
|
|
@ -32,7 +32,6 @@ import javax.xml.stream.XMLOutputFactory;
|
|||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamWriter;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.brutex.xservices.types.AttributeType;
|
||||
import net.brutex.xservices.types.NamespaceListType;
|
||||
import net.brutex.xservices.types.NamespaceType;
|
||||
|
@ -55,7 +54,8 @@ import org.apache.axiom.om.OMText;
|
|||
import org.apache.axiom.om.OMXMLBuilderFactory;
|
||||
import org.apache.axiom.om.xpath.AXIOMXPath;
|
||||
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jaxen.JaxenException;
|
||||
import org.jaxen.SimpleNamespaceContext;
|
||||
|
@ -64,10 +64,9 @@ import org.jaxen.SimpleNamespaceContext;
|
|||
* @author Brian Rosenberger, bru(at)brutex.de
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@WebService(targetNamespace = "http://ws.xservices.brutex.net", endpointInterface = "net.brutex.xservices.ws.XmlService", serviceName = "XmlService")
|
||||
public class XmlServiceImpl implements XmlService {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
|
||||
public String insertNodesFromFile(FileResource res, NamespaceListType nsList, String xpath, String xmlFragment)
|
||||
throws XServicesFault {
|
||||
|
@ -95,7 +94,7 @@ public class XmlServiceImpl implements XmlService {
|
|||
XMLStreamWriter writer = xof.createXMLStreamWriter(sw);
|
||||
document.serialize(writer);
|
||||
|
||||
log.debug(sw.getBuffer().toString());
|
||||
this.logger.trace(sw.getBuffer().toString());
|
||||
return sw.getBuffer().toString();
|
||||
} catch (JaxenException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -135,7 +134,7 @@ public class XmlServiceImpl implements XmlService {
|
|||
XMLStreamWriter writer = xof.createXMLStreamWriter(sw);
|
||||
document.serialize(writer);
|
||||
|
||||
log.debug(sw.getBuffer().toString());
|
||||
this.logger.trace(sw.getBuffer().toString());
|
||||
return sw.getBuffer().toString();
|
||||
} catch (JaxenException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -176,7 +175,7 @@ public class XmlServiceImpl implements XmlService {
|
|||
XMLStreamWriter writer = xof.createXMLStreamWriter(sw);
|
||||
document.serialize(writer);
|
||||
|
||||
log.debug(sw.getBuffer().toString());
|
||||
this.logger.trace(sw.getBuffer().toString());
|
||||
return sw.getBuffer().toString();
|
||||
} catch (JaxenException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -217,7 +216,7 @@ public class XmlServiceImpl implements XmlService {
|
|||
XMLStreamWriter writer = xof.createXMLStreamWriter(sw);
|
||||
document.serialize(writer);
|
||||
|
||||
log.debug(sw.getBuffer().toString());
|
||||
this.logger.trace(sw.getBuffer().toString());
|
||||
return sw.getBuffer().toString();
|
||||
} catch (JaxenException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -358,8 +357,8 @@ public class XmlServiceImpl implements XmlService {
|
|||
List<?> olist = null;
|
||||
try {
|
||||
olist = axp.selectNodes(xmldocument.getOMDocumentElement());
|
||||
log.debug("XPath '" + axp.toString() + "' has " + olist.size() + " matches.");
|
||||
log.debug("XPath root expression is: '" + axp.debug() + "'.");
|
||||
this.logger.debug("XPath '" + axp.toString() + "' has " + olist.size() + " matches.");
|
||||
this.logger.trace("XPath root expression is: '" + axp.debug() + "'.");
|
||||
} catch (JaxenException e) {
|
||||
throw new XServicesFault(e.getMessage(), e);
|
||||
}
|
||||
|
@ -381,25 +380,26 @@ public class XmlServiceImpl implements XmlService {
|
|||
match = (OMElement) o;
|
||||
if ((o instanceof OMDocument))
|
||||
match = ((OMDocument) o).getOMDocumentElement();
|
||||
log.debug(Messages.getString("XmlService.8"));
|
||||
this.logger.debug(Messages.getString("XmlService.8"));
|
||||
break;
|
||||
case OMNode.TEXT_NODE:
|
||||
match = ((OMText) o).getParent();
|
||||
log.debug(Messages.getString("XmlService.9"));
|
||||
this.logger.debug(Messages.getString("XmlService.9"));
|
||||
break;
|
||||
case OMNode.COMMENT_NODE:
|
||||
// match = node.getParent();
|
||||
match = (OMContainer) node;
|
||||
log.debug(Messages.getString("XmlService.10"));
|
||||
this.logger.debug(Messages.getString("XmlService.10"));
|
||||
break;
|
||||
default:
|
||||
log.error("XPath matched " + o.getClass().getCanonicalName() + " Node Type:" + node.getType());
|
||||
log.error(Messages.getString("XmlService.11"));
|
||||
this.logger
|
||||
.error("XPath matched " + o.getClass().getCanonicalName() + " Node Type:" + node.getType());
|
||||
this.logger.error(Messages.getString("XmlService.11"));
|
||||
throw new XServicesFault(Messages.getString("XmlService.12"));
|
||||
}
|
||||
} else {
|
||||
log.error("XPath matched " + o.getClass().getCanonicalName());
|
||||
log.error(Messages.getString("XmlService.11"));
|
||||
this.logger.error("XPath matched " + o.getClass().getCanonicalName());
|
||||
this.logger.error(Messages.getString("XmlService.11"));
|
||||
throw new XServicesFault(Messages.getString("XmlService.12"));
|
||||
}
|
||||
|
||||
|
@ -419,8 +419,8 @@ public class XmlServiceImpl implements XmlService {
|
|||
List<?> olist = null;
|
||||
try {
|
||||
olist = axp.selectNodes(xmldocument.getOMDocumentElement());
|
||||
log.debug("XPath '" + axp.toString() + "' has " + olist.size() + " matches.");
|
||||
log.debug("XPath root expression is: '" + axp.debug() + "'.");
|
||||
this.logger.debug("XPath '" + axp.toString() + "' has " + olist.size() + " matches.");
|
||||
this.logger.trace("XPath root expression is: '" + axp.debug() + "'.");
|
||||
} catch (JaxenException e) {
|
||||
throw new XServicesFault(e.getMessage(), e);
|
||||
}
|
||||
|
@ -442,16 +442,17 @@ public class XmlServiceImpl implements XmlService {
|
|||
match = (OMElement) o;
|
||||
if ((o instanceof OMDocument))
|
||||
match = ((OMDocument) o).getOMDocumentElement();
|
||||
log.debug(Messages.getString("XmlService.8"));
|
||||
this.logger.debug(Messages.getString("XmlService.8"));
|
||||
break;
|
||||
default:
|
||||
log.error("XPath matched " + o.getClass().getCanonicalName() + " Node Type:" + node.getType());
|
||||
log.error(Messages.getString("XmlService.11"));
|
||||
this.logger
|
||||
.error("XPath matched " + o.getClass().getCanonicalName() + " Node Type:" + node.getType());
|
||||
this.logger.error(Messages.getString("XmlService.11"));
|
||||
throw new XServicesFault(Messages.getString("XmlService.12"));
|
||||
}
|
||||
} else {
|
||||
log.error("XPath matched " + o.getClass().getCanonicalName());
|
||||
log.error(Messages.getString("XmlService.11"));
|
||||
this.logger.error("XPath matched " + o.getClass().getCanonicalName());
|
||||
this.logger.error(Messages.getString("XmlService.11"));
|
||||
throw new XServicesFault(Messages.getString("XmlService.12"));
|
||||
}
|
||||
|
||||
|
@ -471,11 +472,11 @@ public class XmlServiceImpl implements XmlService {
|
|||
if (nsList != null) {
|
||||
for (NamespaceType ns : nsList.getNamespaces()) {
|
||||
context.addNamespace(ns.getPrefix(), ns.getUri().toString());
|
||||
log.debug(
|
||||
this.logger.debug(
|
||||
Messages.getString("XmlService.0") + ns.getPrefix() + "=\"" + ns.getUri().toString() + "\"'");
|
||||
}
|
||||
} else {
|
||||
log.debug("No namespaces defined.");
|
||||
logger.debug("No namespaces defined.");
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
@ -489,7 +490,7 @@ public class XmlServiceImpl implements XmlService {
|
|||
} catch (IllegalCharsetNameException e) {
|
||||
throw new XServicesFault("Endcoding '" + encoding + "' is not supported by this JRE.");
|
||||
}
|
||||
log.debug("Setting source xml string encoding to '" + encoding + "'");
|
||||
logger.debug("Setting source xml string encoding to '" + encoding + "'");
|
||||
return encoding;
|
||||
}
|
||||
|
|
@ -12,7 +12,6 @@ import java.util.StringTokenizer;
|
|||
import javax.ws.rs.core.HttpHeaders;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.brutex.xservices.types.scm.AttributeType;
|
||||
import net.brutex.xservices.types.scm.ItemListType;
|
||||
import net.brutex.xservices.types.scm.ItemType;
|
||||
|
@ -30,6 +29,8 @@ import org.apache.commons.configuration2.ex.ConfigurationException;
|
|||
import org.apache.commons.jcs.JCS;
|
||||
import org.apache.commons.jcs.access.CacheAccess;
|
||||
import org.apache.commons.jcs.access.exception.CacheException;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.netbeans.lib.cvsclient.Client;
|
||||
import org.netbeans.lib.cvsclient.command.CommandAbortedException;
|
||||
import org.netbeans.lib.cvsclient.command.CommandException;
|
||||
|
@ -44,16 +45,15 @@ import org.netbeans.lib.cvsclient.connection.AuthenticationException;
|
|||
import org.netbeans.lib.cvsclient.event.EventManager;
|
||||
import org.netbeans.lib.cvsclient.event.FileInfoEvent;
|
||||
|
||||
@Slf4j
|
||||
public class CVSInfoImpl implements CVSInfo {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
final ObjectFactory FACTORY = new ObjectFactory();
|
||||
final ItemListType list = this.FACTORY.createItemListType();
|
||||
|
||||
public Response getRepositoryFiles(HttpHeaders h, File f, String modules,
|
||||
boolean isRecursive, boolean showRevisions, boolean forceNoCache) {
|
||||
String cachekey = "getFiles" + f.toURI().toString();
|
||||
log.debug("forceNoCache=" + forceNoCache);
|
||||
CVSInfoImpl.logger.debug("forceNoCache=" + forceNoCache);
|
||||
ItemListType cacheresult = (ItemListType) getCacheInstance().get(
|
||||
cachekey);
|
||||
|
||||
|
@ -121,7 +121,7 @@ public class CVSInfoImpl implements CVSInfo {
|
|||
try {
|
||||
CVSInfoImpl.this.getCacheInstance().put(key, cvsfile);
|
||||
} catch (CacheException e) {
|
||||
log.error("Could not cache item '"
|
||||
CVSInfoImpl.logger.error("Could not cache item '"
|
||||
+ key + "'", e);
|
||||
}
|
||||
}
|
||||
|
@ -142,14 +142,14 @@ public class CVSInfoImpl implements CVSInfo {
|
|||
|
||||
rlog.setRecursive(isRecursive);
|
||||
|
||||
log.info("Executing CVS command '" + rlog.getCVSCommand()
|
||||
CVSInfoImpl.logger.info("Executing CVS command '" + rlog.getCVSCommand()
|
||||
+ "' against '" + cvsclient.getRoot().host + "@"
|
||||
+ cvsclient.getRoot().repository + "'");
|
||||
client.executeCommand(rlog, cvsclient.getGlobalOptions());
|
||||
|
||||
getCacheInstance().put(cachekey, this.list);
|
||||
} catch (ConfigurationException e) {
|
||||
log.error("CVS Configuration File '" + f.getAbsolutePath()
|
||||
CVSInfoImpl.logger.error("CVS Configuration File '" + f.getAbsolutePath()
|
||||
+ f.getName() + "'not found.", e);
|
||||
} catch (CommandAbortedException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -172,7 +172,7 @@ public class CVSInfoImpl implements CVSInfo {
|
|||
|
||||
public Response getModules(HttpHeaders h, File f, boolean forceNoCache) {
|
||||
String cachekey = "Modules" + f.toURI().toString();
|
||||
log.debug("forceNoCache=" + forceNoCache);
|
||||
CVSInfoImpl.logger.debug("forceNoCache=" + forceNoCache);
|
||||
|
||||
ModuleListType response = (ModuleListType) getCacheInstance().get(
|
||||
cachekey);
|
||||
|
@ -200,12 +200,12 @@ public class CVSInfoImpl implements CVSInfo {
|
|||
CheckoutCommand co = new CheckoutCommand();
|
||||
co.setShowModulesWithStatus(true);
|
||||
|
||||
log.info("Executing CVS command '" + co.getCVSCommand()
|
||||
CVSInfoImpl.logger.info("Executing CVS command '" + co.getCVSCommand()
|
||||
+ "' against '" + cvsclient.getRoot().host + "@"
|
||||
+ cvsclient.getRoot().repository + "'");
|
||||
client.executeCommand(co, cvsclient.getGlobalOptions());
|
||||
if (list.getModules().size() == 0) {
|
||||
log.warn("Repository '"
|
||||
CVSInfoImpl.logger.warn("Repository '"
|
||||
+ cvsclient.getRoot().repository
|
||||
+ "' does not have modules");
|
||||
}
|
||||
|
@ -220,14 +220,14 @@ public class CVSInfoImpl implements CVSInfo {
|
|||
|
||||
public Response getTags(HttpHeaders h, File f, boolean withFiles) {
|
||||
String cachekey = f.toURI().toString() + ":taglist";
|
||||
log.debug("Retrieving Tags from cache using key '" + cachekey
|
||||
CVSInfoImpl.logger.debug("Retrieving Tags from cache using key '" + cachekey
|
||||
+ "'");
|
||||
TagListType tags = (TagListType) getCacheInstance().get(cachekey);
|
||||
if (tags != null) {
|
||||
log.debug("Delivering Tags from cache.");
|
||||
CVSInfoImpl.logger.debug("Delivering Tags from cache.");
|
||||
return Response.ok(tags).build();
|
||||
}
|
||||
log.warn("Taglist not found in cache.");
|
||||
CVSInfoImpl.logger.warn("Taglist not found in cache.");
|
||||
return Response.noContent().build();
|
||||
}
|
||||
|
||||
|
@ -239,17 +239,17 @@ public class CVSInfoImpl implements CVSInfo {
|
|||
ItemListType list = null;
|
||||
|
||||
if (!forceNoCache) {
|
||||
log.debug("Retrieving file content from cache using key '"
|
||||
CVSInfoImpl.logger.debug("Retrieving file content from cache using key '"
|
||||
+ cachekey + "'");
|
||||
list = (ItemListType) getCacheInstance().get(cachekey);
|
||||
}
|
||||
|
||||
if (list != null) {
|
||||
log.debug("Delivering file content from cache.");
|
||||
CVSInfoImpl.logger.debug("Delivering file content from cache.");
|
||||
return Response.ok(list).build();
|
||||
}
|
||||
|
||||
log.warn("File content not found in cache.");
|
||||
CVSInfoImpl.logger.warn("File content not found in cache.");
|
||||
list = this.FACTORY.createItemListType();
|
||||
try {
|
||||
CVSClient cvsclient = new CVSClient(f);
|
||||
|
@ -306,7 +306,7 @@ public class CVSInfoImpl implements CVSInfo {
|
|||
checkout.setModule(filestring);
|
||||
checkout.setPipeToOutput(true);
|
||||
|
||||
log.info("Execute CVS command '" + checkout.getCVSCommand()
|
||||
CVSInfoImpl.logger.info("Execute CVS command '" + checkout.getCVSCommand()
|
||||
+ "' against '" + cvsclient.getRoot().host + "@"
|
||||
+ cvsclient.getRoot().repository + "'");
|
||||
client.executeCommand(checkout, cvsclient.getGlobalOptions());
|
||||
|
@ -330,10 +330,10 @@ public class CVSInfoImpl implements CVSInfo {
|
|||
CacheAccess<Object, Object> jcs = null;
|
||||
String cacheinstance = "CVSCache";
|
||||
try {
|
||||
log.trace("Getting cache instance named 'CVSCache'");
|
||||
CVSInfoImpl.logger.trace("Getting cache instance named 'CVSCache'");
|
||||
jcs = JCS.getInstance("CVSCache");
|
||||
} catch (CacheException e) {
|
||||
log.error("Failed to get cache instance", e);
|
||||
CVSInfoImpl.logger.error("Failed to get cache instance", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return jcs;
|
||||
|
@ -347,24 +347,29 @@ public class CVSInfoImpl implements CVSInfo {
|
|||
+ client.getRoot().repository;
|
||||
|
||||
String cachestring = "FINDINGS-" + cvsroot;
|
||||
log.debug("Fetch searchFileContent response from cache using cachekey '"
|
||||
CVSInfoImpl.logger
|
||||
.debug("Fetch searchFileContent response from cache using cachekey '"
|
||||
+ cachestring + "'");
|
||||
FindingsListType result = (FindingsListType) getCacheInstance()
|
||||
.get(cachestring);
|
||||
if (result != null)
|
||||
log.debug("Found object for key '" + cachestring
|
||||
CVSInfoImpl.logger.debug("Found object for key '" + cachestring
|
||||
+ "' in cache.");
|
||||
else {
|
||||
log.debug("Found no object for key '" + cachestring
|
||||
CVSInfoImpl.logger.debug("Found no object for key '" + cachestring
|
||||
+ "' in cache.");
|
||||
}
|
||||
|
||||
if (result != null)
|
||||
return Response.ok(result).build();
|
||||
} catch (CommandAbortedException | AuthenticationException | ConfigurationException e) {
|
||||
} catch (CommandAbortedException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (AuthenticationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return Response.noContent().build();
|
||||
return Response.noContent().build();
|
||||
}
|
||||
|
||||
private AttributeType getAttribute(String name, String value) {
|
|
@ -33,14 +33,14 @@ import javax.ws.rs.core.HttpHeaders;
|
|||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.configuration2.PropertiesConfiguration;
|
||||
import org.apache.commons.configuration2.builder.fluent.Configurations;
|
||||
import org.apache.commons.configuration2.ex.ConfigurationException;
|
||||
import org.apache.commons.jcs.JCS;
|
||||
import org.apache.commons.jcs.access.CacheAccess;
|
||||
import org.apache.commons.jcs.access.exception.CacheException;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.brutex.xservices.cmtypes.ItemType;
|
||||
import net.brutex.xservices.cmtypes.ItemTypeList;
|
||||
|
@ -78,9 +78,9 @@ import com.serena.dmclient.api.SystemAttributes;
|
|||
*
|
||||
* @author Brian Rosenberger, bru(at)brutex.de
|
||||
*/
|
||||
@Slf4j
|
||||
public class DIMCMInfoImpl implements DIMCMInfo {
|
||||
|
||||
Logger logger = LogManager.getLogger();
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
@ -238,14 +238,14 @@ public class DIMCMInfoImpl implements DIMCMInfo {
|
|||
|
||||
if (search == null || search.equals("")) {
|
||||
search = "*";
|
||||
log.info("No search pattern supplied, using default '*'.");
|
||||
logger.info("No search pattern supplied, using default '*'.");
|
||||
}
|
||||
|
||||
FileWalker finder = new FileWalker(search);
|
||||
try {
|
||||
Files.walkFileTree(dir.toPath(),
|
||||
EnumSet.of(FileVisitOption.FOLLOW_LINKS), depth, finder);
|
||||
log.info("FileWalker returned '" + finder.getCount()
|
||||
logger.info("FileWalker returned '" + finder.getCount()
|
||||
+ "' hits. '" + finder.getTotal()
|
||||
+ "' files have been scanned.");
|
||||
List<Path> result = finder.getResult();
|
||||
|
@ -261,7 +261,7 @@ public class DIMCMInfoImpl implements DIMCMInfo {
|
|||
list.add(new FileInfoType(f, baseuri));
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
log.error(e2.getMessage(), e2);
|
||||
logger.error(e2.getMessage(), e2);
|
||||
;
|
||||
}
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ public class DIMCMInfoImpl implements DIMCMInfo {
|
|||
if (conn != null)
|
||||
return conn;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
|
||||
/*
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue