summaryrefslogtreecommitdiff
path: root/TAO/tao/ccm_core/Component_Base.idl
blob: 312471572a10fd40d95904b975cadf25998b30f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
// $Id$

/**
 * @@ Compile this file with:
 *
 *     tao_idl -Gv -I W:/ACE_wrappers/TAO -I W:/ACE_wrappers/TAO/orbsvcs/orbsvcs Component_Base.idl
 *
 * @@ CosPersistentState related stuff are removed completely.
 *
 */

//  import ::CORBA
//  import ::SecurityLevel2
//  import ::CosPersistentState
//  import ::PortableServer
//  import ::CosNotification
//  import ::CosNotifyChannelAdmin

#include <CORBA.pidl>
#include <SecurityLevel2.idl>
#include <CosPersistentState.idl>
#include <PortableServer/PortableServer.pidl>
#include <IFR_Client/Interface.pidl>
#include <CosNotification.idl>
#include <CosNotifyChannelAdmin.idl>

/**
 * Temporarily fix for lacking of typePrefix keyword.
 * Search for the word "typePrefix" when tao_idl starts
 * supporting the keyword.
 */
#pragma prefix "omg.org"

module Components {

  /**
   * @@ Commented out temporarily for lack of typePrefix support.
   */
  //    typePrefix Components "omg.org"
  typedef string FeatureName;
  typedef sequence<FeatureName> NameList;

  valuetype Cookie
  {
    private CORBA::OctetSeq cookieValue;
  };

  valuetype PortDescription
  {
    public FeatureName Name;
    public CORBA::RepositoryId type_id;
  };

  valuetype FacetDescription : PortDescription
  {
    public Object facet_ref;
  };

  typedef sequence<FacetDescription> FacetDescriptions;

  typedef unsigned long FailureReason;

  exception InvalidName {};
  exception InvalidConnection {};
  exception ExceededConnectionLimit {};
  exception AlreadyConnected {};
  exception NoConnection {};
  exception CookieRequired {};
  exception CreateFailure {
    FailureReason reason;
  };
  exception FinderFailure
  {
    FailureReason reason;
  };
  exception RemoveFailure
  {
    FailureReason reason;
  };
  exception DuplicateKeyValue {};
  exception InvalidKey {};
  exception UnknownKeyValue {};
  exception NoKeyAvailable {};
  exception BadEventType
  {
    CORBA::RepositoryId expected_event_type;
  };
  exception HomeNotFound {};
  exception WrongComponentType {};

  typedef FailureReason InvalidConfigurationReason;
  const InvalidConfigurationReason UnknownConfigValueName = 0;
  const InvalidConfigurationReason InvalidConfigValueType = 1;
  const InvalidConfigurationReason ConfigValueRequired = 2;
  const InvalidConfigurationReason ConfigValueNotExpected = 3;
  exception InvalidConfiguration
  {
    InvalidConfigurationReason reason;
    FeatureName name;
  };
  exception IllegalState {};

  interface Navigation
  {
    Object provide_facet (in FeatureName name)
      raises (InvalidName);
    FacetDescriptions get_all_facets();
    FacetDescriptions get_named_facets (in NameList names)
      raises (InvalidName);
    boolean same_component (in Object object_ref);
  };

  valuetype ConnectionDescription
  {
    public Cookie ck;
    public Object objref;
  };
  typedef sequence<ConnectionDescription> ConnectionDescriptions;

  valuetype ReceptacleDescription : PortDescription
  {
    public boolean is_multiple;
    public ConnectionDescriptions connections;
  };
  typedef sequence<ReceptacleDescription> ReceptacleDescriptions;

  interface Receptacles
  {
    Cookie connect (in FeatureName name, in Object connection )
      raises (InvalidName,
              InvalidConnection,
              AlreadyConnected,
              ExceededConnectionLimit);

    void disconnect (in FeatureName name, in Cookie ck)
      raises (InvalidName,
              InvalidConnection,
              CookieRequired,
              NoConnection);

    ConnectionDescriptions get_connections (in FeatureName name)
      raises (InvalidName);

