KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > descriptor > componentassembly > ccm > deployer > root > ComponentassemblyDeployerHandler


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): Briclet Frédéric.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26 package org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.root;
27
28 // Local Interface Import Statements
29
import java.net.ServerSocket JavaDoc;
30 import org.ist.coach.DCI.AssemblyManager;
31 import org.ist.coach.DCI.DCIInformation;
32 import org.objectweb.openccm.descriptor.ZipEntryRetriever;
33 import org.objectweb.openccm.descriptor.componentassembly.beans.ComponentassemblyBeanImpl;
34 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.*;
35 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.binder.*;
36 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.installer.*;
37 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.managers.*;
38 import org.omg.Components.HomeFinder;
39 import org.omg.Components.HomeRegistration;
40 import org.omg.CosNaming.NamingContextExt JavaDoc;
41
42 /**
43  * The ComponentasemblydeployerHandler in charge to instantiate the component
44  * assemblyDeployer and setup all the connections required.
45  *
46  * @author <a HREF="mailto:briclet@lifl.fr">Briclet Frédéric</a>
47  *
48  * @version 0.1
49  */

50 public class ComponentassemblyDeployerHandler
51        extends HandlerBase
52     {
53     // ==================================================================
54
//
55
// Internal state.
56
//
57
// ==================================================================
58
private ComponentassemblyDeployer _deploy;
59     private NamingContextExt JavaDoc namingcontext;
60     private HomeFinder homefinder;
61     private HomeRegistration homeregistration;
62     private DCIInformation dciinfo;
63     private ZipEntryRetriever zipEntryRetriever;
64     private ServerSocket JavaDoc serverSocket;
65     private AssemblyManager assemblyManager;
66     private DeploymentLogger deploymentLogger;
67     private ErrorManager errorManager;
68     private DestinationDeployerFactory destinationDeployerFactory;
69     // ==================================================================
70
//
71
// Constructors.
72
//
73
// ==================================================================
74
// ==================================================================
75
//
76
// Internal methods.
77
//
78
// ==================================================================
79
// ==================================================================
80
//
81
// Public methods.
82
//
83
// ==================================================================
84
/**
85      * Produce the componentassemblydeployer deployer binded
86      * to the givean @param cai.
87      *
88      * @param cai The componentassembly bean
89      * @return the deployer produced in initialize state
90      * @throws InitializationError thrown if a problem is detected
91      */

92     public Object JavaDoc
93     getInstance(ComponentassemblyBeanImpl cai)
94     throws InitializationError
95     {
96         if(_deploy==null){
97             getDeploymentLogger().log("<<STEP1>> Begin the deployers instantiation/initialization");
98             _deploy=new ComponentassemblyDeployer();
99             _deploy.connectComponentassembly(cai);
100             DefaultLifeCycleManager dlcm=new DefaultLifeCycleManager();
101             _deploy.connectLifeCycleManager(dlcm);
102             dlcm.connectLogger(getDeploymentLogger());
103             dlcm.connectManagedDeployer(_deploy);
104             _deploy.connectDCIInformation(getDciinfo());
105             _deploy.connectNamingContextExt(getNamingcontext());
106             _deploy.connectHomeFinder(getHomefinder());
107             _deploy.connectHomeregistration(getHomeregistration());
108             _deploy.connectServerSocket(getServerSocket());
109             _deploy.connectZipEntryRetriever(getZipEntryRetriever());
110             _deploy.getZipEntryRetriever().connectStreamManager(_deploy);
111             _deploy.connectDeploymentLogger(getDeploymentLogger());
112             _deploy.connectErrorManager(getErrorManager());
113             _deploy.connectDestinationDeployerFactory(getDestinationDeployerFactory());
114             //dem.connectObservedDeployer(_deploy);
115

116             this.connectRootDeployerContext(_deploy);
117             
118             if(cai.getComponentfiles()!=null){
119                 ComponentfilesDeployer c=
120                           (ComponentfilesDeployer)getDeployer(cai.getComponentfiles());
121                  
122                  //TODO: Change the affectation of the root context
123
_deploy.connectComponentfilesDeployer(c);
124             }
125             
126             //according to the DTD partitioning cannot be empty or null
127
PartitioningDeployer p=(PartitioningDeployer)
128                                     getDeployer(cai.getPartitioning());
129                                    
130            _deploy.connectPartitioningDeployer(p);
131                                      
132             if(cai.getConnections()!=null){
133                 _deploy.connectConnectionsDeployer
134                     ((ConnectionsDeployer)getDeployer(cai.getConnections()));
135             }
136            
137             _deploy.initialize();
138             getDeploymentLogger().log("<</STEP1>>Deployers initialization ended");
139         }
140         return (_deploy);
141     }
142     
143     /**
144      * @param manager
145      */

146     public void
147     connectAssemblyManager(AssemblyManager manager)
148     {
149         assemblyManager = manager;
150     }
151
152     /**
153      * @param information
154      */

155     public void
156     connectDciinfo(DCIInformation information)
157     {
158         dciinfo = information;
159     }
160
161     /**
162      * @param finder
163      */

164     public void
165     connectHomefinder(HomeFinder finder)
166     {
167         homefinder = finder;
168     }
169
170     /**
171      * @param registration
172      */

173     public void
174     connectHomeregistration(HomeRegistration registration)
175     {
176         homeregistration = registration;
177     }
178
179     /**
180      * @param ext
181      */

182     public void
183     connectNamingcontext(NamingContextExt JavaDoc ext)
184     {
185         namingcontext = ext;
186     }
187
188     /**
189      * @param socket
190      */

191     public void
192     connectServerSocket(ServerSocket JavaDoc socket)
193     {
194         serverSocket = socket;
195     }
196
197     /**
198      * @param retriever
199      */

200     public void
201     connectZipEntryRetriever(ZipEntryRetriever retriever)
202     {
203         zipEntryRetriever = retriever;
204     }
205
206     /**
207      * @return
208      */

209     private AssemblyManager
210     getAssemblyManager()
211     {
212         return assemblyManager;
213     }
214
215     /**
216      * @return
217      */

218     private DCIInformation
219     getDciinfo()
220     {
221         return dciinfo;
222     }
223
224     /**
225      * @return
226      */

227     private HomeFinder
228     getHomefinder()
229     {
230         return homefinder;
231     }
232
233     /**
234      * @return
235      */

236     private HomeRegistration
237     getHomeregistration()
238     {
239         return homeregistration;
240     }
241
242     /**
243      * @return
244      */

245     private NamingContextExt JavaDoc
246     getNamingcontext()
247     {
248         return namingcontext;
249     }
250
251     /**
252      * @return
253      */

254     private ServerSocket JavaDoc
255     getServerSocket()
256     {
257         return serverSocket;
258     }
259
260     /**
261      * @return
262      */

263     private ZipEntryRetriever
264     getZipEntryRetriever()
265     {
266         return zipEntryRetriever;
267     }
268
269     /**
270      * @return
271      */

272     public DeploymentLogger
273     getDeploymentLogger()
274     {
275         return deploymentLogger;
276     }
277
278     /**
279      * @param logger
280      */

281     public void
282     connectDeploymentLogger(DeploymentLogger logger)
283     {
284         deploymentLogger = logger;
285     }
286
287     /**
288      * @return
289      */

290     public DestinationDeployerFactory
291     getDestinationDeployerFactory()
292     {
293         return destinationDeployerFactory;
294     }
295
296     /**
297      * @return
298      */

299     public ErrorManager
300     getErrorManager()
301     {
302         return errorManager;
303     }
304
305     /**
306      * @param factory
307      */

308     public void
309     connectDestinationDeployerFactory(DestinationDeployerFactory factory)
310     {
311         destinationDeployerFactory = factory;
312     }
313
314     /**
315      * @param manager
316      */

317     public void connectErrorManager(ErrorManager manager) {
318         errorManager = manager;
319     }
320
321 }
322
Popular Tags