KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
31  * Component Server Configurator
32  * <br> Defines which deployment plugins needs to be plugged
33  *
34  * @author <a HREF="mailto:Romain.Rouvoy@lifl.fr">Romain Rouvoy</a>
35  *
36  * @version 0.3
37  */

38 public class ComponentServerConfigurator
39 {
40     // ==================================================================
41
//
42
// Internal state.
43
//
44
// ==================================================================
45

46         /**
47          ** Reference to the plugin chain
48          **
49          **/

50         protected org.objectweb.openccm.Deployment.listener.ComponentServerListener listener_;
51         
52     // ==================================================================
53
//
54
// Constructor.
55
//
56
// ==================================================================
57

58         /**
59          ** Default Constructor
60          **
61          **/

62     public
63         ComponentServerConfigurator()
64     {
65                 listener_ = null;
66                 init();
67     }
68
69
70     // ==================================================================
71
//
72
// Internal methods.
73
//
74
// ==================================================================
75

76         /**
77          ** Initialize the deployment with transaction or not
78          ** <br> Depending on the TRANSACTIONAL System property
79          **
80          ** @deprecated waiting for assembly tool
81          **/

82         protected void
83         init()
84         {
85                 String JavaDoc _transaction = System.getProperties().getProperty("TRANSACTIONAL_PLUGIN","no");
86                 if (_transaction.equalsIgnoreCase("yes"))
87                         add_listener(new org.objectweb.openccm.plugins.transaction.deployment.ComponentServerListenerTransaction());
88                 else
89                         add_listener(new org.objectweb.openccm.Deployment.listener.simple.ComponentServerListenerSimple());
90         }
91
92
93     // ==================================================================
94
//
95
// Public methods.
96
//
97
// ==================================================================
98

99         /**
100          ** Add a new listener to the end of the plugin chain
101          **
102          ** @param listener new listener to add
103          **/

104     public void
105         add_listener(org.objectweb.openccm.Deployment.listener.ComponentServerListener listener)
106     {
107                 if (listener_ == null)
108                         listener_ = listener;
109                 else
110                         listener_.set_delegate(listener);
111                 // Create the corresponding chain into the Container plugin chain
112
TheContainerConfigurator.get_instance().add_listener(listener.get_sub_listener());
113     }
114
115         /**
116          ** ComponentServer CallBack
117          ** <br> Configure the component server
118          **
119          ** @param component_server the component server to configure
120          **/

121     public void
122         configure_component_server(org.objectweb.openccm.Deployment.ComponentServerLocal component_server)
123     {
124                 if (listener_ != null)
125                         listener_.configure_component_server(component_server);
126                 component_server.add_listener(new org.objectweb.openccm.Deployment.listener.ComponentServerListenerDefault(component_server));
127     }
128
129         /**
130          ** Reset the ComponentServer plugin chain
131          **
132          **/

133         public void
134         reset()
135         {
136                 listener_ = null ;
137                 TheContainerConfigurator.get_instance().reset();
138         }
139 }
140
Popular Tags