com.nonesole.persistence.file.operation.first
Class SingletonSeFileAction

java.lang.Object
  extended by com.nonesole.persistence.file.operation.first.SingletonSeFileAction
All Implemented Interfaces:
FileAction

public class SingletonSeFileAction
extends java.lang.Object
implements FileAction

This class implements FileAction interface.It is Serialization Object Operation.

Version:
1.0 - build on 2010-10-30
Author:
JACK LEE

Method Summary
 java.util.List<?> batchInsert(java.util.List<?> obj)
          Insert objects into file system
 java.util.List<?> batchUpdate(java.lang.Object obj, Predicate p, boolean replaceObject)
          Update objects of file system
 java.util.TreeMap<?,?> createIndex(java.lang.String indexName, java.lang.Class<?> clazz, java.lang.reflect.Field field)
          Create new index which made of TreeMap.
 int delete(Predicate p, java.lang.Class<?> clazz)
          Delete one object of file system
 java.util.TreeMap<?,?> getIndex(java.lang.Class<?> clazz, java.lang.String indexName)
          Get new index which made of TreeMap.
 java.lang.Object insert(java.lang.Object obj)
          Insert one object into file system
 java.util.List<?> query(Predicate p, java.lang.Class<?> clazz)
          Query.
Those classed who implement this interface will set search condition by themselves.So it uses Object(common condition object) here.
 boolean removeIndex(java.lang.Class<?> clazz, java.lang.String indexName)
          Remove index which made of TreeMap.
static SingletonSeFileAction self()
           
 SeFileAction setChildFolder(java.lang.String childFolder)
          Set file action.
 FileAction setDBFolder(java.net.URI uri)
          Set root folder of file db
 java.lang.Object update(java.lang.Object obj, Predicate<?> p, boolean replaceObject)
          Update one object of file system
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

self

public static SingletonSeFileAction self()

batchInsert

public java.util.List<?> batchInsert(java.util.List<?> obj)
                              throws OperationsException
Description copied from interface: FileAction
Insert objects into file system

Specified by:
batchInsert in interface FileAction
Parameters:
obj - list of Object
Returns:
Object - list of objs after dealing with
Throws:
OperationsException

batchUpdate

public java.util.List<?> batchUpdate(java.lang.Object obj,
                                     Predicate p,
                                     boolean replaceObject)
                              throws OperationsException
Description copied from interface: FileAction
Update objects of file system

Specified by:
batchUpdate in interface FileAction
Parameters:
obj - Object
p - Predicate Search condition object
replaceObject - If users want to change the whole object ,it should be true.
Returns:
Object - list of objs after dealing with
Throws:
OperationsException

delete

public int delete(Predicate p,
                  java.lang.Class<?> clazz)
           throws OperationsException
Description copied from interface: FileAction
Delete one object of file system

Specified by:
delete in interface FileAction
clazz - - Class of object which will be deleted
Returns:
the number of the objects which is deleted
Throws:
OperationsException

insert

public java.lang.Object insert(java.lang.Object obj)
                        throws OperationsException
Description copied from interface: FileAction
Insert one object into file system

Specified by:
insert in interface FileAction
Parameters:
obj - Object
Returns:
Object - obj after dealing with
Throws:
OperationsException

query

public java.util.List<?> query(Predicate p,
                               java.lang.Class<?> clazz)
                        throws OperationsException
Description copied from interface: FileAction
Query.
Those classed who implement this interface will set search condition by themselves.So it uses Object(common condition object) here.

Specified by:
query in interface FileAction
Parameters:
p - - search condition
clazz - - Class of return
Returns:
result of search
Throws:
OperationsException

setDBFolder

public FileAction setDBFolder(java.net.URI uri)
                       throws OperationsException
Description copied from interface: FileAction
Set root folder of file db

Specified by:
setDBFolder in interface FileAction
Returns:
FileAction
Throws:
OperationsException

update

public java.lang.Object update(java.lang.Object obj,
                               Predicate<?> p,
                               boolean replaceObject)
                        throws OperationsException
Description copied from interface: FileAction
Update one object of file system

Specified by:
update in interface FileAction
Parameters:
obj - Object
p - Predicate Search condition object
replaceObject - If users want to change the whole object ,it should be true.
Returns:
Object - obj after dealing with
Throws:
OperationsException

createIndex

public java.util.TreeMap<?,?> createIndex(java.lang.String indexName,
                                          java.lang.Class<?> clazz,
                                          java.lang.reflect.Field field)
                                   throws OperationsException
Description copied from interface: FileAction
Create new index which made of TreeMap.

Specified by:
createIndex in interface FileAction
Returns:
TreeMap
Throws:
OperationsException

getIndex

public java.util.TreeMap<?,?> getIndex(java.lang.Class<?> clazz,
                                       java.lang.String indexName)
                                throws OperationsException
Description copied from interface: FileAction
Get new index which made of TreeMap.

Specified by:
getIndex in interface FileAction
Returns:
TreeMap
Throws:
OperationsException

removeIndex

public boolean removeIndex(java.lang.Class<?> clazz,
                           java.lang.String indexName)
                    throws OperationsException
Description copied from interface: FileAction
Remove index which made of TreeMap.

Specified by:
removeIndex in interface FileAction
Returns:
TreeMap
Throws:
OperationsException

setChildFolder

public SeFileAction setChildFolder(java.lang.String childFolder)
Description copied from interface: FileAction
Set file action.

Specified by:
setChildFolder in interface FileAction