|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.blunder.service.persistence.InMemoryPersistenceService
public abstract class InMemoryPersistenceService
This class provides a basic implementation for in-memory
persistent services. All implementations based on files
or other could extend from this class instead of extending
from BlunderPersistenceService
.
BlunderPersistenceService
Constructor Summary | |
---|---|
InMemoryPersistenceService()
|
Method Summary | |
---|---|
void |
delete(ExceptionRelation er)
Deletes a new ExceptionRelation . |
List<ExceptionRelation> |
findBy(String leafClassname,
String rootClassname,
String businessClassname)
Finds an ExceptionRelation for
the following arguments. |
List<ExceptionRelation> |
findByBusiness(String businessClassname)
Finds an ExceptionRelation for
the following arguments. |
List<ExceptionRelation> |
findByLeaf(String leafClassname)
Finds an ExceptionRelation for
the following arguments. |
List<ExceptionRelation> |
findByLeafAndBusiness(String leafClassname,
String businessClassname)
Finds an ExceptionRelation for
the following arguments. |
List<ExceptionRelation> |
findByLeafAndRoot(String leafClassname,
String rootClassname)
Finds an ExceptionRelation for
the following arguments. |
List<ExceptionRelation> |
findByRoot(String rootClassname)
Finds an ExceptionRelation for
the following arguments. |
ExceptionRelation |
findDefaultRelation()
|
HashMap<Long,ExceptionRelation> |
getData()
|
protected String |
getEmptyOrValueString(String value)
Analize the value and returns it or an empty String if null. |
String |
getFilePath()
|
protected InputStream |
getInputStream()
This method gets a InputStream for the specified
persitence data file. |
protected OutputStream |
getOutputStream()
This method gets a OutputStream for the specified
persitence data file. |
protected Reader |
getReader()
This method gets a Reader for the specified
persitence data file. |
protected Writer |
getWriter()
This method gets a Writer for the specified
persitence data file. |
void |
learn(ExceptionRelation er)
Learns a new ExceptionRelation . |
abstract HashMap<Long,ExceptionRelation> |
readData()
Your implementation should write this method. |
void |
refresh()
Refresh the persistence service. |
void |
setData(HashMap<Long,ExceptionRelation> data)
Sets the datamap with the relations. |
void |
setFilePath(String filePath)
Sets the file path with the path to the datamap file. |
void |
update(ExceptionRelation er)
Updates a known ExceptionRelation . |
abstract void |
writeData()
Your implementation should write this method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InMemoryPersistenceService()
Method Detail |
---|
protected String getEmptyOrValueString(String value)
value
-
public List<ExceptionRelation> findBy(String leafClassname, String rootClassname, String businessClassname)
BlunderPersistenceService
ExceptionRelation
for
the following arguments.
findBy
in interface BlunderPersistenceService
leafClassname
- class name of the highest level
Exception
in the chain.rootClassname
- class name of the lowest level
Exception
in the chain.businessClassname
- class name of the business
Exception
in the chain.
List
of ExceptionRelation
with all relations that matches with the previous parameters.BlunderPersistenceService.findBy(String, String, String)
public List<ExceptionRelation> findByBusiness(String businessClassname)
BlunderPersistenceService
ExceptionRelation
for
the following arguments.
findByBusiness
in interface BlunderPersistenceService
businessClassname
- class name of the business
Exception
in the chain.
List
of ExceptionRelation
with all relations that matches with the previous parameters.BlunderPersistenceService.findByBusiness(String)
public List<ExceptionRelation> findByLeaf(String leafClassname)
BlunderPersistenceService
ExceptionRelation
for
the following arguments.
findByLeaf
in interface BlunderPersistenceService
leafClassname
- class name of the highest level
Exception
in the chain.
List
of ExceptionRelation
with all relations that matches with the previous parameters.BlunderPersistenceService.findByLeaf(String)
public List<ExceptionRelation> findByLeafAndBusiness(String leafClassname, String businessClassname)
BlunderPersistenceService
ExceptionRelation
for
the following arguments.
findByLeafAndBusiness
in interface BlunderPersistenceService
leafClassname
- class name of the highest level
Exception
in the chain.businessClassname
- class name of the business
Exception
in the chain.
List
of ExceptionRelation
with all relations that matches with the previous parameters.BlunderPersistenceService.findByLeafAndBusiness(String,String)
public List<ExceptionRelation> findByLeafAndRoot(String leafClassname, String rootClassname)
BlunderPersistenceService
ExceptionRelation
for
the following arguments.
findByLeafAndRoot
in interface BlunderPersistenceService
leafClassname
- class name of the highest level
Exception
in the chain.rootClassname
- class name of the lowest level
Exception
in the chain.
List
of ExceptionRelation
with all relations that matches with the previous parameters.BlunderPersistenceService.findByLeafAndRoot(String,String)
public List<ExceptionRelation> findByRoot(String rootClassname)
BlunderPersistenceService
ExceptionRelation
for
the following arguments.
findByRoot
in interface BlunderPersistenceService
rootClassname
- class name of the lowest level
Exception
in the chain.
List
of ExceptionRelation
with all relations that matches with the previous parameters.BlunderPersistenceService.findByRoot(String)
public ExceptionRelation findDefaultRelation()
findDefaultRelation
in interface BlunderPersistenceService
ExceptionRelation
.BlunderPersistenceService.findDefaultRelation()
public void learn(ExceptionRelation er)
BlunderPersistenceService
ExceptionRelation
.
learn
in interface BlunderPersistenceService
er
- the ExceptionRelation
to learn.BlunderPersistenceService.learn(ExceptionRelation)
public void update(ExceptionRelation er)
BlunderPersistenceService
ExceptionRelation
.
update
in interface BlunderPersistenceService
er
- the ExceptionRelation
to update.BlunderPersistenceService.update(ExceptionRelation)
public void delete(ExceptionRelation er)
BlunderPersistenceService
ExceptionRelation
.
delete
in interface BlunderPersistenceService
er
- the ExceptionRelation
to delete.BlunderPersistenceService.delete(ExceptionRelation)
public void refresh()
BlunderPersistenceService
refresh
in interface BlunderPersistenceService
BlunderPersistenceService.refresh()
public void setData(HashMap<Long,ExceptionRelation> data)
data
- public HashMap<Long,ExceptionRelation> getData()
public String getFilePath()
public void setFilePath(String filePath)
filePath
- public abstract void writeData()
public abstract HashMap<Long,ExceptionRelation> readData()
protected Reader getReader()
Reader
for the specified
persitence data file.
FileReader
if the file can be
reached from the file system.
InputStreamReader
if the file
could not be reached from the file system, and
it can be reached from the classpath.
Reader
for the persistence
data file.
{@link
- java.lang.NullPointerException} if the file
can not be reached.protected Writer getWriter() throws IOException
Writer
for the specified
persitence data file.
FileWriter
if the file can be
reached from the file system.
FileWriter
if the file
could not be reached from the file system, and
it can be reached from the classpath.
Writer
for the persistence
data file.
{@link
- java.lang.NullPointerException} if the file
can not be reached.
IOException
protected InputStream getInputStream()
InputStream
for the specified
persitence data file.
FileInputStream
if the file can be
reached from the file system.
InputStream
if the file
could not be reached from the file system, and
it can be reached from the classpath.
InputStream
for the persistence
data file.
{@link
- java.lang.NullPointerException} if the file
can not be reached.protected OutputStream getOutputStream() throws FileNotFoundException
OutputStream
for the specified
persitence data file.
OutputStream
for the persistence
data file.
{@link
- java.lang.NullPointerException} if the file
can not be reached.
FileNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |