File-repository/1.7.1

From WebLab Wiki
Jump to navigationJump to search
Resource Container using file system
Details
Service Interfaces ResourceContainer
Exchange model: WebLab 1.2.2
Versions: <ListSubPages />
Licence LGPL 2.1
Supported OS Windows/Linux/MacOS
Binary file-repository-1.7.1.war
Sources file-repository-1.7.1-sources.jar
Javadoc file-repository-1.7.1-javadoc.jar
SVN file-repository
Maven Artifact

<groupId>org.ow2.weblab.webservices</groupId>

<artifactId>file-repository</artifactId>

<version>1.7.1</version>
Release Note


It's a file system implementation of the ResourceContainer interface aka Repository. It enables to save any kind of WebLab resource as XML file and then to get it back. It is in charge of maintaining the URI unity, i.e. it replace every new upcoming resource URI by a uniform one, unique in the context of this repository. Then, every subsequent save of the resource (possibly updated by a processing chain) while update the current stored version. It has also a specific capability enabling the loading and update of sub resources (for instance you can get a specific mediaUnit in a stored document and save it back).

It can be configured through it's constructor, i.e. through CXF bean loading capability.

Configuration

The configuration is done through the use of custom constructors. Four constructors exist, from the more specific to the default one:

  • public FileRepositoryService(final String pathToTheRepository, final int numberOfFilePerFolder, final String repoId, final String filePrefix)
  • public FileRepositoryService(final String pathToTheRepository, final int numberOfFilePerFolder)
  • public FileRepositoryService(final String pathToTheRepository)
  • public FileRepositoryService()

