KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > descriptor > componentassembly > ccm > deployer > registrar > RegisterwithhomefinderDeployerContext


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.registrar;
27
28 import org.objectweb.openccm.descriptor.componentassembly.Registerwithhomefinder;
29 import org.objectweb.openccm.descriptor.componentassembly.beans.RegisterwithhomefinderBean;
30 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.ChildDeployerContext;
31 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.InitializationError;
32 import org.objectweb.openccm.descriptor.softpkg.ccm.DescriptorDeployerInterface;
33 import org.omg.Components.HomeRegistration;
34
35 /**
36  * The registerwithhomefinder deployer context defines all the connection requires
37  * for the home registration
38  * @author <a HREF="mailto:briclet@lifl.fr">Briclet Frédéric</a>
39  *
40  * @version 0.1
41  */

42 public class RegisterwithhomefinderDeployerContext
43        extends ChildDeployerContext
44     {
45     // ==================================================================
46
//
47
// Internal state.
48
//
49
// ==================================================================
50
private RegisterwithhomefinderBean registerwithhomefinder;
51     private DescriptorDeployerInterface descriptorDeployer;
52     // ==================================================================
53
//
54
// Constructors.
55
//
56
// ==================================================================
57
// ==================================================================
58
//
59
// Internal methods.
60
//
61
// ==================================================================
62
// ==================================================================
63
//
64
// Public accessors methods.
65
//
66
// ==================================================================
67
/**
68      * @return
69      */

70     public Registerwithhomefinder
71     getRegisterwithhomefinder()
72     {
73         return registerwithhomefinder;
74     }
75
76     /**
77      * @param registerwithhomefinder
78      */

79     public void
80     connectRegisterwithhomefinder(RegisterwithhomefinderBean registerwithhomefinder)
81     {
82         this.registerwithhomefinder = registerwithhomefinder;
83         connectDeployerDescription(registerwithhomefinder);
84     }
85     
86     /**
87      * @return
88      */

89     public DescriptorDeployerInterface getDescriptorDeployer() {
90         return descriptorDeployer;
91     }
92
93     /**
94      * @param interface1
95      */

96     public void connectDescriptorDeployer(DescriptorDeployerInterface interface1) {
97         descriptorDeployer = interface1;
98     }
99                
100     public HomeRegistration
101     getHomeregistration()
102     {
103         return getRootDeployerContext().getHomeRegistration();
104     }
105     
106     /**
107      * This initialization method is used to check that all the services and
108      * information required to deploy are presents. If all is OK the deployer
109      * is put in inactive deployer state waiting for the deployment processing.
110      *
111      * @exception InitializationError is thrown if a problem is detected
112      */

113     public void initialize() throws InitializationError{
114        if(getRegisterwithhomefinder()==null)
115              getErrorManager()
116              .submitException(new InitializationError(this,"Connection on registerwithhomefinder bean is required"+
117                                          "check the handler code it must specify this connection"));
118                               
119        if(getRegisterwithhomefinder().getName()==null||
120           getRegisterwithhomefinder().getName().length()==0)
121                 getErrorManager()
122                 .submitException( new InitializationError(this,"The name attribute of the registerwithhomefinder element"+
123                                           "must be fullfilled, check its "+
124                                           "description\n."+getStringifiedDeployerDescription()));
125        if(getHomeregistration()==null)
126              getErrorManager()
127             .submitException(new InitializationError(this,"Connection on the current HomeFinder is required to make"+
128                                            "make homefinder registration change your findby description if"+
129                                            "if you cannot start it.\n"+getStringifiedDeployerDescription()));
130         getLifeCycleManager().stepEndedSuccessFully();
131    }
132
133
134 }
135
Popular Tags