~ubuntu-branches/ubuntu/breezy/ace/breezy

« back to all changes in this revision

Viewing changes to TAO/performance-tests/Cubit/TAO/IDL_Cubit/IDL_Cubit_Client.java

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad, Benjamin Montgomery, Adam Conrad
  • Date: 2005-09-18 22:51:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge) (0.1.2 woody)
  • Revision ID: james.westby@ubuntu.com-20050918225138-seav22q6fyylb536
Tags: 5.4.7-3ubuntu1
[ Benjamin Montgomery ]
* Added a patch for amd64 and powerpc that disables the compiler
  option -fvisibility-inlines-hidden

[ Adam Conrad ]
* Added DPATCH_OPTION_CPP=1 to debian/patches/00options to make
  Benjamin's above changes work correctly with dpatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// IDL_Cubit_Client.java,v 1.1 1998/09/16 00:26:33 schmidt Exp
2
 
//
3
 
// ============================================================================
4
 
// 
5
 
// = FILENAME
6
 
//    IDL_Cubit_Client.java
7
 
//
8
 
// = AUTHOR
9
 
//    Michael Kircher (mk1@cs.wustl.edu)
10
 
//
11
 
// = DESCRIPTION
12
 
//   Connects to the cubit factory, gets a cubit object and
13
 
//   calls the cube_short method on it. The purpose of this
14
 
//   class is to demonstrate how to use the JavaIDL ORB to access
15
 
//   TAO.
16
 
//
17
 
// ============================================================================
18
 
 
19
 
 
20
 
public class IDL_Cubit_Client
21
 
{
22
 
  
23
 
  private org.omg.CORBA.ORB orb_;
24
 
  private org.omg.CORBA.Object naming_service_object_;
25
 
 
26
 
  public void init (String[] args)
27
 
    {
28
 
      try {      
29
 
        
30
 
        orb_ = org.omg.CORBA.ORB.init (args, null);
31
 
                
32
 
        // Get the Naming Service initial reference
33
 
 
34
 
        System.out.println ("Using the lookup protocol!");
35
 
        NS_Resolve ns_resolve = new NS_Resolve ();
36
 
        naming_service_object_ = ns_resolve.resolve_name_service (orb_);
37
 
        
38
 
      } 
39
 
      catch(org.omg.CORBA.SystemException e) {
40
 
        System.err.println ("PushConsumerFactory constructor: ORB and Name Service initialization");
41
 
        System.err.println(e);
42
 
      } 
43
 
      
44
 
    }
45
 
  
46
 
  
47
 
  public void run ()
48
 
    {
49
 
      try
50
 
        {
51
 
          
52
 
          // Get the Naming Context to allow resolving the EventService and
53
 
          // ScheduleService
54
 
          CosNaming.NamingContext naming_context = 
55
 
            CosNaming.NamingContextHelper.narrow (naming_service_object_);
56
 
          
57
 
          if (naming_context == null)
58
 
            {
59
 
              System.err.println ("The Naming Context is null");
60
 
              System.exit (1);
61
 
            }
62
 
          System.out.println ("Reference to the Naming Service is ok.");
63
 
 
64
 
          CosNaming.NameComponent[] cubit_factory_name = new CosNaming.NameComponent[2];
65
 
          cubit_factory_name[0] = new CosNaming.NameComponent ("IDL_Cubit","");
66
 
          cubit_factory_name[1] = new CosNaming.NameComponent ("cubit_factory","");
67
 
          org.omg.CORBA.Object factory_obj = naming_context.resolve (cubit_factory_name);
68
 
          
69
 
          if (factory_obj == null)
70
 
            {
71
 
              System.err.println ("Factory object is nil!");
72
 
              return;
73
 
            }
74
 
          
75
 
          Cubit_Factory cubit_Factory = Cubit_FactoryHelper.narrow (factory_obj);
76
 
          
77
 
          Cubit cubit = cubit_Factory.make_cubit ("key0");
78
 
 
79
 
          short x = 4;
80
 
          
81
 
          System.out.println ("The call cube_short (4) results in: " +cubit.cube_short (x));      
82
 
          
83
 
        }
84
 
      catch (CosNaming.NamingContextPackage.CannotProceed e)
85
 
        {
86
 
          System.err.println ("CosNaming.NamingContextPackage.CannotProceed");
87
 
          System.err.println (e);
88
 
        }
89
 
      catch (CosNaming.NamingContextPackage.InvalidName e)
90
 
        {
91
 
          System.err.println ("CosNaming.NamingContextPackage.InvalidName");
92
 
          System.err.println (e);
93
 
        }
94
 
      catch (CosNaming.NamingContextPackage.NotFound e)
95
 
        {
96
 
          System.err.println ("CosNaming.NamingContextPackage.NotFound");
97
 
          System.err.println (e);       
98
 
        }
99
 
      catch(org.omg.CORBA.SystemException e) 
100
 
        {
101
 
          System.err.println ("PushConsumerFactory.run: Failure");
102
 
          System.err.println(e);
103
 
        }       
104
 
    }    
105
 
 
106
 
  public static void main (String[] args) {      
107
 
    
108
 
    IDL_Cubit_Client cubit_Client = new IDL_Cubit_Client ();
109
 
    cubit_Client.init (args);
110
 
    
111
 
    cubit_Client.run ();
112
 
  }  
113
 
 
114
 
 
115
 
} // public class IDL_Cubit_Client
116
 
 
117
 
 
118
 
 
119
 
 
120
 
 
121
 
 
122