01 /*
02 * Copyright (c) 1995-2010, The University of Sheffield. See the file
03 * COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
04 *
05 * This file is part of GATE (see http://gate.ac.uk/), and is free
06 * software, licenced under the GNU Library General Public License,
07 * Version 2, June 1991 (in the distribution as file licence.html,
08 * and also available at http://gate.ac.uk/gate/licence.html).
09 *
10 * Valentin Tablan 25/10/2001
11 *
12 * $Id: Persistence.java 12006 2009-12-01 17:24:28Z thomas_heitz $
13 *
14 */
15 package gate.util.persistence;
16
17 import java.io.Serializable;
18
19 import gate.creole.ResourceInstantiationException;
20 import gate.persist.PersistenceException;
21 /**
22 * Defines an object that holds persistent data about another object.
23 * Storing an arbitrary object will consist of creating an appropiate
24 * Persistence object for it and storing that one (via serialisation).
25 *
26 * Restoring a previously saved object will consist of restoring the persistence
27 * object and using the data it stores to create a new object that is as similar
28 * as possible to the original object.
29 */
30 public interface Persistence extends Serializable{
31
32 /**
33 * Populates this Persistence with the data that needs to be stored from the
34 * original source object.
35 */
36 public void extractDataFromSource(Object source)throws PersistenceException;
37
38 /**
39 * Creates a new object from the data contained. This new object is supposed
40 * to be a copy for the original object used as source for data extraction.
41 */
42 public Object createObject()throws PersistenceException,
43 ResourceInstantiationException;
44 }
|