ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/experimental/server/SampleConfigObtainer/SampleConfigObtainer.java
Revision: 1.1
Committed: Wed Nov 8 21:24:33 2000 UTC (24 years ago) by ajm
Branch: MAIN
Log Message:
initial checkin of first revision CORE

File Contents

# User Rev Content
1 ajm 1.1 //---PACKAGE DECLARATION---
2    
3     //---IMPORTS---
4     import core.*;
5     import org.omg.CORBA.*;
6     import org.omg.CosNaming.*;
7    
8     /**
9     * A quick class to test the Configurator and Configuration implementations
10     *
11     * @author $Author: ajm4 $
12     * @version $Id: TemplateClass.java,v 1.3 2000/11/08 19:15:05 ajm4 Exp $
13     */
14     class SampleConfigObtainer {
15    
16     //---FINAL ATTRIBUTES---
17    
18     /**
19     * The current CVS revision of this class
20     */
21     public static final String REVISION = "$Revision: 1.3 $";
22    
23     //---STATIC METHODS---
24    
25     public static void main(String[] args) {
26     try {
27     ORB orb = ORB.init(args, null);
28    
29     // something to hold objects
30     org.omg.CORBA.Object objRef = null;
31    
32     // get the Root POA
33     //objRef = orb.resolve_initial_references("RootPOA");
34     //POA poa = POAHelper.narrow(objRef);
35    
36     // get a hook to the name service
37     objRef = orb.resolve_initial_references("NameService");
38     NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
39    
40     // get a ref to the Configurator
41     objRef = ncRef.resolve(ncRef.to_name("iscream.Configurator"));
42     Configurator configurator = ConfiguratorHelper.narrow(objRef);
43    
44     // start the POA off
45     //poa.the_POAManager().activate();
46    
47     // the name of the test config
48     String config = "myconfig";
49    
50     // a test property to get
51     String testProperty = "test";
52    
53     System.out.println("Started:" + REVISION);
54     System.out.println("Trying to get Configuration " + config);
55    
56     // get the config
57     Configuration myConfig = configurator.getConfiguration(config);
58    
59     // did we?
60     if (myConfig == null) {
61     System.out.println("Failed: is it there?, can you read it?");
62     } else {
63    
64     System.out.println("Success.");
65     System.out.println("Trying to get property " + testProperty);
66    
67     // get the property
68     try {
69     System.out.println("Response:" + myConfig.getProperty(testProperty));
70     } catch (org.omg.CORBA.MARSHAL e) {
71     System.out.println("Caught org.omg.CORBA.MARSHAL, must be a null we got back");
72     }
73     }
74    
75     System.out.println("Finished");
76    
77     } catch (Exception e) {
78     System.err.println("TESTER ERROR: " + e);
79     e.printStackTrace(System.out);
80     }
81     }
82    
83     //---CONSTRUCTORS---
84    
85     //---PUBLIC METHODS---
86    
87     //---PRIVATE METHODS---
88    
89     //---ACCESSOR/MUTATOR METHODS---
90    
91     //---ATTRIBUTES---
92    
93     //---STATIC ATTRIBUTES---
94    
95     }