KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > Deployment > listener > ContainerListenerBase


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2002 USTL - LIFL - GOAL
5 Contact: openccm-team@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): Romain Rouvoy.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.Deployment.listener;
28
29
30 import org.objectweb.openccm.Deployment.ContainerLocal;
31
32 /**
33  * Partial implementation for the
34  * ::plugins::deployment::ContainerListener interface
35  *
36  * @author <a HREF="mailto:Romain.Rouvoy@lifl.fr">Romain Rouvoy</a>
37  *
38  * @version 0.3
39  */

40 public abstract class ContainerListenerBase
41 extends org.omg.CORBA.LocalObject JavaDoc
42 implements ContainerListener
43 {
44     // ==================================================================
45
//
46
// Internal state.
47
//
48
// ==================================================================
49
/**
50      * The delegate listener
51      */

52     protected ContainerListener delegate_;
53
54     /**
55      * The event source
56      */

57     protected ContainerLocal source_;
58     
59     // ==================================================================
60
//
61
// Constructor.
62
//
63
// ==================================================================
64
/**
65      * Constructor with parameter
66      *
67      * @param source the event source
68      */

69     protected
70       ContainerListenerBase(ContainerLocal source)
71     {
72         delegate_ = null;
73         source_ = source;
74     }
75
76     /**
77      * Default Constructor
78      *
79      */

80     protected
81     ContainerListenerBase()
82     {
83         this(null) ;
84     }
85
86     // ==================================================================
87
//
88
// Internal methods.
89
//
90
// ==================================================================
91
/**
92      * Provide a new instance of the class
93      *
94      * @return new instance
95      */

96     protected abstract ContainerListener
97       _new();
98
99     // ==================================================================
100
//
101
// Public methods.
102
//
103
// ==================================================================
104

105     // ==================================================================
106
//
107
// Methods for the ::plugins::deployment::ContainerListener interface.
108
//
109
// ==================================================================
110
//
111
// IDL:omg.org/plugins/deployment/ContainerResource/set_delegate:1.0
112
//
113
/**
114      * Set the delegate listener
115      *
116      * @param listener the delegate listener
117      */

118     public void
119     set_delegate (ContainerListener listener)
120     {
121                 set_source(listener.get_source());
122                 if (delegate_ == null)
123                         delegate_ = listener;
124                 else
125                         delegate_.set_delegate (listener);
126     }
127
128     //
129
// IDL:omg.org/plugins/deployment/ContainerResource/get_source:1.0
130
//
131
/**
132      * Provide the interface for interacting with the container
133      *
134      * @return the interface of manipulation
135      */

136     public ContainerLocal
137     get_source()
138     {
139         return source_;
140     }
141     
142     //
143
// IDL:omg.org/plugins/deployment/ContainerResource/set_source:1.0
144
//
145
/**
146      * Set the interface for interacting with the Container
147      *
148      * @param home the interface of manipulation
149      */

150     public void
151     set_source(ContainerLocal home)
152     {
153         source_ = home;
154     }
155     
156     //
157
// IDL:omg.org/plugins/deployment/ContainerResource/configure_container:1.0
158
//
159
/**
160      * Configure the specified container with the current listener
161      *
162      * @param container the component server to configure
163      */

164     public void
165     configure_container(ContainerLocal container)
166     {
167                 container.add_listener(_new());
168     }
169     
170     //
171
// IDL:omg.org/plugins/deployment/ContainerResource/get_sub_listener:1.0
172
//
173
/**
174      * Provide the equivalent CCMHome listener for the current listener
175      *
176      * @return the equivalent CCMHome listener
177      */

178     public abstract CCMHomeListener
179       get_sub_listener();
180
181     // ==================================================================
182
//
183
// Methods for the ::plugins::deployment::ContainerEvents interface.
184
//
185
// ==================================================================
186
//
187
// IDL:omg.org/plugins/deployment/ContainerEvents/on_create:1.0
188
//
189
/**
190      * Event sent after the create function is called on Container object
191      *
192      * @param ref the object created
193      */

194     public abstract void
195       on_create (org.omg.Components.CCMHome ref) ;
196
197     //
198
// IDL:omg.org/plugins/deployment/ContainerEvents/on_add:1.0
199
//
200
/**
201      * Event sent after the add function is called on Container object
202      *
203      * @param ref the object added
204      */

205     public abstract void
206     on_add (org.omg.Components.CCMHome ref) ;
207
208     //
209
// IDL:omg.org/plugins/deployment/ContainerEvents/on_remove:1.0
210
//
211
/**
212      * Event sent before the remove function is called on Container object
213      *
214      * @param ref the object removed
215      */

216     public abstract void
217     on_remove (org.omg.Components.CCMHome ref) ;
218
219     //
220
// IDL:omg.org/plugins/deployment/ContainerEvents/on_destroy:1.0
221
//
222
/**
223      * Event sent before the destruction of the related Container object
224      *
225      */

226     public abstract void
227     on_destroy () ;
228 }
229
230
231
Popular Tags