KickJava   Java API By Example, From Geeks To Geeks.

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


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 package org.objectweb.openccm.Deployment.listener;
27
28 import org.objectweb.openccm.Deployment.CCMHomeLocal;
29
30 /**
31  * Partial implementation for the
32  * Deployment::listener::CCMHomeListener interface
33  *
34  * @author <a HREF="mailto:Romain.Rouvoy@lifl.fr">Romain Rouvoy</a>
35  *
36  * @version 0.3
37  */

38 public abstract class CCMHomeListenerBase
39 extends org.omg.CORBA.LocalObject JavaDoc
40 implements CCMHomeListener
41 {
42     // ==================================================================
43
//
44
// Internal state.
45
//
46
// ==================================================================
47
/**
48      * The delegate listener
49      */

50     protected CCMHomeListener delegate_;
51
52     /**
53      * The event source
54      */

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

67     protected
68     CCMHomeListenerBase(CCMHomeLocal source)
69     {
70         source_ = source;
71         delegate_ = null;
72     }
73
74     /**
75      * Default Constructor
76      *
77      */

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

94     protected abstract CCMHomeListener
95     _new();
96     
97     // ==================================================================
98
//
99
// Public methods.
100
//
101
// ==================================================================
102

103     // ==================================================================
104
//
105
// Methods for the ::plugins::deployment::CCMHomeListener interface.
106
//
107
// ==================================================================
108
/**
109      * Set the delegate listener
110      *
111      * @param listener the delegate listener
112      */

113     public void
114     set_delegate(CCMHomeListener listener)
115     {
116         if (delegate_ == null)
117         {
118             delegate_ = listener;
119             source_ = listener.get_source();
120         }
121         else
122             delegate_.set_delegate (listener);
123     }
124
125     /**
126      * Provide the interface for interacting with the Home
127      *
128      * @return the interface of manipulation
129      */

130     public CCMHomeLocal
131     get_source()
132     {
133         return source_;
134     }
135     
136     /**
137      * Set the interface for interacting with the Home
138      *
139      * @param home the interface of manipulation
140      */

141     public void
142     set_source(CCMHomeLocal home)
143     {
144         source_ = home;
145     }
146      
147     /**
148      * Configure the specified component server with the current listener
149      *
150      * @param home the component server to configure
151      */

152     public void
153     configure_ccm_home(CCMHomeLocal home)
154     {
155     home.add_listener(_new());
156     }
157     
158     // ==================================================================
159
//
160
// Methods for the ::plugins::deployment::CCMHomeEvents interface.
161
//
162
// ==================================================================
163
/**
164      * Event sent after the create function is called on CCMHome object
165      *
166      * @param ref the object created
167      */

168     public abstract void
169     on_create (org.omg.Components.CCMObject ref);
170     
171     /**
172      * Event sent after the add function is called on CCMHome object
173      *
174      * @param ref the object added
175      */

176     public abstract void
177     on_add (org.omg.Components.CCMObject ref );
178     
179     /**
180      * Event sent before the remove function is called on CCMHome object
181      *
182      * @param ref the object removed
183      */

184     public abstract void
185     on_remove (org.omg.Components.CCMObject ref);
186         
187     /**
188      * Event sent before the destruction of the related CCMHome object
189      *
190      */

191     public abstract void
192     on_destroy ();
193 }
194
195
196
197
Popular Tags