Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/tk/htmlvis'
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaskrause committed Apr 25, 2013
2 parents c424444 + 6113161 commit a828238
Show file tree
Hide file tree
Showing 47 changed files with 2,473 additions and 555 deletions.
9 changes: 4 additions & 5 deletions annis-gui/nb-configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
<spellchecker-wordlist xmlns="http://www.netbeans.org/ns/spellchecker-wordlist/1">
<word>plugin</word>
<word>Vaadin</word>
</spellchecker-wordlist>
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<!--
Properties that influence various parts of the IDE, especially code formatting and the like.
Expand Down Expand Up @@ -36,7 +40,6 @@
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>
<netbeans.compile.on.save>none</netbeans.compile.on.save>
<netbeans.hint.jdkPlatform>JDK_1.6</netbeans.hint.jdkPlatform>
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesAfterFields>1</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesAfterFields>
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.wrapMethodParams>WRAP_IF_LONG</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.wrapMethodParams>
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.wrapExtendsImplementsKeyword>WRAP_IF_LONG</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.wrapExtendsImplementsKeyword>
Expand All @@ -45,8 +48,4 @@
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.wrapMethodCallArgs>WRAP_IF_LONG</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.wrapMethodCallArgs>
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.wrapChainedMethodCalls>WRAP_IF_LONG</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.wrapChainedMethodCalls>
</properties>
<spellchecker-wordlist xmlns="http://www.netbeans.org/ns/spellchecker-wordlist/1">
<word>plugin</word>
<word>Vaadin</word>
</spellchecker-wordlist>
</project-shared-configuration>
2 changes: 2 additions & 0 deletions annis-gui/nbactions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<actions>
<action>
<actionName>run</actionName>
<preAction>build-with-dependencies</preAction>
<goals>
<goal>package</goal>
</goals>
Expand All @@ -12,6 +13,7 @@
</action>
<action>
<actionName>debug</actionName>
<preAction>build-with-dependencies</preAction>
<goals>
<goal>package</goal>
</goals>
Expand Down
7 changes: 3 additions & 4 deletions annis-gui/src/main/java/annis/gui/servlets/BinaryServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
* This Servlet provides binary-files with a stream of partial-content. The
* first GET-request is answered with the status-code 206 Partial Content.
*
* TODO: handle more than one byte-range TODO: split rmi-requests TODO: wrote
* tests TODO:
* TODO: handle more than one byte-range TODO:
*
* @author benjamin
*
Expand All @@ -55,7 +54,7 @@ public class BinaryServlet extends HttpServlet

private final static Logger log = LoggerFactory.getLogger(BinaryServlet.class);

private static final int MAX_LENGTH = 50*1024; // max portion which is transfered over REST at once
private static final int MAX_LENGTH = 5*1024; // max portion which is transfered over REST at once: 5MB

@Override
public void init(ServletConfig config) throws ServletException
Expand Down Expand Up @@ -231,7 +230,7 @@ private void writeStepByStep(int offset, int completeLength, WebResource binaryR
int stepLength = Math.min(MAX_LENGTH, remaining);

AnnisBinary bin = binaryRes.path("" + offset).path("" + stepLength).get(AnnisBinary.class);
Validate.isTrue(bin.getBytes().length == stepLength);
Validate.isTrue(bin.getLength() == stepLength);
out.write(bin.getBytes());
out.flush();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,24 @@
*/
package annis.service.objects;

import java.io.Serializable;
import java.util.Arrays;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class AnnisBinary extends AnnisBinaryMetaData
{

private byte[] bytes = new byte[0];

public byte[] getBytes()
{
return Arrays.copyOf(bytes, bytes.length);
}

@Override
public int getLength()
{
return bytes.length;
}

public void setBytes(byte[] bytes)
{
Expand All @@ -38,4 +42,5 @@ public void setBytes(byte[] bytes)
}
this.bytes = Arrays.copyOf(bytes, bytes.length);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.Serializable;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
* This Class provides the Metadata of a BinaryFile.
Expand All @@ -10,7 +11,8 @@
@XmlRootElement
public class AnnisBinaryMetaData implements Serializable
{


private String localFileName;
private String corpusName;
private String mimeType;
private String fileName;
Expand Down Expand Up @@ -56,8 +58,14 @@ public void setLength(int length)
this.length = length;
}



@XmlTransient
public String getLocalFileName()
{
return localFileName;
}


public void setLocalFileName(String localFileName)
{
this.localFileName = localFileName;
}
}
8 changes: 8 additions & 0 deletions annis-libgui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@
<version>1.1</version>
<scope>compile</scope>
</dependency>


<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>14.0.1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
26 changes: 26 additions & 0 deletions annis-libgui/src/main/java/annis/libgui/AnnisBaseUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.core.joran.spi.JoranException;
import com.google.common.hash.Hashing;
import com.vaadin.annotations.Theme;
import com.vaadin.server.ClassResource;
import com.vaadin.server.VaadinRequest;
Expand All @@ -37,6 +38,7 @@
import java.util.Map;
import java.util.Properties;
import java.util.TreeMap;
import java.util.TreeSet;
import net.xeoh.plugins.base.Plugin;
import net.xeoh.plugins.base.PluginManager;
import net.xeoh.plugins.base.impl.PluginManagerFactory;
Expand All @@ -49,6 +51,7 @@
import org.codehaus.jackson.xc.JaxbAnnotationIntrospector;
import org.slf4j.LoggerFactory;
import org.slf4j.bridge.SLF4JBridgeHandler;
import org.vaadin.cssinject.CSSInject;

/**
* Basic UI functionality.
Expand Down Expand Up @@ -82,6 +85,8 @@ public class AnnisBaseUI extends UI implements PluginSystem, Serializable
private transient MediaController mediaController;

private transient ObjectMapper jsonMapper;

private transient TreeSet<String> alreadyAddedCSS;

@Override
protected void init(VaadinRequest request)
Expand Down Expand Up @@ -430,6 +435,27 @@ public void close()

super.close();
}

/**
* Inject CSS into the UI.
* This function will not add multiple style-elements if the
* exact CSS string was already added.
* @param cssContent
*/
public void injectUniqueCSS(String cssContent)
{
if(alreadyAddedCSS == null)
{
alreadyAddedCSS = new TreeSet<String>();
}
String hashForCssContent = Hashing.md5().hashString(cssContent).toString();
if(!alreadyAddedCSS.contains(hashForCssContent))
{
CSSInject cssInject = new CSSInject(UI.getCurrent());
cssInject.setStyles(cssContent);
alreadyAddedCSS.add(hashForCssContent);
}
}


@Override
Expand Down
2 changes: 1 addition & 1 deletion annis-libgui/src/main/java/annis/libgui/Helper.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package annis.libgui;

import annis.libgui.AnnisBaseUI;
import annis.provider.SaltProjectProvider;
import annis.service.objects.CorpusConfig;
import com.sun.jersey.api.client.AsyncWebResource;
Expand Down Expand Up @@ -389,4 +388,5 @@ public static Map<String,String> parseFragment(String fragment)
}
return result;
}

}
2 changes: 0 additions & 2 deletions annis-service/nb-configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ Any value defined here will override the pom.xml file value but is only applicab
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs>
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>

