/lib/orber/src/corba_boa.erl

https://github.com/lht/otp · Erlang · 134 lines · 52 code · 15 blank · 67 comment · 0 complexity · acd280f6c4b8a1354a13edc4a5ffab42 MD5 · raw file

  1. %%--------------------------------------------------------------------
  2. %%
  3. %% %CopyrightBegin%
  4. %%
  5. %% Copyright Ericsson AB 1997-2009. All Rights Reserved.
  6. %%
  7. %% The contents of this file are subject to the Erlang Public License,
  8. %% Version 1.1, (the "License"); you may not use this file except in
  9. %% compliance with the License. You should have received a copy of the
  10. %% Erlang Public License along with this software. If not, it can be
  11. %% retrieved online at http://www.erlang.org/.
  12. %%
  13. %% Software distributed under the License is distributed on an "AS IS"
  14. %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
  15. %% the License for the specific language governing rights and limitations
  16. %% under the License.
  17. %%
  18. %% %CopyrightEnd%
  19. %%
  20. %%
  21. %%-----------------------------------------------------------------
  22. %% File: corba_boa.erl
  23. %%
  24. %% Description:
  25. %% This file contains the CORBA::BOA interface
  26. %%
  27. %%-----------------------------------------------------------------
  28. -module(corba_boa).
  29. -include_lib("orber/include/corba.hrl").
  30. -include_lib("orber/include/ifr_types.hrl").
  31. %%-----------------------------------------------------------------
  32. %% External exports
  33. %%-----------------------------------------------------------------
  34. -export([%create/3,
  35. dispose/1,
  36. get_id/1]).
  37. % change_implementation/2,
  38. % set_exception/3,
  39. % impl_is_ready/1,
  40. % deactivate_impl/1,
  41. % obj_is_ready/2,
  42. % deactivate_obj/1,
  43. % get_principal/2]).
  44. %%-----------------------------------------------------------------
  45. %% Internal exports
  46. %%-----------------------------------------------------------------
  47. -export([]).
  48. %%-----------------------------------------------------------------
  49. %% Macros
  50. %%-----------------------------------------------------------------
  51. -define(DEBUG_LEVEL, 5).
  52. %%-----------------------------------------------------------------
  53. %% External functions
  54. %%-----------------------------------------------------------------
  55. %create(Id, Interface, Implementation) ->
  56. % corba:create(Implementation#orb_ImplDef.module,
  57. % Interface#fullinterfacedescription.id).
  58. dispose(Object) ->
  59. case binary_to_term(iop_ior:get_privfield(Object)) of
  60. undefined ->
  61. case catch iop_ior:get_key(Object) of
  62. {'internal', Key, _, _, _} ->
  63. case orber_objectkeys:get_pid(Key) of
  64. {error, Reason} ->
  65. orber:dbg("[~p] corba_boa:dispose(~p); object not found(~p)",
  66. [?LINE, Object, Reason], ?DEBUG_LEVEL),
  67. corba:raise(#'TRANSIENT'{completion_status=?COMPLETED_NO});
  68. Pid ->
  69. gen_server:call(Pid, stop)
  70. end;
  71. {'internal_registered', Key, _, _, _} ->
  72. case Key of
  73. {pseudo, Module} ->
  74. Module:terminate(normal, undefined),
  75. ok;
  76. _ ->
  77. case whereis(Key) of
  78. undefined ->
  79. corba:raise(#'OBJECT_NOT_EXIST'{completion_status=?COMPLETED_NO});
  80. Pid ->
  81. gen_server:call(Pid, stop)
  82. end
  83. end;
  84. {'external', _} ->
  85. orber:dbg("[~p] corba_boa:dispose(~p); external object.",
  86. [?LINE, Object], ?DEBUG_LEVEL),
  87. %% Must be fixed !!!!!!!!
  88. corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO})
  89. end;
  90. Other ->
  91. case iop_ior:get_key(Object) of
  92. {_, {pseudo, Module}, _, _, _} ->
  93. Module:terminate(normal, Other),
  94. ok;
  95. Why ->
  96. orber:dbg("[~p] corba_boa:dispose(~p); probably subobject key set(~p)",
  97. [?LINE, Object, Why], ?DEBUG_LEVEL),
  98. corba:raise(#'NO_PERMISSION'{completion_status=?COMPLETED_NO})
  99. end
  100. end.
  101. get_id(Object) ->
  102. iop_ior:get_objkey(Object).
  103. %change_implementation(Object, ImplementationDef) ->
  104. % ok.
  105. %get_principal(Object, Env) ->
  106. % ok.
  107. %set_exception(Major, Id, Param) ->
  108. % ok.
  109. %impl_is_ready(ImplementationDef) ->
  110. % ok.
  111. %deactivate_impl(ImplementationDef) ->
  112. % ok.
  113. %obj_is_ready(Object, ImplementationDef) ->
  114. % ok.
  115. %deactivate_obj(Object) ->
  116. % ok.
  117. %%-----------------------------------------------------------------
  118. %% Internal functions
  119. %%-----------------------------------------------------------------