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