org.ow2.weblab.service.exposer
Class LocalFileExposer

java.lang.Object
  extended by org.ow2.weblab.service.exposer.LocalFileExposer
All Implemented Interfaces:
org.weblab_project.services.analyser.Analyser

public class LocalFileExposer
extends java.lang.Object
implements org.weblab_project.services.analyser.Analyser

This service is used in conjunction with an Apache Tomcat or Apache server. The purpose is to annotate documents in input with an "exposition URL" i.e. an URL that can be used in a web browser to access this document. This service only works when processed file are exposed using the server and have the same naming pattern than the read annotation on the document (in most of the case, we use DC:source). Some parameter can be set using a file name : local-file-exposer.config

Author:
ymombrun
Date:
24 oct. 08

Field Summary
protected  boolean annotateAsUri
          Whether the URL shall be annotated as Resource.
protected  java.lang.String byString
          The String to be added at the beginning of the String to replace; in most of the case it's protocol://host:port/exposition_pattern/
static java.lang.String CONFIG_FILE
          The name of the configuration file.
protected  java.lang.String exposedAsUri
          It's possible to change the URI of the predicate to be written with the exposition URL.
protected  int nbStartCharToReplace
          The number of character to be remove at the beginning of the String to replace; in most of the case it's the path to the whole folder that will be exposed.
protected  java.lang.String replacementForSpace
          The java method for URL encoding replaces spaces by '+'.
protected  boolean sourceIsResource
          Sometimes the object of the statement containing the original source of the Document is a Resource (since an URL might be an URI); in this case this parameter has to be true.
protected  java.lang.String sourceUri
          The predicate's URI of the statement that contains the original source of the Document to be modified.
protected  boolean urlEncodeBetweenSlashes
          Whether or not to URL encode between the slashes (and backslashes).
protected  java.lang.String urlEncoding
          When encoding a URL it's needed to use the encoding used by the server for URL encoding; otherwise some file might never be exposed (especially files containing accent in their name or other complex characters).
 
Constructor Summary
LocalFileExposer()
          Constructors
 
Method Summary
 org.weblab_project.services.analyser.types.ProcessReturn process(org.weblab_project.services.analyser.types.ProcessArgs args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sourceUri

protected final java.lang.String sourceUri
The predicate's URI of the statement that contains the original source of the Document to be modified.


sourceIsResource

protected final boolean sourceIsResource
Sometimes the object of the statement containing the original source of the Document is a Resource (since an URL might be an URI); in this case this parameter has to be true.


exposedAsUri

protected final java.lang.String exposedAsUri
It's possible to change the URI of the predicate to be written with the exposition URL.


nbStartCharToReplace

protected final int nbStartCharToReplace
The number of character to be remove at the beginning of the String to replace; in most of the case it's the path to the whole folder that will be exposed.


byString

protected final java.lang.String byString
The String to be added at the beginning of the String to replace; in most of the case it's protocol://host:port/exposition_pattern/


annotateAsUri

protected final boolean annotateAsUri
Whether the URL shall be annotated as Resource. If not it will be a literal statement.


urlEncodeBetweenSlashes

protected final boolean urlEncodeBetweenSlashes
Whether or not to URL encode between the slashes (and backslashes). It's needed in most of the case.


urlEncoding

protected final java.lang.String urlEncoding
When encoding a URL it's needed to use the encoding used by the server for URL encoding; otherwise some file might never be exposed (especially files containing accent in their name or other complex characters).


replacementForSpace

protected final java.lang.String replacementForSpace
The java method for URL encoding replaces spaces by '+'. But servers like Tomcat or Apache are using "%20" (in UTF-8 and ISO-8859-1 for instance) as replacement String.


CONFIG_FILE

public static final java.lang.String CONFIG_FILE
The name of the configuration file.

See Also:
Constant Field Values
Constructor Detail

LocalFileExposer

public LocalFileExposer()
Constructors

Method Detail

process

public org.weblab_project.services.analyser.types.ProcessReturn process(org.weblab_project.services.analyser.types.ProcessArgs args)
                                                                 throws org.weblab_project.services.analyser.ProcessException
Specified by:
process in interface org.weblab_project.services.analyser.Analyser
Throws:
org.weblab_project.services.analyser.ProcessException


Copyright © 2004-2010. All Rights Reserved.