commit
fa5e4d773c
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
|
<classpathentry kind="lib" path="lib/commons-logging-1.2.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/wrapper.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/commons-io.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/itextpdf-5.1.0.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/preflight-2.0.8.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/xmpbox-2.0.8.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/fontbox-2.0.16.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/pdfbox-2.0.16.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/pdfbox-tools-2.0.16.jar"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>PDFPrintServer</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||||
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
@ -0,0 +1,135 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
rem
|
||||||
|
rem Copyright (c) 1999, 2013 Tanuki Software, Ltd.
|
||||||
|
rem http://www.tanukisoftware.com
|
||||||
|
rem All rights reserved.
|
||||||
|
rem
|
||||||
|
rem This software is the proprietary information of Tanuki Software.
|
||||||
|
rem You shall use it only in accordance with the terms of the
|
||||||
|
rem license agreement you entered into with Tanuki Software.
|
||||||
|
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
|
||||||
|
rem
|
||||||
|
rem Java Service Wrapper general passthrough startup script.
|
||||||
|
rem
|
||||||
|
rem -----------------------------------------------------------------------------
|
||||||
|
rem These settings can be modified to fit the needs of your application
|
||||||
|
rem Optimized for use with version 3.5.20 of the Wrapper.
|
||||||
|
|
||||||
|
rem The base name for the Wrapper binary.
|
||||||
|
set _WRAPPER_BASE=wrapper
|
||||||
|
|
||||||
|
rem The directory where the Wrapper binary (.exe) file is located, this can be
|
||||||
|
rem either a absolute or relative path. If the path contains any special characters,
|
||||||
|
rem please make sure to quote the variable.
|
||||||
|
set _WRAPPER_DIR=
|
||||||
|
|
||||||
|
rem The name and location of the Wrapper configuration file. This will be used
|
||||||
|
rem if the user does not specify a configuration file as the first parameter to
|
||||||
|
rem this script. It will not be possible to specify a configuration file on the
|
||||||
|
rem command line if _PASS_THROUGH is set.
|
||||||
|
rem If a relative path is specified, please note that the location is based on the
|
||||||
|
rem location.
|
||||||
|
set _WRAPPER_CONF_DEFAULT="%_WRAPPER_BASE%.conf"
|
||||||
|
|
||||||
|
rem Makes it possible to override the Wrapper configuration file by specifying it
|
||||||
|
rem as the first parameter.
|
||||||
|
rem set _WRAPPER_CONF_OVERRIDE=true
|
||||||
|
|
||||||
|
rem _PASS_THROUGH tells the script to pass all parameters through to the JVM as
|
||||||
|
rem is.
|
||||||
|
set _PASS_THROUGH=true
|
||||||
|
|
||||||
|
rem Do not modify anything beyond this point
|
||||||
|
rem -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
rem
|
||||||
|
rem Resolve the real path of the wrapper.exe
|
||||||
|
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
|
||||||
|
rem can be hard-coded below and the following test removed.
|
||||||
|
rem
|
||||||
|
if "%OS%"=="Windows_NT" goto nt
|
||||||
|
echo This script only works with NT-based versions of Windows.
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
:nt
|
||||||
|
rem Find the application home.
|
||||||
|
rem if no path path specified do the default action
|
||||||
|
IF not DEFINED _WRAPPER_DIR goto dir_undefined
|
||||||
|
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
|
||||||
|
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
|
||||||
|
rem check if absolute path
|
||||||
|
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
|
||||||
|
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
|
||||||
|
rem everythig else means relative path
|
||||||
|
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
|
||||||
|
goto pathfound
|
||||||
|
|
||||||
|
:dir_undefined
|
||||||
|
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
|
||||||
|
set _REALPATH="%~dp0"
|
||||||
|
goto pathfound
|
||||||
|
:absolute_path
|
||||||
|
rem Use an absolute path to the wrapper
|
||||||
|
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
|
||||||
|
|
||||||
|
:pathfound
|
||||||
|
rem
|
||||||
|
rem Decide on the specific Wrapper binary to use (See delta-pack)
|
||||||
|
rem
|
||||||
|
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
|
||||||
|
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
|
||||||
|
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
|
||||||
|
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
|
||||||
|
goto search
|
||||||
|
:amd64
|
||||||
|
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
|
||||||
|
goto search
|
||||||
|
:ia64
|
||||||
|
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
|
||||||
|
goto search
|
||||||
|
:search
|
||||||
|
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
|
||||||
|
if exist %_WRAPPER_EXE% goto conf
|
||||||
|
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
|
||||||
|
if exist %_WRAPPER_EXE% goto conf
|
||||||
|
echo Unable to locate a Wrapper executable using any of the following names:
|
||||||
|
echo %_WRAPPER_L_EXE%
|
||||||
|
echo %_WRAPPER_EXE%
|
||||||
|
pause
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
rem
|
||||||
|
rem Find the wrapper.conf
|
||||||
|
rem
|
||||||
|
:conf
|
||||||
|
if not [%_WRAPPER_CONF_OVERRIDE%]==[] (
|
||||||
|
set _WRAPPER_CONF="%~f1"
|
||||||
|
if not [%_WRAPPER_CONF%]==[""] (
|
||||||
|
shift
|
||||||
|
goto :startup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
|
||||||
|
|
||||||
|
rem
|
||||||
|
rem Start the Wrapper
|
||||||
|
rem
|
||||||
|
:startup
|
||||||
|
|
||||||
|
rem Collect an parameters
|
||||||
|
:parameters
|
||||||
|
set _PARAMETERS=%_PARAMETERS% %1
|
||||||
|
shift
|
||||||
|
if not [%1]==[] goto :parameters
|
||||||
|
|
||||||
|
if [%_PASS_THROUGH%]==[] (
|
||||||
|
%_WRAPPER_EXE% -i %_WRAPPER_CONF%
|
||||||
|
) else (
|
||||||
|
%_WRAPPER_EXE% -i %_WRAPPER_CONF% -- %_PARAMETERS%
|
||||||
|
)
|
||||||
|
if not errorlevel 1 goto :eof
|
||||||
|
pause
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,133 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
rem
|
||||||
|
rem Copyright (c) 1999, 2013 Tanuki Software, Ltd.
|
||||||
|
rem http://www.tanukisoftware.com
|
||||||
|
rem All rights reserved.
|
||||||
|
rem
|
||||||
|
rem This software is the proprietary information of Tanuki Software.
|
||||||
|
rem You shall use it only in accordance with the terms of the
|
||||||
|
rem license agreement you entered into with Tanuki Software.
|
||||||
|
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
|
||||||
|
rem
|
||||||
|
rem Java Service Wrapper general startup script.
|
||||||
|
rem
|
||||||
|
|
||||||
|
rem -----------------------------------------------------------------------------
|
||||||
|
rem These settings can be modified to fit the needs of your application
|
||||||
|
rem Optimized for use with version 3.5.20 of the Wrapper.
|
||||||
|
|
||||||
|
rem The base name for the Wrapper binary.
|
||||||
|
set _WRAPPER_BASE=wrapper
|
||||||
|
|
||||||
|
rem The directory where the Wrapper binary (.exe) file is located, this can be
|
||||||
|
rem either a absolute or relative path. If the path contains any special characters,
|
||||||
|
rem please make sure to quote the variable.
|
||||||
|
set _WRAPPER_DIR=
|
||||||
|
|
||||||
|
rem The name and location of the Wrapper configuration file. This will be used
|
||||||
|
rem if the user does not specify a configuration file as the first parameter to
|
||||||
|
rem this script. It will not be possible to specify a configuration file on the
|
||||||
|
rem command line if _PASS_THROUGH is set.
|
||||||
|
rem If a relative path is specified, please note that the location is based on the
|
||||||
|
rem location.
|
||||||
|
set _WRAPPER_CONF_DEFAULT="%_WRAPPER_BASE%.conf"
|
||||||
|
|
||||||
|
rem Makes it possible to override the Wrapper configuration file by specifying it
|
||||||
|
rem as the first parameter.
|
||||||
|
rem set _WRAPPER_CONF_OVERRIDE=true
|
||||||
|
|
||||||
|
rem Note that it is only possible to pass parameters through to the JVM when
|
||||||
|
rem installing the service, or when running in a console.
|
||||||
|
|
||||||
|
rem Do not modify anything beyond this point
|
||||||
|
rem -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
rem
|
||||||
|
rem Resolve the real path of the wrapper.exe
|
||||||
|
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
|
||||||
|
rem can be hard-coded below and the following test removed.
|
||||||
|
rem
|
||||||
|
if "%OS%"=="Windows_NT" goto nt
|
||||||
|
echo This script only works with NT-based versions of Windows.
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
:nt
|
||||||
|
rem Find the application home.
|
||||||
|
rem if no path path specified do the default action
|
||||||
|
IF not DEFINED _WRAPPER_DIR goto dir_undefined
|
||||||
|
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
|
||||||
|
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
|
||||||
|
rem check if absolute path
|
||||||
|
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
|
||||||
|
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
|
||||||
|
rem everythig else means relative path
|
||||||
|
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
|
||||||
|
goto pathfound
|
||||||
|
|
||||||
|
:dir_undefined
|
||||||
|
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
|
||||||
|
set _REALPATH="%~dp0"
|
||||||
|
goto pathfound
|
||||||
|
:absolute_path
|
||||||
|
rem Use an absolute path to the wrapper
|
||||||
|
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
|
||||||
|
|
||||||
|
:pathfound
|
||||||
|
rem
|
||||||
|
rem Decide on the specific Wrapper binary to use (See delta-pack)
|
||||||
|
rem
|
||||||
|
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
|
||||||
|
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
|
||||||
|
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
|
||||||
|
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
|
||||||
|
goto search
|
||||||
|
:amd64
|
||||||
|
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
|
||||||
|
goto search
|
||||||
|
:ia64
|
||||||
|
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
|
||||||
|
goto search
|
||||||
|
:search
|
||||||
|
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
|
||||||
|
if exist %_WRAPPER_EXE% goto conf
|
||||||
|
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
|
||||||
|
if exist %_WRAPPER_EXE% goto conf
|
||||||
|
echo Unable to locate a Wrapper executable using any of the following names:
|
||||||
|
echo %_WRAPPER_L_EXE%
|
||||||
|
echo %_WRAPPER_EXE%
|
||||||
|
pause
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
rem
|
||||||
|
rem Find the wrapper.conf
|
||||||
|
rem
|
||||||
|
:conf
|
||||||
|
if not [%_WRAPPER_CONF_OVERRIDE%]==[] (
|
||||||
|
set _WRAPPER_CONF="%~f1"
|
||||||
|
if not [%_WRAPPER_CONF%]==[""] (
|
||||||
|
shift
|
||||||
|
goto :startup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
|
||||||
|
|
||||||
|
rem
|
||||||
|
rem Start the Wrapper
|
||||||
|
rem
|
||||||
|
:startup
|
||||||
|
|
||||||
|
rem Collect an parameters
|
||||||
|
:parameters
|
||||||
|
set _PARAMETERS=%_PARAMETERS% %1
|
||||||
|
shift
|
||||||
|
if not [%1]==[] goto :parameters
|
||||||
|
|
||||||
|
if [%_PASS_THROUGH%]==[] (
|
||||||
|
%_WRAPPER_EXE% -r %_WRAPPER_CONF%
|
||||||
|
) else (
|
||||||
|
%_WRAPPER_EXE% -r %_WRAPPER_CONF% -- %_PARAMETERS%
|
||||||
|
)
|
||||||
|
if not errorlevel 1 goto :eof
|
||||||
|
pause
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,176 @@
|
|||||||
|
#encoding=UTF-8
|
||||||
|
# Configuration files must begin with a line specifying the encoding
|
||||||
|
# of the the file.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#********************************************************************
|
||||||
|
# Wrapper Localization
|
||||||
|
#********************************************************************
|
||||||
|
# Specify the locale which the Wrapper should use. By default the system
|
||||||
|
# locale is used.
|
||||||
|
#wrapper.lang=en_US
|
||||||
|
|
||||||
|
# Specify the location of the Wrapper's language resources. If these are
|
||||||
|
# missing, the Wrapper will default to the en_US locale.
|
||||||
|
wrapper.lang.folder=../lang
|
||||||
|
|
||||||
|
#********************************************************************
|
||||||
|
# Wrapper Java Properties
|
||||||
|
#********************************************************************
|
||||||
|
# Java Application
|
||||||
|
# Locate the java binary on the system PATH:
|
||||||
|
wrapper.java.command=java
|
||||||
|
# Specify a specific java binary:
|
||||||
|
#set.JAVA_HOME=/java/path
|
||||||
|
#wrapper.java.command=%JAVA_HOME%/bin/java
|
||||||
|
|
||||||
|
# Tell the Wrapper to log the full generated Java command line.
|
||||||
|
#wrapper.java.command.loglevel=INFO
|
||||||
|
|
||||||
|
# Java Main class. This class must implement the WrapperListener interface
|
||||||
|
# or guarantee that the WrapperManager class is initialized. Helper
|
||||||
|
# classes are provided to do this for you. See the Integration section
|
||||||
|
# of the documentation for details.
|
||||||
|
wrapper.java.mainclass=de.geis.pdfdownloader.Main
|
||||||
|
|
||||||
|
# Java Classpath (include wrapper.jar) Add class path elements as
|
||||||
|
# needed starting from 1
|
||||||
|
wrapper.java.classpath.1=./libs/wrapper.jar
|
||||||
|
wrapper.java.classpath.2=pdfdownloader.jar
|
||||||
|
wrapper.java.classpath.3=./libs/pdfbox-2.0.8.jar
|
||||||
|
wrapper.java.classpath.4=./libs/commons-logging-1.2.jar
|
||||||
|
wrapper.java.classpath.5=./libs/fontbox-2.0.8.jar
|
||||||
|
|
||||||
|
# Java Library Path (location of Wrapper.DLL or libwrapper.so)
|
||||||
|
wrapper.java.library.path.1=libs/
|
||||||
|
|
||||||
|
# Java Bits. On applicable platforms, tells the JVM to run in 32 or 64-bit mode.
|
||||||
|
wrapper.java.additional.auto_bits=TRUE
|
||||||
|
|
||||||
|
# Java Additional Parameters
|
||||||
|
wrapper.java.additional.1=
|
||||||
|
|
||||||
|
# Initial Java Heap Size (in MB)
|
||||||
|
wrapper.java.initmemory=3
|
||||||
|
|
||||||
|
# Maximum Java Heap Size (in MB)
|
||||||
|
wrapper.java.maxmemory=256
|
||||||
|
|
||||||
|
# Application parameters. Add parameters as needed starting from 1
|
||||||
|
wrapper.app.parameter.1=C:\FTPRoot\configDownload\ #Property File
|
||||||
|
wrapper.app.parameter.2=C:\FTPRoot\error\ #Error Ordner
|
||||||
|
wrapper.app.parameter.3=C:\FTPRoot\pdf\ #PDF Ordner
|
||||||
|
wrapper.app.parameter.4=C:\FTPRoot\config\ #Property File fuer den zweiten Dienst (Druck)
|
||||||
|
wrapper.app.parameter.5=C:\FTPRoot\testing\ #PDF Ordner wo nix geloescht wird
|
||||||
|
|
||||||
|
|
||||||
|
# Delay (Millisekunden)
|
||||||
|
wrapper.app.parameter.6=25
|
||||||
|
|
||||||
|
# Versuche
|
||||||
|
wrapper.app.parameter.7=5
|
||||||
|
|
||||||
|
|
||||||
|
#********************************************************************
|
||||||
|
# Wrapper Logging Properties
|
||||||
|
#********************************************************************
|
||||||
|
# Enables Debug output from the Wrapper.
|
||||||
|
wrapper.debug=FALSE
|
||||||
|
|
||||||
|
# Format of output for the console. (See docs for formats)
|
||||||
|
wrapper.console.format=PM
|
||||||
|
|
||||||
|
# Log Level for console output. (See docs for log levels)
|
||||||
|
wrapper.console.loglevel=INFO
|
||||||
|
|
||||||
|
# Log file to use for wrapper output logging.
|
||||||
|
wrapper.logfile=wrapper.log
|
||||||
|
|
||||||
|
# Format of output for the log file. (See docs for formats)
|
||||||
|
wrapper.logfile.format=LPTM
|
||||||
|
|
||||||
|
# Log Level for log file output. (See docs for log levels)
|
||||||
|
wrapper.logfile.loglevel=INFO
|
||||||
|
|
||||||
|
# Maximum size that the log file will be allowed to grow to before
|
||||||
|
# the log is rolled. Size is specified in bytes. The default value
|
||||||
|
# of 0, disables log rolling. May abbreviate with the 'k' (kb) or
|
||||||
|
# 'm' (mb) suffix. For example: 10m = 10 megabytes.
|
||||||
|
wrapper.logfile.maxsize=10m
|
||||||
|
|
||||||
|
# Maximum number of rolled log files which will be allowed before old
|
||||||
|
# files are deleted. The default value of 0 implies no limit.
|
||||||
|
wrapper.logfile.maxfiles=5
|
||||||
|
|
||||||
|
# Log Level for sys/event log output. (See docs for log levels)
|
||||||
|
wrapper.syslog.loglevel=INFO
|
||||||
|
|
||||||
|
# Pings
|
||||||
|
# wrapper.ping.interval.logged=60
|
||||||
|
|
||||||
|
#********************************************************************
|
||||||
|
# Wrapper General Properties
|
||||||
|
#********************************************************************
|
||||||
|
# Allow for the use of non-contiguous numbered properties
|
||||||
|
wrapper.ignore_sequence_gaps=TRUE
|
||||||
|
|
||||||
|
# Do not start if the pid file already exists.
|
||||||
|
wrapper.pidfile.strict=TRUE
|
||||||
|
|
||||||
|
# Title to use when running as a console
|
||||||
|
wrapper.console.title=PDF Downloader (Watcher)
|
||||||
|
|
||||||
|
#********************************************************************
|
||||||
|
# Wrapper JVM Checks
|
||||||
|
#********************************************************************
|
||||||
|
# Detect DeadLocked Threads in the JVM. (Requires Standard Edition)
|
||||||
|
wrapper.check.deadlock=TRUE
|
||||||
|
wrapper.check.deadlock.interval=10
|
||||||
|
wrapper.check.deadlock.action=RESTART
|
||||||
|
wrapper.check.deadlock.output=FULL
|
||||||
|
|
||||||
|
# Out Of Memory detection.
|
||||||
|
# (Ignore output from dumping the configuration to the console. This is only needed by the TestWrapper sample application.)
|
||||||
|
wrapper.filter.trigger.999=wrapper.filter.trigger.*java.lang.OutOfMemoryError
|
||||||
|
wrapper.filter.allow_wildcards.999=TRUE
|
||||||
|
wrapper.filter.action.999=NONE
|
||||||
|
# Ignore -verbose:class output to avoid false positives.
|
||||||
|
wrapper.filter.trigger.1000=[Loaded java.lang.OutOfMemoryError
|
||||||
|
wrapper.filter.action.1000=NONE
|
||||||
|
# (Simple match)
|
||||||
|
wrapper.filter.trigger.1001=java.lang.OutOfMemoryError
|
||||||
|
# (Only match text in stack traces if -XX:+PrintClassHistogram is being used.)
|
||||||
|
#wrapper.filter.trigger.1001=Exception in thread "*" java.lang.OutOfMemoryError
|
||||||
|
#wrapper.filter.allow_wildcards.1001=TRUE
|
||||||
|
wrapper.filter.action.1001=RESTART
|
||||||
|
wrapper.filter.message.1001=The JVM has run out of memory.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#********************************************************************
|
||||||
|
# Wrapper Windows NT/2000/XP Service Properties
|
||||||
|
#********************************************************************
|
||||||
|
# WARNING - Do not modify any of these properties when an application
|
||||||
|
# using this configuration file has been installed as a service.
|
||||||
|
# Please uninstall the service before modifying this section. The
|
||||||
|
# service can then be reinstalled.
|
||||||
|
|
||||||
|
# Name of the service
|
||||||
|
wrapper.name=PDF Download Server
|
||||||
|
|
||||||
|
# Display name of the service
|
||||||
|
wrapper.displayname=PDF Download Server
|
||||||
|
|
||||||
|
# Description of the service
|
||||||
|
wrapper.description=PDF Download Server
|
||||||
|
|
||||||
|
# Service dependencies. Add dependencies as needed starting from 1
|
||||||
|
wrapper.ntservice.dependency.1=
|
||||||
|
|
||||||
|
# Mode in which the service is installed. AUTO_START, DELAY_START or DEMAND_START
|
||||||
|
wrapper.ntservice.starttype=AUTO_START
|
||||||
|
|
||||||
|
# Allow the service to interact with the desktop.
|
||||||
|
wrapper.ntservice.interactive=true
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,135 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
rem
|
||||||
|
rem Copyright (c) 1999, 2013 Tanuki Software, Ltd.
|
||||||
|
rem http://www.tanukisoftware.com
|
||||||
|
rem All rights reserved.
|
||||||
|
rem
|
||||||
|
rem This software is the proprietary information of Tanuki Software.
|
||||||
|
rem You shall use it only in accordance with the terms of the
|
||||||
|
rem license agreement you entered into with Tanuki Software.
|
||||||
|
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
|
||||||
|
rem
|
||||||
|
rem Java Service Wrapper general passthrough startup script.
|
||||||
|
rem
|
||||||
|
rem -----------------------------------------------------------------------------
|
||||||
|
rem These settings can be modified to fit the needs of your application
|
||||||
|
rem Optimized for use with version 3.5.20 of the Wrapper.
|
||||||
|
|
||||||
|
rem The base name for the Wrapper binary.
|
||||||
|
set _WRAPPER_BASE=wrapper
|
||||||
|
|
||||||
|
rem The directory where the Wrapper binary (.exe) file is located, this can be
|
||||||
|
rem either a absolute or relative path. If the path contains any special characters,
|
||||||
|
rem please make sure to quote the variable.
|
||||||
|
set _WRAPPER_DIR=
|
||||||
|
|
||||||
|
rem The name and location of the Wrapper configuration file. This will be used
|
||||||
|
rem if the user does not specify a configuration file as the first parameter to
|
||||||
|
rem this script. It will not be possible to specify a configuration file on the
|
||||||
|
rem command line if _PASS_THROUGH is set.
|
||||||
|
rem If a relative path is specified, please note that the location is based on the
|
||||||
|
rem location.
|
||||||
|
set _WRAPPER_CONF_DEFAULT="%_WRAPPER_BASE%.conf"
|
||||||
|
|
||||||
|
rem Makes it possible to override the Wrapper configuration file by specifying it
|
||||||
|
rem as the first parameter.
|
||||||
|
rem set _WRAPPER_CONF_OVERRIDE=true
|
||||||
|
|
||||||
|
rem _PASS_THROUGH tells the script to pass all parameters through to the JVM as
|
||||||
|
rem is.
|
||||||
|
set _PASS_THROUGH=true
|
||||||
|
|
||||||
|
rem Do not modify anything beyond this point
|
||||||
|
rem -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
rem
|
||||||
|
rem Resolve the real path of the wrapper.exe
|
||||||
|
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
|
||||||
|
rem can be hard-coded below and the following test removed.
|
||||||
|
rem
|
||||||
|
if "%OS%"=="Windows_NT" goto nt
|
||||||
|
echo This script only works with NT-based versions of Windows.
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
:nt
|
||||||
|
rem Find the application home.
|
||||||
|
rem if no path path specified do the default action
|
||||||
|
IF not DEFINED _WRAPPER_DIR goto dir_undefined
|
||||||
|
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
|
||||||
|
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
|
||||||
|
rem check if absolute path
|
||||||
|
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
|
||||||
|
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
|
||||||
|
rem everythig else means relative path
|
||||||
|
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
|
||||||
|
goto pathfound
|
||||||
|
|
||||||
|
:dir_undefined
|
||||||
|
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
|
||||||
|
set _REALPATH="%~dp0"
|
||||||
|
goto pathfound
|
||||||
|
:absolute_path
|
||||||
|
rem Use an absolute path to the wrapper
|
||||||
|
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
|
||||||
|
|
||||||
|
:pathfound
|
||||||
|
rem
|
||||||
|
rem Decide on the specific Wrapper binary to use (See delta-pack)
|
||||||
|
rem
|
||||||
|
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
|
||||||
|
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
|
||||||
|
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
|
||||||
|
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
|
||||||
|
goto search
|
||||||
|
:amd64
|
||||||
|
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
|
||||||
|
goto search
|
||||||
|
:ia64
|
||||||
|
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
|
||||||
|
goto search
|
||||||
|
:search
|
||||||
|
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
|
||||||
|
if exist %_WRAPPER_EXE% goto conf
|
||||||
|
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
|
||||||
|
if exist %_WRAPPER_EXE% goto conf
|
||||||
|
echo Unable to locate a Wrapper executable using any of the following names:
|
||||||
|
echo %_WRAPPER_L_EXE%
|
||||||
|
echo %_WRAPPER_EXE%
|
||||||
|
pause
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
rem
|
||||||
|
rem Find the wrapper.conf
|
||||||
|
rem
|
||||||
|
:conf
|
||||||
|
if not [%_WRAPPER_CONF_OVERRIDE%]==[] (
|
||||||
|
set _WRAPPER_CONF="%~f1"
|
||||||
|
if not [%_WRAPPER_CONF%]==[""] (
|
||||||
|
shift
|
||||||
|
goto :startup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
|
||||||
|
|
||||||
|
rem
|
||||||
|
rem Start the Wrapper
|
||||||
|
rem
|
||||||
|
:startup
|
||||||
|
|
||||||
|
rem Collect an parameters
|
||||||
|
:parameters
|
||||||
|
set _PARAMETERS=%_PARAMETERS% %1
|
||||||
|
shift
|
||||||
|
if not [%1]==[] goto :parameters
|
||||||
|
|
||||||
|
if [%_PASS_THROUGH%]==[] (
|
||||||
|
%_WRAPPER_EXE% -i %_WRAPPER_CONF%
|
||||||
|
) else (
|
||||||
|
%_WRAPPER_EXE% -i %_WRAPPER_CONF% -- %_PARAMETERS%
|
||||||
|
)
|
||||||
|
if not errorlevel 1 goto :eof
|
||||||
|
pause
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,133 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
rem
|
||||||
|
rem Copyright (c) 1999, 2013 Tanuki Software, Ltd.
|
||||||
|
rem http://www.tanukisoftware.com
|
||||||
|
rem All rights reserved.
|
||||||
|
rem
|
||||||
|
rem This software is the proprietary information of Tanuki Software.
|
||||||
|
rem You shall use it only in accordance with the terms of the
|
||||||
|
rem license agreement you entered into with Tanuki Software.
|
||||||
|
rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html
|
||||||
|
rem
|
||||||
|
rem Java Service Wrapper general startup script.
|
||||||
|
rem
|
||||||
|
|
||||||
|
rem -----------------------------------------------------------------------------
|
||||||
|
rem These settings can be modified to fit the needs of your application
|
||||||
|
rem Optimized for use with version 3.5.20 of the Wrapper.
|
||||||
|
|
||||||
|
rem The base name for the Wrapper binary.
|
||||||
|
set _WRAPPER_BASE=wrapper
|
||||||
|
|
||||||
|
rem The directory where the Wrapper binary (.exe) file is located, this can be
|
||||||
|
rem either a absolute or relative path. If the path contains any special characters,
|
||||||
|
rem please make sure to quote the variable.
|
||||||
|
set _WRAPPER_DIR=
|
||||||
|
|
||||||
|
rem The name and location of the Wrapper configuration file. This will be used
|
||||||
|
rem if the user does not specify a configuration file as the first parameter to
|
||||||
|
rem this script. It will not be possible to specify a configuration file on the
|
||||||
|
rem command line if _PASS_THROUGH is set.
|
||||||
|
rem If a relative path is specified, please note that the location is based on the
|
||||||
|
rem location.
|
||||||
|
set _WRAPPER_CONF_DEFAULT="%_WRAPPER_BASE%.conf"
|
||||||
|
|
||||||
|
rem Makes it possible to override the Wrapper configuration file by specifying it
|
||||||
|
rem as the first parameter.
|
||||||
|
rem set _WRAPPER_CONF_OVERRIDE=true
|
||||||
|
|
||||||
|
rem Note that it is only possible to pass parameters through to the JVM when
|
||||||
|
rem installing the service, or when running in a console.
|
||||||
|
|
||||||
|
rem Do not modify anything beyond this point
|
||||||
|
rem -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
rem
|
||||||
|
rem Resolve the real path of the wrapper.exe
|
||||||
|
rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
|
||||||
|
rem can be hard-coded below and the following test removed.
|
||||||
|
rem
|
||||||
|
if "%OS%"=="Windows_NT" goto nt
|
||||||
|
echo This script only works with NT-based versions of Windows.
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
:nt
|
||||||
|
rem Find the application home.
|
||||||
|
rem if no path path specified do the default action
|
||||||
|
IF not DEFINED _WRAPPER_DIR goto dir_undefined
|
||||||
|
set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%"
|
||||||
|
if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\"
|
||||||
|
rem check if absolute path
|
||||||
|
if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path
|
||||||
|
if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path
|
||||||
|
rem everythig else means relative path
|
||||||
|
set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%"
|
||||||
|
goto pathfound
|
||||||
|
|
||||||
|
:dir_undefined
|
||||||
|
rem Use a relative path to the wrapper %~dp0 is location of current script under NT
|
||||||
|
set _REALPATH="%~dp0"
|
||||||
|
goto pathfound
|
||||||
|
:absolute_path
|
||||||
|
rem Use an absolute path to the wrapper
|
||||||
|
set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%"
|
||||||
|
|
||||||
|
:pathfound
|
||||||
|
rem
|
||||||
|
rem Decide on the specific Wrapper binary to use (See delta-pack)
|
||||||
|
rem
|
||||||
|
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64
|
||||||
|
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64
|
||||||
|
if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64
|
||||||
|
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe"
|
||||||
|
goto search
|
||||||
|
:amd64
|
||||||
|
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe"
|
||||||
|
goto search
|
||||||
|
:ia64
|
||||||
|
set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe"
|
||||||
|
goto search
|
||||||
|
:search
|
||||||
|
set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%"
|
||||||
|
if exist %_WRAPPER_EXE% goto conf
|
||||||
|
set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe"
|
||||||
|
if exist %_WRAPPER_EXE% goto conf
|
||||||
|
echo Unable to locate a Wrapper executable using any of the following names:
|
||||||
|
echo %_WRAPPER_L_EXE%
|
||||||
|
echo %_WRAPPER_EXE%
|
||||||
|
pause
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
rem
|
||||||
|
rem Find the wrapper.conf
|
||||||
|
rem
|
||||||
|
:conf
|
||||||
|
if not [%_WRAPPER_CONF_OVERRIDE%]==[] (
|
||||||
|
set _WRAPPER_CONF="%~f1"
|
||||||
|
if not [%_WRAPPER_CONF%]==[""] (
|
||||||
|
shift
|
||||||
|
goto :startup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%"
|
||||||
|
|
||||||
|
rem
|
||||||
|
rem Start the Wrapper
|
||||||
|
rem
|
||||||
|
:startup
|
||||||
|
|
||||||
|
rem Collect an parameters
|
||||||
|
:parameters
|
||||||
|
set _PARAMETERS=%_PARAMETERS% %1
|
||||||
|
shift
|
||||||
|
if not [%1]==[] goto :parameters
|
||||||
|
|
||||||
|
if [%_PASS_THROUGH%]==[] (
|
||||||
|
%_WRAPPER_EXE% -r %_WRAPPER_CONF%
|
||||||
|
) else (
|
||||||
|
%_WRAPPER_EXE% -r %_WRAPPER_CONF% -- %_PARAMETERS%
|
||||||
|
)
|
||||||
|
if not errorlevel 1 goto :eof
|
||||||
|
pause
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,174 @@
|
|||||||
|
#encoding=UTF-8
|
||||||
|
# Configuration files must begin with a line specifying the encoding
|
||||||
|
# of the the file.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#********************************************************************
|
||||||
|
# Wrapper Localization
|
||||||
|
#********************************************************************
|
||||||
|
# Specify the locale which the Wrapper should use. By default the system
|
||||||
|
# locale is used.
|
||||||
|
#wrapper.lang=en_US
|
||||||
|
|
||||||
|
# Specify the location of the Wrapper's language resources. If these are
|
||||||
|
# missing, the Wrapper will default to the en_US locale.
|
||||||
|
wrapper.lang.folder=../lang
|
||||||
|
|
||||||
|
#********************************************************************
|
||||||
|
# Wrapper Java Properties
|
||||||
|
#********************************************************************
|
||||||
|
# Java Application
|
||||||
|
# Locate the java binary on the system PATH:
|
||||||
|
wrapper.java.command=java
|
||||||
|
# Specify a specific java binary:
|
||||||
|
#set.JAVA_HOME=/java/path
|
||||||
|
#wrapper.java.command=%JAVA_HOME%/bin/java
|
||||||
|
|
||||||
|
# Tell the Wrapper to log the full generated Java command line.
|
||||||
|
#wrapper.java.command.loglevel=INFO
|
||||||
|
|
||||||
|
# Java Main class. This class must implement the WrapperListener interface
|
||||||
|
# or guarantee that the WrapperManager class is initialized. Helper
|
||||||
|
# classes are provided to do this for you. See the Integration section
|
||||||
|
# of the documentation for details.
|
||||||
|
wrapper.java.mainclass=de.geis.printserver.Main
|
||||||
|
|
||||||
|
# Java Classpath (include wrapper.jar) Add class path elements as
|
||||||
|
# needed starting from 1
|
||||||
|
wrapper.java.classpath.1=./libs/wrapper.jar
|
||||||
|
wrapper.java.classpath.2=pdfprinter.jar
|
||||||
|
wrapper.java.classpath.3=./libs/pdfbox-2.0.8.jar
|
||||||
|
wrapper.java.classpath.4=./libs/commons-logging-1.2.jar
|
||||||
|
wrapper.java.classpath.5=./libs/fontbox-2.0.8.jar
|
||||||
|
|
||||||
|
# Java Library Path (location of Wrapper.DLL or libwrapper.so)
|
||||||
|
wrapper.java.library.path.1=libs/
|
||||||
|
|
||||||
|
# Java Bits. On applicable platforms, tells the JVM to run in 32 or 64-bit mode.
|
||||||
|
wrapper.java.additional.auto_bits=TRUE
|
||||||
|
|
||||||
|
# Java Additional Parameters
|
||||||
|
wrapper.java.additional.1=
|
||||||
|
|
||||||
|
# Initial Java Heap Size (in MB)
|
||||||
|
wrapper.java.initmemory=3
|
||||||
|
|
||||||
|
# Maximum Java Heap Size (in MB)
|
||||||
|
wrapper.java.maxmemory=256
|
||||||
|
|
||||||
|
# Application parameters. Add parameters as needed starting from 1
|
||||||
|
wrapper.app.parameter.1=C:\FTPRoot\config\
|
||||||
|
wrapper.app.parameter.2=C:\FTPRoot\error\
|
||||||
|
wrapper.app.parameter.3=C:\FTPRoot\pdf\
|
||||||
|
|
||||||
|
|
||||||
|
# Delay (Millisekunden)
|
||||||
|
wrapper.app.parameter.4=25
|
||||||
|
|
||||||
|
# Versuche
|
||||||
|
wrapper.app.parameter.5=5
|
||||||
|
|
||||||
|
|
||||||
|
#********************************************************************
|
||||||
|
# Wrapper Logging Properties
|
||||||
|
#********************************************************************
|
||||||
|
# Enables Debug output from the Wrapper.
|
||||||
|
wrapper.debug=FALSE
|
||||||
|
|
||||||
|
# Format of output for the console. (See docs for formats)
|
||||||
|
wrapper.console.format=PM
|
||||||
|
|
||||||
|
# Log Level for console output. (See docs for log levels)
|
||||||
|
wrapper.console.loglevel=INFO
|
||||||
|
|
||||||
|
# Log file to use for wrapper output logging.
|
||||||
|
wrapper.logfile=wrapper.log
|
||||||
|
|
||||||
|
# Format of output for the log file. (See docs for formats)
|
||||||
|
wrapper.logfile.format=LPTM
|
||||||
|
|
||||||
|
# Log Level for log file output. (See docs for log levels)
|
||||||
|
wrapper.logfile.loglevel=INFO
|
||||||
|
|
||||||
|
# Maximum size that the log file will be allowed to grow to before
|
||||||
|
# the log is rolled. Size is specified in bytes. The default value
|
||||||
|
# of 0, disables log rolling. May abbreviate with the 'k' (kb) or
|
||||||
|
# 'm' (mb) suffix. For example: 10m = 10 megabytes.
|
||||||
|
wrapper.logfile.maxsize=10m
|
||||||
|
|
||||||
|
# Maximum number of rolled log files which will be allowed before old
|
||||||
|
# files are deleted. The default value of 0 implies no limit.
|
||||||
|
wrapper.logfile.maxfiles=5
|
||||||
|
|
||||||
|
# Log Level for sys/event log output. (See docs for log levels)
|
||||||
|
wrapper.syslog.loglevel=INFO
|
||||||
|
|
||||||
|
# Pings
|
||||||
|
# wrapper.ping.interval.logged=60
|
||||||
|
|
||||||
|
#********************************************************************
|
||||||
|
# Wrapper General Properties
|
||||||
|
#********************************************************************
|
||||||
|
# Allow for the use of non-contiguous numbered properties
|
||||||
|
wrapper.ignore_sequence_gaps=TRUE
|
||||||
|
|
||||||
|
# Do not start if the pid file already exists.
|
||||||
|
wrapper.pidfile.strict=TRUE
|
||||||
|
|
||||||
|
# Title to use when running as a console
|
||||||
|
wrapper.console.title=PDF Printer (Watcher)
|
||||||
|
|
||||||
|
#********************************************************************
|
||||||
|
# Wrapper JVM Checks
|
||||||
|
#********************************************************************
|
||||||
|
# Detect DeadLocked Threads in the JVM. (Requires Standard Edition)
|
||||||
|
wrapper.check.deadlock=TRUE
|
||||||
|
wrapper.check.deadlock.interval=10
|
||||||
|
wrapper.check.deadlock.action=RESTART
|
||||||
|
wrapper.check.deadlock.output=FULL
|
||||||
|
|
||||||
|
# Out Of Memory detection.
|
||||||
|
# (Ignore output from dumping the configuration to the console. This is only needed by the TestWrapper sample application.)
|
||||||
|
wrapper.filter.trigger.999=wrapper.filter.trigger.*java.lang.OutOfMemoryError
|
||||||
|
wrapper.filter.allow_wildcards.999=TRUE
|
||||||
|
wrapper.filter.action.999=NONE
|
||||||
|
# Ignore -verbose:class output to avoid false positives.
|
||||||
|
wrapper.filter.trigger.1000=[Loaded java.lang.OutOfMemoryError
|
||||||
|
wrapper.filter.action.1000=NONE
|
||||||
|
# (Simple match)
|
||||||
|
wrapper.filter.trigger.1001=java.lang.OutOfMemoryError
|
||||||
|
# (Only match text in stack traces if -XX:+PrintClassHistogram is being used.)
|
||||||
|
#wrapper.filter.trigger.1001=Exception in thread "*" java.lang.OutOfMemoryError
|
||||||
|
#wrapper.filter.allow_wildcards.1001=TRUE
|
||||||
|
wrapper.filter.action.1001=RESTART
|
||||||
|
wrapper.filter.message.1001=The JVM has run out of memory.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#********************************************************************
|
||||||
|
# Wrapper Windows NT/2000/XP Service Properties
|
||||||
|
#********************************************************************
|
||||||
|
# WARNING - Do not modify any of these properties when an application
|
||||||
|
# using this configuration file has been installed as a service.
|
||||||
|
# Please uninstall the service before modifying this section. The
|
||||||
|
# service can then be reinstalled.
|
||||||
|
|
||||||
|
# Name of the service
|
||||||
|
wrapper.name=PDF Print Server
|
||||||
|
|
||||||
|
# Display name of the service
|
||||||
|
wrapper.displayname=PDF Print Server
|
||||||
|
|
||||||
|
# Description of the service
|
||||||
|
wrapper.description=PDF Print Server
|
||||||
|
|
||||||
|
# Service dependencies. Add dependencies as needed starting from 1
|
||||||
|
wrapper.ntservice.dependency.1=
|
||||||
|
|
||||||
|
# Mode in which the service is installed. AUTO_START, DELAY_START or DEMAND_START
|
||||||
|
wrapper.ntservice.starttype=AUTO_START
|
||||||
|
|
||||||
|
# Allow the service to interact with the desktop.
|
||||||
|
wrapper.ntservice.interactive=true
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,140 @@
|
|||||||
|
STATUS | wrapper | 2018/03/07 16:16:01 | --> Wrapper Started as Console
|
||||||
|
STATUS | wrapper | 2018/03/07 16:16:01 | Java Service Wrapper Community Edition 32-bit 3.5.20
|
||||||
|
STATUS | wrapper | 2018/03/07 16:16:01 | Copyright (C) 1999-2013 Tanuki Software, Ltd. All Rights Reserved.
|
||||||
|
STATUS | wrapper | 2018/03/07 16:16:01 | http://wrapper.tanukisoftware.com
|
||||||
|
STATUS | wrapper | 2018/03/07 16:16:01 |
|
||||||
|
STATUS | wrapper | 2018/03/07 16:16:02 | Launching a JVM...
|
||||||
|
INFO | jvm 1 | 2018/03/07 16:16:02 | WrapperManager: Initializing...
|
||||||
|
INFO | jvm 1 | 2018/03/07 16:16:02 | WrapperManager:
|
||||||
|
INFO | jvm 1 | 2018/03/07 16:16:02 | WrapperManager: WARNING - Unable to load the Wrapper's native library 'wrapper.dll'.
|
||||||
|
INFO | jvm 1 | 2018/03/07 16:16:02 | WrapperManager: The file is located on the path at the following location but
|
||||||
|
INFO | jvm 1 | 2018/03/07 16:16:02 | WrapperManager: could not be loaded:
|
||||||
|
INFO | jvm 1 | 2018/03/07 16:16:02 | WrapperManager: C:\workspace\riscprojects\PDFPrintServer\PDFPrintServer\libs\wrapper.dll
|
||||||
|
INFO | jvm 1 | 2018/03/07 16:16:02 | WrapperManager: Please verify that the file is both readable and executable by the
|
||||||
|
INFO | jvm 1 | 2018/03/07 16:16:02 | WrapperManager: current user and that the file has not been corrupted in any way.
|
||||||
|
INFO | jvm 1 | 2018/03/07 16:16:02 | WrapperManager: One common cause of this problem is running a 32-bit version
|
||||||
|
INFO | jvm 1 | 2018/03/07 16:16:02 | WrapperManager: of the Wrapper with a 64-bit version of Java, or vica versa.
|
||||||
|
INFO | jvm 1 | 2018/03/07 16:16:02 | WrapperManager: This is a 64-bit JVM.
|
||||||
|
INFO | jvm 1 | 2018/03/07 16:16:02 | WrapperManager: Reported cause:
|
||||||
|
INFO | jvm 1 | 2018/03/07 16:16:02 | WrapperManager: C:\workspace\riscprojects\PDFPrintServer\PDFPrintServer\libs\wrapper.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
|
||||||
|
INFO | jvm 1 | 2018/03/07 16:16:02 | WrapperManager: System signals will not be handled correctly.
|
||||||
|
INFO | jvm 1 | 2018/03/07 16:16:02 | WrapperManager:
|
||||||
|
INFO | jvm 1 | 2018/03/07 16:16:02 | STARTED
|
||||||
|
INFO | jvm 1 | 2018/03/07 16:16:58 | Success
|
||||||
|
FATAL | wrapper | 2018/03/07 16:25:29 | Stdin CreateNamedPipe failed (231): Alle Pipeinstanzen sind ausgelastet. (0xe7)
|
||||||
|
FATAL | wrapper | 2018/03/07 16:25:43 | Stdin CreateNamedPipe failed (231): Alle Pipeinstanzen sind ausgelastet. (0xe7)
|
||||||
|
STATUS | wrapper | 2022/05/11 10:29:11 | --> Wrapper Started as Console
|
||||||
|
STATUS | wrapper | 2022/05/11 10:29:11 | Java Service Wrapper Community Edition 32-bit 3.5.20
|
||||||
|
STATUS | wrapper | 2022/05/11 10:29:11 | Copyright (C) 1999-2013 Tanuki Software, Ltd. All Rights Reserved.
|
||||||
|
STATUS | wrapper | 2022/05/11 10:29:11 | http://wrapper.tanukisoftware.com
|
||||||
|
STATUS | wrapper | 2022/05/11 10:29:11 |
|
||||||
|
STATUS | wrapper | 2022/05/11 10:29:11 | Launching a JVM...
|
||||||
|
INFO | jvm 1 | 2022/05/11 10:29:11 | WrapperManager: Initializing...
|
||||||
|
INFO | jvm 1 | 2022/05/11 10:29:12 | DELAY = 25
|
||||||
|
INFO | jvm 1 | 2022/05/11 10:29:12 | VERSUCHE = 5
|
||||||
|
INFO | jvm 1 | 2022/05/11 10:29:12 | STARTED
|
||||||
|
STATUS | wrapper | 2022/05/11 10:36:53 | --> Wrapper Started as Console
|
||||||
|
STATUS | wrapper | 2022/05/11 10:36:53 | Java Service Wrapper Community Edition 32-bit 3.5.20
|
||||||
|
STATUS | wrapper | 2022/05/11 10:36:53 | Copyright (C) 1999-2013 Tanuki Software, Ltd. All Rights Reserved.
|
||||||
|
STATUS | wrapper | 2022/05/11 10:36:53 | http://wrapper.tanukisoftware.com
|
||||||
|
STATUS | wrapper | 2022/05/11 10:36:53 |
|
||||||
|
STATUS | wrapper | 2022/05/11 10:36:53 | Launching a JVM...
|
||||||
|
INFO | jvm 1 | 2022/05/11 10:36:53 | WrapperManager: Initializing...
|
||||||
|
INFO | jvm 1 | 2022/05/11 10:36:53 | DELAY = 25
|
||||||
|
INFO | jvm 1 | 2022/05/11 10:36:53 | VERSUCHE = 5
|
||||||
|
INFO | jvm 1 | 2022/05/11 10:36:53 | STARTED
|
||||||
|
INFO | jvm 1 | 2022/05/11 10:36:53 | STATUS: false
|
||||||
|
STATUS | wrapper | 2022/05/11 10:38:30 | --> Wrapper Started as Console
|
||||||
|
STATUS | wrapper | 2022/05/11 10:38:30 | Java Service Wrapper Community Edition 32-bit 3.5.20
|
||||||
|
STATUS | wrapper | 2022/05/11 10:38:30 | Copyright (C) 1999-2013 Tanuki Software, Ltd. All Rights Reserved.
|
||||||
|
STATUS | wrapper | 2022/05/11 10:38:30 | http://wrapper.tanukisoftware.com
|
||||||
|
STATUS | wrapper | 2022/05/11 10:38:30 |
|
||||||
|
STATUS | wrapper | 2022/05/11 10:38:30 | Launching a JVM...
|
||||||
|
INFO | jvm 1 | 2022/05/11 10:38:30 | WrapperManager: Initializing...
|
||||||
|
INFO | jvm 1 | 2022/05/11 10:38:30 | DELAY = 25
|
||||||
|
INFO | jvm 1 | 2022/05/11 10:38:30 | VERSUCHE = 5
|
||||||
|
INFO | jvm 1 | 2022/05/11 10:38:30 | STARTED
|
||||||
|
INFO | jvm 1 | 2022/05/11 10:38:30 | java.lang.NullPointerException
|
||||||
|
INFO | jvm 1 | 2022/05/11 10:38:30 | at de.geis.printserver.PrintMap.printPdfNotEmulate(PrintMap.java:140)
|
||||||
|
INFO | jvm 1 | 2022/05/11 10:38:30 | at de.geis.printserver.PrintMap.print(PrintMap.java:216)
|
||||||
|
INFO | jvm 1 | 2022/05/11 10:38:30 | at de.geis.printserver.PrintMap.run(PrintMap.java:441)
|
||||||
|
INFO | jvm 1 | 2022/05/11 10:38:30 | STATUS: false
|
||||||
|
STATUS | wrapper | 2022/05/17 11:23:22 | --> Wrapper Started as Console
|
||||||
|
STATUS | wrapper | 2022/05/17 11:23:22 | Java Service Wrapper Community Edition 32-bit 3.5.20
|
||||||
|
STATUS | wrapper | 2022/05/17 11:23:22 | Copyright (C) 1999-2013 Tanuki Software, Ltd. All Rights Reserved.
|
||||||
|
STATUS | wrapper | 2022/05/17 11:23:22 | http://wrapper.tanukisoftware.com
|
||||||
|
STATUS | wrapper | 2022/05/17 11:23:22 |
|
||||||
|
STATUS | wrapper | 2022/05/17 11:23:22 | Launching a JVM...
|
||||||
|
INFO | jvm 1 | 2022/05/17 11:23:22 | WrapperManager: Initializing...
|
||||||
|
INFO | jvm 1 | 2022/05/17 11:23:22 | DELAY = 25
|
||||||
|
INFO | jvm 1 | 2022/05/17 11:23:22 | VERSUCHE = 5
|
||||||
|
INFO | jvm 1 | 2022/05/17 11:23:22 | STARTED
|
||||||
|
INFO | jvm 1 | 2022/05/17 11:23:22 | java.lang.NullPointerException
|
||||||
|
INFO | jvm 1 | 2022/05/17 11:23:22 | at de.geis.printserver.PrintMap.printPdfNotEmulate(PrintMap.java:140)
|
||||||
|
INFO | jvm 1 | 2022/05/17 11:23:22 | at de.geis.printserver.PrintMap.print(PrintMap.java:216)
|
||||||
|
INFO | jvm 1 | 2022/05/17 11:23:22 | at de.geis.printserver.PrintMap.run(PrintMap.java:441)
|
||||||
|
INFO | jvm 1 | 2022/05/17 11:23:22 | STATUS: false
|
||||||
|
INFO | jvm 1 | 2022/05/17 11:24:17 | java.lang.NullPointerException
|
||||||
|
INFO | jvm 1 | 2022/05/17 11:24:17 | at de.geis.printserver.PrintMap.printPdfNotEmulate(PrintMap.java:140)
|
||||||
|
INFO | jvm 1 | 2022/05/17 11:24:17 | at de.geis.printserver.PrintMap.print(PrintMap.java:216)
|
||||||
|
INFO | jvm 1 | 2022/05/17 11:24:17 | at de.geis.printserver.PrintMap.run(PrintMap.java:441)
|
||||||
|
INFO | jvm 1 | 2022/05/17 11:24:17 | STATUS: false
|
||||||
|
STATUS | wrapper | 2022/05/17 11:31:36 | PDF Print Server service installed.
|
||||||
|
STATUS | wrapper | 2022/05/17 11:32:49 | PDF Print Server service removed.
|
||||||
|
STATUS | wrapper | 2023/02/22 08:26:37 | --> Wrapper Started as Console
|
||||||
|
STATUS | wrapper | 2023/02/22 08:26:37 | Java Service Wrapper Community Edition 32-bit 3.5.20
|
||||||
|
STATUS | wrapper | 2023/02/22 08:26:37 | Copyright (C) 1999-2013 Tanuki Software, Ltd. All Rights Reserved.
|
||||||
|
STATUS | wrapper | 2023/02/22 08:26:37 | http://wrapper.tanukisoftware.com
|
||||||
|
STATUS | wrapper | 2023/02/22 08:26:37 |
|
||||||
|
STATUS | wrapper | 2023/02/22 08:26:38 | Launching a JVM...
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:26:38 | WrapperManager: Initializing...
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:26:38 | DELAY = 25
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:26:38 | VERSUCHE = 5
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:26:38 | STARTED
|
||||||
|
STATUS | wrapper | 2023/02/22 08:42:27 | --> Wrapper Started as Console
|
||||||
|
STATUS | wrapper | 2023/02/22 08:42:27 | Java Service Wrapper Community Edition 32-bit 3.5.20
|
||||||
|
STATUS | wrapper | 2023/02/22 08:42:27 | Copyright (C) 1999-2013 Tanuki Software, Ltd. All Rights Reserved.
|
||||||
|
STATUS | wrapper | 2023/02/22 08:42:27 | http://wrapper.tanukisoftware.com
|
||||||
|
STATUS | wrapper | 2023/02/22 08:42:27 |
|
||||||
|
STATUS | wrapper | 2023/02/22 08:42:28 | Launching a JVM...
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:42:28 | WrapperManager: Initializing...
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:42:28 | DELAY = 25
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:42:28 | VERSUCHE = 5
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:42:28 | STARTED
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:42:39 | Start PRINT
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:42:39 | ERROR : Dokument nicht gefunden!, FILE : C:\FTPRoot\config\526827_raben_vers_label - Kopie.property
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:42:39 | ERROR : Dokument nicht gefunden!, FILE : C:\FTPRoot\config\526827_raben_vers_label.property
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:42:52 | Start PRINT
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:42:52 | Start PRINT
|
||||||
|
STATUS | wrapper | 2023/02/22 08:45:33 | --> Wrapper Started as Console
|
||||||
|
STATUS | wrapper | 2023/02/22 08:45:33 | Java Service Wrapper Community Edition 32-bit 3.5.20
|
||||||
|
STATUS | wrapper | 2023/02/22 08:45:33 | Copyright (C) 1999-2013 Tanuki Software, Ltd. All Rights Reserved.
|
||||||
|
STATUS | wrapper | 2023/02/22 08:45:33 | http://wrapper.tanukisoftware.com
|
||||||
|
STATUS | wrapper | 2023/02/22 08:45:33 |
|
||||||
|
STATUS | wrapper | 2023/02/22 08:45:33 | Launching a JVM...
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:45:33 | WrapperManager: Initializing...
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:45:33 | DELAY = 25
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:45:33 | VERSUCHE = 5
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:45:33 | STARTED
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:47:41 | Start PRINT
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:47:41 | ELEMC:\FTPRoot\config\526827_raben_vers_label - Kopie.property
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:47:42 | ELEMC:\FTPRoot\config\526827_raben_vers_label.property
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:50:02 | Start PRINT
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:50:02 | ELEMC:\FTPRoot\config\526827_raben_vers_label - Kopie.property
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:50:02 | EMULIERT
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:50:02 | ELEMC:\FTPRoot\config\526827_raben_vers_label.property
|
||||||
|
INFO | jvm 1 | 2023/02/22 08:50:02 | EMULIERT
|
||||||
|
INFO | wrapper | 2023/03/03 08:28:13 | The timer fell behind the system clock by 588505100ms.
|
||||||
|
STATUS | wrapper | 2023/03/31 12:48:03 | --> Wrapper Started as Console
|
||||||
|
STATUS | wrapper | 2023/03/31 12:48:03 | Java Service Wrapper Community Edition 32-bit 3.5.20
|
||||||
|
STATUS | wrapper | 2023/03/31 12:48:03 | Copyright (C) 1999-2013 Tanuki Software, Ltd. All Rights Reserved.
|
||||||
|
STATUS | wrapper | 2023/03/31 12:48:03 | http://wrapper.tanukisoftware.com
|
||||||
|
STATUS | wrapper | 2023/03/31 12:48:03 |
|
||||||
|
STATUS | wrapper | 2023/03/31 12:48:04 | Launching a JVM...
|
||||||
|
INFO | jvm 1 | 2023/03/31 12:48:04 | WrapperManager: Initializing...
|
||||||
|
INFO | jvm 1 | 2023/03/31 12:48:04 | DELAY = 25
|
||||||
|
INFO | jvm 1 | 2023/03/31 12:48:04 | VERSUCHE = 5
|
||||||
|
INFO | jvm 1 | 2023/03/31 12:48:04 | STARTED
|
||||||
|
INFO | jvm 1 | 2023/03/31 12:48:15 | Start PRINT
|
||||||
|
INFO | jvm 1 | 2023/03/31 12:48:15 | ELEMC:\FTPRoot\config\Beispiel.property
|
||||||
|
INFO | jvm 1 | 2023/03/31 12:48:15 | Success: C:\FTPRoot\config\Beispiel.property
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
STATUS:false
|
||||||
|
PDFNAME:test1.pdf
|
||||||
|
URL:http://jasperreports-75-test.de.geis-group.net:8080/jasperserver/rest_v2/reports/check_verfuegbar/check_verfuegbar.pdf?&j_username=jasper&j_password=beardley
|
||||||
|
PRINTERNAME:FULPR040
|
||||||
|
JOBNUMMER:AS400
|
||||||
|
SPOOLNAME:123
|
||||||
|
PDFEMULATE:false
|
||||||
|
COPIES:1
|
||||||
|
ZEBRAPRINT:false
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
|
||||||
|
<jardesc>
|
||||||
|
<jar path="pdf-print-und-download-server/PDFDownloader/pdfdownloader.jar"/>
|
||||||
|
<options buildIfNeeded="true" compress="true" descriptionLocation="/pdf-print-und-download-server/jars/Downloader.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
|
||||||
|
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
|
||||||
|
<selectedProjects/>
|
||||||
|
<manifest generateManifest="true" manifestLocation="" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
|
||||||
|
<sealing sealJar="false">
|
||||||
|
<packagesToSeal/>
|
||||||
|
<packagesToUnSeal/>
|
||||||
|
</sealing>
|
||||||
|
</manifest>
|
||||||
|
<selectedElements exportClassFiles="true" exportJavaFiles="false" exportOutputFolder="false">
|
||||||
|
<javaElement handleIdentifier="=pdf-print-und-download-server/src<de.geis.pdfdownloader"/>
|
||||||
|
</selectedElements>
|
||||||
|
</jardesc>
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
|
||||||
|
<jardesc>
|
||||||
|
<jar path="pdf-print-und-download-server/PDFPrintServer/pdfprinter.jar"/>
|
||||||
|
<options buildIfNeeded="true" compress="true" descriptionLocation="/pdf-print-und-download-server/jars/Printer.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
|
||||||
|
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
|
||||||
|
<selectedProjects/>
|
||||||
|
<manifest generateManifest="true" manifestLocation="" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
|
||||||
|
<sealing sealJar="false">
|
||||||
|
<packagesToSeal/>
|
||||||
|
<packagesToUnSeal/>
|
||||||
|
</sealing>
|
||||||
|
</manifest>
|
||||||
|
<selectedElements exportClassFiles="true" exportJavaFiles="false" exportOutputFolder="false">
|
||||||
|
<javaElement handleIdentifier="=pdf-print-und-download-server/src<de.geis.printserver"/>
|
||||||
|
</selectedElements>
|
||||||
|
</jardesc>
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,100 @@
|
|||||||
|
package de.geis.pdfdownloader;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
|
||||||
|
public class DownloadPDF {
|
||||||
|
|
||||||
|
//Download PDF und Kopiere in Testing Ordner
|
||||||
|
public void downloadAndCopy() throws MalformedURLException {
|
||||||
|
try {
|
||||||
|
System.out.println("Anzahl: " + m_propertyMap.keySet());
|
||||||
|
for (File elem : m_propertyMap.keySet()) {
|
||||||
|
URL url = new URL(m_propertyMap.get(elem).getURL());
|
||||||
|
try (InputStream in = url.openStream()) {
|
||||||
|
//Download
|
||||||
|
Files.copy(in, Paths.get(Parameters.getFileFolder() + "\\" + m_propertyMap.get(elem).getPdfname() + ".pdf"),
|
||||||
|
StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
|
||||||
|
//Kopie in Test Ordner legen
|
||||||
|
Files.copy(Paths.get(Parameters.getFileFolder() + "\\" + m_propertyMap.get(elem).getPdfname() + ".pdf"),
|
||||||
|
Paths.get(Parameters.getTestFolder() + "\\" + m_propertyMap.get(elem).getPdfname() + ".pdf"),
|
||||||
|
StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println("ERROR: " + m_propertyMap.get(elem).getPdfname() + " - " + e.toString());
|
||||||
|
createErrorProperty(elem, e);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
writePropertyData(elem);
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
System.out.println("ERROR: File nicht gefunden! ");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Property Datei fuer den Druckdienst wird geschrieben
|
||||||
|
public void writePropertyData(File elem) throws IOException {
|
||||||
|
try {
|
||||||
|
List<String> lines = Arrays.asList( "STATUS:false",
|
||||||
|
"PRINTERNAME:" + m_propertyMap.get(elem).getPrinterName(),
|
||||||
|
"JOBNUMMER:" + m_propertyMap.get(elem).getJobNummer(),
|
||||||
|
"PDFNAME:" + m_propertyMap.get(elem).getPdfname() + ".pdf",
|
||||||
|
"SPOOLNAME:" + m_propertyMap.get(elem).getSpoolName(),
|
||||||
|
"PDFEMULATE:" + m_propertyMap.get(elem).getEmulate(),
|
||||||
|
"COPIES:" + m_propertyMap.get(elem).getCopies(),
|
||||||
|
"ZEBRAPRINT:" + m_propertyMap.get(elem).getZebraPrint()
|
||||||
|
);
|
||||||
|
|
||||||
|
Path file = Paths.get(Parameters.getConfigFolder() + "\\" + m_propertyMap.get(elem).getPdfname() + ".property");
|
||||||
|
Files.write(file, lines, StandardCharsets.UTF_8);
|
||||||
|
System.out.println("SUCCESS: Property File geschrieben! " + m_propertyMap.get(elem).getPdfname());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.out.println("ERROR: Property File geschrieben!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Map<File, Property> m_propertyMap;
|
||||||
|
public DownloadPDF(Map<File, Property> propertyMap) {
|
||||||
|
m_propertyMap = propertyMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void createErrorProperty(File elem, Exception e) throws IOException {
|
||||||
|
FileOutputStream fileOutputStream = null;
|
||||||
|
Properties props = new Properties();
|
||||||
|
|
||||||
|
try {
|
||||||
|
props.setProperty("STATUS DOWNLOAD", ErrorCodes.DOWNLOAD.getValue());
|
||||||
|
props.setProperty("URL", m_propertyMap.get(elem).getURL());
|
||||||
|
props.setProperty("PDFNAME", m_propertyMap.get(elem).getPdfname());
|
||||||
|
props.setProperty("Exception", e.getStackTrace().toString());
|
||||||
|
|
||||||
|
fileOutputStream = new FileOutputStream(Parameters.getErrorFolder() + "\\Downloader_" + m_propertyMap.get(elem).getPdfname());
|
||||||
|
props.store(fileOutputStream, null);
|
||||||
|
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
System.out.println(ErrorCodes.DOWNLOAD.getValue() + "-" + ex.getStackTrace());
|
||||||
|
} finally {
|
||||||
|
fileOutputStream.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package de.geis.pdfdownloader;
|
||||||
|
|
||||||
|
public enum ErrorCodes {
|
||||||
|
DOKUMENTE("ERROR:Dokumentenfehler"),
|
||||||
|
DOWNLOAD("ERROR:Beim Downloaden ist was schief gegangen");
|
||||||
|
|
||||||
|
|
||||||
|
ErrorCodes(String v) {
|
||||||
|
value = v;
|
||||||
|
}
|
||||||
|
private String value = "0";
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,85 @@
|
|||||||
|
package de.geis.pdfdownloader;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.FileSystems;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.nio.file.StandardWatchEventKinds;
|
||||||
|
import java.nio.file.WatchEvent;
|
||||||
|
import java.nio.file.WatchKey;
|
||||||
|
import java.nio.file.WatchService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
|
||||||
|
public class FileSystemWatcher extends Thread {
|
||||||
|
|
||||||
|
public void startWatcher() throws InterruptedException, IOException {
|
||||||
|
WatchService watchService = FileSystems.getDefault().newWatchService();
|
||||||
|
WatchKey watchKey = Paths.get(Parameters.getDownloadFolder().toURI()).register(watchService,
|
||||||
|
StandardWatchEventKinds.ENTRY_CREATE);
|
||||||
|
|
||||||
|
//Abarbeitung liegen gebliebene Files
|
||||||
|
File[] listoffiles = Parameters.getDownloadFolder().listFiles();
|
||||||
|
|
||||||
|
for(File file : listoffiles) {
|
||||||
|
PropertyDaten propertyDaten = new PropertyDaten(file.getName());
|
||||||
|
propertyDaten.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Watcher start
|
||||||
|
while(true) {
|
||||||
|
watchKey = watchService.take();
|
||||||
|
if (watchKey != null) {
|
||||||
|
try {
|
||||||
|
TimeUnit.MILLISECONDS.sleep(25);
|
||||||
|
for (WatchEvent<?> event : watchKey.pollEvents()) {
|
||||||
|
if (event.kind().equals(StandardWatchEventKinds.ENTRY_CREATE)) {
|
||||||
|
System.out.println("--- START Sequenz --- " + event.context().toString());
|
||||||
|
normalJobPoolExecutor.submit(startSequenz(event));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watchKey.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long DELAY = 10L;
|
||||||
|
private static ThreadPoolExecutor normalJobPoolExecutor;
|
||||||
|
|
||||||
|
//Erste Sequenz zum Property Laden starten.
|
||||||
|
public Runnable startSequenz(WatchEvent<?> event) {
|
||||||
|
PropertyDaten propertyDaten = new PropertyDaten(event.context().toString());
|
||||||
|
return propertyDaten;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileSystemWatcher() {
|
||||||
|
normalJobPoolExecutor = (ThreadPoolExecutor) Executors.newCachedThreadPool();
|
||||||
|
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (normalJobPoolExecutor != null) {
|
||||||
|
normalJobPoolExecutor.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
startWatcher();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
package de.geis.pdfdownloader;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import org.tanukisoftware.wrapper.WrapperListener;
|
||||||
|
import org.tanukisoftware.wrapper.WrapperManager;
|
||||||
|
|
||||||
|
public class Main implements WrapperListener {
|
||||||
|
|
||||||
|
private FileSystemWatcher m_watcher;
|
||||||
|
|
||||||
|
private Main() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer start(String[] args) {
|
||||||
|
|
||||||
|
// Parameter werden geladen
|
||||||
|
Parameters.setDownloadFolder(new File(args[0]));
|
||||||
|
Parameters.setErrorFolder(new File(args[1]));
|
||||||
|
Parameters.setFileFolder(new File(args[2]));
|
||||||
|
Parameters.setConfigFolder(new File(args[3]));
|
||||||
|
Parameters.setTestFolder(new File(args[4]));
|
||||||
|
|
||||||
|
Parameters.setDelayTime(Integer.parseInt(new File(args[5]).toString()));
|
||||||
|
Parameters.setVersuche(Integer.parseInt(new File(args[6]).toString()));
|
||||||
|
|
||||||
|
System.out.println("DELAY = " + Parameters.getDelayTime());
|
||||||
|
System.out.println("VERSUCHE = " + Parameters.getVersuche());
|
||||||
|
|
||||||
|
m_watcher = new FileSystemWatcher();
|
||||||
|
|
||||||
|
try {
|
||||||
|
m_watcher.start();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int stop(int exitCode) {
|
||||||
|
return exitCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void controlEvent(int event) {
|
||||||
|
if ((event == WrapperManager.WRAPPER_CTRL_LOGOFF_EVENT)
|
||||||
|
&& (WrapperManager.isLaunchedAsService() || WrapperManager.isIgnoreUserLogoffs())) {
|
||||||
|
// Ignore
|
||||||
|
} else {
|
||||||
|
WrapperManager.stop(0);
|
||||||
|
// Will not get here.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
WrapperManager.start(new Main(), args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
package de.geis.pdfdownloader;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class Parameters {
|
||||||
|
private static File m_configFolder = null;
|
||||||
|
public static File getConfigFolder() {
|
||||||
|
if (m_configFolder == null) {
|
||||||
|
m_configFolder = new File("");
|
||||||
|
}
|
||||||
|
return m_configFolder;
|
||||||
|
}
|
||||||
|
public static void setConfigFolder(File configFolder) { m_configFolder = configFolder; }
|
||||||
|
|
||||||
|
private static File m_downloadFolder = null;
|
||||||
|
public static File getDownloadFolder() {
|
||||||
|
if (m_downloadFolder == null) {
|
||||||
|
m_downloadFolder = new File("");
|
||||||
|
}
|
||||||
|
return m_downloadFolder;
|
||||||
|
}
|
||||||
|
public static void setDownloadFolder(File downloadFolder) { m_downloadFolder = downloadFolder; }
|
||||||
|
|
||||||
|
private static File m_errorFolder = null;
|
||||||
|
public static File getErrorFolder() {
|
||||||
|
if (m_errorFolder == null) {
|
||||||
|
m_errorFolder = new File("");
|
||||||
|
}
|
||||||
|
return m_errorFolder;
|
||||||
|
}
|
||||||
|
public static void setErrorFolder(File errorFolder) { m_errorFolder = errorFolder; }
|
||||||
|
|
||||||
|
|
||||||
|
private static File m_fileFolder = null;
|
||||||
|
public static File getFileFolder() {
|
||||||
|
if (m_fileFolder == null) {
|
||||||
|
m_fileFolder = new File("");
|
||||||
|
}
|
||||||
|
return m_fileFolder;
|
||||||
|
}
|
||||||
|
public static void setFileFolder(File fileFolder) { m_fileFolder = fileFolder; }
|
||||||
|
|
||||||
|
private static File m_testFolder = null;
|
||||||
|
public static File getTestFolder() {
|
||||||
|
if (m_testFolder == null) {
|
||||||
|
m_testFolder = new File("");
|
||||||
|
}
|
||||||
|
return m_testFolder;
|
||||||
|
}
|
||||||
|
public static void setTestFolder(File testFolder) { m_testFolder = testFolder; }
|
||||||
|
|
||||||
|
|
||||||
|
private static int versuche = 0;
|
||||||
|
public static int getVersuche() {
|
||||||
|
if(versuche == 0) {
|
||||||
|
versuche = 3;
|
||||||
|
}
|
||||||
|
return versuche;
|
||||||
|
}
|
||||||
|
public static void setVersuche(int value) { versuche = value; }
|
||||||
|
|
||||||
|
private static int delaytime = 0;
|
||||||
|
public static int getDelayTime() {
|
||||||
|
if(delaytime == 0) {
|
||||||
|
delaytime = 25;
|
||||||
|
}
|
||||||
|
return delaytime;
|
||||||
|
}
|
||||||
|
public static void setDelayTime(int value) { delaytime = value; }
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
package de.geis.pdfdownloader;
|
||||||
|
|
||||||
|
public class Property {
|
||||||
|
|
||||||
|
private String status = null;
|
||||||
|
private String pdfname = null;
|
||||||
|
private String url = null;
|
||||||
|
private String printerName = null;
|
||||||
|
private String jobNummer = null;
|
||||||
|
private String spoolName = null;
|
||||||
|
private String emulate = null;
|
||||||
|
private String copies = null;
|
||||||
|
private String zebraPrint = null;
|
||||||
|
|
||||||
|
|
||||||
|
public String getStatus() { return status; }
|
||||||
|
public void setStatus(String status) { this.status = status; }
|
||||||
|
|
||||||
|
public String getURL() { return url; }
|
||||||
|
public void setURL(String url) { this.url = url; }
|
||||||
|
|
||||||
|
public String getPdfname() { return pdfname; }
|
||||||
|
public void setPdfname(String pdfname) { this.pdfname = pdfname; }
|
||||||
|
|
||||||
|
public String getPrinterName() { return printerName; }
|
||||||
|
public void setPrinterName(String printerName) { this.printerName = printerName; }
|
||||||
|
|
||||||
|
public String getJobNummer() { return jobNummer; }
|
||||||
|
public void setJobNummer(String jobNummer) { this.jobNummer = jobNummer; }
|
||||||
|
|
||||||
|
public String getSpoolName() { return spoolName; }
|
||||||
|
public void setSpoolName(String spoolName) { this.spoolName = spoolName; }
|
||||||
|
|
||||||
|
public String getEmulate() { return emulate; }
|
||||||
|
public void setEmulate(String emulate) { this.emulate = emulate; }
|
||||||
|
|
||||||
|
public String getCopies() { return copies; }
|
||||||
|
public void setCopies(String copies) { this.copies = copies; }
|
||||||
|
|
||||||
|
public String getZebraPrint() { return zebraPrint; }
|
||||||
|
public void setZebraPrint(String zebraPrint) { this.zebraPrint = zebraPrint; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,162 @@
|
|||||||
|
package de.geis.pdfdownloader;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class PropertyDaten extends Thread {
|
||||||
|
|
||||||
|
String m_zwischenSpeicher = null;
|
||||||
|
|
||||||
|
File file = null;
|
||||||
|
|
||||||
|
private File getFile() {
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PropertyDaten(String file) {
|
||||||
|
m_zwischenSpeicher = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
private FileInputStream loadFileStream (File fileName) {
|
||||||
|
return loadFileStream(fileName, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private FileInputStream loadFileStream (File fileName, int zaehler) {
|
||||||
|
FileInputStream fileInputStream = null;
|
||||||
|
if (zaehler == Parameters.getVersuche()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
fileInputStream = new FileInputStream(fileName);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
try {
|
||||||
|
if(zaehler < 2) {
|
||||||
|
TimeUnit.MILLISECONDS.sleep(Parameters.getDelayTime());
|
||||||
|
} else {
|
||||||
|
TimeUnit.MILLISECONDS.sleep(Parameters.getDelayTime() + 10);
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
zaehler++;
|
||||||
|
return loadFileStream(fileName, zaehler);
|
||||||
|
}
|
||||||
|
return fileInputStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int counter = 0;
|
||||||
|
|
||||||
|
|
||||||
|
private void loadConfigDatein() throws Exception{
|
||||||
|
|
||||||
|
try {
|
||||||
|
Map<File, Property>propertyMap = new HashMap<File, Property>();
|
||||||
|
Properties props = null;
|
||||||
|
FileInputStream fileInputStream = null;
|
||||||
|
Property property = null;
|
||||||
|
DownloadPDF downloadMap = null;
|
||||||
|
|
||||||
|
counter = 0;
|
||||||
|
try {
|
||||||
|
// setFile(new File(m_zwischenSpeicher));
|
||||||
|
props = new Properties();
|
||||||
|
counter++;
|
||||||
|
property = new Property();
|
||||||
|
counter++;
|
||||||
|
fileInputStream = loadFileStream(getFile());
|
||||||
|
counter++;
|
||||||
|
props.load(fileInputStream);
|
||||||
|
counter++;
|
||||||
|
property.setStatus(props.getProperty("STATUS"));
|
||||||
|
counter++;
|
||||||
|
property.setPdfname(props.getProperty("PDFNAME"));
|
||||||
|
counter++;
|
||||||
|
property.setURL(props.getProperty("URL"));
|
||||||
|
counter++;
|
||||||
|
property.setPrinterName(props.getProperty("PRINTERNAME"));
|
||||||
|
counter++;
|
||||||
|
property.setJobNummer(props.getProperty("JOBNUMMER"));
|
||||||
|
counter++;
|
||||||
|
property.setSpoolName(props.getProperty("SPOOLNAME"));
|
||||||
|
counter++;
|
||||||
|
property.setEmulate(props.getProperty("PDFEMULATE"));
|
||||||
|
counter++;
|
||||||
|
property.setCopies(props.getProperty("COPIES"));
|
||||||
|
counter++;
|
||||||
|
property.setZebraPrint(props.getProperty("ZEBRAPRINT"));
|
||||||
|
counter++;
|
||||||
|
propertyMap.put(file, property);
|
||||||
|
counter++;
|
||||||
|
} catch (Exception e) {
|
||||||
|
createErrorProperty(e);
|
||||||
|
} finally {
|
||||||
|
if (fileInputStream != null) {
|
||||||
|
try {
|
||||||
|
fileInputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
fileInputStream = null;
|
||||||
|
}
|
||||||
|
Files.move(Paths.get(file.getPath()), Paths.get("C:\\FTPRoot\\orginal\\ORGINAL_" + m_zwischenSpeicher), StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (propertyMap.size() > 0) {
|
||||||
|
try {
|
||||||
|
downloadMap = new DownloadPDF(propertyMap);
|
||||||
|
downloadMap.downloadAndCopy();
|
||||||
|
} catch (Exception e) {
|
||||||
|
createErrorProperty(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
createErrorProperty(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createErrorProperty(Exception e) throws IOException {
|
||||||
|
FileOutputStream fileOutputStream = null;
|
||||||
|
Properties props = new Properties();
|
||||||
|
|
||||||
|
try {
|
||||||
|
System.out.println("ERROR: "+ m_zwischenSpeicher + "Counter:" + counter +"\n " + e.getStackTrace());
|
||||||
|
props.setProperty("STATUS DOWNLOAD", ErrorCodes.DOKUMENTE.getValue());
|
||||||
|
props.setProperty("Exception", e.toString());
|
||||||
|
props.setProperty("COUNTER", counter + "");
|
||||||
|
fileOutputStream = new FileOutputStream(Parameters.getErrorFolder() + "\\Downloader_" + m_zwischenSpeicher);
|
||||||
|
props.store(fileOutputStream, null);
|
||||||
|
|
||||||
|
Files.move(Paths.get(file.getPath()), Paths.get("C:\\FTPRoot\\orginal\\ORGINAL_" + m_zwischenSpeicher), StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
System.out.println(ErrorCodes.DOKUMENTE.getValue() + ":" + m_zwischenSpeicher + "\n" + ex.getStackTrace());
|
||||||
|
} finally {
|
||||||
|
fileOutputStream.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
System.out.println("--- LADE PROPERTIES ---" + m_zwischenSpeicher);
|
||||||
|
file = new File(Parameters.getDownloadFolder() + "\\" + m_zwischenSpeicher);
|
||||||
|
loadConfigDatein();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package de.geis.printserver;
|
||||||
|
|
||||||
|
public enum ErrorCodes {
|
||||||
|
PRINTER("ERROR : Drucker nicht gefunden!"),
|
||||||
|
DOKUMENT("ERROR : Dokument nicht gefunden!");
|
||||||
|
|
||||||
|
|
||||||
|
ErrorCodes(String v) {
|
||||||
|
value = v;
|
||||||
|
}
|
||||||
|
private String value = "0";
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
package de.geis.printserver;
|
||||||
|
|
||||||
|
import java.nio.file.FileSystems;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.nio.file.StandardWatchEventKinds;
|
||||||
|
import java.nio.file.WatchKey;
|
||||||
|
import java.nio.file.WatchService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
public class FileSystemWatcher extends Thread {
|
||||||
|
@SuppressWarnings("null")
|
||||||
|
public void startWatcher() throws Exception {
|
||||||
|
WatchService watchService = FileSystems.getDefault().newWatchService();
|
||||||
|
//Lade Property Dateien die nicht abgearbeitet wurden
|
||||||
|
PropertyDaten propertyDaten = new PropertyDaten();
|
||||||
|
propertyDaten.loadConfigDatein();
|
||||||
|
|
||||||
|
//Watchkey init
|
||||||
|
WatchKey watchKey = Paths.get(Parameters.getConfigFolder().toURI()).register(watchService,
|
||||||
|
StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_MODIFY);
|
||||||
|
|
||||||
|
while(true) {
|
||||||
|
watchKey = watchService.take();
|
||||||
|
TimeUnit.MILLISECONDS.sleep(25);
|
||||||
|
|
||||||
|
if (watchKey != null) {
|
||||||
|
//Lade Config von Property Datei
|
||||||
|
propertyDaten.loadConfigDatein();
|
||||||
|
}
|
||||||
|
|
||||||
|
watchKey.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main( String[] args ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
startWatcher();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,69 @@
|
|||||||
|
package de.geis.printserver;
|
||||||
|
|
||||||
|
import org.tanukisoftware.wrapper.WrapperManager;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import org.tanukisoftware.wrapper.WrapperListener;
|
||||||
|
|
||||||
|
public class Main
|
||||||
|
implements WrapperListener
|
||||||
|
{
|
||||||
|
private FileSystemWatcher m_watcher;
|
||||||
|
|
||||||
|
private Main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer start( String[] args ) {
|
||||||
|
|
||||||
|
Parameters.setConfigFolder(new File(args[0]));
|
||||||
|
Parameters.setErrorFolder(new File(args[1]));
|
||||||
|
Parameters.setFileFolder(new File(args[2]));
|
||||||
|
|
||||||
|
Parameters.setDelayTime(Integer.parseInt(new File(args[3]).toString()));
|
||||||
|
Parameters.setVersuche(Integer.parseInt(new File(args[4]).toString()));
|
||||||
|
|
||||||
|
System.out.println("DELAY = " + Parameters.getDelayTime());
|
||||||
|
System.out.println("VERSUCHE = " + Parameters.getVersuche());
|
||||||
|
|
||||||
|
m_watcher = new FileSystemWatcher();
|
||||||
|
|
||||||
|
try {
|
||||||
|
m_watcher.start();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
System.out.println("STARTED");
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int stop( int exitCode )
|
||||||
|
{
|
||||||
|
return exitCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void controlEvent( int event )
|
||||||
|
{
|
||||||
|
if ( ( event == WrapperManager.WRAPPER_CTRL_LOGOFF_EVENT )
|
||||||
|
&& ( WrapperManager.isLaunchedAsService() || WrapperManager.isIgnoreUserLogoffs() ) )
|
||||||
|
{
|
||||||
|
// Ignore
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WrapperManager.stop( 0 );
|
||||||
|
// Will not get here.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main( String[] args )
|
||||||
|
{
|
||||||
|
WrapperManager.start( new Main(), args );
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
package de.geis.printserver;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class Parameters {
|
||||||
|
private static File m_configFolder = null;
|
||||||
|
public static File getConfigFolder() {
|
||||||
|
if (m_configFolder == null) {
|
||||||
|
m_configFolder = new File("");
|
||||||
|
}
|
||||||
|
return m_configFolder;
|
||||||
|
}
|
||||||
|
public static void setConfigFolder(File configFolder) { m_configFolder = configFolder; }
|
||||||
|
|
||||||
|
|
||||||
|
private static File m_errorFolder = null;
|
||||||
|
public static File getErrorFolder() {
|
||||||
|
if (m_errorFolder == null) {
|
||||||
|
m_errorFolder = new File("");
|
||||||
|
}
|
||||||
|
return m_errorFolder;
|
||||||
|
}
|
||||||
|
public static void setErrorFolder(File errorFolder) { m_errorFolder = errorFolder; }
|
||||||
|
|
||||||
|
|
||||||
|
private static File m_fileFolder = null;
|
||||||
|
public static File getFileFolder() {
|
||||||
|
if (m_fileFolder == null) {
|
||||||
|
m_fileFolder = new File("");
|
||||||
|
}
|
||||||
|
return m_fileFolder;
|
||||||
|
}
|
||||||
|
public static void setFileFolder(File fileFolder) { m_fileFolder = fileFolder; }
|
||||||
|
|
||||||
|
|
||||||
|
private static int versuche = 0;
|
||||||
|
public static int getVersuche() {
|
||||||
|
if(versuche == 0) {
|
||||||
|
versuche = 3;
|
||||||
|
}
|
||||||
|
return versuche;
|
||||||
|
}
|
||||||
|
public static void setVersuche(int value) { versuche = value; }
|
||||||
|
|
||||||
|
private static int delaytime = 0;
|
||||||
|
public static int getDelayTime() {
|
||||||
|
if(delaytime == 0) {
|
||||||
|
delaytime = 25;
|
||||||
|
}
|
||||||
|
return delaytime;
|
||||||
|
}
|
||||||
|
public static void setDelayTime(int value) { delaytime = value; }
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,387 @@
|
|||||||
|
package de.geis.printserver;
|
||||||
|
|
||||||
|
import java.awt.print.PrinterJob;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
|
import javax.print.Doc;
|
||||||
|
import javax.print.DocFlavor;
|
||||||
|
import javax.print.DocPrintJob;
|
||||||
|
import javax.print.PrintService;
|
||||||
|
import javax.print.PrintServiceLookup;
|
||||||
|
import javax.print.SimpleDoc;
|
||||||
|
import javax.print.attribute.HashPrintRequestAttributeSet;
|
||||||
|
import javax.print.attribute.PrintRequestAttributeSet;
|
||||||
|
import javax.print.attribute.standard.JobName;
|
||||||
|
import javax.print.event.PrintJobAdapter;
|
||||||
|
import javax.print.event.PrintJobEvent;
|
||||||
|
|
||||||
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
|
import org.apache.pdfbox.printing.PDFPageable;
|
||||||
|
|
||||||
|
|
||||||
|
public class PrintMap extends Thread {
|
||||||
|
|
||||||
|
private File pdffile = null;
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private static boolean jobRunning = true;
|
||||||
|
|
||||||
|
PDDocument m_pdDocument = null;
|
||||||
|
|
||||||
|
private final Map<File, Property> m_propertyMap;
|
||||||
|
public PrintMap(Map<File, Property> propertyMap) {
|
||||||
|
super();
|
||||||
|
m_propertyMap = propertyMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean printPdfNotEmulate(Property property, int copies) {
|
||||||
|
boolean status = true;
|
||||||
|
|
||||||
|
for (int i = 0; i < copies; i++) {
|
||||||
|
System.out.println("IM NICHT EMULIERT");
|
||||||
|
status = printPdfNotEmulate(property);
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private boolean printPdfToZebra(Property property) {
|
||||||
|
boolean status = true;
|
||||||
|
PrinterJob printerJob = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
printerJob = PrinterJob.getPrinterJob();
|
||||||
|
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
|
||||||
|
|
||||||
|
printerJob.setPageable(new PDFPageable(m_pdDocument));
|
||||||
|
printerJob.setPrintService(findPrintService(property.getPrintername()));
|
||||||
|
printerJob.setJobName(fillString(property.getSpoolname(), 10, " ", false) + property.getJobnummer());
|
||||||
|
|
||||||
|
if (property.getCopies() > 1) {
|
||||||
|
printerJob.setCopies(property.getCopies());
|
||||||
|
System.out.println("Kopien: " + property.getCopies());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
printerJob.print(aset);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
if (m_pdDocument != null) {
|
||||||
|
try {
|
||||||
|
m_pdDocument.close();
|
||||||
|
} catch (Exception e2) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean printZPLToZebra (Property property) {
|
||||||
|
InputStream fileInputStream = null;
|
||||||
|
try {
|
||||||
|
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
|
||||||
|
|
||||||
|
fileInputStream = Files.newInputStream(Paths.get(property.getPdfname()));
|
||||||
|
|
||||||
|
PrintService service = findPrintService(property.getPrintername());
|
||||||
|
DocFlavor psInFormat = DocFlavor.INPUT_STREAM.AUTOSENSE;
|
||||||
|
Doc pdfDoc = new SimpleDoc(fileInputStream, psInFormat, null);
|
||||||
|
aset.add(new JobName(fillString(property.getSpoolname(), 10, " ", false) + property.getJobnummer(), null));
|
||||||
|
|
||||||
|
DocPrintJob printJob = service.createPrintJob();
|
||||||
|
|
||||||
|
printJob.addPrintJobListener(new JobCompleteMonitor());
|
||||||
|
|
||||||
|
printJob.print(pdfDoc, aset);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
fileInputStream.close();
|
||||||
|
} catch (Exception io) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean printPdfNotEmulate(Property property) {
|
||||||
|
|
||||||
|
InputStream fileInputStream = null;
|
||||||
|
try {
|
||||||
|
fileInputStream = Files.newInputStream(Paths.get(property.getPdfname()));
|
||||||
|
|
||||||
|
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
|
||||||
|
|
||||||
|
PrintService service = findPrintService(property.getPrintername());
|
||||||
|
DocFlavor psInFormat = DocFlavor.INPUT_STREAM.AUTOSENSE;
|
||||||
|
|
||||||
|
Doc pdfDoc = new SimpleDoc(fileInputStream, psInFormat, null);
|
||||||
|
|
||||||
|
DocPrintJob printJob = service.createPrintJob();
|
||||||
|
|
||||||
|
printJob.addPrintJobListener(new JobCompleteMonitor());
|
||||||
|
|
||||||
|
aset.add(new JobName(fillString(property.getSpoolname(), 10, " ", false) + property.getJobnummer(), null));
|
||||||
|
|
||||||
|
printJob.print(pdfDoc, aset);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
fileInputStream.close();
|
||||||
|
} catch (IOException io) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static class JobCompleteMonitor extends PrintJobAdapter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void printJobCompleted(PrintJobEvent jobEvent) {
|
||||||
|
System.out.println("Job completed");
|
||||||
|
jobRunning = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void print() {
|
||||||
|
|
||||||
|
boolean delete = true;
|
||||||
|
FileOutputStream fileOutputStream = null;
|
||||||
|
ArrayList<File> removeFile = new ArrayList<File>();
|
||||||
|
|
||||||
|
for (File elem : m_propertyMap.keySet()) {
|
||||||
|
System.out.println("ELEM"+ elem);
|
||||||
|
Property property = m_propertyMap.get(elem);
|
||||||
|
boolean status = true;
|
||||||
|
if (!property.getPdfname().endsWith(".zpl")) {
|
||||||
|
status = loadPdf(m_propertyMap.get(elem).getPdfname());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
status = loadZPL(m_propertyMap.get(elem).getPdfname());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (status == false) {
|
||||||
|
createErrorProperty(ErrorCodes.DOKUMENT.getValue(), elem);
|
||||||
|
delete = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property.getPdfname().endsWith(".zpl")) {
|
||||||
|
status = printZPLToZebra(property);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (property.getZebraPrinter()) {
|
||||||
|
status = printPdfToZebra(property);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
else if (property.getPdfemulate()) {
|
||||||
|
status = printPdfEmulate(property);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (property.getCopies() > 1) {
|
||||||
|
status = printPdfNotEmulate(property, property.getCopies());
|
||||||
|
} else {
|
||||||
|
status = printPdfNotEmulate(property);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
delete = false;
|
||||||
|
|
||||||
|
createErrorProperty(ErrorCodes.PRINTER.getValue(), elem);
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
if (status) {
|
||||||
|
System.out.println("Success: " + elem);
|
||||||
|
removeFile.add(elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileOutputStream != null) {
|
||||||
|
try {
|
||||||
|
fileOutputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m_pdDocument != null) {
|
||||||
|
try {
|
||||||
|
m_pdDocument.close();
|
||||||
|
pdffile.delete();
|
||||||
|
pdffile = null;
|
||||||
|
} catch (IOException io) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
pdffile.delete();
|
||||||
|
pdffile = null;
|
||||||
|
} catch (Exception io) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(delete == true) {
|
||||||
|
for (File elem : removeFile) {
|
||||||
|
m_propertyMap.remove(elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean printPdfEmulate(Property property) {
|
||||||
|
boolean status = true;
|
||||||
|
PrinterJob printerJob = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
System.out.println("EMULIERT");
|
||||||
|
printerJob = PrinterJob.getPrinterJob();
|
||||||
|
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
|
||||||
|
|
||||||
|
printerJob.setPageable(new PDFPageable(m_pdDocument));
|
||||||
|
printerJob.setPrintService(findPrintService(property.getPrintername()));
|
||||||
|
printerJob.setJobName(fillString(property.getSpoolname(), 10, " ", false) + property.getJobnummer());
|
||||||
|
|
||||||
|
//aset.add(new PrinterResolution(300, 300, PrinterResolution.DPI));
|
||||||
|
|
||||||
|
if (property.getCopies() > 1) {
|
||||||
|
printerJob.setCopies(property.getCopies());
|
||||||
|
System.out.println("Kopien: " + property.getCopies());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
printerJob.print(aset);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
if (m_pdDocument != null) {
|
||||||
|
try {
|
||||||
|
m_pdDocument.close();
|
||||||
|
} catch (Exception e2) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean loadPdf(String pdfFileName) {
|
||||||
|
boolean status = false;
|
||||||
|
try {
|
||||||
|
pdffile = new File(pdfFileName);
|
||||||
|
|
||||||
|
if (pdffile.exists() == true) {
|
||||||
|
m_pdDocument = PDDocument.load(pdffile);
|
||||||
|
status = true;
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
status = false;
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean loadZPL(String zplName) {
|
||||||
|
boolean status = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
pdffile = new File(zplName);
|
||||||
|
|
||||||
|
if (pdffile.exists()) {
|
||||||
|
status = true;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
status = false;
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public String fillString(Object data, int totaleLenght, String fillWith, boolean isRight) {
|
||||||
|
StringBuffer stringFueller = new StringBuffer();
|
||||||
|
if (data == null) {
|
||||||
|
data = "";
|
||||||
|
}
|
||||||
|
for (int i = 0; i < totaleLenght - data.toString().length(); ++i) {
|
||||||
|
stringFueller.append(fillWith);
|
||||||
|
}
|
||||||
|
return isRight ? stringFueller.toString() + data : data + stringFueller.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private PrintService findPrintService(String printerName) {
|
||||||
|
PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, null);
|
||||||
|
for (PrintService printService : printServices) {
|
||||||
|
if (printService.getName().trim().equals(printerName)) {
|
||||||
|
return printService;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public void setDaten(Map<File, Property> propertyMap) {
|
||||||
|
// m_propertyMap = propertyMap;
|
||||||
|
// }
|
||||||
|
|
||||||
|
private void createErrorProperty(String status, File file) {
|
||||||
|
FileOutputStream fileOutputStream = null;
|
||||||
|
Properties props = new Properties();
|
||||||
|
|
||||||
|
System.out.println(status + ", FILE : " + file);
|
||||||
|
|
||||||
|
try {
|
||||||
|
props.setProperty("STATUS", status);
|
||||||
|
props.setProperty("PRINTERNAME", m_propertyMap.get(file).getPrintername());
|
||||||
|
props.setProperty("JOBNUMMER", m_propertyMap.get(file).getJobnummer());
|
||||||
|
props.setProperty("PDFNAME", m_propertyMap.get(file).getPdfname());
|
||||||
|
props.setProperty("SPOOLNAME", m_propertyMap.get(file).getSpoolname());
|
||||||
|
props.setProperty("PDFEMULATE", m_propertyMap.get(file).getPdfemulate().toString());
|
||||||
|
props.setProperty("COPIES", m_propertyMap.get(file).getCopies().toString());
|
||||||
|
props.setProperty("ZEBRAPRINT", m_propertyMap.get(file).getZebraPrinter().toString());
|
||||||
|
|
||||||
|
fileOutputStream = new FileOutputStream(Parameters.getErrorFolder() + "\\" + file.getName());
|
||||||
|
props.store(fileOutputStream, null);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
fileOutputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
print();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,412 @@
|
|||||||
|
package de.geis.printserver;
|
||||||
|
|
||||||
|
import java.awt.print.PrinterException;
|
||||||
|
import java.awt.print.PrinterJob;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.print.Doc;
|
||||||
|
import javax.print.DocFlavor;
|
||||||
|
import javax.print.DocPrintJob;
|
||||||
|
import javax.print.PrintService;
|
||||||
|
import javax.print.PrintServiceLookup;
|
||||||
|
import javax.print.SimpleDoc;
|
||||||
|
import javax.print.attribute.HashPrintRequestAttributeSet;
|
||||||
|
import javax.print.attribute.PrintJobAttributeSet;
|
||||||
|
import javax.print.attribute.PrintRequestAttributeSet;
|
||||||
|
import javax.print.attribute.standard.JobName;
|
||||||
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
|
import org.apache.pdfbox.printing.PDFPageable;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
|
|
||||||
|
public class Printer {
|
||||||
|
|
||||||
|
private String m_jobNummer = null;
|
||||||
|
public String getJobNummer() { return m_jobNummer; }
|
||||||
|
public void setJobNummer(String jobNummer) { m_jobNummer = jobNummer; }
|
||||||
|
|
||||||
|
private boolean m_loaded = false;
|
||||||
|
public boolean getLoaded() { return m_loaded; }
|
||||||
|
public void setLoaded(boolean loaded) { m_loaded = loaded; }
|
||||||
|
|
||||||
|
private File m_configFolder = null;
|
||||||
|
public File getConfigFolder() { return m_configFolder; }
|
||||||
|
public void setConfigFolder(File configFolder) { m_configFolder = configFolder; }
|
||||||
|
|
||||||
|
private File m_errorFolder = null;
|
||||||
|
public File getErrorFolder() { return m_errorFolder; }
|
||||||
|
public void setErrorFolder(File errorFolder) { m_errorFolder = errorFolder; }
|
||||||
|
|
||||||
|
private File m_fileFolder = null;
|
||||||
|
public File getFileFolder() { return m_fileFolder; }
|
||||||
|
public void setFileFolder(File fileFolder) { m_fileFolder = fileFolder; }
|
||||||
|
|
||||||
|
PDDocument m_pdDocument = null;
|
||||||
|
|
||||||
|
// private boolean m_withPrintDialog = false;
|
||||||
|
// public boolean getWithPrintDialog() { return m_withPrintDialog; }
|
||||||
|
// public void setWithPrintDialog(boolean withPrintDialog) { m_withPrintDialog = withPrintDialog; }
|
||||||
|
|
||||||
|
private String m_printerName = null;
|
||||||
|
public String getPrinterName() { return m_printerName; }
|
||||||
|
public void setPrinterName(String printerName) { m_printerName = printerName; }
|
||||||
|
|
||||||
|
private String m_pdfName = null;
|
||||||
|
public String getPdfName() { return m_pdfName; }
|
||||||
|
public void setPdfName(String pdfName) { this.m_pdfName = pdfName; }
|
||||||
|
|
||||||
|
private String m_spoolName = null;
|
||||||
|
public String getSpoolName() { return m_spoolName; }
|
||||||
|
public void setSpoolName(String spoolName) { this.m_spoolName = spoolName; }
|
||||||
|
|
||||||
|
|
||||||
|
public void loadInputStream(InputStream inputStream) throws IOException {
|
||||||
|
m_pdDocument = PDDocument.load(inputStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadUrl(String url) throws IOException {
|
||||||
|
File file = null;
|
||||||
|
FileUtils.copyURLToFile(new URL(url), file);
|
||||||
|
|
||||||
|
m_pdDocument = PDDocument.load(file);
|
||||||
|
file = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadPdf(String pdfFileName) {
|
||||||
|
try {
|
||||||
|
File file = new File(pdfFileName);
|
||||||
|
m_pdDocument = PDDocument.load(file);
|
||||||
|
setLoaded(true);
|
||||||
|
} catch (IOException e) {
|
||||||
|
setLoaded(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadByteArray(byte[] byteArray) throws IOException {
|
||||||
|
ByteArrayInputStream bis = new ByteArrayInputStream(byteArray);
|
||||||
|
m_pdDocument = PDDocument.load(bis);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean print() throws PrinterException, IOException {
|
||||||
|
boolean status = true;
|
||||||
|
System.out.println(getPdfName());
|
||||||
|
loadPdf(getPdfName());
|
||||||
|
|
||||||
|
if (m_pdDocument == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (getLoaded() == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
PrinterJob printerJob = PrinterJob.getPrinterJob();
|
||||||
|
printerJob.setPageable(new PDFPageable(m_pdDocument));
|
||||||
|
printerJob.setPrintService(findPrintService(getPrinterName()));
|
||||||
|
setSpoolName(fillString(getSpoolName(), 10, " ", false));
|
||||||
|
printerJob.setJobName(getSpoolName() + getJobNummer());
|
||||||
|
// if (getWithPrintDialog()) {
|
||||||
|
// if (printerJob.printDialog()) {
|
||||||
|
// printerJob.print();
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
printerJob.print();
|
||||||
|
// }
|
||||||
|
|
||||||
|
} catch (PrinterException pe) {
|
||||||
|
status = false;
|
||||||
|
} finally {
|
||||||
|
if (m_pdDocument != null) {
|
||||||
|
try {
|
||||||
|
m_pdDocument.close();
|
||||||
|
} catch (IOException io) {
|
||||||
|
status = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Printer() {
|
||||||
|
setConfigFolder(Parameters.getConfigFolder());
|
||||||
|
setErrorFolder(Parameters.getErrorFolder());
|
||||||
|
setFileFolder(Parameters.getFileFolder());
|
||||||
|
}
|
||||||
|
|
||||||
|
// public Printer(boolean printDialog) {
|
||||||
|
// this.m_withPrintDialog = printDialog;
|
||||||
|
// }
|
||||||
|
|
||||||
|
public Printer(String configFolder) {
|
||||||
|
File file = null;
|
||||||
|
try {
|
||||||
|
FileUtils.copyURLToFile(new URL(configFolder), file);
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
this.m_configFolder = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static PrintService findPrintService(String printerName) {
|
||||||
|
PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, null);
|
||||||
|
for (PrintService printService : printServices) {
|
||||||
|
if (printService.getName().trim().equals(printerName)) {
|
||||||
|
return printService;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
|
public boolean holeConfigDatei(File path) {
|
||||||
|
Properties props = new Properties();
|
||||||
|
FileInputStream fileInputStream = null;
|
||||||
|
FileOutputStream fileOutputStream = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
fileInputStream = new FileInputStream(path);
|
||||||
|
|
||||||
|
props.load(fileInputStream);
|
||||||
|
System.out.println("LOAD INPUTSTREAM");
|
||||||
|
|
||||||
|
String status = props.getProperty("STATUS");
|
||||||
|
System.out.println("STATUS:"+status);
|
||||||
|
|
||||||
|
if (status.equals("open")) {
|
||||||
|
setPdfName(getFileFolder()+ "\\" + props.getProperty("PDFNAME"));
|
||||||
|
System.out.println(getPdfName());
|
||||||
|
setJobNummer(props.getProperty("JOBNUMMER"));
|
||||||
|
setSpoolName(props.getProperty("SPOOLNAME"));
|
||||||
|
setPrinterName(props.getProperty("PRINTERNAME"));
|
||||||
|
//setWithPrintDialog(getWithPrintDialog());
|
||||||
|
try {
|
||||||
|
/*
|
||||||
|
if (print()) {
|
||||||
|
System.out.println("printed!!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
if (printAlternativ()){
|
||||||
|
System.out.println("printed");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
System.out.println("not printed!!");
|
||||||
|
if (getLoaded()) {
|
||||||
|
props.setProperty("STATUS", "fehler:drucker nicht gefunden");
|
||||||
|
fileOutputStream = new FileOutputStream(getErrorFolder() + "\\" + path.getName());
|
||||||
|
props.store(fileOutputStream, null);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
props.setProperty("STATUS", "fehler:pdf nicht gefunden");
|
||||||
|
fileOutputStream = new FileOutputStream(getErrorFolder() + "\\" + path.getName());
|
||||||
|
props.store(fileOutputStream, null);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
path.delete();
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
path.delete();
|
||||||
|
fileInputStream.close();
|
||||||
|
if (fileOutputStream != null) {
|
||||||
|
fileOutputStream.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.println("Hier kommt keiner hin");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
}
|
||||||
|
System.out.println("ICH BIN UNTEN BEIM FALSE");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void start() {
|
||||||
|
|
||||||
|
File[] listoffiles = getConfigFolder().listFiles();
|
||||||
|
File pdffile = null;
|
||||||
|
|
||||||
|
for (File file : listoffiles) {
|
||||||
|
if (file.isFile()) {
|
||||||
|
System.out.println(file);
|
||||||
|
boolean printStatus = holeConfigDatei(file);
|
||||||
|
System.out.println("PRINTSTATUS: "+ printStatus);
|
||||||
|
|
||||||
|
if (printStatus) {
|
||||||
|
pdffile = new File(getPdfName());
|
||||||
|
file.delete();
|
||||||
|
pdffile.delete();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
file.delete();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pdffile = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static public String fillString(Object data, int totaleLenght, String fillWith, boolean isRight) {
|
||||||
|
StringBuffer stringFueller = new StringBuffer();
|
||||||
|
if (data == null) {
|
||||||
|
data = "";
|
||||||
|
}
|
||||||
|
for (int i = 0; i < totaleLenght - data.toString().length(); ++i) {
|
||||||
|
stringFueller.append(fillWith);
|
||||||
|
}
|
||||||
|
return isRight ? stringFueller.toString() + data : data + stringFueller.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("null")
|
||||||
|
public boolean printAlternativ() {
|
||||||
|
|
||||||
|
FileInputStream fis = null;
|
||||||
|
System.out.println("Print Alternativ");
|
||||||
|
try {
|
||||||
|
fis = new FileInputStream(getPdfName());
|
||||||
|
System.out.println("HALLO "+getPdfName());
|
||||||
|
DocFlavor psInFormat = DocFlavor.INPUT_STREAM.PDF;
|
||||||
|
|
||||||
|
Doc pdfDoc = new SimpleDoc(fis, psInFormat, null);
|
||||||
|
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
|
||||||
|
|
||||||
|
DocPrintJob printJob = findPrintService(getPrinterName()).createPrintJob();
|
||||||
|
PrintJobAttributeSet printJobAttributeSet = printJob.getAttributes();
|
||||||
|
|
||||||
|
System.out.println("printJobAttributeSet: " + printJobAttributeSet.size());
|
||||||
|
|
||||||
|
setSpoolName(fillString(getSpoolName(), 10, " ", false));
|
||||||
|
aset.add(new JobName(getSpoolName() + getJobNummer(), null));
|
||||||
|
|
||||||
|
printJob.print(pdfDoc, aset);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
fis.close();
|
||||||
|
} catch (IOException io) {
|
||||||
|
io.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
/*
|
||||||
|
// Test mit Property-Datei
|
||||||
|
Printer printer = new Printer();
|
||||||
|
try {
|
||||||
|
printer.holeConfigDatei();
|
||||||
|
printer.setWithPrintDialog(printer.getWithPrintDialog());
|
||||||
|
String path = "C:\\Users\\braunp\\Desktop\\Files\\"+printer.getPdfName();
|
||||||
|
InputStream inputStream = new FileInputStream(path);
|
||||||
|
|
||||||
|
printer.loadInputStream(inputStream);
|
||||||
|
|
||||||
|
if (printer.print()) {
|
||||||
|
System.out.println("printed!!");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.println("not printed!!");
|
||||||
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
printer = null;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
// Test mit InputStream
|
||||||
|
try {
|
||||||
|
Printer printer = new Printer();
|
||||||
|
InputStream inputStream = new FileInputStream("C:\\Users\\braunp\\Desktop\\pdftest.pdf");
|
||||||
|
printer.setWithPrintDialog(false);
|
||||||
|
printer.loadInputStream(inputStream);
|
||||||
|
|
||||||
|
if (printer.print()) {
|
||||||
|
System.out.println("printed!!");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.println("not printed!!");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test mit URL
|
||||||
|
try {
|
||||||
|
Printer printer = new Printer();
|
||||||
|
String url = "";
|
||||||
|
printer.setWithPrintDialog(false);
|
||||||
|
printer.loadUrl(url);
|
||||||
|
|
||||||
|
if (printer.print()) {
|
||||||
|
System.out.println("printed!!");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.println("not printed!!");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test mit PDF
|
||||||
|
try {
|
||||||
|
Printer printer = new Printer();
|
||||||
|
String pdf = "C:\\Users\\braunp\\Desktop\\pdftest.pdf";
|
||||||
|
printer.setWithPrintDialog(false);
|
||||||
|
printer.loadPdf(pdf);
|
||||||
|
|
||||||
|
if (printer.print()) {
|
||||||
|
System.out.println("printed!!");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.println("not printed!!");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test mit Byte
|
||||||
|
try {
|
||||||
|
Printer printer = new Printer();
|
||||||
|
byte[] bytes = {3, 6, 9, 12};
|
||||||
|
printer.setWithPrintDialog(false);
|
||||||
|
printer.loadByteArray(bytes);
|
||||||
|
|
||||||
|
if (printer.print()) {
|
||||||
|
System.out.println("printed!!");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.println("not printed!!");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
package de.geis.printserver;
|
||||||
|
|
||||||
|
public class Property {
|
||||||
|
|
||||||
|
private String status = null;
|
||||||
|
private String jobnummer = null;
|
||||||
|
private String printername = null;
|
||||||
|
private String pdfname = null;
|
||||||
|
private String spoolname = null;
|
||||||
|
private Boolean pdfemulate = false;
|
||||||
|
private Integer copies = 1;
|
||||||
|
private Boolean zebraprint = null;
|
||||||
|
private String mediasize = null;
|
||||||
|
private String orientation = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String getStatus() { return status; }
|
||||||
|
public void setStatus(String status) { this.status = status; }
|
||||||
|
|
||||||
|
public String getJobnummer() { return jobnummer; }
|
||||||
|
public void setJobnummer(String jobnummer) { this.jobnummer = jobnummer; }
|
||||||
|
|
||||||
|
public String getPrintername() { return printername; }
|
||||||
|
public void setPrintername(String printername) { this.printername = printername; }
|
||||||
|
|
||||||
|
public String getPdfname() { return pdfname; }
|
||||||
|
public void setPdfname(String pdfname) { this.pdfname = pdfname; }
|
||||||
|
|
||||||
|
public String getSpoolname() { return spoolname; }
|
||||||
|
public void setSpoolname(String spoolname) { this.spoolname = spoolname; }
|
||||||
|
|
||||||
|
public Boolean getPdfemulate() { return pdfemulate; }
|
||||||
|
public void setPdfemulate(Boolean pdfemulate) { this.pdfemulate = pdfemulate; }
|
||||||
|
|
||||||
|
public Integer getCopies() { return copies; }
|
||||||
|
public void setCopies(Integer copies) { this.copies = copies; }
|
||||||
|
|
||||||
|
public Boolean getZebraPrinter() { return zebraprint; }
|
||||||
|
public void setZebraPrinter(Boolean zebraprint) { this.zebraprint = zebraprint; }
|
||||||
|
|
||||||
|
public String getMediaSize() { return mediasize; }
|
||||||
|
public void setMediaSize(String mediasize) { this.mediasize = mediasize; }
|
||||||
|
|
||||||
|
public String getOrientation() { return orientation; }
|
||||||
|
public void setOrientation(String orientation) { this.orientation = orientation; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,115 @@
|
|||||||
|
package de.geis.printserver;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
|
||||||
|
public class PropertyDaten {
|
||||||
|
|
||||||
|
public InputStream loadFileStream (String fileName) {
|
||||||
|
return loadFileStream(fileName, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InputStream loadFileStream (String fileName, int zaehler) {
|
||||||
|
InputStream fileInputStream = null;
|
||||||
|
|
||||||
|
if (zaehler == Parameters.getVersuche()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
fileInputStream = Files.newInputStream(Paths.get(Parameters.getConfigFolder() + "\\" + fileName));
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
try {
|
||||||
|
TimeUnit.MILLISECONDS.sleep(Parameters.getDelayTime());
|
||||||
|
} catch (InterruptedException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
zaehler++;
|
||||||
|
return loadFileStream(fileName, zaehler);
|
||||||
|
}
|
||||||
|
return fileInputStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void loadConfigDatein() {
|
||||||
|
File[] listoffiles = Parameters.getConfigFolder().listFiles();
|
||||||
|
Map<File, Property>propertyMap = new HashMap<File, Property>();
|
||||||
|
Properties props = null;
|
||||||
|
InputStream fileInputStream = null;
|
||||||
|
Property property = null;
|
||||||
|
PrintMap printMap = null;
|
||||||
|
|
||||||
|
for (File file : listoffiles) {
|
||||||
|
try {
|
||||||
|
props = new Properties();
|
||||||
|
property = new Property();
|
||||||
|
fileInputStream = loadFileStream(file.getName());
|
||||||
|
|
||||||
|
if(fileInputStream == null) {
|
||||||
|
createErrorProperty(file);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
props.load(fileInputStream);
|
||||||
|
|
||||||
|
property.setStatus(props.getProperty("STATUS"));
|
||||||
|
property.setPrintername(props.getProperty("PRINTERNAME"));
|
||||||
|
property.setJobnummer(props.getProperty("JOBNUMMER"));
|
||||||
|
property.setPdfname(Parameters.getFileFolder() + "\\" + props.getProperty("PDFNAME"));
|
||||||
|
property.setSpoolname(props.getProperty("SPOOLNAME"));
|
||||||
|
property.setPdfemulate(Boolean.parseBoolean(props.getProperty("PDFEMULATE", "false")));
|
||||||
|
property.setCopies(Integer.parseInt(props.getProperty("COPIES", "1")));
|
||||||
|
property.setZebraPrinter(Boolean.parseBoolean(props.getProperty("ZEBRAPRINT", "false")));
|
||||||
|
|
||||||
|
propertyMap.put(file, property);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if (fileInputStream != null) {
|
||||||
|
try {
|
||||||
|
fileInputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
fileInputStream = null;
|
||||||
|
}
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (propertyMap.size() > 0) {
|
||||||
|
printMap = new PrintMap(propertyMap);
|
||||||
|
System.out.println("Start PRINT");
|
||||||
|
printMap.start();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createErrorProperty(File file) throws IOException {
|
||||||
|
FileOutputStream fileOutputStream = null;
|
||||||
|
Properties props = new Properties();
|
||||||
|
|
||||||
|
try {
|
||||||
|
props.setProperty("STATUS", ErrorCodes.DOKUMENT.getValue());
|
||||||
|
fileOutputStream = new FileOutputStream(Parameters.getErrorFolder() + "\\" + file.getName());
|
||||||
|
props.store(fileOutputStream, null);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(ErrorCodes.DOKUMENT.getValue());
|
||||||
|
} finally {
|
||||||
|
fileOutputStream.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,198 @@
|
|||||||
|
package de.geis.printserver;
|
||||||
|
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ZPLConverter {
|
||||||
|
private int blackLimit = 380;
|
||||||
|
private int total;
|
||||||
|
private int widthBytes;
|
||||||
|
private boolean compressHex = false;
|
||||||
|
private static Map<Integer, String> mapCode = new HashMap<Integer, String>();
|
||||||
|
{
|
||||||
|
mapCode.put(1, "G");
|
||||||
|
mapCode.put(2, "H");
|
||||||
|
mapCode.put(3, "I");
|
||||||
|
mapCode.put(4, "J");
|
||||||
|
mapCode.put(5, "K");
|
||||||
|
mapCode.put(6, "L");
|
||||||
|
mapCode.put(7, "M");
|
||||||
|
mapCode.put(8, "N");
|
||||||
|
mapCode.put(9, "O");
|
||||||
|
mapCode.put(10, "P");
|
||||||
|
mapCode.put(11, "Q");
|
||||||
|
mapCode.put(12, "R");
|
||||||
|
mapCode.put(13, "S");
|
||||||
|
mapCode.put(14, "T");
|
||||||
|
mapCode.put(15, "U");
|
||||||
|
mapCode.put(16, "V");
|
||||||
|
mapCode.put(17, "W");
|
||||||
|
mapCode.put(18, "X");
|
||||||
|
mapCode.put(19, "Y");
|
||||||
|
mapCode.put(20, "g");
|
||||||
|
mapCode.put(40, "h");
|
||||||
|
mapCode.put(60, "i");
|
||||||
|
mapCode.put(80, "j");
|
||||||
|
mapCode.put(100, "k");
|
||||||
|
mapCode.put(120, "l");
|
||||||
|
mapCode.put(140, "m");
|
||||||
|
mapCode.put(160, "n");
|
||||||
|
mapCode.put(180, "o");
|
||||||
|
mapCode.put(200, "p");
|
||||||
|
mapCode.put(220, "q");
|
||||||
|
mapCode.put(240, "r");
|
||||||
|
mapCode.put(260, "s");
|
||||||
|
mapCode.put(280, "t");
|
||||||
|
mapCode.put(300, "u");
|
||||||
|
mapCode.put(320, "v");
|
||||||
|
mapCode.put(340, "w");
|
||||||
|
mapCode.put(360, "x");
|
||||||
|
mapCode.put(380, "y");
|
||||||
|
mapCode.put(400, "z");
|
||||||
|
}
|
||||||
|
public String convertfromImg(BufferedImage image) throws IOException {
|
||||||
|
String cuerpo = createBody(image);
|
||||||
|
if(compressHex)
|
||||||
|
cuerpo = encodeHexAscii(cuerpo);
|
||||||
|
return headDoc() + cuerpo + footDoc();
|
||||||
|
}
|
||||||
|
private String createBody(BufferedImage orginalImage) throws IOException {
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
Graphics2D graphics = orginalImage.createGraphics();
|
||||||
|
graphics.drawImage(orginalImage, 0, 0, null);
|
||||||
|
int height = orginalImage.getHeight();
|
||||||
|
int width = orginalImage.getWidth();
|
||||||
|
int rgb, red, green, blue, index=0;
|
||||||
|
char auxBinaryChar[] = {'0', '0', '0', '0', '0', '0', '0', '0'};
|
||||||
|
widthBytes = width/8;
|
||||||
|
if(width%8>0){
|
||||||
|
widthBytes= (((int)(width/8))+1);
|
||||||
|
} else {
|
||||||
|
widthBytes= width/8;
|
||||||
|
}
|
||||||
|
this.total = widthBytes*height;
|
||||||
|
for (int h = 0; h<height; h++)
|
||||||
|
{
|
||||||
|
for (int w = 0; w<width; w++)
|
||||||
|
{
|
||||||
|
rgb = orginalImage.getRGB(w, h);
|
||||||
|
red = (rgb >> 16 ) & 0x000000FF;
|
||||||
|
green = (rgb >> 8 ) & 0x000000FF;
|
||||||
|
blue = (rgb) & 0x000000FF;
|
||||||
|
char auxChar = '1';
|
||||||
|
int totalColor = red + green + blue;
|
||||||
|
if(totalColor>blackLimit){
|
||||||
|
auxChar = '0';
|
||||||
|
}
|
||||||
|
auxBinaryChar[index] = auxChar;
|
||||||
|
index++;
|
||||||
|
if(index==8 || w==(width-1)){
|
||||||
|
sb.append(fourByteBinary(new String(auxBinaryChar)));
|
||||||
|
auxBinaryChar = new char[]{'0', '0', '0', '0', '0', '0', '0', '0'};
|
||||||
|
index=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sb.append("\n");
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
private String fourByteBinary(String binaryStr){
|
||||||
|
int decimal = Integer.parseInt(binaryStr,2);
|
||||||
|
if (decimal>15){
|
||||||
|
return Integer.toString(decimal,16).toUpperCase();
|
||||||
|
} else {
|
||||||
|
return "0" + Integer.toString(decimal,16).toUpperCase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private String encodeHexAscii(String code){
|
||||||
|
int maxlinea = widthBytes * 2;
|
||||||
|
StringBuffer sbCode = new StringBuffer();
|
||||||
|
StringBuffer sbLinea = new StringBuffer();
|
||||||
|
String previousLine = null;
|
||||||
|
int counter = 1;
|
||||||
|
char aux = code.charAt(0);
|
||||||
|
boolean firstChar = false;
|
||||||
|
for(int i = 1; i< code.length(); i++ ){
|
||||||
|
if(firstChar){
|
||||||
|
aux = code.charAt(i);
|
||||||
|
firstChar = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(code.charAt(i)=='\n'){
|
||||||
|
if(counter>=maxlinea && aux=='0'){
|
||||||
|
sbLinea.append(",");
|
||||||
|
} else if(counter>=maxlinea && aux=='F'){
|
||||||
|
sbLinea.append("!");
|
||||||
|
} else if (counter>20){
|
||||||
|
int multi20 = (counter/20)*20;
|
||||||
|
int resto20 = (counter%20);
|
||||||
|
sbLinea.append(mapCode.get(multi20));
|
||||||
|
if(resto20!=0){
|
||||||
|
sbLinea.append(mapCode.get(resto20) + aux);
|
||||||
|
} else {
|
||||||
|
sbLinea.append(aux);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sbLinea.append(mapCode.get(counter) + aux);
|
||||||
|
if(mapCode.get(counter)==null){
|
||||||
|
}
|
||||||
|
}
|
||||||
|
counter = 1;
|
||||||
|
firstChar = true;
|
||||||
|
if(sbLinea.toString().equals(previousLine)){
|
||||||
|
sbCode.append(":");
|
||||||
|
} else {
|
||||||
|
sbCode.append(sbLinea.toString());
|
||||||
|
}
|
||||||
|
previousLine = sbLinea.toString();
|
||||||
|
sbLinea.setLength(0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(aux == code.charAt(i)){
|
||||||
|
counter++;
|
||||||
|
} else {
|
||||||
|
if(counter>20){
|
||||||
|
int multi20 = (counter/20)*20;
|
||||||
|
int resto20 = (counter%20);
|
||||||
|
sbLinea.append(mapCode.get(multi20));
|
||||||
|
if(resto20!=0){
|
||||||
|
sbLinea.append(mapCode.get(resto20) + aux);
|
||||||
|
} else {
|
||||||
|
sbLinea.append(aux);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sbLinea.append(mapCode.get(counter) + aux);
|
||||||
|
}
|
||||||
|
counter = 1;
|
||||||
|
aux = code.charAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sbCode.toString();
|
||||||
|
}
|
||||||
|
private String headDoc(){
|
||||||
|
String str = "^XA " +
|
||||||
|
"^FO0,0^GFA,"+ total + ","+ total + "," + widthBytes +", ";
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
private String footDoc(){
|
||||||
|
String str = "^FS"+
|
||||||
|
"^XZ";
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
public void setCompressHex(boolean compressHex) {
|
||||||
|
this.compressHex = compressHex;
|
||||||
|
}
|
||||||
|
public void setBlacknessLimitPercentage(int percentage){
|
||||||
|
blackLimit = (percentage * 768 / 100);
|
||||||
|
}
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
// BufferedImage orginalImage = ImageIO.read(new File("/tmp/logo.jpg"));
|
||||||
|
// ZPLConverter zp = new ZPLConverter();
|
||||||
|
// zp.setCompressHex(true);
|
||||||
|
// zp.setBlacknessLimitPercentage(50);
|
||||||
|
// System.out.println(zp.convertfromImg(orginalImage));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 3.1 KiB |
Loading…
Reference in new issue