Subversion Repositories XServices

Compare Revisions

No changes between revisions

Ignore whitespace Rev 197 → Rev 198

/xservices/trunk/ivy.xml
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/ivysettings.xml
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/web/META-INF/MANIFEST.MF
File deleted
/xservices/trunk/web/NOTICE
File deleted
\ No newline at end of file
/xservices/trunk/web/LICENSE.cxf
File deleted
/xservices/trunk/web/LICENSE
File deleted
/xservices/trunk/web/LICENSE.ant
File deleted
/xservices/trunk/web/LICENSE.antcontrib
File deleted
/xservices/trunk/web/LICENSE.jaxb
File deleted
/xservices/trunk/web/WEB-INF/shiro.ini
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/web/WEB-INF/dimcm.properties
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/web/WEB-INF/applicationContext.xml
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/web/WEB-INF/data/QRTZ_LOCKS.ddl
File deleted
\ No newline at end of file
/xservices/trunk/web/WEB-INF/data/QRTZ_CALENDARS.ddl
File deleted
\ No newline at end of file
/xservices/trunk/web/WEB-INF/data/QRTZ_SCHEDULER_STATE.ddl
File deleted
\ No newline at end of file
/xservices/trunk/web/WEB-INF/data/QRTZ_PAUSED_TRIGGER_GRPS.ddl
File deleted
\ No newline at end of file
/xservices/trunk/web/WEB-INF/data/QRTZ_SIMPROP_TRIGGERS.ddl
File deleted
\ No newline at end of file
/xservices/trunk/web/WEB-INF/data/QRTZ_SIMPLE_TRIGGERS.ddl
File deleted
\ No newline at end of file
/xservices/trunk/web/WEB-INF/data/QRTZ_FIRED_TRIGGERS.ddl
File deleted
\ No newline at end of file
/xservices/trunk/web/WEB-INF/data/QRTZ_JOB_DETAILS.ddl
File deleted
\ No newline at end of file
/xservices/trunk/web/WEB-INF/data/QRTZ_BLOB_TRIGGERS.ddl
File deleted
\ No newline at end of file
/xservices/trunk/web/WEB-INF/data/QRTZ_TRIGGERS.ddl
File deleted
\ No newline at end of file
/xservices/trunk/web/WEB-INF/data/QRTZ_CRON_TRIGGERS.ddl
File deleted
\ No newline at end of file
/xservices/trunk/web/WEB-INF/web.xml
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/web/WEB-INF/log4j2.xml
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/web/WEB-INF
Property changes:
Deleted: svn:ignore
-sun-jaxws.xml
/xservices/trunk/web/LICENSE.unrar
File deleted
\ No newline at end of file
/xservices/trunk/web/index.html
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/build.gradle
0,0 → 1,54
apply plugin: 'war'
 
repositories {
mavenCentral()
}
 
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.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.apache.logging.log4j:log4j-core:2.20.0"
implementation "org.apache.logging.log4j:log4j-web:2.20.0"
implementation "org.apache.logging.log4j:log4j-1.2-api:2.20.0"
implementation "org.apache.logging.log4j:log4j-slf4j18-impl:2.18.0"
 
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.6.1"
implementation "org.apache.cxf:cxf-rt-databinding-aegis:3.6.1"
runtimeOnly "org.apache.cxf:cxf-rt-transports-http:3.6.1"
runtimeOnly "org.apache.cxf:cxf-rt-frontend-jaxrs:3.6.1"
runtimeOnly "org.apache.cxf:cxf-rt-frontend-jaxws:3.6.1"
runtimeOnly "org.apache.cxf:cxf-rt-security:3.6.1"
 
 
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 fileTree(dir: "lib/", includes: ["*.jar"])
}
/xservices/trunk/gradle/wrapper/gradle-wrapper.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/xservices/trunk/gradle/wrapper/gradle-wrapper.properties
0,0 → 1,7
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
/xservices/trunk/gradlew
0,0 → 1,248
#!/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" "$@"
/xservices/trunk/gradlew.bat
0,0 → 1,92
@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
/xservices/trunk/src/java/log4j.properties
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/cache.ccf
File deleted
/xservices/trunk/src/java/log4j2.xml
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/quartz.properties
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/security/PermissionResolver.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/security/XmlServicePermission.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/security/XServicesRealm.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/security/DirectoryPermission.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/XmlService.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/MailServiceImpl.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/ExecuteServiceImpl.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/StorageServiceImpl.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/Messages.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/StringServiceImpl.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/JobServiceImpl.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/MiscServiceImpl.java
File deleted
\ No newline at end of file
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/DateServiceImpl.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/OpenAirProxyServiceImpl.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/messages.properties
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/FileServiceImpl.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/XmlServiceImpl.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/ArchiveServiceImpl.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/ArchiveService.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/ws/ExecuteService.java
File deleted
\ No newline at end of file
/xservices/trunk/src/java/net/brutex/xservices/ws/MailService.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/rs/CVSInfoImpl.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/rs/OpenAirInfoService.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/rs/FileInfo.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/rs/OpenAirInfoServiceImpl.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/rs/FileInfoImpl.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/rs/FileListType.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/rs/ResultType.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/rs/DIMCMInfo.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/rs/CVSInfo.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/rs/DIMCMInfoImpl.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/StorageService.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/StringService.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/XServicesFault.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/ws/JobService.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/MiscService.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/ws/DateService.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/OpenAirProxyService.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/ws/FileService.java
File deleted
\ No newline at end of file
/xservices/trunk/src/java/net/brutex/xservices/util/BrutexHSQLQuartzConnectionProvider.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/util/BasicCVSListener.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/util/cache/DaemonThreadFactory.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/util/cache/CacheExecutorService.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/util/cache/CacheServlet.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/util/cache/FindingsCacheServlet.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/util/cache/FindingsConfigBean.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/util/FileWalker.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/util/XServicesDocumentation.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/util/RunTask.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/util/BrutexNamespaces.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/util/UnRarTask.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/util/CVSClient.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/util/JobWrapper.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/util/BrutexQuartzConnectionProvider.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/util/OpenAirConnection.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/util/CvsPassword.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/util/CVSRoot.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/cmtypes/ItemTypeList.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/cmtypes/ItemType.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/DateFormatType.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/StringMatchDetails.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/NamespaceListType.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/HostinfoType.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/DateInfoType.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/ScheduledJob.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/MailMimeType.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/types/TimeZoneType.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/HostConnection.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/types/FileInfoType.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/TargetNodeType.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/NamespaceType.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/RuntimeInfoType.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/ant/ContainsSelectorType.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/types/ant/SelectorType.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/types/ant/SelectorTypeInterface.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/types/ant/FileSetResource.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/types/ant/ResourceSetInterface.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/ant/PatternElement.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/types/ant/AntProperty.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/types/ant/FileResource.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/types/ant/ResourceInterface.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/types/ant/ArchiveResource.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/types/ant/AttachmentType.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/ant/PatternSetType.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/types/ant/DateInfoType.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/ant/CollectionType.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/CompressionType.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/types/StringReplaceType.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/AttributeType.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/ReplacePattern.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/ReturnCode.java
File deleted
/xservices/trunk/src/java/net/brutex/xservices/types/DateInfoExtendedType.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/DateTimeUnits.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/StringSplitType.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/types/StringMatchType.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/util/BrutexHSQLQuartzConnectionProvider.java
0,0 → 1,188
/*
* Copyright 2011 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.util;
 
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
 
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
*
*/
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)) {
logger.debug("Checking tables on pre-exisiting database connection.");
checkTables();
return conn;
}
try {
// Class.forName("org.hsqldb.jdbc.JDBCDriver" );
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
} catch (Exception e) {
logger.fatal("Failed to load Derby JDBC driver.");
e.printStackTrace();
return null;
}
 
if(isConnected(false)) {
checkTables();
} else {
return null;
}
return conn;
}
 
public void shutdown() throws SQLException {
try {
// Class.forName("org.hsqldb.jdbc.JDBCDriver" );
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
} catch (Exception e) {
System.err.println("ERROR: failed to load Derby JDBC driver.");
e.printStackTrace();
return;
}
String t = this.getClass().getClassLoader().getResource("/").toString()
.substring(6);
t += "../data/db";
System.out.println("Shut down embedded database now.");
Connection c = DriverManager.getConnection("jdbc:derby:" + t
+ ";shutdown=true;");
 
}
 
@Override
public void initialize() throws SQLException {
 
}
 
private synchronized void recursiveDelete(File dbDir) {
File[] files = dbDir.listFiles();
for (int i = 0; i < files.length; i++) {
if (files[i].isFile()) {
files[i].delete();
} else {
recursiveDelete(files[i]);
files[i].delete();
}
}
dbDir.delete();
}
private synchronized void checkTables() throws SQLException {
logger.debug("Checking QUARTZ database schema.");
if(!isConnected(false)) {
logger.error("Failed to validate QUARTZ database schema.");
return;
}
List<String> ddl_list = new ArrayList<String>(11);
ddl_list.add("QRTZ_JOB_DETAILS");
ddl_list.add("QRTZ_TRIGGERS");
ddl_list.add("QRTZ_SIMPLE_TRIGGERS");
ddl_list.add("QRTZ_CRON_TRIGGERS");
ddl_list.add("QRTZ_SIMPROP_TRIGGERS");
ddl_list.add("QRTZ_BLOB_TRIGGERS");
ddl_list.add("QRTZ_CALENDARS");
ddl_list.add("QRTZ_PAUSED_TRIGGER_GRPS");
ddl_list.add("QRTZ_FIRED_TRIGGERS");
ddl_list.add("QRTZ_SCHEDULER_STATE");
ddl_list.add("QRTZ_LOCKS");
String ddl = this.getClass().getClassLoader().getResource("/").toString()
.substring(6)+ "../data/";
 
DatabaseMetaData dmd = conn.getMetaData();
for (String tbl : ddl_list) {
ResultSet rs = dmd.getTables(null, "APP", tbl, null);
if (!rs.next()) {
logger.log(Level.INFO, "Adding DDL for table "+ tbl);
Statement st = conn.createStatement();
File ddlFile = new File(ddl + tbl + ".ddl");
String create = "";
try {
BufferedReader r = new BufferedReader(new FileReader(ddlFile));
while (r.ready()) {
create += r.readLine() + "\n";
}
create.trim();
if( st.execute(create)) {
logger.log(Level.INFO, "Table " + tbl + " created.");
}
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
} catch (SQLException ex) {
logger.log(Level.ERROR, "Error executing statement "+ create );
System.out.println(ex.getMessage());
}
} else {
logger.trace("Table "+tbl+" exists.");
}
}
}
private synchronized boolean isConnected(boolean fail) throws SQLException {
if(conn!=null ) { // Todo: && conn.conn.isValid(5)) {) {
return true;
} else {
String t = this.getClass().getClassLoader().getResource("/").toString().substring(6); // WEB-INF/classes
t += "../data/db";
logger.debug("Database directory is set to '" + t + "'");
try {
this.conn = DriverManager.getConnection("jdbc:derby:" + t + ";create=true;");
} catch (SQLException ex) {
logger.error(ex.getMessage(), ex);
if(!fail) {
logger.warn("Deleting database directory.");
recursiveDelete(new File(t));
logger.warn("Retrying to connect to database.");
return isConnected(true);
} else {
return false;
}
}
}
return false;
}
 
 
}
 
 
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/util/BrutexQuartzConnectionProvider.java
0,0 → 1,187
/*
* Copyright 2011 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.util;
 
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
 
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
*
*/
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)) {) {
logger.debug("Checking tables on pre-exisiting database connection.");
checkTables();
return conn;
}
try {
// Class.forName("org.hsqldb.jdbc.JDBCDriver" );
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
} catch (Exception e) {
logger.fatal("Failed to load Derby JDBC driver.");
e.printStackTrace();
return null;
}
 
if(isConnected(false)) {
checkTables();
} else {
return null;
}
return conn;
}
 
public void shutdown() throws SQLException {
try {
// Class.forName("org.hsqldb.jdbc.JDBCDriver" );
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
} catch (Exception e) {
System.err.println("ERROR: failed to load Derby JDBC driver.");
e.printStackTrace();
return;
}
String t = this.getClass().getClassLoader().getResource("/").toString()
.substring(6);
t += "../data/db";
System.out.println("Shut down embedded database now.");
Connection c = DriverManager.getConnection("jdbc:derby:" + t
+ ";shutdown=true;");
 
}
 
@Override
public void initialize() throws SQLException {
 
}
 
private synchronized void recursiveDelete(File dbDir) {
File[] files = dbDir.listFiles();
for (int i = 0; i < files.length; i++) {
if (files[i].isFile()) {
files[i].delete();
} else {
recursiveDelete(files[i]);
files[i].delete();
}
}
dbDir.delete();
}
private synchronized void checkTables() throws SQLException {
logger.debug("Checking QUARTZ database schema.");
if(!isConnected(false)) {
logger.error("Failed to validate QUARTZ database schema.");
return;
}
List<String> ddl_list = new ArrayList<String>(11);
ddl_list.add("QRTZ_JOB_DETAILS");
ddl_list.add("QRTZ_TRIGGERS");
ddl_list.add("QRTZ_SIMPLE_TRIGGERS");
ddl_list.add("QRTZ_CRON_TRIGGERS");
ddl_list.add("QRTZ_SIMPROP_TRIGGERS");
ddl_list.add("QRTZ_BLOB_TRIGGERS");
ddl_list.add("QRTZ_CALENDARS");
ddl_list.add("QRTZ_PAUSED_TRIGGER_GRPS");
ddl_list.add("QRTZ_FIRED_TRIGGERS");
ddl_list.add("QRTZ_SCHEDULER_STATE");
ddl_list.add("QRTZ_LOCKS");
String ddl = this.getClass().getClassLoader().getResource("/").toString()
.substring(6)+ "../data/";
 
DatabaseMetaData dmd = conn.getMetaData();
for (String tbl : ddl_list) {
ResultSet rs = dmd.getTables(null, "APP", tbl, null);
if (!rs.next()) {
logger.log(Level.INFO, "Adding DDL for table "+ tbl);
Statement st = conn.createStatement();
File ddlFile = new File(ddl + tbl + ".ddl");
String create = "";
try {
BufferedReader r = new BufferedReader(new FileReader(ddlFile));
while (r.ready()) {
create += r.readLine() + "\n";
}
create.trim();
if( st.execute(create)) {
logger.log(Level.INFO, "Table " + tbl + " created.");
}
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
} catch (SQLException ex) {
logger.log(Level.ERROR, "Error executing statement "+ create );
System.out.println(ex.getMessage());
}
} else {
logger.trace("Table "+tbl+" exists.");
}
}
}
private synchronized boolean isConnected(boolean fail) throws SQLException {
if(conn!=null ) { // Todo: && conn.conn.isValid(5)) {) {
return true;
} else {
String t = this.getClass().getClassLoader().getResource("/").toString().substring(6); // WEB-INF/classes
t += "../data/db";
logger.debug("Database directory is set to '" + t + "'");
try {
this.conn = DriverManager.getConnection("jdbc:derby:" + t + ";create=true;");
} catch (SQLException ex) {
logger.error(ex.getMessage(), ex);
if(!fail) {
logger.warn("Deleting database directory.");
recursiveDelete(new File(t));
logger.warn("Retrying to connect to database.");
return isConnected(true);
} else {
return false;
}
}
}
return false;
}
 
}
 
 
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/util/OpenAirConnection.java
0,0 → 1,64
/**
*
*/
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 org.apache.commons.configuration2.ex.ConfigurationException;
import org.apache.commons.configuration2.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;
 
/**
* @author brosenberger
*
*/
public final class OpenAirConnection {
private final static Logger logger = LogManager.getLogger();
public static OpenAirRestConnection getOpenAirConnection() {
final PropertiesConfiguration props;
try {
final String config = "../openair.properties";
logger.info("Loading Open Air connection details from {}", config.toString());
final URL configloc = OpenAirConnection.class.getClassLoader().getResource(config);
logger.debug("Loading Open Air connection details from {}", configloc.toString());
 
props = new PropertiesConfiguration();
props.read( new InputStreamReader( new BufferedInputStream(configloc.openStream())) );
 
final String user = props.getString("user");
final String password = props.getString("password");
final String company = props.getString("company");
final String apikey = props.getString("apikey", "_PUT_HERE_");
final String namespace = props.getString("namespace", "");
 
final OpenAirRestConnection con;
 
con = new OpenAirRestConnection(JCS.getInstance("OACache"), company, user, password);
return con;
} catch (CacheException e) {
logger.error(e.getMessage(), e);
e.printStackTrace();
} catch (ConfigurationException e) {
logger.error(e.getMessage(), e);
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
 
}
return null;
}
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/util/CVSClient.java
0,0 → 1,98
/* */ package net.brutex.xservices.util;
/* */
/* */ import java.io.File;
/* */ 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;
/* */
/* */ 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()
/* */ {
/* 49 */ return this.client;
/* */ }
/* */
/* */ public CVSClient(File config) throws CommandAbortedException, AuthenticationException, ConfigurationException {
/* 53 */ System.setProperty("cvsClientLog", "c:/temp/cvs.log");
/* 54 */ if ((config == null) || (!config.exists()) || (config.isDirectory())) {
/* 55 */ throw new ConfigurationException("Config file not found");
/* */ }
/* 57 */ this.configfile = config;
Configurations configs = new Configurations();
/* 58 */ PropertiesConfiguration configuration = configs.properties(this.configfile);
/* */
/* 60 */ String cvsroot = configuration.getString("CVSROOT");
/* 61 */ String workdir = configuration.getString("WORKDIR");
/* 62 */ String password = configuration.getString("PASSWORD");
/* */
/* 64 */ this.root = new CVSRoot(cvsroot);
/* 65 */ this.globalOptions = new GlobalOptions();
/* 66 */ this.globalOptions.setCVSRoot(cvsroot);
/* */
/* 68 */ this.connection = new PServerConnection();
/* 69 */ this.connection.setUserName(this.root.user);
/* 70 */ if (password != null)
/* 71 */ this.connection.setEncodedPassword(CvsPassword.encode(password));
/* */ else {
/* 73 */ this.connection.setEncodedPassword(password);
/* */ }
/* */
/* 76 */ this.connection.setHostName(this.root.host);
/* 77 */ this.connection.setRepository(this.root.repository);
/* */ try {
/* 79 */ this.connection.open();
/* */ } catch (AuthenticationException ex) {
/* 81 */ this.logger.error(ex.getMessage());
/* */ }
/* */
/* 84 */ this.client = new Client(this.connection, new StandardAdminHandler());
/* 85 */ this.client.setLocalPath(workdir);
/* */ }
/* */
/* */ public File getConfigFile()
/* */ {
/* 91 */ return this.configfile;
/* */ }
/* */
/* */ public GlobalOptions getGlobalOptions() {
/* 95 */ return this.globalOptions;
/* */ }
/* */
/* */ public PServerConnection getConnection()
/* */ {
/* 101 */ return this.connection;
/* */ }
/* */
/* */ public CVSRoot getRoot()
/* */ {
/* 107 */ return this.root;
/* */ }
/* */
/* */ public static String generateID(ItemType item) {
/* 111 */ return "::[" + item.getRemotename() + "]";
/* */ }
/* */ }
 
/* Location: C:\Users\brosenberger\Documents\My Box Files\XBridgeNG-download\XServices-20130131 - Kopie\WEB-INF\classes\net.zip
* Qualified Name: net.brutex.xservices.util.CVSClient
* JD-Core Version: 0.6.2
*/
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/util/FileWalker.java
0,0 → 1,150
/*
* 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.util;
 
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.FileVisitResult;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
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
/**
* The Class FileWalker.
*
* @author Brian Rosenberger, bru(at)brutex.de
*/
public class FileWalker extends SimpleFileVisitor<Path> {
/** The matcher. */
private final PathMatcher matcher;
/** The num. */
private long num=0;
/** The total. */
private long total=0;
/** The pattern. */
private final String pattern;
/** The logger. */
private static final Logger logger = LogManager.getLogger();
 
List<Path> list;
/**
* Instantiates a new file walker.
*
* @param pattern the pattern
*/
public FileWalker(String pattern) {
matcher = FileSystems.getDefault()
.getPathMatcher("glob:" + pattern);
this.pattern = "glob:"+pattern;
this.list = new ArrayList<Path>();
}
// Compares the glob pattern against
// the file or directory name.
/**
* Find.
*
* @param file the file
*/
void find(Path file) {
Path name = file.getFileName();
logger.trace("Compare file " + file.toString() + " against pattern '"+pattern+"'.");
total++;
if (name != null && matcher.matches(name)) {
list.add(file);
logger.debug("Added file " + file.toString() + " to the result set.");
num++;
}
}
 
// Invoke the pattern matching
// method on each file.
/* (non-Javadoc)
* @see java.nio.file.SimpleFileVisitor#visitFile(java.lang.Object, java.nio.file.attribute.BasicFileAttributes)
*/
@Override
public FileVisitResult visitFile(Path file,
BasicFileAttributes attrs) {
find(file);
return FileVisitResult.CONTINUE;
}
 
// Invoke the pattern matching
// method on each directory.
/* (non-Javadoc)
* @see java.nio.file.SimpleFileVisitor#preVisitDirectory(java.lang.Object, java.nio.file.attribute.BasicFileAttributes)
*/
@Override
public FileVisitResult preVisitDirectory(Path dir,
BasicFileAttributes attrs) {
find(dir);
return FileVisitResult.CONTINUE;
}
 
/* (non-Javadoc)
* @see java.nio.file.SimpleFileVisitor#visitFileFailed(java.lang.Object, java.io.IOException)
*/
@Override
public FileVisitResult visitFileFailed(Path file,
IOException exc) {
logger.warn(String.format("Failed to include file '%s'.", file.toString()));
return FileVisitResult.CONTINUE;
}
/**
* Gets the count.
*
* @return the count
*/
public long getCount() {
return num;
}
/**
* Gets the total.
*
* @return the total
*/
public long getTotal() {
return total;
}
/**
* Get result list
*/
public List<Path> getResult() {
return list;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/util/cache/CacheExecutorService.java
0,0 → 1,55
/*
* 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.util.cache;
 
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
 
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
 
public class CacheExecutorService implements ServletContextListener {
static final String EXECUTOR_NAME = "CACHE_EXECUTOR";
private ExecutorService executor;
 
public void contextInitialized(ServletContextEvent arg0) {
ServletContext context = arg0.getServletContext();
int nr_executors = 5;
ThreadFactory daemonFactory = new DaemonThreadFactory();
try {
nr_executors = Integer.parseInt(context.getInitParameter("cache:thread-count"));
} catch (NumberFormatException localNumberFormatException) {
}
if (nr_executors <= 1)
this.executor = Executors.newSingleThreadExecutor(daemonFactory);
else {
this.executor = Executors.newFixedThreadPool(nr_executors, daemonFactory);
}
context.setAttribute("CACHE_EXECUTOR", this.executor);
}
 
public void contextDestroyed(ServletContextEvent arg0) {
ServletContext context = arg0.getServletContext();
this.executor.shutdownNow();
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/util/cache/CacheServlet.java
0,0 → 1,70
/*
* 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.util.cache;
 
import java.io.File;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.concurrent.ExecutorService;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
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
*
*/
 
 
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();
 
public void init()
throws ServletException
{
super.init();
ExecutorService executor = (ExecutorService)getServletContext()
.getAttribute("CACHE_EXECUTOR");
 
Enumeration attributes = getServletContext()
.getInitParameterNames();
while (attributes.hasMoreElements()) {
String name = (String)attributes.nextElement();
if (name.startsWith("cvs-config-")) {
String configfile = getServletContext()
.getInitParameter(name);
this.logger.info("CVS configuration file: " + configfile);
this.configfiles.add(new File(configfile));
}
}
this.cacheinterval = 15;
try {
this.cacheinterval = Integer.parseInt(getServletContext()
.getInitParameter("cvs-cache-interval"));
} catch (NumberFormatException e) {
this.logger.debug("Could not read parameter 'cvs-cache-interval' from web.xml. Using default value '" + this.cacheinterval + "' minutes");
}
this.logger.info("CacheServlet set to " + this.cacheinterval + " minutes interval.");
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/util/cache/FindingsCacheServlet.java
0,0 → 1,371
/*
* 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.util.cache;
 
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.ws.rs.core.Response;
import net.brutex.xservices.types.scm.ItemListType;
import net.brutex.xservices.types.scm.ItemType;
import net.brutex.xservices.types.scmfindings.FindingDetailsType;
import net.brutex.xservices.types.scmfindings.FindingType;
import net.brutex.xservices.types.scmfindings.FindingsListType;
import net.brutex.xservices.types.scmfindings.GroupMatchListType;
import net.brutex.xservices.types.scmfindings.ObjectFactory;
import net.brutex.xservices.ws.rs.CVSInfoImpl;
 
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
*
*/
 
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;
 
@Override
public void init() throws ServletException {
super.init();
executor = (ExecutorService) getServletContext()
.getAttribute("CACHE_EXECUTOR");
if(! this.initConfigList()) return;
if(! this.initConfigFindings()) return;
 
int i = 1;
for(File f: configfiles) {
//Initialise configuration bean using default values
FindingsConfigBean cbean = new FindingsConfigBean(i, LogManager.getLogger("worker-"+i+ "." + this.getClass().getName()));
i++;
//Read cvs-cache-interval parameter
try {
int cacheinterval = Integer.parseInt(getServletContext()
.getInitParameter("cvs-cache-interval"));
cbean.setCacheinterval(cacheinterval);
logger.info("FindingsCacheServlet set to "+ cacheinterval + " minutes interval.");
} catch (NumberFormatException e) {
logger.warn("Could not read parameter 'cvs-cache-interval' from web.xml. Using default value '"
+ cbean.getCacheinterval()+ "' minutes");
}
Configurations configs = new Configurations();
PropertiesConfiguration config = null;
try {
config = configs.properties(f);
} catch (ConfigurationException e) {
logger.error("Could not read parameter file at '"+f.getAbsolutePath()+"'");
return;
}
File cvsconfig = new File(config.getString("CVSROOTCONFIGFILE"));
cbean.setCvsconfig(cvsconfig);
FindingsCacheServlet.logger.debug("Fetching list of files using '"
+ cvsconfig.getAbsolutePath() + "' config file");
List<Object> filepatterns = config.getList("FILESEARCH");
cbean.setFilepatterns(filepatterns);
FindingsCacheServlet.logger.debug("Checking '"
+ filepatterns.size()
+ "' patterns for file name and path matching.");
List<Object> contentpatterns = config.getList("CONTENTSEARCH");
cbean.setContentpatterns(contentpatterns);
FindingsCacheServlet.logger.debug("Checking '"
+ contentpatterns.size()
+ "' patterns for content matching");
 
executor.submit(new ThisRunnable(cbean));
}
logger.info("FindingsCacheServlet has been initialized.");
 
}
/*
* Initialise CVS findings configuration
*/
private boolean initConfigFindings() {
String filename = getServletContext().getInitParameter(
"cvs-findings-configuration");
if (filename == null) {
logger.warn("'cvs-findings-configuration' init parameter is not specified.");
return false;
}
final File findingsconfig = new File(filename);
logger.info("CVS findings configuration file found at '"
+ findingsconfig.getAbsolutePath() + "'");
if ((!findingsconfig.canRead()) || (findingsconfig.isDirectory())) {
logger.info("CVS findings configuration file '"
+ findingsconfig.getAbsolutePath() + "' does not exist.");
return false;
}
return true;
}
 
/*
* Add all specified CVS configuration files to the list. Parameter pattern
* is "cvs-config-XX".
*/
private boolean initConfigList() {
Enumeration<String> attributes = getServletContext()
.getInitParameterNames();
while (attributes.hasMoreElements()) {
String name = (String) attributes.nextElement();
if (name.startsWith("cvs-config-")) {
String configfile = getServletContext().getInitParameter(name);
logger.info("Adding CVS configuration file: " + configfile);
this.configfiles.add(new File(configfile));
}
}
/*
* Verify, that all configuration files do exists and are readable.
*/
List<File> removelist = new ArrayList<File>();
for (File f : configfiles) {
if (!f.exists()) {
logger.warn("CVS configuration file '"
+ f.getAbsolutePath()
+ "' is specified, but does not exist. Removing from list.");
removelist.add(f);
} else if (!f.canRead()) {
logger.warn("CVS configuration file '"
+ f.getAbsolutePath()
+ "' does exist, but is not readable. Removing from list.");
removelist.add(f);
}
}
configfiles.removeAll(removelist);
return true;
}
 
class ThisRunnable implements Runnable {
boolean isInterrupted = false;
FindingsConfigBean configuration;
 
public ThisRunnable(FindingsConfigBean configuration) {
this.configuration = configuration;
}
 
public void run() {
CVSInfoImpl instance = new CVSInfoImpl();
 
ItemListType fileslist = (ItemListType) instance
.getRepositoryFiles(null, configuration.getCvsconfig(), "", true, true, true)
.getEntity();
ObjectFactory FACTORY = new ObjectFactory();
FindingsListType findingsList = FACTORY.createFindingsListType();
 
FindingsCacheServlet.logger.info("Processing '"
+ fileslist.getItems().size() + "' files and directories.");
 
while (!this.isInterrupted) {
Pattern p;
for (ItemType i : fileslist.getItems()) {
if (this.isInterrupted)
break;
Iterator<Object> iterF = configuration.getFilepatterns().iterator();
while(iterF.hasNext()) {
Object o = iterF.next();
if (this.isInterrupted)
break;
FindingsCacheServlet.logger.debug("Scanning filename '"
+ i.getFullname() + "' for pattern '"
+ (String) o + "'");
p = Pattern.compile((String) o);
Matcher m = p.matcher(i.getFullname());
if (m.find()) {
FindingType finding = FACTORY.createFindingType();
finding.setFilesearch(p.toString());
ItemType it = (ItemType) instance.getFileContent(
null, configuration.getCvsconfig(), i.getFullname(), true)
.getEntity();
finding.setContent(it.getContent());
finding.setData(it.getData());
finding = copyDetails(finding, i);
findingsList.getFindings().add(finding);
FindingsCacheServlet.logger
.debug("Match found for '"
+ i.getFullname() + "'");
break;
}
FindingsCacheServlet.logger
.debug("No match found for '" + i.getFullname()
+ "'");
}
}
FindingsCacheServlet.logger
.debug("Processing file content for '"
+ findingsList.getFindings().size()
+ "' entries in the list.");
 
for (FindingType t : findingsList.getFindings()) {
if (this.isInterrupted)
break;
boolean isFound = false;
Matcher m;
Iterator<Object> iter = configuration.getContentpatterns().iterator();
while (iter.hasNext()) {
 
Object o = iter.next();
if (this.isInterrupted)
break;
FindingsCacheServlet.logger
.debug("Scanning file content for file '"
+ t.getFullname() + "' for pattern '"
+ (String) o + "'");
 
Pattern p1 = Pattern.compile((String) o);
m = p1.matcher(t.getContent());
t.setContentsearch(p1.toString());
 
isFound = true;
int s = m.start();
int e = m.end();
String c = m.group();
 
FindingDetailsType fd = FACTORY
.createFindingDetailsType();
GroupMatchListType gm = FACTORY
.createGroupMatchListType();
gm.setMatchAtIndex(s);
gm.setMatchToIndex(e);
gm.setMatchString(c);
gm.setMatchGroup(0);
fd.setFullmatch(gm);
for (int i = 1; i <= m.groupCount(); i++) {
GroupMatchListType gmg = FACTORY
.createGroupMatchListType();
s = m.start(i);
e = m.end(i);
c = m.group(i);
gmg.setMatchAtIndex(s);
gmg.setMatchToIndex(e);
gmg.setMatchString(c);
gmg.setMatchGroup(i);
fd.getMatchLists().add(gmg);
}
t.getFindingLists().add(fd);
FindingsCacheServlet.logger
.debug("Found matching content at index '" + s
+ "' in file '" + t.getFullname()
+ "' with pattern '" + p1.toString()
+ "'");
}
 
if (!isFound) {
findingsList.getFindings().remove(t);
FindingsCacheServlet.logger
.debug("Found matching filename for '"
+ t.getFullname()
+ "' but content didn't match. Removing.");
}
 
try {
instance.getCacheInstance().put(
"FINDINGS-" + t.getROOT(), findingsList);
FindingsCacheServlet.logger
.info("FINDINGS for CVSROOT '" + t.getROOT()
+ "' have been updated in cache.");
} catch (CacheException e) {
FindingsCacheServlet.logger.error(e.getMessage(), e);
}
}
try {
int cacheinterval = configuration.getCacheinterval();
FindingsCacheServlet.logger.debug("Now sleeping for '"
+ cacheinterval + "' minutes");
Thread.currentThread();
Thread.sleep(cacheinterval * 60000);
FindingsCacheServlet.logger.debug("Waking up after '"
+ cacheinterval + "' minutes of sleep");
} catch (InterruptedException e) {
this.isInterrupted = true;
FindingsCacheServlet.logger
.warn("FindingsCacheServlet cache was interrupted. Shutting down.");
}
}
 
}
 
private FindingType copyDetails(FindingType finding, ItemType item) {
finding.setDescription(item.getDescription());
finding.setFullname(item.getFullname());
finding.setName(item.getName());
finding.setPath(item.getPath());
finding.setRemotefullname(item.getRemotefullname());
finding.setRemotename(item.getRemotename());
finding.setRemotepath(item.getRemotepath());
finding.setROOT(item.getROOT());
return finding;
}
 
}
 
 
 
 
/* (non-Javadoc)
* @see javax.servlet.GenericServlet#destroy()
*/
@Override
public void destroy() {
// TODO Auto-generated method stub
executor.shutdown();
try {
executor.awaitTermination(3, TimeUnit.SECONDS);
logger.info("Cache Worker Threads have shut down.");
} catch (InterruptedException e) {
logger.error("Cache Worker Threads did not terminate within timeout.", e);
}
super.destroy();
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/util/cache/FindingsConfigBean.java
0,0 → 1,109
/*
* 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.util.cache;
 
import java.io.File;
import java.util.List;
 
import org.apache.logging.log4j.Logger;
 
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
public class FindingsConfigBean {
 
private Logger logger;
private final int instanceid;
 
private File cvsconfig;
private int cacheinterval = 15;
private List<Object> filepatterns;
private List<Object> contentpatterns;
 
public FindingsConfigBean(int instanceid, Logger logger) {
this.instanceid = instanceid;
this.logger = logger;
logger.debug("Initialise FindingsConfigBean instance '" + instanceid + "'");
 
}
 
/**
* @return the cache interval
*/
public int getCacheinterval() {
return cacheinterval;
}
 
/**
* @param cacheinterval
* the cache interval to set
*/
public void setCacheinterval(int cacheinterval) {
this.cacheinterval = cacheinterval;
}
 
/**
* @return the cvsconfig
*/
public File getCvsconfig() {
return cvsconfig;
}
 
/**
* @param cvsconfig
* the cvsconfig to set
*/
public void setCvsconfig(File cvsconfig) {
this.cvsconfig = cvsconfig;
}
 
/**
* @return the filepatterns
*/
public List<Object> getFilepatterns() {
return filepatterns;
}
 
/**
* @param filepatterns
* the filepatterns to set
*/
public void setFilepatterns(List<Object> filepatterns) {
this.filepatterns = filepatterns;
}
 
/**
* @return the contentpatterns
*/
public List<Object> getContentpatterns() {
return contentpatterns;
}
 
/**
* @param contentpatterns
* the contentpatterns to set
*/
public void setContentpatterns(List<Object> contentpatterns) {
this.contentpatterns = contentpatterns;
}
 
/**
* @param instanceid
*/
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/util/cache/DaemonThreadFactory.java
0,0 → 1,49
/*
* 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.util.cache;
 
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
 
 
public class DaemonThreadFactory
implements ThreadFactory
{
private final ThreadFactory factory;
 
public DaemonThreadFactory()
{
this(Executors.defaultThreadFactory());
}
 
public DaemonThreadFactory(ThreadFactory factory)
{
if (factory == null)
throw new NullPointerException("factory cannot be null");
this.factory = factory;
}
 
public Thread newThread(Runnable r) {
Thread t = this.factory.newThread(r);
t.setDaemon(true);
return t;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/util/RunTask.java
0,0 → 1,102
/*
* Copyright 2010 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.util;
 
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
 
import net.brutex.xservices.types.ReturnCode;
import net.brutex.xservices.types.ant.AntProperty;
 
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Target;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.listener.TimestampedLogger;
import org.apache.tools.ant.taskdefs.Echo;
 
/**
*
* @author Brian Rosenberger, bru@brutex.de
*/
public class RunTask {
 
Project antproject;
Target anttarget;
Task anttask;
ByteArrayOutputStream myout = new ByteArrayOutputStream();
ByteArrayOutputStream myerr = new ByteArrayOutputStream();
PrintStream out = new PrintStream(myout);
PrintStream err = new PrintStream(myerr);
TimestampedLogger log = null;
 
public RunTask(Task anttask) {
 
antproject = new Project();
antproject.init();
antproject.setBasedir(System.getProperty("java.io.tmpdir"));
log = new TimestampedLogger();
log.setOutputPrintStream(out);
log.setErrorPrintStream(err);
log.setMessageOutputLevel(Echo.EchoLevel.WARN.getLevel());
 
antproject.addBuildListener(log);
 
anttarget = new Target();
anttarget.setName("XBridgeNGDynamicTarget");
anttarget.setProject(antproject);
antproject.addTarget(anttarget);
 
this.anttask = anttask;
prepareTask();
}
 
private void prepareTask()
throws BuildException {
anttask.init();
anttask.setProject(antproject);
anttask.setOwningTarget(anttarget);
anttarget.addTask(anttask);
antproject.addOrReplaceTarget(anttarget);
}
 
/**
* @return ReturnCode type {@link ReturnCode}
* @throws BuildException
*/
public ReturnCode postTask() throws BuildException {
int returnCode = 0;
Map<String, Object> origMap = new HashMap<String, Object>();
Map<String, Object> newMap = null;
origMap.putAll(antproject.getProperties());
antproject.executeTarget(anttarget.getName());
newMap = antproject.getProperties();
newMap.putAll(antproject.getUserProperties());
for (Map.Entry<String, Object> e : origMap.entrySet()) {
newMap.remove(e.getKey());
}
 
//anttask.execute();
return new ReturnCode(returnCode,
myout.toString(),
myerr.toString(),
AntProperty.createAntPropertyList(newMap));
 
}
}
/xservices/trunk/src/main/java/net/brutex/xservices/util/CVSRoot.java
0,0 → 1,82
/* */ package net.brutex.xservices.util;
/* */
/* */ import java.io.BufferedReader;
/* */ import java.io.File;
/* */ import java.io.FileReader;
/* */ import java.io.IOException;
/* */ import java.io.PrintStream;
/* */
/* */ public class CVSRoot
/* */ {
/* */ public String connectionType;
/* */ public String user;
/* */ public String host;
/* */ public String repository;
/* */
/* */ public CVSRoot(String root)
/* */ throws IllegalArgumentException
/* */ {
/* 19 */ if (!root.startsWith(":")) {
/* 20 */ throw new IllegalArgumentException();
/* */ }
/* 22 */ int oldColonPosition = 0;
/* 23 */ int colonPosition = root.indexOf(':', 1);
/* 24 */ if (colonPosition == -1)
/* 25 */ throw new IllegalArgumentException();
/* 26 */ this.connectionType = root.substring(oldColonPosition + 1, colonPosition);
/* 27 */ oldColonPosition = colonPosition;
/* 28 */ colonPosition = root.indexOf('@', colonPosition + 1);
/* 29 */ if (colonPosition == -1)
/* 30 */ throw new IllegalArgumentException();
/* 31 */ this.user = root.substring(oldColonPosition + 1, colonPosition);
/* 32 */ oldColonPosition = colonPosition;
/* 33 */ colonPosition = root.indexOf(':', colonPosition + 1);
/* 34 */ if (colonPosition == -1)
/* 35 */ throw new IllegalArgumentException();
/* 36 */ this.host = root.substring(oldColonPosition + 1, colonPosition);
/* 37 */ this.repository = root.substring(colonPosition + 1);
/* 38 */ if ((this.connectionType == null) || (this.user == null) || (this.host == null) ||
/* 39 */ (this.repository == null))
/* 40 */ throw new IllegalArgumentException();
/* */ }
/* */
/* */ public String getCVSRoot(File directory) {
/* 44 */ String root = null;
/* 45 */ BufferedReader r = null;
/* */ try {
/* 47 */ File rootFile = new File(directory, "CVS/Root");
/* 48 */ if (rootFile.exists()) {
/* 49 */ r = new BufferedReader(new FileReader(rootFile));
/* 50 */ root = r.readLine();
/* */ }
/* */ }
/* */ catch (IOException localIOException1)
/* */ {
/* */ try {
/* 56 */ if (r != null)
/* 57 */ r.close();
/* */ } catch (IOException e) {
/* 59 */ System.err.println("Warning: could not close CVS/Root file!");
/* */ }
/* */ }
/* */ finally
/* */ {
/* */ try
/* */ {
/* 56 */ if (r != null)
/* 57 */ r.close();
/* */ } catch (IOException e) {
/* 59 */ System.err.println("Warning: could not close CVS/Root file!");
/* */ }
/* */ }
/* 62 */ if (root == null) {
/* 63 */ root = System.getProperty("cvs.root");
/* */ }
/* 65 */ return root;
/* */ }
/* */ }
 
/* Location: C:\Users\brosenberger\Documents\My Box Files\XBridgeNG-download\XServices-20130131 - Kopie\WEB-INF\classes\net.zip
* Qualified Name: net.brutex.xservices.util.CVSRoot
* JD-Core Version: 0.6.2
*/
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/util/BasicCVSListener.java
0,0 → 1,78
/* */ package net.brutex.xservices.util;
/* */
/* */ import java.io.PrintStream;
/* */ import org.netbeans.lib.cvsclient.event.BinaryMessageEvent;
/* */ import org.netbeans.lib.cvsclient.event.CVSListener;
/* */ import org.netbeans.lib.cvsclient.event.FileAddedEvent;
/* */ import org.netbeans.lib.cvsclient.event.FileInfoEvent;
/* */ import org.netbeans.lib.cvsclient.event.FileRemovedEvent;
/* */ import org.netbeans.lib.cvsclient.event.FileToRemoveEvent;
/* */ import org.netbeans.lib.cvsclient.event.FileUpdatedEvent;
/* */ import org.netbeans.lib.cvsclient.event.MessageEvent;
/* */ import org.netbeans.lib.cvsclient.event.ModuleExpansionEvent;
/* */ import org.netbeans.lib.cvsclient.event.TerminationEvent;
/* */
/* */ public abstract class BasicCVSListener
/* */ implements CVSListener
/* */ {
/* 24 */ private final StringBuffer taggedLine = new StringBuffer();
/* */
/* 26 */ private final boolean showEvents = true;
/* */
/* */ public void messageSent(MessageEvent e)
/* */ {
/* 36 */ String line = e.getMessage();
/* 37 */ PrintStream stream = e.isError() ? System.err :
/* 38 */ System.out;
/* */
/* 40 */ if (e.isTagged())
/* */ {
/* 42 */ String str1 = MessageEvent.parseTaggedMessage(this.taggedLine, line);
/* */ }
/* */ }
/* */
/* */ public void commandTerminated(TerminationEvent arg0)
/* */ {
/* 59 */ System.out.println("commandTerminated");
/* */ }
/* */
/* */ public void fileAdded(FileAddedEvent arg0)
/* */ {
/* 65 */ System.out.println("fileAdded");
/* */ }
/* */
/* */ public void fileInfoGenerated(FileInfoEvent arg0)
/* */ {
/* 71 */ System.out.println("fileInfoGenerated");
/* */ }
/* */
/* */ public void fileRemoved(FileRemovedEvent arg0)
/* */ {
/* 76 */ System.out.println("fileRemoved");
/* */ }
/* */
/* */ public void fileToRemove(FileToRemoveEvent arg0)
/* */ {
/* 82 */ System.out.println("fileToRemove");
/* */ }
/* */
/* */ public void fileUpdated(FileUpdatedEvent arg0)
/* */ {
/* 88 */ System.out.println("fileUpdated");
/* */ }
/* */
/* */ public void messageSent(BinaryMessageEvent arg0)
/* */ {
/* 94 */ System.out.println("messageSent_Binary");
/* */ }
/* */
/* */ public void moduleExpanded(ModuleExpansionEvent arg0)
/* */ {
/* 100 */ System.out.println("ModuleExpansionEvent");
/* */ }
/* */ }
 
/* Location: C:\Users\brosenberger\Documents\My Box Files\XBridgeNG-download\XServices-20130131 - Kopie\WEB-INF\classes\net.zip
* Qualified Name: net.brutex.xservices.util.BasicCVSListener
* JD-Core Version: 0.6.2
*/
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/util/XServicesDocumentation.java
0,0 → 1,71
/*
* Copyright 2011 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.util;
 
/**
* Holds static documentation.
*
*
* @author Brian Rosenberger, bru@brutex.de
*/
public class XServicesDocumentation {
 
public static final String BRUTEX_COPYRIGHT = "" +
"/*\n" +
"* Copyright 2010 Brian Rosenberger (Brutex Network)\n" +
"*\n" +
"* Licensed under the Apache License, Version 2.0 (the \"License\")\n" +
"* you may not use this file except in compliance with the License.\n" +
"* You may obtain a copy of the License at\n" +
"*\n" +
"* http://www.apache.org/licenses/LICENSE-2.0\n" +
"*\n" +
"* Unless required by applicable law or agreed to in writing, software\n" +
"* distributed under the License is distributed on an \"AS IS\" BASIS,\n" +
"* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +
"* See the License for the specific language governing permissions and\n" +
"* limitations under the License.\n" +
"*/";
 
 
public static final String SERVICE_OPERATION_DOWNLOADFILE = "Download a file from the maschine where the service is running in order " +
"to process it with the client. The file is either downloaded as a MTOM attachment or " +
"as inline base64 encoded block. Keep in mind that unless you are using MTOM, a lot of " +
"java heap memory is used.";
public static final String SERVICE_OPERATION_UPLOADFILE = "Send a file from client to web service server using either " +
"MTOM attachment or base64 inline attachment.";
public static final String SERVICE_OPERATION_COPY = "Copies a fileset locally on the server.";
public static final String SERVICE_OPERATION_COPYFILE = "Copies a single file locally on the server";
public static final String SERVICE_OPERATION_LOADRESOURCE = "Load the content of a resource";
public static final String SERVICE_OPERATION_LOADRESOURCEFROMARCHIVE = "Load the content of a resource";
public static final String SERVICE_OPERATION_ECHOTOFILE = "Write or append a string to a file";
public static final String SERVICE_OPERATION_REPLACEINFILE = "Replaces every <pattern> with a string in an ascii file";
public static final String SERVICE_OPERATION_REPLACEINFILE2 = "Replaces every <pattern> with a string in an ascii file";
public static final String SERVICE_OPERATION_REPLACEINFILEREGEX = "Replaces every <regex pattern> with a string in an ascii file";
private XServicesDocumentation() {};
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/util/CvsPassword.java
0,0 → 1,69
/* */ package net.brutex.xservices.util;
/* */
/* */ import java.io.PrintStream;
/* */
/* */ public class CvsPassword
/* */ {
/* 46 */ private static final char[] LOOKUP_TABLE = {
/* 47 */ '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', 'r', 'x', '5',
/* 48 */ 'O', '\000', 'm', 'H', 'l', 'F', '@', 'L', 'C', 't', 'J', 'D', 'W', 'o', '4', 'K',
/* 49 */ 'w', '1', '"', 'R', 'Q', '_', 'A', 'p', 'V', 'v', 'n', 'z', 'i', ')', '9',
/* 50 */ 'S', '+', '.', 'f', '(', 'Y', '&', 'g', '-', '2', '*', '{', '[', '#', '}', '7',
/* 51 */ '6', 'B', '|', '~', ';', '/', '\\', 'G', 's', 'N', 'X', 'k', 'j', '8',
/* 52 */ '\000', 'y', 'u', 'h', 'e', 'd', 'E', 'I', 'c', '?', '^', ']', '\'', '%', '=', '0',
/* 53 */ ':', 'q', ' ', 'Z', ',', 'b', '<', '3', '!', 'a', '>', 'M', 'T', 'P', 'U' };
/* */
/* */ public static String encode(String clearText)
/* */ {
/* 68 */ char[] encoded = new char[clearText.length() + 1];
/* 69 */ encoded[0] = 'A';
/* */
/* 72 */ int counter = 1;
/* 73 */ for (char c : clearText.toCharArray())
/* */ {
/* 75 */ if ((c == '`') || (c == '$') || (c < ' '))
/* */ {
/* 77 */ throw new IllegalArgumentException(
/* 78 */ "Illegal character was found in clear password.");
/* */ }
/* */
/* 81 */ encoded[(counter++)] = LOOKUP_TABLE[c];
/* */ }
/* */
/* 84 */ return String.valueOf(encoded);
/* */ }
/* */
/* */ public static String decode(String encodedPassword)
/* */ {
/* 98 */ String rtn = null;
/* */
/* 100 */ if ((encodedPassword != null) && (encodedPassword.length() > 0))
/* */ {
/* 102 */ if (encodedPassword.startsWith("A"))
/* */ {
/* 104 */ rtn = encode(encodedPassword.substring(1)).substring(1);
/* */ }
/* */ else
/* */ {
/* 108 */ rtn = encode(encodedPassword).substring(1);
/* */ }
/* */ }
/* */
/* 112 */ return rtn;
/* */ }
/* */
/* */ public static void main(String[] sArgs)
/* */ {
/* 117 */ String TEST_WORD = "i07w91";
/* 118 */ String encoded = encode("i07w91");
/* 119 */ System.out.println("Encoded: <" + encoded + ">");
/* 120 */ String decoded = decode(encoded);
/* 121 */ System.out.println("Decoded: <" + decoded + ">");
/* 122 */ System.out.println(decoded.equals("i07w91") ? "Test Passed" : "Test Failed");
/* */ }
/* */ }
 
/* Location: C:\Users\brosenberger\Documents\My Box Files\XBridgeNG-download\XServices-20130131 - Kopie\WEB-INF\classes\net.zip
* Qualified Name: net.brutex.xservices.util.CvsPassword
* JD-Core Version: 0.6.2
*/
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/util/JobWrapper.java
0,0 → 1,96
/*
* Copyright 2011 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.util;
 
import java.io.Serializable;
import java.util.Date;
 
import org.mozilla.javascript.Context;
import org.mozilla.javascript.Scriptable;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
 
/**
* Wrapper for jobs that can be executed through quartz scheduler.
*
* @author Brian Rosenberger, bru@brutex.de
* @since 0.5.0
*
*/
public class JobWrapper implements Job, Serializable {
 
public void execute(JobExecutionContext jcontext)
throws JobExecutionException {
try {
 
System.out.println("Executing scheduled job '"+jcontext.getJobDetail().getKey().getName()+"' at " + new Date());
 
JobDataMap jdMap = jcontext.getJobDetail().getJobDataMap();
String script = jdMap.getString("script");
 
// Create and enter a Context. A Context stores information about
// the execution environment of a script.
Context cx = Context.enter();
cx.setOptimizationLevel(0);
cx.setLanguageVersion(Context.VERSION_1_7);
// cx is the Context instance you're using to run scripts
/*
* cx.setClassShutter(new ClassShutter() { public boolean
* visibleToScripts(String className) {
* if(className.startsWith("adapter")) return true;
* if(className.startsWith("java.lang.System") ||
* className.startsWith
* ("org.apache.tomcat.util.log.SystemLogHandler")) return true;
* System.out.println(className + " is blocked."); return false; }
* });
*/
 
// Initialise the standard objects (Object, Function, etc.). This
// must be done before scripts can be
// executed. The null parameter tells initStandardObjects
// to create and return a scope object that we use
// in later calls.
Scriptable scope = cx.initStandardObjects();
//Object wrappedOut = Context.javaToJS(System.out, scope);
//Object wrappedOut2 = Context.javaToJS(this, scope);
//scope.put("out", scope, wrappedOut);
//scope.put("exe", scope, wrappedOut2);
 
// Execute the script
// cx.evaluateString(scope, "importClass('java.lang.System');\n",
// "head", 1, null);
// cx.evaluateString(scope, "importPackage('java.util');\n", "head",
// 2, null);
Object obj = cx
.evaluateString(scope, script, "TestScript", 1, null);
 
} catch (Exception e) {
System.out.println(e.getMessage());
} finally {
// Exit the Context. This removes the association between the
// Context and the current thread and is an
// essential cleanup action. There should be a call to exit for
// every call to enter.
Context.exit();
}
 
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/util/BrutexNamespaces.java
0,0 → 1,54
/*
* Copyright 2010 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.util;
 
/**
* Holds static namespace information.
*
*
* @author Brian Rosenberger, bru@brutex.de
*/
public class BrutexNamespaces {
 
/**
* Brutex Network XServices web service name space declaration
*/
public static final String WS_XSERVICES = "http://ws.xservices.brutex.net";
/**
* Copyright and license agreement statement.
*/
public static final String BRUTEX_COPYRIGHT = "" +
"/*\n" +
"* Copyright 2010 Brian Rosenberger (Brutex Network)\n" +
"*\n" +
"* Licensed under the Apache License, Version 2.0 (the \"License\")\n" +
"* you may not use this file except in compliance with the License.\n" +
"* You may obtain a copy of the License at\n" +
"*\n" +
"* http://www.apache.org/licenses/LICENSE-2.0\n" +
"*\n" +
"* Unless required by applicable law or agreed to in writing, software\n" +
"* distributed under the License is distributed on an \"AS IS\" BASIS,\n" +
"* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +
"* See the License for the specific language governing permissions and\n" +
"* limitations under the License.\n" +
"*/";
 
 
private BrutexNamespaces() {};
}
/xservices/trunk/src/main/java/net/brutex/xservices/util/UnRarTask.java
0,0 → 1,74
/*
* Copyright 2010 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.util;
 
import de.innosystec.unrar.Archive;
import de.innosystec.unrar.exception.RarException;
import de.innosystec.unrar.rarfile.FileHeader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
 
/**
*
* @author Brian Rosenberger, bru@brutex.de
*/
public class UnRarTask extends Task {
 
private File dst = null;
private File src = null;
 
public File getDst() {
return dst;
}
 
public void setDst(File dst) {
this.dst = dst;
}
 
public File getSrc() {
return src;
}
 
public void setSrc(File src) {
this.src = src;
}
 
 
@Override
public void execute() {
if(src==null ) throw new BuildException("Please supply a source archive file.");
if(!src.exists()) throw new BuildException("Archive '"+src.getName()+"' does not exist.");
 
try {
if(dst==null) dst = new File(src.getParent());
Archive ar = new Archive(src);
List<FileHeader> list = ar.getFileHeaders();
for(FileHeader h : list) {
ar.extractFile(h, new FileOutputStream(new File(dst.getAbsolutePath()+"/"+h.getFileNameString())));
}
} catch (RarException ex) {
throw new BuildException(ex.getMessage(), ex);
} catch (IOException ex) {
throw new BuildException(ex.getMessage(), ex);
}
}
 
}
/xservices/trunk/src/main/java/net/brutex/xservices/security/XServicesRealm.java
0,0 → 1,84
/*
* 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.security;
 
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.shiro.config.Ini;
import org.apache.shiro.realm.text.IniRealm;
import org.apache.shiro.util.Nameable;
 
import java.net.URI;
import java.net.URISyntaxException;
 
// TODO: Auto-generated Javadoc
/*
* For later use. A Realm connects to a DS where Users/ Passes are defined
* and allows Shiro to transparently work against different user/pass stores
* (i.e. LDAP, Custom, etc.)
*
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
/**
* The Class XServicesRealm.
*/
public class XServicesRealm extends IniRealm implements Nameable {
 
/** The logger. */
private final Logger logger = LogManager.getLogger();
/** The name. */
private String name;
/* (non-Javadoc)
* @see org.apache.shiro.realm.AuthorizingRealm#setName(java.lang.String)
*/
@Override
public void setName(String name) {
this.name = name;
}
 
/**
* Instantiates a new x services realm with default
* 'shiro.ini' in classpath and {@link net.brutex.xservices.security.PermissionResolver PermissionResolver}.
*
*/
public XServicesRealm() {
super();
/* needs review */
URI classesRootDir;
try {
classesRootDir = getClass().getProtectionDomain().getCodeSource().getLocation().toURI();
String dir = classesRootDir.toString().replaceAll("%20", " ");
dir = dir.substring(0, dir.lastIndexOf("WEB-INF"));
this.setIni(Ini.fromResourcePath(dir+"/WEB-INF/shiro.ini"));
} catch (URISyntaxException e) {
logger.error(e.getMessage(), e);
e.printStackTrace();
}
this.setPermissionResolver(new net.brutex.xservices.security.PermissionResolver());
}
 
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/security/DirectoryPermission.java
0,0 → 1,69
/*
* 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.security;
 
 
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.shiro.authz.Permission;
import org.apache.shiro.util.AntPathMatcher;
 
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
public class DirectoryPermission implements Permission {
 
private final Logger logger = LogManager.getLogger();
 
private final String path;
 
public DirectoryPermission(String antlikepath) {
logger.debug(String.format("Creating permission for path '%s'", antlikepath));
path = antlikepath;
}
@Override
public boolean implies(Permission p) {
boolean result = false;
/* is of same type */
if(! (p instanceof DirectoryPermission)) {
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) {
logger.debug(String.format("Testing if DirectoryPermission '%s' implies permission to 'null'. Result was '%s'" , this.getPath(), result));
return result;
}
/* directory pattern implies other */
if( (new AntPathMatcher()).matches(path, ((DirectoryPermission)p).getPath()) ) {
result = true;
}
logger.debug(String.format("Testing if DirectoryPermission '%s' implies permission to '%s'. Result was '%s'" , this.getPath(), ((DirectoryPermission) p).getPath(), result));
return result;
}
public String getPath() {
return path;
}
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/security/PermissionResolver.java
0,0 → 1,61
/*
* 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.security;
 
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;
 
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
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) {
logger.debug(String.format("Trying to examine new Permission '%s'", permissionString));
if(! permissionString.contains(DELIMITER)) {
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:
logger.debug(String.format("Found '%s' as permission class.", value));
return new XmlServicePermission(permissionString.substring( delimiterIndex ));
case FileInfo.SERVICE_NAME:
logger.debug(String.format("Found '%s' as permission class.", value));
return new DirectoryPermission(permissionString.substring( delimiterIndex ));
 
 
default:
logger.warn(String.format("Permission class '%s' is not defined.", value));
throw new InvalidPermissionStringException(String.format("Permission class '%s' is not defined.", value), permissionString);
}
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/security/XmlServicePermission.java
0,0 → 1,67
/*
* 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.security;
 
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
*
*/
public class XmlServicePermission implements Permission {
 
private final Logger logger = LogManager.getLogger();
private final String permissionString;
 
public XmlServicePermission(String permissionString) {
logger.debug(String.format("Creating permission for '%s'", permissionString));
this.permissionString = permissionString;
}
@Override
public boolean implies(Permission p) {
boolean result = false;
/* is of same type */
if(! (p instanceof XmlServicePermission)) {
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) {
logger.debug(String.format("Testing if DirectoryPermission '%s' implies permission to 'null'. Result was '%s'" , permissionString, result));
return result;
}
/* directory pattern implies other */
//TODO
/*if( (new AntPathMatcher()).matches(permissionString, ((XmlServicePermission)p).getPermissionString())) ) {
result = true;
}
logger.debug(String.format("Testing if DirectoryPermission '%s' implies permission to '%s'. Result was '%s'" , permissionString, ((XmlServicePermission) p).getPermissionString(), result));
*/
return result;
}
public String getPermissionString() {
return permissionString;
}
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/StringMatchType.java
0,0 → 1,45
/*
* 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.types;
 
import java.util.ArrayList;
import java.util.List;
 
import javax.xml.bind.annotation.XmlType;
 
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
 
@XmlType
public class StringMatchType
{
public final List<StringMatchDetails> stringlist = new ArrayList<StringMatchDetails>();
public int size = 0;
 
public synchronized void addStringMatch(StringMatchDetails match)
{
this.stringlist.add(match);
this.size += 1;
}
 
public synchronized void addStringMatch(long start, long end, String group, String content) {
StringMatchDetails details = new StringMatchDetails(start, end, group, content);
addStringMatch(details);
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/FileInfoType.java
0,0 → 1,260
/*
* 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.types;
 
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URLEncoder;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributeView;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.DosFileAttributeView;
import java.nio.file.attribute.DosFileAttributes;
import java.nio.file.attribute.FileTime;
import java.nio.file.attribute.PosixFileAttributeView;
import java.nio.file.attribute.PosixFileAttributes;
import java.nio.file.attribute.UserPrincipal;
import java.util.GregorianCalendar;
 
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorOrder;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
 
 
 
@XmlRootElement
@XmlType(propOrder={"name", "path", "filesize", "owner", "lastModifiedDate", "createdDate", "lastAccessDate", "mimeType",
"readonly", "hidden", "directory", "symbolicLink", "archive", "system", "downloadUrl"})
@XmlAccessorType(XmlAccessType.PROPERTY)
public class FileInfoType
{
private String name;
private String path;
private long filesize;
private boolean isReadonly;
private boolean isHidden;
private boolean isDirectory;
private boolean isSymbolicLink;
private boolean isArchive;
private boolean isSystem;
private GregorianCalendar lastModifiedDate;
private GregorianCalendar createdDate;
private GregorianCalendar lastAccessDate;
private String owner;
private String mimeType;
private URI downloadUrl;
 
public FileInfoType()
{
}
public FileInfoType(Path p) throws IOException {
this.name = p.getFileName().toString();
this.path = p.toAbsolutePath().toString().replace('\\', '/');
 
BasicFileAttributeView basicView = Files.getFileAttributeView(p, BasicFileAttributeView.class);
BasicFileAttributes basic;
basic = basicView.readAttributes();
this.isDirectory = basic.isDirectory();
this.isSymbolicLink = basic.isSymbolicLink();
this.filesize = basic.size();
this.lastModifiedDate = (GregorianCalendar) GregorianCalendar.getInstance();
this.lastModifiedDate.setTimeInMillis(basic.lastModifiedTime().toMillis());
this.createdDate = (GregorianCalendar) GregorianCalendar.getInstance();
this.createdDate.setTimeInMillis(basic.creationTime().toMillis());
this.lastAccessDate = (GregorianCalendar) GregorianCalendar.getInstance();
this.lastAccessDate.setTimeInMillis(basic.lastAccessTime().toMillis());
// Try to set the Mime Type for that file
// or default to octet-stream
if(!isDirectory) {
this.mimeType = Files.probeContentType(p);
if(this.mimeType==null) mimeType = "application/octet-stream";
} else {
this.mimeType = null;
}
// Set the file/ directory owner
this.owner = Files.getOwner(p).getName();
//Dos specific Attributes
DosFileAttributeView dosView = Files.getFileAttributeView(p, DosFileAttributeView.class);
if(dosView != null) {
DosFileAttributes dos = dosView.readAttributes();
this.isReadonly = dos.isReadOnly();
this.isHidden = dos.isHidden();
this.isArchive = dos.isArchive();
this.isSystem = dos.isSystem();
}
//POSIX specific Attributes
PosixFileAttributeView posixView = Files.getFileAttributeView(p, PosixFileAttributeView.class);
if(posixView != null) {
PosixFileAttributes posix = posixView.readAttributes();
//TODO: Unix specific file attributes
}
}
 
public FileInfoType(Path file, URI downloadURL) throws IOException {
this(file);
try {
this.downloadUrl = URI.create(downloadURL+URLEncoder.encode(this.path, "UTF-8"));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
 
/**
* @return the name
*/
@XmlElement(name="name")
public String getName() {
return name;
}
 
/**
* @return the path
*/
@XmlElement(name = "path")
public String getPath() {
return path;
}
 
/**
* @return the filesize
*/
@XmlElement(name="filesize")
public long getFilesize() {
return filesize;
}
 
/**
* @return the isReadonly
*/
@XmlElement(name="isReadonly")
public boolean isReadonly() {
return isReadonly;
}
 
/**
* @return the isHidden
*/
@XmlElement(name="isHidden")
public boolean isHidden() {
return isHidden;
}
 
/**
* @return the isDirectory
*/
@XmlElement(name="isDirectory")
public boolean isDirectory() {
return isDirectory;
}
 
/**
* @return the isSymbolicLink
*/
@XmlElement(name="isSymbolicLink")
public boolean isSymbolicLink() {
return isSymbolicLink;
}
 
/**
* @return the isArchive
*/
@XmlElement(name="isArchive")
public boolean isArchive() {
return isArchive;
}
 
/**
* @return the isSystem
*/
@XmlElement(name="isSystem")
public boolean isSystem() {
return isSystem;
}
 
/**
* @return the lastModifiedDate
*/
@XmlElement(name="lastModifiedDate")
public GregorianCalendar getLastModifiedDate() {
return lastModifiedDate;
}
 
/**
* @return the createdDate
*/
@XmlElement(name="createdDate")
public GregorianCalendar getCreatedDate() {
return createdDate;
}
 
/**
* @return the lastAccessDate
*/
@XmlElement(name="lastAccessDate")
public GregorianCalendar getLastAccessDate() {
return lastAccessDate;
}
 
/**
* @return the owner
*/
@XmlElement(name="owner")
public String getOwner() {
return owner;
}
 
/**
* @return the mimeType
*/
@XmlElement(name="mimeType")
public String getMimeType() {
return mimeType;
}
 
/**
* @return the downloadUrl
*/
@XmlElement(name="downloadUrl")
public URI getDownloadUrl() {
return downloadUrl;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/ant/AntProperty.java
0,0 → 1,76
/*
* Copyright 2010 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.types.ant;
 
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
 
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
 
/**
* Generic key/ value pairs.
*
* @author Brian Rosenberger
*/
@XmlRootElement
public class AntProperty {
 
/**
* Key of the entry.
*/
@XmlElement(required=true)
public String name ="";
 
/**
* Value of the entry.
*/
@XmlElement(required=true)
public String value="";
 
/**
* Converts a Map&lt;String, String&gt; into a list of
* AntProperties.
* @param newMap The map to convert
* @return A list of key/value pairs
*/
public static List<AntProperty> createAntPropertyList(Map<String, Object> newMap) {
List<AntProperty> list = new ArrayList<AntProperty>();
for(Map.Entry<String, Object> e : newMap.entrySet()) {
list.add(new AntProperty(e.getKey(), (String)e.getValue()));
}
return list;
}
 
/**
* Creates a new AntProperty.
* @param name
* @param value
*/
public AntProperty(String name, String value) {
this.name = name;
this.value = value;
}
 
/**
* Creates a new AntProperty.
*/
public AntProperty() {
}
 
}
/xservices/trunk/src/main/java/net/brutex/xservices/types/ant/DateInfoType.java
0,0 → 1,66
/*
* 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.types.ant;
 
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import net.brutex.xservices.types.DateFormatType;
 
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
@XmlType(name="DateInfoType", namespace="http://ws.xservices.brutex.net", propOrder={"isoDate", "rfcDate", "millis"})
public class DateInfoType
{
public static final String XML_NAME = "DateInfoType";
private final GregorianCalendar date;
private final TimeZone zone;
 
public DateInfoType(GregorianCalendar date, TimeZone zone)
{
this.date = date;
this.zone = zone;
}
 
public DateInfoType()
{
this.zone = TimeZone.getDefault();
this.date = new GregorianCalendar(this.zone);
}
 
@XmlElement(name="timestamp")
public long getMillis()
{
return this.date.getTimeInMillis();
}
 
@XmlElement(name="iso8601date")
public Date getIsoDate()
{
return this.date.getTime();
}
 
@XmlElement(name="rfc822date")
public String getRfcDate()
{
return DateFormatType.RFC822.format(this.date.getTime(), null, null);
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/ant/ContainsSelectorType.java
0,0 → 1,53
/*
* Copyright 2010 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.types.ant;
 
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.apache.tools.ant.types.selectors.ContainsSelector;
import org.apache.tools.ant.types.selectors.FileSelector;
 
/**
*
* @author Brian Rosenberger, bru@brutex.de
*/
@XmlType
public class ContainsSelectorType implements SelectorTypeInterface {
public static final String XML_NAME="contains";
 
public ContainsSelectorType() {
}
 
public FileSelector getSelector() {
ContainsSelector selector = new ContainsSelector();
selector.setCasesensitive(casesensitive);
selector.setText(text);
selector.setIgnorewhitespace(ignorewhitespace);
return selector;
}
 
@XmlElement(required=true, nillable=false)
public String text;
 
@XmlElement(required=true, defaultValue="true")
public boolean casesensitive;
 
@XmlElement(required=true, defaultValue="false")
public boolean ignorewhitespace;
 
}
/xservices/trunk/src/main/java/net/brutex/xservices/types/ant/SelectorType.java
0,0 → 1,36
/*
* Copyright 2010 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.types.ant;
 
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import org.apache.tools.ant.types.selectors.FileSelector;
 
/**
*
* @author Brian Rosenberger, bru@brutex.de
*/
public abstract class SelectorType implements SelectorTypeInterface {
 
public SelectorType() {
}
 
@XmlElement(name=ContainsSelectorType.XML_NAME, nillable=true)
public List<ContainsSelectorType> contains;
 
 
}
/xservices/trunk/src/main/java/net/brutex/xservices/types/ant/FileSetResource.java
0,0 → 1,132
/*
* Copyright 2010 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.types.ant;
 
import java.io.File;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Resource;
import org.apache.tools.ant.types.TarFileSet;
import org.apache.tools.ant.types.ZipFileSet;
 
/**
* Set of files from various sources.
*
* @author Brian Rosenberger, bru@brutex.de
*/
@XmlType(name = "FileSetType", namespace = "http://ws.xservices.brutex.net",
propOrder = {"type", "source", "filter", "excludes", "casesensitive"})
public class FileSetResource implements ResourceSetInterface {
 
public static final String XML_NAME = "fileset";
/**
* Type of FileSet
*/
@XmlElement(name = "FileSetType", required = true, nillable = false, defaultValue = "FILES")
public FileSetType type = FileSetType.FILES;
/**
* File set source.
*
* Depends on the file set type. This is either an archive file or a
* directory.
*/
@XmlElement(name = "source", required = true, nillable = false)
public String source = "";
/**
* Pattern of files to include.
*
*/
@XmlElement(name = PatternSetType.XML_NAME, required = true, nillable = true)
public PatternSetType filter;
 
/**
* Pattern of files to exclude.
*/
@XmlElement(name = "excludes", required = false, nillable = true, defaultValue = "")
public String excludes = "";
/**
* Case sensitivity for include/ exclude patterns.
*/
@XmlElement(name = "casesensitive", required = true, nillable = false, defaultValue = "true")
public boolean casesensitive = true;
 
/**
* Get Ant FileSet for this file set.
*
* @param p Ant project
* @return Ant FileSet for this file set.
*/
public FileSet getAntResource(Project p) {
FileSet set = null;
switch (type) {
case ZIP:
ZipFileSet zset = new ZipFileSet();
zset.setSrc(new File(source));
zset.setEncoding(System.getProperty("file.encoding"));
set = zset;
break;
case TAR:
TarFileSet tset = new TarFileSet();
tset.setSrc(new File(source));
set = tset;
break;
case GZTAR:
Resource res = new FileResource(FileResource.Type.GZIP, source).getAntResource(p);
TarFileSet gzset = new TarFileSet();
gzset.setSrcResource(res);
set = gzset;
break;
default: //FILES
set = new FileSet();
set.setDir(new File(source));
}
set.setProject(p);
//set.setIncludes(includes);
set.setExcludes(excludes);
set.setCaseSensitive(casesensitive);
 
return set;
}
 
/**
* File set types.
*/
@XmlEnum()
@XmlType(name="resourcetype")
public enum FileSetType {
 
/**
* Set of files (this is based on a directory, so provide a path only
* as file set source).
*/
FILES,
/**
* Set of files inside a ZIP archive.
*/
ZIP,
/**
* Set of files inside a TAR archive (without compression).
*/
TAR,
/**
* Set of files inside a gzip compressed TAR archive.
*/
GZTAR
}
}
/xservices/trunk/src/main/java/net/brutex/xservices/types/ant/SelectorTypeInterface.java
0,0 → 1,27
/*
* Copyright 2011 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.types.ant;
 
import org.apache.tools.ant.types.selectors.FileSelector;
 
/**
*
* @author Brian Rosenberger
*/
public interface SelectorTypeInterface {
public FileSelector getSelector();
}
/xservices/trunk/src/main/java/net/brutex/xservices/types/ant/ResourceSetInterface.java
0,0 → 1,35
/*
* Copyright 2011 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.
*/
 
/**
* Wrapper for Ant Resource Sets. A resource set
* is simply a collection of resources.
*
* @author Brian Rosenberger, bru@brutex.de
*/
package net.brutex.xservices.types.ant;
 
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.ResourceCollection;
/**
* Wrapper for Ant Resource Collection.
*
* @author Brian Rosenberger, bru@brutex.de
*/
public interface ResourceSetInterface {
public ResourceCollection getAntResource(Project p);
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/ant/FileResource.java
0,0 → 1,139
/*
* Copyright 2010 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.types.ant;
 
import java.io.File;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
 
import net.brutex.xservices.util.BrutexNamespaces;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Resource;
import org.apache.tools.ant.types.resources.BZip2Resource;
import org.apache.tools.ant.types.resources.GZipResource;
import org.apache.tools.ant.types.resources.URLResource;
 
/**
* File based resource declaration.
*
*
* @author Brian Rosenberger, bru@brutex.de
*/
@XmlType(name="FileResourceType", namespace=BrutexNamespaces.WS_XSERVICES)
public class FileResource
implements ResourceInterface {
 
public static final String XML_NAME = "file";
/**
* File resource type.
*/
@XmlElement(defaultValue = "FILE", nillable = false, required = true)
public Type type = Type.FILE;
 
/**
* URI to file.
*
* Examples:<br>
* <code>c:/path/to/myfile.txt<br>
* /usr/share/file<br>
* http://server/path/file.zip</code>
*/
@XmlElement(nillable = false, required = true)
public String uri;
 
/**
* File resource type.
*
* Defines the wrapper around the source.
*/
@XmlEnum(value=String.class)
public enum Type {
 
/**
* Plain file from OS accessible file system.
*/
FILE,
 
/**
* File from URL (http, https, ftp, ...)
*/
URL,
 
/**
* File from file system with on-the-fly GZIP decompression
*/
GZIP,
 
/**
* File from file system with on-the-fly BZIP2 decompression
*/
BZIP2
}
 
/**
* Creates a FileResource.
*
* @param type file resource type
* @param uri file resource uri
*/
public FileResource(Type type, String uri) {
this.type = type;
this.uri = uri;
}
 
/**
* Create an empty FileResource
*/
public FileResource() {
}
 
/**
* Get Apache Ant Resource type.
*
* @param p Ant project
* @return This FileResource as Ant Resource
*/
public Resource getAntResource(Project p) {
Resource res = null;
switch (type) {
case URL:
URLResource ures = new URLResource(uri);
res = ures;
break;
 
case GZIP:
GZipResource gres = new GZipResource(
new org.apache.tools.ant.types.resources.FileResource(new File(uri)));
res = gres;
break;
 
case BZIP2:
BZip2Resource bres = new BZip2Resource(
new org.apache.tools.ant.types.resources.FileResource(new File(uri)));
res = bres;
break;
 
default:
//Default is Type FILE
res = new org.apache.tools.ant.types.resources.FileResource(new File(uri));
}
res.setProject(p);
return res;
}
}
/xservices/trunk/src/main/java/net/brutex/xservices/types/ant/PatternElement.java
0,0 → 1,31
/*
* Copyright 2011 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.types.ant;
 
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
 
/**
*
* @author brian
*/
@XmlType()
public class PatternElement {
 
@XmlValue()
public String pattern;
}
/xservices/trunk/src/main/java/net/brutex/xservices/types/ant/ResourceInterface.java
0,0 → 1,37
/*
* Copyright 2010 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.types.ant;
 
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Resource;
 
/**
* Wrapper for a single file like Ant Resources.
*
* @author Brian Rosenberger, bru@brutex.de
*/
public interface ResourceInterface {
 
/**
* Get this resource as Ant Resource.
*
* @param p Ant project
* @return this resource as Ant Resource
*/
Resource getAntResource(Project p);
 
}
/xservices/trunk/src/main/java/net/brutex/xservices/types/ant/ArchiveResource.java
0,0 → 1,123
/*
* Copyright 2010 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.types.ant;
 
import java.io.File;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
 
import net.brutex.xservices.util.BrutexNamespaces;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Resource;
import org.apache.tools.ant.types.resources.TarResource;
import org.apache.tools.ant.types.resources.ZipResource;
import org.apache.tools.tar.TarEntry;
import org.apache.tools.zip.ZipEntry;
 
/**
* Resource from archive declaration.
*
* Defines a resource within an archive.
* @author Brian Rosenberger, bru@brutex.de
*/
@XmlType(namespace = BrutexNamespaces.WS_XSERVICES, name="ArchiveResourceType")
public class ArchiveResource
implements ResourceInterface {
 
/**
* Archive Type.
*/
@XmlElement(defaultValue = "ZIP", nillable = false, required = true)
public ArchiveType type = ArchiveType.ZIP;
 
/**
* Archive file.
*
* Path and filename of the archive to use.
*/
@XmlElement(nillable = false, required = true)
public String archive;
 
/**
* URI within the archive.
*
* This is usually a filename or a path/filename combination. Relative paths
* are based from the archive root. It depends on how the archive has been
* created whether or not it is possible to use relative paths, absolute
* paths are required otherwise. Uses "/" as separator.
*/
@XmlElement(nillable = false, required = true)
public String uri;
 
/**
* Supported archive types.
*/
@XmlEnum(value=String.class)
public enum ArchiveType {
 
/**
* Zip archive type.
*/
ZIP,
 
/**
* Tar archive type, without compression
*/
TAR,
/**
* Tar archive type, with GZIP compression
*/
GZTAR
}
 
/**
* Get Apache Ant Resource Type.
*
* @param p Ant project
* @return this ArchiveResource as Ant Resource
*/
public Resource getAntResource(Project p) {
Resource res = null;
switch (type) {
case TAR:
TarEntry tarentry = new TarEntry(uri);
TarResource tres = new TarResource(new File(archive), tarentry);
res = tres;
break;
 
case GZTAR:
TarResource gres = new TarResource(new org.apache.tools.ant.types.resources.GZipResource(
new org.apache.tools.ant.types.resources.FileResource(
new File(archive))), new TarEntry(uri));
res = gres;
break;
 
default: //This is type ZIP also
ZipEntry zipentry = new ZipEntry(uri);
if (zipentry.getTime() == -1) {
zipentry.setTime(System.currentTimeMillis());
}
res = new ZipResource(new File(archive), null, zipentry);
break;
}
 
res.setProject(p);
return res;
}
}
/xservices/trunk/src/main/java/net/brutex/xservices/types/ant/AttachmentType.java
0,0 → 1,69
/*
* Copyright 2011 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.types.ant;
 
import java.io.File;
import java.io.IOException;
 
import javax.activation.DataHandler;
import javax.xml.bind.annotation.XmlMimeType;
 
import net.brutex.xservices.util.BrutexNamespaces;
 
import org.apache.cxf.aegis.type.java5.XmlElement;
import org.apache.cxf.aegis.type.java5.XmlType;
 
 
/**
* Represents a single file based attachment type.
* @author Brian Rosenberger, bru@brutex.de
* @since 0.4.0
*/
@XmlType(name=AttachmentType.XML_NAME, namespace=BrutexNamespaces.WS_XSERVICES)
public class AttachmentType {
 
public static final String XML_NAME="attachment";
private DataHandler content;
private String filename = null;
 
@XmlMimeType("application/octet-stream")
@XmlElement(minOccurs="1")
public void setContent(DataHandler content) {
this.content = content;
}
 
public DataHandler getContent() {
return content;
}
public String getFilename() {
if(filename==null || filename.equals("")) {
try {
filename = File.createTempFile("XServices_", ".tmp").getPath();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/ant/PatternSetType.java
0,0 → 1,41
/*
* Copyright 2010 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.types.ant;
 
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
 
/**
*
* @author Brian Rosenberger
*/
 
public class PatternSetType {
 
public static final String XML_NAME = "filter";
 
@XmlElement(required=false, nillable=false, defaultValue="**/*")
public List<PatternElement> include;
 
@XmlElement(required=false, nillable=false)
public List<PatternElement> exclude;
 
@XmlElement(required=false, nillable=true)
public SelectorType selector;
 
public PatternSetType() {
}
}
/xservices/trunk/src/main/java/net/brutex/xservices/types/ant/CollectionType.java
0,0 → 1,84
/*
* Copyright 2010 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.types.ant;
 
import java.util.UUID;
 
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
 
/**
* Defines a collection of storable objects.
*
* @author Brian Rosenberger
* @since 1.0
*/
@XmlType()
public class CollectionType {
 
private String name="";
final private UUID uuid;
 
/**
* @return the name
*/
public String getName() {
return name;
}
 
/**
* @param name the name to set
*/
@XmlElement(required=true)
public void setName(String name) {
this.name = name;
}
/**
* @return
*/
public String getUuid() {
return uuid.toString();
}
 
/**
* @param name
* @param uuid
*/
public CollectionType(String name, UUID uuid) {
this.name = name;
this.uuid = uuid;
}
/**
* @param name
* @param uuid
*/
public CollectionType(String name) {
this.name = name;
this.uuid = UUID.randomUUID();
}
/**
*/
public CollectionType() {
this.name = "";
this.uuid = UUID.randomUUID();
}
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/HostinfoType.java
0,0 → 1,116
/*
* Copyright 2012 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.types;
 
import net.brutex.xservices.util.BrutexNamespaces;
 
 
/**
* Host information.
* @author Brian Rosenberger, bru@brutex.de
*/
@javax.xml.bind.annotation.XmlType(name=HostinfoType.XML_NAME, namespace=BrutexNamespaces.WS_XSERVICES)
public class HostinfoType {
 
public final static String XML_NAME="hostinfo";
private String name;
private String domain;
private String ip4;
private String ip6;
/**
* Create a new HostinfoType.
*/
public HostinfoType() {
}
/**
* Create a new HostinfoType.
*
* @param name
* @param domain
* @param ip4
* @param ip6
*/
public HostinfoType(String name, String domain, String ip4, String ip6) {
this.name = name;
this.domain = domain;
this.ip4 = ip4;
this.ip6 = ip6;
}
 
/**
* Get the host name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Set the host name.
*
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* Get the host domain.
*
* @return the domain
*/
public String getDomain() {
return domain;
}
/**
* Set the host domain.
*
* @param domain the domain to set
*/
public void setDomain(String domain) {
this.domain = domain;
}
/**
* Get the IP address version 4 representation for this host.
* @return the ip4
*/
public String getIp4() {
return ip4;
}
/**
* Set the IP address version 4.
* @param ip4 the ip4 to set
*/
public void setIp4(String ip4) {
this.ip4 = ip4;
}
/**
* Get the IP address version 6 representation for this host.
* @return the ip6
*/
public String getIp6() {
return ip6;
}
/**
* Set the IP address version 6 representation for this host.
* @param ip6 the ip6 to set
*/
public void setIp6(String ip6) {
this.ip6 = ip6;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/AttributeType.java
0,0 → 1,35
/*
* 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.types;
 
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
 
import net.brutex.xservices.util.BrutexNamespaces;
 
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
@XmlType(namespace=BrutexNamespaces.WS_XSERVICES, name=AttributeType.XML_NAME)
public class AttributeType {
public final static String XML_NAME = "AttributeType";
@XmlElement(required=true, nillable=false)
public String name;
@XmlElement(nillable=true)
public String value;
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/RuntimeInfoType.java
0,0 → 1,64
/*
* Copyright 2012 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.types;
 
import javax.xml.bind.annotation.XmlElement;
 
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
 
public class RuntimeInfoType
{
private final Runtime runtime = Runtime.getRuntime();
 
@XmlElement
public int getAvailableProcessors() {
return this.runtime.availableProcessors();
}
 
@XmlElement
public long getFreeMemory() {
return this.runtime.freeMemory();
}
 
@XmlElement
public long getFreeMemoryMB() {
return this.runtime.freeMemory() / 1024L;
}
 
@XmlElement
public long getMaxMemory() {
return this.runtime.maxMemory();
}
 
@XmlElement
public long getMaxMemoryMB() {
return this.runtime.maxMemory() / 1024L;
}
 
@XmlElement
public long getTotalMemory() {
return this.runtime.totalMemory();
}
 
@XmlElement
public long getTotalMemoryMB() {
return this.runtime.totalMemory() / 1024L;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/StringReplaceType.java
0,0 → 1,37
/*
* 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.types;
 
import javax.xml.bind.annotation.XmlType;
 
@XmlType
public class StringReplaceType
{
public String string;
public int count;
 
public StringReplaceType()
{
}
 
public StringReplaceType(String string, int count)
{
this();
this.string = string;
this.count = count;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/StringMatchDetails.java
0,0 → 1,41
/*
* 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.types;
 
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
public class StringMatchDetails
{
public long startPosition;
public long endPosition;
public String content;
public String group;
 
public StringMatchDetails()
{
}
 
public StringMatchDetails(long start, long end, String group, String content)
{
this.startPosition = start;
this.endPosition = end;
this.group = group;
this.content = content;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/StringSplitType.java
0,0 → 1,40
/*
* 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.types;
 
import java.util.ArrayList;
import java.util.List;
 
import javax.xml.bind.annotation.XmlType;
 
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
 
@XmlType
public class StringSplitType
{
public final List<String> stringlist = new ArrayList();
public int size = 0;
 
public synchronized void addStringMatch(String token)
{
this.stringlist.add(token);
this.size += 1;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/NamespaceListType.java
0,0 → 1,55
/*
* 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.types;
 
import java.util.ArrayList;
import java.util.List;
 
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
 
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
@XmlRootElement
public class NamespaceListType
{
private List<NamespaceType> list = new ArrayList<NamespaceType>();
 
/**
* @return
*/
@XmlElement(name="namespace")
public List<NamespaceType> getNamespaces() {
return this.list;
}
 
/**
* @param ns
*/
public void addNamespace(NamespaceType ns) {
this.list.add(ns);
}
 
/**
*
*/
public void clearNamespaceList() {
this.list.clear();
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/NamespaceType.java
0,0 → 1,57
/*
* 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.types;
 
import java.net.URI;
 
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
 
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
@XmlType(name="namespace", namespace="http://ws.xservices.brutex.net")
public class NamespaceType
{
public static final String XML_NAME = "namespace";
private String prefix;
private URI uri;
 
public String getPrefix()
{
return this.prefix;
}
 
@XmlElement(required=true)
public void setPrefix(String prefix)
{
this.prefix = prefix;
}
 
public URI getUri()
{
return this.uri;
}
 
@XmlElement(nillable=true, required=true)
public void setUri(URI uri)
{
this.uri = uri;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/DateTimeUnits.java
0,0 → 1,74
/*
* Copyright 2011 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.types;
 
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
 
/**
* Different pre-defined date formats.
*
* @author Brian Rosenberger, bru@brutex.de
*/
@XmlEnum(value = String.class)
public enum DateTimeUnits {
 
/**
* milliseconds
*/
@XmlEnumValue("milliseconds")
MILLISECONDS("milliseconds"),
/**
* seconds
*/
@XmlEnumValue("seconds")
SECONDS("seconds"),
/**
* minutes
*/
@XmlEnumValue("minutes")
MINUTES("minutes"),
/**
* hours
*/
@XmlEnumValue("hours")
HOURS("hours"),
/**
* days
*/
@XmlEnumValue("days")
DAYS("days"),
@XmlEnumValue("years")
YEARS("years");
private String value;
DateTimeUnits(String value) {
this.value = value;
}
 
/**
* Return the value of the enum.
* @return String representation of the mime type
*/
public String value() {
return value;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/DateFormatType.java
0,0 → 1,111
/*
* Copyright 2011 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.types;
 
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
 
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;
 
import net.brutex.xservices.util.BrutexNamespaces;
 
/**
* Different pre-defined date formats.
*
* @author Brian Rosenberger, bru@brutex.de
*/
@XmlEnum()
public enum DateFormatType {
 
/**
* ISO 8601 format (2011-05-24T14:39+01:00)
*/
@XmlEnumValue("ISO 8601")
ISO8601("ISO 8601", "yyyy-MM-dd'T'HH:mm:ss.SSSZ"),
/**
* RFC822 format (2011-05-24T14:39+0100)
*/
@XmlEnumValue("RFC 822")
RFC822("RFC 822", "yyyy-MM-dd'T'HH:mm:ss.SSSZ"),
/**
* yyyy/mm/dd
*/
@XmlEnumValue("DateOnly-slashed")
YYYYMMDD("DateOnly-slashed", "yyyy/MM/dd"),
/**
* dd.mm.yyyy
*/
@XmlEnumValue("DateOnly-dotted")
DDMMYYYY("DateOnly-dotted", "dd.MM.yyyy"),
/**
* dd.mm.yyyy
*/
@XmlEnumValue("DateOnly-dashed")
DDMMYYYYdashed("DateOnly-dashed", "dd-MM-yyyy");
private String value;
private String format;
DateFormatType(String value, String format) {
this.value = value;
this.format = format;
}
 
/**
* Return the value of the enum.
* @return String representation of the mime type
*/
public String value() {
return value;
}
public String format(Date date, Locale locale, TimeZone timezone) {
if(date==null) return "";
if(locale==null) locale = Locale.getDefault();
if(timezone==null) timezone = TimeZone.getDefault();
String result = "";
SimpleDateFormat f;
if(this.equals(ISO8601)) {
//apply ISO8061 hack
f = new SimpleDateFormat(RFC822.format, locale);
f.setTimeZone(timezone);
result = f.format(date);
result = result.substring(0, 26) + ":" + result.substring(26);
} else {
f = new SimpleDateFormat(this.format, locale);
f.setTimeZone(timezone);
result = f.format(date);
}
return result;
}
public Date parse(String s, Locale locale, TimeZone timezone)
throws ParseException {
if(locale==null) locale = Locale.getDefault();
if(timezone==null) timezone = TimeZone.getDefault();
SimpleDateFormat fin = new SimpleDateFormat(this.format, locale);
fin.setTimeZone(timezone);
Date date = fin.parse(s);
return date;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/DateInfoType.java
0,0 → 1,96
/*
* Copyright 2012 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.types;
 
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
 
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
 
import net.brutex.xservices.util.BrutexNamespaces;
 
 
 
 
/**
* Date object representation with different formats
*
* @author Brian Rosenberger, bru@brutex.de
*/
@XmlType(name=DateInfoType.XML_NAME, namespace=BrutexNamespaces.WS_XSERVICES,
propOrder={"isoDate","rfcDate", "millis"})
public class DateInfoType {
 
public static final String XML_NAME="DateInfoType";
private final GregorianCalendar date;
private final TimeZone zone;
/**
* Create a new DateInfoType
* @param date date/time
*/
public DateInfoType(GregorianCalendar date, TimeZone zone) {
this.date = date;
this.zone = zone;
}
/**
* Create a new DateInfoType with current date/time
*/
public DateInfoType() {
this.zone = TimeZone.getDefault();
this.date = new GregorianCalendar(zone);
}
/**
* @return milliseconds since 01.01.1970
*/
@XmlElement(name="timestamp")
public long getMillis() {
return date.getTimeInMillis();
}
/**
* Get date formated according to ISO8601 (done by jaxb->xsd:datetime conversion)
* @return date
*/
@XmlElement(name="iso8601date")
public Date getIsoDate() {
//String format = DateFormatType.ISO8601.format();
//SimpleDateFormat f = new SimpleDateFormat(format);
//String text = f.format(date.getTime());
//Fix missing colon in java timezone
//return text.substring(0, 22) + ":" + text.substring(22);
return date.getTime();
}
/**
* Get date formated according to RFC822 (also java standard)
* @return date string
*/
@XmlElement(name="rfc822date")
public String getRfcDate() {
return DateFormatType.RFC822.format(date.getTime(), null, null);
}
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/DateInfoExtendedType.java
0,0 → 1,69
/*
* Copyright 2011 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.types;
 
import java.text.SimpleDateFormat;
import java.util.GregorianCalendar;
import java.util.TimeZone;
 
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
 
import net.brutex.xservices.util.BrutexNamespaces;
 
/**
* @author Brian Rosenberger
*
*/
@XmlType(namespace=BrutexNamespaces.WS_XSERVICES)
public class DateInfoExtendedType extends DateInfoType {
 
private GregorianCalendar date = null;
private TimeZone zone = null;
 
@SuppressWarnings("unused")
public DateInfoExtendedType() {
super();
}
 
public DateInfoExtendedType(GregorianCalendar date, TimeZone zone) {
this.date = date;
this.zone = zone;
}
 
@XmlElement(name = "format1")
public String getFormat1() {
return DateFormatType.DDMMYYYY.format(date.getTime(), null, null);
}
 
/**
* @return
*/
@XmlElement(name = "format2")
public String getFormat2() {
return DateFormatType.YYYYMMDD.format(date.getTime(), null, null);
}
 
@XmlElement(name = "format3")
public String getFormat3() {
String format = "HH:mm:ss";
SimpleDateFormat f = new SimpleDateFormat(format);
return f.format(date.getTime());
}
 
// yyyy-MM-dd'T'HH:mm:ssZ
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/TimeZoneType.java
0,0 → 1,81
/*
* Copyright 2012 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.types;
 
import java.util.TimeZone;
 
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
 
import net.brutex.xservices.util.BrutexNamespaces;
 
/**
* Different pre-defined date formats.
*
* @author Brian Rosenberger, bru@brutex.de
*/
@XmlType(name=TimeZoneType.XML_NAME, namespace=BrutexNamespaces.WS_XSERVICES)
public class TimeZoneType {
public static final String XML_NAME = "timezone";
private String id;
private String displayname;
private TimeZone timezone;
private long offset;
public TimeZoneType(TimeZone timezone) {
this.timezone = timezone;
this.id = timezone.getID();
this.displayname = timezone.getDisplayName();
this.offset = timezone.getRawOffset()/1000;
}
public TimeZoneType() {
this(TimeZone.getDefault());
}
 
/**
* @return the id
*/
@XmlElement
public String getId() {
return id;
}
 
/**
* @return the displayname
*/
@XmlElement
public String getDisplayname() {
return displayname;
}
 
/**
* @return the timezone
*/
public TimeZone getTimezone() {
return timezone;
}
 
/**
* @return the offset
*/
@XmlElement
public long getOffset() {
return offset;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/ReturnCode.java
0,0 → 1,100
/*
* Copyright 2010 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.types;
 
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
 
import net.brutex.xservices.types.ant.AntProperty;
import net.brutex.xservices.util.BrutexNamespaces;
 
/**
*
* @author Brian Rosenberger, bru@brutex.de
*/
@XmlType(namespace=BrutexNamespaces.WS_XSERVICES, name="ReturnCodeType")
public class ReturnCode {
 
/**
* Numeric return code.
*
* The numeric return code of the last operation on the underlying operation
* systen (OS). In general the return code indicates the failure or success
* of a command. Which value indicates success is dependent on the OS, most
* linux based systems use "0" for success.
*/
@XmlElement(required=true, nillable=false)
public int returnCode=0;
 
/**
* Standard Out as provided by the OS.
*
* The stdOut given by the last operation (if any).
*/
@XmlElement(name="stdOut", nillable=false)
public String stdOut="";
 
/**
* The Standard Error as provided by the OS.
*
* The stdErr given by the last operation (if any). The presents of any
* value here ususally indicates that a failure has occured.
*/
@XmlElement(name="stdErr", nillable=false)
public String stdErr="";
 
 
@XmlElement(name="propertyList", nillable=true)
public List<AntProperty> property = null;
 
/**
* Create a new ReturnCode default constructor.
*/
public ReturnCode() {
}
 
/**
* Create a new ReturnCode.
*
* @param returnCode return code integer value
* @param stdOut standard out string
* @param stdErr standard error string
*/
public ReturnCode(int returnCode, String stdOut, String stdErr, List<AntProperty> props) {
this.returnCode = returnCode;
this.stdOut = stdOut;
this.stdErr = stdErr;
this.property = props;
}
/**
* @param key
* @return
*/
public String getProperty(String key) {
for(AntProperty prop : this.property) {
if(key.equals(prop.name)) return prop.value;
}
return null;
}
/**
* @return
*/
public String getStdOut() { return this.stdOut; }
}
/xservices/trunk/src/main/java/net/brutex/xservices/types/TargetNodeType.java
0,0 → 1,60
/*
* Copyright 2012 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.types;
 
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
 
import net.brutex.xservices.util.BrutexNamespaces;
 
 
/**
* Defines target nodes.
*
* @author Brian Rosenberger
* @since 1.0
*/
@XmlType(name=TargetNodeType.XML_NAME, namespace=BrutexNamespaces.WS_XSERVICES)
public class TargetNodeType {
 
public static final String XML_NAME = "targetnode";
private String name="";
 
 
/**
* @return the name
*/
public String getName() {
return name;
}
 
/**
* @param name the name to set
*/
@XmlElement(required=true)
public void setName(String name) {
this.name = name;
}
/**
*
*/
public TargetNodeType() {
 
}
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/MailMimeType.java
0,0 → 1,55
/*
* Copyright 2010 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.types;
 
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
 
/**
* MIME types for email messages.
* This type restricts the mime types to be used within the
* email body.
*
* @author Brian Rosenberger, bru@brutex.de
* @since 0.4.0
*/
@XmlEnum(value = String.class)
public enum MailMimeType {
 
/**
* Plain text.
*/
@XmlEnumValue("text/plain")
PLAIN("text/plain"),
/**
* HTML
*/
@XmlEnumValue("text/html")
HTML("text/html");
private String value;
 
MailMimeType(String value) {
this.value = value;
}
 
/**
* Return the value of the enum.
* @return String representation of the mime type
*/
public String value() {
return value;
}
}
/xservices/trunk/src/main/java/net/brutex/xservices/types/ScheduledJob.java
0,0 → 1,135
/*
* Copyright 2011 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.types;
 
import java.util.GregorianCalendar;
 
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
 
import net.brutex.xservices.util.BrutexNamespaces;
 
/**
* Scheduled job type
*
* @author Brian Rosenberger
* @since 0.5.0
*
*/
@XmlType(namespace=BrutexNamespaces.WS_XSERVICES)
@XmlAccessorType(XmlAccessType.FIELD)
public class ScheduledJob {
 
@XmlElement(required=true,name="name")
private String name;
@XmlElement(required=false, name="description")
private String description;
@XmlElement(required=true, name="datetime")
private GregorianCalendar date;
@XmlElement(name="script")
private String script;
/**
* Create a new scheduled job.
*
* @param name Job name.
* @param datetime Scheduled date and time.
* @param script The script to execute.
*/
public ScheduledJob(String name, GregorianCalendar datetime, String script) {
this.name = name;
this.date = datetime;
this.script = script;
this.description = null;
}
/**
* Create a new scheduled job.
*
* @param name Job name.
* @param datetime Scheduled date and time.
* @param script The script to execute.
* @param description Job description.
*/
public ScheduledJob(String name, GregorianCalendar datetime, String script, String description) {
this.name = name;
this.date = datetime;
this.script = script;
this.description = description;
}
/**
* Create a new scheduled job.
*/
public ScheduledJob() {
this.name = null;
this.date=null;
this.script=null;
}
/**
* Set name of the job.
* @param name
*/
public void setName(String name) {
this.name = name;
}
 
/**
* Get name of the job.
* @return job name
*/
public String getName() {
return name;
}
 
/**
* Set scheduled date.
* @param date
*/
public void setDate(GregorianCalendar date) {
this.date = date;
}
 
/**
* get scheduled date.
* @return date
*/
public GregorianCalendar getDate() {
return date;
}
 
public void setScript(String script) {
this.script = script;
}
 
public String getScript() {
return script;
}
public void setDescription(String desc) {
this.description = desc;
}
 
public String getDescription() {
return description;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/ReplacePattern.java
0,0 → 1,75
/*
* Copyright 2010 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.types;
 
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
 
/**
* Generic key/ value pairs.
*
* @author Brian Rosenberger
*/
@XmlRootElement
public class ReplacePattern {
 
/**
* Search string.
*/
@XmlElement(required=true)
public String search ="";
 
/**
* Replace string.
*/
@XmlElement(required=true)
public String replace="";
 
/**
* Converts a Map&lt;String, String&gt; into a list of
* ReplacePattern.
* @param map The map to convert
* @return A list of key/value pairs
*/
public static List<ReplacePattern> createAntPropertyList(Map<String, String> map) {
List<ReplacePattern> list = new ArrayList<ReplacePattern>();
for(Map.Entry<String, String> e : map.entrySet()) {
list.add(new ReplacePattern(e.getKey(), e.getValue()));
}
return list;
}
 
/**
* Creates a new ReplacePattern.
* @param name
* @param value
*/
public ReplacePattern(String search, String replace) {
this.search = search;
this.replace = replace;
}
 
/**
* Creates a new ReplacePattern.
*/
public ReplacePattern() {
}
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/types/HostConnection.java
0,0 → 1,44
/*
* Copyright 2010 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.types;
 
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
 
/**
*
* @author Brian Rosenberger, bru@brutex.de
*/
@XmlType(name="connection")
public class HostConnection {
 
public HostConnection() {
}
 
@XmlElement(name="hostname", required=true, nillable=false)
public String hostname;
 
@XmlElement(name="port", required=false, nillable=false)
public int port;
 
@XmlElement(name="user", required=false, nillable=false)
public String user;
 
@XmlElement(name="password", required=false, nillable=false)
public String password;
 
}
/xservices/trunk/src/main/java/net/brutex/xservices/types/CompressionType.java
0,0 → 1,28
/*
* Copyright 2010 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.types;
 
import javax.xml.bind.annotation.XmlEnum;
 
/**
*
* @author Brian Rosenberger, bru@brutex.de
*/
@XmlEnum()
public enum CompressionType {
NONE, GZIP, BZIP2
}
/xservices/trunk/src/main/java/net/brutex/xservices/ws/impl/OpenAirProxyServiceImpl.java
0,0 → 1,501
/*
* Copyright 2017 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.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
 
import javax.activation.DataHandler;
import javax.jws.WebParam;
import javax.jws.WebService;
 
import org.apache.commons.configuration2.ex.ConfigurationException;
import org.apache.commons.configuration2.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;
import net.brutex.mgmt.api.xml.AnyEntity;
import net.brutex.mgmt.api.xml.Customer;
import net.brutex.mgmt.api.xml.DateFilter;
import net.brutex.mgmt.api.xml.Project;
import net.brutex.mgmt.api.xml.Query;
import net.brutex.mgmt.api.xml.Query.BOOL;
import net.brutex.mgmt.api.xml.QueryEntity;
import net.brutex.mgmt.api.xml.StringEntity;
import net.brutex.mgmt.api.xml.TimesheetEntry;
import net.brutex.mgmt.api.xml.TimesheetFilter;
import net.brutex.mgmt.api.xml.User;
import net.brutex.mgmt.openair.OpenAirRestConnection;
import net.brutex.xservices.types.ant.AttachmentType;
import net.brutex.xservices.util.BrutexNamespaces;
import net.brutex.xservices.ws.OpenAirProxyService;
import net.brutex.xservices.ws.XServicesFault;
 
/**
* @author Brian Rosenberger
*
*/
@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)
*
* @see
* net.brutex.xservices.ws.OpenAirProxyService#getTimeEntryList(java.lang.
* String)
*/
 
@Override
public List<TimesheetEntry> getTimeEntryList(int oa_projectid, int oa_customerid, int oa_userid,
GregorianCalendar startdate, GregorianCalendar enddate, boolean includeNonBillable, List<TimesheetFilter.TimesheetFilterType> filter) throws XServicesFault {
return getTimeEntries(oa_projectid, oa_customerid, oa_userid, startdate, enddate, includeNonBillable, filter);
}
private List<TimesheetEntry> getTimeEntries(final int oa_projectid, final int oa_customerid, final int oa_userid,
final GregorianCalendar fromDate, final GregorianCalendar toDate, final boolean includeNonBillable, List<TimesheetFilter.TimesheetFilterType> filter)
throws XServicesFault {
List<TimesheetEntry> resultlist = new ArrayList<TimesheetEntry>();
if( filter != null && filter.size()>0) {
for( TimesheetFilter.TimesheetFilterType f : filter) {
resultlist.addAll(
getTimeEntriesRAW(oa_projectid, oa_customerid, oa_userid, fromDate, toDate, includeNonBillable, f)
);
}
} else {
resultlist = getTimeEntriesRAW(oa_projectid, oa_customerid, oa_userid, fromDate, toDate, includeNonBillable, null);
}
return resultlist;
}
 
private List<TimesheetEntry> getTimeEntriesRAW(final int oa_projectid, final int oa_customerid, final int oa_userid,
final GregorianCalendar fromDate, final GregorianCalendar toDate, final boolean includeNonBillable, TimesheetFilter.TimesheetFilterType filter)
throws XServicesFault {
 
final OpenAirRestConnection con = getOpenAirConnection();
if (con == null) {
throw new XServicesFault("Could not establish Open Air connection.");
}
 
Query query = new Query(TimesheetEntry.class);
 
if (oa_projectid > 0) {
query.addQuery(new QueryEntity("projectid", new StringEntity(String.valueOf(oa_projectid))), BOOL.AND);
}
 
if (oa_customerid > 0) {
query.addQuery(new QueryEntity("customerid", new StringEntity(String.valueOf(oa_customerid))), BOOL.AND);
}
 
if (oa_userid > 0) {
query.addQuery(new QueryEntity("userid", new StringEntity(String.valueOf(oa_userid))), BOOL.AND);
}
 
if (fromDate != null) {
//adjust
fromDate.add(GregorianCalendar.DAY_OF_MONTH, -1);
DateFilter date = new DateFilter("date");
date.setStartdate(fromDate);
if (toDate != null) {
toDate.add(GregorianCalendar.DAY_OF_MONTH, 1);
date.setEnddate(toDate);
}
query.addFilter(date);
}
if (filter != null) {
query.addFilter(new TimesheetFilter(filter));
}
List<TimesheetEntry> timesheets = (List<TimesheetEntry>) con.getEntitiesByQuery(query);
if (!includeNonBillable)
timesheets = filterBillableOnly(timesheets);
return timesheets;
 
/*
* Query q = new Query(Project.class);
*
* //QueryEntity qe = new QueryEntity("Portfolio__c", new
* StringEntity("Serena")); QueryEntity qe = new QueryEntity("id", new
* StringEntity("19738")); //DWP Bank QueryEntity qe2 = new
* QueryEntity("id", new StringEntity("19737")); //PNW //QueryEntity qe2
* = new QueryEntity("customer_name", new StringEntity(
* "Gerencia Informatica Seguridad Social (GISS)"));
*
* q.addQuery(qe, Query.BOOL.OR); q.addQuery(qe2, Query.BOOL.OR);
*
* List<Project> list = (List<Project>) con.getEntitiesByQuery(q, true);
*
* /*for (Project p : list) {
* Logger.getLogger("TestMain").debug(p.getName());
* System.out.println(p.toString()); }
*/
// User user = con.getUserByLogin("brosenberger");
 
// System.out.println(user.toString());
}
 
@Override
public AttachmentType getExcelTimesheet(int oa_projectid, int oa_customerid, int oa_userid,
GregorianCalendar startdate, GregorianCalendar enddate, boolean includeNonBillable, List<TimesheetFilter.TimesheetFilterType> filter, AttachmentType template)
throws XServicesFault {
 
List<TimesheetEntry> list = getTimeEntries(oa_projectid, oa_customerid, oa_userid, startdate, enddate,
includeNonBillable, filter);
AttachmentType t = getExcelTimesheet2(list, includeNonBillable, template);
/*
* Try to set a time sheet name:
* SignOff <From> - <To> <Project> - <Id> <User>.xlxs
*
*/
String filename = "SignOff";
if(startdate!=null) {
filename += "_";
filename += startdate.toZonedDateTime()
.format( DateTimeFormatter.ofPattern( "uuuu-MM-dd" ) );
}
if(enddate!=null) {
filename += "-";
filename += enddate.toZonedDateTime()
.format( DateTimeFormatter.ofPattern( "uuuu-MM-dd" ) );
}
if(oa_projectid > 0) {
//Project spezifiziert
filename += "_";
if(list.size()>0) {
TimesheetEntry anyentry = list.get(0);
filename += anyentry.getProject().getName();
} else {
filename +="Emtpy";
}
} else {
//Mehrere Projekte, gibt es vielleicht nur eins?
int i = 0;
Set<String> namen = new HashSet<String>();
for (TimesheetEntry entry : list) {
namen.add( entry.getProject().getId() );
}
if(namen.size()>1) {
filename += "_Multiple_Projects";
} else {
if(list.size()>0) {
TimesheetEntry anyentry = list.get(0);
filename += anyentry.getProject().getName();
} else {
filename +="_Emtpy";
}
}
}
//Username
if(oa_userid>0) {
filename += "_";
if(list.size()>0) {
TimesheetEntry anyentry = list.get(0);
filename += anyentry.getUser().getName();
}
}
filename = filename.replace(" ","_");
filename = filename.replaceAll("[^A-Za-z0-9_\\-]", "");
filename += ".xlsx";
t.setFilename(filename);
return t;
}
 
@Override
public AttachmentType getExcelTimesheet2(List<TimesheetEntry> entries, boolean includeNonBillable,
AttachmentType templatefile) throws XServicesFault {
DocBuilder builder = new DocBuilder();
DataHandler dh;
if (templatefile != null) {
dh = builder.createTimesheet(entries, templatefile.getContent());
} else {
dh = builder.createTimesheet(entries, null);
}
AttachmentType t = new AttachmentType();
t.setContent(dh);
t.setFilename("timesheet.xlsx");
return t;
}
 
@Override
public List<Project> getProjectsByExternalId(String externalid) throws XServicesFault {
 
final OpenAirRestConnection con = getOpenAirConnection();
if (con == null) {
throw new XServicesFault("Could not establish Open Air connection.");
}
 
Query query = new Query(Project.class);
 
if (externalid.length() > 0) {
query.addQuery(new QueryEntity("externalid", new StringEntity(externalid)), BOOL.AND);
}
 
List<Project> projects = (List<Project>) con.getEntitiesByQuery(query);
 
return projects;
}
 
/*
* (non-Javadoc)
*
* @see
* net.brutex.xservices.ws.OpenAirProxyService#getProjectsByOppId(java.lang.
* String)
*/
@Override
public List<Project> getProjectsByOppId(String oppid) throws XServicesFault {
final OpenAirRestConnection con = getOpenAirConnection();
if (con == null) {
throw new XServicesFault("Could not establish Open Air connection.");
}
 
Query query = new Query(Project.class);
 
if (oppid.length() > 0) {
query.addQuery(new QueryEntity("opportunity_num__c", new StringEntity(oppid)), BOOL.OR);
query.addQuery(new QueryEntity("SAP_Oracle_Number__c", new StringEntity(oppid)), BOOL.OR);
}
 
List<Project> projects = (List<Project>) con.getEntitiesByQuery(query);
 
return projects;
}
 
@Override
public Customer getCustomerById(int customerid) throws XServicesFault {
final OpenAirRestConnection con = getOpenAirConnection();
if (con == null) {
throw new XServicesFault("Could not establish Open Air connection.");
}
 
Query query = new Query(Customer.class);
 
if (customerid > 0) {
query.addQuery(new QueryEntity("id", new StringEntity(String.valueOf(customerid))), BOOL.AND);
}
 
List<Customer> customer = (List<Customer>) con.getEntitiesByQuery(query);
 
if (customer.isEmpty()) {
return null;
} else {
return customer.get(0);
}
}
/* (non-Javadoc)
* @see net.brutex.xservices.ws.OpenAirProxyService#getUpdatedCustomer(java.util.GregorianCalendar)
*/
@Override
public List<Customer> getUpdatedCustomer(GregorianCalendar date, int offset) throws XServicesFault {
final OpenAirRestConnection con = getOpenAirConnection();
if (con == null) {
throw new XServicesFault("Could not establish Open Air connection.");
}
 
Query query = new Query(Customer.class);
//query.addQuery("Address_Country", new StringEntity(search), BOOL.AND);
query.addQuery("active", new StringEntity("1"), BOOL.AND);
DateFilter datefilter = new DateFilter("updated");
date.add(GregorianCalendar.MINUTE, -1*offset);
datefilter.setStartdate(date);
query.addFilter(datefilter);
 
List<Customer> customer = (List<Customer>) con.getEntitiesByQuery(query);
 
if (customer.isEmpty()) {
return null;
} else {
return customer;
}
}
@Override
public List<Project> getUpdatedProjects(GregorianCalendar date, int offset) throws XServicesFault {
final OpenAirRestConnection con = getOpenAirConnection();
if (con == null) {
throw new XServicesFault("Could not establish Open Air connection.");
}
 
Query query = new Query(Project.class);
//query.addQuery("Address_Country", new StringEntity(search), BOOL.AND);
query.addQuery("Stage", new StringEntity("3"), BOOL.AND);
DateFilter datefilter = new DateFilter("updated");
date.add(GregorianCalendar.MINUTE, -1*offset);
datefilter.setStartdate(date);
query.addFilter(datefilter);
 
List<Project> project = (List<Project>) con.getEntitiesByQuery(query);
 
if (project.isEmpty()) {
return null;
} else {
return project;
}
}
 
@Override
public User getUserById(int userid) throws XServicesFault {
Query query = new Query(User.class);
if (userid > 0) {
query.addQuery(new QueryEntity("id", new StringEntity(String.valueOf(userid))), BOOL.AND);
} else {
return null;
}
return getUserByQuery(query);
}
 
@Override
public User getUserByUsername(String username) throws XServicesFault {
Query query = new Query(User.class);
query.addQuery(new QueryEntity("nickname", new StringEntity(username)), BOOL.AND);
return getUserByQuery(query);
}
@Override
public List<AnyEntity> getAnyObject(String objecttype, List<QueryParameter> queries) throws XServicesFault {
JITCompiler.load();
final OpenAirRestConnection con = getOpenAirConnection();
if (con == null) {
throw new XServicesFault("Could not establish Open Air connection.");
}
Class clazz;
try {
Class.forName("net.brutex.mgmt.api.xml.EntityType");
Class.forName("net.brutex.mgmt.api.xml.AbstractEntity");
clazz = Class.forName("net.brutex.mgmt.api.xml."+objecttype);
} catch (ClassNotFoundException ex ) {
throw new XServicesFault(ex);
}
Query query = new Query(clazz);
 
for(QueryParameter p : queries) {
query.addQuery(new QueryEntity(p.field, new StringEntity(p.value)), BOOL.AND);
}
 
List<AnyEntity> anyentity = (List<AnyEntity>) con.getEntitiesByQuery(query);
 
if (anyentity.isEmpty()) {
return null;
} else {
return anyentity;
}
}
private User getUserByQuery(Query query) throws XServicesFault {
final OpenAirRestConnection con = getOpenAirConnection();
if (con == null) {
throw new XServicesFault("Could not establish Open Air connection.");
}
User user = (User) con.getSingleEntityByQuery(query);
return user;
}
 
List<TimesheetEntry> filterBillableOnly(List<TimesheetEntry> timesheets) {
List<TimesheetEntry> list = new ArrayList<TimesheetEntry>();
for (TimesheetEntry entry : timesheets) {
if (entry.getProjecttask().isBillable()) {
list.add(entry);
}
}
return list;
}
 
private OpenAirRestConnection getOpenAirConnection() {
 
/*
* get details from configuration file
*/
final PropertiesConfiguration props;
try {
final String config = "../openair.properties";
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() )));
final String user = props.getString("user");
final String password = props.getString("password");
final String company = props.getString("company");
final String apikey = props.getString("apikey", "_PUT_HERE_");
final String namespace = props.getString("namespace");
 
final OpenAirRestConnection con;
 
con = new OpenAirRestConnection(JCS.getInstance("OACache"), company, user, password);
return con;
} catch (CacheException e) {
logger.error(e);
e.printStackTrace();
} catch (ConfigurationException e) {
logger.error(e);
e.printStackTrace();
} catch (IOException e) {
logger.error(e);
e.printStackTrace();
} finally {
 
}
return null;
}
 
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/impl/StringServiceImpl.java
0,0 → 1,156
/*
* 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.HashSet;
import java.util.Iterator;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
 
import javax.jws.WebService;
 
import net.brutex.xservices.types.StringMatchType;
import net.brutex.xservices.types.StringReplaceType;
import net.brutex.xservices.types.StringSplitType;
import net.brutex.xservices.ws.StringService;
import net.brutex.xservices.ws.XServicesFault;
 
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.text.translate.CharSequenceTranslator;
import org.apache.commons.lang3.text.translate.NumericEntityEscaper;
 
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
@WebService(targetNamespace="http://ws.xservices.brutex.net", endpointInterface="net.brutex.xservices.ws.StringService", serviceName="StringService")
public class StringServiceImpl
implements StringService
{
public StringReplaceType replaceRegEx(String res, String search, String replace, String flags)
throws XServicesFault
{
try
{
int allflags = getFlags(flags);
Pattern pattern = Pattern.compile(search, allflags);
Matcher matcher = pattern.matcher(res);
int count = 0;
while (matcher.find()) {
count++;
}
if (flags.contains("g")) {
return new StringReplaceType(matcher.replaceAll(replace), count);
}
if (count > 1)
count = 1;
return new StringReplaceType(matcher.replaceFirst(replace),
count);
}
catch (Exception e) {
throw new XServicesFault(e);
}
}
 
public StringMatchType matchRegEx(String res, String search, String flags)
throws XServicesFault
{
int allflags = getFlags(flags);
Pattern pattern = Pattern.compile(search, allflags);
Matcher matcher = pattern.matcher(res);
StringMatchType rm = new StringMatchType();
for (int i=0; i <= matcher.groupCount(); i++) {
while(matcher.find()) {
rm.addStringMatch(matcher.start(i), matcher.end(i), "group-"+i, matcher.group(i));
}
matcher.reset();
}
return rm;
}
 
public String encodeToXMLEntities(String res)
throws XServicesFault
{
StringEscapeUtils fac = new StringEscapeUtils();
StringEscapeUtils.ESCAPE_XML.with(new CharSequenceTranslator[] { NumericEntityEscaper.between(128, 2147483647) });
return StringEscapeUtils.escapeXml(res);
}
public StringSplitType splitString(String paramString, String delimiter) throws XServicesFault {
StringTokenizer tk = new StringTokenizer(paramString, delimiter);
StringSplitType result = new StringSplitType();
while(tk.hasMoreTokens()) {
result.addStringMatch( tk.nextToken() );
}
return result;
}
@Override
public String removeCRLF(String paramString) throws XServicesFault {
String value = paramString.replaceAll("[\r\n]", "");
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")) {
allflags += 2;
}
if (flags.contains("m")) {
allflags += 8;
}
if (flags.contains("u")) {
allflags += 64;
}
if (flags.contains("s")) {
allflags += 32;
}
if (flags.contains("d")) {
allflags++;
}
if (flags.contains("x")) {
allflags += 4;
}
return allflags;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/impl/XmlServiceImpl.java
0,0 → 1,497
/*
* 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.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.util.Iterator;
import java.util.List;
import javax.jws.WebService;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
 
import net.brutex.xservices.types.AttributeType;
import net.brutex.xservices.types.NamespaceListType;
import net.brutex.xservices.types.NamespaceType;
import net.brutex.xservices.types.StringSplitType;
import net.brutex.xservices.types.ant.FileResource;
import net.brutex.xservices.ws.XServicesFault;
import net.brutex.xservices.ws.XmlService;
 
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMCloneOptions;
import org.apache.axiom.om.OMComment;
import org.apache.axiom.om.OMContainer;
import org.apache.axiom.om.OMDocument;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.OMProcessingInstruction;
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;
 
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
@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 {
try {
AXIOMXPath axp = new AXIOMXPath(xpath);
InputStream is = res.getAntResource(null).getInputStream();
OMDocument sourcedoc = OMXMLBuilderFactory.createOMBuilder(is).getDocument();
OMDocument fragdoc = null;
if ((xmlFragment != null) && (new String(xmlFragment).length() > 0)) {
fragdoc = OMXMLBuilderFactory.createOMBuilder(new StringReader("<XS>" + xmlFragment + "</XS>"))
.getDocument();
} else {
throw new XServicesFault("No xmldata to insert.");
}
 
// Initialize XPath context
SimpleNamespaceContext context = createContext(nsList);
axp.setNamespaceContext(context);
axp.addNamespaces(fragdoc.getOMDocumentElement());
 
OMDocument document = insertNodes(sourcedoc, axp, fragdoc);
 
StringWriter sw = new StringWriter();
XMLOutputFactory xof = XMLOutputFactory.newInstance();
XMLStreamWriter writer = xof.createXMLStreamWriter(sw);
document.serialize(writer);
 
this.logger.trace(sw.getBuffer().toString());
return sw.getBuffer().toString();
} catch (JaxenException e) {
e.printStackTrace();
throw new XServicesFault(e);
} catch (IOException e) {
e.printStackTrace();
throw new XServicesFault(e);
} catch (XMLStreamException e) {
e.printStackTrace();
throw new XServicesFault(e);
}
}
 
public String replaceNodesFromFile(FileResource res, NamespaceListType nsList, String xpath, String xmlFragment)
throws XServicesFault {
try {
AXIOMXPath axp = new AXIOMXPath(xpath);
InputStream is = res.getAntResource(null).getInputStream();
OMDocument sourcedoc = OMXMLBuilderFactory.createOMBuilder(is).getDocument();
OMDocument fragdoc = null;
if ((xmlFragment != null) && (new String(xmlFragment).length() > 0)) {
fragdoc = OMXMLBuilderFactory.createOMBuilder(new StringReader("<XS>" + xmlFragment + "</XS>"))
.getDocument();
} else {
throw new XServicesFault("No xmldata to insert.");
}
 
// Initialize XPath context
SimpleNamespaceContext context = createContext(nsList);
axp.setNamespaceContext(context);
axp.addNamespaces(fragdoc.getOMDocumentElement());
 
OMDocument document = replaceNodes(sourcedoc, axp, fragdoc);
 
StringWriter sw = new StringWriter();
XMLOutputFactory xof = XMLOutputFactory.newInstance();
XMLStreamWriter writer = xof.createXMLStreamWriter(sw);
document.serialize(writer);
 
this.logger.trace(sw.getBuffer().toString());
return sw.getBuffer().toString();
} catch (JaxenException e) {
e.printStackTrace();
throw new XServicesFault(e);
} catch (XMLStreamException e) {
e.printStackTrace();
throw new XServicesFault(e);
} catch (IOException e) {
e.printStackTrace();
throw new XServicesFault(e);
}
}
 
public String replaceNodes(String source, String encoding, NamespaceListType nsList, String xpath,
String xmlFragment) throws XServicesFault {
encoding = validateEncoding(encoding);
try {
AXIOMXPath axp = new AXIOMXPath(xpath);
InputStream is = new ByteArrayInputStream(source.getBytes(encoding));
OMDocument sourcedoc = OMXMLBuilderFactory.createOMBuilder(is).getDocument();
OMDocument fragdoc = null;
if ((xmlFragment != null) && (new String(xmlFragment).length() > 0)) {
fragdoc = OMXMLBuilderFactory.createOMBuilder(new StringReader("<XS>" + xmlFragment + "</XS>"))
.getDocument();
} else {
throw new XServicesFault("No xmldata to insert.");
}
 
// Initialize XPath context
SimpleNamespaceContext context = createContext(nsList);
axp.setNamespaceContext(context);
axp.addNamespaces(fragdoc.getOMDocumentElement());
 
OMDocument document = replaceNodes(sourcedoc, axp, fragdoc);
 
StringWriter sw = new StringWriter();
XMLOutputFactory xof = XMLOutputFactory.newInstance();
XMLStreamWriter writer = xof.createXMLStreamWriter(sw);
document.serialize(writer);
 
this.logger.trace(sw.getBuffer().toString());
return sw.getBuffer().toString();
} catch (JaxenException e) {
e.printStackTrace();
throw new XServicesFault(e);
} catch (XMLStreamException e) {
e.printStackTrace();
throw new XServicesFault(e);
} catch (UnsupportedEncodingException e) {
throw new XServicesFault(e);
}
}
 
@RequiresPermissions("insertNodes")
public String insertNodes(String source, String encoding, NamespaceListType nsList, String xpath,
String xmlFragment) throws XServicesFault {
encoding = validateEncoding(encoding);
try {
AXIOMXPath axp = new AXIOMXPath(xpath);
InputStream is = new ByteArrayInputStream(source.getBytes(encoding));
OMDocument sourcedoc = OMXMLBuilderFactory.createOMBuilder(is).getDocument();
OMDocument fragdoc = null;
if ((xmlFragment != null) && (new String(xmlFragment).length() > 0)) {
fragdoc = OMXMLBuilderFactory.createOMBuilder(new StringReader("<XS>" + xmlFragment + "</XS>"))
.getDocument();
} else {
throw new XServicesFault("No xmldata to insert.");
}
 
// Initialize XPath context
SimpleNamespaceContext context = createContext(nsList);
axp.setNamespaceContext(context);
axp.addNamespaces(fragdoc.getOMDocumentElement());
 
OMDocument document = insertNodes(sourcedoc, axp, fragdoc);
 
StringWriter sw = new StringWriter();
XMLOutputFactory xof = XMLOutputFactory.newInstance();
XMLStreamWriter writer = xof.createXMLStreamWriter(sw);
document.serialize(writer);
 
this.logger.trace(sw.getBuffer().toString());
return sw.getBuffer().toString();
} catch (JaxenException e) {
e.printStackTrace();
throw new XServicesFault(e);
} catch (XMLStreamException e) {
e.printStackTrace();
throw new XServicesFault(e);
} catch (UnsupportedEncodingException e) {
throw new XServicesFault(e);
}
}
 
public String wrapInCDATA(String data) throws XServicesFault {
String result = "";
String[] tokens = data.split("\\]\\]>", -1);
 
for (int i = 0; i < tokens.length; i++) {
result += tokens[i];
if (i + 1 < tokens.length)
result += "]]]]><![CDATA[>";
}
 
result = "<![CDATA[" + result + "]]>";
return result;
}
 
public StringSplitType selectXPath(String source, String encoding, NamespaceListType nsList, String xpath)
throws XServicesFault {
encoding = validateEncoding(encoding);
try {
StringSplitType rarray = new StringSplitType();
AXIOMXPath axp = new AXIOMXPath(xpath);
InputStream is = new ByteArrayInputStream(source.getBytes(encoding));
OMDocument sourcedoc = OMXMLBuilderFactory.createOMBuilder(is).getDocument();
 
// Initialize XPath context
SimpleNamespaceContext context = createContext(nsList);
 
axp.setNamespaceContext(context);
List results = axp.selectNodes(sourcedoc);
for (Object o : results) {
String text = null;
 
if (o instanceof OMNode) {
switch (((OMNode) o).getType()) {
case OMNode.TEXT_NODE:
text = ((OMText) o).getText();
break;
case OMNode.COMMENT_NODE:
text = ((OMComment) o).getValue();
break;
case OMNode.PI_NODE:
text = ((OMProcessingInstruction) o).getValue();
break;
default:
StringWriter sw = new StringWriter();
XMLOutputFactory xof = XMLOutputFactory.newInstance();
XMLStreamWriter writer = xof.createXMLStreamWriter(sw);
((OMNode) o).serialize(writer);
writer.flush();
text = sw.toString();
}
} else if (o instanceof OMAttribute) {
text = ((OMAttribute) o).getAttributeValue();
} else {
text = String.valueOf(o);
}
rarray.addStringMatch(text);
}
 
return rarray;
} catch (JaxenException e) {
e.printStackTrace();
throw new XServicesFault(e);
} catch (XMLStreamException e) {
// TODO Auto-generated catch block
throw new XServicesFault(e.getMessage());
} catch (UnsupportedEncodingException e) {
throw new XServicesFault(e);
}
}
 
public String setAttribute(String source, String encoding, NamespaceListType nsList, String xpath,
AttributeType attr) throws XServicesFault {
encoding = validateEncoding(encoding);
try {
StringSplitType rarray = new StringSplitType();
AXIOMXPath axp = new AXIOMXPath(xpath);
InputStream is = new ByteArrayInputStream(source.getBytes(encoding));
OMDocument sourcedoc = OMXMLBuilderFactory.createOMBuilder(is).getDocument();
OMFactory fac = OMAbstractFactory.getOMFactory();
 
// Initialize XPath context
SimpleNamespaceContext context = createContext(nsList);
 
axp.setNamespaceContext(context);
List results = axp.selectNodes(sourcedoc);
for (Object o : results) {
String text = null;
 
if (o instanceof OMNode) {
switch (((OMNode) o).getType()) {
case OMNode.ELEMENT_NODE:
OMElement node = ((OMElement) o);
if (attr.value == null) {
node.removeAttribute(node.getAttribute(new QName(attr.name)));
} else {
node.addAttribute(attr.name, attr.value, node.getNamespace());
}
break;
default:
throw new XServicesFault("XPath expression did not match an element node.");
}
} else {
throw new XServicesFault("XPath expression did not match a node.");
}
}
 
StringWriter sw = new StringWriter();
XMLOutputFactory xof = XMLOutputFactory.newInstance();
XMLStreamWriter writer = xof.createXMLStreamWriter(sw);
sourcedoc.serialize(writer);
writer.flush();
return sw.toString();
} catch (JaxenException e) {
e.printStackTrace();
throw new XServicesFault(e);
} catch (XMLStreamException e) {
// TODO Auto-generated catch block
throw new XServicesFault(e.getMessage());
} catch (UnsupportedEncodingException e) {
throw new XServicesFault(e);
}
}
 
private OMDocument insertNodes(OMDocument xmldocument, AXIOMXPath axp, OMDocument xmlfragment)
throws XServicesFault {
List<?> olist = null;
try {
olist = axp.selectNodes(xmldocument.getOMDocumentElement());
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);
}
if (olist.size() == 0)
throw new XServicesFault(Messages.getString("XmlService.no_match", new Object[] { axp.toString() }));
 
// Prepare children to insert
xmlfragment.build();
 
// Determine what has been matched
OMContainer match = null;
for (Object o : olist) {
Iterator<?> children = xmlfragment.getOMDocumentElement().getChildren();
if ((o instanceof OMNode)) {
OMNode node = (OMNode) o;
switch (node.getType()) {
case OMNode.ELEMENT_NODE:
if ((o instanceof OMElement))
match = (OMElement) o;
if ((o instanceof OMDocument))
match = ((OMDocument) o).getOMDocumentElement();
this.logger.debug(Messages.getString("XmlService.8"));
break;
case OMNode.TEXT_NODE:
match = ((OMText) o).getParent();
this.logger.debug(Messages.getString("XmlService.9"));
break;
case OMNode.COMMENT_NODE:
// match = node.getParent();
match = (OMContainer) node;
this.logger.debug(Messages.getString("XmlService.10"));
break;
default:
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 {
this.logger.error("XPath matched " + o.getClass().getCanonicalName());
this.logger.error(Messages.getString("XmlService.11"));
throw new XServicesFault(Messages.getString("XmlService.12"));
}
 
while (children.hasNext()) {
OMNode container = (OMNode) children.next();
match.addChild((OMNode) container.clone(new OMCloneOptions()));
}
}
 
xmldocument.build();
return xmldocument;
}
 
private OMDocument replaceNodes(OMDocument xmldocument, AXIOMXPath axp, OMDocument xmlfragment)
throws XServicesFault {
 
List<?> olist = null;
try {
olist = axp.selectNodes(xmldocument.getOMDocumentElement());
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);
}
if (olist.size() == 0)
throw new XServicesFault(Messages.getString("XmlService.no_match", new Object[] { axp.toString() }));
 
// Prepare children to insert
xmlfragment.build();
 
// Determine what has been matched
OMNode match = null;
for (Object o : olist) {
Iterator<?> children = xmlfragment.getOMDocumentElement().getChildren();
if ((o instanceof OMNode)) {
OMNode node = (OMNode) o;
switch (node.getType()) {
case OMNode.ELEMENT_NODE:
if ((o instanceof OMElement))
match = (OMElement) o;
if ((o instanceof OMDocument))
match = ((OMDocument) o).getOMDocumentElement();
this.logger.debug(Messages.getString("XmlService.8"));
break;
default:
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 {
this.logger.error("XPath matched " + o.getClass().getCanonicalName());
this.logger.error(Messages.getString("XmlService.11"));
throw new XServicesFault(Messages.getString("XmlService.12"));
}
 
while (children.hasNext()) {
OMNode container = (OMNode) children.next();
match.insertSiblingBefore((OMNode) container.clone(new OMCloneOptions()));
}
match.detach();
}
xmldocument.build();
return xmldocument;
}
 
private SimpleNamespaceContext createContext(NamespaceListType nsList) {
// Initialize XPath context
SimpleNamespaceContext context = new SimpleNamespaceContext();
if (nsList != null) {
for (NamespaceType ns : nsList.getNamespaces()) {
context.addNamespace(ns.getPrefix(), ns.getUri().toString());
this.logger.debug(
Messages.getString("XmlService.0") + ns.getPrefix() + "=\"" + ns.getUri().toString() + "\"'");
}
} else {
logger.debug("No namespaces defined.");
}
return context;
}
 
private String validateEncoding(String encoding) throws XServicesFault {
if (encoding == null || encoding.equals("")) {
encoding = Charset.defaultCharset().displayName();
}
try {
Charset.isSupported(encoding);
} catch (IllegalCharsetNameException e) {
throw new XServicesFault("Endcoding '" + encoding + "' is not supported by this JRE.");
}
logger.debug("Setting source xml string encoding to '" + encoding + "'");
return encoding;
}
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/impl/MailServiceImpl.java
0,0 → 1,94
/*
* Copyright 2012 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 javax.jws.WebService;
 
import net.brutex.xservices.types.HostConnection;
import net.brutex.xservices.types.MailMimeType;
import net.brutex.xservices.types.ReturnCode;
import net.brutex.xservices.types.ant.FileSetResource;
import net.brutex.xservices.util.BrutexNamespaces;
import net.brutex.xservices.util.RunTask;
import net.brutex.xservices.ws.MailService;
 
import org.apache.tools.ant.taskdefs.email.EmailTask;
 
/**
* Implements MailService
*
* @author Brian Rosenberger, bru@brutex.de
*/
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES,
endpointInterface = "net.brutex.xservices.ws.MailService",
serviceName = "MailService")
public class MailServiceImpl implements MailService {
 
 
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);
}
 
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();
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/impl/ExecuteServiceImpl.java
0,0 → 1,341
/*
* Copyright 2010 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.io.File;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import net.brutex.xservices.types.HostConnection;
import net.brutex.xservices.types.ReturnCode;
import net.brutex.xservices.util.BrutexNamespaces;
import net.brutex.xservices.util.RunTask;
import net.brutex.xservices.ws.ExecuteService;
import net.brutex.xservices.ws.XServicesFault;
 
import org.apache.tools.ant.taskdefs.ExecTask;
import org.apache.tools.ant.taskdefs.optional.net.RExecTask;
import org.apache.tools.ant.taskdefs.optional.net.TelnetTask;
import org.apache.tools.ant.taskdefs.optional.ssh.SSHExec;
import org.apache.tools.ant.types.Commandline;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.Scriptable;
 
/**
*
* @author Brian Rosenberger, bru@brutex.de
*/
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES, endpointInterface = "net.brutex.xservices.ws.ExecuteService", serviceName = "ExecuteService")
public class ExecuteServiceImpl implements ExecuteService {
 
/*
* (non-Javadoc)
*
* @see
* net.brutex.xservices.ws.impl.ExecuteService#runCommand(java.lang.String,
* java.lang.String, long)
*/
@WebMethod(operationName = "runCommand")
public ReturnCode runCommand(@WebParam(name = "executable") String cmd,
@WebParam(name = "argline") String args,
@WebParam(name = "timeout") long timeout) {
 
return executeCommand(cmd, Commandline.translateCommandline(args),
null, false, null, false, true, false, timeout);
}
 
/*
* (non-Javadoc)
*
* @see
* net.brutex.xservices.ws.impl.ExecuteService#runCommandWithArgs(java.lang
* .String, java.lang.String[], long)
*/
@WebMethod(operationName = "runCommandWithArgs")
public ReturnCode runCommandWithArgs(
@WebParam(name = "executable") String cmd,
@WebParam(name = "arg") String[] args,
@WebParam(name = "timeout") long timeout) {
 
return executeCommand(cmd, args, null, false, null, false, true, false,
timeout);
}
 
/*
* (non-Javadoc)
*
* @see
* net.brutex.xservices.ws.impl.ExecuteService#runCommandAsync(java.lang
* .String, java.lang.String)
*/
@WebMethod(operationName = "runCommandAsync")
public ReturnCode runCommandAsync(
@WebParam(name = "executable") String cmd,
@WebParam(name = "argline") String args) {
 
return executeCommand(cmd, Commandline.translateCommandline(args),
null, true, null, false, true, false, 0);
}
 
/*
* (non-Javadoc)
*
* @see
* net.brutex.xservices.ws.impl.ExecuteService#runCommandAsyncWithArgs(java
* .lang.String, java.lang.String[])
*/
@WebMethod(operationName = "runCommandAsyncWithArgs")
public ReturnCode runCommandAsyncWithArgs(
@WebParam(name = "executable") String cmd,
@WebParam(name = "arg") String[] args) {
 
return executeCommand(cmd, args, null, true, null, false, true, false,
0);
}
 
/*
* (non-Javadoc)
*
* @see
* net.brutex.xservices.ws.impl.ExecuteService#runCommandWithSSH(java.lang
* .String, int, java.lang.String, java.lang.String, java.lang.String, long)
*/
@WebMethod(operationName = "runCommandWithSSH")
public ReturnCode runCommandWithSSH(
@WebParam(name = "host") HostConnection host,
@WebParam(name = "command") String cmd,
@WebParam(name = "timeout") long timeout) {
 
return sshExec(host.hostname, host.user, host.password, host.port, cmd,
timeout);
}
 
/*
* (non-Javadoc)
*
* @see
* net.brutex.xservices.ws.impl.ExecuteService#runCommandWithSSHKeyAuth(
* java.lang.String, int, java.lang.String, java.lang.String,
* java.lang.String, java.lang.String, long)
*/
@WebMethod(operationName = "runCommandWithSSHKeyAuth")
public ReturnCode runCommandWithSSHKeyAuth(
@WebParam(name = "host") HostConnection host,
@WebParam(name = "keyfile") String keyfile,
@WebParam(name = "command") String cmd,
@WebParam(name = "timeout") long timeout) {
 
return sshExecWithCert(host.hostname, host.user, host.password,
keyfile, host.port, cmd, timeout);
}
 
/*
* (non-Javadoc)
*
* @see
* net.brutex.xservices.ws.impl.ExecuteService#rExec(net.brutex.xservices
* .types.HostConnection, java.lang.String, long)
*/
@WebMethod(operationName = "rExec")
public ReturnCode rExec(@WebParam(name = "host") HostConnection host,
@WebParam(name = "command") String cmd,
@WebParam(name = "timeout") long timeout) {
return rexec(host.hostname, host.port, host.user, host.password, cmd,
timeout);
}
 
/*
* (non-Javadoc)
*
* @see
* net.brutex.xservices.ws.impl.ExecuteService#runTelnet(net.brutex.xservices
* .types.HostConnection, java.lang.String, java.lang.String,
* java.lang.String, long)
*/
@WebMethod(operationName = "telnet")
public ReturnCode runTelnet(@WebParam(name = "host") HostConnection host,
@WebParam(name = "prompt") String prompt,
@WebParam(name = "command") String cmd,
@WebParam(name = "expect") String expect,
@WebParam(name = "timeout") long timeout) {
return telnet(host.hostname, host.port, host.user, host.password, cmd,
timeout, prompt, expect);
}
 
public void runJScript(String script) throws XServicesFault {
 
try {
// Create and enter a Context. A Context stores information about
// the execution environment of a script.
Context cx = Context.enter();
cx.setOptimizationLevel(0);
cx.setLanguageVersion(Context.VERSION_1_7);
// cx is the Context instance you're using to run scripts
/*
* cx.setClassShutter(new ClassShutter() { public boolean
* visibleToScripts(String className) {
* if(className.startsWith("adapter")) return true;
* if(className.startsWith("java.lang.System") ||
* className.startsWith
* ("org.apache.tomcat.util.log.SystemLogHandler")) return true;
* System.out.println(className + " is blocked."); return false; }
* });
*/
 
// Initialise the standard objects (Object, Function, etc.). This
// must be done before scripts can be
// executed. The null parameter tells initStandardObjects
// to create and return a scope object that we use
// in later calls.
Scriptable scope = cx.initStandardObjects();
// Object wrappedOut = Context.javaToJS(System.out, scope);
// Object wrappedOut2 = Context.javaToJS(this, scope);
// scope.put("out", scope, wrappedOut);
// scope.put("exe", scope, wrappedOut2);
 
// Execute the script
// cx.evaluateString(scope, "importClass('java.lang.System');\n",
// "head", 1, null);
// cx.evaluateString(scope, "importPackage('java.util');\n", "head",
// 2, null);
Object obj = cx
.evaluateString(scope, script, "TestScript", 1, null);
 
} catch (Exception e) {
System.out.println(e.getMessage());
} finally {
// Exit the Context. This removes the association between the
// Context and the current thread and is an
// essential cleanup action. There should be a call to exit for
// every call to enter.
Context.exit();
}
 
}
 
@WebMethod(exclude = true)
private ReturnCode executeCommand(String executable, String[] args,
File dir, boolean spawn, String inputstring,
boolean newenvironment, boolean vmlauncher, boolean searchpath,
long timeout) {
ExecTask exe = new ExecTask();
RunTask runner = new RunTask(exe);
 
/*
* Commandline cmdl = new Commandline(); cmdl.setExecutable(executable);
* cmdl.addArguments(args); System.out.println(cmdl.describeCommand());
*/
 
exe.setExecutable(executable);
for (String s : args) {
exe.createArg().setValue(s);
}
 
exe.setDir(dir);
if (spawn) {
exe.setSpawn(spawn);
} else {
exe.setTimeout(timeout);
exe.setInputString(inputstring);
exe.setOutputproperty("ExecuteService.stdout");
exe.setErrorProperty("ExecuteService.stderr");
exe.setResultProperty("ExecuteService.result");
}
 
exe.setNewenvironment(newenvironment);
exe.setVMLauncher(vmlauncher);
exe.setSearchPath(searchpath);
 
return runner.postTask();
}
 
@WebMethod(exclude = true)
private ReturnCode sshExec(String host, String username, String password,
int port, String command, long timeout) {
SSHExec sshexec = new SSHExec();
RunTask runner = new RunTask(sshexec);
sshexec.setHost(host);
sshexec.setUsername(username);
sshexec.setPassword(password);
sshexec.setPort(port);
sshexec.setCommand(command);
sshexec.setTrust(true);
sshexec.setTimeout(timeout);
sshexec.setOutputproperty("SSHExec.stdout");
return runner.postTask();
}
 
@WebMethod(exclude = true)
private ReturnCode sshExecWithCert(String host, String username,
String passphrase, String keyfile, int port, String command,
long timeout) {
SSHExec sshexec = new SSHExec();
RunTask runner = new RunTask(sshexec);
sshexec.setHost(host);
sshexec.setUsername(username);
sshexec.setKeyfile(keyfile);
sshexec.setPassphrase(passphrase);
sshexec.setPort(port);
sshexec.setCommand(command);
sshexec.setTrust(true);
sshexec.setTimeout(timeout);
sshexec.setOutputproperty("SSHExec.stdout");
return runner.postTask();
}
 
@WebMethod(exclude = true)
private ReturnCode rexec(String host, int port, String username,
String password, String command, long timeout) {
RExecTask rexec = new RExecTask();
RunTask runner = new RunTask(rexec);
rexec.setServer(host);
rexec.setPort(port);
rexec.setUserid(username);
rexec.setPassword(password);
rexec.setCommand(command);
rexec.setTimeout((int) Math.round(timeout));
 
return runner.postTask();
}
 
@WebMethod(exclude = true)
private ReturnCode telnet(String host, int port, String username,
String password, String command, long timeout, String prompt,
String expect) {
TelnetTask rexec = new TelnetTask();
RunTask runner = new RunTask(rexec);
rexec.setServer(host);
rexec.setPort(port);
rexec.setUserid(username);
rexec.setPassword(password);
rexec.setTimeout((int) Math.round(timeout));
 
rexec.createRead().addText(prompt);
rexec.createWrite().addText(command);
rexec.createRead().addText(expect);
 
return runner.postTask();
}
}
/xservices/trunk/src/main/java/net/brutex/xservices/ws/impl/DateServiceImpl.java
0,0 → 1,202
/*
* Copyright 2011 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.math.BigInteger;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.TimeZone;
 
import javax.jws.WebService;
import net.brutex.xservices.types.DateFormatType;
import net.brutex.xservices.types.DateInfoExtendedType;
import net.brutex.xservices.types.DateInfoType;
import net.brutex.xservices.types.DateTimeUnits;
import net.brutex.xservices.types.TimeZoneType;
import net.brutex.xservices.util.BrutexNamespaces;
import net.brutex.xservices.ws.DateService;
import net.brutex.xservices.ws.XServicesFault;
 
/**
* @author Brian Rosenberger
*
*/
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES, endpointInterface = "net.brutex.xservices.ws.DateService", serviceName = DateService.SERVICE_NAME)
public class DateServiceImpl implements DateService {
 
private static String ERR_INVALIDFORMAT = "Invalid format pattern.";
private static String ERR_INVALIDTIMEZONE = "Invalid timezone.";
 
public DateInfoType getDate() throws XServicesFault {
GregorianCalendar c = new GregorianCalendar();
DateInfoType dateinfo = new DateInfoType(c, TimeZone.getDefault());
return dateinfo;
}
 
public DateInfoExtendedType getDateExtended() throws XServicesFault {
GregorianCalendar c = new GregorianCalendar();
DateInfoExtendedType dateinfo = new DateInfoExtendedType(c,
TimeZone.getDefault());
return dateinfo;
}
 
public BigInteger getTimestamp() {
Date d = new Date();
long l = d.getTime();
return new BigInteger(Long.toString(l));
}
 
public BigInteger getTimestamp2() {
Date d = new Date();
long l = d.getTime() / 1000;
return new BigInteger(Long.toString(l));
}
 
public String getInTimezone(Date date, String timezone)
throws XServicesFault {
if (!isValidTimezone(timezone))
throw new XServicesFault(ERR_INVALIDTIMEZONE);
TimeZone targetzone = TimeZone.getTimeZone(timezone);
String targetstring = DateFormatType.ISO8601.format(date, null, targetzone);
return targetstring;
}
 
public String formatDate(Date cal, DateFormatType format)
throws XServicesFault {
return format.format(cal, null, null);
}
 
public String formatDateAdvanced(Date cal, String format)
throws XServicesFault {
String result = null;
SimpleDateFormat f = new SimpleDateFormat(format);
result = f.format(cal);
return result;
}
 
public Date parseDate(String s, DateFormatType format, String timezone)
throws XServicesFault {
if (timezone == null | timezone.equals(""))
timezone = TimeZone.getDefault().getID();
if (!isValidTimezone(timezone))
throw new XServicesFault(ERR_INVALIDTIMEZONE);
try {
return format.parse(s, null, TimeZone.getTimeZone(timezone));
} catch (ParseException e) {
throw new XServicesFault(e);
}
}
 
public GregorianCalendar parseDateAdvanced(String s, String format,
String timezone) throws XServicesFault {
SimpleDateFormat f = null;
Date date = null;
if (timezone == null | timezone.equals(""))
timezone = TimeZone.getDefault().getID();
if (!isValidTimezone(timezone))
throw new XServicesFault(ERR_INVALIDTIMEZONE);
 
try {
f = new SimpleDateFormat(format);
date = f.parse(s);
} catch (IllegalArgumentException e) {
throw new XServicesFault(ERR_INVALIDFORMAT + e.getMessage());
} catch (ParseException e) {
throw new XServicesFault("Cannot parse date: " + e.getMessage());
}
GregorianCalendar cal = new GregorianCalendar();
cal.setTimeZone(TimeZone.getTimeZone(timezone));
cal.setTime(date);
return cal;
}
 
public BigInteger dateTimeDiff(Date fromCal, Date toCal)
throws XServicesFault {
long diff = toCal.getTime() - fromCal.getTime();
BigInteger d = new BigInteger(String.valueOf(diff), 10);
return d;
}
 
public BigInteger dateTimeDiff2(Date fromCal, Date toCal, DateTimeUnits unit)
throws XServicesFault {
BigInteger d = dateTimeDiff(fromCal, toCal);
switch (unit) {
case SECONDS:
d = d.divide(new BigInteger("1000"));
break;
case MINUTES:
d = d.divide(new BigInteger("60000"));
break;
case HOURS:
d = d.divide(new BigInteger("3600000"));
break;
case DAYS:
d = d.divide(new BigInteger("86400000"));
break;
case YEARS:
d = d.divide(new BigInteger("31536000000"));
break;
}
return d;
}
 
public GregorianCalendar dateAdd(GregorianCalendar cal, BigInteger value,
DateTimeUnits unit) throws XServicesFault {
switch (unit) {
case SECONDS:
cal.add(GregorianCalendar.SECOND, value.intValue());
break;
case MINUTES:
cal.add(GregorianCalendar.MINUTE, value.intValue());
break;
case HOURS:
cal.add(GregorianCalendar.HOUR_OF_DAY, value.intValue());
break;
case DAYS:
cal.add(GregorianCalendar.DAY_OF_MONTH, value.intValue());
break;
case YEARS:
cal.add(GregorianCalendar.YEAR, value.intValue());
break;
default:
cal.add(GregorianCalendar.MILLISECOND, value.intValue());
}
return cal;
}
 
private boolean isValidTimezone(String id) {
boolean yes = false;
for (String s : TimeZone.getAvailableIDs()) {
if (s.equals(id)) {
yes = true;
break;
}
}
return yes;
}
 
public List<TimeZoneType> getTimezones() {
List<TimeZoneType> output = new ArrayList<TimeZoneType>();
for (String s : TimeZone.getAvailableIDs()) {
output.add(new TimeZoneType(TimeZone.getTimeZone(s)));
}
return output;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/impl/FileServiceImpl.java
0,0 → 1,371
/*
* Copyright 2010 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.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
 
import javax.activation.DataHandler;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
 
import net.brutex.xservices.types.ReplacePattern;
import net.brutex.xservices.types.ReturnCode;
import net.brutex.xservices.types.ant.ArchiveResource;
import net.brutex.xservices.types.ant.AttachmentType;
import net.brutex.xservices.types.ant.FileResource;
import net.brutex.xservices.types.ant.FileSetResource;
import net.brutex.xservices.util.BrutexNamespaces;
import net.brutex.xservices.util.RunTask;
import net.brutex.xservices.ws.FileService;
import net.brutex.xservices.ws.XServicesFault;
 
import org.apache.cxf.aegis.type.mtom.StreamDataSource;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.Basename;
import org.apache.tools.ant.taskdefs.Chmod;
import org.apache.tools.ant.taskdefs.Copy;
import org.apache.tools.ant.taskdefs.Echo;
import org.apache.tools.ant.taskdefs.LoadResource;
import org.apache.tools.ant.taskdefs.Replace;
import org.apache.tools.ant.taskdefs.optional.ReplaceRegExp;
import org.apache.tools.ant.taskdefs.optional.unix.Chgrp;
import org.apache.tools.ant.taskdefs.optional.unix.Chown;
import org.apache.tools.ant.types.FileSet;
 
/**
*
* @author Brian Rosenberger, bru@brutex.de
*/
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES, endpointInterface = "net.brutex.xservices.ws.FileService", serviceName = "FileService")
public class FileServiceImpl implements FileService {
 
/*
* (non-Javadoc)
*
* @see net.brutex.xservices.ws.impl.FileService#basename(java.lang.String,
* java.lang.String)
*/
public String basename(String filename, String suffix) {
final String BASENAME_VALUE = "basename.value";
Basename basename = new Basename();
RunTask runner = new RunTask(basename);
basename.setFile(new File(filename));
if (suffix != null && !suffix.equals("")) {
basename.setSuffix(suffix);
}
basename.setProperty(BASENAME_VALUE);
ReturnCode r = runner.postTask();
return r.getProperty(BASENAME_VALUE);
}
 
public ReturnCode replaceInFile(FileResource res, String search,
String replace) throws XServicesFault {
ReturnCode r = null;
Replace rep = new Replace();
rep.setTaskName("Replace");
RunTask runner = new RunTask(rep);
rep.addConfigured(res.getAntResource(rep.getProject()));
rep.setToken(search);
rep.setValue(replace);
try {
r = runner.postTask();
} catch (BuildException e) {
throw new XServicesFault(e);
}
return r;
}
 
public ReturnCode replaceInFile2(FileResource res,
List<ReplacePattern> patternList) throws XServicesFault {
ReturnCode r = null;
for (ReplacePattern pat : patternList) {
Replace rep = new Replace();
rep.setTaskName("Replace");
RunTask runner = new RunTask(rep);
rep.addConfigured(res.getAntResource(rep.getProject()));
rep.setToken(pat.search);
rep.setValue(pat.replace);
try {
r = runner.postTask();
} catch (BuildException e) {
throw new XServicesFault(e);
}
}
return r;
}
 
public ReturnCode replaceInFileRegEx(FileResource res, String search,
String replace, String flags) throws XServicesFault {
ReplaceRegExp rep = new ReplaceRegExp();
rep.setTaskName("ReplaceRegExp");
RunTask runner = new RunTask(rep);
File infile = new File(res.uri);
rep.setFile(infile);
rep.setMatch(search);
rep.setReplace(replace);
rep.setFlags(flags);
try {
ReturnCode r = runner.postTask();
return r;
} catch (BuildException e) {
throw new XServicesFault(e);
}
}
 
/*
* (non-Javadoc)
*
* @see
* net.brutex.xservices.ws.impl.FileService#base64Encode(net.brutex.xservices
* .types.FileSetResource)
*/
public AttachmentType downloadFile(FileResource res) throws XServicesFault {
InputStream is = null;
try {
is = res.getAntResource(null).getInputStream();
StreamDataSource ssource = new StreamDataSource(
"application/binary", is);
DataHandler h = new DataHandler(ssource);
AttachmentType t = new AttachmentType();
t.setContent(h);
t.setFilename(res.getAntResource(null).getName());
return t;
} catch (IOException e) {
throw new XServicesFault(e);
}
}
 
/*
* (non-Javadoc)
*
* @see
* net.brutex.xservices.ws.impl.FileService#base64Decode(net.brutex.xservices
* .types.AttachmentType)
*/
public String uploadFile(AttachmentType file) throws XServicesFault {
DataHandler h = file.getContent();
File f = new File(file.getFilename());
FileOutputStream fout;
try {
fout = new FileOutputStream(f);
h.writeTo(fout);
fout.flush();
fout.close();
} catch (FileNotFoundException e) {
throw new XServicesFault(e);
} catch (IOException e) {
throw new XServicesFault(e);
}
return file.getFilename();
}
 
/*
* (non-Javadoc)
*
* @see
* net.brutex.xservices.ws.impl.FileService#copy(net.brutex.xservices.types
* .FileSetResource, java.lang.String, boolean, boolean, java.lang.String)
*/
public ReturnCode copy(FileSetResource src, String todir, boolean plm,
boolean overwrite, String encoding) throws XServicesFault {
Copy copy = new Copy();
copy.setTaskName("Copy");
RunTask runner = new RunTask(copy);
FileSet set = src.getAntResource(copy.getProject());
copy.add(set);
File dst = new File(todir);
if (dst.isDirectory()) {
copy.setTodir(dst);
}
if (dst.isFile()) {
copy.setTofile(dst);
}
copy.setOverwrite(overwrite);
copy.setPreserveLastModified(plm);
if (encoding != null && !encoding.equals("")) {
copy.setOutputEncoding(encoding);
} else {
copy.setOutputEncoding(System.getProperty("file.encoding"));
}
return runner.postTask();
}
 
public ReturnCode copyFile(String fromFile, String tofile, boolean overwrite)
throws XServicesFault {
Copy copy = new Copy();
copy.setTaskName("Copy");
RunTask runner = new RunTask(copy);
File f = new File(fromFile);
if (!f.isFile())
throw new XServicesFault("File '" + fromFile + "' not found.");
copy.setFile(new File(fromFile));
copy.setTofile(new File(tofile));
copy.setOverwrite(overwrite);
return runner.postTask();
}
 
/*
* (non-Javadoc)
*
* @see
* net.brutex.xservices.ws.impl.FileService#loadRes(net.brutex.xservices
* .types.FileResource, java.lang.String)
*/
public String loadRes(FileResource res, String encoding)
throws XServicesFault {
if (encoding == null || encoding.equals("")) {
encoding = System.getProperty("file.encoding");
}
LoadResource lr = new LoadResource();
lr.setTaskName("LoadResource");
RunTask runner = new RunTask(lr);
lr.addConfigured(res.getAntResource(lr.getProject()));
lr.setEncoding(encoding);
System.out.println("Using encoding: " + encoding);
lr.setProperty("LoadResource.out");
ReturnCode r = runner.postTask();
return r.getProperty("LoadResource.out");
}
 
/*
* (non-Javadoc)
*
* @see
* net.brutex.xservices.ws.impl.FileService#loadResFromArchive(net.brutex
* .xservices.types.ArchiveResource, java.lang.String)
*/
public String loadResFromArchive(ArchiveResource res, String encoding) {
if (encoding == null || encoding.equals("")) {
encoding = System.getProperty("file.encoding");
}
LoadResource lr = new LoadResource();
lr.setTaskName("LoadResource");
RunTask runner = new RunTask(lr);
lr.addConfigured(res.getAntResource(lr.getProject()));
lr.setEncoding(encoding);
System.out.println("Using encoding: " + encoding);
lr.setProperty("LoadResource.out");
ReturnCode r = runner.postTask();
return r.getProperty("LoadResource.out");
 
}
 
/*
* (non-Javadoc)
*
* @see net.brutex.xservices.ws.impl.FileService#echo2file(java.lang.String,
* java.lang.String, java.lang.String, boolean)
*/
public ReturnCode echo2file(String message, String file, String encoding,
boolean append, boolean create) throws XServicesFault {
 
Echo echo = new Echo();
echo.setTaskName("toFile");
RunTask runTask = new RunTask(echo);
echo.addText(message);
echo.setEncoding(encoding);
File f = new File(file);
 
try {
if(!f.exists() && create) f.createNewFile();
if (!f.canWrite())
throw new XServicesFault("Cannot write to file: "
+ f.getCanonicalPath());
 
echo.setFile(f);
echo.setAppend(append);
ReturnCode c = runTask.postTask();
return c;
} catch (BuildException e) {
throw new XServicesFault("Error in echo2file.", e);
} catch (IOException e) {
throw new XServicesFault("Cannot write to file." + e.getMessage(), e);
}
}
 
/*
* (non-Javadoc)
*
* @see
* net.brutex.xservices.ws.impl.FileService#changeOwner(net.brutex.xservices
* .types.FileSetResource, java.lang.String)
*/
public ReturnCode changeOwner(FileSetResource res, String owner) {
Chown chown = new Chown();
chown.setTaskName("Chown");
RunTask runner = new RunTask(chown);
chown.setOwner(owner);
FileSet set = res.getAntResource(chown.getProject());
chown.add(set);
chown.setMaxParallel(300);
return runner.postTask();
}
 
/*
* (non-Javadoc)
*
* @see
* net.brutex.xservices.ws.impl.FileService#changeGroup(net.brutex.xservices
* .types.FileSetResource, java.lang.String)
*/
public ReturnCode changeGroup(FileSetResource res, String group) {
Chgrp chgrp = new Chgrp();
chgrp.setTaskName("Chgrp");
RunTask runner = new RunTask(chgrp);
chgrp.setGroup(group);
FileSet set = res.getAntResource(chgrp.getProject());
chgrp.add(set);
chgrp.setMaxParallel(300);
return runner.postTask();
}
 
/*
* (non-Javadoc)
*
* @see
* net.brutex.xservices.ws.impl.FileService#changeMode(net.brutex.xservices
* .types.FileSetResource, java.lang.String)
*/
public ReturnCode changeMode(FileSetResource res, String perm) {
Chmod chmod = new Chmod();
chmod.setTaskName("Chmod");
RunTask runner = new RunTask(chmod);
FileSet set = res.getAntResource(chmod.getProject());
chmod.add(set);
chmod.setMaxParallel(300);
chmod.setPerm(perm);
chmod.setVerbose(true);
return runner.postTask();
}
 
}
/xservices/trunk/src/main/java/net/brutex/xservices/ws/impl/messages.properties
0,0 → 1,11
XmlService.0=Adding name space to XPath context: 'xmlns:
XmlService.10=XPath did match a comment node
XmlService.11=XPath did match a not supported node
XmlService.12=XPath did match a not supported node
XmlService.13=XPath did not match a node.
XmlService.14=XPath did not match a node.
XmlService.adding_namespace=Adding name space to XPath context: 'xmlns:{0}="{1}"
XmlService.8=XPath did match an element node
XmlService.9=XPath did match a text node
XmlService.no_match=XPath "{0}" did not match anything.
XmlService.null_or_empty=Nothing to append!
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/impl/ArchiveServiceImpl.java
0,0 → 1,324
/*
* Copyright 2010 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.io.File;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import net.brutex.xservices.types.CompressionType;
import net.brutex.xservices.types.ReturnCode;
import net.brutex.xservices.types.ant.ArchiveResource;
import net.brutex.xservices.types.ant.FileResource;
import net.brutex.xservices.types.ant.ResourceInterface;
import net.brutex.xservices.util.BrutexNamespaces;
import net.brutex.xservices.util.RunTask;
import net.brutex.xservices.util.UnRarTask;
import net.brutex.xservices.ws.ArchiveService;
 
import org.apache.tools.ant.taskdefs.BUnzip2;
import org.apache.tools.ant.taskdefs.BZip2;
import org.apache.tools.ant.taskdefs.Expand;
import org.apache.tools.ant.taskdefs.GUnzip;
import org.apache.tools.ant.taskdefs.GZip;
import org.apache.tools.ant.taskdefs.Untar;
import org.apache.tools.ant.taskdefs.Zip;
 
/**
*
* @author Brian Rosenberger, bru@brutex.de
*/
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES,
endpointInterface="net.brutex.xservices.ws.ArchiveService",
serviceName = "ArchiveService")
public class ArchiveServiceImpl implements ArchiveService {
 
 
/* (non-Javadoc)
* @see net.brutex.xservices.ws.ArchiveService#bzip2(net.brutex.xservices.types.FileResource, java.lang.String)
*/
@WebMethod(operationName = WS_OPERATION_BZIP2, action = WS_OPERATION_BZIP2)
public ReturnCode bzip2(@WebParam(name = WS_PARAM_SOURCEFILE) FileResource src,
@WebParam(name = WS_PARAM_DESTFILE) String file) {
return bzip(src, new File(file));
}
 
/* (non-Javadoc)
* @see net.brutex.xservices.ws.ArchiveService#bzip2FromArchive(net.brutex.xservices.types.ArchiveResource, java.lang.String)
*/
@WebMethod(operationName = WS_OPERATION_BZIP2_ARCHIVE, action = WS_OPERATION_BZIP2_ARCHIVE)
public ReturnCode bzip2FromArchive(@WebParam(name = WS_PARAM_SOURCEARCHIVE) ArchiveResource src,
@WebParam(name = WS_PARAM_DESTFILE) String file) {
return null;// return bzip(src, new File(file));
}
 
/* (non-Javadoc)
* @see net.brutex.xservices.ws.ArchiveService#gzip(net.brutex.xservices.types.FileResource, java.lang.String)
*/
@WebMethod(operationName = WS_OPERATION_GZIP, action = WS_OPERATION_GZIP)
public ReturnCode gzip(@WebParam(name = WS_PARAM_SOURCEFILE) FileResource src,
@WebParam(name = WS_PARAM_DESTFILE) String file) {
return gzip(src, new File(file));
}
 
/* (non-Javadoc)
* @see net.brutex.xservices.ws.ArchiveService#gzipFromArchive(net.brutex.xservices.types.ArchiveResource, java.lang.String)
*/
@WebMethod(operationName = WS_OPERATION_GZIP_ARCHIVE, action = WS_OPERATION_GZIP_ARCHIVE)
public ReturnCode gzipFromArchive(@WebParam(name = WS_PARAM_SOURCEARCHIVE) ArchiveResource src,
@WebParam(name = WS_PARAM_DESTFILE) String file) {
return gzip(src, new File(file));
}
 
/* (non-Javadoc)
* @see net.brutex.xservices.ws.ArchiveService#gunzip(java.lang.String, java.lang.String)
*/
@WebMethod(operationName = WS_OPERATION_GUNZIP, action = WS_OPERATION_GUNZIP)
public ReturnCode gunzip(@WebParam(name = WS_PARAM_SOURCEFILE_STRING) String src,
@WebParam(name = WS_PARAM_DESTDIR) String dest) {
File target = null;
if (!dest.equals("") && dest != null) {
target = new File(dest);
}
return GUnzip(new FileResource(FileResource.Type.FILE, src), target);
}
 
/* (non-Javadoc)
* @see net.brutex.xservices.ws.ArchiveService#bunzip2(java.lang.String, java.lang.String)
*/
@WebMethod(operationName = WS_OPERATION_BUNZIP2)
public ReturnCode bunzip2(@WebParam(name = WS_PARAM_SOURCEFILE_STRING) String src,
@WebParam(name = WS_PARAM_DESTDIR) String dest) {
File target = null;
if (!dest.equals("") && dest != null) {
target = new File(dest);
}
return BUnzip2(new FileResource(FileResource.Type.FILE, src), target);
}
 
/* (non-Javadoc)
* @see net.brutex.xservices.ws.ArchiveService#gunzipFromURL(java.lang.String, java.lang.String)
*/
@WebMethod(operationName = "gunzipFromURL")
public ReturnCode gunzipFromURL(@WebParam(name = WS_PARAM_SOURCEURL) String src,
@WebParam(name = WS_PARAM_DESTDIR) String dest) {
File target = null;
if (!dest.equals("") && dest != null) {
target = new File(dest);
}
return GUnzip(new FileResource(FileResource.Type.URL, src), target);
}
 
/* (non-Javadoc)
* @see net.brutex.xservices.ws.ArchiveService#bunzip2FromURL(java.lang.String, java.lang.String)
*/
@WebMethod(operationName = "bunzip2FromURL")
public ReturnCode bunzip2FromURL(@WebParam(name = WS_PARAM_SOURCEURL) String src,
@WebParam(name = WS_PARAM_DESTDIR) String dest) {
File target = null;
if (!dest.equals("") && dest != null) {
target = new File(dest);
}
return BUnzip2(new FileResource(FileResource.Type.URL, src), target);
}
 
/* (non-Javadoc)
* @see net.brutex.xservices.ws.ArchiveService#zip(net.brutex.xservices.types.FileResource, java.lang.String, boolean, java.lang.String, int)
*/
@WebMethod(operationName = "zip")
public ReturnCode zip(@WebParam(name = WS_PARAM_SOURCEFILE) FileResource src,
@WebParam(name = WS_PARAM_DESTFILE) String file,
@WebParam(name = WS_PARAM_OVERWRITE) boolean overwrite,
@WebParam(name = WS_PARAM_ENCODING) String encoding,
@WebParam(name = "compresslevel") int level) {
if (level > 9) {
level = 9;
}
if (level < 0) {
level = 0;
}
return zip(src, new File(file), encoding, !overwrite, level);
}
 
/* (non-Javadoc)
* @see net.brutex.xservices.ws.ArchiveService#zipFromArchive(net.brutex.xservices.types.ArchiveResource, java.lang.String, boolean, java.lang.String, int)
*/
@WebMethod(operationName = "zipFromArchive")
public ReturnCode zipFromArchive(@WebParam(name = WS_PARAM_SOURCEARCHIVE) ArchiveResource src,
@WebParam(name = WS_PARAM_DESTFILE) String file,
@WebParam(name = WS_PARAM_OVERWRITE) boolean update,
@WebParam(name = WS_PARAM_ENCODING) String encoding,
@WebParam(name = "compresslevel") int level) {
return zip(src, new File(file), encoding, !update, level);
}
 
/* (non-Javadoc)
* @see net.brutex.xservices.ws.ArchiveService#unzip(java.lang.String, java.lang.String, boolean, java.lang.String)
*/
@WebMethod(operationName = "unzip")
public ReturnCode unzip(@WebParam(name = WS_PARAM_SOURCEFILE_STRING) String src,
@WebParam(name = WS_PARAM_DESTDIR) String dest,
@WebParam(name = WS_PARAM_OVERWRITE) boolean overwrite,
@WebParam(name = WS_PARAM_ENCODING) String encoding) {
return unzip(new File(src), new File(dest), overwrite, encoding);
}
 
/* (non-Javadoc)
* @see net.brutex.xservices.ws.ArchiveService#unrar(java.lang.String, java.lang.String)
*/
@WebMethod(operationName = "unrar")
public ReturnCode unrar(@WebParam(name = WS_PARAM_SOURCEFILE_STRING) String src,
@WebParam(name = WS_PARAM_DESTDIR) String dest) {
return unrar(new File(src), new File(dest));
}
 
/* (non-Javadoc)
* @see net.brutex.xservices.ws.ArchiveService#untar(java.lang.String, java.lang.String, boolean, net.brutex.xservices.types.CompressionType)
*/
@WebMethod(operationName = "untar")
public ReturnCode untar(@WebParam(name = WS_PARAM_SOURCEFILE_STRING) String src,
@WebParam(name = WS_PARAM_DESTDIR) String dest,
@WebParam(name = WS_PARAM_OVERWRITE) boolean overwrite,
@WebParam(name = "compression") CompressionType compression) {
Untar.UntarCompressionMethod c = new Untar.UntarCompressionMethod();
switch (compression) {
case GZIP:
c.setValue("gzip");
break;
case BZIP2:
c.setValue("bzip2");
break;
default:
c.setValue("none");
break;
}
return untar(new File(src), new File(dest), overwrite, c);
}
 
@WebMethod(exclude = true)
private ReturnCode bzip(ResourceInterface src, File dst) {
if (dst.exists() && dst.isFile()) {
dst.delete();
}
BZip2 bzip = new BZip2();
bzip.setTaskName("BZip2");
RunTask runner = new RunTask(bzip);
bzip.setSrcResource(src.getAntResource(bzip.getProject()));
bzip.setDestfile(dst);
 
return runner.postTask();
}
 
@WebMethod(exclude = true)
private ReturnCode gzip(ResourceInterface src, File dst) {
if (dst.exists() && dst.isFile()) {
dst.delete();
}
GZip gzip = new GZip();
gzip.setTaskName("GZip");
RunTask runner = new RunTask(gzip);
gzip.addConfigured(src.getAntResource(gzip.getProject()));
gzip.setDestfile(dst);
return runner.postTask();
}
 
@WebMethod(exclude = true)
private ReturnCode zip(ResourceInterface src, File dst, String encoding, boolean update, int compresslevel) {
Zip zip = new Zip();
zip.setTaskName("Zip");
RunTask runner = new RunTask(zip);
zip.add(src.getAntResource(zip.getProject()));
zip.setDestFile(dst);
if (encoding != null && !encoding.equals("")) {
zip.setEncoding(encoding);
}
zip.setUpdate(update);
zip.setLevel(compresslevel);
return runner.postTask();
}
 
@WebMethod(exclude = true)
private ReturnCode GUnzip(ResourceInterface src, File dst) {
GUnzip uz = new GUnzip();
uz.setTaskName("GUnzip");
RunTask runner = new RunTask(uz);
uz.setSrcResource(src.getAntResource(uz.getProject()));
if (dst != null) {
uz.setDest(dst);
}
return runner.postTask();
}
 
@WebMethod(exclude = true)
private ReturnCode BUnzip2(ResourceInterface src, File dst) {
BUnzip2 uz = new BUnzip2();
uz.setTaskName("BUnzip2");
RunTask runner = new RunTask(uz);
uz.setSrcResource(src.getAntResource(uz.getProject()));
if (dst != null) {
uz.setDest(dst);
}
return runner.postTask();
}
 
@WebMethod(exclude = true)
private ReturnCode unzip(File src, File dest, boolean overwrite, String encoding) {
Expand unzip = new Expand();
unzip.setTaskName("UnZip");
RunTask runner = new RunTask(unzip);
unzip.setSrc(src);
unzip.setDest(dest);
unzip.setOverwrite(overwrite);
if (encoding != null && !encoding.equals("")) {
unzip.setEncoding(encoding);
}
return runner.postTask();
}
 
@WebMethod(exclude = true)
private ReturnCode untar(File src, File dest, boolean overwrite, Untar.UntarCompressionMethod compression) {
Untar unzip = new Untar();
unzip.setTaskName("Untar");
RunTask runner = new RunTask(unzip);
unzip.setSrc(src);
unzip.setDest(dest);
unzip.setOverwrite(overwrite);
unzip.setCompression(compression);
return runner.postTask();
}
 
@WebMethod(exclude = true)
private ReturnCode unrar(File src, File dst) {
UnRarTask unrar = new UnRarTask();
unrar.setTaskName("UnRar");
RunTask runner = new RunTask(unrar);
unrar.setSrc(src);
unrar.setDst(dst);
return runner.postTask();
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/impl/StorageServiceImpl.java
0,0 → 1,56
/*
* Copyright 2011 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 javax.jws.WebService;
 
import net.brutex.xservices.types.TargetNodeType;
import net.brutex.xservices.types.ant.AttachmentType;
import net.brutex.xservices.types.ant.CollectionType;
import net.brutex.xservices.util.BrutexNamespaces;
import net.brutex.xservices.ws.StorageService;
import net.brutex.xservices.ws.XServicesFault;
 
/**
* @author Brian Rosenberger
* @since 0.5.0
*
*/
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES, endpointInterface = "net.brutex.xservices.ws.StorageService", serviceName = StorageService.SERVICE_NAME)
public class StorageServiceImpl implements StorageService {
 
public String storeText(String text) throws XServicesFault {
// TODO Auto-generated method stub
return null;
}
 
public String storeBinary(AttachmentType binary) throws XServicesFault {
// TODO Auto-generated method stub
return null;
}
 
public String createCollection(CollectionType collection)
throws XServicesFault {
return collection.getUuid();
}
public void deliverCollection(CollectionType collection,
TargetNodeType targetnode, boolean isFiring) throws XServicesFault {
// TODO Auto-generated method stub
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/impl/Messages.java
0,0 → 1,44
/*
* 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.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
 
public class Messages
{
private static final String BUNDLE_NAME = "net.brutex.xservices.ws.impl.messages";
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("net.brutex.xservices.ws.impl.messages");
 
public static String getString(String key)
{
try
{
return RESOURCE_BUNDLE.getString(key); } catch (MissingResourceException e) {
}
return '!' + key + '!';
}
 
public static String getString(String key, Object[] params)
{
try {
return MessageFormat.format(RESOURCE_BUNDLE.getString(key), params); } catch (MissingResourceException e) {
}
return '!' + key + '!';
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/impl/MiscServiceImpl.java
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();
}
}
/xservices/trunk/src/main/java/net/brutex/xservices/ws/impl/JobServiceImpl.java
0,0 → 1,151
/*
* Copyright 2011 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 static org.quartz.TriggerBuilder.newTrigger;
 
import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Set;
import java.util.TimeZone;
import java.util.UUID;
 
import javax.jws.WebService;
 
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;
 
import net.brutex.xservices.types.ScheduledJob;
import net.brutex.xservices.util.BrutexNamespaces;
import net.brutex.xservices.util.JobWrapper;
import net.brutex.xservices.ws.JobService;
import net.brutex.xservices.ws.XServicesFault;
 
/**
* @author Brian Rosenberger
* @since 0.5.0
*
*/
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES, endpointInterface = "net.brutex.xservices.ws.JobService", serviceName = JobService.SERVICE_NAME)
public class JobServiceImpl implements JobService {
 
public List<ScheduledJob> getJobList() throws XServicesFault {
List<ScheduledJob> joblist = new ArrayList<ScheduledJob>();
try {
Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
List<String> jobgroups = scheduler.getJobGroupNames();
for (String g : jobgroups) {
GroupMatcher m = GroupMatcher.groupContains(g);
Set<JobKey> keyset = scheduler.getJobKeys(m);
for (JobKey key : keyset) {
JobDataMap detail = scheduler.getJobDetail(key)
.getJobDataMap();
ScheduledJob job = new ScheduledJob(key.getName(),
(GregorianCalendar) detail.get("date"),
detail.getString("script"));
joblist.add(job);
}
 
}
 
} catch (SchedulerException e) {
throw new XServicesFault(e);
}
return joblist;
}
 
public ScheduledJob getJob(String uuid) throws XServicesFault {
try {
Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
JobDetail job = scheduler.getJobDetail(new JobKey(uuid, "DEFAULT"));
if (job == null)
throw new XServicesFault("Job not found.");
Trigger t = scheduler.getTrigger(new TriggerKey(uuid));
GregorianCalendar cal = new GregorianCalendar(TimeZone.getDefault());
cal.setTime(t.getStartTime());
return new ScheduledJob(uuid, cal, job.getJobDataMap().getString(
"script"), job.getDescription());
} catch (SchedulerException e) {
e.printStackTrace();
throw new XServicesFault(e);
}
}
 
public void deleteJob(String uuid) throws XServicesFault {
try {
Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
JobKey key = new JobKey(uuid, "DEFAULT");
JobDetail job = scheduler.getJobDetail(key);
if (job == null)
throw new XServicesFault("Job not found.");
Trigger t = scheduler.getTrigger(new TriggerKey(uuid));
scheduler.deleteJob(key);
} catch (SchedulerException e) {
throw new XServicesFault(e);
}
 
}
 
public String scheduleJob(ScheduledJob job) throws XServicesFault {
try {
// Grab the Scheduler instance from the Factory
Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
 
// and start it off
 
if (!scheduler.isStarted())
scheduler.start();
if (scheduler.isInStandbyMode())
scheduler.resumeAll();
 
String identity = UUID.randomUUID().toString();
//String identity = "test";
JobDetail job2 = JobBuilder.newJob(JobWrapper.class)
.withIdentity(identity).build();
 
job2.getJobDataMap().put("script", job.getScript());
job2.getJobDataMap().put("description", job.getDescription());
job2.getJobDataMap().put("date", job.getDate());
 
SimpleTrigger t = (SimpleTrigger) newTrigger()
.withIdentity(identity).startAt(job.getDate().getTime())
.build();
;
 
scheduler.scheduleJob(job2, t);
return identity;
} catch (SchedulerException e) {
e.printStackTrace();
throw new XServicesFault(e);
}
}
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/StringService.java
0,0 → 1,91
/*
* 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;
 
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlElement;
 
import net.brutex.xservices.types.StringMatchType;
import net.brutex.xservices.types.StringReplaceType;
import net.brutex.xservices.types.StringSplitType;
 
import org.apache.cxf.annotations.WSDLDocumentation;
 
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
@WebService(targetNamespace="http://ws.xservices.brutex.net")
public abstract interface StringService
{
public static final String SERVICE_NAME = "StringService";
public static final String OPERATION_REPLACEREGEX = "replaceRegEx";
public static final String OPERATION_MATCHREGEX = "matchRegEx";
public static final String OPERATION_ENCODETOENTITIES = "encodeToXMLEntities";
public static final String PARAM_STRING = "string";
public static final String PARAM_SEARCH = "search";
public static final String PARAM_REPLACE = "replace";
public static final String PARAM_FLAGS = "regexflags";
 
@WebMethod(operationName="replaceRegEx")
@WSDLDocumentation("Store text based data")
public abstract StringReplaceType replaceRegEx(
@WebParam(name="string") String paramString1,
@WebParam(name="search") String paramString2,
@WebParam(name="replace") String paramString3,
@WebParam(name="regexflags") String paramString4)
throws XServicesFault;
 
@WebMethod(operationName="matchRegEx")
@WSDLDocumentation("Match text based data")
public abstract StringMatchType matchRegEx(
@WebParam(name="string") String paramString1,
@WebParam(name="search") String paramString2,
@WebParam(name="regexflags") String paramString3)
throws XServicesFault;
 
@WebMethod(operationName="encodeToXMLEntities")
@WSDLDocumentation("Match text based data")
public abstract String encodeToXMLEntities(
@WebParam(name="string") @XmlElement(required=true) String paramString)
throws XServicesFault;
@WebMethod(operationName="splitString")
@WSDLDocumentation("Split a string into tokens")
public abstract StringSplitType splitString(
@WebParam(name="string") @XmlElement(required=true) String paramString,
@WebParam(name="delimiter") @XmlElement(required=true) String delimiter)
throws XServicesFault;
@WebMethod(operationName="removeCRLF")
@WSDLDocumentation("Remove any line feed and/ or carriage return characters")
public abstract String removeCRLF(
@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;
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/OpenAirProxyService.java
0,0 → 1,218
/*
* Copyright 2017 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;
 
import java.util.GregorianCalendar;
import java.util.List;
 
import javax.jws.WebMethod;
import javax.jws.WebParam;
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;
import net.brutex.mgmt.api.xml.TimesheetEntry;
import net.brutex.mgmt.api.xml.TimesheetFilter;
import net.brutex.mgmt.api.xml.User;
import net.brutex.xservices.types.ant.AttachmentType;
import net.brutex.xservices.util.BrutexNamespaces;
 
 
 
/**
* OpenAir proxy services
* @author Brian Rosenberger
* @since 20160531
*
*/
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES)
public interface OpenAirProxyService {
public static final String SERVICE_NAME = "OpenAirProxyService";
final String OPERATION_GETTIMEENTRIES = "getTimeentries";
final String OPERATION_GETEXCELTIMESHEET = "getExcelTimesheet";
final String OPERATION_GETEXCELTIMESHEET2 = "getExcelTimesheet2";
final String OPERATION_GETPROJECTBYEXTERNALID = "getProjectsByExternalId";
final String OPERATION_GETPROJECTBYOPPID = "getProjectsByOppId";
final String OPERATION_GETCUSTOMERBYID = "getCustomerById";
final String OPERATION_GETUSERBYID = "getUserById";
final String OPERATION_GETUSERBYUSERNAME = "getUserByUsername";
final String OPERATION_GETANYOBJECT = "getAnyObject";
final String OPERATION_GETUPDATEDCOMPANIES = "getUpdatedCustomer";
final String OPERATION_GETUPDATEDPROJECTS = "getUpdatedProject";
 
final String PARAM_PROJECTID = "oa_projectid";
final String PARAM_CUSTOMERID = "oa_customerid";
final String PARAM_USERID = "oa_userid";
final String PARAM_USERNAME = "oa_username";
final String PARAM_TEMPLATE ="template";
final String PARAM_STARTDATE = "startdate";
final String PARAM_ENDDATE = "enddate";
final String PARAM_ENTRYLIST = "timeentries";
final String PARAM_EXTERNALID = "externalid";
final String PARAM_OPPID = "oppid";
final String PARAM_INCLUDENONBILLABLE = "includeNonBillable";
final String PARAM_OBJECTTYPE = "objecttype";
final String PARAM_QUERIES = "queries";
final String PARAM_DATE = "datetime";
final String PARAM_OFFSET = "offset_minutes";
final String PARAM_TIMESHEETSTATUS = "timesheetstatus";
/**
* Get a list of time entries.
*
* @return List of time entries
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_GETTIMEENTRIES)
@WSDLDocumentation(value="Get list of time entries")
public abstract List<TimesheetEntry> getTimeEntryList(
@WebParam(name=PARAM_PROJECTID) int oa_projectid,
@WebParam(name=PARAM_CUSTOMERID) int oa_customerid,
@WebParam(name=PARAM_USERID) int oa_userid,
@WebParam(name=PARAM_STARTDATE) GregorianCalendar startdate,
@WebParam(name=PARAM_ENDDATE) GregorianCalendar enddate,
@WebParam(name=PARAM_INCLUDENONBILLABLE) boolean includeNonBillable,
@WebParam(name=PARAM_TIMESHEETSTATUS) java.util.List<TimesheetFilter.TimesheetFilterType> filter)
throws XServicesFault;
 
/**
* Get an excel time sheet file.
*
* @return List of time entries
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_GETEXCELTIMESHEET)
@WSDLDocumentation(value="Get an excel time sheet file.")
public abstract AttachmentType getExcelTimesheet(
@WebParam(name=PARAM_PROJECTID) int oa_projectid,
@WebParam(name=PARAM_CUSTOMERID) int oa_customerid,
@WebParam(name=PARAM_USERID) int oa_userid,
@WebParam(name=PARAM_STARTDATE) GregorianCalendar startdate,
@WebParam(name=PARAM_ENDDATE) GregorianCalendar enddate,
@WebParam(name=PARAM_INCLUDENONBILLABLE) boolean includeNonBillable,
@WebParam(name=PARAM_TIMESHEETSTATUS) java.util.List<TimesheetFilter.TimesheetFilterType> filter,
@WebParam(name=PARAM_TEMPLATE) AttachmentType templatefile) throws XServicesFault;
/**
* Get an excel time sheet file.
*
* @return List of time entries
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_GETEXCELTIMESHEET2)
@WSDLDocumentation(value="Get an excel time sheet file.")
public abstract AttachmentType getExcelTimesheet2(
@WebParam(name=PARAM_ENTRYLIST) List<TimesheetEntry> entries,
@WebParam(name=PARAM_INCLUDENONBILLABLE) boolean includeNonBillable,
@WebParam(name=PARAM_TEMPLATE) AttachmentType templatefile) throws XServicesFault;
/**
* Get a project from External Id
*
* @return List of projects with this ExternalId
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_GETPROJECTBYEXTERNALID)
@WSDLDocumentation(value="Get a project from External Id")
public abstract List<Project> getProjectsByExternalId(
@WebParam(name=PARAM_EXTERNALID) String externalid) throws XServicesFault;
/**
* Get a project from Opportunity
*
* @return List of projects with this Opportunity
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_GETPROJECTBYOPPID)
@WSDLDocumentation(value="Get a project from Opportunity Id")
public abstract List<Project> getProjectsByOppId(
@WebParam(name=PARAM_OPPID) String oppid) throws XServicesFault;
/**
* Get a customer by its ID
*
* @return Customer object
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_GETCUSTOMERBYID)
@WSDLDocumentation(value="Get a customer by its Id")
public abstract Customer getCustomerById(
@WebParam(name=PARAM_CUSTOMERID) int customerid) throws XServicesFault;
/**
* Get a user record by its ID
*
* @return user object
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_GETUSERBYID)
@WSDLDocumentation(value="Get a user by its Id")
public abstract User getUserById(
@WebParam(name=PARAM_USERID) int userid) throws XServicesFault;
/**
* Get a user record by its username
*
* @return user object
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_GETUSERBYUSERNAME)
@WSDLDocumentation(value="Get a user by its username")
public abstract User getUserByUsername(
@WebParam(name=PARAM_USERNAME) String username) throws XServicesFault;
@WebMethod(operationName=OPERATION_GETANYOBJECT)
@WSDLDocumentation(value="Get any Object by Query")
public abstract List<AnyEntity> getAnyObject(
@WebParam(name=PARAM_OBJECTTYPE) @XmlElement(required=true) String objecttype,
@WebParam(name=PARAM_QUERIES) List<QueryParameter> queries) throws XServicesFault;
@WebMethod(operationName=OPERATION_GETUPDATEDCOMPANIES)
@WSDLDocumentation(value="Get updated customers")
public abstract List<Customer> getUpdatedCustomer(
@WebParam(name=PARAM_DATE) @XmlElement(required=true) GregorianCalendar date,
@WebParam(name=PARAM_OFFSET) @XmlElement(required=true) int offset)
throws XServicesFault;
@WebMethod(operationName=OPERATION_GETUPDATEDPROJECTS)
@WSDLDocumentation(value="Get updated projects")
public abstract List<Project> getUpdatedProjects(
@WebParam(name=PARAM_DATE) @XmlElement(required=true) GregorianCalendar date,
@WebParam(name=PARAM_OFFSET) @XmlElement(required=true) int offset)
throws XServicesFault;
public class QueryParameter {
@XmlElement(required=true)
public String field;
@XmlElement(required=true)
public String value;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/rs/OpenAirInfoServiceImpl.java
0,0 → 1,91
package net.brutex.xservices.ws.rs;
 
import java.net.URL;
import java.util.GregorianCalendar;
import java.util.List;
 
import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
 
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.exception.CacheException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
 
import net.brutex.mgmt.api.xml.Customer;
import net.brutex.mgmt.api.xml.DateFilter;
import net.brutex.mgmt.api.xml.Query;
import net.brutex.mgmt.api.xml.Query.BOOL;
import net.brutex.mgmt.api.xml.StringEntity;
import net.brutex.mgmt.openair.OpenAirRestConnection;
 
public class OpenAirInfoServiceImpl implements OpenAirInfoService {
static final Logger logger = LogManager.getLogger();
 
@Override
public Response getCompanies(HttpHeaders paramHttpHeaders, String search) {
OpenAirRestConnection con = getOpenAirConnection();
Query query = new Query(Customer.class);
query.addQuery("Address_Country", new StringEntity(search), BOOL.AND);
query.addQuery("active", new StringEntity("1"), BOOL.AND);
DateFilter datefilter = new DateFilter("updated");
GregorianCalendar date = new GregorianCalendar();
 
date.add(GregorianCalendar.MINUTE, -5);
datefilter.setStartdate(date);
query.addFilter(datefilter);
//query.addQuery("CustomerAccountCode", new StringEntity(search), BOOL.OR);
List<Customer> resultlist = (List<Customer>) con.getEntitiesByQuery(query);
GenericEntity generic = new GenericEntity<List<Customer>>(resultlist) {};
Response response = Response.ok(generic).build();
return response;
}
private OpenAirRestConnection getOpenAirConnection() {
 
/*
* get details from configuration file
*/
Configurations configs = new Configurations();
final PropertiesConfiguration props;
try {
final String config = "../openair.properties";
logger.debug("Loading Open Air connection details from " + this.getClass().getClassLoader().getResource("/")
+ config);
 
final URL configloc = this.getClass().getClassLoader().getResource(config);
 
props = configs.properties(configloc);
final String user = props.getString("user");
final String password = props.getString("password");
final String company = props.getString("company");
final String apikey = props.getString("apikey", "9x7G49ENkLCJ81i9XZJU");
final String namespace = props.getString("namespace");
 
final OpenAirRestConnection con;
 
con = new OpenAirRestConnection(JCS.getInstance("FileCache"), company, user, password);
return con;
} catch (CacheException e) {
logger.error(e);
e.printStackTrace();
} catch (ConfigurationException e) {
logger.error(e);
e.printStackTrace();
} finally {
 
}
return null;
}
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/rs/OpenAirInfoService.java
0,0 → 1,49
/*
* 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.rs;
 
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
 
 
/**
* The OpenAirInfoService Rest Service.
*
* @author Brian Rosenberger, bru(at)brutex.de
*/
 
@Path("/OpenAirInfoService/")
@Produces({ "text/xml" })
public abstract interface OpenAirInfoService {
 
public final static String BASE_PATH = "/OpenAirInfoService/";
public final static String SERVICE_NAME = "OpenAirInfoService";
 
 
@GET
@Path("getCompanies/")
//@Produces("application/octet-stream")
public abstract Response getCompanies(
@Context HttpHeaders paramHttpHeaders,
@QueryParam("search") String search);
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/rs/CVSInfoImpl.java
0,0 → 1,381
package net.brutex.xservices.ws.rs;
 
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import java.net.URI;
import java.util.List;
import java.util.StringTokenizer;
 
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
 
import net.brutex.xservices.types.scm.AttributeType;
import net.brutex.xservices.types.scm.ItemListType;
import net.brutex.xservices.types.scm.ItemType;
import net.brutex.xservices.types.scm.ModuleListType;
import net.brutex.xservices.types.scm.ModuleType;
import net.brutex.xservices.types.scm.ObjectFactory;
import net.brutex.xservices.types.scm.RevisionType;
import net.brutex.xservices.types.scm.TagListType;
import net.brutex.xservices.types.scmfindings.FindingsListType;
import net.brutex.xservices.util.BasicCVSListener;
import net.brutex.xservices.util.CVSClient;
import net.brutex.xservices.util.CVSRoot;
 
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;
import org.netbeans.lib.cvsclient.command.FileInfoContainer;
import org.netbeans.lib.cvsclient.command.PipedFileInformation;
import org.netbeans.lib.cvsclient.command.checkout.CheckoutCommand;
import org.netbeans.lib.cvsclient.command.checkout.ModuleListInformation;
import org.netbeans.lib.cvsclient.command.log.LogInformation;
import org.netbeans.lib.cvsclient.command.log.LogInformation.Revision;
import org.netbeans.lib.cvsclient.command.log.RlogCommand;
import org.netbeans.lib.cvsclient.connection.AuthenticationException;
import org.netbeans.lib.cvsclient.event.EventManager;
import org.netbeans.lib.cvsclient.event.FileInfoEvent;
 
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();
CVSInfoImpl.logger.debug("forceNoCache=" + forceNoCache);
ItemListType cacheresult = (ItemListType) getCacheInstance().get(
cachekey);
 
if ((!forceNoCache) && (cacheresult != null)) {
return Response.ok(cacheresult).build();
}
Client client;
try {
final CVSClient cvsclient = new CVSClient(f);
client = cvsclient.client;
 
client.getEventManager().addCVSListener(new BasicCVSListener() {
public void fileInfoGenerated(FileInfoEvent arg0) {
LogInformation info = (LogInformation) arg0
.getInfoContainer();
String repoPath = cvsclient.client.getRepository();
 
ItemType cvsfile = CVSInfoImpl.this.FACTORY
.createItemType();
cvsfile.setIsLeaf(true);
cvsfile.setIsBinary(false);
 
cvsfile.setFullname(info.getRepositoryFilename().substring(
repoPath.length() + 2,
info.getRepositoryFilename().length() - 2));
 
cvsfile.setRemotename(info.getRepositoryFilename());
cvsfile.setRemotefullname(info.getRepositoryFilename());
RevisionType revision = CVSInfoImpl.this.FACTORY
.createRevisionType();
revision.setRevision(info.getHeadRevision());
revision.setComment(info.getDescription());
cvsfile.setTipRevision(revision);
 
for (LogInformation.Revision r : info.getRevisionList()) {
revision = CVSInfoImpl.this.FACTORY
.createRevisionType();
revision.setRevision(r.getNumber());
revision.setComment(r.getMessage());
cvsfile.getRevisions().add(revision);
}
 
cvsfile.getAttributes().add(
CVSInfoImpl.this.getAttribute("TOTALREVISIONS",
info.getTotalRevisions()));
cvsfile.getAttributes().add(
CVSInfoImpl.this.getAttribute("BRANCH",
info.getBranch()));
cvsfile.getAttributes().add(
CVSInfoImpl.this.getAttribute(
"KEYWORDSUBSTITUTION",
info.getKeywordSubstitution()));
cvsfile.getAttributes().add(
CVSInfoImpl.this.getAttribute("LOCKS",
info.getLocks()));
cvsfile.getAttributes().add(
CVSInfoImpl.this.getAttribute("SELECTEDREVISIONS",
info.getSelectedRevisions()));
cvsfile.setROOT(cvsclient.getRoot().host + "@"
+ cvsclient.getRoot().repository);
 
CVSInfoImpl.this.list.getItems().add(cvsfile);
 
String key = CVSClient.generateID(cvsfile);
try {
CVSInfoImpl.this.getCacheInstance().put(key, cvsfile);
} catch (CacheException e) {
CVSInfoImpl.logger.error("Could not cache item '"
+ key + "'", e);
}
}
});
RlogCommand rlog = new RlogCommand();
StringTokenizer tk = new StringTokenizer(modules, ",");
while (tk.hasMoreTokens()) {
rlog.setModule(tk.nextToken());
}
if (rlog.getModules().length == 0) {
rlog.setModule("");
}
rlog.setDefaultBranch(false);
 
rlog.setNoTags(false);
 
rlog.setHeaderAndDescOnly(false);
 
rlog.setRecursive(isRecursive);
 
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) {
CVSInfoImpl.logger.error("CVS Configuration File '" + f.getAbsolutePath()
+ f.getName() + "'not found.", e);
} catch (CommandAbortedException e) {
e.printStackTrace();
} catch (AuthenticationException e) {
e.printStackTrace();
} catch (CommandException e) {
e.printStackTrace();
} catch (CacheException e) {
e.printStackTrace();
}
 
if (!showRevisions) {
for (ItemType t : this.list.getItems()) {
t.getRevisions().clear();
}
}
 
return Response.ok(this.list).build();
}
 
public Response getModules(HttpHeaders h, File f, boolean forceNoCache) {
String cachekey = "Modules" + f.toURI().toString();
CVSInfoImpl.logger.debug("forceNoCache=" + forceNoCache);
 
ModuleListType response = (ModuleListType) getCacheInstance().get(
cachekey);
if ((!forceNoCache) && (response != null)) {
return Response.ok(response).build();
}
try {
CVSClient cvsclient = new CVSClient(f);
Client client = cvsclient.client;
final ModuleListType list = this.FACTORY.createModuleListType();
 
client.getEventManager().addCVSListener(new BasicCVSListener() {
public void fileInfoGenerated(FileInfoEvent e) {
ModuleListInformation info = (ModuleListInformation) e
.getInfoContainer();
ModuleType module = CVSInfoImpl.this.FACTORY
.createModuleType();
module.setName(info.getModuleName());
module.setStatus(info.getModuleStatus());
module.setPath(info.getPaths());
module.setType(info.getType());
list.getModules().add(module);
}
});
CheckoutCommand co = new CheckoutCommand();
co.setShowModulesWithStatus(true);
 
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) {
CVSInfoImpl.logger.warn("Repository '"
+ cvsclient.getRoot().repository
+ "' does not have modules");
}
 
getCacheInstance().put(cachekey, list);
return Response.ok(list).build();
} catch (Exception e) {
e.printStackTrace();
}
return Response.serverError().build();
}
 
public Response getTags(HttpHeaders h, File f, boolean withFiles) {
String cachekey = f.toURI().toString() + ":taglist";
CVSInfoImpl.logger.debug("Retrieving Tags from cache using key '" + cachekey
+ "'");
TagListType tags = (TagListType) getCacheInstance().get(cachekey);
if (tags != null) {
CVSInfoImpl.logger.debug("Delivering Tags from cache.");
return Response.ok(tags).build();
}
CVSInfoImpl.logger.warn("Taglist not found in cache.");
return Response.noContent().build();
}
 
public Response getFileContent(HttpHeaders h, File f, String filestring,
boolean forceNoCache) {
final ItemType result = this.FACTORY.createItemType();
final String cachekey = f.toURI().toString() + ":" + filestring
+ ":content";
ItemListType list = null;
 
if (!forceNoCache) {
CVSInfoImpl.logger.debug("Retrieving file content from cache using key '"
+ cachekey + "'");
list = (ItemListType) getCacheInstance().get(cachekey);
}
 
if (list != null) {
CVSInfoImpl.logger.debug("Delivering file content from cache.");
return Response.ok(list).build();
}
 
CVSInfoImpl.logger.warn("File content not found in cache.");
list = this.FACTORY.createItemListType();
try {
CVSClient cvsclient = new CVSClient(f);
Client client = cvsclient.getClient();
 
CheckoutCommand checkout = new CheckoutCommand();
BasicCVSListener listener = new BasicCVSListener() {
public void fileInfoGenerated(FileInfoEvent arg0) {
System.out.println(arg0.getInfoContainer().getFile()
.toURI().toString());
PipedFileInformation info = (PipedFileInformation) arg0
.getInfoContainer();
result.setName(info.getFile().getName());
try {
boolean isBinary = false;
result.setIsBinary(isBinary);
result.setRemotename(info.getRepositoryFileName());
RevisionType revision = CVSInfoImpl.this.FACTORY
.createRevisionType();
revision.setRevision(info.getRepositoryRevision());
revision.setComment("");
 
if (!isBinary) {
FileReader fin = new FileReader(info.getTempFile());
 
ByteArrayOutputStream bout = new ByteArrayOutputStream();
StringBuffer sbuf = new StringBuffer();
int c;
while ((c = fin.read()) != -1) {
bout.write(c);
sbuf.append((char) c);
}
result.setData(bout.toByteArray());
result.setContent(sbuf.toString());
}
 
} catch (IOException e2) {
e2.printStackTrace();
} catch (NullPointerException ne) {
ne.printStackTrace();
}
 
String key = CVSClient.generateID(result);
try {
CVSInfoImpl.this.getCacheInstance().put(cachekey,
result);
} catch (CacheException e1) {
e1.printStackTrace();
}
}
};
client.getEventManager().addCVSListener(listener);
 
checkout.setModule(filestring);
checkout.setPipeToOutput(true);
 
CVSInfoImpl.logger.info("Execute CVS command '" + checkout.getCVSCommand()
+ "' against '" + cvsclient.getRoot().host + "@"
+ cvsclient.getRoot().repository + "'");
client.executeCommand(checkout, cvsclient.getGlobalOptions());
} catch (CommandAbortedException e) {
e.printStackTrace();
} catch (ConfigurationException e) {
e.printStackTrace();
} catch (AuthenticationException e) {
e.printStackTrace();
} catch (CommandException e) {
e.printStackTrace();
}
 
if (result.getContent() != null) {
return Response.ok(result).build();
}
return Response.noContent().build();
}
 
public CacheAccess<Object, Object> getCacheInstance() {
CacheAccess<Object, Object> jcs = null;
String cacheinstance = "CVSCache";
try {
CVSInfoImpl.logger.trace("Getting cache instance named 'CVSCache'");
jcs = JCS.getInstance("CVSCache");
} catch (CacheException e) {
CVSInfoImpl.logger.error("Failed to get cache instance", e);
e.printStackTrace();
}
return jcs;
}
 
public Response searchFileContent(HttpHeaders h, File f,
String file_regexp, String content_regexp, boolean forceNoCache) {
try {
CVSClient client = new CVSClient(f);
String cvsroot = client.getRoot().host + "@"
+ client.getRoot().repository;
 
String cachestring = "FINDINGS-" + cvsroot;
CVSInfoImpl.logger
.debug("Fetch searchFileContent response from cache using cachekey '"
+ cachestring + "'");
FindingsListType result = (FindingsListType) getCacheInstance()
.get(cachestring);
if (result != null)
CVSInfoImpl.logger.debug("Found object for key '" + cachestring
+ "' in cache.");
else {
CVSInfoImpl.logger.debug("Found no object for key '" + cachestring
+ "' in cache.");
}
 
if (result != null)
return Response.ok(result).build();
} catch (CommandAbortedException e) {
e.printStackTrace();
} catch (ConfigurationException e) {
e.printStackTrace();
} catch (AuthenticationException e) {
e.printStackTrace();
}
return Response.noContent().build();
}
 
private AttributeType getAttribute(String name, String value) {
AttributeType attribute = this.FACTORY.createAttributeType();
attribute.setName(name);
attribute.setValue(value);
return attribute;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/rs/DIMCMInfo.java
0,0 → 1,80
/*
* Copyright 2014 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.rs;
 
import java.io.File;
 
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
 
import org.apache.commons.jcs.access.exception.CacheException;
 
import net.brutex.xservices.ws.XServicesFault;
 
 
/**
* The Dim CM Browsing Rest Service.
*
* @author Brian Rosenberger, bru(at)brutex.de
*/
 
@Path("/")
@Produces({ "text/xml" })
public abstract interface DIMCMInfo {
 
public final static String BASE_PATH = "/DIMCMService/";
public final static String SERVICE_NAME = "DIMCMInfoService";
/**
* Get the file/ directory listing.
*
* @param paramHttpHeaders the param http headers
* @param uriInfo request url info
* @param directory The directory to list.
* @param includeDirectories Whether or not to include directories in the listing. Default is true.
* @param includeFiles Whether or not to include files in the listing. Default is true.
* @param depth Include subdirectories down to a given depth. Default is 1.
* @param search Additional "Glob search pattern" for the file/ directory name. I.e. '*.log'
* @param itemsPerPage How many items to return with one call. Default is 50.
* @param page Paging support. Default is 1.
* @param useCache whether or not to use cache. Defaults to true.
* @return the FileInfo Set as an XML structure
* @throws CacheException
*/
@GET
@Path("getItems/")
public abstract Response getFiles(
@Context HttpHeaders paramHttpHeaders,
@Context UriInfo uriInfo,
@QueryParam("projSpec") String project,
@QueryParam("directory") String directory,
@QueryParam("recursive") @DefaultValue("false") boolean recursive,
@QueryParam("includeFiles") @DefaultValue("1") boolean includeFiles,
@QueryParam("depth") @DefaultValue("1") int depth,
@QueryParam("search") String search,
@QueryParam("itemsPerPage") @DefaultValue("50") int itemsPerPage,
@QueryParam("page") @DefaultValue("1") int page,
@QueryParam("usecache") @DefaultValue("true") boolean useCache) throws CacheException;
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/rs/DIMCMInfoImpl.java
0,0 → 1,378
/*
* Copyright 2014 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.rs;
 
 
 
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.nio.file.FileVisitOption;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
 
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;
import net.brutex.xservices.types.FileInfoType;
import net.brutex.xservices.util.FileWalker;
 
 
 
/*
* The Serena Dimensions CM Java API is required for these imports.
* The API is not included in this package due to copyright reasons,
* please get Dimensions CM from Serena Software Inc., Evaluation versions
* are available from http://www.serena.com
*
* required Jars:
* serena.darius-14.1.jar
* serena.dmclient-14.1.jar
* serena.dmfile-14.1.jar
* serena.dmnet-14.1.jar
* serena.dmtpi-14.1.jar
*
*/
 
import com.serena.dmclient.api.BulkOperator;
import com.serena.dmclient.api.DimensionsConnection;
import com.serena.dmclient.api.DimensionsConnectionDetails;
import com.serena.dmclient.api.DimensionsConnectionManager;
import com.serena.dmclient.api.ItemRevision;
import com.serena.dmclient.api.Project;
import com.serena.dmclient.api.RepositoryFolder;
import com.serena.dmclient.api.SystemAttributes;
 
/**
* The Class FileInfoImpl.
*
* @author Brian Rosenberger, bru(at)brutex.de
*/
public class DIMCMInfoImpl implements DIMCMInfo {
 
Logger logger = LogManager.getLogger();
 
/*
* (non-Javadoc)
*
* @see
* net.brutex.xservices.ws.rs.FileInfo#getFiles(javax.ws.rs.core.HttpHeaders
* , java.lang.String, boolean, boolean, int, java.lang.String, int, int)
*/
public Response getFiles(HttpHeaders h, UriInfo uriInfo, String projSpec,
String directory, boolean recursive, boolean withFiles, int level,
String search, int count, int page, boolean useCache) throws CacheException {
 
/*
* try to hit cache first
*/
CacheAccess<Object, Object> cache = JCS.getInstance("DIMCM");
String cachekey = projSpec + directory + String.valueOf(recursive);
if(useCache) {
ItemTypeList cacheresult = (ItemTypeList) cache.get(cachekey);
if(cacheresult != null) return Response.ok(cacheresult).build();
}
//Reject when project has not the form "PRODUCT:PROJECT"
if(! projSpec.contains(":")) return Response.noContent().build();
Project project = getDIMCMConnection().getObjectFactory().getProject(projSpec);
RepositoryFolder folder = null;
if (directory == null) {
folder = project.getRootFolder();
} else {
while(directory.startsWith("/") || directory.startsWith("\\")) {
directory = directory.substring(1);
}
if(directory.equals("")) {
folder = project.getRootFolder();
} else {
folder = project.findRepositoryFolderByPath(directory);
}
}
 
ItemTypeList resultlist = new ItemTypeList();
resultlist.list = getItems(folder, recursive);
if(cache!=null) cache.put(cachekey, resultlist);
//does this help?
DimensionsConnectionManager.unregisterThreadConnection();
return Response.ok(resultlist).build();
 
}
 
List<ItemType> getItems(RepositoryFolder f, boolean recursive) {
DimensionsConnection conn = getDIMCMConnection();
List<ItemType> result = new ArrayList<>();
 
/* get Items from current folder */
/* latest revision only */
List<ItemRevision> revisions = f.getLatestItemRevisions();
 
int[] attr = { SystemAttributes.FULL_PATH_NAME,
SystemAttributes.ITEMFILE_DIR,
SystemAttributes.ITEMFILE_FILENAME,
SystemAttributes.ITEMFILE_DIR, SystemAttributes.OBJECT_SPEC,
SystemAttributes.OBJECT_ID, SystemAttributes.OBJECT_SPEC_UID,
SystemAttributes.OBJECT_UID, SystemAttributes.CREATION_DATE,
SystemAttributes.CREATION_USER, SystemAttributes.ITEM_FORMAT,
SystemAttributes.LAST_UPDATED_DATE,
SystemAttributes.LAST_UPDATED_USER };
BulkOperator bulk = conn.getObjectFactory().getBulkOperator(revisions);
bulk.queryAttribute(attr);
 
// Copy into JAXB object
for (ItemRevision r : revisions) {
ItemType item = new ItemType();
item.setLongFilename((String) r
.getAttribute(SystemAttributes.FULL_PATH_NAME));
item.setDirName((String) r
.getAttribute(SystemAttributes.ITEMFILE_DIR));
item.setShortFilename((String) r
.getAttribute(SystemAttributes.ITEMFILE_FILENAME));
item.setObject_id((String) r
.getAttribute(SystemAttributes.OBJECT_ID));
item.setObject_uid((String.valueOf(r
.getAttribute(SystemAttributes.OBJECT_UID))));
item.setObject_spec((String) r
.getAttribute(SystemAttributes.OBJECT_SPEC));
item.setObject_spec_uid(String.valueOf(r
.getAttribute(SystemAttributes.OBJECT_SPEC_UID)));
item.setObject_spec_uid(String.valueOf(r
.getAttribute(SystemAttributes.OBJECT_SPEC_UID)));
item.setCreatedDate(String.valueOf(r
.getAttribute(SystemAttributes.CREATION_DATE)));
item.setCreatedUser(String.valueOf(r
.getAttribute(SystemAttributes.CREATION_USER)));
item.setItemFormat(String.valueOf(r
.getAttribute(SystemAttributes.ITEM_FORMAT)));
item.setUpdatedDate(String.valueOf(r
.getAttribute(SystemAttributes.LAST_UPDATED_DATE)));
item.setUpdatedUser(String.valueOf(r
.getAttribute(SystemAttributes.LAST_UPDATED_USER)));
 
try {
item.setUrl(new URL(getBaseURL()
+ "?jsp=api&command=openi&object_id="
+ item.getObject_spec() + "&DB_CONN="
+ conn.getConnectionDetails().getDbConn() + "&DB_NAME="
+ conn.getConnectionDetails().getDbName()));
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
result.add(item);
}
/*
* for recursive add other folders
*/
if(recursive) {
List<RepositoryFolder> folders = f.getAllChildFolders();
for(RepositoryFolder ff : folders) {
result.addAll(getItems(ff, false));
}
}
return result;
}
 
/**
* Sets the directory.
*
* @param list
* the list
* @param dir
* the dir
* @param withDirectories
* the with directories
* @param withFiles
* the with files
* @param depth
* the depth
* @param search
* the search
*/
private void setDirectory(final URI baseuri, final List<FileInfoType> list,
File dir, boolean withDirectories, boolean withFiles,
final int depth, String search) {
if (depth <= 0)
return;
 
if (search == null || search.equals("")) {
search = "*";
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);
logger.info("FileWalker returned '" + finder.getCount()
+ "' hits. '" + finder.getTotal()
+ "' files have been scanned.");
List<Path> result = finder.getResult();
for (Path f : result) {
if (!withDirectories) {
if (f.toFile().isDirectory())
continue;
}
if (!withFiles) {
if (f.toFile().isFile())
continue;
}
list.add(new FileInfoType(f, baseuri));
}
} catch (IOException e2) {
logger.error(e2.getMessage(), e2);
;
}
}
 
/**
* Sets the directory.
*
* @param dir
* the dir
* @param withDirectories
* the with directories
* @param withFiles
* the with files
* @param depth
* the depth
* @param search
* the search
* @return the list
*/
private List<FileInfoType> setDirectory(URI baseuri, String dir,
boolean withDirectories, boolean withFiles, int depth, String search) {
List<FileInfoType> list = new ArrayList<FileInfoType>();
setDirectory(baseuri, list, new File(dir), withDirectories, withFiles,
depth, search);
return list;
}
 
private boolean isPermitted(String dir) {
/*
*
* logger.warn(String.format(
* "User '%s' does not have permission to access '%s'."
* ,SecurityUtils.getSubject().getPrincipal(), dir )); throw new
* NotAuthorizedException(new
* UnauthorizedException("User does not have permission to access "+
* dir)); }
*/
return true;
}
 
// http://stackoverflow.com/questions/3758606/how-to-convert-byte-size-into-human-readable-format-in-java
private static String humanReadableByteCount(long bytes, boolean si) {
int unit = si ? 1000 : 1024;
if (bytes < unit)
return bytes + " B";
int exp = (int) (Math.log(bytes) / Math.log(unit));
String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1)
+ (si ? "" : "i");
return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
}
 
private DimensionsConnection getDIMCMConnection() {
/*
* Do we have a registered connection already?
*/
DimensionsConnection conn = null;
try {
conn = DimensionsConnectionManager.getThreadConnection();
if (conn != null)
return conn;
} catch (Exception e) {
logger.error(e.getMessage());
}
 
/*
* Create a new connection from property file
*/
PropertiesConfiguration props;
try {
props = new Configurations().properties(this.getClass()
.getClassLoader().getResource("/../dimcm.properties"));
} catch (ConfigurationException e) {
e.printStackTrace();
return null;
}
 
DimensionsConnectionDetails details = new DimensionsConnectionDetails();
details.setUsername(props.getString("user"));
details.setPassword(props.getString("password"));
details.setDbName(props.getString("dbname"));
details.setDbConn(props.getString("dbconn"));
details.setServer(props.getString("server"));
conn = DimensionsConnectionManager.getConnection(details);
DimensionsConnectionManager.registerThreadConnection(conn);
return conn;
}
 
private String getBaseURL() {
final String CACHE_BASEURL = "DIMCM.conf.baseurl";
try {
CacheAccess<Object, Object> cache = JCS.getInstance("DIMCM");
String baseurl = (String) cache.get(CACHE_BASEURL);
if(baseurl != null) return baseurl;
Configurations configs = new Configurations();
PropertiesConfiguration props = configs.properties((this.getClass().getClassLoader().getResource("/../dimcm.properties")));
baseurl = props.getString("baseurl");
cache.put(CACHE_BASEURL, baseurl);
return baseurl;
} catch (CacheException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
return null;
} catch (ConfigurationException e) {
e.printStackTrace();
return null;
}
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/rs/FileInfoImpl.java
0,0 → 1,270
/*
* 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.rs;
 
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;
import java.nio.file.DirectoryStream;
import java.nio.file.FileSystems;
import java.nio.file.FileVisitOption;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributeView;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
 
import javax.ws.rs.NotAuthorizedException;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.StreamingOutput;
import javax.ws.rs.core.UriInfo;
 
import net.brutex.xservices.security.DirectoryPermission;
import net.brutex.xservices.types.FileInfoType;
import net.brutex.xservices.util.FileWalker;
 
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.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.UnauthorizedException;
 
/**
* The Class FileInfoImpl.
*
* @author Brian Rosenberger, bru(at)brutex.de
*/
public class FileInfoImpl implements FileInfo {
Logger logger = LogManager.getLogger();
 
/* (non-Javadoc)
* @see net.brutex.xservices.ws.rs.FileInfo#getFiles(javax.ws.rs.core.HttpHeaders, java.lang.String, boolean, boolean, int, java.lang.String, int, int)
*/
public Response getFiles(HttpHeaders h, UriInfo uriInfo, String dir, boolean withDir, boolean withFiles, int level, String search, int count, int page, boolean useCache)
{
if(dir==null) {
dir = "c:/";
logger.warn("No directory specified. Default is 'c:/'.");
}
isPermitted(dir);
URI baseuri = URI.create(uriInfo.getBaseUri()+FileInfo.BASE_PATH+"getFile?file=");
logger.info(String.format("Listing directory '%s'.", dir));
if (level <= 0) level = 1;
 
if ((!withDir) && (!withFiles)) withFiles = true;
String cachekey = level + "||" + withFiles + "||" + withDir + "||" + search + "||" + dir;
try {
logger.debug(String.format("Hitting cache with cachekey '%s'", cachekey));
CacheAccess<Object, Object> jcs = JCS.getInstance("FileCache");
 
/*Try to retrieve the file list from the cache*/
List<FileInfoType> list = (List<FileInfoType>)jcs.get(cachekey);
if (list == null || !useCache) {
list = setDirectory(baseuri, dir, withDir, withFiles, level, search);
jcs.put(cachekey, list);
logger.debug("Stored in Cache: " + list.toString());
} else {
logger.debug("Got from Cache: " + list.toString());
}
 
int fromIndex = 0;
int toIndex = 0;
fromIndex = (page - 1) * count;
toIndex = page * count;
if (toIndex > list.size()) toIndex = list.size();
if (fromIndex > toIndex) fromIndex = toIndex;
GenericEntity<List<FileInfoType>> sublist = new GenericEntity<List<FileInfoType>>(list.subList(fromIndex, toIndex)) {};
logger.info(String.format("Returning items %s to %s from total of %s items in the list.", fromIndex, toIndex, list.size()));
return Response.ok(sublist).build();
} catch (CacheException e) {
return Response.serverError().build();
}
}
 
/**
* Sets the directory.
*
* @param list the list
* @param dir the dir
* @param withDirectories the with directories
* @param withFiles the with files
* @param depth the depth
* @param search the search
*/
private void setDirectory(final URI baseuri, final List<FileInfoType> list, File dir, boolean withDirectories, boolean withFiles, final int depth, String search)
{
if (depth <= 0) return;
if(search==null || search.equals("") ) {
search = "*";
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);
logger.info("FileWalker returned '"+finder.getCount()+"' hits. '" + finder.getTotal() + "' files have been scanned.");
List<Path> result = finder.getResult();
for(Path f : result) {
if(! withDirectories) {
if(f.toFile().isDirectory()) continue;
}
if(! withFiles) {
if(f.toFile().isFile()) continue;
}
list.add(new FileInfoType(f, baseuri));
}
} catch (IOException e2) {
logger.error(e2.getMessage(), e2);;
}
}
/**
* Sets the directory.
*
* @param dir the dir
* @param withDirectories the with directories
* @param withFiles the with files
* @param depth the depth
* @param search the search
* @return the list
*/
private List<FileInfoType> setDirectory(URI baseuri, String dir, boolean withDirectories, boolean withFiles, int depth, String search)
{
List<FileInfoType> list = new ArrayList<FileInfoType>();
setDirectory(baseuri, list, new File(dir), withDirectories, withFiles, depth, search);
return list;
}
 
@Override
public Response getFile(HttpHeaders paramHttpHeaders, String file) {
isPermitted(file);
try {
Path path = FileSystems.getDefault().getPath(file);
BasicFileAttributeView basicView = Files.getFileAttributeView(path, BasicFileAttributeView.class);
BasicFileAttributes basic;
basic = basicView.readAttributes();
//In case this is a directory
//we zip it and return the zip stream
if(basic.isDirectory()) return getDirectoryAsZip(path);
MediaType mime = MediaType.APPLICATION_OCTET_STREAM_TYPE;
try {
mime = MediaType.valueOf(Files.probeContentType(path));
} catch (IllegalArgumentException | IOException e) {
//In case we can not find the media type for some reason
//the default assignment is taken, so we can
//ignore this error.
logger.debug(String.format("Could not probe media type for file '%s'. Default is '%s'", path.toString(), mime.getType()), e);
}
Response r = Response.ok(path.toFile(), mime).build();
String fileName = path.getFileName().toString();
if(mime == MediaType.APPLICATION_OCTET_STREAM_TYPE) r.getHeaders().add("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
return r;
} catch (IOException e1) {
// TODO Auto-generated catch block
logger.error(e1.getMessage(), e1);
return Response.serverError().build();
}
}
 
private Response getDirectoryAsZip(final Path path) {
 
StreamingOutput output = new StreamingOutput() {
@Override
public void write(OutputStream os) throws IOException,
WebApplicationException {
ZipOutputStream zos = new ZipOutputStream(os);
//read directory content (files only)
try (DirectoryStream<Path> stream = Files.newDirectoryStream(path)) {
for (Path file: stream) {
//skip anything not being a file
if(! file.toFile().isFile()) continue;
//ZipEntry
String filename = file.getFileName().toString();
ZipEntry ze = new ZipEntry(filename);
zos.putNextEntry( ze );
//read a file and put it into the output stream
FileInputStream fis = new FileInputStream(file.toFile());
byte[] buffer = new byte[1024];
int len;
while ((len = fis.read(buffer)) > 0) {
zos.write(buffer, 0, len);
}
zos.flush();
fis.close();
}
zos.close();
}
}
};
Response r = Response.ok(output, MediaType.APPLICATION_OCTET_STREAM_TYPE).build();
String zipname = (path.getFileName()==null) ? "null.zip" : path.getFileName().toString()+".zip";
r.getHeaders().add("Content-Disposition", "attachment; filename=\"" + zipname + "\"");
return r;
}
 
private boolean isPermitted(String dir) {
if(! SecurityUtils.getSubject().isPermitted( new DirectoryPermission(dir))) {
logger.warn(String.format("User '%s' does not have permission to access '%s'.",SecurityUtils.getSubject().getPrincipal(), dir ));
throw new NotAuthorizedException(new UnauthorizedException("User does not have permission to access "+ dir));
}
return true;
}
 
//http://stackoverflow.com/questions/3758606/how-to-convert-byte-size-into-human-readable-format-in-java
private static String humanReadableByteCount(long bytes, boolean si) {
int unit = si ? 1000 : 1024;
if (bytes < unit) return bytes + " B";
int exp = (int) (Math.log(bytes) / Math.log(unit));
String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp-1) + (si ? "" : "i");
return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
}
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/rs/FileInfo.java
0,0 → 1,82
/*
* 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.rs;
 
import java.io.File;
 
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
 
import net.brutex.xservices.ws.XServicesFault;
 
 
/**
* The FileBrowsing Rest Service.
*
* @author Brian Rosenberger, bru(at)brutex.de
*/
 
@Path("/FileService/")
@Produces({ "text/xml" })
public abstract interface FileInfo {
 
public final static String BASE_PATH = "/FileService/";
public final static String SERVICE_NAME = "FileInfoService";
/**
* Get the file/ directory listing.
*
* @param paramHttpHeaders the param http headers
* @param uriInfo request url info
* @param directory The directory to list.
* @param includeDirectories Whether or not to include directories in the listing. Default is true.
* @param includeFiles Whether or not to include files in the listing. Default is true.
* @param depth Include subdirectories down to a given depth. Default is 1.
* @param search Additional "Glob search pattern" for the file/ directory name. I.e. '*.log'
* @param itemsPerPage How many items to return with one call. Default is 50.
* @param page Paging support. Default is 1.
* @param useCache whether or not to use cache. Defaults to true.
* @return the FileInfo Set as an XML structure
*/
@GET
@Path("getFiles/")
public abstract Response getFiles(
@Context HttpHeaders paramHttpHeaders,
@Context UriInfo uriInfo,
@QueryParam("directory") String directory,
@QueryParam("includeDirectories") @DefaultValue("0") boolean includeDirectories,
@QueryParam("includeFiles") @DefaultValue("1") boolean includeFiles,
@QueryParam("depth") @DefaultValue("1") int depth,
@QueryParam("search") String search,
@QueryParam("itemsPerPage") @DefaultValue("50") int itemsPerPage,
@QueryParam("page") @DefaultValue("1") int page,
@QueryParam("usecache") @DefaultValue("1") boolean useCache);
 
@GET
@Path("getFile/")
//@Produces("application/octet-stream")
public abstract Response getFile(
@Context HttpHeaders paramHttpHeaders,
@QueryParam("file") String file);
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/rs/FileListType.java
0,0 → 1,37
/*
* Copyright 2014 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.rs;
 
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
 
@XmlRootElement(name="FileList")
public class FileListType
{
 
@XmlElement
public String name;
 
public FileListType()
{
}
 
public FileListType(String name)
{
this.name = name;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/rs/ResultType.java
0,0 → 1,34
/*
* Copyright 2014 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.rs;
 
import net.brutex.xservices.types.scm.ItemType;
 
class ResultType
{
private ItemType result = null;
 
ItemType getResult()
{
return this.result;
}
 
void setResult(ItemType result)
{
this.result = result;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/rs/CVSInfo.java
0,0 → 1,47
package net.brutex.xservices.ws.rs;
 
import java.io.File;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
 
@Path("/CVSService/")
@Produces({"application/xml", "application/json"})
public abstract interface CVSInfo
{
public static final String WS_OPERATION_GETREPOSITORYFILES = "getRepositoryFiles";
public static final String WS_OPERATION_GETMODULES = "getModules";
public static final String WS_OPERATION_GETTAGS = "getTags";
public static final String WS_OPERATION_GETFILECONTENT = "getFileContent";
public static final String WS_OPERATION_SEARCHFILECONTENT = "searchFileContent";
 
@GET
@Path("getRepositoryFiles")
public abstract Response getRepositoryFiles(@Context HttpHeaders paramHttpHeaders, @QueryParam("config") File paramFile, @QueryParam("modules") @DefaultValue("") String paramString, @QueryParam("recursive") @DefaultValue("false") boolean paramBoolean1, @QueryParam("showRevisions") @DefaultValue("false") boolean paramBoolean2, @QueryParam("forceNoCache") @DefaultValue("false") boolean paramBoolean3);
 
@GET
@Path("getModules")
public abstract Response getModules(@Context HttpHeaders paramHttpHeaders, @QueryParam("config") File paramFile, @QueryParam("forceNoCache") @DefaultValue("false") boolean paramBoolean);
 
@GET
@Path("getTags")
public abstract Response getTags(@Context HttpHeaders paramHttpHeaders, @QueryParam("config") File paramFile, @QueryParam("withFiles") @DefaultValue("false") boolean paramBoolean);
 
@GET
@Path("getFileContent")
public abstract Response getFileContent(@Context HttpHeaders paramHttpHeaders, @QueryParam("config") File paramFile, @QueryParam("file") String paramString, @QueryParam("forceNoCache") @DefaultValue("false") boolean paramBoolean);
 
@GET
@Path("searchFileContent")
public abstract Response searchFileContent(@Context HttpHeaders paramHttpHeaders, @QueryParam("config") File paramFile, @QueryParam("file_regexp") String paramString1, @QueryParam("content_regexp") String paramString2, @QueryParam("forceNoCache") @DefaultValue("false") boolean paramBoolean);
}
 
/* Location: C:\Users\brosenberger\Documents\My Box Files\XBridgeNG-download\XServices-20130131 - Kopie\WEB-INF\classes\net.zip
* Qualified Name: net.brutex.xservices.ws.rs.CVSInfo
* JD-Core Version: 0.6.2
*/
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/XmlService.java
0,0 → 1,108
/*
* Copyright 2012 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;
 
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlElement;
 
import net.brutex.xservices.types.AttributeType;
import net.brutex.xservices.types.NamespaceListType;
import net.brutex.xservices.types.StringSplitType;
import net.brutex.xservices.types.ant.FileResource;
 
import org.apache.cxf.annotations.WSDLDocumentation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
 
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
@WebService(targetNamespace="http://ws.xservices.brutex.net")
public abstract interface XmlService
{
public static final String SERVICE_NAME = "XmlService";
public static final String OPERATION_APPENDTO = "appendTo";
public static final String OPERATION_REPLACE = "replaceNode";
public static final String PARAM_XPATH = "xpath";
public static final String PARAM_XML = "xmldata";
 
@RequiresPermissions("insertNodes")
@WebMethod(operationName="insertNodes")
@WSDLDocumentation("Insert an XML fragment into an XML document given as string.")
public abstract String insertNodes(
@WebParam(name="sourcexml") String source,
@WebParam(name="encoding") String encoding,
@WebParam(name="namespaceList") NamespaceListType paramNamespaceListType,
@WebParam(name="xpath") @XmlElement(required=true) String paramString1,
@WebParam(name="xmldata") String paramString2)
throws XServicesFault;
@WebMethod(operationName="insertNodes2")
@WSDLDocumentation("Insert an XML fragment into an XML document given as file.")
public abstract String insertNodesFromFile(
@WebParam(name="file") FileResource paramFileResource,
@WebParam(name="namespaceList") NamespaceListType paramNamespaceListType,
@WebParam(name="xpath") @XmlElement(required=true) String paramString1,
@WebParam(name="xmldata") String paramString2)
throws XServicesFault;
@WebMethod(operationName="replaceNodes")
@WSDLDocumentation("Replaces matched XML nodes with an XML document given as string.")
public abstract String replaceNodes(
@WebParam(name="sourcexml") String source,
@WebParam(name="encoding") String encoding,
@WebParam(name="namespaceList") NamespaceListType paramNamespaceListType,
@WebParam(name="xpath") @XmlElement(required=true) String paramString1,
@WebParam(name="xmldata") String paramString2)
throws XServicesFault;
@WebMethod(operationName="replaceNodes2")
@WSDLDocumentation("Replaces matched XML nodes with an XML document given as file.")
public abstract String replaceNodesFromFile(
@WebParam(name="file") FileResource paramFileResource,
@WebParam(name="namespaceList") NamespaceListType paramNamespaceListType,
@WebParam(name="xpath") @XmlElement(required=true) String paramString1,
@WebParam(name="xmldata") String paramString2)
throws XServicesFault;
@WebMethod(operationName="wrapInCDATA")
@WSDLDocumentation("Wraps a String into a CDATA element")
public abstract String wrapInCDATA(@WebParam(name="data") @XmlElement(required=true) String data)
throws XServicesFault;
@WebMethod(operationName="selectXPath")
@WSDLDocumentation("Select from xml document given as string using an XPath expression.")
public abstract StringSplitType selectXPath(
@WebParam(name="sourcexml") @XmlElement(required=true) String source,
@WebParam(name="encoding") String encoding,
@WebParam(name="namespaceList") NamespaceListType paramNamespaceListType,
@WebParam(name="xpath") @XmlElement(required=true) String paramString1)
throws XServicesFault;
@WebMethod(operationName="setAttribute")
@WSDLDocumentation("Set an attribute.")
public abstract String setAttribute(
@WebParam(name="sourcexml") @XmlElement(required=true) String source,
@WebParam(name="encoding") String encoding,
@WebParam(name="namespaceList") NamespaceListType paramNamespaceListType,
@WebParam(name="xpath") @XmlElement(required=true) String paramString1,
@WebParam(name="attribute") @XmlElement(nillable=false, required=true) AttributeType attr)
throws XServicesFault;
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/ArchiveService.java
0,0 → 1,205
/*
g * Copyright 2010 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;
 
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import net.brutex.xservices.types.CompressionType;
 
import net.brutex.xservices.types.ReturnCode;
import net.brutex.xservices.types.ant.ArchiveResource;
import net.brutex.xservices.types.ant.FileResource;
import net.brutex.xservices.types.ant.FileSetResource;
import net.brutex.xservices.util.BrutexNamespaces;
 
 
/**
* Archiving related web service.
*
* @author Brian Rosenberger, bru@brutex.de
* @since 0.4.0
*/
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES)
public interface ArchiveService {
 
final String WS_OPERATION_BZIP2 = "bzip2";
final String WS_OPERATION_BZIP2_ARCHIVE = "bzip2FromArchive";
final String WS_OPERATION_GZIP = "gzip";
final String WS_OPERATION_GZIP_ARCHIVE = "gzipFromArchive";
final String WS_OPERATION_UNZIP = "unzip";
final String WS_OPERATION_GUNZIP = "gunzip";
final String WS_OPERATION_BUNZIP2 = "bunzip2";
final String WS_PARAM_SOURCEFILE = "source";
final String WS_PARAM_SOURCEFILE_STRING = "srcfile";
final String WS_PARAM_SOURCEURL = "srcurl";
final String WS_PARAM_SOURCEARCHIVE = "archivesource";
final String WS_PARAM_DESTFILE = "destfile";
final String WS_PARAM_DESTDIR = "destdir";
final String WS_PARAM_ENCODING = "encoding";
final String WS_PARAM_OVERWRITE = "overwrite";
final String WS_PARAM_COMPRESS = "compresslevel";
 
/**
* @param src
* @param file
* @return
* @throws XServicesFault
*/
@WebMethod(operationName = WS_OPERATION_BZIP2, action = WS_OPERATION_BZIP2)
public ReturnCode bzip2(@WebParam(name = WS_PARAM_SOURCEFILE) FileResource src,
@WebParam(name = WS_PARAM_DESTFILE) String file) throws XServicesFault;
 
/**
* @param src
* @param file
* @return
* @throws XServicesFault
*/
@WebMethod(operationName = WS_OPERATION_BZIP2_ARCHIVE, action = WS_OPERATION_BZIP2_ARCHIVE)
public ReturnCode bzip2FromArchive(@WebParam(name = WS_PARAM_SOURCEARCHIVE) ArchiveResource src,
@WebParam(name = WS_PARAM_DESTFILE) String file) throws XServicesFault;
 
/**
* @param src
* @param file
* @return
* @throws XServicesFault
*/
@WebMethod(operationName = WS_OPERATION_GZIP, action = WS_OPERATION_GZIP)
public ReturnCode gzip(@WebParam(name = WS_PARAM_SOURCEFILE) FileResource src,
@WebParam(name = WS_PARAM_DESTFILE) String file) throws XServicesFault;
 
/**
* @param src
* @param file
* @return
* @throws XServicesFault
*/
@WebMethod(operationName = WS_OPERATION_GZIP_ARCHIVE, action = WS_OPERATION_GZIP_ARCHIVE)
public ReturnCode gzipFromArchive(@WebParam(name = WS_PARAM_SOURCEARCHIVE) ArchiveResource src,
@WebParam(name = WS_PARAM_DESTFILE) String file) throws XServicesFault;
 
/**
* @param src
* @param dest
* @return
* @throws XServicesFault
*/
@WebMethod(operationName = WS_OPERATION_GUNZIP, action = WS_OPERATION_GUNZIP)
public ReturnCode gunzip(@WebParam(name = WS_PARAM_SOURCEFILE_STRING) String src,
@WebParam(name = WS_PARAM_DESTDIR) String dest) throws XServicesFault;
 
/**
* @param src
* @param dest
* @return
* @throws XServicesFault
*/
@WebMethod(operationName = WS_OPERATION_BUNZIP2)
public ReturnCode bunzip2(@WebParam(name = WS_PARAM_SOURCEFILE_STRING) String src,
@WebParam(name = WS_PARAM_DESTDIR) String dest) throws XServicesFault;
 
/**
* @param src
* @param dest
* @return
* @throws XServicesFault
*/
@WebMethod(operationName = "gunzipFromURL")
public ReturnCode gunzipFromURL(@WebParam(name = WS_PARAM_SOURCEURL) String src,
@WebParam(name = WS_PARAM_DESTDIR) String dest) throws XServicesFault;
 
/**
* @param src
* @param dest
* @return
* @throws XServicesFault
*/
@WebMethod(operationName = "bunzip2FromURL")
public ReturnCode bunzip2FromURL(@WebParam(name = WS_PARAM_SOURCEURL) String src,
@WebParam(name = WS_PARAM_DESTDIR) String dest) throws XServicesFault;
 
/**
* @param src
* @param file
* @param overwrite
* @param encoding
* @param level
* @return
* @throws XServicesFault
*/
@WebMethod(operationName = "zip")
public ReturnCode zip(@WebParam(name = WS_PARAM_SOURCEFILE) FileResource src,
@WebParam(name = WS_PARAM_DESTFILE) String file,
@WebParam(name = WS_PARAM_OVERWRITE) boolean overwrite,
@WebParam(name = WS_PARAM_ENCODING) String encoding,
@WebParam(name = WS_PARAM_COMPRESS) int level) throws XServicesFault;
 
/**
* @param src
* @param file
* @param update
* @param encoding
* @param level
* @return
* @throws XServicesFault
*/
@WebMethod(operationName = "zipFromArchive")
public ReturnCode zipFromArchive(@WebParam(name = WS_PARAM_SOURCEARCHIVE) ArchiveResource src,
@WebParam(name = WS_PARAM_DESTFILE) String file,
@WebParam(name = WS_PARAM_OVERWRITE) boolean update,
@WebParam(name = WS_PARAM_ENCODING) String encoding,
@WebParam(name = "compresslevel") int level) throws XServicesFault;
 
/**
* @param src
* @param dest
* @param overwrite
* @param encoding
* @return
* @throws XServicesFault
*/
@WebMethod(operationName = "unzip")
public ReturnCode unzip(@WebParam(name = WS_PARAM_SOURCEFILE_STRING) String src,
@WebParam(name = WS_PARAM_DESTDIR) String dest,
@WebParam(name = WS_PARAM_OVERWRITE) boolean overwrite,
@WebParam(name = WS_PARAM_ENCODING) String encoding) throws XServicesFault;
 
/**
* @param src
* @param dest
* @return
* @throws XServicesFault
*/
@WebMethod(operationName = "unrar")
public ReturnCode unrar(@WebParam(name = WS_PARAM_SOURCEFILE_STRING) String src,
@WebParam(name = WS_PARAM_DESTDIR) String dest) throws XServicesFault;
 
/**
* @param src
* @param dest
* @param overwrite
* @param compression
* @return
* @throws XServicesFault
*/
@WebMethod(operationName = "untar")
public ReturnCode untar(@WebParam(name = WS_PARAM_SOURCEFILE_STRING) String src,
@WebParam(name = WS_PARAM_DESTDIR) String dest,
@WebParam(name = WS_PARAM_OVERWRITE) boolean overwrite,
@WebParam(name = "compression") CompressionType compression) throws XServicesFault;
}
/xservices/trunk/src/main/java/net/brutex/xservices/ws/FileService.java
0,0 → 1,255
/*
* Copyright 2010 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;
 
import java.util.List;
 
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlElement;
 
import org.apache.cxf.annotations.WSDLDocumentation;
import org.apache.cxf.annotations.WSDLDocumentationCollection;
 
import net.brutex.xservices.types.ReplacePattern;
import net.brutex.xservices.types.ReturnCode;
import net.brutex.xservices.types.ant.ArchiveResource;
import net.brutex.xservices.types.ant.AttachmentType;
import net.brutex.xservices.types.ant.FileResource;
import net.brutex.xservices.types.ant.FileSetResource;
import net.brutex.xservices.util.BrutexNamespaces;
import net.brutex.xservices.util.XServicesDocumentation;
/**
* File related web service operations.
*
* @author Brian Rosenberger
* @since 0.3.0
*
*/
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES)
@WSDLDocumentationCollection(
{
@WSDLDocumentation(value = BrutexNamespaces.BRUTEX_COPYRIGHT, placement = WSDLDocumentation.Placement.TOP)
}
)
public interface FileService {
 
final String OPERATION_BASENAME ="basename";
final String OPERATION_DOWNLOADFILE ="downloadFile";
final String OPERATION_UPLOADFILE ="uploadFile";
final String OPERATION_COPY ="copy";
final String OPERATION_COPYFILE ="copyFile";
final String OPERATION_LOADRESOURCE = "loadResource";
final String OPERATION_LOADRESOURCEFROMARCHIVE = "loadResourceFromArchive";
final String OPERATION_ECHOTOFILE = "echoToFile";
final String OPERATION_CHANGEOWNER = "changeOwner";
final String OPERATION_CHANGEMODE = "changeMode";
final String OPERATION_CHANGEGROUP = "changeGroup";
final String OPERATION_REPLACEINFILE = "replaceInFile";
final String OPERATION_REPLACEINFILE2 = "replaceInFile2";
final String OPERATION_REPLACEINFILEREGEX = "replaceInFileRegEx";
final String PARAM_FILE = "file";
final String PARAM_ENCODING = "encoding";
final String PARAM_OVERRIDE = "override";
/**
* @param filename
* @param suffix
* @return The base name of the given file excluding the suffix.
*/
@WSDLDocumentation(value = "The base name of the given file excluding the suffix.")
@WebMethod(operationName = OPERATION_BASENAME)
public abstract String basename(
@WebParam(name = PARAM_FILE) @XmlElement(required=true) String filename,
@WebParam(name = "suffix") String suffix);
 
/**
* @param res
* @return The file itself (MTOM attachment or inline base64) including some file metadata.
* @throws XServicesFault
*/
@WSDLDocumentation(XServicesDocumentation.SERVICE_OPERATION_DOWNLOADFILE)
@WebMethod(operationName = OPERATION_DOWNLOADFILE)
public abstract AttachmentType downloadFile(
@WebParam(name = FileResource.XML_NAME) FileResource res) throws XServicesFault;
/**
* @param file
* @return The file name of the file that has been uploaded.
* @throws XServicesFault
*/
@WSDLDocumentation(XServicesDocumentation.SERVICE_OPERATION_UPLOADFILE)
@WebMethod(operationName = OPERATION_UPLOADFILE)
public abstract String uploadFile(
@WebParam(name = PARAM_FILE) AttachmentType file) throws XServicesFault;
/**
* @param src
* @param todir
* @param plm
* @param overwrite
* @param encoding
* @return
* @throws XServicesFault
*/
@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_COPY)
@WebMethod(operationName = OPERATION_COPY)
public abstract ReturnCode copy(
@WebParam(name = FileSetResource.XML_NAME) @XmlElement(required=true) FileSetResource src,
@WebParam(name = "todir") @XmlElement(required=true) String todir,
@WebParam(name = "preservelastmodified") boolean plm,
@WebParam(name = PARAM_OVERRIDE) boolean overwrite,
@WebParam(name = PARAM_ENCODING) String encoding) throws XServicesFault;
/**
* @param fromFile
* @param tofile
* @param overwrite
* @return
* @throws XServicesFault
*/
@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_COPYFILE)
@WebMethod(operationName = OPERATION_COPYFILE)
public abstract ReturnCode copyFile(
@WebParam(name = "fromFile") @XmlElement(required=true) String fromFile,
@WebParam(name = "toFile") @XmlElement(required=true) String tofile,
@WebParam(name = PARAM_OVERRIDE) boolean overwrite) throws XServicesFault;
 
/**
* @param res
* @param encoding
* @return content of the resource
* @throws XServicesFault
*/
@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_LOADRESOURCE)
@WebMethod(operationName = OPERATION_LOADRESOURCE)
public abstract String loadRes(
@WebParam(name = FileResource.XML_NAME) FileResource res,
@WebParam(name = PARAM_ENCODING) String encoding) throws XServicesFault;
 
/**
* @param res
* @param encoding
* @return content of the resource
* @throws XServicesFault
*/
@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_LOADRESOURCEFROMARCHIVE)
@WebMethod(operationName = OPERATION_LOADRESOURCEFROMARCHIVE)
public abstract String loadResFromArchive(
@WebParam(name = "archiveresource") ArchiveResource res,
@WebParam(name = PARAM_ENCODING) String encoding) throws XServicesFault;
 
/**
* @param message
* @param file
* @param encoding
* @param append
* @param create
* @return
* @throws XServicesFault
*/
@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_ECHOTOFILE)
@WebMethod(operationName = OPERATION_ECHOTOFILE)
public abstract ReturnCode echo2file(
@WebParam(name = "message") @XmlElement(required=true) String message,
@WebParam(name = PARAM_FILE) @XmlElement(required=true) String file,
@WebParam(name = PARAM_ENCODING) String encoding,
@WebParam(name = "append") boolean append,
@WebParam(name = "create") boolean create) throws XServicesFault;
 
/**
* Changes the owner of a file or all files inside specified directories.
* Right now it has effect only under Unix/ Linux as it is implemented through
* the 'chown' command.
*
* @param res Collection of files/ directories
* @param owner Identifier of the new owner
* @return
*/
@WebMethod(operationName = OPERATION_CHANGEOWNER)
public abstract ReturnCode changeOwner(
@WebParam(name = FileSetResource.XML_NAME) FileSetResource res,
@WebParam(name = "owner") @XmlElement(required=true) String owner);
 
/**
* Changes the group owner of a file or all files inside specified directories.
* Right now it has effect only under Unix/ Linux as it is implemented through
* the 'chgrp' command.
*
* @param res Collection of files/ directories
* @param group Identifier of the new group owner
* @return
*/
@WebMethod(operationName = OPERATION_CHANGEGROUP)
public abstract ReturnCode changeGroup(
@WebParam(name = FileSetResource.XML_NAME) FileSetResource res,
@WebParam(name = "group") @XmlElement(required=true) String group);
 
/**
* @param res
* @param perm
* @return
*/
@WebMethod(operationName = OPERATION_CHANGEMODE)
public abstract ReturnCode changeMode(
@WebParam(name = FileSetResource.XML_NAME) FileSetResource res,
@WebParam(name = "permissions") @XmlElement(required=true) String perm);
/**
* @param res
* @param search
* @param replace
* @return
* @throws XServicesFault
*/
@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILE)
@WebMethod(operationName = OPERATION_REPLACEINFILE)
public abstract ReturnCode replaceInFile(
@WebParam(name = FileResource.XML_NAME) @XmlElement(required=true) FileResource res,
@WebParam(name = "search") @XmlElement(required=true) String search,
@WebParam(name = "replace") @XmlElement(required=true) String replace) throws XServicesFault;
/**
* @param res
* @param patternList
* @return
* @throws XServicesFault
*/
@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILE2)
@WebMethod(operationName = OPERATION_REPLACEINFILE2)
public abstract ReturnCode replaceInFile2(
@WebParam(name = FileResource.XML_NAME) FileResource res,
@WebParam(name = "patternList") List<ReplacePattern> patternList) throws XServicesFault;
/**
* @param res
* @param search
* @param replace
* @param flags
* @return
* @throws XServicesFault
*/
@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILEREGEX)
@WebMethod(operationName = OPERATION_REPLACEINFILEREGEX)
public abstract ReturnCode replaceInFileRegEx(
@WebParam(name = FileResource.XML_NAME) FileResource res,
@WebParam(name = "search") String search,
@WebParam(name = "replace") String replace,
@WebParam(name = "flags") String flags) throws XServicesFault;
}
/xservices/trunk/src/main/java/net/brutex/xservices/ws/JobService.java
0,0 → 1,97
/*
* Copyright 2011 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;
 
import java.util.List;
 
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlElement;
 
import net.brutex.xservices.types.ScheduledJob;
import net.brutex.xservices.util.BrutexNamespaces;
 
import org.apache.cxf.annotations.WSDLDocumentation;
 
/**
* Job management services.
* @author Brian Rosenberger
* @since 0.5.0
*
*/
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES)
public interface JobService {
public static final String SERVICE_NAME = "JobService";
final String OPERATION_GETJOBLIST = "getJobs";
final String OPERATION_SCHEDULEJOB = "scheduleJob";
final String OPERATION_GETJOB = "getJob";
final String OPERATION_DELETEJOB = "deleteJob";
final String PARAM_JOB = "job";
/**
* Get a full list of all scheduled jobs.
*
* @return List of scheduled jobs
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_GETJOBLIST)
@WSDLDocumentation(value="Get list of scheduled jobs")
public abstract List<ScheduledJob> getJobList() throws XServicesFault;
/**
* Add a job to the scheduler.
*
* @param job
* @return The unique identifier of the job.
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_SCHEDULEJOB)
@WSDLDocumentation(value="Schedule a job")
public abstract String scheduleJob(
@WebParam(name=PARAM_JOB) @XmlElement(required=true) ScheduledJob job)
throws XServicesFault;
/**
* Get a job by id.
*
* @param uuid
* @return Job details
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_GETJOB)
@WSDLDocumentation(value="Get a job by id")
public abstract ScheduledJob getJob(
@WebParam(name="id") @XmlElement(required=true) String uuid) throws XServicesFault;
/**
* Delete a job from scheduler.
*
* @param uuid Id of the job that should be deleted
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_DELETEJOB)
@WSDLDocumentation(value="Delete a scheduled job.")
public abstract void deleteJob(
@WebParam(name="id") @XmlElement(required=true) String uuid) throws XServicesFault;
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/MiscService.java
0,0 → 1,63
/*
* 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;
 
import javax.jws.WebMethod;
import javax.jws.WebParam;
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 org.apache.cxf.aegis.type.java5.XmlElement;
import org.apache.cxf.aegis.type.java5.XmlReturnType;
import org.apache.cxf.annotations.WSDLDocumentation;
 
/**
* Bundles various methods
*
* @author Brian Rosenberger, bru@brutex.de
* @since 0.4.0
*/
@WebService(targetNamespace = net.brutex.xservices.util.BrutexNamespaces.WS_XSERVICES)
@WSDLDocumentation("Various service operations.")
public interface MiscService {
 
public static final String OPERATION_GETMEMORY = "getMemory";
 
@WebMethod(operationName="getHostinfo")
@WSDLDocumentation("Get information about a host.")
public abstract HostinfoType getHostinfo(@WebParam(name="hostname") @XmlElement(minOccurs="1", nillable=false) String paramString);
 
@WebMethod(operationName="sleep")
@WSDLDocumentation("Delay request response a specified duration.")
public abstract ReturnCode sleep(@WebParam(name="minutes") int paramInt1, @WebParam(name="seconds") int paramInt2);
 
@WebMethod(operationName="getInfo")
@WSDLDocumentation("Get XService information.")
public abstract ReturnCode getInfo();
 
@WebMethod(operationName="generateUUID")
@WSDLDocumentation("Generate a UUID.")
public abstract String generateUUID();
 
@WebMethod(operationName="getMemory")
@WSDLDocumentation("Get memory and processor information")
public abstract RuntimeInfoType getMemory();
}
/xservices/trunk/src/main/java/net/brutex/xservices/ws/MailService.java
0,0 → 1,123
/*
* Copyright 2012 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;
 
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlElement;
 
import net.brutex.xservices.types.HostConnection;
import net.brutex.xservices.types.MailMimeType;
import net.brutex.xservices.types.ReturnCode;
import net.brutex.xservices.types.ant.FileSetResource;
import net.brutex.xservices.util.BrutexNamespaces;
 
import org.apache.cxf.annotations.WSDLDocumentation;
 
/**
* Bundles various method for sending and receiving mails
*
* @author Brian Rosenberger, bru@brutex.de
* @since 2.0.0
*/
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES)
@WSDLDocumentation("Various mail service operations.")
public interface MailService {
 
final String PARAM_SMTPHOST = "mailhost";
final String PARAM_SENDER = "from";
final String PARAM_RECEIVER = "to";
final String PARAM_SUBJECT = "subject";
final String PARAM_MESSAGE = "message";
final String PARAM_ATTACHMENTS = "attachments";
/**
* Simple mail send operation with sender, single receiver, subject and message.
*
* @param mailhost connection details for the SMTP server to use
* @param from mail address to be used as sender
* @param tolist mail address of the receiver
* @param subject subject of the mail
* @param message mail body
* @return ReturnCode
*/
@WebMethod(operationName = "sendMailSimple")
@WSDLDocumentation(value = "Send an email (simple).")
public ReturnCode sendMailSimple(
@WebParam(name = PARAM_SMTPHOST) @XmlElement(required=true, nillable=false) HostConnection mailhost,
@WebParam(name = PARAM_SENDER) @XmlElement(required=true) String from,
@WebParam(name = PARAM_RECEIVER) @XmlElement(required=true, nillable=false) String tolist,
@WebParam(name = PARAM_SUBJECT) String subject,
@WebParam(name = PARAM_MESSAGE) String message);
 
/**
* Simple mail send operation with sender, single receiver, subject and message
* including support for file attachments.
*
* @param mailhost connection details for the SMTP server to use
* @param from mail address to be used as sender
* @param tolist mail address of the receiver
* @param subject subject of the mail
* @param message mail body
* @param res attachments
* @return ReturnCode
*/
@WebMethod(operationName = "sendMailSimpleWithAttachment")
@WSDLDocumentation(value = "Send an email with attachment (simple).")
public ReturnCode sendMailSimpleWithAttachment(
@WebParam(name = PARAM_SMTPHOST) @XmlElement(required=true, nillable=false) HostConnection mailhost,
@WebParam(name = PARAM_SENDER) @XmlElement(required=true, nillable=false) String from,
@WebParam(name = PARAM_RECEIVER) @XmlElement(required=true, nillable=false) String tolist,
@WebParam(name = PARAM_SUBJECT) String subject,
@WebParam(name = PARAM_MESSAGE) String message,
@WebParam(name = PARAM_ATTACHMENTS) FileSetResource res);
 
/**
* Send email with a lot of options
*
* @param mailhost connection details for the SMTP server to use
* @param from mail address to be used as sender
* @param tolist mail address of the receiver
* @param cclist mail carbon copy receiver
* @param bcclist mail blind carbon copy receiver
* @param subject subject of the mail
* @param mimetype message MIME type (i.e. text/plain)
* @param charset character set to use (i.e. utf-8, iso-8859-15)
* @param message mail body
* @param res attachments
* @param ssl use SSL
* @param tls use TLS
* @return ReturnCode
*/
@WebMethod(operationName = "sendMail")
@WSDLDocumentation(value = "Send an email (advanced).")
public ReturnCode sendMail(
@WebParam(name = PARAM_SMTPHOST) @XmlElement(required=true, nillable=false) HostConnection mailhost,
@WebParam(name = PARAM_SENDER) @XmlElement(required=true, nillable=false) String from,
@WebParam(name = PARAM_RECEIVER) @XmlElement(required=true, nillable=false) String tolist,
@WebParam(name = "cc") String cclist,
@WebParam(name = "bcc") String bcclist,
@WebParam(name = PARAM_SUBJECT) String subject,
@WebParam(name = "mimetype") MailMimeType mimetype,
@WebParam(name = "charset") String charset,
@WebParam(name = PARAM_MESSAGE) String message,
@WebParam(name = PARAM_ATTACHMENTS) FileSetResource res,
@WebParam(name = "useSSL") boolean ssl,
@WebParam(name = "useStartTLS") boolean tls);
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/XServicesFault.java
0,0 → 1,99
/*
* Copyright 2010 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;
 
import java.util.GregorianCalendar;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.ws.WebFault;
 
import net.brutex.xservices.util.BrutexNamespaces;
 
/**
* Generic web service fault.
*
* @author Brian Rosenberger, bru@brutex.de
* since 0.4.0
*/
@WebFault(targetNamespace=BrutexNamespaces.WS_XSERVICES)
public class XServicesFault extends Exception {
 
/**
*
*/
private static final long serialVersionUID = -6779279189376374820L;
 
public XServicesFault(String message, Exception e) {
this(message, e.getCause());
}
 
public XServicesFault(String string) {
this(string, new Exception(string).getCause());
}
 
public XServicesFault(Exception e) {
this(e.getMessage(), e.getCause());
}
 
public XServicesFault(String message, Throwable cause) {
super(message, cause);
this.faultstring=message;
 
try {
timestamp = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
} catch (DatatypeConfigurationException ex) {
System.err.println(ex.getMessage());
}
 
 
}
/**
* The error message.
*/
@XmlElement(name="faultstring", namespace=BrutexNamespaces.WS_XSERVICES)
public String faultstring = "";
 
/**
* Username under which the web service has been executed.
*/
@XmlElement(name="username", namespace=BrutexNamespaces.WS_XSERVICES)
public String username = System.getProperty("user.name");
 
/**
* Home directory of the user profile running the web service.
*/
@XmlElement(name="homedir", namespace=BrutexNamespaces.WS_XSERVICES)
public String homedir = System.getProperty("user.home");
 
/**
* Timestamp when the fault was thrown.
*/
@XmlElement(name="timstamp", namespace=BrutexNamespaces.WS_XSERVICES)
public XMLGregorianCalendar timestamp = null;
/**
* Java runtime version.
*/
@XmlElement(name="jvmversion")
public String jvmruntime = System.getProperty("java.version");
}
/xservices/trunk/src/main/java/net/brutex/xservices/ws/StorageService.java
0,0 → 1,84
/*
* Copyright 2011 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;
 
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import net.brutex.xservices.types.TargetNodeType;
import net.brutex.xservices.types.ant.AttachmentType;
import net.brutex.xservices.types.ant.CollectionType;
import net.brutex.xservices.util.BrutexNamespaces;
 
import org.apache.cxf.annotations.WSDLDocumentation;
 
/**
* Storage management services.
* @author Brian Rosenberger
* @since 0.5.0
*
*/
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES)
public interface StorageService {
public static final String SERVICE_NAME = "StorageService";
final String OPERATION_STORETEXT = "storeText";
final String OPERATION_STOREBINARY = "storeBinary";
final String OPERATION_CREATECOLLECTION = "createCollection";
final String OPERATION_DELIVERCOLLECTION = "deliverCollection";
final String PARAM_TEXT = "text";
final String PARAM_BINARY = "binary";
final String PARAM_NAME = "name";
final String PARAM_COLLECTION = "collection";
final String PARAM_TARGETNODE = "target";
final String PARAM_RAISEEVENT = "event";
;
/**
* Store text based data.
* @param text text to be stored
*
* @return uuid reference to stored object
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_STORETEXT)
@WSDLDocumentation(value="Store text based data")
public abstract String storeText(@WebParam(name = PARAM_TEXT) String text) throws XServicesFault;
@WebMethod(operationName=OPERATION_STOREBINARY)
@WSDLDocumentation(value="Store binary data")
public abstract String storeBinary(
@WebParam(name= PARAM_BINARY) AttachmentType binary)
throws XServicesFault;
@WebMethod(operationName=OPERATION_CREATECOLLECTION)
@WSDLDocumentation(value="Create a new Collection by name.")
public abstract String createCollection(
@WebParam(name= PARAM_COLLECTION) CollectionType collection)
throws XServicesFault;
@WebMethod(operationName=OPERATION_DELIVERCOLLECTION)
@WSDLDocumentation(value="Deliver a collection to a target node (asynchronous).")
public abstract void deliverCollection(
@WebParam(name= PARAM_COLLECTION) CollectionType collection,
@WebParam(name= PARAM_TARGETNODE) TargetNodeType targetnode,
@WebParam(name= PARAM_RAISEEVENT) boolean isFiring)
throws XServicesFault;
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/DateService.java
0,0 → 1,255
/*
* Copyright 2011 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;
 
import java.math.BigInteger;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
 
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.datatype.XMLGregorianCalendar;
 
import net.brutex.xservices.types.DateFormatType;
import net.brutex.xservices.types.DateInfoExtendedType;
import net.brutex.xservices.types.DateInfoType;
import net.brutex.xservices.types.DateTimeUnits;
import net.brutex.xservices.types.TimeZoneType;
import net.brutex.xservices.util.BrutexNamespaces;
 
 
import org.apache.cxf.annotations.WSDLDocumentation;
import org.apache.cxf.annotations.WSDLDocumentationCollection;
 
/**
* Date and time related services.
* @author Brian Rosenberger
*
*/
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES)
@WSDLDocumentationCollection(
{
@WSDLDocumentation(value = BrutexNamespaces.BRUTEX_COPYRIGHT, placement = WSDLDocumentation.Placement.TOP)
}
)
public interface DateService {
public static final String SERVICE_NAME = "DateService";
final String OPERATION_GETDATE = "getDate";
final String OPERATION_GETDATEEXTENDED = "getDateExtended";
final String OPERATION_GETTIMESTAMP = "getTimestamp";
final String OPERATION_GETTIMESTAMP2 = "getTimestamp2";
final String OPERATION_GETINTIMEZONE = "getInTimezone";
final String OPERATION_FORMATDATE = "formatDate";
final String OPERATION_FORMATDATEADVANCED = "formatDateAdvanced";
final String OPERATION_PARSEDATE = "parseDate";
final String OPERATION_PARSEDATEADVANCED = "parseDateAdvanced";
final String OPERATION_DATETIMEDIFF = "dateTimeDiff";
final String OPERATION_DATETIMEDIFF2 = "dateTimeDiff2";
final String OPERATION_DATEADD = "dateAdd";
final String OPERATION_GETTIMEZONES = "getTimezones";
final String PARAM_TIMEZONE = "timezone";
final String PARAM_DATETIME = "datetime";
final String PARAM_FORMAT = "format";
final String PARAM_UNIT = "unit";
/**
* Get current date and time.
*
* @return Current date and time.
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_GETDATE)
@WSDLDocumentation(value="Get current date and time.")
public abstract DateInfoType getDate()
throws XServicesFault;
/**
* Get current date and time (extended version).
*
* @return Current date and time.
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_GETDATEEXTENDED)
@WSDLDocumentation(value="Get current date and time in different formats.")
public abstract DateInfoExtendedType getDateExtended()
throws XServicesFault;
/**
* Get milliseconds since 01.01.1970.
*
* @return timestamp milliseconds
*/
@WebMethod(operationName=OPERATION_GETTIMESTAMP)
@WSDLDocumentation(value="Get milliseconds since 01.01.1970 (Unix timestap).")
public abstract BigInteger getTimestamp();
 
/**
* Get seconds since 01.01.1970.
*
* @return timestamp seconds
*/
@WebMethod(operationName=OPERATION_GETTIMESTAMP2)
@WSDLDocumentation(value="Get seconds since 01.01.1970 (Unix timestap).")
public abstract BigInteger getTimestamp2();
/**
* Display a date time with a different time zone.
* Changes representation only (no conversion).
*
* @param cal date time.
* @param timezone time zone
* @return date time
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_GETINTIMEZONE)
public abstract String getInTimezone(
@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) Date cal,
@WebParam(name=PARAM_TIMEZONE) @XmlElement(required=true) String timezone) throws XServicesFault;
/**
* Formats a date with pre-defined patterns.
*
* @param cal date time to be formatted in ISO8601
* @param format Pattern to be used for date formating
* @return formatted date/time string
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_FORMATDATE)
public abstract String formatDate(
@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) Date cal,
@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) DateFormatType format) throws XServicesFault;
@WebMethod(operationName=OPERATION_GETTIMEZONES)
public abstract List<TimeZoneType> getTimezones() throws XServicesFault;
/**
* Formats a date with a free form pattern.
* Uses SimpleDateFormat patterns
* The following pattern letters are defined (all other characters from 'A' to 'Z' and from 'a' to 'z' are reserved):
 
Letter Date or Time Component Presentation Examples
G Era designator Text AD
y Year Year 1996; 96
M Month in year Month July; Jul; 07
w Week in year Number 27
W Week in month Number 2
D Day in year Number 189
d Day in month Number 10
F Day of week in month Number 2
E Day in week Text Tuesday; Tue
a Am/pm marker Text PM
H Hour in day (0-23) Number 0
k Hour in day (1-24) Number 24
K Hour in am/pm (0-11) Number 0
h Hour in am/pm (1-12) Number 12
m Minute in hour Number 30
s Second in minute Number 55
S Millisecond Number 978
z Time zone General time zone Pacific Standard Time; PST; GMT-08:00
Z Time zone RFC 822 time zone -0800
* @param cal Date time to be formatted
* @param format Format string
* @return Date time formatted according to format string
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_FORMATDATEADVANCED)
public abstract String formatDateAdvanced(
@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) Date cal,
@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) String format) throws XServicesFault;
/**
* Converts a string into date using pre-defined date formats.
*
* @param s Date/ time as string
* @param format date format
* @param timezone timezone
* @return XML Date
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_PARSEDATE)
@WSDLDocumentation(value="Converts a string into date using pre-defined date formats.")
public abstract Date parseDate(
@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) String s,
@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) DateFormatType format,
@WebParam(name=PARAM_TIMEZONE) String timezone) throws XServicesFault;
/**
* Converts a string into date using any format.
* @param s date/ time as string
* @param format date format
* @param timezone timezone
* @return XML Date
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_PARSEDATEADVANCED)
public abstract GregorianCalendar parseDateAdvanced(
@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) String s,
@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) String format,
@WebParam(name=PARAM_TIMEZONE) String timezone) throws XServicesFault;
/**
* Calculate elapsed time between two dates.
* @param fromCal First date.
* @param toCal Second date.
* @return Elapsed time in milliseconds
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_DATETIMEDIFF)
public abstract BigInteger dateTimeDiff(
@WebParam(name="fromDateTime") @XmlElement(required=true) Date fromCal,
@WebParam(name="toDateTime") @XmlElement(required=true) Date toCal) throws XServicesFault;
/**
* Fully elapsed units between two dates.
* 4:15:10-4:15:55 in minutes = 0 and in seconds = 45
*
* @param fromCal
* @param toCal
* @param unit
* @return Date/time difference in unit
* @throws XServicesFault
*/
@WebMethod(operationName=OPERATION_DATETIMEDIFF2)
@WSDLDocumentation(value="Get elapsed time between to dates.")
public abstract BigInteger dateTimeDiff2(
@WebParam(name="fromDateTime") @XmlElement(required=true) Date fromCal,
@WebParam(name="toDateTime") @XmlElement(required=true) Date toCal,
@WebParam(name=PARAM_UNIT) DateTimeUnits unit) throws XServicesFault;
/**
* Add or subtract a time span from a date.
*
* @param cal The initial date.
* @param value The amount to add.
* @param unit The unit the amount is defined in.
* @return New date and time.
* @throws XServicesFault
*
*/
@WebMethod(operationName=OPERATION_DATEADD)
@WSDLDocumentation(value="Add or substract a time span from a date.")
public abstract GregorianCalendar dateAdd(
@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) GregorianCalendar cal,
@WebParam(name="value") @XmlElement(required=true) BigInteger value,
@WebParam(name=PARAM_UNIT) @XmlElement(required=true) DateTimeUnits unit) throws XServicesFault;
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/ws/ExecuteService.java
0,0 → 1,145
/*
* Copyright 2011 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;
 
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlElement;
 
import net.brutex.xservices.types.HostConnection;
import net.brutex.xservices.types.ReturnCode;
import net.brutex.xservices.util.BrutexNamespaces;
 
/**
* Task execution web service
*
* @author Brian Rosenberger
* @since 0.1.0
*
*/
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES)
public interface ExecuteService {
 
/**
* @param cmd
* @param args
* @param timeout
* @return
*/
@WebMethod(operationName = "runCommand")
public abstract ReturnCode runCommand(
@WebParam(name = "executable") String cmd,
@WebParam(name = "argline") String args,
@WebParam(name = "timeout") long timeout);
 
/**
* @param cmd
* @param args
* @param timeout
* @return
*/
@WebMethod(operationName = "runCommandWithArgs")
public abstract ReturnCode runCommandWithArgs(
@WebParam(name = "executable") String cmd,
@WebParam(name = "arg") String[] args,
@WebParam(name = "timeout") long timeout);
 
/**
* @param cmd
* @param args
* @return
*/
@WebMethod(operationName = "runCommandAsync")
public abstract ReturnCode runCommandAsync(
@WebParam(name = "executable") String cmd,
@WebParam(name = "argline") String args);
 
/**
* @param cmd
* @param args
* @return
*/
@WebMethod(operationName = "runCommandAsyncWithArgs")
public abstract ReturnCode runCommandAsyncWithArgs(
@WebParam(name = "executable") String cmd,
@WebParam(name = "arg") String[] args);
 
/**
* @param host
* @param cmd
* @param timeout
* @return
*/
@WebMethod(operationName = "runCommandWithSSH")
public abstract ReturnCode runCommandWithSSH(
@WebParam(name = "host") HostConnection host,
@WebParam(name = "command") String cmd,
@WebParam(name = "timeout") long timeout);
 
/**
* @param host
* @param keyfile
* @param cmd
* @param timeout
* @return
*/
@WebMethod(operationName = "runCommandWithSSHKeyAuth")
public abstract ReturnCode runCommandWithSSHKeyAuth(
@WebParam(name = "host") HostConnection host,
@WebParam(name = "keyfile") String keyfile,
@WebParam(name = "command") String cmd,
@WebParam(name = "timeout") long timeout);
 
/**
* @param host
* @param cmd
* @param timeout
* @return
*/
@WebMethod(operationName = "rExec")
public abstract ReturnCode rExec(
@WebParam(name = "host") HostConnection host,
@WebParam(name = "command") String cmd,
@WebParam(name = "timeout") long timeout);
 
/**
* @param host
* @param prompt
* @param cmd
* @param expect
* @param timeout
* @return
*/
@WebMethod(operationName = "telnet")
public abstract ReturnCode runTelnet(
@WebParam(name = "host") HostConnection host,
@WebParam(name = "prompt") String prompt,
@WebParam(name = "command") String cmd,
@WebParam(name = "expect") String expect,
@WebParam(name = "timeout") long timeout);
/**
* @param script
* @throws XServicesFault
*/
@WebMethod(operationName = "runJavaScript")
public abstract void runJScript(
@WebParam(name = "script") @XmlElement(required=true) String script) throws XServicesFault;
 
}
/xservices/trunk/src/main/java/net/brutex/xservices/cmtypes/ItemTypeList.java
0,0 → 1,38
/*
* Copyright 2014 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.cmtypes;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
 
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
 
@XmlRootElement
public class ItemTypeList implements Serializable {
 
/**
*
*/
private static final long serialVersionUID = 2662597594771167080L;
@XmlElement(name="ItemRevision")
public List<ItemType> list = new ArrayList<>();
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/java/net/brutex/xservices/cmtypes/ItemType.java
0,0 → 1,167
/*
* Copyright 2014 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.cmtypes;
 
import java.net.URL;
 
import javax.xml.bind.annotation.XmlType;
 
@XmlType(name="Item")
public class ItemType {
private String longFilename;
private String shortFilename;
private String dirName;
private String createdDate;
private String createdUser;
private String object_id;
private String object_uid;
private String object_spec_uid;
private String object_spec;
private String itemFormat;
private String updatedDate;
private String updatedUser;
/*
SystemAttributes.FULL_PATH_NAME,
SystemAttributes.ITEMFILE_DIR,
SystemAttributes.ITEMFILE_FILENAME,
SystemAttributes.ITEMFILE_DIR,
SystemAttributes.OBJECT_SPEC,
SystemAttributes.OBJECT_ID,
SystemAttributes.OBJECT_SPEC_UID,
SystemAttributes.OBJECT_UID,
SystemAttributes.CREATION_DATE,
SystemAttributes.CREATION_USER,
SystemAttributes.ITEM_FORMAT,
SystemAttributes.LAST_UPDATED_DATE,
SystemAttributes.LAST_UPDATED_USER
*/
public String getDirName() {
return dirName;
}
 
public void setDirName(String dirName) {
this.dirName = dirName;
}
 
public String getCreatedUser() {
return createdUser;
}
 
public void setCreatedUser(String createdUser) {
this.createdUser = createdUser;
}
 
public String getItemFormat() {
return itemFormat;
}
 
public void setItemFormat(String itemFormat) {
this.itemFormat = itemFormat;
}
 
public String getUpdatedDate() {
return updatedDate;
}
 
public void setUpdatedDate(String updatedDate) {
this.updatedDate = updatedDate;
}
 
public String getUpdatedUser() {
return updatedUser;
}
 
public void setUpdatedUser(String updatedUser) {
this.updatedUser = updatedUser;
}
 
public String getObject_uid() {
return object_uid;
}
 
public void setObject_uid(String object_uid) {
this.object_uid = object_uid;
}
 
public String getObject_spec_uid() {
return object_spec_uid;
}
 
public void setObject_spec_uid(String object_spec_uid) {
this.object_spec_uid = object_spec_uid;
}
 
public String getObject_spec() {
return object_spec;
}
 
public void setObject_spec(String object_spec) {
this.object_spec = object_spec;
}
private URL url;
public URL getUrl() {
return url;
}
public void setUrl(URL url) {
this.url = url;
}
public String getObject_id() {
return object_id;
}
public void setObject_id(String object_id) {
this.object_id = object_id;
}
public String getLongFilename() {
return longFilename;
}
public void setLongFilename(String longFilename) {
this.longFilename = longFilename;
}
public String getShortFilename() {
return shortFilename;
}
public void setShortFilename(String shortFilename) {
this.shortFilename = shortFilename;
}
 
public String getCreatedDate() {
return createdDate;
}
public void setCreatedDate(String createdDate) {
this.createdDate = createdDate;
}
 
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append(longFilename);
sb.append(";");
sb.append(" (");
sb.append(shortFilename);
sb.append("), related as ");
sb.append(", created at ");
sb.append(createdDate);
return sb.toString();
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/resources/cache.ccf
0,0 → 1,51
# DEFAULT CACHE REGION
jcs.default=DC
jcs.default.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=1000
jcs.default.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache
 
# AVAILABLE AUXILIARY CACHES
jcs.auxiliary.DC=org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DC.attributes=org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
jcs.auxiliary.DC.attributes.DiskPath=${user.dir}/jcs_swap
jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000000
jcs.auxiliary.DC.attributes.MaxKeySize=1000000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC.attributes.ShutdownSpoolTimeLimit=60
 
# PRE-DEFINED CACHE REGIONS
jcs.region.FileCache=DC
jcs.region.FileCache.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.FileCache.cacheattributes.MaxObjects=1000
jcs.region.FileCache.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache
jcs.region.FileCache.cacheattributes.UseMemoryShrinker=false
jcs.region.FileCache.cacheattributes.MaxMemoryIdleTimeSeconds=3600
jcs.region.FileCache.cacheattributes.ShrinkerIntervalSeconds=60
jcs.region.FileCache.cacheattributes.MaxSpoolPerRun=500
jcs.region.FileCache.elementattributes=org.apache.commons.jcs.engine.ElementAttributes
jcs.region.FileCache.elementattributes.IsEternal=false
 
jcs.region.CVSCache=DC
jcs.region.CVSCache.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.CVSCache.cacheattributes.MaxObjects=50
jcs.region.CVSCache.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache
jcs.region.CVSCache.cacheattributes.UseMemoryShrinker=true
jcs.region.CVSCache.cacheattributes.MaxMemoryIdleTimeSeconds=3600
jcs.region.CVSCache.cacheattributes.ShrinkerIntervalSeconds=60
jcs.region.CVSCache.cacheattributes.MaxSpoolPerRun=5
jcs.region.CVSCache.elementattributes=org.apache.commons.jcs.engine.ElementAttributes
jcs.region.CVSCache.elementattributes.IsEternal=false
 
jcs.region.DIMCM=DC
jcs.region.DIMCM.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.DIMCM.cacheattributes.MaxObjects=50
jcs.region.DIMCM.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache
jcs.region.DIMCM.cacheattributes.UseMemoryShrinker=true
jcs.region.DIMCM.cacheattributes.MaxMemoryIdleTimeSeconds=3600
jcs.region.DIMCM.cacheattributes.ShrinkerIntervalSeconds=60
jcs.region.DIMCM.cacheattributes.MaxSpoolPerRun=5
jcs.region.DIMCM.elementattributes=org.apache.commons.jcs.engine.ElementAttributes
jcs.region.DIMCM.elementattributes.IsEternal=false
 
 
 
/xservices/trunk/src/main/resources/log4j.properties
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
 
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/resources/log4j2.xml
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>
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/resources/quartz.properties
0,0 → 1,17
org.quartz.scheduler.instanceName = XServicesScheduler
org.quartz.threadPool.threadCount = 3
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
#org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
#org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.CloudscapeDelegate
#org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
#org.quartz.jobStore.dataSource = QUARTZ
 
#org.quartz.dataSource.QUARTZ.driver = org.hsqldb.jdbcDriver
#org.quartz.dataSource.QUARTZ.URL = jdbc:hsqldb:file:quartz_store;shutdown=true;
#org.quartz.dataSource.QUARTZ.user = sa
#org.quartz.dataSource.QUARTZ.connectionProvider.class = net.brutex.xservices.util.BrutexQuartzConnectionProvider
 
#String url = “jdbc:hsqldb:file:/path/to/database/file”;
#String user = “sa”;
#String password = “”;
#Connection c = DriverManager.getConnection(url, user, password);
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/webapp/LICENSE.H2
0,0 → 1,6
This software contains unmodified binary redistributions for
H2 database engine (https://h2database.com/),
which is dual licensed and available under the MPL 2.0
(Mozilla Public License) or under the EPL 1.0 (Eclipse Public License).
An original copy of the license agreement can be found at:
https://h2database.com/html/license.html
/xservices/trunk/src/main/webapp/WEB-INF/web.xml
0,0 → 1,128
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
 
<context-param>
<param-name>log4jConfiguration</param-name>
<param-value>/WEB-INF/log4j2.xml</param-value>
</context-param>
<context-param>
<param-name>shiroConfigLocations</param-name>
<param-value>/WEB-INF/shiro.ini</param-value>
</context-param>
<context-param>
<param-name>quartz:config-file</param-name>
<param-value>quartz.properties</param-value>
</context-param>
<context-param>
<param-name>quartz:shutdown-on-unload</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>quartz:wait-on-shutdown</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>quartz:start-scheduler-on-load</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>cache:thread-count</param-name>
<param-value>3</param-value>
</context-param>
 
<!-- <context-param> <param-name>cvs-config-02</param-name> <param-value>c:/temp/test2.txt</param-value>
</context-param> <context-param> <param-name>cvs-config-01</param-name> <param-value>c:/temp/test.txt</param-value>
</context-param> <context-param> <param-name>cvs-config-03</param-name> <param-value>c:/temp/test3.txt</param-value>
</context-param> -->
 
<!-- Caching interval in minutes for CVS cache -->
<context-param>
<param-name>cvs-cache-interval</param-name>
<param-value>3</param-value>
</context-param>
 
<!-- CVS content search cache -->
<!-- <context-param> <param-name>cvs-findings-configuration</param-name>
<param-value>c:/temp/cvs-findings.txt</param-value> </context-param> -->
 
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.quartz.ee.servlet.QuartzInitializerListener</listener-class>
</listener>
<listener>
<listener-class>net.brutex.xservices.util.cache.CacheExecutorService</listener-class>
</listener>
 
 
<servlet>
<servlet-name>XServices</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<!-- <init-param>
<param-name>config-location</param-name>
<param-value>/WEB-INF/cxf-servlet.xml</param-value>
</init-param>
-->
<init-param>
<param-name>hide-service-list-page</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>QuartzInitializer</servlet-name>
<servlet-class>org.quartz.ee.servlet.QuartzInitializerServlet</servlet-class>
<init-param>
<param-name>shutdown-on-unload</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>CacheServlet</servlet-name>
<servlet-class>net.brutex.xservices.util.cache.CacheServlet</servlet-class>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet>
<servlet-name>FindingsCacheServlet</servlet-name>
<servlet-class>net.brutex.xservices.util.cache.FindingsCacheServlet</servlet-class>
<load-on-startup>3</load-on-startup>
</servlet>
 
<servlet-mapping>
<servlet-name>XServices</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
 
<!-- Shiro -->
<listener>
<listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
</listener>
 
<filter>
<filter-name>ShiroFilter</filter-name>
<filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
</filter>
 
<filter-mapping>
<filter-name>ShiroFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
<!-- Shiro -->
</web-app>
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/webapp/WEB-INF/applicationContext.xml
0,0 → 1,104
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
 
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<jaxws:endpoint id="archiveservice"
implementor="net.brutex.xservices.ws.impl.ArchiveServiceImpl" address="/ArchiveService">
</jaxws:endpoint>
 
<jaxws:endpoint id="dateservice"
implementor="net.brutex.xservices.ws.impl.DateServiceImpl" address="/DateService">
</jaxws:endpoint>
 
<jaxws:endpoint id="fileservice"
implementor="net.brutex.xservices.ws.impl.FileServiceImpl" address="/FileService">
<jaxws:properties>
<entry key="mtom-enabled" value="false" />
</jaxws:properties>
</jaxws:endpoint>
 
<!-- This is the MTOM enabled FileServices endpoint -->
<jaxws:endpoint id="fileservice2"
implementor="net.brutex.xservices.ws.impl.FileServiceImpl" address="/FileServiceMTOM">
<jaxws:properties>
<entry key="mtom-enabled" value="true" />
<entry key="attachment-directory" value="c:\temp" />
<entry key="attachment-memory-threshold" value="2000" />
</jaxws:properties>
</jaxws:endpoint>
 
 
<jaxws:endpoint id="executeservice"
implementor="net.brutex.xservices.ws.impl.ExecuteServiceImpl" address="/ExecuteService">
</jaxws:endpoint>
 
<jaxws:endpoint id="jobservice"
implementor="net.brutex.xservices.ws.impl.JobServiceImpl" address="/JobService">
</jaxws:endpoint>
 
<jaxws:endpoint id="mailservice"
implementor="net.brutex.xservices.ws.impl.MailServiceImpl" address="/MailService">
</jaxws:endpoint>
 
<jaxws:endpoint id="miscservice"
implementor="net.brutex.xservices.ws.impl.MiscServiceImpl" address="/MiscService">
</jaxws:endpoint>
 
<jaxws:endpoint id="stringservice"
implementor="net.brutex.xservices.ws.impl.StringServiceImpl" address="/StringService">
</jaxws:endpoint>
 
<jaxws:endpoint id="storageservice"
implementor="net.brutex.xservices.ws.impl.StorageServiceImpl" address="/StorageService">
</jaxws:endpoint>
 
<jaxws:endpoint id="storageservice2"
implementor="net.brutex.xservices.ws.impl.StorageServiceImpl" address="/StorageServiceMTOM">
<jaxws:properties>
<entry key="mtom-enabled" value="true" />
<entry key="attachment-directory" value="c:\temp" />
<entry key="attachment-memory-threshold" value="2000" />
</jaxws:properties>
</jaxws:endpoint>
 
<jaxws:endpoint id="xmlservice"
implementor="net.brutex.xservices.ws.impl.XmlServiceImpl" address="/XmlService">
</jaxws:endpoint>
 
 
<jaxrs:server id="FileInfo" address="/fileinfo">
<jaxrs:serviceBeans>
<ref bean="FileInfoBean" />
</jaxrs:serviceBeans>
</jaxrs:server>
<bean id="FileInfoBean" class="net.brutex.xservices.ws.rs.FileInfoImpl" />
 
 
 
<jaxrs:server id="CVSInfo" address="/cvsinfo">
<jaxrs:serviceBeans>
<ref bean="CVSInfoBean" />
</jaxrs:serviceBeans>
</jaxrs:server>
<bean id="CVSInfoBean" class="net.brutex.xservices.ws.rs.CVSInfoImpl" />
<!--
<jaxrs:server id="DIMCMInfo" address="/dimcminfo">
<jaxrs:serviceBeans>
<ref bean="DIMCMInfoBean" />
</jaxrs:serviceBeans>
</jaxrs:server>
<bean id="DIMCMInfoBean" class="net.brutex.xservices.ws.rs.DIMCMInfoImpl" />
-->
 
</beans>
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/webapp/WEB-INF/log4j2.xml
0,0 → 1,26
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<RollingFile name="XSERVICES" fileName="c:/temp/xservices.log"
filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout>
<Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="10 MB"/>
</Policies>
</RollingFile>
</Appenders>
<Loggers>
<Logger name="net.brutex.xservices" level="debug" additivity="false">
<AppenderRef ref="XSERVICES"/>
</Logger>
<Logger name="org.springframework.web" level="debug">
<AppenderRef ref="XSERVICES"/>
</Logger>
</Loggers>
</Configuration>
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/webapp/WEB-INF/shiro.ini
0,0 → 1,68
# =======================
# Shiro INI configuration
# =======================
 
[main]
# Objects and their properties are defined here,
# Such as the securityManager, Realms and anything
# else needed to build the SecurityManager
 
realm = net.brutex.xservices.security.XServicesRealm
securityManager.realms = $realm
 
authcBasic = org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter
 
[users]
# The 'users' section is for simple deployments
# when you only need a small number of statically-defined
# set of User accounts.
# Format: user = password, role1, role2, ...
 
admin = , Administrator
brian = brian, Administrator
 
 
[roles]
# The 'roles' section is for simple deployments
# when you only need a small number of statically-defined
# roles.
 
#Administrator = c:/t*/*, c:/windows/*, d:/**/VIDEO, C:/Users/brosenberger/**, d:/data/**, c:/**
Administrator = FileInfoService||c:/temp/**, XmlService||test
 
[urls]
# The 'urls' section is used for url-based security
# in web applications. We'll discuss this section in the
# Web documentation
 
/ArchiveService = anon
/DateService = anon
/ExecuteService = anon
/FileService = anon
/JobService = anon
/MailService = anon
/MiscService = anon
/StorageService = anon
/StringService = anon
/XmlService = anon
 
 
/fileinfo/** = authcBasic
/dimcminfo/** = anon
 
/** = authcBasic
#/** = anon
 
#Default filters
#Filter Name Class
#anon org.apache.shiro.web.filter.authc.AnonymousFilter
#authc org.apache.shiro.web.filter.authc.FormAuthenticationFilter
#authcBasic org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter
#logout org.apache.shiro.web.filter.authc.LogoutFilter
#noSessionCreation org.apache.shiro.web.filter.session.NoSessionCreationFilter
#perms org.apache.shiro.web.filter.authz.PermissionsAuthorizationFilter
#port org.apache.shiro.web.filter.authz.PortFilter
#rest org.apache.shiro.web.filter.authz.HttpMethodPermissionFilter
#roles org.apache.shiro.web.filter.authz.RolesAuthorizationFilter
#ssl org.apache.shiro.web.filter.authz.SslFilter
#user org.apache.shiro.web.filter.authc.UserFilter
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/webapp/WEB-INF/dimcm.properties
0,0 → 1,9
#This is an example config file
 
user=dmsys
password=yourpassword
dbname=cm_typical
dbconn=DIM14
server=cepoc01.cloudapp.net\:671
 
baseurl=http\://cepoc01.cloudapp.net\:8080/dimensions
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/webapp/WEB-INF/data/QRTZ_SCHEDULER_STATE.ddl
0,0 → 1,8
create table qrtz_scheduler_state
(
sched_name varchar(120) not null,
instance_name varchar(200) not null,
last_checkin_time bigint not null,
checkin_interval bigint not null,
primary key (sched_name,instance_name)
)
/xservices/trunk/src/main/webapp/WEB-INF/data/QRTZ_FIRED_TRIGGERS.ddl
0,0 → 1,15
create table qrtz_fired_triggers(
sched_name varchar(120) not null,
entry_id varchar(95) not null,
trigger_name varchar(200) not null,
trigger_group varchar(200) not null,
instance_name varchar(200) not null,
fired_time bigint not null,
priority integer not null,
state varchar(16) not null,
job_name varchar(200),
job_group varchar(200),
is_nonconcurrent varchar(5),
requests_recovery varchar(5),
primary key (sched_name,entry_id)
)
/xservices/trunk/src/main/webapp/WEB-INF/data/QRTZ_JOB_DETAILS.ddl
0,0 → 1,13
create table qrtz_job_details (
sched_name varchar(120) not null,
job_name varchar(200) not null,
job_group varchar(200) not null,
description varchar(250) ,
job_class_name varchar(250) not null,
is_durable varchar(5) not null,
is_nonconcurrent varchar(5) not null,
is_update_data varchar(5) not null,
requests_recovery varchar(5) not null,
job_data blob,
primary key (sched_name,job_name,job_group)
)
/xservices/trunk/src/main/webapp/WEB-INF/data/QRTZ_PAUSED_TRIGGER_GRPS.ddl
0,0 → 1,6
create table qrtz_paused_trigger_grps
(
sched_name varchar(120) not null,
trigger_group varchar(200) not null,
primary key (sched_name,trigger_group)
)
/xservices/trunk/src/main/webapp/WEB-INF/data/QRTZ_SIMPLE_TRIGGERS.ddl
0,0 → 1,10
create table qrtz_simple_triggers(
sched_name varchar(120) not null,
trigger_name varchar(200) not null,
trigger_group varchar(200) not null,
repeat_count bigint not null,
repeat_interval bigint not null,
times_triggered bigint not null,
primary key (sched_name,trigger_name,trigger_group),
foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
)
/xservices/trunk/src/main/webapp/WEB-INF/data/QRTZ_SIMPROP_TRIGGERS.ddl
0,0 → 1,19
CREATE TABLE qrtz_simprop_triggers (
sched_name varchar(120) not null,
TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
STR_PROP_1 VARCHAR(512),
STR_PROP_2 VARCHAR(512),
STR_PROP_3 VARCHAR(512),
INT_PROP_1 INT,
INT_PROP_2 INT,
LONG_PROP_1 BIGINT,
LONG_PROP_2 BIGINT,
DEC_PROP_1 NUMERIC(13,4),
DEC_PROP_2 NUMERIC(13,4),
BOOL_PROP_1 varchar(5),
BOOL_PROP_2 varchar(5),
PRIMARY KEY (sched_name,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (sched_name,TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES QRTZ_TRIGGERS(sched_name,TRIGGER_NAME,TRIGGER_GROUP)
)
/xservices/trunk/src/main/webapp/WEB-INF/data/QRTZ_BLOB_TRIGGERS.ddl
0,0 → 1,8
create table qrtz_blob_triggers(
sched_name varchar(120) not null,
trigger_name varchar(200) not null,
trigger_group varchar(200) not null,
blob_data blob,
primary key (sched_name,trigger_name,trigger_group),
foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
)
/xservices/trunk/src/main/webapp/WEB-INF/data/QRTZ_TRIGGERS.ddl
0,0 → 1,20
create table qrtz_triggers(
sched_name varchar(120) not null,
trigger_name varchar(200) not null,
trigger_group varchar(200) not null,
job_name varchar(200) not null,
job_group varchar(200) not null,
description varchar(250),
next_fire_time bigint,
prev_fire_time bigint,
priority integer,
trigger_state varchar(16) not null,
trigger_type varchar(8) not null,
start_time bigint not null,
end_time bigint,
calendar_name varchar(200),
misfire_instr smallint,
job_data blob,
primary key (sched_name,trigger_name,trigger_group),
foreign key (sched_name,job_name,job_group) references qrtz_job_details(sched_name,job_name,job_group)
)
/xservices/trunk/src/main/webapp/WEB-INF/data/QRTZ_CRON_TRIGGERS.ddl
0,0 → 1,9
create table qrtz_cron_triggers(
sched_name varchar(120) not null,
trigger_name varchar(200) not null,
trigger_group varchar(200) not null,
cron_expression varchar(120) not null,
time_zone_id varchar(80),
primary key (sched_name,trigger_name,trigger_group),
foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
)
/xservices/trunk/src/main/webapp/WEB-INF/data/QRTZ_LOCKS.ddl
0,0 → 1,6
create table qrtz_locks
(
sched_name varchar(120) not null,
lock_name varchar(40) not null,
primary key (sched_name,lock_name)
)
/xservices/trunk/src/main/webapp/WEB-INF/data/QRTZ_CALENDARS.ddl
0,0 → 1,6
create table qrtz_calendars(
sched_name varchar(120) not null,
calendar_name varchar(200) not null,
calendar blob not null,
primary key (sched_name,calendar_name)
)
/xservices/trunk/src/main/webapp/WEB-INF
Property changes:
Added: svn:ignore
+sun-jaxws.xml
/xservices/trunk/src/main/webapp/META-INF/MANIFEST.MF
0,0 → 1,3
Manifest-Version: 1.0
Class-Path:
 
/xservices/trunk/src/main/webapp/index.html
0,0 → 1,7
<html>
<head>
<title>XServices</title>
</head>
<body><h1>
XServices</h1></body>
</html>
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/main/webapp/LICENSE.antcontrib
0,0 → 1,47
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2003 Ant-Contrib project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Ant-Contrib project (http://sourceforge.net/projects/ant-contrib)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The name Ant-Contrib must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact
* ant-contrib-developers@lists.sourceforge.net.
*
* 5. Products derived from this software may not be called "Ant-Contrib"
* nor may "Ant-Contrib" appear in their names without prior written
* permission of the Ant-Contrib project.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE ANT-CONTRIB PROJECT OR ITS
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*/
/xservices/trunk/src/main/webapp/LICENSE.cxf
0,0 → 1,265
 
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
 
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
 
1. Definitions.
 
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
 
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
 
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
 
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
 
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
 
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
 
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
 
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
 
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
 
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
 
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
 
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
 
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
 
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
 
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
 
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
 
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
 
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
 
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
 
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
 
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
 
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
 
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
 
END OF TERMS AND CONDITIONS
 
APPENDIX: How to apply the Apache License to your work.
 
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
 
Copyright [yyyy] [name of copyright owner]
 
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
 
http://www.apache.org/licenses/LICENSE-2.0
 
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
 
Apache CXF includes a number of components and libraries with separate
copyright notices and license terms. Your use of those components are
subject to the terms and conditions of the following licenses.
 
 
 
AntLR Parser Generator (http://www.antlr.org/) antlr:antlr:jar:2.7.7
License: BSD License (http://www.antlr.org/license.html)
 
AOP alliance (http://aopalliance.sourceforge.net) aopalliance:aopalliance:jar:1.0
License: Public Domain
 
ASM (http://asm.objectweb.org/asm/asm) asm:asm:jar:2.2.3:compile
License: BSD (http://asm.ow2.org/license.html)
 
Sun JAXB Reference Implementation Runtime com.sun.xml.bind:jaxb-impl:jar:2.1.12:compile
License: COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 (http://www.sun.com/cddl/cddl.html)
 
Sun JAXB Reference Implementation Tools com.sun.xml.bind:jaxb-xjc:jar:2.1.12:compile
License: COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 (http://www.sun.com/cddl/cddl.html)
 
Sun SAAJ Reference Implementation com.sun.xml.messaging.saaj:saaj-impl:jar:1.3.2:compile
License: COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 (http://www.sun.com/cddl/cddl.html)
 
JSR 311 API (https://jsr311.dev.java.net/) javax.ws.rs:jsr311-api:jar:1.0:compile
License: COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 (http://www.sun.com/cddl/cddl.html)
 
Java Architecture for XML Binding (JAXB API) javax.xml.bind:jaxb-api:jar:2.1:compile
License: COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 (http://www.sun.com/cddl/cddl.html)
 
Sun SAAJ API (http://java.sun.com/webservices/saaj/index.jsp/saaj-api) javax.xml.soap:saaj-api:jar:1.3:compile
License: COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 (http://www.sun.com/cddl/cddl.html)
 
Jaxen (http://jaxen.codehaus.org/jaxen) jaxen:jaxen:jar:1.1:compile
License: BSD (http://jaxen.codehaus.org/license.html)
 
Bouncy Castle Provider (http://www.bouncycastle.org/java.html) org.bouncycastle:bcprov-jdk15:jar:1.43
License: Bouncy Castle Licence (http://www.bouncycastle.org/licence.html)
 
Jetty Server (http://www.eclipse.org/jetty/jetty-parent/project/modules/jetty) org.mortbay.jetty:jetty:jar:6.1.21
License: Apache Software License - Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
 
Jetty Server (http://www.eclipse.org/jetty/jetty-parent/project/modules/jetty) org.mortbay.jetty:jetty:jar:6.1.21
License: Eclipse Public License - Version 1.0 (http://www.eclipse.org/org/documents/epl-v10.php)
 
Jetty Utilities (http://www.eclipse.org/jetty/jetty-parent/project/jetty-util) org.mortbay.jetty:jetty-util:jar:6.1.21
License: Apache Software License - Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
 
Jetty Utilities (http://www.eclipse.org/jetty/jetty-parent/project/jetty-util) org.mortbay.jetty:jetty-util:jar:6.1.21
License: Eclipse Public License - Version 1.0 (http://www.eclipse.org/org/documents/epl-v10.php)
 
Simple Logging Facade for Java - API (http://www.slf4j.org/slf4j-api) org.slf4j:slf4j-api:jar:1.5.8:compile
License: MIT License (http://www.slf4j.org/license.html)
 
Simple Logging Facade for Java - JDK Logging (http://www.slf4j.org/slf4j-jdk14) org.slf4j:slf4j-jdk14:jar:1.5.8:compile
License: MIT License (http://www.slf4j.org/license.html)
 
Rhino (http://www.mozilla.org/rhino/) rhino:js:jar:1.7R1
License: Mozilla Public License version 1.1 (http://www.mozilla.org/MPL/MPL-1.1.html)
 
WSDL4J (http://sf.net/projects/wsdl4j) wsdl4j:wsdl4j:jar:1.6.2
License: CPL (http://www.opensource.org/licenses/cpl1.0.txt)
/xservices/trunk/src/main/webapp/NOTICE
0,0 → 1,26
=========================================================================
== NOTICE file corresponding to the section 4 d of ==
== the Apache License, Version 2.0, ==
== in this case for the Apache Ant distribution. ==
=========================================================================
 
Apache Ant
Copyright 1999-2008 The Apache Software Foundation
 
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
 
This product includes also software developed by:
- the W3C consortium (http://www.w3c.org),
- the SAX project (http://www.saxproject.org)
 
The <sync> task is based on code Copyright (c) 2002, Landmark
Graphics Corp that has been kindly donated to the Apache Software
Foundation.
 
Portions of this software were originally based on the following:
- software copyright (c) 1999, IBM Corporation., http://www.ibm.com.
- software copyright (c) 1999, Sun Microsystems., http://www.sun.com.
- voluntary contributions made by Paul Eng on behalf of the
Apache Software Foundation that were originally developed at iClick, Inc.,
software copyright (c) 1999.
/xservices/trunk/src/main/webapp/LICENSE
0,0 → 1,203
/*
* Apache License
* Version 2.0, January 2004
* http://www.apache.org/licenses/
*
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
*
* 1. Definitions.
*
* "License" shall mean the terms and conditions for use, reproduction,
* and distribution as defined by Sections 1 through 9 of this document.
*
* "Licensor" shall mean the copyright owner or entity authorized by
* the copyright owner that is granting the License.
*
* "Legal Entity" shall mean the union of the acting entity and all
* other entities that control, are controlled by, or are under common
* control with that entity. For the purposes of this definition,
* "control" means (i) the power, direct or indirect, to cause the
* direction or management of such entity, whether by contract or
* otherwise, or (ii) ownership of fifty percent (50%) or more of the
* outstanding shares, or (iii) beneficial ownership of such entity.
*
* "You" (or "Your") shall mean an individual or Legal Entity
* exercising permissions granted by this License.
*
* "Source" form shall mean the preferred form for making modifications,
* including but not limited to software source code, documentation
* source, and configuration files.
*
* "Object" form shall mean any form resulting from mechanical
* transformation or translation of a Source form, including but
* not limited to compiled object code, generated documentation,
* and conversions to other media types.
*
* "Work" shall mean the work of authorship, whether in Source or
* Object form, made available under the License, as indicated by a
* copyright notice that is included in or attached to the work
* (an example is provided in the Appendix below).
*
* "Derivative Works" shall mean any work, whether in Source or Object
* form, that is based on (or derived from) the Work and for which the
* editorial revisions, annotations, elaborations, or other modifications
* represent, as a whole, an original work of authorship. For the purposes
* of this License, Derivative Works shall not include works that remain
* separable from, or merely link (or bind by name) to the interfaces of,
* the Work and Derivative Works thereof.
*
* "Contribution" shall mean any work of authorship, including
* the original version of the Work and any modifications or additions
* to that Work or Derivative Works thereof, that is intentionally
* submitted to Licensor for inclusion in the Work by the copyright owner
* or by an individual or Legal Entity authorized to submit on behalf of
* the copyright owner. For the purposes of this definition, "submitted"
* means any form of electronic, verbal, or written communication sent
* to the Licensor or its representatives, including but not limited to
* communication on electronic mailing lists, source code control systems,
* and issue tracking systems that are managed by, or on behalf of, the
* Licensor for the purpose of discussing and improving the Work, but
* excluding communication that is conspicuously marked or otherwise
* designated in writing by the copyright owner as "Not a Contribution."
*
* "Contributor" shall mean Licensor and any individual or Legal Entity
* on behalf of whom a Contribution has been received by Licensor and
* subsequently incorporated within the Work.
*
* 2. Grant of Copyright License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* copyright license to reproduce, prepare Derivative Works of,
* publicly display, publicly perform, sublicense, and distribute the
* Work and such Derivative Works in Source or Object form.
*
* 3. Grant of Patent License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* (except as stated in this section) patent license to make, have made,
* use, offer to sell, sell, import, and otherwise transfer the Work,
* where such license applies only to those patent claims licensable
* by such Contributor that are necessarily infringed by their
* Contribution(s) alone or by combination of their Contribution(s)
* with the Work to which such Contribution(s) was submitted. If You
* institute patent litigation against any entity (including a
* cross-claim or counterclaim in a lawsuit) alleging that the Work
* or a Contribution incorporated within the Work constitutes direct
* or contributory patent infringement, then any patent licenses
* granted to You under this License for that Work shall terminate
* as of the date such litigation is filed.
*
* 4. Redistribution. You may reproduce and distribute copies of the
* Work or Derivative Works thereof in any medium, with or without
* modifications, and in Source or Object form, provided that You
* meet the following conditions:
*
* (a) You must give any other recipients of the Work or
* Derivative Works a copy of this License; and
*
* (b) You must cause any modified files to carry prominent notices
* stating that You changed the files; and
*
* (c) You must retain, in the Source form of any Derivative Works
* that You distribute, all copyright, patent, trademark, and
* attribution notices from the Source form of the Work,
* excluding those notices that do not pertain to any part of
* the Derivative Works; and
*
* (d) If the Work includes a "NOTICE" text file as part of its
* distribution, then any Derivative Works that You distribute must
* include a readable copy of the attribution notices contained
* within such NOTICE file, excluding those notices that do not
* pertain to any part of the Derivative Works, in at least one
* of the following places: within a NOTICE text file distributed
* as part of the Derivative Works; within the Source form or
* documentation, if provided along with the Derivative Works; or,
* within a display generated by the Derivative Works, if and
* wherever such third-party notices normally appear. The contents
* of the NOTICE file are for informational purposes only and
* do not modify the License. You may add Your own attribution
* notices within Derivative Works that You distribute, alongside
* or as an addendum to the NOTICE text from the Work, provided
* that such additional attribution notices cannot be construed
* as modifying the License.
*
* You may add Your own copyright statement to Your modifications and
* may provide additional or different license terms and conditions
* for use, reproduction, or distribution of Your modifications, or
* for any such Derivative Works as a whole, provided Your use,
* reproduction, and distribution of the Work otherwise complies with
* the conditions stated in this License.
*
* 5. Submission of Contributions. Unless You explicitly state otherwise,
* any Contribution intentionally submitted for inclusion in the Work
* by You to the Licensor shall be under the terms and conditions of
* this License, without any additional terms or conditions.
* Notwithstanding the above, nothing herein shall supersede or modify
* the terms of any separate license agreement you may have executed
* with Licensor regarding such Contributions.
*
* 6. Trademarks. This License does not grant permission to use the trade
* names, trademarks, service marks, or product names of the Licensor,
* except as required for reasonable and customary use in describing the
* origin of the Work and reproducing the content of the NOTICE file.
*
* 7. Disclaimer of Warranty. Unless required by applicable law or
* agreed to in writing, Licensor provides the Work (and each
* Contributor provides its Contributions) on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied, including, without limitation, any warranties or conditions
* of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
* PARTICULAR PURPOSE. You are solely responsible for determining the
* appropriateness of using or redistributing the Work and assume any
* risks associated with Your exercise of permissions under this License.
*
* 8. Limitation of Liability. In no event and under no legal theory,
* whether in tort (including negligence), contract, or otherwise,
* unless required by applicable law (such as deliberate and grossly
* negligent acts) or agreed to in writing, shall any Contributor be
* liable to You for damages, including any direct, indirect, special,
* incidental, or consequential damages of any character arising as a
* result of this License or out of the use or inability to use the
* Work (including but not limited to damages for loss of goodwill,
* work stoppage, computer failure or malfunction, or any and all
* other commercial damages or losses), even if such Contributor
* has been advised of the possibility of such damages.
*
* 9. Accepting Warranty or Additional Liability. While redistributing
* the Work or Derivative Works thereof, You may choose to offer,
* and charge a fee for, acceptance of support, warranty, indemnity,
* or other liability obligations and/or rights consistent with this
* License. However, in accepting such obligations, You may act only
* on Your own behalf and on Your sole responsibility, not on behalf
* of any other Contributor, and only if You agree to indemnify,
* defend, and hold each Contributor harmless for any liability
* incurred by, or claims asserted against, such Contributor by reason
* of your accepting any such warranty or additional liability.
*
* END OF TERMS AND CONDITIONS
*
* APPENDIX: How to apply the Apache License to your work.
*
* To apply the Apache License to your work, attach the following
* boilerplate notice, with the fields enclosed by brackets "[]"
* replaced with your own identifying information. (Don't include
* the brackets!) The text should be enclosed in the appropriate
* comment syntax for the file format. We also recommend that a
* file or class name and description of purpose be included on the
* same "printed page" as the copyright notice for easier
* identification within third-party archives.
*
* Copyright [yyyy] [name of copyright owner]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/xservices/trunk/src/main/webapp/LICENSE.ant
0,0 → 1,203
/*
* Apache License
* Version 2.0, January 2004
* http://www.apache.org/licenses/
*
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
*
* 1. Definitions.
*
* "License" shall mean the terms and conditions for use, reproduction,
* and distribution as defined by Sections 1 through 9 of this document.
*
* "Licensor" shall mean the copyright owner or entity authorized by
* the copyright owner that is granting the License.
*
* "Legal Entity" shall mean the union of the acting entity and all
* other entities that control, are controlled by, or are under common
* control with that entity. For the purposes of this definition,
* "control" means (i) the power, direct or indirect, to cause the
* direction or management of such entity, whether by contract or
* otherwise, or (ii) ownership of fifty percent (50%) or more of the
* outstanding shares, or (iii) beneficial ownership of such entity.
*
* "You" (or "Your") shall mean an individual or Legal Entity
* exercising permissions granted by this License.
*
* "Source" form shall mean the preferred form for making modifications,
* including but not limited to software source code, documentation
* source, and configuration files.
*
* "Object" form shall mean any form resulting from mechanical
* transformation or translation of a Source form, including but
* not limited to compiled object code, generated documentation,
* and conversions to other media types.
*
* "Work" shall mean the work of authorship, whether in Source or
* Object form, made available under the License, as indicated by a
* copyright notice that is included in or attached to the work
* (an example is provided in the Appendix below).
*
* "Derivative Works" shall mean any work, whether in Source or Object
* form, that is based on (or derived from) the Work and for which the
* editorial revisions, annotations, elaborations, or other modifications
* represent, as a whole, an original work of authorship. For the purposes
* of this License, Derivative Works shall not include works that remain
* separable from, or merely link (or bind by name) to the interfaces of,
* the Work and Derivative Works thereof.
*
* "Contribution" shall mean any work of authorship, including
* the original version of the Work and any modifications or additions
* to that Work or Derivative Works thereof, that is intentionally
* submitted to Licensor for inclusion in the Work by the copyright owner
* or by an individual or Legal Entity authorized to submit on behalf of
* the copyright owner. For the purposes of this definition, "submitted"
* means any form of electronic, verbal, or written communication sent
* to the Licensor or its representatives, including but not limited to
* communication on electronic mailing lists, source code control systems,
* and issue tracking systems that are managed by, or on behalf of, the
* Licensor for the purpose of discussing and improving the Work, but
* excluding communication that is conspicuously marked or otherwise
* designated in writing by the copyright owner as "Not a Contribution."
*
* "Contributor" shall mean Licensor and any individual or Legal Entity
* on behalf of whom a Contribution has been received by Licensor and
* subsequently incorporated within the Work.
*
* 2. Grant of Copyright License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* copyright license to reproduce, prepare Derivative Works of,
* publicly display, publicly perform, sublicense, and distribute the
* Work and such Derivative Works in Source or Object form.
*
* 3. Grant of Patent License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* (except as stated in this section) patent license to make, have made,
* use, offer to sell, sell, import, and otherwise transfer the Work,
* where such license applies only to those patent claims licensable
* by such Contributor that are necessarily infringed by their
* Contribution(s) alone or by combination of their Contribution(s)
* with the Work to which such Contribution(s) was submitted. If You
* institute patent litigation against any entity (including a
* cross-claim or counterclaim in a lawsuit) alleging that the Work
* or a Contribution incorporated within the Work constitutes direct
* or contributory patent infringement, then any patent licenses
* granted to You under this License for that Work shall terminate
* as of the date such litigation is filed.
*
* 4. Redistribution. You may reproduce and distribute copies of the
* Work or Derivative Works thereof in any medium, with or without
* modifications, and in Source or Object form, provided that You
* meet the following conditions:
*
* (a) You must give any other recipients of the Work or
* Derivative Works a copy of this License; and
*
* (b) You must cause any modified files to carry prominent notices
* stating that You changed the files; and
*
* (c) You must retain, in the Source form of any Derivative Works
* that You distribute, all copyright, patent, trademark, and
* attribution notices from the Source form of the Work,
* excluding those notices that do not pertain to any part of
* the Derivative Works; and
*
* (d) If the Work includes a "NOTICE" text file as part of its
* distribution, then any Derivative Works that You distribute must
* include a readable copy of the attribution notices contained
* within such NOTICE file, excluding those notices that do not
* pertain to any part of the Derivative Works, in at least one
* of the following places: within a NOTICE text file distributed
* as part of the Derivative Works; within the Source form or
* documentation, if provided along with the Derivative Works; or,
* within a display generated by the Derivative Works, if and
* wherever such third-party notices normally appear. The contents
* of the NOTICE file are for informational purposes only and
* do not modify the License. You may add Your own attribution
* notices within Derivative Works that You distribute, alongside
* or as an addendum to the NOTICE text from the Work, provided
* that such additional attribution notices cannot be construed
* as modifying the License.
*
* You may add Your own copyright statement to Your modifications and
* may provide additional or different license terms and conditions
* for use, reproduction, or distribution of Your modifications, or
* for any such Derivative Works as a whole, provided Your use,
* reproduction, and distribution of the Work otherwise complies with
* the conditions stated in this License.
*
* 5. Submission of Contributions. Unless You explicitly state otherwise,
* any Contribution intentionally submitted for inclusion in the Work
* by You to the Licensor shall be under the terms and conditions of
* this License, without any additional terms or conditions.
* Notwithstanding the above, nothing herein shall supersede or modify
* the terms of any separate license agreement you may have executed
* with Licensor regarding such Contributions.
*
* 6. Trademarks. This License does not grant permission to use the trade
* names, trademarks, service marks, or product names of the Licensor,
* except as required for reasonable and customary use in describing the
* origin of the Work and reproducing the content of the NOTICE file.
*
* 7. Disclaimer of Warranty. Unless required by applicable law or
* agreed to in writing, Licensor provides the Work (and each
* Contributor provides its Contributions) on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied, including, without limitation, any warranties or conditions
* of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
* PARTICULAR PURPOSE. You are solely responsible for determining the
* appropriateness of using or redistributing the Work and assume any
* risks associated with Your exercise of permissions under this License.
*
* 8. Limitation of Liability. In no event and under no legal theory,
* whether in tort (including negligence), contract, or otherwise,
* unless required by applicable law (such as deliberate and grossly
* negligent acts) or agreed to in writing, shall any Contributor be
* liable to You for damages, including any direct, indirect, special,
* incidental, or consequential damages of any character arising as a
* result of this License or out of the use or inability to use the
* Work (including but not limited to damages for loss of goodwill,
* work stoppage, computer failure or malfunction, or any and all
* other commercial damages or losses), even if such Contributor
* has been advised of the possibility of such damages.
*
* 9. Accepting Warranty or Additional Liability. While redistributing
* the Work or Derivative Works thereof, You may choose to offer,
* and charge a fee for, acceptance of support, warranty, indemnity,
* or other liability obligations and/or rights consistent with this
* License. However, in accepting such obligations, You may act only
* on Your own behalf and on Your sole responsibility, not on behalf
* of any other Contributor, and only if You agree to indemnify,
* defend, and hold each Contributor harmless for any liability
* incurred by, or claims asserted against, such Contributor by reason
* of your accepting any such warranty or additional liability.
*
* END OF TERMS AND CONDITIONS
*
* APPENDIX: How to apply the Apache License to your work.
*
* To apply the Apache License to your work, attach the following
* boilerplate notice, with the fields enclosed by brackets "[]"
* replaced with your own identifying information. (Don't include
* the brackets!) The text should be enclosed in the appropriate
* comment syntax for the file format. We also recommend that a
* file or class name and description of purpose be included on the
* same "printed page" as the copyright notice for easier
* identification within third-party archives.
*
* Copyright [yyyy] [name of copyright owner]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/xservices/trunk/src/main/webapp/LICENSE.jaxb
0,0 → 1,384
COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
 
 
1. Definitions.
 
1.1. "Contributor" means each individual or entity that
creates or contributes to the creation of Modifications.
 
1.2. "Contributor Version" means the combination of the
Original Software, prior Modifications used by a
Contributor (if any), and the Modifications made by that
particular Contributor.
 
1.3. "Covered Software" means (a) the Original Software, or
(b) Modifications, or (c) the combination of files
containing Original Software with files containing
Modifications, in each case including portions thereof.
 
1.4. "Executable" means the Covered Software in any form
other than Source Code.
 
1.5. "Initial Developer" means the individual or entity
that first makes Original Software available under this
License.
1.6. "Larger Work" means a work which combines Covered
Software or portions thereof with code not governed by the
terms of this License.
 
1.7. "License" means this document.
 
1.8. "Licensable" means having the right to grant, to the
maximum extent possible, whether at the time of the initial
grant or subsequently acquired, any and all of the rights
conveyed herein.
1.9. "Modifications" means the Source Code and Executable
form of any of the following:
 
A. Any file that results from an addition to,
deletion from or modification of the contents of a
file containing Original Software or previous
Modifications;
 
B. Any new file that contains any part of the
Original Software or previous Modification; or
 
C. Any new file that is contributed or otherwise made
available under the terms of this License.
 
1.10. "Original Software" means the Source Code and
Executable form of computer software code that is
originally released under this License.
 
1.11. "Patent Claims" means any patent claim(s), now owned
or hereafter acquired, including without limitation,
method, process, and apparatus claims, in any patent
Licensable by grantor.
 
1.12. "Source Code" means (a) the common form of computer
software code in which modifications are made and (b)
associated documentation included in or with such code.
 
1.13. "You" (or "Your") means an individual or a legal
entity exercising rights under, and complying with all of
the terms of, this License. For legal entities, "You"
includes any entity which controls, is controlled by, or is
under common control with You. For purposes of this
definition, "control" means (a) the power, direct or
indirect, to cause the direction or management of such
entity, whether by contract or otherwise, or (b) ownership
of more than fifty percent (50%) of the outstanding shares
or beneficial ownership of such entity.
 
2. License Grants.
 
2.1. The Initial Developer Grant.
 
Conditioned upon Your compliance with Section 3.1 below and
subject to third party intellectual property claims, the
Initial Developer hereby grants You a world-wide,
royalty-free, non-exclusive license:
 
(a) under intellectual property rights (other than
patent or trademark) Licensable by Initial Developer,
to use, reproduce, modify, display, perform,
sublicense and distribute the Original Software (or
portions thereof), with or without Modifications,
and/or as part of a Larger Work; and
 
(b) under Patent Claims infringed by the making,
using or selling of Original Software, to make, have
made, use, practice, sell, and offer for sale, and/or
otherwise dispose of the Original Software (or
portions thereof).
 
(c) The licenses granted in Sections 2.1(a) and (b)
are effective on the date Initial Developer first
distributes or otherwise makes the Original Software
available to a third party under the terms of this
License.
 
(d) Notwithstanding Section 2.1(b) above, no patent
license is granted: (1) for code that You delete from
the Original Software, or (2) for infringements
caused by: (i) the modification of the Original
Software, or (ii) the combination of the Original
Software with other software or devices.
 
2.2. Contributor Grant.
 
Conditioned upon Your compliance with Section 3.1 below and
subject to third party intellectual property claims, each
Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
 
(a) under intellectual property rights (other than
patent or trademark) Licensable by Contributor to
use, reproduce, modify, display, perform, sublicense
and distribute the Modifications created by such
Contributor (or portions thereof), either on an
unmodified basis, with other Modifications, as
Covered Software and/or as part of a Larger Work; and
 
(b) under Patent Claims infringed by the making,
using, or selling of Modifications made by that
Contributor either alone and/or in combination with
its Contributor Version (or portions of such
combination), to make, use, sell, offer for sale,
have made, and/or otherwise dispose of: (1)
Modifications made by that Contributor (or portions
thereof); and (2) the combination of Modifications
made by that Contributor with its Contributor Version
(or portions of such combination).
 
(c) The licenses granted in Sections 2.2(a) and
2.2(b) are effective on the date Contributor first
distributes or otherwise makes the Modifications
available to a third party.
 
(d) Notwithstanding Section 2.2(b) above, no patent
license is granted: (1) for any code that Contributor
has deleted from the Contributor Version; (2) for
infringements caused by: (i) third party
modifications of Contributor Version, or (ii) the
combination of Modifications made by that Contributor
with other software (except as part of the
Contributor Version) or other devices; or (3) under
Patent Claims infringed by Covered Software in the
absence of Modifications made by that Contributor.
 
3. Distribution Obligations.
 
3.1. Availability of Source Code.
 
Any Covered Software that You distribute or otherwise make
available in Executable form must also be made available in
Source Code form and that Source Code form must be
distributed only under the terms of this License. You must
include a copy of this License with every copy of the
Source Code form of the Covered Software You distribute or
otherwise make available. You must inform recipients of any
such Covered Software in Executable form as to how they can
obtain such Covered Software in Source Code form in a
reasonable manner on or through a medium customarily used
for software exchange.
 
3.2. Modifications.
 
The Modifications that You create or to which You
contribute are governed by the terms of this License. You
represent that You believe Your Modifications are Your
original creation(s) and/or You have sufficient rights to
grant the rights conveyed by this License.
 
3.3. Required Notices.
 
You must include a notice in each of Your Modifications
that identifies You as the Contributor of the Modification.
You may not remove or alter any copyright, patent or
trademark notices contained within the Covered Software, or
any notices of licensing or any descriptive text giving
attribution to any Contributor or the Initial Developer.
 
3.4. Application of Additional Terms.
 
You may not offer or impose any terms on any Covered
Software in Source Code form that alters or restricts the
applicable version of this License or the recipientsÕ
rights hereunder. You may choose to offer, and to charge a
fee for, warranty, support, indemnity or liability
obligations to one or more recipients of Covered Software.
However, you may do so only on Your own behalf, and not on
behalf of the Initial Developer or any Contributor. You
must make it absolutely clear that any such warranty,
support, indemnity or liability obligation is offered by
You alone, and You hereby agree to indemnify the Initial
Developer and every Contributor for any liability incurred
by the Initial Developer or such Contributor as a result of
warranty, support, indemnity or liability terms You offer.
 
3.5. Distribution of Executable Versions.
 
You may distribute the Executable form of the Covered
Software under the terms of this License or under the terms
of a license of Your choice, which may contain terms
different from this License, provided that You are in
compliance with the terms of this License and that the
license for the Executable form does not attempt to limit
or alter the recipientÕs rights in the Source Code form
from the rights set forth in this License. If You
distribute the Covered Software in Executable form under a
different license, You must make it absolutely clear that
any terms which differ from this License are offered by You
alone, not by the Initial Developer or Contributor. You
hereby agree to indemnify the Initial Developer and every
Contributor for any liability incurred by the Initial
Developer or such Contributor as a result of any such terms
You offer.
 
3.6. Larger Works.
 
You may create a Larger Work by combining Covered Software
with other code not governed by the terms of this License
and distribute the Larger Work as a single product. In such
a case, You must make sure the requirements of this License
are fulfilled for the Covered Software.
4. Versions of the License.
 
4.1. New Versions.
 
Sun Microsystems, Inc. is the initial license steward and
may publish revised and/or new versions of this License
from time to time. Each version will be given a
distinguishing version number. Except as provided in
Section 4.3, no one other than the license steward has the
right to modify this License.
 
4.2. Effect of New Versions.
 
You may always continue to use, distribute or otherwise
make the Covered Software available under the terms of the
version of the License under which You originally received
the Covered Software. If the Initial Developer includes a
notice in the Original Software prohibiting it from being
distributed or otherwise made available under any
subsequent version of the License, You must distribute and
make the Covered Software available under the terms of the
version of the License under which You originally received
the Covered Software. Otherwise, You may also choose to
use, distribute or otherwise make the Covered Software
available under the terms of any subsequent version of the
License published by the license steward.
 
4.3. Modified Versions.
 
When You are an Initial Developer and You want to create a
new license for Your Original Software, You may create and
use a modified version of this License if You: (a) rename
the license and remove any references to the name of the
license steward (except to note that the license differs
from this License); and (b) otherwise make it clear that
the license contains terms which differ from this License.
 
5. DISCLAIMER OF WARRANTY.
 
COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
DISCLAIMER.
 
6. TERMINATION.
 
6.1. This License and the rights granted hereunder will
terminate automatically if You fail to comply with terms
herein and fail to cure such breach within 30 days of
becoming aware of the breach. Provisions which, by their
nature, must remain in effect beyond the termination of
this License shall survive.
 
6.2. If You assert a patent infringement claim (excluding
declaratory judgment actions) against Initial Developer or
a Contributor (the Initial Developer or Contributor against
whom You assert such claim is referred to as "Participant")
alleging that the Participant Software (meaning the
Contributor Version where the Participant is a Contributor
or the Original Software where the Participant is the
Initial Developer) directly or indirectly infringes any
patent, then any and all rights granted directly or
indirectly to You by such Participant, the Initial
Developer (if the Initial Developer is not the Participant)
and all Contributors under Sections 2.1 and/or 2.2 of this
License shall, upon 60 days notice from Participant
terminate prospectively and automatically at the expiration
of such 60 day notice period, unless if within such 60 day
period You withdraw Your claim with respect to the
Participant Software against such Participant either
unilaterally or pursuant to a written agreement with
Participant.
 
6.3. In the event of termination under Sections 6.1 or 6.2
above, all end user licenses that have been validly granted
by You or any distributor hereunder prior to termination
(excluding licenses granted to You by any distributor)
shall survive termination.
 
7. LIMITATION OF LIABILITY.
 
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
INJURY RESULTING FROM SUCH PARTYÕS NEGLIGENCE TO THE EXTENT
APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
APPLY TO YOU.
 
8. U.S. GOVERNMENT END USERS.
 
The Covered Software is a "commercial item," as that term is
defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
computer software" (as that term is defined at 48 C.F.R. ¤
252.227-7014(a)(1)) and "commercial computer software
documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
through 227.7202-4 (June 1995), all U.S. Government End Users
acquire Covered Software with only those rights set forth herein.
This U.S. Government Rights clause is in lieu of, and supersedes,
any other FAR, DFAR, or other clause or provision that addresses
Government rights in computer software under this License.
 
9. MISCELLANEOUS.
 
This License represents the complete agreement concerning subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the
extent necessary to make it enforceable. This License shall be
governed by the law of the jurisdiction specified in a notice
contained within the Original Software (except to the extent
applicable law, if any, provides otherwise), excluding such
jurisdictionÕs conflict-of-law provisions. Any litigation
relating to this License shall be subject to the jurisdiction of
the courts located in the jurisdiction and venue specified in a
notice contained within the Original Software, with the losing
party responsible for costs, including, without limitation, court
costs and reasonable attorneysÕ fees and expenses. The
application of the United Nations Convention on Contracts for the
International Sale of Goods is expressly excluded. Any law or
regulation which provides that the language of a contract shall
be construed against the drafter shall not apply to this License.
You agree that You alone are responsible for compliance with the
United States export administration regulations (and the export
control laws and regulation of any other countries) when You use,
distribute or otherwise make available any Covered Software.
 
10. RESPONSIBILITY FOR CLAIMS.
 
As between Initial Developer and the Contributors, each party is
responsible for claims and damages arising, directly or
indirectly, out of its utilization of rights under this License
and You agree to work with Initial Developer and Contributors to
distribute such responsibility on an equitable basis. Nothing
herein is intended or shall be deemed to constitute any admission
of liability.
/xservices/trunk/src/main/webapp/LICENSE.unrar
0,0 → 1,40
****** ***** ****** UnRAR - free utility for RAR archives
** ** ** ** ** ** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
****** ******* ****** License for use and distribution of
** ** ** ** ** ** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
** ** ** ** ** ** FREE portable version
~~~~~~~~~~~~~~~~~~~~~
 
The source code of UnRAR utility is freeware. This means:
 
1. All copyrights to RAR and the utility UnRAR are exclusively
owned by the author - Alexander Roshal.
 
2. The UnRAR sources may be used in any software to handle RAR
archives without limitations free of charge, but cannot be used
to re-create the RAR compression algorithm, which is proprietary.
Distribution of modified UnRAR sources in separate form or as a
part of other software is permitted, provided that it is clearly
stated in the documentation and source comments that the code may
not be used to develop a RAR (WinRAR) compatible archiver.
 
3. The UnRAR utility may be freely distributed. It is allowed
to distribute UnRAR inside of other software packages.
 
4. THE RAR ARCHIVER AND THE UnRAR UTILITY ARE DISTRIBUTED "AS IS".
NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED. YOU USE AT
YOUR OWN RISK. THE AUTHOR WILL NOT BE LIABLE FOR DATA LOSS,
DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING
OR MISUSING THIS SOFTWARE.
 
5. Installing and using the UnRAR utility signifies acceptance of
these terms and conditions of the license.
 
6. If you don't agree with terms of the license you must remove
UnRAR files from your storage devices and cease to use the
utility.
 
Thank you for your interest in RAR and UnRAR.
 
 
Alexander L. Roshal
/xservices/trunk
Property changes:
Modified: svn:ignore
.externalToolBuilders
.classpath
+*.iml