Here are the parameter that can be set and their default values:

  • pathToTheRepository: This is the path to the folder that will be used as root of the repository. The best is to use an absolute path given your specific installation, other wise it might change given the way the server is started. Default value is: repository which leads to the creation of a repository folder in the tomcat/bin directory in most of the cases.
  • numberOfFilePerFolder: This is the number of XML files that can be stored in a subfolder of pathToTheRepository. Each type this value is reached, a new folder is created under pathToTheRepository. The default value is 1000.
  • repoId : This is the simple string that will be used as producedName when adapting URIs to be specific to this repository (the new URI are line: "weblab:repoId/subFolderTimestamp/filePrefixN). Default value is fileRepository.
  • filePrefix: This the prefix to be used in file names and in URIs before the number. By default it is res_.


UsageContext effects

Not used in current implementation.

Examples of SOAP Input/Output

  • SaveResource Request:
    • The input contains an optional usageContext and a required resource of any type. One best practice is to use WebLab URI for resource URIs.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:res="http://weblab.ow2.org/core/1.2/services/resourcecontainer">
   <soapenv:Header/>
   <soapenv:Body>
      <res:saveResourceArgs>
         <usageContext>mycontext</usageContext>
         <resource xsi:type="ns13:Document" uri="weblab://example-made-document/anyuri/1327592136291/-784092873" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns13="http://weblab.ow2.org/core/1.2/model#">
            <annotation uri="weblab://example-made-document/anyuri/1327592136291/-784092873#a0">
               <data xmlns:ns10="http://weblab.ow2.org/core/1.2/services/trainable" xmlns:ns11="http://weblab.ow2.org/core/1.2/services/exception" xmlns:ns12="http://weblab.ow2.org/core/1.2/services/reportprovider" xmlns:ns2="http://weblab.ow2.org/core/1.2/model#" xmlns:ns3="http://weblab.ow2.org/core/1.2/services/indexer" xmlns:ns4="http://weblab.ow2.org/core/1.2/services/configurable" xmlns:ns5="http://weblab.ow2.org/core/1.2/services/sourcereader" xmlns:ns6="http://weblab.ow2.org/core/1.2/services/resourcecontainer" xmlns:ns8="http://weblab.ow2.org/core/1.2/services/analyser" xmlns:ns9="http://weblab.ow2.org/core/1.2/services/queuemanager">
                  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:wp="http://weblab.ow2.org/core/1.2/ontology/processing#">
                     <rdf:Description rdf:about="weblab://example-made-document/anyuri/1327592136291/-784092873" xmlns:dc="http://purl.org/dc/elements/1.1/">
                        <dc:source>http://weblab-project.org</dc:source>
                        <dc:title>Document Title</dc:title>
                        <dc:date>2012-01-26T16:35:48+0100</dc:date>
                     </rdf:Description>
                  </rdf:RDF>
               </data>
            </annotation>
            <mediaUnit xsi:type="ns13:Text" uri="weblab://example-made-document/anyuri/1327592136291/-784092873#t1">
               <content>any text</content>
            </mediaUnit>
         </resource>
      </res:saveResourceArgs>
   </soapenv:Body>
</soapenv:Envelope>
  • SaveResource Result:
    • The output is the URI of the resource stored. It is either the same than the input (if the resource had already been stored before) or a new one. In this case, it follows the WebLab URI scheme.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns10:saveResourceReturn xmlns:ns2="http://weblab.ow2.org/core/1.2/services/reportprovider" xmlns:ns3="http://weblab.ow2.org/core/1.2/services/trainable" xmlns:ns4="http://weblab.ow2.org/core/1.2/services/sourcereader" xmlns:ns5="http://weblab.ow2.org/core/1.2/services/configurable" xmlns:ns6="http://weblab.ow2.org/core/1.2/services/exception" xmlns:ns7="http://weblab.ow2.org/core/1.2/services/searcher" xmlns:ns8="http://weblab.ow2.org/core/1.2/services/queuemanager" xmlns:ns9="http://weblab.ow2.org/core/1.2/services/analyser" xmlns:ns10="http://weblab.ow2.org/core/1.2/services/resourcecontainer" xmlns:ns11="http://weblab.ow2.org/core/1.2/services/indexer">
         <resourceId>weblab://fileRepository/1307691313823/res_0</resourceId>
      </ns10:saveResourceReturn>
   </soap:Body>
</soap:Envelope>
  • LoadResource Request:
    • The input contaisn an optional usageContext and the URI of the resource to be retrieved. It should be a valid WebLab URI.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:res="http://weblab.ow2.org/core/1.2/services/resourcecontainer">
   <soapenv:Header/>
   <soapenv:Body>
      <res:loadResourceArgs>
         <usageContext>mycontext</usageContext>
         <resourceId>weblab://fileRepository/1307691313823/res_0</resourceId>
      </res:loadResourceArgs>
   </soapenv:Body>
</soapenv:Envelope>
  • LoadResource Result:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns10:loadResourceReturn xmlns:ns2="http://weblab.ow2.org/core/1.2/services/reportprovider" xmlns:ns3="http://weblab.ow2.org/core/1.2/services/trainable" xmlns:ns4="http://weblab.ow2.org/core/1.2/services/sourcereader" xmlns:ns5="http://weblab.ow2.org/core/1.2/services/configurable" xmlns:ns6="http://weblab.ow2.org/core/1.2/services/exception" xmlns:ns7="http://weblab.ow2.org/core/1.2/services/searcher" xmlns:ns8="http://weblab.ow2.org/core/1.2/services/queuemanager" xmlns:ns9="http://weblab.ow2.org/core/1.2/services/analyser" xmlns:ns10="http://weblab.ow2.org/core/1.2/services/resourcecontainer" xmlns:ns11="http://weblab.ow2.org/core/1.2/services/indexer">
         <resource xsi:type="ns13:Document" uri="weblab://fileRepository/1307691313823/res_0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns13="http://weblab.ow2.org/core/1.2/model#">
            <annotation uri="weblab://fileRepository/1307691313823/res_0#a0">
               <data xmlns:ns10="http://weblab.ow2.org/core/1.2/services/trainable" xmlns:ns11="http://weblab.ow2.org/core/1.2/services/exception" xmlns:ns12="http://weblab.ow2.org/core/1.2/services/reportprovider" xmlns:ns2="http://weblab.ow2.org/core/1.2/model#" xmlns:ns3="http://weblab.ow2.org/core/1.2/services/indexer" xmlns:ns4="http://weblab.ow2.org/core/1.2/services/configurable" xmlns:ns5="http://weblab.ow2.org/core/1.2/services/sourcereader" xmlns:ns6="http://weblab.ow2.org/core/1.2/services/resourcecontainer" xmlns:ns8="http://weblab.ow2.org/core/1.2/services/analyser" xmlns:ns9="http://weblab.ow2.org/core/1.2/services/queuemanager">
                  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:wp="http://weblab.ow2.org/core/1.2/ontology/processing#">
                     <rdf:Description rdf:about="weblab://fileRepository/1307691313823/res_0" xmlns:dc="http://purl.org/dc/elements/1.1/">
                        <dc:source>http://weblab-project.org</dc:source>
                        <dc:title>Document Title</dc:title>
                        <dc:date>2012-01-26T16:35:48+0100</dc:date>
                     </rdf:Description>
                  </rdf:RDF>
               </data>
            </annotation>
            <mediaUnit xsi:type="ns13:Text" uri="weblab://fileRepository/1307691313823/res_0#t1">
               <content>any text</content>
            </mediaUnit>
         </resource>
      </ns10:loadResourceReturn>
   </soap:Body>
</soap:Envelope>

Known Limitations

  • The sub resource loading is not working for every kind of super and of sub resource. For instance, it is not feasible to store a ComposedResource and to get back one of its part. See http://jira.ow2.org/browse/WEBLAB-379

Dependencies

List off all dependencies of this service:

org.ow2.weblab.webservices:file-repository:war:1.7.1
+- log4j:log4j:jar:1.2.16:test
+- org.ow2.weblab.core.helpers:rdf-helper-jena:jar:1.3.2:test
|  \- com.hp.hpl.jena:jena:jar:2.6.4:test
|     +- com.hp.hpl.jena:iri:jar:0.8:test
|     +- com.ibm.icu:icu4j:jar:3.4.4:test
|     +- xerces:xercesImpl:jar:2.7.1:test
|     +- org.slf4j:slf4j-api:jar:1.5.8:test
|     \- org.slf4j:slf4j-log4j12:jar:1.5.8:test
+- commons-io:commons-io:jar:2.0.1:compile
+- org.ow2.weblab.core:model:jar:1.2.2:compile
+- org.ow2.weblab.core:extended:jar:1.2.2:compile
+- org.ow2.weblab.core:annotator:jar:1.2.4:compile
|  \- joda-time:joda-time:jar:1.6.2:compile
+- org.apache.cxf:cxf-rt-frontend-jaxws:jar:2.4.0:compile
|  +- xml-resolver:xml-resolver:jar:1.2:compile
|  +- asm:asm:jar:3.3:compile
|  +- org.apache.cxf:cxf-api:jar:2.4.0:compile
|  |  +- org.apache.cxf:cxf-common-utilities:jar:2.4.0:compile
|  |  +- org.apache.ws.xmlschema:xmlschema-core:jar:2.0:compile
|  |  \- org.apache.neethi:neethi:jar:3.0.0:compile
|  |     +- wsdl4j:wsdl4j:jar:1.6.2:compile
|  |     \- org.codehaus.woodstox:woodstox-core-asl:jar:4.1.1:compile
|  |        \- org.codehaus.woodstox:stax2-api:jar:3.0.2:compile
|  +- org.apache.cxf:cxf-rt-core:jar:2.4.0:compile
|  |  +- com.sun.xml.bind:jaxb-impl:jar:2.1.13:compile
|  |  \- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1:compile
|  +- org.apache.cxf:cxf-rt-bindings-soap:jar:2.4.0:compile
|  |  +- org.apache.cxf:cxf-tools-common:jar:2.4.0:compile
|  |  \- org.apache.cxf:cxf-rt-databinding-jaxb:jar:2.4.0:compile
|  +- org.apache.cxf:cxf-rt-bindings-xml:jar:2.4.0:compile
|  +- org.apache.cxf:cxf-rt-frontend-simple:jar:2.4.0:compile
|  \- org.apache.cxf:cxf-rt-ws-addr:jar:2.4.0:compile
+- org.apache.cxf:cxf-rt-transports-http:jar:2.4.0:compile
|  +- org.apache.cxf:cxf-rt-transports-common:jar:2.4.0:compile
|  \- org.springframework:spring-web:jar:3.0.5.RELEASE:compile
|     +- aopalliance:aopalliance:jar:1.0:compile
|     +- org.springframework:spring-beans:jar:3.0.5.RELEASE:compile
|     +- org.springframework:spring-context:jar:3.0.5.RELEASE:compile
|     |  +- org.springframework:spring-aop:jar:3.0.5.RELEASE:compile
|     |  +- org.springframework:spring-expression:jar:3.0.5.RELEASE:compile
|     |  \- org.springframework:spring-asm:jar:3.0.5.RELEASE:compile
|     \- org.springframework:spring-core:jar:3.0.5.RELEASE:compile
+- xalan:xalan:jar:2.7.1:compile
|  \- xalan:serializer:jar:2.7.1:compile
|     \- xml-apis:xml-apis:jar:1.3.04:compile
+- commons-logging:commons-logging:jar:1.1.1:compile
+- junit:junit:jar:4.8.2:test
\- javax.servlet:servlet-api:jar:2.4:provided