KickJava   Java API By Example, From Geeks To Geeks.

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


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): Sylvain Leblanc___________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.binder;
28
29 //Importation of the needed packages
30

31 /**
32  * A connectinterfaceDeployer to establish interface connections.
33  *
34  * @author <a HREF="mailto:frederic.briclet@lifl.fr">Briclet Frederic</a>
35  *
36  * @version 0.1
37  */

38
39 public class ConnectinterfaceDeployer
40        extends ConnectinterfaceDeployerContext
41     {
42     // ==================================================================
43
//
44
// Internal state.
45
//
46
// ==================================================================
47
//Internal exception to warn of impossibility to resovle a reference
48
public class CannotResolveReferenceException extends Exception JavaDoc{};
49    
50     // ==================================================================
51
//
52
// Internal methods.
53
//
54
// ==================================================================
55
// ==================================================================
56
//
57
// Constructor.
58
//
59
// ==================================================================
60
// ==================================================================
61
//
62
// Public methods.
63
//
64
// ==================================================================
65

66
67     /**
68      * Establish the connectinterface connection.
69      *
70      * @throws ConnectInterfaceEstablishmentFailureException thrown if
71      * a problem occured during connecting.
72      */

73     public void deploy()
74     throws ConnectInterfaceEstablishmentFailureException
75     {
76          try{
77              org.omg.CORBA.Object JavaDoc providedObject=null ;
78              /*Proceed a Providesport tag*/
79              if(getProvidesportDeployer()!=null){
80                  providedObject = getProvidesportDeployer().getProvidedPort();
81              }/*Proceed the homeinterface tag*/
82              else if(getHomeinterfaceDeployer()!=null){
83                  providedObject =getHomeinterfaceDeployer().getHome();
84              }/*Proceed the component supported interface tag*/
85              else if(getComponentsupportedinterfaceDeployer()!=null){
86                  providedObject=getComponentsupportedinterfaceDeployer().resolveComponent();
87              }/*proceed the existing interface tag*/
88              else if(getExistinginterfaceDeployer()!=null){
89                  providedObject= getExistinginterfaceDeployer().getCorbaObject();
90              }
91                             
92              if(providedObject==null)
93                  throw new ConnectInterfaceEstablishmentFailureException(this,null);
94              
95               getUsesportDeployer().establishConnection(providedObject);
96
97          }
98          catch(Exception JavaDoc e)
99              {
100                throw new ConnectInterfaceEstablishmentFailureException(this,e);
101              }
102         getLifeCycleManager().stepEndedSuccessFully();
103     }
104     
105     /**
106      * Break the connectinterface.
107      *
108      * @exception ConnectInterfaceBrekingFailureException is thrown if a problem
109      * occured during disconnecting.
110      */

111     public void
112     tearDown()
113     throws ConnectInterfaceBreakingFailureException
114     {
115         try
116             {
117                 getUsesportDeployer().breakConnection();
118             }
119         catch(Exception JavaDoc e)
120             {
121                 throw new ConnectInterfaceBreakingFailureException(this,e);
122             }
123         getLifeCycleManager().stepEndedSuccessFully();
124     }
125
126 }
127
Popular Tags