org.ow2.weblab.service
Class SimpleRepo

java.lang.Object
  extended by org.ow2.weblab.service.SimpleRepo
All Implemented Interfaces:
org.ow2.weblab.core.services.ResourceContainer
Direct Known Subclasses:
FullDataManagment

public class SimpleRepo
extends java.lang.Object
implements org.ow2.weblab.core.services.ResourceContainer

This is a simple implementation of a ResourceContainer. It enable to save resource on a file system and get them after. It is a simpler version that the filerepository one. Main differences are:

Author:
ymombrun, Copyright Cassidian
Date:
2010-04-15

Field Summary
protected  org.ow2.weblab.core.extended.jaxb.WebLabMarshaller reader
          Instance of WebLabMarshaller used to read resources stored in repo.
protected  java.io.File repoBase
          The base folder of the repository in the file system
protected  org.ow2.weblab.core.extended.jaxb.WebLabMarshaller writer
          Instance of WebLabMarshaller used to store resources in repo.
 
Constructor Summary
SimpleRepo(java.lang.String path)
          The constructor.
 
Method Summary
 org.ow2.weblab.core.services.resourcecontainer.LoadResourceReturn loadResource(org.ow2.weblab.core.services.resourcecontainer.LoadResourceArgs args)
           
 org.ow2.weblab.core.services.resourcecontainer.SaveResourceReturn saveResource(org.ow2.weblab.core.services.resourcecontainer.SaveResourceArgs args)
           
protected  java.io.File uriToFile(java.lang.String uri)
          Hash the URI to obtain a path to an unique file to be used to store (or load) the resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

repoBase

protected final java.io.File repoBase
The base folder of the repository in the file system


reader

protected final org.ow2.weblab.core.extended.jaxb.WebLabMarshaller reader
Instance of WebLabMarshaller used to read resources stored in repo.


writer

protected final org.ow2.weblab.core.extended.jaxb.WebLabMarshaller writer
Instance of WebLabMarshaller used to store resources in repo.

Constructor Detail

SimpleRepo

public SimpleRepo(java.lang.String path)
The constructor.

Parameters:
path - The path of the base directory of the repository where resources are stored.
Method Detail

loadResource

public org.ow2.weblab.core.services.resourcecontainer.LoadResourceReturn loadResource(org.ow2.weblab.core.services.resourcecontainer.LoadResourceArgs args)
                                                                               throws org.ow2.weblab.core.services.InvalidParameterException,
                                                                                      org.ow2.weblab.core.services.UnexpectedException
Specified by:
loadResource in interface org.ow2.weblab.core.services.ResourceContainer
Throws:
org.ow2.weblab.core.services.InvalidParameterException
org.ow2.weblab.core.services.UnexpectedException

saveResource

public org.ow2.weblab.core.services.resourcecontainer.SaveResourceReturn saveResource(org.ow2.weblab.core.services.resourcecontainer.SaveResourceArgs args)
                                                                               throws org.ow2.weblab.core.services.InvalidParameterException,
                                                                                      org.ow2.weblab.core.services.UnexpectedException
Specified by:
saveResource in interface org.ow2.weblab.core.services.ResourceContainer
Throws:
org.ow2.weblab.core.services.InvalidParameterException
org.ow2.weblab.core.services.UnexpectedException

uriToFile

protected java.io.File uriToFile(java.lang.String uri)
Hash the URI to obtain a path to an unique file to be used to store (or load) the resource.

Parameters:
uri - The URI of the Resource to get the storing file
Returns:
The file used to store a resource


Copyright © 2004-2012. All Rights Reserved.