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. package com.sun.corba.se.spi.presentation.rmi ;
  8. import java.rmi.RemoteException ;
  9. import org.omg.CORBA.portable.Delegate ;
  10. import org.omg.CORBA.ORB ;
  11. import org.omg.CORBA.Request ;
  12. import org.omg.CORBA.Context ;
  13. import org.omg.CORBA.NamedValue ;
  14. import org.omg.CORBA.NVList ;
  15. import org.omg.CORBA.ContextList ;
  16. import org.omg.CORBA.ExceptionList ;
  17. import org.omg.CORBA.Policy ;
  18. import org.omg.CORBA.DomainManager ;
  19. import org.omg.CORBA.SetOverrideType ;
  20. import org.omg.CORBA.portable.OutputStream ;
  21. /** Wrapper that can take any stub (object x such that StubAdapter.isStub(x))
  22. * and treat it as a DynamicStub.
  23. */
  24. public class StubWrapper implements DynamicStub
  25. {
  26. private org.omg.CORBA.Object object ;
  27. public StubWrapper( org.omg.CORBA.Object object )
  28. {
  29. if (!(StubAdapter.isStub(object)))
  30. throw new IllegalStateException() ;
  31. this.object = object ;
  32. }
  33. public void setDelegate( Delegate delegate )
  34. {
  35. StubAdapter.setDelegate( object, delegate ) ;
  36. }
  37. public Delegate getDelegate()
  38. {
  39. return StubAdapter.getDelegate( object ) ;
  40. }
  41. public ORB getORB()
  42. {
  43. return StubAdapter.getORB( object ) ;
  44. }
  45. public String[] getTypeIds()
  46. {
  47. return StubAdapter.getTypeIds( object ) ;
  48. }
  49. public void connect( ORB orb ) throws RemoteException
  50. {
  51. StubAdapter.connect( object, (com.sun.corba.se.spi.orb.ORB)orb ) ;
  52. }
  53. public boolean isLocal()
  54. {
  55. return StubAdapter.isLocal( object ) ;
  56. }
  57. public OutputStream request( String operation, boolean responseExpected )
  58. {
  59. return StubAdapter.request( object, operation, responseExpected ) ;
  60. }
  61. public boolean _is_a(String repositoryIdentifier)
  62. {
  63. return object._is_a( repositoryIdentifier ) ;
  64. }
  65. public boolean _is_equivalent(org.omg.CORBA.Object other)
  66. {
  67. return object._is_equivalent( other ) ;
  68. }
  69. public boolean _non_existent()
  70. {
  71. return object._non_existent() ;
  72. }
  73. public int _hash(int maximum)
  74. {
  75. return object._hash( maximum ) ;
  76. }
  77. public org.omg.CORBA.Object _duplicate()
  78. {
  79. return object._duplicate() ;
  80. }
  81. public void _release()
  82. {
  83. object._release() ;
  84. }
  85. public org.omg.CORBA.Object _get_interface_def()
  86. {
  87. return object._get_interface_def() ;
  88. }
  89. public Request _request(String operation)
  90. {
  91. return object._request( operation ) ;
  92. }
  93. public Request _create_request( Context ctx, String operation, NVList arg_list,
  94. NamedValue result)
  95. {
  96. return object._create_request( ctx, operation, arg_list, result ) ;
  97. }
  98. public Request _create_request( Context ctx, String operation, NVList arg_list,
  99. NamedValue result, ExceptionList exclist, ContextList ctxlist)
  100. {
  101. return object._create_request( ctx, operation, arg_list, result,
  102. exclist, ctxlist ) ;
  103. }
  104. public Policy _get_policy(int policy_type)
  105. {
  106. return object._get_policy( policy_type ) ;
  107. }
  108. public DomainManager[] _get_domain_managers()
  109. {
  110. return object._get_domain_managers() ;
  111. }
  112. public org.omg.CORBA.Object _set_policy_override( Policy[] policies,
  113. SetOverrideType set_add)
  114. {
  115. return object._set_policy_override( policies, set_add ) ;
  116. }
  117. }