KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > coach > actor > Main


1 /***************************************************************************/
2 /* COACH: Component Based Open Source Architecture for */
3 /* Distributed Telecom Applications */
4 /* See: http://www.objectweb.org/ */
5 /* */
6 /* Copyright (C) 2003 Lucent Technologies Nederland BV */
7 /* Bell Labs Advanced Technologies - EMEA */
8 /* */
9 /* Initial developer(s): Harold Batteram */
10 /* */
11 /* This library is free software; you can redistribute it and/or */
12 /* modify it under the terms of the GNU Lesser General Public */
13 /* License as published by the Free Software Foundation; either */
14 /* version 2.1 of the License, or (at your option) any later version. */
15 /* */
16 /* This library is distributed in the hope that it will be useful, */
17 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
18 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
19 /* Lesser General Public License for more details. */
20 /* */
21 /* You should have received a copy of the GNU Lesser General Public */
22 /* License along with this library; if not, write to the Free Software */
23 /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
24 /***************************************************************************/
25 package org.coach.actor;
26
27 import java.io.*;
28
29 /** The java API's imports */
30
31 /**
32  * This class defines the main frame
33  *
34  * @author <a HREF="mailto:Jerome.Moroy@lifl.fr">Jerome Moroy</a>
35  * @version 0.1
36  */

37 public class Main {
38     /**
39      * Default constructor
40      */

41     public Main(File contextPropertyFile, File[] browserPropertyFile) {
42         System.out.println("Actor started");
43         // Adds the interface repository into the initial context
44
try {
45             org.omg.CORBA.Object JavaDoc o = org.objectweb.openccm.corba.TheORB.getORB().resolve_initial_references("InterfaceRepository");
46         } catch (org.omg.CORBA.ORBPackage.InvalidName JavaDoc e1) {
47             // IR is not started
48
}
49             
50         // Use Runtime.init to register value type factories
51
org.objectweb.openccm.corba.TheORB.register_value_factory(org.omg.Components.ComponentPortDescriptionHelper.id(),
52                                new org.objectweb.openccm.Components.ComponentPortDescriptionFactory());
53
54         org.objectweb.openccm.corba.TheORB.register_value_factory(org.omg.Components.ConfigValueHelper.id(),
55                                new org.objectweb.openccm.Components.ConfigValueFactory());
56
57         org.objectweb.openccm.corba.TheORB.register_value_factory(org.omg.Components.ConnectionDescriptionHelper.id(),
58                                new org.objectweb.openccm.Components.ConnectionDescriptionFactory());
59
60         org.objectweb.openccm.corba.TheORB.register_value_factory(org.omg.Components.ConsumerDescriptionHelper.id(),
61                                new org.objectweb.openccm.Components.ConsumerDescriptionFactory());
62
63         org.objectweb.openccm.corba.TheORB.register_value_factory(org.omg.Components.CookieHelper.id(),
64                                new org.objectweb.openccm.Components.CookieFactory());
65
66         org.objectweb.openccm.corba.TheORB.register_value_factory(org.omg.Components.EmitterDescriptionHelper.id(),
67                                new org.objectweb.openccm.Components.EmitterDescriptionFactory());
68
69         org.objectweb.openccm.corba.TheORB.register_value_factory(org.omg.Components.FacetDescriptionHelper.id(),
70                                new org.objectweb.openccm.Components.FacetDescriptionFactory());
71
72         org.objectweb.openccm.corba.TheORB.register_value_factory(org.omg.Components.FacetDescriptionHelper.id(),
73                                new org.objectweb.openccm.Components.FacetDescriptionFactory());
74
75         org.objectweb.openccm.corba.TheORB.register_value_factory(org.omg.Components.PublisherDescriptionHelper.id(),
76                                new org.objectweb.openccm.Components.PublisherDescriptionFactory());
77
78         org.objectweb.openccm.corba.TheORB.register_value_factory(org.omg.Components.ReceptacleDescriptionHelper.id(),
79                                new org.objectweb.openccm.Components.ReceptacleDescriptionFactory());
80
81         org.objectweb.openccm.corba.TheORB.register_value_factory(org.omg.Components.SubscriberDescriptionHelper.id(),
82                                new org.objectweb.openccm.Components.SubscriberDescriptionFactory());
83     
84         // Obtain the ORB.
85
org.omg.CORBA.ORB JavaDoc orb = org.objectweb.openccm.corba.TheORB.getORB();
86         org.coach.idltree.IdlNode.setOrb(orb);
87         
88         // Obtain the Name Service.
89
System.err.println("Actor: Obtaining the Name Service...");
90         try {
91             org.omg.CORBA.Object JavaDoc obj = orb.resolve_initial_references("NameService");
92             org.omg.CosNaming.NamingContext JavaDoc nc = org.omg.CosNaming.NamingContextHelper.narrow(obj);
93         } catch (org.omg.CORBA.ORBPackage.InvalidName JavaDoc e1) {
94             // NS is not started
95
}
96             
97         try {
98             org.coach.actor.namingBrowser.NameModel model = new org.coach.actor.namingBrowser.NameModel(orb);
99             org.coach.actor.namingBrowser.NameTree tree = new org.coach.actor.namingBrowser.NameTree(orb, model);
100             tree.setTitle("COACH NameServer Browser");
101         } catch (Throwable JavaDoc e) {
102             e.printStackTrace();
103         }
104     }
105 }
106
Popular Tags