KickJava   Java API By Example, From Geeks To Geeks.

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


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.Hostcollocation;
31 import org.objectweb.openccm.descriptor.componentassembly.beans.HostcollocationBean;
32 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.ChildDeployerContext;
33 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.InitializationError;
34
35 /**
36  * The hostcollocation deployer context defines all the connection requires for
37  * deploy a homeplacement collocation.
38  *
39  * @author <a HREF="mailto:briclet@lifl.fr">Briclet Frédéric</a>
40  *
41  * @version 0.1
42  */

43 public class HostcollocationDeployerContext
44        extends ChildDeployerContext
45     {
46     // ==================================================================
47
//
48
// Internal state.
49
//
50
// ==================================================================
51
private HostcollocationBean hostcollocation;
52     private LinkedList JavaDoc homeplacementDeployers;
53     private DestinationDeployer destinationDeployer;
54     
55     // ==================================================================
56
//
57
// Constructors.
58
//
59
// ==================================================================
60
public HostcollocationDeployerContext(){
61         this.homeplacementDeployers=new LinkedList JavaDoc();
62     }
63     // ==================================================================
64
//
65
// Internal methods.
66
//
67
// ==================================================================
68
// ==================================================================
69
//
70
// Public accessors methods.
71
//
72
// ==================================================================
73

74     public void connectHostcollocation(HostcollocationBean hostcollocation){
75         this.hostcollocation=hostcollocation;
76         connectDeployerDescription(hostcollocation);
77     }
78     
79     public Hostcollocation
80     getHostcollocation()
81     {
82         return hostcollocation;
83     }
84     
85     public void
86     connectHomeplacementDeployer(HomeplacementDeployer home)
87     {
88         this.homeplacementDeployers.addLast(home);
89     }
90     
91     public HomeplacementDeployer[]
92     getHomeplacementDeployers()
93     {
94         return (HomeplacementDeployer[])
95                 homeplacementDeployers.toArray
96                 (new HomeplacementDeployer[homeplacementDeployers.size()]);
97     }
98     /**
99      * @return
100      */

101     public DestinationDeployer
102     getDestinationDeployer()
103     {
104         return destinationDeployer;
105     }
106
107     /**
108      * @param deployer
109      */

110     public void
111     connectDestinationDeployer(DestinationDeployer deployer)
112     {
113         destinationDeployer = deployer;
114     }
115     /**
116      * This initialization method is used to check that all the services and
117      * information required to deploy are presents. If all is OK the deployer
118      * is put in inactive deployer state waiting for the deployment processing.
119      *
120      * @exception InitializationError is thrown if a problem is detected
121      */

122     public void
123     initialize()
124     throws InitializationError
125     {
126         if(getHostcollocation()==null)
127              getErrorManager()
128             .submitException(new InitializationError(this,"Connection on hostcollocation bean is required"+
129                                           "check the handler code it must specify this connection"));
130         if(getHostcollocation().getDestination()==null)
131             getErrorManager()
132             .submitException(new InitializationError(this,"The destination element must be precised into"+
133                                                           "an hostcollocation\n"+getStringifiedDeployerDescription()));
134         if(getHomeplacementDeployers().length==0)
135              getErrorManager()
136             .submitException(new InitializationError(this,"At least one homeplacement child must be specified "+
137                                           "check the hostcollocation element"+
138                                           "description\n."+getStringifiedDeployerDescription()));
139         getLifeCycleManager().stepEndedSuccessFully();
140    }
141
142
143 }
Popular Tags