OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 17 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
17 ilm 1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
10
 *
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
13
 
14
 package org.openconcerto.xml.persistence;
15
 
16
import java.io.IOException;
83 ilm 17
import java.util.Map;
17 ilm 18
import java.util.Set;
19
 
20
/**
21
 * Permet de lire et ecrire des Persistent déjà serialisés.
22
 *
23
 * @author ILM Informatique 29 juin 2004
24
 */
25
public interface PersistenceIO {
26
 
27
    /**
28
     * Sauve l'élément passé.
29
     *
30
     * @param ser
31
     * @param pers
32
     * @param id
33
     * @throws IOException if an error occurs while saving.
34
     */
35
    public void save(Object ser, Persistent pers, String id) throws IOException;
36
 
37
    /**
38
     * Load a serialized form.
39
     *
40
     * @param clazz the class of the serialized object.
41
     * @param id the id of the serialized object.
42
     * @return the serialized form of the object, or <code>null</code> if not found.
43
     * @throws IOException if pb while loading.
44
     */
45
    public Object load(Class clazz, String id) throws IOException;
46
 
47
    public Set<String> getIDs(Class clazz) throws IOException;
48
 
83 ilm 49
    public Map<Class<?>, Set<String>> getIDs() throws IOException;
17 ilm 50
 
51
    public void delete(Class clazz, String id) throws IOException;
52
 
53
    public void delete(Class clazz) throws IOException;
54
 
55
    public void deleteAll() throws IOException;
56
 
57
    public boolean exists(Class clazz, String id);
58
 
59
    public void setAutoCommit(boolean b) throws IOException;
60
 
61
    /**
62
     * Should free loaded objects from any cache. In general, this means that the next load() will
63
     * do some io, so this method should only be used when all objects we're interested in have been
64
     * loaded or when memory run low.
65
     */
66
    public void unload();
67
}