<netbeans.hint.jdkPlatform>JDK_1.6</netbeans.hint.jdkPlatform>

<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.wrapMethodParams>WRAP_IF_LONG</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.wrapMethodParams>
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.wrapExtendsImplementsList>WRAP_IF_LONG</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.wrapExtendsImplementsList>
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.wrapExtendsImplementsKeyword>WRAP_IF_LONG</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.wrapExtendsImplementsKeyword>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# The port on which the service will listen
annis.webservice-port=5711

# External files
annis.external-data-path=${annis.home}/extData
# External files, leave empty for default value "<user-home>/.annis/data"
annis.external-data-path=

# SQL scripts
annis.script-path=${annis.home}/sql
Expand Down
8 changes: 6 additions & 2 deletions annis-service/src/main/distribution/conf/spring/CommonDao.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@
<property name="saltAnnotateExtractor" ref="saltAnnotateExtractor"/>
<property name="matrixSqlGenerator" ref="matrixSqlGenerator"/>
<property name="graphSqlGenerator" ref="graphSqlGenerator" />
<property name="externalFilesPath" value="${annis.external-data-path}"/>
<property name="maxFileBufferSize" value="10240" /> <!-- 10 MB -->

<property name="dataSource" ref="dataSource"/>

Expand Down Expand Up @@ -140,8 +142,10 @@
<entry key="webm" value="video/webm"/>
<entry key="ogg" value="audio/ogg"/>
<entry key="wav" value="audio/wav"/>
<entry key="mp3" value="audio/mpeg"/>
<entry key="pdf" value="application/pdf"/>
<entry key="mp3" value="audio/mpeg"/>
<entry key="pdf" value="application/pdf"/>
<entry key="css" value="text/css"/>
<entry key="config" value="application/x-config+text"/>
</util:map>
</property>
<property name="tableInsertFrom">
Expand Down
3 changes: 1 addition & 2 deletions annis-service/src/main/distribution/sql/annopool/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ COMMENT ON COLUMN facts.edge_name IS 'name of the edges in this component';
DROP TABLE IF EXISTS media_files CASCADE;
CREATE TABLE media_files
(
file bytea NOT NULL,
filename text NOT NULL,
corpus_ref integer NOT NULL REFERENCES corpus(id) ON DELETE CASCADE,
bytes bigint NOT NULL,
mime_type varchar NOT NULL,
title varchar NOT NULL,
UNIQUE (corpus_ref, title)
Expand Down
3 changes: 1 addition & 2 deletions annis-service/src/main/distribution/sql/fullfacts/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@ COMMENT ON COLUMN facts.edge_annotation_value IS 'annotation value';

CREATE TABLE media_files
(
file bytea NOT NULL,
filename text NOT NULL,
corpus_ref integer NOT NULL REFERENCES corpus(id) ON DELETE CASCADE,
bytes bigint NOT NULL,
mime_type varchar NOT NULL,
title varchar NOT NULL,
UNIQUE (corpus_ref, title)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,8 @@ COMMENT ON COLUMN facts_edge.edge_name IS 'name of the edges in this component';

CREATE TABLE media_files
(
file bytea NOT NULL,
filename text NOT NULL,
corpus_ref integer NOT NULL REFERENCES corpus(id) ON DELETE CASCADE,
bytes bigint NOT NULL,
mime_type varchar NOT NULL,
title varchar NOT NULL,
UNIQUE (corpus_ref, title)
Expand Down
3 changes: 1 addition & 2 deletions annis-service/src/main/distribution/sql/staging_area.sql
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,8 @@ CREATE :tmp TABLE _resolver_vis_map

CREATE :tmp TABLE _media_files
(
file bytea NOT NULL,
filename text NOT NULL,
corpus_ref bigint NOT NULL,
bytes bigint NOT NULL,
mime_type varchar NOT NULL,
title varchar NOT NULL
);
Loading

0 comments on commit a828238

Please sign in to comment.