byghis

learning scs

Sep 17th, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. type unsigned long ConnectionId
  2. typedef sequence<string> NameList
  3.  
  4. struct FacetDescription{
  5. string name;
  6. string interface_name;
  7. Object facet_ref;
  8. }
  9. typedef sequence<FacetDescriptions> FacetDescriptions;
  10.  
  11. struct ConnectionDescription{
  12. ConnectionId id;
  13. Object objref;
  14. }
  15. typedef sequence<ConnectionDescriptions> ConnectionDescriptions;
  16.  
  17. struct ReceptacleDescription{
  18. string name;
  19. string interface_name;
  20. boolean is_multiplex;
  21. ConnectionDescriptions connections;
  22. }
  23. typedef sequence<ReceptacleDescription> ReceptacleDescriptions;
  24.  
  25. struct ComponentId{
  26. string name;
  27. octect major_version;
  28. octect minor_version;
  29. octect patch_version;
  30. }
  31. typedef sequence<ComponentId> ComponentIdSeq;
  32.  
  33. -------------------------------------------------------
  34.  
  35. IComponent
  36.  
  37. void startup() raises(StartupFailed)
  38. void shutdown() raises(ShutdownFailed)
  39. Object getFacet(in string facet_interface)
  40. Object getFacetByName(in string facet)
  41. Object getComponentId()
  42.  
  43. IComponentSeq : O Conjunto de interfaces de componentes
  44.  
  45. -------------------------------------------------------
  46.  
  47. IMetaInterface
  48.  
  49. FacetDescriptions getFacets()
  50. FacetDescriptions getFacetsByName(in NameList names) raises(InvalidName)
  51. ReceptacleDescriptions getReceptacles()
  52. ReceptacleDescriptions getReceptaclesByName(in NameList names) raises(InvalidName)
  53.  
  54. -------------------------------------------------------
  55.  
  56. IReceptacles
  57.  
  58. ConnectionId connect(in string receptacle, in Object obj) raises
  59. (InvalidName, InvalidConnection, AlreadyConnected, ExceededConnectionLimit)
  60. void disconnect(in ConnectionId id) raises (InvalidConnection, NoConnection)
  61. ConnectionDescriptions getConenctions(in string receptacle) raises(InvalidName)
  62.  
  63. ====================================================================================
  64.  
  65. HelloServant helloImpl = (HelloServant) context.getFacets().get(FACET_HELLO);
  66. helloImpl.setName("World, I'm the server written in Java!");
  67.  
  68. //Saving the CORBA Reference of the Hello facet
  69.  
  70. /**
  71. CounterImpl c_impl = new CounterImpl();
  72. Counter c = c_impl._this(orb);
  73.  
  74. // byte[] servantId = rootPOA.activate_object(c_impl);
  75. // org.omg.CORBA.Object c = rootPOA.id_to_reference(servantId);
  76. // --
  77. // org.omg.CORBA.Object obj = null
  78. // obj = orb.string_to_object(ref)
  79. // Counter c = CounterHelper.narrow(obj)
  80.  
  81.  
  82. String ref = orb.object_to_string(c);
  83. */
  84.  
  85. String ior = orb.object_to_string( IComponentHelper.narrow(context.getFacetDescs().get(FACET_ICOMPONENT).facet_ref) );
Add Comment
Please, Sign In to add comment