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

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

public class SeFileAction
extends java.lang.Object
implements FileAction

Version:
1.0 - build on 2010-11-04
Author:
JACK

Constructor Summary
SeFileAction()
           
 
Method Summary
 java.util.List<?> batchInsert(java.util.List<?> l)
          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
static java.net.URI getConfig(java.lang.String key)
          Get set which likes db folder path from config file.
static java.net.URL getEnv(java.lang.String key)
          Get set which likes db folder path from system env.
 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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SeFileAction

public SeFileAction()
Method Detail

getConfig

public static java.net.URI getConfig(java.lang.String key)
Get set which likes db folder path from config file.

Returns:
URL obj

getEnv

public static java.net.URL getEnv(java.lang.String key)
Get set which likes db folder path from system env.

Returns:
URL obj

batchInsert

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

Specified by:
batchInsert in interface FileAction
Parameters:
l - 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

setChildFolder

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

Specified by:
setChildFolder in interface FileAction

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