com.nonesole.persistence.file.operation.first
Interface FileAction

All Known Implementing Classes:
SeFileAction, SingletonSeFileAction

public interface FileAction

 In the version 1.04 of persistence,some actions on handling files were too simple to use,
 like querying files.So it would be changed to deal with files in the new version.
 More power actions will be provided ,and they can give users more help.    
 
 This interface ,FileAction ,creates all the new actions on handling files.
 

Version:
1.04 - build on 2010-10-29
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.
 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
 

Method Detail

setChildFolder

SeFileAction setChildFolder(java.lang.String childFolder)
Set file action.

Parameters:
child - folder

setDBFolder

FileAction setDBFolder(java.net.URI uri)
                       throws OperationsException
Set root folder of file db

Parameters:
url - - file URL
Returns:
FileAction
Throws:
OperationsException

createIndex

java.util.TreeMap<?,?> createIndex(java.lang.String indexName,
                                   java.lang.Class<?> clazz,
                                   java.lang.reflect.Field field)
                                   throws OperationsException
Create new index which made of TreeMap.

Parameters:
url - - index name
Returns:
TreeMap
Throws:
OperationsException

getIndex

java.util.TreeMap<?,?> getIndex(java.lang.Class<?> clazz,
                                java.lang.String indexName)
                                throws OperationsException
Get new index which made of TreeMap.

Parameters:
url - - index name
Returns:
TreeMap
Throws:
OperationsException

removeIndex

boolean removeIndex(java.lang.Class<?> clazz,
                    java.lang.String indexName)
                    throws OperationsException
Remove index which made of TreeMap.

Parameters:
url - - index name
Returns:
TreeMap
Throws:
OperationsException

insert

java.lang.Object insert(java.lang.Object obj)
                        throws OperationsException
Insert one object into file system

Parameters:
obj - Object
Returns:
Object - obj after dealing with
Throws:
OperationsException

update

java.lang.Object update(java.lang.Object obj,
                        Predicate<?> p,
                        boolean replaceObject)
                        throws OperationsException
Update one object of file system

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

delete

int delete(Predicate p,
           java.lang.Class<?> clazz)
           throws OperationsException
Delete one object of file system

Parameters:
obj - Object
clazz - - Class of object which will be deleted
Returns:
the number of the objects which is deleted
Throws:
OperationsException

query

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

Parameters:
p - - search condition
clazz - - Class of return
Returns:
result of search
Throws:
OperationsException

batchInsert

java.util.List<?> batchInsert(java.util.List<?> obj)
                              throws OperationsException
Insert objects into file system

Parameters:
obj - list of Object
Returns:
Object - list of objs after dealing with
Throws:
OperationsException

batchUpdate

java.util.List<?> batchUpdate(java.lang.Object obj,
                              Predicate p,
                              boolean replaceObject)
                              throws OperationsException
Update objects of file system

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