View Javadoc

1   /*
2    * @(#)$Id: StorageEngine.java 724 2009-08-04 22:13:35Z kurmannu $
3    *
4    * Author       :   Ueli Kurmann, igesture@uelikurmann.ch
5    *
6    * Purpose      : 	Interface for StorageEngines implementations
7    *                  realising access functionality for data sources.  
8    *
9    * -----------------------------------------------------------------------
10   *
11   * Revision Information:
12   *
13   * Date             Who         Reason
14   *
15   * Dec 26, 2006     ukurmann    Initial Release
16   * Mar 22, 2007     bsigner     Cleanup
17   *
18   * -----------------------------------------------------------------------
19   *
20   * Copyright 1999-2009 ETH Zurich. All Rights Reserved.
21   *
22   * This software is the proprietary information of ETH Zurich.
23   * Use is subject to license terms.
24   * 
25   */
26  
27  
28  package org.ximtec.igesture.storage;
29  
30  import java.io.File;
31  import java.util.List;
32  
33  import org.ximtec.igesture.core.DataObject;
34  
35  
36  /**
37   * Interface for StorageEngines implementations realising access functionality
38   * for data sources.
39   * 
40   * @version 1.0, Dec 2006
41   * @author Ueli Kurmann, igesture@uelikurmann.ch
42   * @author Beat Signer, signer@inf.ethz.ch
43   */
44  public interface StorageEngine {
45  
46     /**
47      * Loads a data object of a specific type.
48      */
49     public <T extends DataObject> T load(Class<T> clazz, String id);
50  
51  
52     /**
53      * Loads a collection of data objects of a given type. In general this method
54      * returns all instances of the specific type.
55      */
56     public <T extends DataObject> List<T> load(Class<T> clazz);
57  
58  
59     /**
60      * Loads a collection of data objects
61      */
62     public <T extends DataObject> List<T> load(Class<T> clazz, String fieldName,
63           Object value);
64  
65  
66     /**
67      * Stores a data object. The engine is responsible to set an unique id to the
68      * data object.
69      */
70     public void store(DataObject dataObjects);
71  
72  
73     /**
74      * Updates a data object.
75      */
76     public void update(DataObject obj);
77  
78  
79     /**
80      * Removes a data object.
81      */
82     public void remove(DataObject ojb);
83     
84     /**
85      * Commits the Transaction
86      */
87     public void commit();
88  
89  
90     /**
91      * Disposes the engine.
92      */
93     public void dispose();
94     
95     /**
96      * 
97      * @param file
98      */
99     public void copyTo(File file);
100 
101 }