    ReceptacleDescriptions get_all_receptacles ();

    ReceptacleDescriptions get_named_receptacles (in NameList names)
      raises (InvalidName);
  };

  abstract valuetype EventBase {};

  interface EventConsumerBase
  {
    void push_event (in EventBase evt) raises (BadEventType);
  };

  valuetype ConsumerDescription : PortDescription
  {
    public EventConsumerBase consumer;
  };
  typedef sequence<ConsumerDescription> ConsumerDescriptions;

  valuetype EmitterDescription : PortDescription
  {
    public EventConsumerBase consumer;
  };
  typedef sequence<EmitterDescription> EmitterDescriptions;

  // @@ I added the parent class "PortDescription" below as it seems
  //    to be missing from the draft.
  valuetype SubscriberDescription : PortDescription
  {
    public Cookie ck;
    public EventConsumerBase consumer;
  };
  typedef sequence<SubscriberDescription> SubscriberDescriptions;

  valuetype PublisherDescription : PortDescription
  {
    public SubscriberDescriptions consumer;
  };
  typedef sequence<PublisherDescription> PublisherDescriptions;

  interface Events
  {
    EventConsumerBase get_consumer (in FeatureName sink_name)
      raises (InvalidName);

    Cookie subscribe (in FeatureName publisher_name,
                      in EventConsumerBase subscriber)
      raises (InvalidName,
              AlreadyConnected,
              InvalidConnection);

    void unsubscribe (in FeatureName publisher_name,
                      in Cookie ck)
      raises (InvalidName,
              InvalidConnection);

    void connect_consumer (in FeatureName emitter_name,
                           in EventConsumerBase consumer)
      raises (InvalidName,
              AlreadyConnected,
              InvalidConnection);

    EventConsumerBase disconnect_consumer (in FeatureName source_name)
      raises (InvalidName,
              NoConnection);

    ConsumerDescriptions get_all_consumers ();

    ConsumerDescriptions get_named_consumers (in NameList names)
      raises (InvalidName);

    EmitterDescriptions get_all_emitters ();

    EmitterDescriptions get_named_emitters (in NameList names)
      raises (InvalidName);

    PublisherDescriptions get_all_publishers ();

    PublisherDescriptions get_named_publishers (in NameList names)
      raises (InvalidName);
  };

  abstract valuetype PrimaryKeyBase {};

  interface CCMObject; //forward reference

  interface CCMHome
  {
    CORBA::IRObject get_component_def ();
    CORBA::IRObject get_home_def ();
    void remove_component ( in CCMObject comp)
      raises (RemoveFailure);
  };
  typedef sequence<CCMHome> CCMHomes;

  interface KeylessCCMHome
  {
    CCMObject create_component()
      raises (CreateFailure);
  };

  interface HomeFinder
  {
    CCMHome find_home_by_component_type (in CORBA::RepositoryId comp_repid)
      raises (HomeNotFound);

    CCMHome find_home_by_home_type (in CORBA::RepositoryId home_repid)
      raises (HomeNotFound);

    CCMHome find_home_by_name (in string home_name)
      raises (HomeNotFound);
  };

  interface Configurator
  {
    void configure (in CCMObject comp)
      raises (WrongComponentType);
  };

  valuetype ConfigValue
  {
    public FeatureName name;
    public any value;
  };

  typedef sequence<ConfigValue> ConfigValues;

  interface StandardConfigurator : Configurator
  {
    void set_configuration (in ConfigValues descr);
  };

  interface HomeConfiguration : CCMHome
  {
    void set_configurator (in Configurator cfg);
    void set_configuration_values (in ConfigValues config);
    void complete_component_configuration (in boolean b);
    void disable_home_configuration();
  };

  valuetype ComponentPortDescription
  {
    public FacetDescriptions facets;
    public ReceptacleDescriptions receptacles;
    public ConsumerDescriptions consumers;
    public EmitterDescriptions emitters;
    public PublisherDescriptions publishers;
  };

