KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
30  * Base class for IFR object implementation classes:
31  * storing the IFR and POA Tie servant references.
32  *
33  * @author <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>
34  * <a HREF="mailto:Mathieu.Vadet@lifl.fr">Mathieu Vadet</a>
35  *
36  * @version 0.5
37  */

38
39 abstract public class IFRObject
40               extends org.objectweb.util.ref.lib.ReferencableBase
41 {
42     // ==================================================================
43
//
44
// Internal state.
45
//
46
// ==================================================================
47

48     /** Reference to the IFR. */
49     private IFR ifr_;
50
51     /** Reference to the POA tie Servant. */
52     private org.omg.PortableServer.Servant JavaDoc servant_;
53
54     // ==================================================================
55
//
56
// Constructor.
57
//
58
// ==================================================================
59

60     /**
61      * Create the IFRObject with an IFR reference.
62      */

63     public
64     IFRObject(IFR ifr)
65     {
66         // Calls the ReferencableBase constructor.
67
super();
68
69         // Inits internal state.
70
ifr_ = ifr;
71         servant_ = null;
72     }
73
74     // ==================================================================
75
//
76
// Public methods.
77
//
78
// ==================================================================
79

80     /**
81      * Obtain the IFR object.
82      */

83     public IFR
84     getIFR()
85     {
86         return ifr_;
87     }
88
89     /**
90      * Obtain the POA tie servant.
91      */

92     public org.omg.PortableServer.Servant JavaDoc
93     getServant()
94     {
95         return servant_;
96     }
97
98     /**
99      * Obtain the Servant object reference.
100      */

101     public org.omg.CORBA.Object JavaDoc
102     asObject()
103     {
104         return servant_._this_object();
105     }
106
107     /**
108      * Set the POA tie servant.
109      */

110     public void
111     setServant(org.omg.PortableServer.Servant JavaDoc servant)
112     {
113         // deactivate the previous servant.
114
if (servant_ != null)
115             ifr_.deactivate(servant_);
116
117         servant_ = servant;
118  
119         // activate the new servant.
120
if (servant != null)
121             ifr_.activate(servant, this);
122     }
123 }
124
Popular Tags