Skip to content

Commit

Permalink
Merge pull request #16 from BiBiServ/development
Browse files Browse the repository at this point in the history
pre release 2.1.0.alpha.1
  • Loading branch information
pbelmann authored Nov 18, 2016
2 parents 454e72b + 6817a55 commit 355d382
Show file tree
Hide file tree
Showing 64 changed files with 7,691 additions and 51 deletions.
6 changes: 6 additions & 0 deletions bibimainapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@
<artifactId>uasparser</artifactId>
<version>0.6.2</version>
</dependency>

<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.2</version>
</dependency>



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,9 @@
*/
package de.unibi.techfak.bibiserv;

import de.unibi.techfak.bibiserv.cms.TenumParam;
import de.unibi.techfak.bibiserv.cms.TenumValue;
import de.unibi.techfak.bibiserv.cms.Tfunction;
import de.unibi.techfak.bibiserv.cms.TinputOutput;
import de.unibi.techfak.bibiserv.cms.Tparam;
import de.unibi.techfak.bibiserv.cms.*;
import de.unibi.techfak.bibiserv.cms.Tparam.Max;
import de.unibi.techfak.bibiserv.cms.Tparam.Min;
import de.unibi.techfak.bibiserv.cms.TparamGroup;
import de.unibi.techfak.bibiserv.cms.TrunnableItem;
import de.unibi.techfak.bibiserv.debug.DDataSource;
import de.unibi.techfak.bibiserv.exception.BiBiToolsException;
import de.unibi.techfak.bibiserv.exception.DBConnectionException;
Expand Down Expand Up @@ -932,8 +926,8 @@ public File getTmpDir() throws FileNotFoundException {
*
* @return
*/
public Element getToolDescription() {
return (Element) runnableitem;
public TrunnableItem getToolDescription() {
return runnableitem;
}

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

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

File test = new File(cmdline.toString());
if (testexec && !(test.exists() && test.isFile() && test.canExecute())) {
Expand Down Expand Up @@ -2949,35 +2943,31 @@ private TinputOutput search_for_input(String id) {
*/
private String getExecCmd() {
StringBuffer cmdbuf = new StringBuffer();
if (getProperty("UseDocker") == null || !getProperty("UseDocker").equalsIgnoreCase("true")) {
if (getProperty("executable.rootpath") != null) {
cmdbuf.append(getProperty("executable.rootpath"));
if (!endWithFileSeparator(cmdbuf)) {
cmdbuf.append(this.separator);
}
if (getProperty("executable.path.isrelativ").equalsIgnoreCase("true")) {
cmdbuf.append(runnableitem.getExecutable().getExecInfo().getPath());
if (!endWithFileSeparator(cmdbuf)) {
cmdbuf.append(this.separator);
}
}
} else {

Texecutable executable = getToolDescription().getExecutable();
boolean isDocker = getToolDescription().getExecutable().getExecInfo().getExecutableType().equalsIgnoreCase("docker");
if (getProperty("executable.rootpath") != null && !isDocker) {
cmdbuf.append(getProperty("executable.rootpath"));
if (!endWithFileSeparator(cmdbuf)) {
cmdbuf.append(this.separator);
}
if (getProperty("executable.path.isrelativ").equalsIgnoreCase("true")) {
cmdbuf.append(runnableitem.getExecutable().getExecInfo().getPath());
if (!endWithFileSeparator(cmdbuf)) {
cmdbuf.append(this.separator);
}
}
} else {
String orga = getProperty("DockerHubOrganization");
if (orga != null) {
cmdbuf.append("docker run ");
cmdbuf.append(" --rm=true");
cmdbuf.append(" -v ").append(getProperty("spooldir.base")).append(":").append(getProperty("spooldir.base"));
cmdbuf.append(" ").append(orga).append("/").append(runnableitem.getId());
cmdbuf.append(" /usr/local/bin/");
} else {
cmdbuf.append("# BiBiTool.properties doesn't contain a property named 'DockerHubOrganization'!");
cmdbuf.append("docker ");
cmdbuf.append("run ");
cmdbuf.append("--entrypoint='" + runnableitem.getExecutable().getExecInfo().getPath() + "' ");
try {
cmdbuf.append("-v ");
cmdbuf.append(getSpoolDir().toString() + ":" + getSpoolDir().toString() + ":rw ");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
cmdbuf.append(executable.getExecInfo().getImage() + " ");
}
cmdbuf.append(runnableitem.getExecutable().getExecInfo().getCallingInformation());
return cmdbuf.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import de.unibi.techfak.bibiserv.exception.IdNotFoundException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
Expand All @@ -39,7 +38,6 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.logging.Level;
import org.apache.log4j.Logger;
import org.json.*;

Expand Down Expand Up @@ -77,7 +75,16 @@ public JobProxyCall() {
*/
public JobProxyCall(BiBiTools wsstools) {
this(wsstools, wsstools.getStatus());
// get servr JobProxyServer from
setUri(wsstools);
}

@Override
public void setBiBiTools(BiBiTools bibitools) {
super.setBiBiTools(bibitools);
setUri(bibitools);
}

private void setUri(BiBiTools biBiTools){
try {
uri = new URI(wsstools.getProperty("JobProxyServer.URI", "http://localhost:9999/"));
} catch (URISyntaxException e) {
Expand All @@ -88,7 +95,6 @@ public JobProxyCall(BiBiTools wsstools) {
// should not occure
}
}

}

public JobProxyCall(BiBiTools submitted_wsstools, Status submitted_status) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

import de.unibi.techfak.bibiserv.exception.DBConnectionException;
import java.io.File;
import java.io.FileInputStream;

/**
* Implements the Call interface executing a program directly on the local
Expand Down
29 changes: 29 additions & 0 deletions libs/dependencyparser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#Dependency Parser

A parser written in JavaCC 4.0+ for describing dependencies if bibiserv application function.


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.

A dependency can only contain parameters that are actually defined in the function. References to parameters are set using the id of the parameter.

The definition below describes all possible interactions using standard BNF notation:

```
<Function> ::= <AND> | <OR> | <XOR>| <NOT> | <IMPL> | <LOGEQ> | def(<id>) | <EQUALS> | <GREATER> | <GREATEREQUALS> | <LESSER> | <LESSEREQUALS>
<AND> ::= and(<Function>,<Function>) // conjunction
<OR> ::= or(<Function>,<Function>) // disjunction
<XOR> ::= xor(<Function>,<Function>) // exclusive disjunction
<NOT> ::= not(<Function>) // denial
<IMPL> ::= impl(<Function>,<Function>) // implication
<LOGEQ> ::= logeq(<Function>,<Function>) // equivalence
<EQUALS> ::= eq(<id>,<id> | <value>)
<GREATER> ::= gt(<id>,<id> |<value>)
<GREATEREQUALS>::= ge(<id>,<id> |<value>)
<LESSER> ::= lt(<id>,<id> |<value>)
<LESSEREQUALS> ::= le(<id>,<id> |<value>)
<id> ::= @[A-Z,a-z,0-9]+
<value> ::= [0-9]+[.]?[0-9]*|[A-Z,a-z,0-9,...]
```

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.
30 changes: 30 additions & 0 deletions libs/dependencyparser/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Dependency Parser

Der Dependency Parser ist ein in JavaCC 4.0 geschriebener Parser um Abhaengigkeiten zwischen
Parameter bzw. Parametergruppen beschreiben zu koennen. Eine Beschreibung zu dem Parser
bzw. der BNF findet sich im Wiki unter :

http://wiki.techfak.uni-bielefeld.de/bibiserv/BiBiServ_V2_XMLSServerDescription

Vorraussetzungen :

Java 1.5 oder neuer
JavaCC 4 oder neuer
Netbeans 6.x oder neuer fuer das TreeBeispiel
Xerces im Pfad fuer das Commandline Beispiel

Dateien im Repository:

DependencyParser.jj - DependencyParser in JacaCC 4.0 Syntax
build.xml - zentrales Build um aus dem .jj File den Parser zu bauen
- unterstuetzte Targets:
package (default) compiliert und erzeugt ein Jar File im dist ordner
compile compiliert den Parser (javacc und javac)
clean loescht die generierten Sourcen und Klassen
clean_dist loescht alles (clean + pakcage distribution)
run (ruft compile auf) startet einen builtin CMDLine Client auf den Beispiel
Daten (unter sample)
sample - enthaelt zwei Beispieldateien fuer den CMDline Client und ein NetbeansProjekt
(Netbeans >= 6.x)

(jkrueger@techfak.uni-bielefeld.de)
176 changes: 176 additions & 0 deletions libs/dependencyparser/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
<?xml version="1.0" encoding="UTF-8"?>

<project name="javacc_dependcy_parser" default="package" xmlns:ivy="antlib:org.apache.ivy.ant">



<!-- define some properties to -->
<property name="build.dir" value="build"/>
<property name="test.dir" value="build.test"/>
<property name="dist.dir" value="dist"/>
<property name="javacc.home" value="/vol/java/share/javacc"/>
<property name="package" value="de.unibi.techfak.bibiserv.util.dependencyparser.javacc"/>
<property name="package.dir" value="de/unibi/techfak/bibiserv/util/dependencyparser/javacc"/>
<property name="src.dir" value="src"/>
<property name="gen.src.dir" value="gen.src"/>
<property name="test.src.dir" value="test"/>
<property name="lib.dir" value="lib"/>




<!-- getting access to environment vars -->
<property environment="env"/>

<!-- ################################
# check some conditions before #
################################ -->
<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"/>

<!-- include ant-contrib tasks -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>



<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->

<!-- load ivy-settings -->
<!-- set ivy.settings.file property -->
<if>
<http url="http://bibiserv.techfak.uni-bielefeld.de/ivy-rep/ivysettings.xml" errorsbeginat="300"/>
<then>
<echo>Loading Ivy Settings from BiBiServ ... </echo>
<ivy:settings url="http://bibiserv.techfak.uni-bielefeld.de/ivy-rep/ivysettings.xml"/>
</then>
<else>
<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>
<ivy:settings file="${user.home}/ivy-rep/ivysettings.xml"/>
</else>
</if>

<!-- use ivy to resolve library dependencies -->
<target name="resolve" description="retrieve dependencies with ivy">
<ivy:retrieve/>
</target>

<!-- publish current project in private ivy-repository -->
<target name="publish" depends="package,resolve,_mercurial" description="publish package as modul on local ivy repository">
<ivy:publish resolver="private" validate="false" overwrite="true" artifactspattern="dist/[artifact].[ext]" pubrevision="${HG.TAG}_${HG.REVISION}"/>
</target>


<!-- install package from local ivy-repository on the server -->
<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!">

<!-- create local ivy-rep as install base -->
<mkdir dir="ivy-rep"/>
<ivy:publish resolver="local" validate="false" overwrite="true" artifactspattern="dist/[artifact].[ext]" pubrevision="${HG.TAG}_${HG.REVISION}"/>

<!-- load ssh specify setting from bibiserv -->
<property url="http://bibiserv.techfak.uni-bielefeld.de/ivy-rep/ivy_ssh.properties"/>

<!-- check if ${ssh.key} and ${ssh.user} is set -->
<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!"/>
<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!"/>


<!-- copy local ivy-rep to bibiserv using porta.techfak.uni-bielefeld.de -->
<scp todir="${ssh.user}@${ssh.host}:${ssh.basedir}/ivy-rep" passphrase="${ssh.passphrase}" keyfile="${ssh.key}">
<fileset dir="ivy-rep"/>
</scp>

<!-- change file AND directory permission on remote sevrver -->
<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 "/>
</target>

<!-- target, for internal use only -->
<target name="_mercurial" description="get the latest tag name and revision number">


<exec executable="bash" outputproperty="HG.TAG">
<arg line = "-c "/>
<arg value = "hg log | grep tag: | head -n 2 | grep -v tip | cut -f 2 -d ':' | sed -e 's/^ *//' "/>
</exec>
<exec executable="bash" outputproperty="HG.REVISION">
<arg line = "-c "/>
<arg value = "LANG=en_US hg tip | grep changeset: | cut -f 2 -d ':' | sed -e 's/^ *//' "/>
</exec>

</target>

<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->


<target name="clean" description="clean ">
<delete dir="${gen.src.dir}"/>
<delete dir="${build.dir}"/>
<delete dir="${test.dir}"/>
<delete dir="${dist.dir}"/>
</target>

<target name="clean_dist" depends="clean" description="clean everything">
<delete dir="${dist.dir}"/>
<delete dir="ivy-rep"/>
</target>

<target name="mkdir">
<mkdir dir="${gen.src.dir}/${package.dir}"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${test.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>



<target name="javacc" depends="mkdir" description="generate parser (and interpreter) using javacc">

<javacc target="DependencyParser.jj" outputdirectory="${gen.src.dir}/${package.dir}" javacchome="${env.JAVACC_HOME}"/>
<!-- Since JavaCC does not support packages (generate Java files in specify package) or I don't
understand how to do that, the following replaceregexp task add one(!) import line in front of
each generated Java File -->
<replaceregexp>
<regexp pattern="^(package ${package};${line.separator})?(.)"/>
<substitution expression="package ${package};${line.separator}\2"/>
<fileset dir="${gen.src.dir}/${package.dir}">
<include name="**/*.java"/>
</fileset>
</replaceregexp>
</target>

<target name="compile" depends="javacc,resolve">
<javac destdir="build" debug="true" debuglevel="lines,vars,source">
<src path="${gen.src.dir}"/>
<src path="${src.dir}"/>
<classpath>
<fileset dir="${lib.dir}"/>
</classpath>
</javac>
</target>

<target name="compile_test" depends="compile">
<javac classpath="${build.dir}" srcdir="${test.src.dir}" destdir="${test.dir}"/>
</target>

<target name="test" depends="compile_test">
<junit haltonerror="true" haltonfailure="false">
<classpath>
<fileset dir="${test.dir}"/>
<fileset dir="${test.src.dir}"/>
<fileset dir="${build.dir}"/>
<fileset dir="${lib.dir}"/>
</classpath>
</junit>

</target>

<target name="package" depends="compile" description="generates a Jar package">
<!-- pack all classes -->
<jar destfile="${dist.dir}/DependencyParser.jar" basedir="${build.dir}" includes="**/*.class"/>


</target>




</project>
Loading

0 comments on commit 355d382

Please sign in to comment.