  interface CCMObject : Navigation, Receptacles, Events
  {
    CORBA::IRObject get_component_def ( );
    CCMHome get_ccm_home( );
    PrimaryKeyBase get_primary_key( )
      raises (NoKeyAvailable);
    void configuration_complete( )
      raises (InvalidConfiguration);
    void remove()
      raises (RemoveFailure);
    ComponentPortDescription get_all_ports ();
  };


  // @@ Enumeration and DefaultEnumeration are only for EJB to CCM
  // mapping?  At any rate, we should be able to skip them for now.
  abstract valuetype Enumeration
  {
    boolean has_more_elements();
    CCMObject next_element();
  };

  typedef sequence<CCMObject> CCMObjectSeq;

  valuetype DefaultEnumeration : Enumeration
  {
    private CCMObjectSeq objects;
  };

  // @@ Components::Transaction is still there.
  module Transaction
  {

    typedef sequence<octet> TranToken;

    exception NoTransaction {};
    exception NotSupported {};
    exception SystemError {};
    exception RollbackError {};
    exception HeuristicMixed {};
    exception HeuristicRollback {};
    exception Security {};
    exception InvalidToken {};

    enum Status
    {
      ACTIVE,
      MARKED_ROLLBACK,
      PREPARED,
      COMMITTED,
      ROLLED_BACK,
      NO_TRANSACTION,
      PREPARING,
      COMMITTING,
      ROLLING_BACK
    };

    local interface UserTransaction {
      void begin ()
        raises (NotSupported,
                SystemError);

      void commit ()
        raises (RollbackError,
                NoTransaction,
                HeuristicMixed,
                HeuristicRollback,
                Security,
                SystemError);

      void rollback ()
        raises (NoTransaction,
                Security,
                SystemError);

      void set_rollback_only ()
        raises (NoTransaction,
                SystemError);

      Status get_status()
        raises (SystemError);

      void set_timeout (in long to)
        raises (SystemError);

      TranToken suspend ()
        raises (NoTransaction,
                SystemError);

      void resume (in TranToken txtoken)
        raises (InvalidToken,
                SystemError);
    };
  };

  // @@ module Notification doesn't seem to exist anymore.
    module Notification {

        typedef CosNotification::EventHeader EventHeader;
        /**
         * @@ Typo with "CosNotifyChannnelAdmin::ChannelId"?
         */
        typedef CosNotifyChannelAdmin::ChannelID Channel;

        exception ChannelUnavailable {};
        exception InvalidSubscription {};
        exception InvalidName {};
        exception InvalidChannel {};

        local interface LocalCookie {
            boolean same_as (in LocalCookie cookie);
        };

        local interface Event {
            EventConsumerBase create_channel
                (out Channel chid)
                raises (ChannelUnavailable);
            LocalCookie subscribe (
                in EventConsumerBase ecb,
                in Channel chid)
                raises (ChannelUnavailable);
            void unsubscribe (in LocalCookie cookie)
                raises (InvalidSubscription);
            EventConsumerBase obtain_channel (
                in string supp_name,
                in EventHeader hdr)
                raises (InvalidName);
            void listen (in EventConsumerBase ecb,
                in string csmr_name)
                raises (InvalidName);
            void push (in EventBase evt);
            void destroy_channel (in Channel chid)
                raises (InvalidChannel);
        };
    };

  // *************** Basic Container interfaces ***************

  typedef SecurityLevel2::Credentials Principal;

  local interface CCMContext
  {
    Principal get_caller_principal();

    CCMHome get_CCM_home();

    boolean get_rollback_only()
      raises (IllegalState);

    Transaction::UserTransaction get_user_transaction()
      raises (IllegalState);

    boolean is_caller_in_role (in string role);

    void set_rollback_only()
      raises (IllegalState);
  };

  enum CCMExceptionReason
  {
    SYSTEM_ERROR,
    CREATE_ERROR,
    REMOVE_ERROR,
    DUPLICATE_KEY,
    FIND_ERROR,
    OBJECT_NOT_FOUND,
    NO_SUCH_ENTITY
  };

