KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > descriptor > componentassembly > ccm > deployer > installer > HomeplacementDeployerContext


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.installer;
27
28 import java.util.LinkedList JavaDoc;
29
30 import org.objectweb.openccm.descriptor.componentassembly.Homeplacement;
31 import org.objectweb.openccm.descriptor.componentassembly.beans.HomeplacementBean;
32 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.ChildDeployerContext;
33 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.InitializationError;
34 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.registrar.*;
35 import org.objectweb.openccm.descriptor.softpkg.ccm.ImplementationDeployer;
36 import org.objectweb.openccm.descriptor.softpkg.ccm.SoftpkgDeployer;
37
38 /**
39  * The homeplacement deployer context defines all the connection requires for
40  * the installation of a home.
41  *
42  * @author <a HREF="mailto:briclet@lifl.fr">Briclet Frédéric</a>
43  *
44  * @version 0.1
45  */

46 public class HomeplacementDeployerContext
47        extends ChildDeployerContext
48     {
49     // ==================================================================
50
//
51
// Internal state.
52
//
53
// ==================================================================
54
private HomeplacementBean homeplacement;
55     private HomeplacementDeployInfo homeplacementInfo;
56     private LinkedList JavaDoc componentInstantiationDeployers;
57     private LinkedList JavaDoc registerwithhomefinderDeployers;
58     private LinkedList JavaDoc registerwithnamingDeployers;
59     private LinkedList JavaDoc registerwithtraderDeployers;
60     private ImplementationDeployer implementationDeployer;
61     private SoftpkgDeployer softpkgDeployer;
62     private DestinationDeployer destinationDeployer;
63
64     // ==================================================================
65
//
66
// Constructors.
67
//
68
// ==================================================================
69
public HomeplacementDeployerContext()
70     {
71         componentInstantiationDeployers = new LinkedList JavaDoc();
72         registerwithhomefinderDeployers = new LinkedList JavaDoc();
73         registerwithnamingDeployers = new LinkedList JavaDoc();
74         registerwithtraderDeployers = new LinkedList JavaDoc();
75     }
76     // ==================================================================
77
//
78
// Internal methods.
79
//
80
// ==================================================================
81
// ==================================================================
82
//
83
// Public accessors methods.
84
//
85
// ==================================================================
86
public void
87     connectRegisterwithhomefinderDeployer(RegisterwithhomefinderDeployer reg)
88     {
89         this.registerwithhomefinderDeployers.addLast(reg);
90     }
91
92     public RegisterwithhomefinderDeployer[]
93     getRegisterwithhomefinderDeployers()
94     {
95         return (
96             RegisterwithhomefinderDeployer[]) registerwithhomefinderDeployers
97                 .toArray(
98             new RegisterwithhomefinderDeployer[registerwithhomefinderDeployers
99                 .size()]);
100     }
101
102     public void
103     connectRegisterwithtraderDeployer(RegisterwithtraderDeployer reg)
104     {
105         this.registerwithtraderDeployers.addLast(reg);
106     }
107
108     public RegisterwithtraderDeployer[]
109     getRegisterwithtraderDeployers()
110     {
111         return (
112             RegisterwithtraderDeployer[]) registerwithtraderDeployers.toArray(
113             new RegisterwithtraderDeployer[registerwithtraderDeployers.size()]);
114     }
115
116     public void
117     connectRegisterwithnamingDeployer(RegisterwithnamingDeployer reg)
118     {
119         this.registerwithnamingDeployers.addLast(reg);
120     }
121
122     public RegisterwithnamingDeployer[]
123     getRegisterwithnamingDeployers()
124     {
125         return (
126             RegisterwithnamingDeployer[]) registerwithnamingDeployers.toArray(
127             new RegisterwithnamingDeployer[registerwithnamingDeployers.size()]);
128     }
129
130     public void
131     connectHomeplacement(HomeplacementBean homeplacement)
132     {
133         this.homeplacement = homeplacement;
134         connectDeployerDescription(homeplacement);
135     }
136
137     public Homeplacement
138     getHomeplacement()
139     {
140         return homeplacement;
141     }
142
143     public void
144     connectComponentInstantiationDeployer(ComponentinstantiationDeployer componentInstantiationDeployer)
145     {
146         this.componentInstantiationDeployers.addLast(
147             componentInstantiationDeployer);
148     }
149
150     public ComponentinstantiationDeployer[]
151     getComponentInstantiationDeployers()
152     {
153         return (
154             ComponentinstantiationDeployer[]) componentInstantiationDeployers
155                 .toArray(
156             new ComponentinstantiationDeployer[componentInstantiationDeployers
157                 .size()]);
158     }
159     /**
160      * @return
161      */

162     public ImplementationDeployer
163     getImplementationDeployer()
164     {
165         return implementationDeployer;
166     }
167
168     /**
169      * @param deployer
170      */

171     public void
172     connectImplementationDeployer(ImplementationDeployer deployer)
173     {
174         implementationDeployer = deployer;
175     }
176
177     /**
178      * @return
179      */

180     public SoftpkgDeployer
181     getSoftpkgDeployer()
182     {
183         return softpkgDeployer;
184     }
185
186     /**
187      * @param deployer
188      */

189     public void
190     connectSoftpkgDeployer(SoftpkgDeployer deployer)
191     {
192         softpkgDeployer = deployer;
193     }
194
195     /**
196         * @return
197         */

198     public DestinationDeployer
199     getDestinationDeployer()
200     {
201         return destinationDeployer;
202     }
203
204     /**
205      * @param deployer
206      */

207     public void
208     connectDestinationDeployer(DestinationDeployer deployer)
209     {
210         destinationDeployer = deployer;
211     }
212
213     /**
214      * @return
215      */

216     public HomeplacementDeployInfo
217     getHomeplacementInfo()
218     {
219         return homeplacementInfo;
220     }
221
222     /**
223      * @param handler
224      */

225     public void
226     connectHomeplacementInfo(HomeplacementDeployInfo handler)
227     {
228         homeplacementInfo = handler;
229     }
230     
231     /**
232      * This initialization method is used to check that all the services and
233      * information required to deploy are presents. If all is OK the deployer
234      * is put in inactive deployer state waiting for the deployment processing.
235      *
236      * @exception InitializationError is thrown if a problem is detected
237      */

238     public void
239     initialize()
240     throws InitializationError
241     {
242         if (getHomeplacement() == null)
243             getErrorManager().submitException(
244                 new InitializationError(
245                     this,
246                     "Connection on homeplacement bean is required"
247                         + "check the handler code it must specify this connection"));
248         if (getHomeplacement().getComponentfileref() == null
249             || getHomeplacement().getComponentfileref().getIdref() == null
250             || getHomeplacement().getComponentfileref().getIdref().length() == 0)
251             getErrorManager().submitException(
252                 new InitializationError(
253                     this,
254                     "The homeplacement element must be fullfilled "
255                         + "including its idref attribute, check the homeplacement element"
256                         + "description\n."
257                         + getStringifiedDeployerDescription()));
258         if(getDestinationDeployer()==null)
259             getErrorManager().submitException(
260                 new InitializationError(
261                     this,
262                     "The homeplacement requires a Destination to be installed "
263                         + "check the homeplacement element description\n."
264                         + getStringifiedDeployerDescription()));
265                         
266         getLifeCycleManager().stepEndedSuccessFully();
267     }
268
269
270 }
271
Popular Tags