KickJava   Java API By Example, From Geeks To Geeks.

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


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
29 import java.util.LinkedList JavaDoc;
30 import org.objectweb.openccm.descriptor.componentassembly.Componentplacement;
31 import org.objectweb.openccm.descriptor.componentassembly.beans.ComponentplacementBean;
32 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.*;
33
34 /**
35  * The componentplacement deployer context defines all the connection requires for
36  * install a component.
37  *
38  * @author <a HREF="mailto:briclet@lifl.fr">Briclet Frédéric</a>
39  *
40  * @version 0.1
41  */

42 public class ComponentplacementDeployerContext
43        extends ChildDeployerContext
44     {
45     // ==================================================================
46
//
47
// Internal state.
48
//
49
// ==================================================================
50
private ExistinghomeDeployer existinghome;
51     private ComponentplacementBean componentPlacement;
52     private LinkedList JavaDoc componentInstantiations;
53     // ==================================================================
54
//
55
// Constructors.
56
//
57
// ==================================================================
58
public ComponentplacementDeployerContext(){
59         this.componentInstantiations=new LinkedList JavaDoc();
60     }
61     // ==================================================================
62
//
63
// Internal methods.
64
//
65
// ==================================================================
66
// ==================================================================
67
//
68
// Public accesors methods.
69
//
70
// ==================================================================
71

72     
73     
74     public void
75     connectComponentplacement(ComponentplacementBean componentPlacement)
76     {
77         this.componentPlacement=componentPlacement;
78         connectDeployerDescription(componentPlacement);
79     }
80     
81     public Componentplacement
82     getComponentplacement()
83     {
84         return componentPlacement;
85     }
86     
87     public void
88     connectExistinghomeDeployer(ExistinghomeDeployer existinghome)
89     {
90         this.existinghome=existinghome;
91     }
92     
93     public ExistinghomeDeployer
94     getExistinghomeDeployer()
95     {
96         return existinghome;
97     }
98     
99     public void
100     connectComponentinstantiationDeployer
101     (ComponentinstantiationDeployer componentInstantiation)
102     {
103         this.componentInstantiations.addLast(componentInstantiation);
104     }
105     
106     public ComponentinstantiationDeployer[]
107     getComponentinstantiationDeployer()
108     {
109         return (ComponentinstantiationDeployer [])
110                 componentInstantiations.toArray
111                 (new ComponentinstantiationDeployer[componentInstantiations.size()]);
112     }
113     /**
114      * This initialization method is used to check that all the services and
115      * information required to deploy are presents. If all is OK the deployer
116      * is put in inactive deployer state waiting for the deployment processing.
117      *
118      * @exception InitializationError is thrown if a problem is detected
119      */

120     public void
121     initialize()
122     throws InitializationError
123     {
124         if(getComponentplacement()==null)
125             getErrorManager()
126            .submitException( new InitializationError(this,"Connection on componentplacement bean is required"+
127                                           "check the handler code it must specify this connection"));
128                                           
129         if(getComponentinstantiationDeployer().length==0){
130             getErrorManager()
131            .submitException(new InitializationError(this,"At least one componentinstantiation must be specified in"+
132                                           "componentplacement element check you componentplacement element"+
133                                           "description.\n"+getStringifiedDeployerDescription()));
134         }
135           
136         if(getExistinghomeDeployer()==null)
137                 getErrorManager()
138                .submitException(new InitializationError(this,"The existinghome element must be specified in"+
139                                           "componentplacement element check you componentplacement element"+
140                                           "description."+getStringifiedDeployerDescription()));
141         getLifeCycleManager().stepEndedSuccessFully();
142     }
143     
144 }
145
146
Popular Tags