net.sourceforge.sconman.rep
Class FSQuotedRepository

java.lang.Object
  extended by net.sourceforge.sconman.rep.FSBasicRepository
      extended by net.sourceforge.sconman.rep.FSQuotedRepository
All Implemented Interfaces:
IRepository, IXMLSerializable

public class FSQuotedRepository
extends FSBasicRepository

This is a file repostitory that have quoted implemented. This repository is defined by the size and threshold

Author:
rcuartero

Nested Class Summary
(package private)  class FSQuotedRepository.QuotaCalculator
           
 
Nested classes/interfaces inherited from interface net.sourceforge.sconman.IRepository
IRepository.IVisitor
 
Field Summary
static int STORE_QUOTA_EXCEED
          Store code result : Quota excceed
 
Fields inherited from class net.sourceforge.sconman.rep.FSBasicRepository
category, rootPath
 
Fields inherited from interface net.sourceforge.sconman.IRepository
STORE_OK
 
Constructor Summary
FSQuotedRepository()
           
FSQuotedRepository(java.lang.String rootPath, long size)
          Creates a new repository
FSQuotedRepository(java.lang.String rootPath, long size, long threshold)
          Creates a new repository
 
Method Summary
 void deserializeXML(org.kxml2.io.KXmlParser in)
          Deserialize from XML
 long getSize()
          Gets the size of the repository
 long getThreshold()
          Gets the threshold
 long getUsedSize()
          Gets the used size of the repository
 void initialize()
          Initialize the repository
 void remove(java.lang.String path)
          Removes the stored file, given its path
 void serializeXML(org.kxml2.io.KXmlSerializer out)
          Serialize to XML
 void setQuotaListesner(SCMQuotaListener listenerQuota)
          Sets a quota listener
 void setSize(long newSize)
          Resize the size of the repository
 void setThreshold(long newThreshold)
          Resize the threshold of the repository
 int store(java.io.InputStream is, java.lang.String path)
          Store an InputStream in the repository
 
Methods inherited from class net.sourceforge.sconman.rep.FSBasicRepository
add, addNonamed, exists, getCategory, getFile, getInputStream, getLastModified, getOutputStream, getRootPath, setCategory, setRootPath, size, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STORE_QUOTA_EXCEED

public static final int STORE_QUOTA_EXCEED
Store code result : Quota excceed

See Also:
Constant Field Values
Constructor Detail

FSQuotedRepository

public FSQuotedRepository()

FSQuotedRepository

public FSQuotedRepository(java.lang.String rootPath,
                          long size)
                   throws java.io.IOException
Creates a new repository

Parameters:
name - Repository´s name
rootPath - The root path where the files are stored
size - Quota of the repository in bytes.
Throws:
java.io.IOException

FSQuotedRepository

public FSQuotedRepository(java.lang.String rootPath,
                          long size,
                          long threshold)
                   throws java.io.IOException
Creates a new repository

Parameters:
name - Repository´s name.
rootPath - The root path where the files are stored.
size - Quota of the repository in bytes.
thresold - Repository threshold in bytes.
Throws:
java.io.IOException
Method Detail

getSize

public long getSize()
Gets the size of the repository

Returns:
The size in bytes.

getThreshold

public long getThreshold()
Gets the threshold

Returns:
Number of threshold bytes

getUsedSize

public long getUsedSize()
Gets the used size of the repository

Returns:
The number of bytes used of the repository

setQuotaListesner

public void setQuotaListesner(SCMQuotaListener listenerQuota)
Sets a quota listener

Parameters:
listenerQuota - Listener

setSize

public void setSize(long newSize)
Resize the size of the repository

Parameters:
newSize - The new repository size in bytes.
Throws:
java.io.IOException - If can´t store the properties in the repository

setThreshold

public void setThreshold(long newThreshold)
Resize the threshold of the repository

Parameters:
newThreshold - The new repository threshold in bytes.
Throws:
java.io.IOException - If can´t store the properties in the repository

store

public int store(java.io.InputStream is,
                 java.lang.String path)
          throws java.io.IOException
Description copied from interface: IRepository
Store an InputStream in the repository

Specified by:
store in interface IRepository
Overrides:
store in class FSBasicRepository
Parameters:
is - The InputStream
path - The path to the file
Returns:
Error code
Throws:
java.io.IOException

remove

public void remove(java.lang.String path)
            throws java.io.IOException
Removes the stored file, given its path

Specified by:
remove in interface IRepository
Overrides:
remove in class FSBasicRepository
Parameters:
path -
Throws:
java.io.IOException

initialize

public void initialize()
                throws java.io.IOException
Description copied from interface: IRepository
Initialize the repository

Specified by:
initialize in interface IRepository
Overrides:
initialize in class FSBasicRepository
Throws:
java.io.IOException

serializeXML

public void serializeXML(org.kxml2.io.KXmlSerializer out)
                  throws java.io.IOException
Description copied from interface: IXMLSerializable
Serialize to XML

Specified by:
serializeXML in interface IXMLSerializable
Overrides:
serializeXML in class FSBasicRepository
Parameters:
out - The KXmlSerializer to do the output
Throws:
java.io.IOException - Thrown if there's an IO problem

deserializeXML

public void deserializeXML(org.kxml2.io.KXmlParser in)
                    throws org.xmlpull.v1.XmlPullParserException,
                           java.io.IOException
Description copied from interface: IXMLSerializable
Deserialize from XML

Specified by:
deserializeXML in interface IXMLSerializable
Overrides:
deserializeXML in class FSBasicRepository
Parameters:
in - The KXml pull parser
Throws:
org.xmlpull.v1.XmlPullParserException - Thrown if there's an XML problem
java.io.IOException - Thrown if there's an IO problem


Copyright null null. All Rights Reserved.