KickJava   Java API By Example, From Geeks To Geeks.

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


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.Partitioning;
31 import org.objectweb.openccm.descriptor.componentassembly.beans.PartitioningBean;
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  *
37  * The partitioningdeployer context defines all the connection requires for
38  * processing a partitioning.
39  *
40  * @author <a HREF="mailto:briclet@lifl.fr">Briclet Frédéric</a>
41  *
42  * @version 0.1
43  */

44 public class PartitioningDeployerContext extends ChildDeployerContext {
45     // ==================================================================
46
//
47
// Internal state.
48
//
49
// ==================================================================
50
private LinkedList JavaDoc homeplacement;
51     private LinkedList JavaDoc componentplacement;
52     private LinkedList JavaDoc hostcollocation;
53     private LinkedList JavaDoc processcollocation;
54     private PartitioningBean partitioning;
55     // ==================================================================
56
//
57
// Constructors.
58
//
59
// ==================================================================
60
public PartitioningDeployerContext() {
61         homeplacement = new LinkedList JavaDoc();
62         componentplacement = new LinkedList JavaDoc();
63         hostcollocation = new LinkedList JavaDoc();
64         processcollocation = new LinkedList JavaDoc();
65     }
66     // ==================================================================
67
//
68
// Internal methods.
69
//
70
// ==================================================================
71
// ==================================================================
72
//
73
// Public accessors methods.
74
//
75
// ==================================================================
76
public void
77     connectHomeplacementDeployer(HomeplacementDeployer homeplacement)
78     {
79         this.homeplacement.addLast(homeplacement);
80     }
81     public HomeplacementDeployer[]
82     getHomeplacementDeployers()
83     {
84         return (HomeplacementDeployer[]) this.homeplacement.toArray(
85             new HomeplacementDeployer[homeplacement.size()]);
86     }
87
88     public void
89     connectComponentplacementDeployer(ComponentplacementDeployer componentplacement)
90     {
91         this.componentplacement.addLast(componentplacement);
92     }
93
94     public ComponentplacementDeployer[]
95     getComponentplacementDeployers()
96     {
97         return (ComponentplacementDeployer[]) this.componentplacement.toArray(
98             new ComponentplacementDeployer[componentplacement.size()]);
99     }
100
101     public void
102     connectHostcollocationDeployer(HostcollocationDeployer hostcollocation)
103     {
104         this.hostcollocation.addLast(hostcollocation);
105     }
106
107     public HostcollocationDeployer[]
108     getHostcollocationDeployers()
109     {
110         return (HostcollocationDeployer[]) this.hostcollocation.toArray(
111             new HostcollocationDeployer[hostcollocation.size()]);
112     }
113
114     public void
115     connectProcesscollocationDeployer(ProcesscollocationDeployer processcollocation)
116     {
117         this.processcollocation.addLast(processcollocation);
118     }
119
120     public ProcesscollocationDeployer[]
121     getProcesscollocationDeployers()
122     {
123         return (ProcesscollocationDeployer[]) this.processcollocation.toArray(
124             new ProcesscollocationDeployer[processcollocation.size()]);
125     }
126     /**
127      * @return
128      */

129     public Partitioning
130     getPartitioning()
131     {
132         return partitioning;
133     }
134
135     /**
136      * @param partitioning
137      */

138     public void
139     connectPartitioning(PartitioningBean partitioning)
140     {
141         this.partitioning = partitioning;
142         connectDeployerDescription(partitioning);
143     }
144     /**
145      * This initialization method is used to check that all the services and
146      * information required to deploy are presents. If all is OK the deployer
147      * is put in inactive deployer state waiting for the deployment processing.
148      *
149      * @exception InitializationError is thrown if a problem is detected
150      */

151     public void
152     initialize()
153     throws InitializationError
154     {
155         if (getPartitioning() == null)
156             getErrorManager().submitException(
157                 new InitializationError(
158                     this,
159                     "Connection on partitioning bean is required"
160                         + "check the handler code it must specify this connection"));
161         if (getHomeplacementDeployers().length == 0
162             && getComponentplacementDeployers().length == 0
163             && getHostcollocationDeployers().length == 0
164             && getProcesscollocationDeployers().length == 0)
165             getErrorManager().submitException(
166                 new InitializationError(
167                     this,
168                     "At least one of homeplacement/hostcollocation/processcollocation/"
169                         + "componentplacement/hostcollation children must be specified "
170                         + "check the partitioning element"
171                         + "description\n."
172                         + getStringifiedDeployerDescription()));
173         getLifeCycleManager().stepEndedSuccessFully();
174     }
175
176
177 }
178
Popular Tags