Skip to content

Commit 355d382

Browse files
authored
Merge pull request #16 from BiBiServ/development
pre release 2.1.0.alpha.1
2 parents 454e72b + 6817a55 commit 355d382

File tree

64 files changed

+7691
-51
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+7691
-51
lines changed

bibimainapp/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@
117117
<artifactId>uasparser</artifactId>
118118
<version>0.6.2</version>
119119
</dependency>
120+
121+
<dependency>
122+
<groupId>commons-fileupload</groupId>
123+
<artifactId>commons-fileupload</artifactId>
124+
<version>1.2.2</version>
125+
</dependency>
120126

121127

122128

libs/bibitools/src/main/java/de/unibi/techfak/bibiserv/BiBiTools.java

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,9 @@
2222
*/
2323
package de.unibi.techfak.bibiserv;
2424

25-
import de.unibi.techfak.bibiserv.cms.TenumParam;
26-
import de.unibi.techfak.bibiserv.cms.TenumValue;
27-
import de.unibi.techfak.bibiserv.cms.Tfunction;
28-
import de.unibi.techfak.bibiserv.cms.TinputOutput;
29-
import de.unibi.techfak.bibiserv.cms.Tparam;
25+
import de.unibi.techfak.bibiserv.cms.*;
3026
import de.unibi.techfak.bibiserv.cms.Tparam.Max;
3127
import de.unibi.techfak.bibiserv.cms.Tparam.Min;
32-
import de.unibi.techfak.bibiserv.cms.TparamGroup;
33-
import de.unibi.techfak.bibiserv.cms.TrunnableItem;
3428
import de.unibi.techfak.bibiserv.debug.DDataSource;
3529
import de.unibi.techfak.bibiserv.exception.BiBiToolsException;
3630
import de.unibi.techfak.bibiserv.exception.DBConnectionException;
@@ -932,8 +926,8 @@ public File getTmpDir() throws FileNotFoundException {
932926
*
933927
* @return
934928
*/
935-
public Element getToolDescription() {
936-
return (Element) runnableitem;
929+
public TrunnableItem getToolDescription() {
930+
return runnableitem;
937931
}
938932

939933
/**
@@ -2285,7 +2279,7 @@ public String generateCmdLineString(String id, Map<String, String> hash, String
22852279
StringBuffer cmdline = new StringBuffer(getExecCmd());
22862280

22872281
// test if cmdline describe a valid executable (only if 'UseDocker' is unset)
2288-
if (getProperty("UseDocker") == null || !getProperty("UseDocker").equalsIgnoreCase("true")) {
2282+
if (!getToolDescription().getExecutable().getExecInfo().getExecutableType().equalsIgnoreCase("docker")) {
22892283

22902284
File test = new File(cmdline.toString());
22912285
if (testexec && !(test.exists() && test.isFile() && test.canExecute())) {
@@ -2949,35 +2943,31 @@ private TinputOutput search_for_input(String id) {
29492943
*/
29502944
private String getExecCmd() {
29512945
StringBuffer cmdbuf = new StringBuffer();
2952-
if (getProperty("UseDocker") == null || !getProperty("UseDocker").equalsIgnoreCase("true")) {
2953-
if (getProperty("executable.rootpath") != null) {
2954-
cmdbuf.append(getProperty("executable.rootpath"));
2955-
if (!endWithFileSeparator(cmdbuf)) {
2956-
cmdbuf.append(this.separator);
2957-
}
2958-
if (getProperty("executable.path.isrelativ").equalsIgnoreCase("true")) {
2959-
cmdbuf.append(runnableitem.getExecutable().getExecInfo().getPath());
2960-
if (!endWithFileSeparator(cmdbuf)) {
2961-
cmdbuf.append(this.separator);
2962-
}
2963-
}
2964-
} else {
2946+
2947+
Texecutable executable = getToolDescription().getExecutable();
2948+
boolean isDocker = getToolDescription().getExecutable().getExecInfo().getExecutableType().equalsIgnoreCase("docker");
2949+
if (getProperty("executable.rootpath") != null && !isDocker) {
2950+
cmdbuf.append(getProperty("executable.rootpath"));
2951+
if (!endWithFileSeparator(cmdbuf)) {
2952+
cmdbuf.append(this.separator);
2953+
}
2954+
if (getProperty("executable.path.isrelativ").equalsIgnoreCase("true")) {
29652955
cmdbuf.append(runnableitem.getExecutable().getExecInfo().getPath());
29662956
if (!endWithFileSeparator(cmdbuf)) {
29672957
cmdbuf.append(this.separator);
29682958
}
29692959
}
29702960
} else {
2971-
String orga = getProperty("DockerHubOrganization");
2972-
if (orga != null) {
2973-
cmdbuf.append("docker run ");
2974-
cmdbuf.append(" --rm=true");
2975-
cmdbuf.append(" -v ").append(getProperty("spooldir.base")).append(":").append(getProperty("spooldir.base"));
2976-
cmdbuf.append(" ").append(orga).append("/").append(runnableitem.getId());
2977-
cmdbuf.append(" /usr/local/bin/");
2978-
} else {
2979-
cmdbuf.append("# BiBiTool.properties doesn't contain a property named 'DockerHubOrganization'!");
2961+
cmdbuf.append("docker ");
2962+
cmdbuf.append("run ");
2963+
cmdbuf.append("--entrypoint='" + runnableitem.getExecutable().getExecInfo().getPath() + "' ");
2964+
try {
2965+
cmdbuf.append("-v ");
2966+
cmdbuf.append(getSpoolDir().toString() + ":" + getSpoolDir().toString() + ":rw ");
2967+
} catch (FileNotFoundException e) {
2968+
e.printStackTrace();
29802969
}
2970+
cmdbuf.append(executable.getExecInfo().getImage() + " ");
29812971
}
29822972
cmdbuf.append(runnableitem.getExecutable().getExecInfo().getCallingInformation());
29832973
return cmdbuf.toString();

libs/bibitools/src/main/java/de/unibi/techfak/bibiserv/impl/JobProxyCall.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import de.unibi.techfak.bibiserv.exception.IdNotFoundException;
3030
import java.io.File;
3131
import java.io.FileInputStream;
32-
import java.io.FileNotFoundException;
3332
import java.io.IOException;
3433
import java.io.InputStreamReader;
3534
import java.io.OutputStream;
@@ -39,7 +38,6 @@
3938
import java.net.URI;
4039
import java.net.URISyntaxException;
4140
import java.net.URL;
42-
import java.util.logging.Level;
4341
import org.apache.log4j.Logger;
4442
import org.json.*;
4543

@@ -77,7 +75,16 @@ public JobProxyCall() {
7775
*/
7876
public JobProxyCall(BiBiTools wsstools) {
7977
this(wsstools, wsstools.getStatus());
80-
// get servr JobProxyServer from
78+
setUri(wsstools);
79+
}
80+
81+
@Override
82+
public void setBiBiTools(BiBiTools bibitools) {
83+
super.setBiBiTools(bibitools);
84+
setUri(bibitools);
85+
}
86+
87+
private void setUri(BiBiTools biBiTools){
8188
try {
8289
uri = new URI(wsstools.getProperty("JobProxyServer.URI", "http://localhost:9999/"));
8390
} catch (URISyntaxException e) {
@@ -88,7 +95,6 @@ public JobProxyCall(BiBiTools wsstools) {
8895
// should not occure
8996
}
9097
}
91-
9298
}
9399

94100
public JobProxyCall(BiBiTools submitted_wsstools, Status submitted_status) {

libs/bibitools/src/main/java/de/unibi/techfak/bibiserv/impl/LocalCall.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
import de.unibi.techfak.bibiserv.exception.DBConnectionException;
3131
import java.io.File;
32-
import java.io.FileInputStream;
3332

3433
/**
3534
* Implements the Call interface executing a program directly on the local

libs/dependencyparser/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#Dependency Parser
2+
3+
A parser written in JavaCC 4.0+ for describing dependencies if bibiserv application function.
4+
5+
6+
In some cases not all parameters of a function are needed at the same time or, in other cases, some parameters are exclusive to each other. Via dependencies, restrictions to the defined parameters of a function can be made using standard logical operators.
7+
8+
A dependency can only contain parameters that are actually defined in the function. References to parameters are set using the id of the parameter.
9+
10+
The definition below describes all possible interactions using standard BNF notation:
11+
12+
```
13+
<Function> ::= <AND> | <OR> | <XOR>| <NOT> | <IMPL> | <LOGEQ> | def(<id>) | <EQUALS> | <GREATER> | <GREATEREQUALS> | <LESSER> | <LESSEREQUALS>
14+
<AND> ::= and(<Function>,<Function>) // conjunction
15+
<OR> ::= or(<Function>,<Function>) // disjunction
16+
<XOR> ::= xor(<Function>,<Function>) // exclusive disjunction
17+
<NOT> ::= not(<Function>) // denial
18+
<IMPL> ::= impl(<Function>,<Function>) // implication
19+
<LOGEQ> ::= logeq(<Function>,<Function>) // equivalence
20+
<EQUALS> ::= eq(<id>,<id> | <value>)
21+
<GREATER> ::= gt(<id>,<id> |<value>)
22+
<GREATEREQUALS>::= ge(<id>,<id> |<value>)
23+
<LESSER> ::= lt(<id>,<id> |<value>)
24+
<LESSEREQUALS> ::= le(<id>,<id> |<value>)
25+
<id> ::= @[A-Z,a-z,0-9]+
26+
<value> ::= [0-9]+[.]?[0-9]*|[A-Z,a-z,0-9,...]
27+
```
28+
29+
See also the [BiBiServ Wiki](https://wiki.cebitec.uni-bielefeld.de/bibiserv-1.25.2/index.php/Dependency_Language_Dev) which may contain some additional informations.

libs/dependencyparser/README.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Dependency Parser
2+
3+
Der Dependency Parser ist ein in JavaCC 4.0 geschriebener Parser um Abhaengigkeiten zwischen
4+
Parameter bzw. Parametergruppen beschreiben zu koennen. Eine Beschreibung zu dem Parser
5+
bzw. der BNF findet sich im Wiki unter :
6+
7+
http://wiki.techfak.uni-bielefeld.de/bibiserv/BiBiServ_V2_XMLSServerDescription
8+
9+
Vorraussetzungen :
10+
11+
Java 1.5 oder neuer
12+
JavaCC 4 oder neuer
13+
Netbeans 6.x oder neuer fuer das TreeBeispiel
14+
Xerces im Pfad fuer das Commandline Beispiel
15+
16+
Dateien im Repository:
17+
18+
DependencyParser.jj - DependencyParser in JacaCC 4.0 Syntax
19+
build.xml - zentrales Build um aus dem .jj File den Parser zu bauen
20+
- unterstuetzte Targets:
21+
package (default) compiliert und erzeugt ein Jar File im dist ordner
22+
compile compiliert den Parser (javacc und javac)
23+
clean loescht die generierten Sourcen und Klassen
24+
clean_dist loescht alles (clean + pakcage distribution)
25+
run (ruft compile auf) startet einen builtin CMDLine Client auf den Beispiel
26+
Daten (unter sample)
27+
sample - enthaelt zwei Beispieldateien fuer den CMDline Client und ein NetbeansProjekt
28+
(Netbeans >= 6.x)
29+
30+
(jkrueger@techfak.uni-bielefeld.de)

libs/dependencyparser/build.xml

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project name="javacc_dependcy_parser" default="package" xmlns:ivy="antlib:org.apache.ivy.ant">
4+
5+
6+
7+
<!-- define some properties to -->
8+
<property name="build.dir" value="build"/>
9+
<property name="test.dir" value="build.test"/>
10+
<property name="dist.dir" value="dist"/>
11+
<property name="javacc.home" value="/vol/java/share/javacc"/>
12+
<property name="package" value="de.unibi.techfak.bibiserv.util.dependencyparser.javacc"/>
13+
<property name="package.dir" value="de/unibi/techfak/bibiserv/util/dependencyparser/javacc"/>
14+
<property name="src.dir" value="src"/>
15+
<property name="gen.src.dir" value="gen.src"/>
16+
<property name="test.src.dir" value="test"/>
17+
<property name="lib.dir" value="lib"/>
18+
19+
20+
21+
22+
<!-- getting access to environment vars -->
23+
<property environment="env"/>
24+
25+
<!-- ################################
26+
# check some conditions before #
27+
################################ -->
28+
<fail message="The environment variable JAVACC_HOME is not set. Make sure that the JAVACC_HOME environment variable points to a JAVACC suite. Abbort ... " unless="env.JAVACC_HOME"/>
29+
30+
<!-- include ant-contrib tasks -->
31+
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
32+
33+
34+
35+
<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
36+
37+
<!-- load ivy-settings -->
38+
<!-- set ivy.settings.file property -->
39+
<if>
40+
<http url="http://bibiserv.techfak.uni-bielefeld.de/ivy-rep/ivysettings.xml" errorsbeginat="300"/>
41+
<then>
42+
<echo>Loading Ivy Settings from BiBiServ ... </echo>
43+
<ivy:settings url="http://bibiserv.techfak.uni-bielefeld.de/ivy-rep/ivysettings.xml"/>
44+
</then>
45+
<else>
46+
<echo>BiBiserv not available, load Ivy settings from ${user.home}/ivy-rep/ivy-settings.xml or if this file does not exist load default settings file</echo>
47+
<ivy:settings file="${user.home}/ivy-rep/ivysettings.xml"/>
48+
</else>
49+
</if>
50+
51+
<!-- use ivy to resolve library dependencies -->
52+
<target name="resolve" description="retrieve dependencies with ivy">
53+
<ivy:retrieve/>
54+
</target>
55+
56+
<!-- publish current project in private ivy-repository -->
57+
<target name="publish" depends="package,resolve,_mercurial" description="publish package as modul on local ivy repository">
58+
<ivy:publish resolver="private" validate="false" overwrite="true" artifactspattern="dist/[artifact].[ext]" pubrevision="${HG.TAG}_${HG.REVISION}"/>
59+
</target>
60+
61+
62+
<!-- install package from local ivy-repository on the server -->
63+
<target name="install" depends="package,_mercurial" description="install published package on bibiserv repository : ssh.user, ssh.key and ssh.passphrase(optional) must set as property!">
64+
65+
<!-- create local ivy-rep as install base -->
66+
<mkdir dir="ivy-rep"/>
67+
<ivy:publish resolver="local" validate="false" overwrite="true" artifactspattern="dist/[artifact].[ext]" pubrevision="${HG.TAG}_${HG.REVISION}"/>
68+
69+
<!-- load ssh specify setting from bibiserv -->
70+
<property url="http://bibiserv.techfak.uni-bielefeld.de/ivy-rep/ivy_ssh.properties"/>
71+
72+
<!-- check if ${ssh.key} and ${ssh.user} is set -->
73+
<fail unless="ssh.user" message="The Target &lt;install&gt; uses ssh key based authentication. Give the ssh user for ${ssh.host} as property 'ssh.user' as argument to the ant call!"/>
74+
<fail unless="ssh.key" message="The Target &lt;install&gt; uses ssh key based authentication. Give the location of your private key as property 'ssh.key' and optional a passphrase as property 'ssh.passphrase' as argument to the ant call!"/>
75+
76+
77+
<!-- copy local ivy-rep to bibiserv using porta.techfak.uni-bielefeld.de -->
78+
<scp todir="${ssh.user}@${ssh.host}:${ssh.basedir}/ivy-rep" passphrase="${ssh.passphrase}" keyfile="${ssh.key}">
79+
<fileset dir="ivy-rep"/>
80+
</scp>
81+
82+
<!-- change file AND directory permission on remote sevrver -->
83+
<sshexec host="${ssh.host}" username="${ssh.user}" keyfile="${ssh.key}" passphrase="${ssh.passphrase}" command="find -L ${ssh.basedir}/ivy-rep -type d -user ${ssh.user} | xargs chmod g+ws; find -L ${ssh.basedir}/ivy-rep -type f -user ${ssh.user} | xargs chmod g+w "/>
84+
</target>
85+
86+
<!-- target, for internal use only -->
87+
<target name="_mercurial" description="get the latest tag name and revision number">
88+
89+
90+
<exec executable="bash" outputproperty="HG.TAG">
91+
<arg line = "-c "/>
92+
<arg value = "hg log | grep tag: | head -n 2 | grep -v tip | cut -f 2 -d ':' | sed -e 's/^ *//' "/>
93+
</exec>
94+
<exec executable="bash" outputproperty="HG.REVISION">
95+
<arg line = "-c "/>
96+
<arg value = "LANG=en_US hg tip | grep changeset: | cut -f 2 -d ':' | sed -e 's/^ *//' "/>
97+
</exec>
98+
99+
</target>
100+
101+
<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
102+
103+
104+
<target name="clean" description="clean ">
105+
<delete dir="${gen.src.dir}"/>
106+
<delete dir="${build.dir}"/>
107+
<delete dir="${test.dir}"/>
108+
<delete dir="${dist.dir}"/>
109+
</target>
110+
111+
<target name="clean_dist" depends="clean" description="clean everything">
112+
<delete dir="${dist.dir}"/>
113+
<delete dir="ivy-rep"/>
114+
</target>
115+
116+
<target name="mkdir">
117+
<mkdir dir="${gen.src.dir}/${package.dir}"/>
118+
<mkdir dir="${build.dir}"/>
119+
<mkdir dir="${test.dir}"/>
120+
<mkdir dir="${dist.dir}"/>
121+
</target>
122+
123+
124+
125+
<target name="javacc" depends="mkdir" description="generate parser (and interpreter) using javacc">
126+
127+
<javacc target="DependencyParser.jj" outputdirectory="${gen.src.dir}/${package.dir}" javacchome="${env.JAVACC_HOME}"/>
128+
<!-- Since JavaCC does not support packages (generate Java files in specify package) or I don't
129+
understand how to do that, the following replaceregexp task add one(!) import line in front of
130+
each generated Java File -->
131+
<replaceregexp>
132+
<regexp pattern="^(package ${package};${line.separator})?(.)"/>
133+
<substitution expression="package ${package};${line.separator}\2"/>
134+
<fileset dir="${gen.src.dir}/${package.dir}">
135+
<include name="**/*.java"/>
136+
</fileset>
137+
</replaceregexp>
138+
</target>
139+
140+
<target name="compile" depends="javacc,resolve">
141+
<javac destdir="build" debug="true" debuglevel="lines,vars,source">
142+
<src path="${gen.src.dir}"/>
143+
<src path="${src.dir}"/>
144+
<classpath>
145+
<fileset dir="${lib.dir}"/>
146+
</classpath>
147+
</javac>
148+
</target>
149+
150+
<target name="compile_test" depends="compile">
151+
<javac classpath="${build.dir}" srcdir="${test.src.dir}" destdir="${test.dir}"/>
152+
</target>
153+
154+
<target name="test" depends="compile_test">
155+
<junit haltonerror="true" haltonfailure="false">
156+
<classpath>
157+
<fileset dir="${test.dir}"/>
158+
<fileset dir="${test.src.dir}"/>
159+
<fileset dir="${build.dir}"/>
160+
<fileset dir="${lib.dir}"/>
161+
</classpath>
162+
</junit>
163+
164+
</target>
165+
166+
<target name="package" depends="compile" description="generates a Jar package">
167+
<!-- pack all classes -->
168+
<jar destfile="${dist.dir}/DependencyParser.jar" basedir="${build.dir}" includes="**/*.class"/>
169+
170+
171+
</target>
172+
173+
174+
175+
176+
</project>

0 commit comments

Comments
 (0)