KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > pss > runtime > common > lib > StorageHomeBase


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.common.lib;
28
29 /**
30  * This is a base class for Storage Homes.
31  *
32  * @author <a HREF="mailto:Christophe.Demarey@lifl.fr">Christophe Demarey</a>
33  *
34  * @version 0.1
35  */

36 public abstract class StorageHomeBase
37               extends org.omg.CORBA.LocalObject JavaDoc
38            implements org.objectweb.openccm.pss.runtime.common.api.StorageHomeBase
39 {
40     // ==================================================================
41
//
42
// Internal state.
43
//
44
// ==================================================================
45

46     /**
47      * The catalog.
48      */

49     private org.objectweb.openccm.pss.runtime.common.api.CatalogBase _catalog;
50
51     /**
52      * Managed storage type incarnations.
53      */

54     protected java.util.List JavaDoc _storage_type_incarnations;
55
56     // ==================================================================
57
//
58
// Constructor.
59
//
60
// ==================================================================
61

62     /**
63      * The default constructor.
64      */

65     public StorageHomeBase()
66     {
67         _storage_type_incarnations = new java.util.ArrayList JavaDoc();
68         _catalog = null;
69     }
70
71     // ==================================================================
72
//
73
// Internal methods.
74
//
75
// ==================================================================
76

77     // ==================================================================
78
//
79
// Public methods.
80
//
81
// ==================================================================
82

83     // ==================================================================
84
//
85
// Methods for org.omg.CosPersistentState.StorageHomeBase
86
//
87
// ==================================================================
88

89     /**
90      * Get the catalog.
91      */

92     public org.omg.CosPersistentState.CatalogBase
93     get_catalog()
94     {
95         return _catalog;
96     }
97
98     /**
99      * Retrieve a storage object with its short pid.
100      *
101      * @param short_pid - The short pid to find.
102      *
103      * @throws org.omg.CosPersistentState.NotFound ifstorage object can't be found.
104      *
105      * @return The binding storage object.
106      */

107     public abstract java.lang.Object JavaDoc
108     find_by_short_pid(byte[] short_pid)
109     throws org.omg.CosPersistentState.NotFound;
110
111     // ==================================================================
112
//
113
// Methods for org.objectweb.openccm.pss.runtime.common.api.StorageHomeBase
114
//
115
// ==================================================================
116

117     /**
118      * Initialize the storage home.
119      *
120      * @param catalog - The storage home catalog.
121      */

122     public void
123     initialize(org.objectweb.openccm.pss.runtime.common.api.CatalogBase catalog)
124     {
125         _catalog = catalog;
126     }
127
128     /**
129      * Register a storage type incarnation.
130      */

131     public void
132     register_storage_type_incarnation(java.lang.Object JavaDoc st_incarnation)
133     {
134         _storage_type_incarnations.add(st_incarnation);
135     }
136
137     /**
138      * Unregister a storage type incarnation.
139      */

140     public void
141     unregister_storage_type_incarnation(byte[] pid)
142     {
143         java.util.Iterator JavaDoc it = _storage_type_incarnations.iterator();
144         org.omg.CosPersistentState.StorageObject so = null;
145
146         while(it.hasNext())
147         {
148             so = (org.omg.CosPersistentState.StorageObject) it.next();
149             if ( java.util.Arrays.equals(so.get_pid(), pid) )
150             {
151                 it.remove();
152                 return;
153             }
154         }
155     }
156
157     /**
158      * Get the Repository ID of a storage home.
159      *
160      * @return The storage home RID.
161      */

162     public abstract String JavaDoc
163     get_rid();
164
165     /**
166      * Get the Repository ID of the managed storage type.
167      *
168      * @return The storage type RID.
169      */

170     public abstract String JavaDoc
171     get_st_rid();
172 }
173
Popular Tags