1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.db;
\r
14 import org.simantics.db.exception.DatabaseException;
\r
15 import org.simantics.db.exception.InvalidResourceReferenceException;
\r
16 import org.simantics.db.service.SerialisationSupport;
\r
19 * @deprecated use {@link SerialisationSupport} instead
\r
22 public interface ResourceSerializer {
\r
25 * Allocates and returns an identifier that can be stored persistently over
\r
26 * time in a client and the database will be able to give you the
\r
27 * corresponding Resource at a later time, until all statements of the
\r
28 * resource are removed or the identifier is released by
\r
29 * {@link #releaseRandomAccessForResource(String)}.
\r
32 * If random access is requested multiple times for a particular resource,
\r
33 * the allocated ID's should be separate and each need to be released
\r
37 * The format of the generated ID's should be such that they do not contain
\r
41 * To retrieve the Resource for the generated ID later a read transaction is
\r
42 * needed where {@link ReadGraph#getResource(String)} can be used.
\r
45 * @return a persistent identifier
\r
46 * @throws InvalidResourceReferenceException ??? does this ever need to be
\r
49 @Deprecated // in favor of getRandomAccessId
\r
50 String createRandomAccessId(Resource resource)
\r
51 throws InvalidResourceReferenceException;
\r
53 long getRandomAccessId(Resource resource) throws DatabaseException;
\r
54 int getTransientId(Resource resource) throws DatabaseException;
\r
60 * @throws InvalidResourceReferenceException
\r
62 @Deprecated // in favor of getResource(long)
\r
63 Resource getResource(String randomAccessId)
\r
64 throws InvalidResourceReferenceException;
\r
66 Resource getResource(long randomAccessId) throws DatabaseException;
\r
68 Resource getResource(int transientId) throws DatabaseException;
\r
71 * @param identifier an identifier for a previously created random access
\r
73 * {@link #createRandomAccessForResource(Resource)}.
\r
74 * @return <code>true</code> if the id was successfully released and
\r
75 * <code>false</code> if the id did not exist.
\r
76 * @throws InvalidResourceReferenceException
\r
78 boolean disposeRandomAccessId(String randomAccessId)
\r
79 throws InvalidResourceReferenceException;
\r