  exception CCMException
  {
    CCMExceptionReason reason;
  };

  local interface EnterpriseComponent {};

  local interface SessionContext : CCMContext
  {
    Object get_CCM_object()
      raises (IllegalState);
  };

  local interface SessionComponent : EnterpriseComponent
  {
    void set_session_context ( in SessionContext ctx)
      raises (CCMException);

    void ccm_activate()
      raises (CCMException);

    void ccm_passivate()
      raises (CCMException);

    void ccm_remove ()
      raises (CCMException);
  };

  local interface SessionSynchronization
  {
    void after_begin ()
      raises (CCMException);

    void before_completion ()
      raises (CCMException);

    void after_completion (in boolean committed)
      raises (CCMException);
  };

  local interface EntityContext : CCMContext
  {
    Object get_CCM_object ()
      raises (IllegalState);

    PrimaryKeyBase get_primary_key ()
      raises (IllegalState);
  };

  local interface EntityComponent : EnterpriseComponent
  {
    void set_entity_context (in EntityContext ctx)
      raises (CCMException);

    void unset_entity_context ()
      raises (CCMException);

    void ccm_activate ()
      raises (CCMException);

    void ccm_load ()
      raises (CCMException);

    void ccm_store ()
      raises (CCMException);

    void ccm_passivate ()
      raises (CCMException);

    void ccm_remove ()
      raises (CCMException);
  };

  // *************** Extended Container Interfaces ***************

  enum BadComponentReferenceReason
  {
    NON_LOCAL_REFERENCE,
    NON_COMPONENT_REFERENCE,
    WRONG_CONTAINER
  };

  typedef CosPersistentState::CatalogBase CatalogBase;
  typedef CosPersistentState::TypeId TypeId;

  typedef short SegmentId;
  const SegmentId COMPONENT_SEGMENT = 0;

  typedef short FacetId;
  const FacetId COMPONENT_FACET = 0;

  typedef sequence<octet> IdData;
  typedef CosPersistentState::Pid PersistentId;

  typedef short StateIdType;
  const StateIdType PERSISTENT_ID = 0;

  exception BadComponentReference
  {
    BadComponentReferenceReason reason;
  };
  exception PolicyMismatch {};
  exception PersistenceNotAvailable {};
  exception UnknownActualHome {};
  exception ProxyHomeNotSupported {};
  exception InvalidStateIdData {};

  local interface HomeRegistration
  {
    void register_home (in CCMHome home_ref,
                        in string home_name);

    void unregister_home (in CCMHome home_ref);
  };

  local interface CCM2Context : CCMContext
  {
    HomeRegistration get_home_registration ();

    void req_passivate ()
      raises (PolicyMismatch);

    CatalogBase get_persistence (in TypeId catalog_type_id)
      raises (PersistenceNotAvailable);
  };

  local interface ProxyHomeRegistration : HomeRegistration
  {
    void register_proxy_home (in CCMHome rhome,
                              in CCMHome ahome)
      raises (UnknownActualHome,
              ProxyHomeNotSupported);
  };

  local interface Session2Context : SessionContext, CCM2Context
  {
    Object create_ref (in CORBA::RepositoryId repid);

    Object create_ref_from_oid (in CORBA::OctetSeq oid,
                                in CORBA::RepositoryId repid);

    CORBA::OctetSeq get_oid_from_ref (in Object objref)
      raises (IllegalState,
              BadComponentReference);
  };

  abstract valuetype StateIdValue
  {
    StateIdType get_sid_type();
    IdData get_sid_data();
  };

  local interface StateIdFactory
  {
    StateIdValue create (in IdData data)
      raises (InvalidStateIdData);
  };

  valuetype PersistentIdValue : StateIdValue
  {
    private PersistentId pid;

    PersistentId get_pid();
    factory init (in PersistentId pid);
  };

  valuetype SegmentDescr
  {
    private StateIdValue sid;
    private SegmentId seg;

    StateIdValue get_sid();
    SegmentId get_seg_id();
    factory init (in StateIdValue sid,
                  in SegmentId seg);
  };

