KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > spi > presentation > rmi > StubWrapper


1 /*
2  * @(#)StubWrapper.java 1.4 04/07/27
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.corba.se.spi.presentation.rmi ;
9
10 import java.rmi.RemoteException JavaDoc ;
11
12 import org.omg.CORBA.portable.Delegate JavaDoc ;
13 import org.omg.CORBA.ORB JavaDoc ;
14 import org.omg.CORBA.Request JavaDoc ;
15 import org.omg.CORBA.Context JavaDoc ;
16 import org.omg.CORBA.NamedValue JavaDoc ;
17 import org.omg.CORBA.NVList JavaDoc ;
18 import org.omg.CORBA.ContextList JavaDoc ;
19 import org.omg.CORBA.ExceptionList JavaDoc ;
20 import org.omg.CORBA.Policy JavaDoc ;
21 import org.omg.CORBA.DomainManager JavaDoc ;
22 import org.omg.CORBA.SetOverrideType JavaDoc ;
23
24 import org.omg.CORBA.portable.OutputStream JavaDoc ;
25
26 /** Wrapper that can take any stub (object x such that StubAdapter.isStub(x))
27  * and treat it as a DynamicStub.
28  */

29 public class StubWrapper implements DynamicStub
30 {
31     private org.omg.CORBA.Object JavaDoc object ;
32
33     public StubWrapper( org.omg.CORBA.Object JavaDoc object )
34     {
35     if (!(StubAdapter.isStub(object)))
36         throw new IllegalStateException JavaDoc() ;
37
38     this.object = object ;
39     }
40
41     public void setDelegate( Delegate JavaDoc delegate )
42     {
43     StubAdapter.setDelegate( object, delegate ) ;
44     }
45
46     public Delegate JavaDoc getDelegate()
47     {
48     return StubAdapter.getDelegate( object ) ;
49     }
50
51     public ORB JavaDoc getORB()
52     {
53     return StubAdapter.getORB( object ) ;
54     }
55
56     public String JavaDoc[] getTypeIds()
57     {
58     return StubAdapter.getTypeIds( object ) ;
59     }
60
61     public void connect( ORB JavaDoc orb ) throws RemoteException JavaDoc
62     {
63     StubAdapter.connect( object, (com.sun.corba.se.spi.orb.ORB)orb ) ;
64     }
65
66     public boolean isLocal()
67     {
68     return StubAdapter.isLocal( object ) ;
69     }
70
71     public OutputStream JavaDoc request( String JavaDoc operation, boolean responseExpected )
72     {
73     return StubAdapter.request( object, operation, responseExpected ) ;
74     }
75
76     public boolean _is_a(String JavaDoc repositoryIdentifier)
77     {
78     return object._is_a( repositoryIdentifier ) ;
79     }
80
81     public boolean _is_equivalent(org.omg.CORBA.Object JavaDoc other)
82     {
83     return object._is_equivalent( other ) ;
84     }
85
86     public boolean _non_existent()
87     {
88     return object._non_existent() ;
89     }
90
91     public int _hash(int maximum)
92     {
93     return object._hash( maximum ) ;
94     }
95
96     public org.omg.CORBA.Object JavaDoc _duplicate()
97     {
98     return object._duplicate() ;
99     }
100
101     public void _release()
102     {
103     object._release() ;
104     }
105
106     public org.omg.CORBA.Object JavaDoc _get_interface_def()
107     {
108     return object._get_interface_def() ;
109     }
110
111     public Request JavaDoc _request(String JavaDoc operation)
112     {
113     return object._request( operation ) ;
114     }
115
116     public Request JavaDoc _create_request( Context JavaDoc ctx, String JavaDoc operation, NVList JavaDoc arg_list,
117     NamedValue JavaDoc result)
118     {
119     return object._create_request( ctx, operation, arg_list, result ) ;
120     }
121
122     public Request JavaDoc _create_request( Context JavaDoc ctx, String JavaDoc operation, NVList JavaDoc arg_list,
123     NamedValue JavaDoc result, ExceptionList JavaDoc exclist, ContextList JavaDoc ctxlist)
124     {
125     return object._create_request( ctx, operation, arg_list, result,
126         exclist, ctxlist ) ;
127     }
128
129     public Policy JavaDoc _get_policy(int policy_type)
130     {
131     return object._get_policy( policy_type ) ;
132     }
133
134     public DomainManager JavaDoc[] _get_domain_managers()
135     {
136     return object._get_domain_managers() ;
137     }
138
139     public org.omg.CORBA.Object JavaDoc _set_policy_override( Policy JavaDoc[] policies,
140     SetOverrideType JavaDoc set_add)
141     {
142     return object._set_policy_override( policies, set_add ) ;
143     }
144 }
145
Popular Tags