KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > pss > runtime > jdo > lib > Session


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
5 Contact: openccm@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Christophe Demarey.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.pss.runtime.jdo.lib;
28
29 import org.objectweb.openccm.pss.runtime.common.lib.PIDHelper;
30
31 /**
32  * This class establish a session with a JDO implementation.
33  * It implements the org.objectweb.openccm.pss.runtime.api.Connector interface.
34  *
35  * @author <a HREF="mailto:Christophe.Demarey@lifl.fr">Christophe Demarey</a>
36  *
37  * @version 0.1
38  */

39
40 public class Session
41      extends org.objectweb.openccm.pss.runtime.jdo.lib.CatalogBase
42   implements org.objectweb.openccm.pss.runtime.jdo.api.Session
43 {
44     // ==================================================================
45
//
46
// Internal state.
47
//
48
// ==================================================================
49

50     // ==================================================================
51
//
52
// Constructor.
53
//
54
// ==================================================================
55

56     /**
57      * The default constructor.
58      *
59      * @param id - The catalog id.
60      * @param pm - The associted JDO Persistence Manager.
61      */

62     public Session(int id, javax.jdo.PersistenceManager pm)
63     {
64         super(id, pm);
65     }
66
67     // ==================================================================
68
//
69
// Internal methods.
70
//
71
// ==================================================================
72

73     // ==================================================================
74
//
75
// Public methods.
76
//
77
// ==================================================================
78

79     // ==================================================================
80
//
81
// Methods for org.omg.CosPersistentState.Catalog
82
//
83
// ==================================================================
84

85     /**
86      * Retrieve a storage object with its pid.
87      */

88     public java.lang.Object JavaDoc
89     find_by_pid(byte[] the_pid)
90     throws org.omg.CosPersistentState.NotFound
91     {
92         org.omg.CosPersistentState.StorageHomeBase sh = null;
93
94         // Get the object storage home with its Repository ID
95
sh = find_storage_home(PIDHelper.get_RID(the_pid));
96
97         return sh.find_by_short_pid(PIDHelper.get_short_pid(the_pid));
98     }
99
100     /**
101      * Operation flush
102      */

103     public void
104     flush()
105     {
106         commit_tx();
107         begin_tx();
108     }
109
110     /**
111      * Operation refresh
112      */

113     public void
114     refresh()
115     {
116         rollback_tx();
117         begin_tx();
118     }
119
120     /**
121      * Operation free_all
122      */

123     public void
124     free_all()
125     {
126         // For each Storage Home, free registered storage types incarnations
127
// TO DO
128
}
129
130     /**
131      * Operation close
132      */

133     public void
134     close()
135     {
136         flush();
137         get_persistence_manager().close();
138     }
139
140     // ==================================================================
141
//
142
// Methods for org.objectweb.openccm.pss.runtime.common.api.CatalogBase
143
//
144
// ==================================================================
145

146     // ==================================================================
147
//
148
// Methods for org.objectweb.openccm.pss.runtime.jdo.api.CatalogBase
149
//
150
// ==================================================================
151
}
152
Popular Tags