KickJava   Java API By Example, From Geeks To Geeks.

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


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
27 package org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.installer;
28
29 //import the needed packages
30
import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.*;
31 import org.omg.Components.CCMHome;
32
33 /**
34  * ComponentplacementDeployer intiate components on an exiting home.
35  * @author <a HREF="mailto:frederic.briclet@lifl.fr">Briclet Frederic</a>
36  *
37  * @version 0.1
38  */

39 public class ComponentplacementDeployer
40     extends ComponentplacementDeployerContext
41     {
42     // ==================================================================
43
//
44
// Internal state.
45
//
46
// ==================================================================
47
private CCMHome homePlaced;
48     // ==================================================================
49
//
50
// Internal methods.
51
//
52
// ==================================================================
53

54     // ==================================================================
55
//
56
// Constructors
57
//
58
// ==================================================================
59

60     // ==================================================================
61
//
62
// Public methods.
63
//
64
// ==================================================================
65

66     /**
67     * Deploy is in charge to find the weeted home and instantiate
68     * components.
69     *
70     * @throws FatalDeploymentException if a fatal problem occured
71     */

72     public void deploy()
73     throws FatalDeploymentException
74     {
75         try {
76             homePlaced = getExistinghomeDeployer().resolveHome();
77         } catch (ExistingHomeResolutionFailureException e) {
78             getLifeCycleManager().stepAborded();
79             getErrorManager().submitException(e);
80             return;
81         }
82         traverse(this, getComponentinstantiationDeployer());
83         getLifeCycleManager().stepEndedSuccessFully();
84     }
85
86     /**
87     * Tear down the Componentplacement but does not remove the home
88     * @throws FatalDeploymentException if a fatal problem occured
89     */

90     public void
91     tearDown()
92     throws FatalDeploymentException
93     {
94         traverse(this, getComponentinstantiationDeployer());
95         getLifeCycleManager().stepEndedSuccessFully();
96     }
97     
98     /**
99      * Componentplacement visitor used if failure state
100      *
101      * @param comp The componentinstantiationdeployer to process
102      * @param status the current deployer status
103      * @throws FatalDeploymentException if a fatal problem occured
104      */

105     public void
106     visit(ComponentinstantiationDeployer comp,
107           DeployerFailureState status)
108     throws FatalDeploymentException
109     {
110         getLifeCycleManager().stepEndedSuccessFully();
111     }
112     /**
113      * The componentinstantiation visitor used to instantiate component.
114      *
115      * @param comp The componentinstantiationdeployer to process
116      * @param status the current deployer status
117      * @throws FatalDeploymentException if a fatal problem occured
118      */

119     public void
120     visit(ComponentinstantiationDeployer comp,
121           DeployerInactiveState status)
122     throws FatalDeploymentException
123     {
124         try {
125             comp.deploy(homePlaced);
126         } catch (ComponentInstantiationFailureException e) {
127             getErrorManager().submitException(e);
128         }
129
130     }
131     /**
132      * The componentinstantiation visitor used to tear_down component
133      * instante.
134      *
135      * @param comp The componentinstantiationdeployer to process
136      * @param status the current deployer status
137      * @throws FatalDeploymentException if a fatal problem occured
138      */

139     public void
140     visit(ComponentinstantiationDeployer comp,
141           DeployerActiveState status)
142     throws FatalDeploymentException
143     {
144         comp.tearDown();
145     }
146
147 }
148   
Popular Tags