  typedef sequence<SegmentDescr> SegmentDescrSeq;

  local interface ComponentId
  {
    FacetId get_target_facet();

    SegmentId get_target_segment();

    StateIdValue get_target_state_id (in StateIdFactory sid_factory)
      raises (InvalidStateIdData);

    StateIdValue get_segment_state_id (in SegmentId seg,
                                       in StateIdFactory sid_factory)
      raises (InvalidStateIdData);

    ComponentId create_with_new_target (in FacetId new_target_facet,
                                        in SegmentId new_target_segment);

    SegmentDescrSeq get_segment_descrs (in StateIdFactory sid_factory)
      raises (InvalidStateIdData);
  };

  local interface Entity2Context : EntityContext, CCM2Context
  {
    ComponentId get_component_id ()
      raises (IllegalState);

    ComponentId create_component_id (in FacetId target_facet,
                                     in SegmentId target_segment,
                                     in SegmentDescrSeq seq_descrs);

    ComponentId create_monolithic_component_id (in FacetId target_facet,
                                                in StateIdValue sid);

    Object create_ref_from_cid (in CORBA::RepositoryId repid,
                                in ComponentId cid);

    ComponentId get_cid_from_ref (in Object objref)
      raises (BadComponentReference);
  };

  // *************** Packaging and Deployment ***************

  module Deployment
  {
    typedef string UUID;
    typedef string Location;

    enum AssemblyState
    {
      INACTIVE,
      INSERVICE
    };

    exception UnknownImplId {};
    exception InvalidLocation {};
    exception InstallationFailure
    {
      FailureReason reason;
    };
    exception InvalidAssembly {};

    interface ComponentInstallation
    {
      void install(in UUID implUUID,
                   in Location component_loc)
        raises (InvalidLocation,
                InstallationFailure);

      void replace(in UUID implUUID,
                   in Location component_loc)
        raises (InvalidLocation,
                InstallationFailure);

      void remove(in UUID implUUID)
        raises (UnknownImplId,
                RemoveFailure);

      Location get_implementation (in UUID implUUID)
        raises (UnknownImplId,
                InstallationFailure);
    };

    interface Assembly
    {
      void build();

      void tear_down()
        raises (RemoveFailure);

      AssemblyState get_state();
    };

    interface AssemblyFactory
    {
      Cookie create(in Location assembly_loc)
        raises (InvalidLocation,
                CreateFailure);

      Assembly lookup(in Cookie c)
        raises (InvalidAssembly);

      void destroy(in Cookie c)
        raises (InvalidAssembly,
                RemoveFailure);
    };

    interface ComponentServer;  // Forward decl.
    typedef sequence<ComponentServer> ComponentServers;

    interface ServerActivator
    {
      ComponentServer create_component_server (in ConfigValues config)
        raises (CreateFailure,
                InvalidConfiguration);

      void remove_component_server (in ComponentServer server)
        raises (RemoveFailure);

      ComponentServers get_component_servers ();
    };

    interface Container;        // Forward decl.
    typedef sequence<Container> Containers;

    interface ComponentServer
    {
      readonly attribute ConfigValues configuration;

      ServerActivator get_server_activator ();
      Container create_container (in ConfigValues config)
        raises (CreateFailure,
                InvalidConfiguration);

      void remove_container (in Container cref)
        raises (RemoveFailure);

      Containers get_containers ();

      void remove ()
        raises (RemoveFailure);
    };

    exception ImplEntryPointNotFound {};

    interface Container
    {
      readonly attribute ConfigValues configuration;

      ComponentServer get_component_server ();

      CCMHome install_home (in UUID id,
                            in string entrypt,
                            in ConfigValues config)
        raises (UnknownImplId,
                ImplEntryPointNotFound,
                InstallationFailure,
                InvalidConfiguration);

      void remove_home (in CCMHome href)
        raises (RemoveFailure);

      CCMHomes get_homes ();
      void remove ()
        raises (RemoveFailure);

    };

  };
};