]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db/src/org/simantics/db/ResourceSerializer.java
Fail safe import fixes made by Antti
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / ResourceSerializer.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.db;
13
14 import org.simantics.db.exception.DatabaseException;
15 import org.simantics.db.exception.InvalidResourceReferenceException;
16 import org.simantics.db.service.SerialisationSupport;
17
18 /**
19  * @deprecated use {@link SerialisationSupport} instead
20  */
21 @Deprecated
22 public interface ResourceSerializer {
23
24     /**
25      * Allocates and returns an identifier that can be stored persistently over
26      * time in a client and the database will be able to give you the
27      * corresponding Resource at a later time, until all statements of the
28      * resource are removed or the identifier is released by
29      * {@link #releaseRandomAccessForResource(String)}.
30      * 
31      * <p>
32      * If random access is requested multiple times for a particular resource,
33      * the allocated ID's should be separate and each need to be released
34      * separately.
35      * 
36      * <p>
37      * The format of the generated ID's should be such that they do not contain
38      * ':' characters.
39      * 
40      * <p>
41      * To retrieve the Resource for the generated ID later a read transaction is
42      * needed where {@link ReadGraph#getResource(String)} can be used.
43      * 
44      * @param resource
45      * @return a persistent identifier
46      * @throws InvalidResourceReferenceException ??? does this ever need to be
47      *         thrown ???
48      */
49     @Deprecated // in favor of getRandomAccessId
50     String createRandomAccessId(Resource resource)
51     throws InvalidResourceReferenceException;
52
53     long getRandomAccessId(Resource resource) throws DatabaseException;
54     int getTransientId(Resource resource) throws DatabaseException;
55
56     /**
57      * 
58      * @param id
59      * @return
60      * @throws InvalidResourceReferenceException
61      */
62     @Deprecated // in favor of getResource(long)
63     Resource getResource(String randomAccessId)
64     throws InvalidResourceReferenceException;
65
66     Resource getResource(long randomAccessId) throws DatabaseException;
67
68     Resource getResource(int transientId) throws DatabaseException;
69
70     /**
71      * @param identifier an identifier for a previously created random access
72      *        resource id using
73      *        {@link #createRandomAccessForResource(Resource)}.
74      * @return <code>true</code> if the id was successfully released and
75      *         <code>false</code> if the id did not exist.
76      * @throws InvalidResourceReferenceException
77      */
78     boolean disposeRandomAccessId(String randomAccessId)
79     throws InvalidResourceReferenceException;
80
81 }