KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > descriptor > componentassembly > ccm > deployer > binder > ConnectionsDeployer


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.binder;
28
29 // importation of the needed packages
30
import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.DeployerActiveState;
31 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.DeployerInactiveState;
32 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.FatalDeploymentException;
33
34 /**
35  * This deployer is in charge to build synchronous and asynchronous connections.
36  *
37  * @author <a HREF="mailto:briclet@lifl.fr">Briclet Frédéric</a>
38  *
39  * @version 0.1
40  */

41 public class ConnectionsDeployer
42        extends ConnectionsDeployerContext
43     {
44     
45     // ==================================================================
46
//
47
// Internal state.
48
//
49
// ==================================================================
50
// ==================================================================
51
//
52
// Constructor.
53
//
54
// ==================================================================
55
// ==================================================================
56
//
57
// Internal methods.
58
//
59
// ==================================================================
60
// ==================================================================
61
//
62
// Public methods.
63
//
64
// ==================================================================
65

66     /**
67      * establishes all the synchronous and asynchronous connections
68      * @exception FatalDeploymentException is thrown if a connection
69      * failed.
70      */

71     public void
72     deploy()
73     throws FatalDeploymentException
74     {
75         // browse the connectinterface list
76
traverse(this,getConnectinterfaceDeployers());
77         //browse the connectevent list
78
traverse(this,getConnecteventDeployers());
79         getLifeCycleManager().stepEndedSuccessFully();
80     }
81     
82     /**
83      * The visitor method to establish event connection.
84      *
85      * @param deployer The event deployer to proceed.
86      * @param status The status of the current deployer.
87      * @throws FatalDeploymentException is thrown if a fatal problem occured
88      */

89     public void
90     visit(ConnecteventDeployer deployer, DeployerInactiveState status)
91     throws FatalDeploymentException
92     {
93         try{
94             deployer.deploy();
95         }
96         catch(ConnectEventEstablishmentFailureException e){
97                 getErrorManager().submitException(e);
98         }
99     }
100     
101     /**
102      * The visitor method to establish interface connection.
103      *
104      * @param deployer The event deployer to proceed.
105      * @param status The status of the current deployer.
106      * @throws FatalDeploymentException is thrown if a fatal problem occured
107      */

108     public void
109     visit(ConnectinterfaceDeployer deployer,DeployerInactiveState status)
110     throws FatalDeploymentException{
111         try{
112             deployer.deploy();
113         }
114         catch(ConnectInterfaceEstablishmentFailureException e){
115                         getErrorManager().submitException(e);
116         }
117
118     }
119     /**
120      * Tear down all the connection.
121      * @param FatalDeploymentException is thrown if a problem occured
122      * during disconnecting.
123      */

124     public void
125     tearDown()
126     throws FatalDeploymentException
127     {
128        traverse(this,getConnectinterfaceDeployers());
129        traverse(this,getConnecteventDeployers());
130        getLifeCycleManager().stepEndedSuccessFully();
131     }
132     
133     /**
134      * The visitor method to establish event connection.
135      *
136      * @param deployer The event deployer to proceed.
137      * @param status The status of the current deployer.
138      * @throws FatalDeploymentException is thrown if a fatal problem occured
139      */

140     public void visit(ConnecteventDeployer deployer, DeployerActiveState status)
141     throws FatalDeploymentException{
142         try{
143             deployer.tearDown();
144         }
145         catch(ConnectEventBreakingFailureException e){
146             getErrorManager().submitException(e);
147         }
148     }
149     
150     /**
151      * The visitor method to break interface connection.
152      *
153      * @param deployer The event deployer to proceed.
154      * @param status The status of the current deployer.
155      * @throws FatalDeploymentException is thrown if a fatal problem occured
156      */

157     public void visit(ConnectinterfaceDeployer deployer,DeployerActiveState status)
158     throws FatalDeploymentException{
159         try{
160             deployer.tearDown();
161         }
162         catch(ConnectInterfaceBreakingFailureException e){
163               getErrorManager().submitException(e);
164         }
165
166     }
167     
168 }
169
Popular Tags