libis-format 1.0.5 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/.travis.yml +1 -1
- data/base/Dockerfile +22 -2
- data/base/Dockerfile.alpine +20 -0
- data/base/Dockerfile.rvm +56 -0
- data/base/rework_path +25 -0
- data/docker_cfg.yml +1 -0
- data/lib/libis/format/type_database.rb +1 -2
- data/lib/libis/format/type_database_impl.rb +1 -1
- data/lib/libis/format/version.rb +1 -1
- data/tools/fop/fop.bat +75 -75
- data/tools/fop/fop.cmd +31 -31
- data/tools/fop/fop.js +341 -341
- data/tools/fop/lib/avalon-framework.NOTICE.TXT +11 -11
- data/tools/fop/lib/xml-apis.LICENSE-SAX.html +17 -17
- data/tools/fop/lib/xml-apis.LICENSE.DOM-documentation.html +74 -74
- data/tools/fop/lib/xml-apis.LICENSE.DOM-software.html +66 -66
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09143d3be9aca7d01b5c6ba3512e4b106d4ee2f0e370fad9c565bf0724c61846'
|
4
|
+
data.tar.gz: 5c9f5fb67527e828a2b293ffe6e4bf8616d7a08f67780b963e5f292bb50ae385
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbf99230e3566a2aacdfd02e97f2622cd83d32601cb772fec50a94c04054754e367ea1a09276e7cdee6d9bc564f8642a63967159a2d3290769c368945fe3c233
|
7
|
+
data.tar.gz: c0f33d0d7d0208ea7ed8678da52dea0dd30ee54438c321a4be0a1b5ccc01f2451591251615775074639b03e4548d9a97cf4218e4ae0b8ce0aa2819e70f12a964
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -44,7 +44,7 @@ before_install:
|
|
44
44
|
- sudo chmod 755 /opt/droid/droid.sh
|
45
45
|
- sudo locale-gen "en_US.UTF-8"
|
46
46
|
- sudo dpkg-reconfigure locales
|
47
|
-
- echo "8\n9\n" | sudo
|
47
|
+
- echo "8\n9\n" | sudo dpkg-reconfigure tzdata
|
48
48
|
env:
|
49
49
|
- LC_ALL=en_US.UTF-8
|
50
50
|
- LANG=en_US.UTF-8
|
data/base/Dockerfile
CHANGED
@@ -1,13 +1,33 @@
|
|
1
1
|
FROM ubuntu:18.04
|
2
|
-
RUN apt-get -q update
|
3
|
-
|
2
|
+
RUN apt-get -q update \
|
3
|
+
&& apt-get install -q -y --no-install-recommends \
|
4
|
+
wget \
|
5
|
+
unzip \
|
6
|
+
imagemagick \
|
7
|
+
python2.7 \
|
8
|
+
python-pip \
|
9
|
+
openjdk-8-jre-headless \
|
10
|
+
libreoffice \
|
11
|
+
ghostscript
|
12
|
+
|
13
|
+
RUN apt-get clean \
|
14
|
+
&& rm -rf /var/lib/apt/lists/*
|
15
|
+
|
4
16
|
RUN pip install --upgrade pip && pip install opf-fido
|
17
|
+
|
5
18
|
RUN wget -q -O droid.zip "http://www.nationalarchives.gov.uk/documents/information-management/droid-binary-6.4-bin.zip" \
|
6
19
|
&& mkdir -p /opt/droid \
|
7
20
|
&& unzip -d /opt/droid droid.zip \
|
8
21
|
&& chmod 755 /opt/droid/droid.sh \
|
9
22
|
&& rm droid.zip
|
23
|
+
|
10
24
|
RUN wget -q -O fop.tar.gz "http://www.apache.org/dyn/closer.cgi?filename=/xmlgraphics/fop/binaries/fop-2.3-bin.tar.gz&action=download" \
|
11
25
|
&& mkdir -p /opt/fop \
|
12
26
|
&& tar xzf fop.tar.gz -C /opt/fop --strip-components=2 \
|
13
27
|
&& rm fop.tar.gz
|
28
|
+
|
29
|
+
RUN echo "8\n9\n" | apt-get install tzdata
|
30
|
+
ADD ./tools /tools
|
31
|
+
ADD ./data /config
|
32
|
+
ADD ./spec/data /data
|
33
|
+
CMD /bin/bash
|
@@ -0,0 +1,20 @@
|
|
1
|
+
FROM alpine:3.8
|
2
|
+
LABEL maintainer="kris.dekeyser@libis.be"
|
3
|
+
RUN apk update -q && apk upgrade -q
|
4
|
+
RUN apk add -q python2 py-pip openjdk8-jre ffmpeg libreoffice ttf-liberation ttf-freefont ttf-opensans sox git wget unzip sudo bash curl tar imagemagick
|
5
|
+
# install fido
|
6
|
+
RUN pip install -q --upgrade pip && pip install -q opf-fido
|
7
|
+
# install droid
|
8
|
+
RUN wget -q -O droid.zip http://www.nationalarchives.gov.uk/documents/information-management/droid-binary-6.4-bin.zip \
|
9
|
+
&& mkdir -p /opt/droid \
|
10
|
+
&& unzip -q -d /opt/droid droid.zip \
|
11
|
+
&& chmod 755 /opt/droid/droid.sh \
|
12
|
+
&& rm droid.zip
|
13
|
+
# install ImageMagick
|
14
|
+
RUN apk add -q imagemagick
|
15
|
+
ADD ../tools /tools
|
16
|
+
ADD ../data /cfg
|
17
|
+
VOLUME /data
|
18
|
+
WORKDIR /data
|
19
|
+
|
20
|
+
CMD ["/bin/bash", "-l"]
|
data/base/Dockerfile.rvm
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
ARG ubuntu_ver=latest
|
2
|
+
ARG ruby_ver=2.5.3
|
3
|
+
ARG node_ver=10.15.0
|
4
|
+
|
5
|
+
FROM ubuntu:${ubuntu_ver}
|
6
|
+
LABEL maintainer="kris.dekeyser@libis.be"
|
7
|
+
|
8
|
+
ENV RUBY_ENV=${ruby_ver}
|
9
|
+
ENV NVM_DIR=/usr/local/nvm
|
10
|
+
ENV NODE_VER=${node_ver}
|
11
|
+
ENV NODE_PATH=$NVM_DIR/v$NODE_VER/lib/node_modules
|
12
|
+
ENV NODE_PATH=$NVM_DIR/versions/node/v$NODE_VER/bin
|
13
|
+
ENV PATH "${PATH}:${NODE_PATH}:${NODE_PATH}/npm"
|
14
|
+
|
15
|
+
RUN echo $RUBY_ENV
|
16
|
+
|
17
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
18
|
+
RUN apt-get update -q \
|
19
|
+
&& apt-get install -y -q --no-install-recommends software-properties-common apt-utils
|
20
|
+
RUN apt-add-repository -y ppa:rael-gc/rvm \
|
21
|
+
&& apt-get update -q
|
22
|
+
RUN apt-get install -y -q --no-install-recommends \
|
23
|
+
build-essential \
|
24
|
+
gnupg2 \
|
25
|
+
git \
|
26
|
+
wget \
|
27
|
+
curl \
|
28
|
+
sudo \
|
29
|
+
unzip \
|
30
|
+
openjdk-8-jre-headless
|
31
|
+
|
32
|
+
ENV BASH_ENV='/etc/profile exec bash'
|
33
|
+
SHELL ["/bin/bash", "-l", "-c"]
|
34
|
+
|
35
|
+
RUN addgroup --gid 2000 teneo \
|
36
|
+
&& adduser --uid 2000 --gid 2000 --disabled-password --gecos "Teneo user" teneo \
|
37
|
+
&& usermod -L -s /bin/bash teneo
|
38
|
+
RUN echo 'teneo ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers
|
39
|
+
|
40
|
+
USER teneo
|
41
|
+
|
42
|
+
RUN gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
|
43
|
+
|
44
|
+
RUN curl -sSL https://get.rvm.io | bash -s stable
|
45
|
+
|
46
|
+
RUN echo 'gem: --no-document' > ${HOME}/.gemrc
|
47
|
+
RUN echo rvm install ${ruby_ver}
|
48
|
+
RUN echo rvm use ${RUBY_ENV}@teneo --create --ruby-version --ruby-gems
|
49
|
+
|
50
|
+
# required due to bug in rubygems (https://github.com/rubygems/rubygems/issues/2483)
|
51
|
+
RUN gem install rdoc bundler
|
52
|
+
RUN gem update --no-document --system
|
53
|
+
RUN rvm info
|
54
|
+
#ADD . /home/libis/libis_format
|
55
|
+
#WORKDIR /home/libis/libis_format
|
56
|
+
#RUN bundle install && bundle exec rake spec
|
data/base/rework_path
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
#file=${1/$SRC_PATH/$TGT_PATH}
|
4
|
+
#echo "$1 -> $file"
|
5
|
+
|
6
|
+
CMD=$1
|
7
|
+
shift
|
8
|
+
|
9
|
+
readarray -d ',' -t mapping <<< "$VOLUME_MAPPING"
|
10
|
+
|
11
|
+
args=("$@")
|
12
|
+
echo "args: ${args[@]}"
|
13
|
+
#args="${args[@]/$SRC_PATH/$TGT_PATH}"
|
14
|
+
#args="${args[@]/$SRC_TMP/$TGT_TMP}"
|
15
|
+
for map in "${mapping[@]}"
|
16
|
+
do
|
17
|
+
map="${map//[$'\t\r\n ']}"
|
18
|
+
readarray -d '=' -t m <<< "$map"
|
19
|
+
src="${m[0]//[$'\t\r\n ']}"
|
20
|
+
tgt="${m[1]//[$'\t\r\n ']}"
|
21
|
+
echo "$src -> $tgt"
|
22
|
+
args="${args[@]/$src/$tgt}"
|
23
|
+
echo "args: ${args[@]}"
|
24
|
+
done
|
25
|
+
echo $CMD "${args[@]}"
|
data/docker_cfg.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
:fop_jar: '/tools/fop.jar'
|
data/lib/libis/format/version.rb
CHANGED
data/tools/fop/fop.bat
CHANGED
@@ -1,75 +1,75 @@
|
|
1
|
-
@ECHO OFF
|
2
|
-
REM Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
-
REM contributor license agreements. See the NOTICE file distributed with
|
4
|
-
REM this work for additional information regarding copyright ownership.
|
5
|
-
REM The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
-
REM (the "License"); you may not use this file except in compliance with
|
7
|
-
REM the License. You may obtain a copy of the License at
|
8
|
-
REM
|
9
|
-
REM http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
REM
|
11
|
-
REM Unless required by applicable law or agreed to in writing, software
|
12
|
-
REM distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
REM See the License for the specific language governing permissions and
|
15
|
-
REM limitations under the License.
|
16
|
-
REM $Id: fop.bat 1736993 2016-03-29 09:19:30Z ssteiner $
|
17
|
-
|
18
|
-
SETLOCAL ENABLEDELAYEDEXPANSION
|
19
|
-
|
20
|
-
rem %~dp0 is the expanded pathname of the current script under NT
|
21
|
-
set LOCAL_FOP_HOME=
|
22
|
-
if "%OS%"=="Windows_NT" set LOCAL_FOP_HOME="%~dp0"
|
23
|
-
|
24
|
-
rem Code from Apache Ant project
|
25
|
-
rem Slurp the command line arguments. This loop allows for an unlimited number
|
26
|
-
rem of arguments (up to the command line limit, anyway).
|
27
|
-
rem Could also do a "shift" and "%*" for all params, but apparently doesn't work
|
28
|
-
rem with Win9x.
|
29
|
-
set FOP_CMD_LINE_ARGS=%1
|
30
|
-
if ""%1""=="""" goto doneStart
|
31
|
-
shift
|
32
|
-
:setupArgs
|
33
|
-
if ""%1""=="""" goto doneStart
|
34
|
-
set FOP_CMD_LINE_ARGS=%FOP_CMD_LINE_ARGS% %1
|
35
|
-
shift
|
36
|
-
goto setupArgs
|
37
|
-
rem This label provides a place for the argument list loop to break out
|
38
|
-
rem and for NT handling to skip to.
|
39
|
-
:doneStart
|
40
|
-
|
41
|
-
set LOGCHOICE=
|
42
|
-
rem The default commons logger for JDK1.4 is JDK1.4Logger.
|
43
|
-
rem To use a different logger, uncomment the one desired below
|
44
|
-
rem set LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog
|
45
|
-
rem set LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
|
46
|
-
rem set LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
|
47
|
-
|
48
|
-
set LOGLEVEL=
|
49
|
-
rem Logging levels
|
50
|
-
rem Below option is only if you are using SimpleLog instead of the default JDK1.4 Logger.
|
51
|
-
rem To set logging levels for JDK 1.4 Logger, edit the %JAVA_HOME%\JRE\LIB\logging.properties
|
52
|
-
rem file instead.
|
53
|
-
rem Possible SimpleLog values: "trace", "debug", "info" (default), "warn", "error", or "fatal".
|
54
|
-
rem set LOGLEVEL=-Dorg.apache.commons.logging.simplelog.defaultlog=INFO
|
55
|
-
|
56
|
-
set LIBDIR=%LOCAL_FOP_HOME%lib
|
57
|
-
|
58
|
-
set LOCALCLASSPATH=%FOP_HYPHENATION_PATH%
|
59
|
-
for %%l in (%LOCAL_FOP_HOME%build\*.jar %LIBDIR%\*.jar %LOCAL_FOP_HOME%target\*.jar) do set LOCALCLASSPATH=!LOCALCLASSPATH!;%%l
|
60
|
-
|
61
|
-
set JAVAOPTS=-Denv.windir=%WINDIR%
|
62
|
-
|
63
|
-
if "%JAVA_HOME%" == "" goto noJavaHome
|
64
|
-
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
|
65
|
-
if "%JAVACMD%" == "" set JAVACMD=%JAVA_HOME%\bin\java
|
66
|
-
goto runFop
|
67
|
-
|
68
|
-
:noJavaHome
|
69
|
-
if "%JAVACMD%" == "" set JAVACMD=java
|
70
|
-
|
71
|
-
:runFop
|
72
|
-
rem echo "%JAVACMD%" %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%" org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS%
|
73
|
-
"%JAVACMD%" %JAVAOPTS% %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%" %FOP_OPTS% org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS%
|
74
|
-
|
75
|
-
ENDLOCAL
|
1
|
+
@ECHO OFF
|
2
|
+
REM Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
+
REM contributor license agreements. See the NOTICE file distributed with
|
4
|
+
REM this work for additional information regarding copyright ownership.
|
5
|
+
REM The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
+
REM (the "License"); you may not use this file except in compliance with
|
7
|
+
REM the License. You may obtain a copy of the License at
|
8
|
+
REM
|
9
|
+
REM http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
REM
|
11
|
+
REM Unless required by applicable law or agreed to in writing, software
|
12
|
+
REM distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
REM See the License for the specific language governing permissions and
|
15
|
+
REM limitations under the License.
|
16
|
+
REM $Id: fop.bat 1736993 2016-03-29 09:19:30Z ssteiner $
|
17
|
+
|
18
|
+
SETLOCAL ENABLEDELAYEDEXPANSION
|
19
|
+
|
20
|
+
rem %~dp0 is the expanded pathname of the current script under NT
|
21
|
+
set LOCAL_FOP_HOME=
|
22
|
+
if "%OS%"=="Windows_NT" set LOCAL_FOP_HOME="%~dp0"
|
23
|
+
|
24
|
+
rem Code from Apache Ant project
|
25
|
+
rem Slurp the command line arguments. This loop allows for an unlimited number
|
26
|
+
rem of arguments (up to the command line limit, anyway).
|
27
|
+
rem Could also do a "shift" and "%*" for all params, but apparently doesn't work
|
28
|
+
rem with Win9x.
|
29
|
+
set FOP_CMD_LINE_ARGS=%1
|
30
|
+
if ""%1""=="""" goto doneStart
|
31
|
+
shift
|
32
|
+
:setupArgs
|
33
|
+
if ""%1""=="""" goto doneStart
|
34
|
+
set FOP_CMD_LINE_ARGS=%FOP_CMD_LINE_ARGS% %1
|
35
|
+
shift
|
36
|
+
goto setupArgs
|
37
|
+
rem This label provides a place for the argument list loop to break out
|
38
|
+
rem and for NT handling to skip to.
|
39
|
+
:doneStart
|
40
|
+
|
41
|
+
set LOGCHOICE=
|
42
|
+
rem The default commons logger for JDK1.4 is JDK1.4Logger.
|
43
|
+
rem To use a different logger, uncomment the one desired below
|
44
|
+
rem set LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog
|
45
|
+
rem set LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
|
46
|
+
rem set LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
|
47
|
+
|
48
|
+
set LOGLEVEL=
|
49
|
+
rem Logging levels
|
50
|
+
rem Below option is only if you are using SimpleLog instead of the default JDK1.4 Logger.
|
51
|
+
rem To set logging levels for JDK 1.4 Logger, edit the %JAVA_HOME%\JRE\LIB\logging.properties
|
52
|
+
rem file instead.
|
53
|
+
rem Possible SimpleLog values: "trace", "debug", "info" (default), "warn", "error", or "fatal".
|
54
|
+
rem set LOGLEVEL=-Dorg.apache.commons.logging.simplelog.defaultlog=INFO
|
55
|
+
|
56
|
+
set LIBDIR=%LOCAL_FOP_HOME%lib
|
57
|
+
|
58
|
+
set LOCALCLASSPATH=%FOP_HYPHENATION_PATH%
|
59
|
+
for %%l in (%LOCAL_FOP_HOME%build\*.jar %LIBDIR%\*.jar %LOCAL_FOP_HOME%target\*.jar) do set LOCALCLASSPATH=!LOCALCLASSPATH!;%%l
|
60
|
+
|
61
|
+
set JAVAOPTS=-Denv.windir=%WINDIR%
|
62
|
+
|
63
|
+
if "%JAVA_HOME%" == "" goto noJavaHome
|
64
|
+
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
|
65
|
+
if "%JAVACMD%" == "" set JAVACMD=%JAVA_HOME%\bin\java
|
66
|
+
goto runFop
|
67
|
+
|
68
|
+
:noJavaHome
|
69
|
+
if "%JAVACMD%" == "" set JAVACMD=java
|
70
|
+
|
71
|
+
:runFop
|
72
|
+
rem echo "%JAVACMD%" %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%" org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS%
|
73
|
+
"%JAVACMD%" %JAVAOPTS% %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%" %FOP_OPTS% org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS%
|
74
|
+
|
75
|
+
ENDLOCAL
|
data/tools/fop/fop.cmd
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
@ECHO OFF
|
2
|
-
REM Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
-
REM contributor license agreements. See the NOTICE file distributed with
|
4
|
-
REM this work for additional information regarding copyright ownership.
|
5
|
-
REM The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
-
REM (the "License"); you may not use this file except in compliance with
|
7
|
-
REM the License. You may obtain a copy of the License at
|
8
|
-
REM
|
9
|
-
REM http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
REM
|
11
|
-
REM Unless required by applicable law or agreed to in writing, software
|
12
|
-
REM distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
REM See the License for the specific language governing permissions and
|
15
|
-
REM limitations under the License.
|
16
|
-
REM $Id: fop.cmd 1734671 2016-03-12 05:39:53Z gadams $
|
17
|
-
|
18
|
-
set LOCAL_FOP_HOME=%~dp0
|
19
|
-
set FOP_CMD_LINE_ARGS=%1
|
20
|
-
if ""%1""=="""" goto doneStart
|
21
|
-
shift
|
22
|
-
:setupArgs
|
23
|
-
if ""%1""=="""" goto doneStart
|
24
|
-
set FOP_CMD_LINE_ARGS=%FOP_CMD_LINE_ARGS% %1
|
25
|
-
shift
|
26
|
-
goto setupArgs
|
27
|
-
rem This label provides a place for the argument list loop to break out
|
28
|
-
:doneStart
|
29
|
-
|
30
|
-
call "%LOCAL_FOP_HOME%\fop.bat" %FOP_CMD_LINE_ARGS%
|
31
|
-
|
1
|
+
@ECHO OFF
|
2
|
+
REM Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
+
REM contributor license agreements. See the NOTICE file distributed with
|
4
|
+
REM this work for additional information regarding copyright ownership.
|
5
|
+
REM The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
+
REM (the "License"); you may not use this file except in compliance with
|
7
|
+
REM the License. You may obtain a copy of the License at
|
8
|
+
REM
|
9
|
+
REM http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
REM
|
11
|
+
REM Unless required by applicable law or agreed to in writing, software
|
12
|
+
REM distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
REM See the License for the specific language governing permissions and
|
15
|
+
REM limitations under the License.
|
16
|
+
REM $Id: fop.cmd 1734671 2016-03-12 05:39:53Z gadams $
|
17
|
+
|
18
|
+
set LOCAL_FOP_HOME=%~dp0
|
19
|
+
set FOP_CMD_LINE_ARGS=%1
|
20
|
+
if ""%1""=="""" goto doneStart
|
21
|
+
shift
|
22
|
+
:setupArgs
|
23
|
+
if ""%1""=="""" goto doneStart
|
24
|
+
set FOP_CMD_LINE_ARGS=%FOP_CMD_LINE_ARGS% %1
|
25
|
+
shift
|
26
|
+
goto setupArgs
|
27
|
+
rem This label provides a place for the argument list loop to break out
|
28
|
+
:doneStart
|
29
|
+
|
30
|
+
call "%LOCAL_FOP_HOME%\fop.bat" %FOP_CMD_LINE_ARGS%
|
31
|
+
|
data/tools/fop/fop.js
CHANGED
@@ -1,341 +1,341 @@
|
|
1
|
-
// Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
-
// contributor license agreements. See the NOTICE file distributed with
|
3
|
-
// this work for additional information regarding copyright ownership.
|
4
|
-
// The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
-
// (the "License"); you may not use this file except in compliance with
|
6
|
-
// the License. You may obtain a copy of the License at
|
7
|
-
//
|
8
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
//
|
10
|
-
// Unless required by applicable law or agreed to in writing, software
|
11
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
// See the License for the specific language governing permissions and
|
14
|
-
// limitations under the License.
|
15
|
-
// $Id: fop.js 1734671 2016-03-12 05:39:53Z gadams $ -->
|
16
|
-
|
17
|
-
// jscript to run FOP, adapted from the Jakarta-Ant project.
|
18
|
-
|
19
|
-
// rpm_mode is irrelevant on Windows
|
20
|
-
// var rpm_mode=true;
|
21
|
-
var fop_exec_args = "";
|
22
|
-
var no_config=false;
|
23
|
-
var fop_exec_debug=false;
|
24
|
-
var debug=false;
|
25
|
-
var keep_open=false;
|
26
|
-
var show_help=false;
|
27
|
-
|
28
|
-
var config_wanted = new Array("FOP_HOME", "CLASSPATH", "FOP_HYPHENATION_PATH", "FOP_OPTS", "JAVA_OPTS", "LOGCHOICE", "LOGLEVEL");
|
29
|
-
|
30
|
-
// parse command-line arguments
|
31
|
-
function read_args() {
|
32
|
-
var args = WScript.Arguments;
|
33
|
-
var named = new ActiveXObject("Scripting.Dictionary");
|
34
|
-
for (i = 0; i < args.length; i++) {
|
35
|
-
switch(args(i)) {
|
36
|
-
case "--debug":
|
37
|
-
debug=true;
|
38
|
-
break;
|
39
|
-
case "--execdebug":
|
40
|
-
fop_exec_debug=true;
|
41
|
-
break;
|
42
|
-
case "--keepopen":
|
43
|
-
keep_open=true;
|
44
|
-
break;
|
45
|
-
case "--noconfig":
|
46
|
-
no_config=true;
|
47
|
-
break;
|
48
|
-
case "-h":
|
49
|
-
case "--help":
|
50
|
-
case "--h":
|
51
|
-
case "-help":
|
52
|
-
show_help=true;
|
53
|
-
// fop_exec_args=fop_exec_args + " -h";
|
54
|
-
break;
|
55
|
-
default:
|
56
|
-
fop_exec_args=fop_exec_args + " " + args(i);
|
57
|
-
}
|
58
|
-
}
|
59
|
-
if (debug) {
|
60
|
-
WScript.Echo("debug: " + debug);
|
61
|
-
WScript.Echo("execdebug: " + fop_exec_debug);
|
62
|
-
WScript.Echo("keepopen: " + keep_open);
|
63
|
-
WScript.Echo("noconfig: " + no_config);
|
64
|
-
WScript.Echo("help: " + show_help);
|
65
|
-
WScript.Echo("fop arguments: " + fop_exec_args);
|
66
|
-
}
|
67
|
-
}
|
68
|
-
|
69
|
-
var help_text="Usage:\n"
|
70
|
-
+ WScript.ScriptFullName + " [script options] [FOP options]\n"
|
71
|
-
+ "Script Options:\n"
|
72
|
-
+ " --help, -h print this message and FOP help\n"
|
73
|
-
+ " --debug print debugging information for this launch script\n"
|
74
|
-
+ " --execdebug print FOP exec line generated by this launch script\n"
|
75
|
-
+ " --keepopen keep FOP's command window open\n"
|
76
|
-
+ " --noconfig suppress reading of configuration file and registry";
|
77
|
-
|
78
|
-
function read_environment() {
|
79
|
-
for (i in config_wanted) {
|
80
|
-
if (!config.Exists(config_wanted[i])) {
|
81
|
-
var env_var_string = "%" + config_wanted[i] + "%";
|
82
|
-
var env_var = shell.ExpandEnvironmentStrings(env_var_string);
|
83
|
-
if (env_var != "" && env_var != env_var_string) {
|
84
|
-
config.Add(config_wanted[i], env_var);
|
85
|
-
if (debug) {
|
86
|
-
WScript.Echo(config_wanted[i] + " env: "
|
87
|
-
+ config.Item(config_wanted[i]));
|
88
|
-
}
|
89
|
-
}
|
90
|
-
}
|
91
|
-
}
|
92
|
-
}
|
93
|
-
|
94
|
-
function read_desktop(dtname) {
|
95
|
-
if (fs.FolderExists(dtname)) {
|
96
|
-
var fopname = fs.GetFolder(dtname).ParentFolder.Path
|
97
|
-
+ "\\Application Data\\Fop";
|
98
|
-
if (fs.FolderExists(fopname)) {
|
99
|
-
var fop_conf_name = fs.GetFolder(fopname).Path + "\\fop.conf";
|
100
|
-
if (fs.FileExists(fop_conf_name)) {
|
101
|
-
// source fop_conf_file
|
102
|
-
var conf_file = fs.openTextFile(fs.GetFile(fop_conf_name));
|
103
|
-
var conf_lines = new ActiveXObject("Scripting.Dictionary");
|
104
|
-
while (!conf_file.AtEndOfStream) {
|
105
|
-
var line = conf_file.ReadLine();
|
106
|
-
var m = line.match(/(.+?)=(.+)/);
|
107
|
-
if (m != null) {
|
108
|
-
conf_lines.Add(m[1], m[2]);
|
109
|
-
}
|
110
|
-
}
|
111
|
-
for (j in config_wanted) {
|
112
|
-
if (!config.Exists(config_wanted[j])
|
113
|
-
&& conf_lines.Exists(config_wanted[j])) {
|
114
|
-
config.Add(config_wanted[j], conf_lines.Item(config_wanted[j]));
|
115
|
-
if (debug) {
|
116
|
-
WScript.Echo(config_wanted[j] + " " + dts[i] + ": "
|
117
|
-
+ config.Item(config_wanted[i]));
|
118
|
-
}
|
119
|
-
}
|
120
|
-
}
|
121
|
-
}
|
122
|
-
}
|
123
|
-
}
|
124
|
-
}
|
125
|
-
|
126
|
-
function read_registry(section) {
|
127
|
-
for (j in config_wanted) {
|
128
|
-
if (!config.Exists(config_wanted[j])) {
|
129
|
-
var reg_var;
|
130
|
-
try {
|
131
|
-
reg_var = shell.RegRead(section + "\\Software\\Fop\\"
|
132
|
-
+ config_wanted[j]);
|
133
|
-
config.Add(config_wanted[j], reg_var);
|
134
|
-
if (debug) {
|
135
|
-
WScript.Echo(config_wanted[j] + " " + rks[i] + ": "
|
136
|
-
+ config.Item(config_wanted[j]));
|
137
|
-
}
|
138
|
-
} catch(e) {}
|
139
|
-
}
|
140
|
-
}
|
141
|
-
}
|
142
|
-
|
143
|
-
// construct FOP_HOME from the script folder
|
144
|
-
function get_fop_home() {
|
145
|
-
if (!config.Exists("FOP_HOME")
|
146
|
-
|| !fs.FolderExists(config.Item("FOP_HOME"))) {
|
147
|
-
var fop_home = WScript.ScriptFullName;
|
148
|
-
fop_home = fop_home.substring(0, fop_home.length
|
149
|
-
- WScript.ScriptName.length - 1);
|
150
|
-
if (config.Exists("FOP_HOME")) {
|
151
|
-
config.Remove("FOP_HOME");
|
152
|
-
}
|
153
|
-
config.Add("FOP_HOME", fop_home);
|
154
|
-
if (debug) {
|
155
|
-
WScript.Echo("FOP_HOME dyn: " + config.Item("FOP_HOME"));
|
156
|
-
}
|
157
|
-
}
|
158
|
-
}
|
159
|
-
|
160
|
-
function get_java_cmd() {
|
161
|
-
var java_home = shell.ExpandEnvironmentStrings("%JAVA_HOME%");
|
162
|
-
javacmd = "java";
|
163
|
-
if (java_home != "" && typeof(java_home) != "undefined"
|
164
|
-
&& fs.FolderExists(java_home)) {
|
165
|
-
var javacmd_candidate = java_home + "\\bin\\java.exe";
|
166
|
-
if (fs.FileExists(javacmd_candidate)) {
|
167
|
-
javacmd = javacmd_candidate;
|
168
|
-
}
|
169
|
-
}
|
170
|
-
if (debug) {
|
171
|
-
WScript.Echo("java command: " + javacmd);
|
172
|
-
}
|
173
|
-
}
|
174
|
-
|
175
|
-
function get_local_classpath() {
|
176
|
-
if (config.Exists("CLASSPATH")) {
|
177
|
-
local_classpath = config.Item("CLASSPATH");
|
178
|
-
if (debug) {
|
179
|
-
WScript.Echo("local classpath: " + local_classpath);
|
180
|
-
}
|
181
|
-
}
|
182
|
-
|
183
|
-
// add fop.jar, fop-sandbox and fop-hyph.jar, which reside in $FOP_HOME/build
|
184
|
-
var lcp = local_classpath;
|
185
|
-
local_classpath = config.Item("FOP_HOME") + "\\build\\fop.jar;"
|
186
|
-
+ config.Item("FOP_HOME") + "\\build\\fop-sandbox.jar;"
|
187
|
-
+ config.Item("FOP_HOME") + "\\build\\fop-hyph.jar";
|
188
|
-
if (lcp != "") {
|
189
|
-
local_classpath += ";" + lcp;
|
190
|
-
}
|
191
|
-
if (debug) {
|
192
|
-
WScript.Echo("local classpath: " + local_classpath);
|
193
|
-
}
|
194
|
-
|
195
|
-
// add in the dependency .jar files, which reside in $FOP_HOME/lib
|
196
|
-
var libdir_name = config.Item("FOP_HOME") + "\\lib";
|
197
|
-
var dirlibs;
|
198
|
-
if (fs.FolderExists(libdir_name)) {
|
199
|
-
dirlibs = fs.GetFolder(libdir_name).Files;
|
200
|
-
var e = new Enumerator(dirlibs);
|
201
|
-
for (; !e.atEnd(); e.moveNext()) {
|
202
|
-
if (e.item().Name.match("\.jar$")) {
|
203
|
-
local_classpath = libdir_name + "\\" + e.item().Name + ";" + local_classpath;
|
204
|
-
}
|
205
|
-
}
|
206
|
-
if (debug) {
|
207
|
-
WScript.Echo("local classpath: " + local_classpath);
|
208
|
-
}
|
209
|
-
}
|
210
|
-
|
211
|
-
// add in user-defined hyphenation JARs
|
212
|
-
if (config.Exists("FOP_HYPHENATION_PATH")) {
|
213
|
-
local_classpath += ";" + config.Item("FOP_HYPHENATION_PATH");
|
214
|
-
if (debug) {
|
215
|
-
WScript.Echo("local classpath: " + local_classpath);
|
216
|
-
}
|
217
|
-
}
|
218
|
-
}
|
219
|
-
|
220
|
-
// Execute fop via shell.Exec
|
221
|
-
function fop_exec() {
|
222
|
-
var fop_exec_command = "\"" + javacmd + "\" "
|
223
|
-
+ (config.Exists("JAVA_OPTS")?config.Item("JAVA_OPTS") + " ":"")
|
224
|
-
+ (config.Exists("LOGCHOICE")?config.Item("LOGCHOICE") + " ":"")
|
225
|
-
+ (config.Exists("LOGLEVEL")?config.Item("LOGLEVEL") + " ":"")
|
226
|
-
+ "-classpath \"" + local_classpath + "\" "
|
227
|
-
+ (config.Exists("FOP_OPTS")?config.Item("FOP_OPTS"):"")
|
228
|
-
+ "org.apache.fop.cli.Main " + fop_exec_args;
|
229
|
-
if (debug || fop_exec_debug) {
|
230
|
-
WScript.Echo(fop_exec_command);
|
231
|
-
}
|
232
|
-
|
233
|
-
var fop_run = shell.Exec(fop_exec_command);
|
234
|
-
while (true) {
|
235
|
-
while (!fop_run.StdOut.AtEndOfStream) {
|
236
|
-
WScript.Echo(fop_run.StdOut.ReadLine());
|
237
|
-
}
|
238
|
-
while (!fop_run.StdErr.AtEndOfStream) {
|
239
|
-
WScript.Echo(fop_run.StdErr.ReadLine());
|
240
|
-
}
|
241
|
-
if (fop_run.Status == 1) {
|
242
|
-
break;
|
243
|
-
}
|
244
|
-
WScript.Sleep(100);
|
245
|
-
}
|
246
|
-
if (debug) {
|
247
|
-
WScript.Echo("exit status: " + fop_run.ExitCode);
|
248
|
-
}
|
249
|
-
}
|
250
|
-
|
251
|
-
// Execute fop via shell.Run
|
252
|
-
function fop_run() {
|
253
|
-
var fop_exec_command = "cmd /" + (keep_open?"K":"C") + " \""
|
254
|
-
+ "\"" + javacmd + "\" "
|
255
|
-
+ (config.Exists("JAVA_OPTS")?config.Item("JAVA_OPTS") + " ":"")
|
256
|
-
+ (config.Exists("LOGCHOICE")?config.Item("LOGCHOICE") + " ":"")
|
257
|
-
+ (config.Exists("LOGLEVEL")?config.Item("LOGLEVEL") + " ":"")
|
258
|
-
+ "-classpath \"" + local_classpath + "\" "
|
259
|
-
+ (config.Exists("FOP_OPTS")?config.Item("FOP_OPTS") + " ":"")
|
260
|
-
+ "org.apache.fop.cli.Main " + fop_exec_args + "\"";
|
261
|
-
if (debug || fop_exec_debug) {
|
262
|
-
WScript.Echo(fop_exec_command);
|
263
|
-
}
|
264
|
-
var exit_code = shell.Run(fop_exec_command, 1, 1);
|
265
|
-
if (debug) {
|
266
|
-
WScript.Echo("exit status: " + exit_code);
|
267
|
-
} else {
|
268
|
-
if (exit_code != 0) {
|
269
|
-
WScript.Echo("A FOP error occurred (FOP exit status: " + exit_code + ")\n"
|
270
|
-
+ "Use option --keepopen to see FOP's output\n"
|
271
|
-
+ "(that is two dashes)");
|
272
|
-
}
|
273
|
-
}
|
274
|
-
}
|
275
|
-
|
276
|
-
function get_log_choice() {
|
277
|
-
// The default commons logger for JDK1.4 is JDK1.4Logger.
|
278
|
-
// To use a different logger, uncomment the one desired below
|
279
|
-
if (!config.Exists("LOGCHOICE")) {
|
280
|
-
// config.Add("LOGCHOICE","\"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog\"");
|
281
|
-
// config.Add("LOGCHOICE","\"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog\"");
|
282
|
-
// config.Add("LOGCHOICE","\"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger\"");
|
283
|
-
if (debug && config.Exists("LOGCHOICE")) {
|
284
|
-
WScript.Echo("LOGCHOICE script: " + config.Item("LOGCHOICE"));
|
285
|
-
}
|
286
|
-
}
|
287
|
-
}
|
288
|
-
|
289
|
-
function get_log_level() {
|
290
|
-
// Logging levels
|
291
|
-
// Below option is only if you are using SimpleLog instead of the default JDK1.4 Logger.
|
292
|
-
// To set logging levels for JDK 1.4 Logger, edit the %JAVA_HOME%/JRE/LIB/logging.properties
|
293
|
-
// file instead.
|
294
|
-
// Possible SimpleLog values: "trace", "debug", "info" (default), "warn", "error", or "fatal".
|
295
|
-
if (!config.Exists("LOGLEVEL")) {
|
296
|
-
// config.Add("LOGLEVEL","\"-Dorg.apache.commons.logging.simplelog.defaultlog=INFO\"");
|
297
|
-
if (debug && config.Exists("LOGLEVEL")) {
|
298
|
-
WScript.Echo("LOGLEVEL script: " + config.Item("LOGLEVEL"));
|
299
|
-
}
|
300
|
-
}
|
301
|
-
}
|
302
|
-
|
303
|
-
var shell = WScript.CreateObject("WScript.Shell");
|
304
|
-
var fs = WScript.CreateObject("Scripting.FileSystemObject");
|
305
|
-
|
306
|
-
// configuration
|
307
|
-
var config = new ActiveXObject("Scripting.Dictionary");
|
308
|
-
|
309
|
-
read_args();
|
310
|
-
read_environment();
|
311
|
-
if (!no_config) {
|
312
|
-
// read user and system-wide fop configurations
|
313
|
-
var spec = shell.SpecialFolders;
|
314
|
-
var dts = new Array("Desktop", "AllUsersDesktop");
|
315
|
-
for (i in dts) {
|
316
|
-
read_desktop(spec(dts[i]));
|
317
|
-
}
|
318
|
-
// read user and system-wide registry
|
319
|
-
var rks = new Array("HKCU", "HKLM");
|
320
|
-
for (i in rks) {
|
321
|
-
read_registry(rks[i]);
|
322
|
-
}
|
323
|
-
}
|
324
|
-
|
325
|
-
get_fop_home();
|
326
|
-
get_log_choice();
|
327
|
-
get_log_level();
|
328
|
-
var javacmd = "";
|
329
|
-
get_java_cmd();
|
330
|
-
var local_classpath = "";
|
331
|
-
get_local_classpath();
|
332
|
-
|
333
|
-
// Show script help if requested
|
334
|
-
if (show_help) {
|
335
|
-
// fop_exec_args = "";
|
336
|
-
keep_open = true;
|
337
|
-
WScript.Echo(help_text);
|
338
|
-
}
|
339
|
-
|
340
|
-
// fop_exec();
|
341
|
-
fop_run();
|
1
|
+
// Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
// contributor license agreements. See the NOTICE file distributed with
|
3
|
+
// this work for additional information regarding copyright ownership.
|
4
|
+
// The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
// (the "License"); you may not use this file except in compliance with
|
6
|
+
// the License. You may obtain a copy of the License at
|
7
|
+
//
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
//
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
// See the License for the specific language governing permissions and
|
14
|
+
// limitations under the License.
|
15
|
+
// $Id: fop.js 1734671 2016-03-12 05:39:53Z gadams $ -->
|
16
|
+
|
17
|
+
// jscript to run FOP, adapted from the Jakarta-Ant project.
|
18
|
+
|
19
|
+
// rpm_mode is irrelevant on Windows
|
20
|
+
// var rpm_mode=true;
|
21
|
+
var fop_exec_args = "";
|
22
|
+
var no_config=false;
|
23
|
+
var fop_exec_debug=false;
|
24
|
+
var debug=false;
|
25
|
+
var keep_open=false;
|
26
|
+
var show_help=false;
|
27
|
+
|
28
|
+
var config_wanted = new Array("FOP_HOME", "CLASSPATH", "FOP_HYPHENATION_PATH", "FOP_OPTS", "JAVA_OPTS", "LOGCHOICE", "LOGLEVEL");
|
29
|
+
|
30
|
+
// parse command-line arguments
|
31
|
+
function read_args() {
|
32
|
+
var args = WScript.Arguments;
|
33
|
+
var named = new ActiveXObject("Scripting.Dictionary");
|
34
|
+
for (i = 0; i < args.length; i++) {
|
35
|
+
switch(args(i)) {
|
36
|
+
case "--debug":
|
37
|
+
debug=true;
|
38
|
+
break;
|
39
|
+
case "--execdebug":
|
40
|
+
fop_exec_debug=true;
|
41
|
+
break;
|
42
|
+
case "--keepopen":
|
43
|
+
keep_open=true;
|
44
|
+
break;
|
45
|
+
case "--noconfig":
|
46
|
+
no_config=true;
|
47
|
+
break;
|
48
|
+
case "-h":
|
49
|
+
case "--help":
|
50
|
+
case "--h":
|
51
|
+
case "-help":
|
52
|
+
show_help=true;
|
53
|
+
// fop_exec_args=fop_exec_args + " -h";
|
54
|
+
break;
|
55
|
+
default:
|
56
|
+
fop_exec_args=fop_exec_args + " " + args(i);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
if (debug) {
|
60
|
+
WScript.Echo("debug: " + debug);
|
61
|
+
WScript.Echo("execdebug: " + fop_exec_debug);
|
62
|
+
WScript.Echo("keepopen: " + keep_open);
|
63
|
+
WScript.Echo("noconfig: " + no_config);
|
64
|
+
WScript.Echo("help: " + show_help);
|
65
|
+
WScript.Echo("fop arguments: " + fop_exec_args);
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
var help_text="Usage:\n"
|
70
|
+
+ WScript.ScriptFullName + " [script options] [FOP options]\n"
|
71
|
+
+ "Script Options:\n"
|
72
|
+
+ " --help, -h print this message and FOP help\n"
|
73
|
+
+ " --debug print debugging information for this launch script\n"
|
74
|
+
+ " --execdebug print FOP exec line generated by this launch script\n"
|
75
|
+
+ " --keepopen keep FOP's command window open\n"
|
76
|
+
+ " --noconfig suppress reading of configuration file and registry";
|
77
|
+
|
78
|
+
function read_environment() {
|
79
|
+
for (i in config_wanted) {
|
80
|
+
if (!config.Exists(config_wanted[i])) {
|
81
|
+
var env_var_string = "%" + config_wanted[i] + "%";
|
82
|
+
var env_var = shell.ExpandEnvironmentStrings(env_var_string);
|
83
|
+
if (env_var != "" && env_var != env_var_string) {
|
84
|
+
config.Add(config_wanted[i], env_var);
|
85
|
+
if (debug) {
|
86
|
+
WScript.Echo(config_wanted[i] + " env: "
|
87
|
+
+ config.Item(config_wanted[i]));
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
function read_desktop(dtname) {
|
95
|
+
if (fs.FolderExists(dtname)) {
|
96
|
+
var fopname = fs.GetFolder(dtname).ParentFolder.Path
|
97
|
+
+ "\\Application Data\\Fop";
|
98
|
+
if (fs.FolderExists(fopname)) {
|
99
|
+
var fop_conf_name = fs.GetFolder(fopname).Path + "\\fop.conf";
|
100
|
+
if (fs.FileExists(fop_conf_name)) {
|
101
|
+
// source fop_conf_file
|
102
|
+
var conf_file = fs.openTextFile(fs.GetFile(fop_conf_name));
|
103
|
+
var conf_lines = new ActiveXObject("Scripting.Dictionary");
|
104
|
+
while (!conf_file.AtEndOfStream) {
|
105
|
+
var line = conf_file.ReadLine();
|
106
|
+
var m = line.match(/(.+?)=(.+)/);
|
107
|
+
if (m != null) {
|
108
|
+
conf_lines.Add(m[1], m[2]);
|
109
|
+
}
|
110
|
+
}
|
111
|
+
for (j in config_wanted) {
|
112
|
+
if (!config.Exists(config_wanted[j])
|
113
|
+
&& conf_lines.Exists(config_wanted[j])) {
|
114
|
+
config.Add(config_wanted[j], conf_lines.Item(config_wanted[j]));
|
115
|
+
if (debug) {
|
116
|
+
WScript.Echo(config_wanted[j] + " " + dts[i] + ": "
|
117
|
+
+ config.Item(config_wanted[i]));
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
function read_registry(section) {
|
127
|
+
for (j in config_wanted) {
|
128
|
+
if (!config.Exists(config_wanted[j])) {
|
129
|
+
var reg_var;
|
130
|
+
try {
|
131
|
+
reg_var = shell.RegRead(section + "\\Software\\Fop\\"
|
132
|
+
+ config_wanted[j]);
|
133
|
+
config.Add(config_wanted[j], reg_var);
|
134
|
+
if (debug) {
|
135
|
+
WScript.Echo(config_wanted[j] + " " + rks[i] + ": "
|
136
|
+
+ config.Item(config_wanted[j]));
|
137
|
+
}
|
138
|
+
} catch(e) {}
|
139
|
+
}
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
143
|
+
// construct FOP_HOME from the script folder
|
144
|
+
function get_fop_home() {
|
145
|
+
if (!config.Exists("FOP_HOME")
|
146
|
+
|| !fs.FolderExists(config.Item("FOP_HOME"))) {
|
147
|
+
var fop_home = WScript.ScriptFullName;
|
148
|
+
fop_home = fop_home.substring(0, fop_home.length
|
149
|
+
- WScript.ScriptName.length - 1);
|
150
|
+
if (config.Exists("FOP_HOME")) {
|
151
|
+
config.Remove("FOP_HOME");
|
152
|
+
}
|
153
|
+
config.Add("FOP_HOME", fop_home);
|
154
|
+
if (debug) {
|
155
|
+
WScript.Echo("FOP_HOME dyn: " + config.Item("FOP_HOME"));
|
156
|
+
}
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
function get_java_cmd() {
|
161
|
+
var java_home = shell.ExpandEnvironmentStrings("%JAVA_HOME%");
|
162
|
+
javacmd = "java";
|
163
|
+
if (java_home != "" && typeof(java_home) != "undefined"
|
164
|
+
&& fs.FolderExists(java_home)) {
|
165
|
+
var javacmd_candidate = java_home + "\\bin\\java.exe";
|
166
|
+
if (fs.FileExists(javacmd_candidate)) {
|
167
|
+
javacmd = javacmd_candidate;
|
168
|
+
}
|
169
|
+
}
|
170
|
+
if (debug) {
|
171
|
+
WScript.Echo("java command: " + javacmd);
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
function get_local_classpath() {
|
176
|
+
if (config.Exists("CLASSPATH")) {
|
177
|
+
local_classpath = config.Item("CLASSPATH");
|
178
|
+
if (debug) {
|
179
|
+
WScript.Echo("local classpath: " + local_classpath);
|
180
|
+
}
|
181
|
+
}
|
182
|
+
|
183
|
+
// add fop.jar, fop-sandbox and fop-hyph.jar, which reside in $FOP_HOME/build
|
184
|
+
var lcp = local_classpath;
|
185
|
+
local_classpath = config.Item("FOP_HOME") + "\\build\\fop.jar;"
|
186
|
+
+ config.Item("FOP_HOME") + "\\build\\fop-sandbox.jar;"
|
187
|
+
+ config.Item("FOP_HOME") + "\\build\\fop-hyph.jar";
|
188
|
+
if (lcp != "") {
|
189
|
+
local_classpath += ";" + lcp;
|
190
|
+
}
|
191
|
+
if (debug) {
|
192
|
+
WScript.Echo("local classpath: " + local_classpath);
|
193
|
+
}
|
194
|
+
|
195
|
+
// add in the dependency .jar files, which reside in $FOP_HOME/lib
|
196
|
+
var libdir_name = config.Item("FOP_HOME") + "\\lib";
|
197
|
+
var dirlibs;
|
198
|
+
if (fs.FolderExists(libdir_name)) {
|
199
|
+
dirlibs = fs.GetFolder(libdir_name).Files;
|
200
|
+
var e = new Enumerator(dirlibs);
|
201
|
+
for (; !e.atEnd(); e.moveNext()) {
|
202
|
+
if (e.item().Name.match("\.jar$")) {
|
203
|
+
local_classpath = libdir_name + "\\" + e.item().Name + ";" + local_classpath;
|
204
|
+
}
|
205
|
+
}
|
206
|
+
if (debug) {
|
207
|
+
WScript.Echo("local classpath: " + local_classpath);
|
208
|
+
}
|
209
|
+
}
|
210
|
+
|
211
|
+
// add in user-defined hyphenation JARs
|
212
|
+
if (config.Exists("FOP_HYPHENATION_PATH")) {
|
213
|
+
local_classpath += ";" + config.Item("FOP_HYPHENATION_PATH");
|
214
|
+
if (debug) {
|
215
|
+
WScript.Echo("local classpath: " + local_classpath);
|
216
|
+
}
|
217
|
+
}
|
218
|
+
}
|
219
|
+
|
220
|
+
// Execute fop via shell.Exec
|
221
|
+
function fop_exec() {
|
222
|
+
var fop_exec_command = "\"" + javacmd + "\" "
|
223
|
+
+ (config.Exists("JAVA_OPTS")?config.Item("JAVA_OPTS") + " ":"")
|
224
|
+
+ (config.Exists("LOGCHOICE")?config.Item("LOGCHOICE") + " ":"")
|
225
|
+
+ (config.Exists("LOGLEVEL")?config.Item("LOGLEVEL") + " ":"")
|
226
|
+
+ "-classpath \"" + local_classpath + "\" "
|
227
|
+
+ (config.Exists("FOP_OPTS")?config.Item("FOP_OPTS"):"")
|
228
|
+
+ "org.apache.fop.cli.Main " + fop_exec_args;
|
229
|
+
if (debug || fop_exec_debug) {
|
230
|
+
WScript.Echo(fop_exec_command);
|
231
|
+
}
|
232
|
+
|
233
|
+
var fop_run = shell.Exec(fop_exec_command);
|
234
|
+
while (true) {
|
235
|
+
while (!fop_run.StdOut.AtEndOfStream) {
|
236
|
+
WScript.Echo(fop_run.StdOut.ReadLine());
|
237
|
+
}
|
238
|
+
while (!fop_run.StdErr.AtEndOfStream) {
|
239
|
+
WScript.Echo(fop_run.StdErr.ReadLine());
|
240
|
+
}
|
241
|
+
if (fop_run.Status == 1) {
|
242
|
+
break;
|
243
|
+
}
|
244
|
+
WScript.Sleep(100);
|
245
|
+
}
|
246
|
+
if (debug) {
|
247
|
+
WScript.Echo("exit status: " + fop_run.ExitCode);
|
248
|
+
}
|
249
|
+
}
|
250
|
+
|
251
|
+
// Execute fop via shell.Run
|
252
|
+
function fop_run() {
|
253
|
+
var fop_exec_command = "cmd /" + (keep_open?"K":"C") + " \""
|
254
|
+
+ "\"" + javacmd + "\" "
|
255
|
+
+ (config.Exists("JAVA_OPTS")?config.Item("JAVA_OPTS") + " ":"")
|
256
|
+
+ (config.Exists("LOGCHOICE")?config.Item("LOGCHOICE") + " ":"")
|
257
|
+
+ (config.Exists("LOGLEVEL")?config.Item("LOGLEVEL") + " ":"")
|
258
|
+
+ "-classpath \"" + local_classpath + "\" "
|
259
|
+
+ (config.Exists("FOP_OPTS")?config.Item("FOP_OPTS") + " ":"")
|
260
|
+
+ "org.apache.fop.cli.Main " + fop_exec_args + "\"";
|
261
|
+
if (debug || fop_exec_debug) {
|
262
|
+
WScript.Echo(fop_exec_command);
|
263
|
+
}
|
264
|
+
var exit_code = shell.Run(fop_exec_command, 1, 1);
|
265
|
+
if (debug) {
|
266
|
+
WScript.Echo("exit status: " + exit_code);
|
267
|
+
} else {
|
268
|
+
if (exit_code != 0) {
|
269
|
+
WScript.Echo("A FOP error occurred (FOP exit status: " + exit_code + ")\n"
|
270
|
+
+ "Use option --keepopen to see FOP's output\n"
|
271
|
+
+ "(that is two dashes)");
|
272
|
+
}
|
273
|
+
}
|
274
|
+
}
|
275
|
+
|
276
|
+
function get_log_choice() {
|
277
|
+
// The default commons logger for JDK1.4 is JDK1.4Logger.
|
278
|
+
// To use a different logger, uncomment the one desired below
|
279
|
+
if (!config.Exists("LOGCHOICE")) {
|
280
|
+
// config.Add("LOGCHOICE","\"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog\"");
|
281
|
+
// config.Add("LOGCHOICE","\"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog\"");
|
282
|
+
// config.Add("LOGCHOICE","\"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger\"");
|
283
|
+
if (debug && config.Exists("LOGCHOICE")) {
|
284
|
+
WScript.Echo("LOGCHOICE script: " + config.Item("LOGCHOICE"));
|
285
|
+
}
|
286
|
+
}
|
287
|
+
}
|
288
|
+
|
289
|
+
function get_log_level() {
|
290
|
+
// Logging levels
|
291
|
+
// Below option is only if you are using SimpleLog instead of the default JDK1.4 Logger.
|
292
|
+
// To set logging levels for JDK 1.4 Logger, edit the %JAVA_HOME%/JRE/LIB/logging.properties
|
293
|
+
// file instead.
|
294
|
+
// Possible SimpleLog values: "trace", "debug", "info" (default), "warn", "error", or "fatal".
|
295
|
+
if (!config.Exists("LOGLEVEL")) {
|
296
|
+
// config.Add("LOGLEVEL","\"-Dorg.apache.commons.logging.simplelog.defaultlog=INFO\"");
|
297
|
+
if (debug && config.Exists("LOGLEVEL")) {
|
298
|
+
WScript.Echo("LOGLEVEL script: " + config.Item("LOGLEVEL"));
|
299
|
+
}
|
300
|
+
}
|
301
|
+
}
|
302
|
+
|
303
|
+
var shell = WScript.CreateObject("WScript.Shell");
|
304
|
+
var fs = WScript.CreateObject("Scripting.FileSystemObject");
|
305
|
+
|
306
|
+
// configuration
|
307
|
+
var config = new ActiveXObject("Scripting.Dictionary");
|
308
|
+
|
309
|
+
read_args();
|
310
|
+
read_environment();
|
311
|
+
if (!no_config) {
|
312
|
+
// read user and system-wide fop configurations
|
313
|
+
var spec = shell.SpecialFolders;
|
314
|
+
var dts = new Array("Desktop", "AllUsersDesktop");
|
315
|
+
for (i in dts) {
|
316
|
+
read_desktop(spec(dts[i]));
|
317
|
+
}
|
318
|
+
// read user and system-wide registry
|
319
|
+
var rks = new Array("HKCU", "HKLM");
|
320
|
+
for (i in rks) {
|
321
|
+
read_registry(rks[i]);
|
322
|
+
}
|
323
|
+
}
|
324
|
+
|
325
|
+
get_fop_home();
|
326
|
+
get_log_choice();
|
327
|
+
get_log_level();
|
328
|
+
var javacmd = "";
|
329
|
+
get_java_cmd();
|
330
|
+
var local_classpath = "";
|
331
|
+
get_local_classpath();
|
332
|
+
|
333
|
+
// Show script help if requested
|
334
|
+
if (show_help) {
|
335
|
+
// fop_exec_args = "";
|
336
|
+
keep_open = true;
|
337
|
+
WScript.Echo(help_text);
|
338
|
+
}
|
339
|
+
|
340
|
+
// fop_exec();
|
341
|
+
fop_run();
|