KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > Component > DCUP > ComponentBuilderImpl


1 /* $Id: ComponentBuilderImpl.java,v 1.1.1.1 2003/02/11 16:19:40 bures Exp $ */
2 package SOFA.Component.DCUP;
3
4 /** Base implementation of the component builder.
5   *
6   * @author Petr Hnetynka
7   */

8 abstract public class ComponentBuilderImpl implements ComponentBuilder {
9   /** Component manager. */
10   protected SOFA.Component.ComponentManager cm;
11   /** Deployment desciptor of the component. */
12   protected SOFA.SOFAnode.Run.Deployment.DeploymentDescriptor dd;
13   /** If component can be updated. */
14   protected boolean updatable;
15   /** Full instance name */
16   protected String JavaDoc fullInstanceName;
17
18   /** Flag if component is stopped. */
19   public boolean stopped;
20
21   public void initialize(SOFA.Component.ComponentManager cm, SOFA.SOFAnode.Run.Deployment.DeploymentDescriptor dd) throws SOFA.Component.ComponentLifecycleException {
22     this.cm = cm;
23     this.dd = dd;
24     fullInstanceName = dd.getInstanceName()+":"+dd.getInstanceId();
25     updatable = false;
26     stopped = false;
27   }
28   
29   /** Creates connector to component manager from reference to it.
30     * @param ref reference to CM
31     * @return connector to CM
32     * @exception SOFA.Component.InstantiationException prob. bad reference
33     */

34   protected DCUPComponentManager getCMConnectorFromRef(SOFA.Connector.Reference ref) throws SOFA.Component.InstantiationException {
35     SOFA.Component.DCUP.DCUPComponentManager aplcm = null;
36     try {
37       aplcm = (SOFA.Component.DCUP.DCUPComponentManager) SOFA.Connector.Boot.DCUPComponentManagerConnector.createClt(ref);
38     } catch (SOFA.Connector.ConnectorException e) {
39       throw new SOFA.Component.InstantiationException("Can't create connector to component manger", e);
40     }
41     return aplcm;
42   }
43
44   public boolean isUpdatable() {
45     return updatable;
46   }
47
48   public boolean isStopped() {
49     return stopped;
50   }
51 }
52
Popular Tags