KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > ir3 > AnonymousIDLType


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): Philippe Merle.
23 Contributor(s): Mathieu Vadet, Christophe Demarey.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.ir3;
28
29 //Package dependencies
30
import org.omg.CORBA.*;
31
32 /**
33  * Abstract base class for anonymous CORBA::IDLType objects.
34  *
35  * @author <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>
36  * <a HREF="mailto:Mathieu.Vadet@lifl.fr">Mathieu Vadet</a>
37  *
38  * @version 0.5
39  */

40
41 abstract public class AnonymousIDLType
42                 extends IRObject_impl
43                 implements IDLTypeOperations
44 {
45     // ==================================================================
46
//
47
// Internal state.
48
//
49
// ==================================================================
50

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

57     /** TODO */
58     public
59     AnonymousIDLType(IFR ifr)
60     {
61         // Calls the IRObject_impl contructor.
62
super(ifr);
63     }
64
65     // ==================================================================
66
//
67
// Internal methods.
68
//
69
// ==================================================================
70

71     /**
72      * TODO
73      */

74     protected boolean
75     isUnderDestruction()
76     {
77         // Returns true if this object is already in destruction.
78
if(super.isUnderDestruction()) return true;
79
80         // If dependencies to this object exist then
81
if (getReferencedByCounter() != 0)
82         {
83             // Visits all IR objects referencing this object.
84
org.objectweb.util.ref.api.Referencable[] referenced_by = getReferencedBy();
85             for(int i=0; i<referenced_by.length; i++) {
86                 // Returns false if one of the referencing object is not
87
// under destruction.
88
if(!((IRObject_impl)(referenced_by[i])).isUnderDestruction())
89                     return false;
90             }
91         }
92         return true;
93     }
94
95     // ==================================================================
96
//
97
// Public methods.
98
//
99
// ==================================================================
100

101     // ==================================================================
102
//
103
// For org.objectweb.util.ref.api.Referencable interface.
104
//
105
// ==================================================================
106

107     /**
108      * Removes a reference.
109      *
110      * @param ref The Referencable object to remove.
111      *
112      * @postcondition if ref was previously added then
113      * getReferencedByCounter() == old.getReferencedByCounter() - 1
114      */

115     public void
116     removeReferencedBy(org.objectweb.util.ref.api.Referencable ref)
117     {
118         super.removeReferencedBy(ref);
119
120         // If there is no more dependency then
121
// destroy this anonymous CORBA::IDLType.
122
if (getReferencedByCounter() == 0)
123             destroy();
124     }
125
126     // ==================================================================
127
//
128
// For CORBA::IRObject interface.
129
//
130
// ==================================================================
131

132     // same as in the IRObject_impl class.
133

134     // ==================================================================
135
//
136
// For CORBA::IDLType interface.
137
//
138
// ==================================================================
139

140     // implemented into subclasses.
141
}
142
Popular Tags