00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TAO_TRADER_BASE_H
00017 #define TAO_TRADER_BASE_H
00018 #include "ace/pre.h"
00019
00020 #include "orbsvcs/Trader/Interpreter_Utils.h"
00021
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 # pragma once
00024 #endif
00025
00026 #include "ace/Containers.h"
00027
00028 #include "orbsvcs/CosTradingS.h"
00029 #include "orbsvcs/CosTradingReposS.h"
00030 #include "orbsvcs/CosTradingDynamicS.h"
00031 #include "orbsvcs/Trader/trading_serv_export.h"
00032
00033 #if defined(_MSC_VER)
00034 #pragma warning(push)
00035 #pragma warning (disable:4250)
00036 #endif
00037
00038 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00039
00040
00041 class TAO_Trader_Base;
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 class TAO_Trading_Serv_Export TAO_Trader_Factory
00054 {
00055 public:
00056
00057 typedef TAO_Trader_Base TAO_TRADER;
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 static TAO_TRADER* create_trader (int& argc, ACE_TCHAR** argv);
00080
00081 protected:
00082
00083 TAO_Trader_Factory (int& argc, ACE_TCHAR** argv);
00084
00085 private:
00086
00087 enum Conformance { TAO_TRADER_QUERY,
00088 TAO_TRADER_SIMPLE,
00089 TAO_TRADER_STANDALONE,
00090 TAO_TRADER_LINKED };
00091
00092 TAO_TRADER* manufacture_trader (void);
00093
00094 void parse_args (int& argc, ACE_TCHAR** argv);
00095
00096 TAO_Trader_Factory& operator= (const TAO_Trader_Factory&);
00097 TAO_Trader_Factory (const TAO_Trader_Factory&);
00098
00099
00100
00101 Conformance conformance_;
00102 CORBA::Boolean threadsafe_;
00103 CORBA::Boolean supports_dynamic_properties_;
00104 CORBA::Boolean supports_modifiable_properties_;
00105 CORBA::ULong def_search_card_;
00106 CORBA::ULong max_search_card_;
00107 CORBA::ULong def_match_card_;
00108 CORBA::ULong max_match_card_;
00109 CORBA::ULong def_return_card_;
00110 CORBA::ULong max_return_card_;
00111 CORBA::ULong def_hop_count_;
00112 CORBA::ULong max_hop_count_;
00113 CosTrading::FollowOption def_follow_policy_;
00114 CosTrading::FollowOption max_follow_policy_;
00115 };
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127 #if defined (__BORLANDC__) && (__BORLANDC__ <= 0x582)
00128
00129
00130
00131
00132 class TAO_Trading_Serv_Export TAO_Lockable
00133 #else
00134 class TAO_Lockable
00135 #endif
00136 {
00137 public:
00138 virtual ~TAO_Lockable (void);
00139
00140 virtual ACE_Lock& lock (void) = 0;
00141 };
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153 class TAO_Trading_Serv_Export TAO_Support_Attributes_i
00154 {
00155 public:
00156
00157 TAO_Support_Attributes_i (TAO_Lockable &locker);
00158 ~TAO_Support_Attributes_i ();
00159
00160
00161 CORBA::Boolean supports_modifiable_properties (void) const;
00162 void supports_modifiable_properties (CORBA::Boolean);
00163
00164 CORBA::Boolean supports_dynamic_properties (void) const;
00165 void supports_dynamic_properties (CORBA::Boolean);
00166
00167 CORBA::Boolean supports_proxy_offers (void) const;
00168 void supports_proxy_offers (CORBA::Boolean);
00169
00170 CosTrading::TypeRepository_ptr type_repos (void) const;
00171 void type_repos (CosTrading::TypeRepository_ptr);
00172
00173 CosTradingRepos::ServiceTypeRepository_ptr service_type_repos (void) const;
00174
00175 private:
00176
00177
00178 TAO_Lockable &locker_;
00179
00180
00181 CORBA::Boolean supports_modifiable_properties_;
00182
00183
00184 CORBA::Boolean supports_dynamic_properties_;
00185
00186
00187 CORBA::Boolean supports_proxy_offers_;
00188
00189
00190 CORBA::Object_var type_repos_;
00191
00192
00193 CosTradingRepos::ServiceTypeRepository_var service_type_repos_;
00194 };
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205 class TAO_Trading_Serv_Export TAO_Link_Attributes_i
00206 {
00207 public:
00208
00209
00210 TAO_Link_Attributes_i (TAO_Lockable &locker);
00211 ~TAO_Link_Attributes_i ();
00212
00213
00214
00215 CosTrading::FollowOption max_link_follow_policy (void) const;
00216 void max_link_follow_policy (CosTrading::FollowOption);
00217
00218 private:
00219
00220
00221 TAO_Lockable &locker_;
00222
00223
00224 CosTrading::FollowOption max_link_follow_policy_;
00225 };
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236 class TAO_Trading_Serv_Export TAO_Import_Attributes_i
00237 {
00238 public:
00239
00240
00241 TAO_Import_Attributes_i (TAO_Lockable &locker);
00242
00243 ~TAO_Import_Attributes_i (void);
00244
00245
00246
00247 CORBA::ULong def_search_card (void) const;
00248 void def_search_card (CORBA::ULong);
00249
00250 CORBA::ULong max_search_card (void) const;
00251 void max_search_card (CORBA::ULong);
00252
00253 CORBA::ULong def_match_card (void) const;
00254 void def_match_card (CORBA::ULong);
00255
00256 CORBA::ULong max_match_card (void) const;
00257 void max_match_card (CORBA::ULong);
00258
00259 CORBA::ULong def_return_card (void) const;
00260 void def_return_card (CORBA::ULong);
00261
00262 CORBA::ULong max_return_card (void) const;
00263 void max_return_card (CORBA::ULong);
00264
00265 CORBA::ULong max_list (void) const;
00266 void max_list (CORBA::ULong);
00267
00268 CORBA::ULong def_hop_count (void) const;
00269 void def_hop_count (CORBA::ULong);
00270
00271 CORBA::ULong max_hop_count (void) const;
00272 void max_hop_count (CORBA::ULong);
00273
00274 CosTrading::FollowOption def_follow_policy (void) const;
00275 void def_follow_policy (CosTrading::FollowOption);
00276
00277 CosTrading::FollowOption max_follow_policy (void) const;
00278 void max_follow_policy (CosTrading::FollowOption);
00279
00280 private:
00281
00282 TAO_Lockable &locker_;
00283
00284
00285
00286 CORBA::ULong def_search_card_;
00287
00288
00289 CORBA::ULong max_search_card_;
00290
00291
00292
00293 CORBA::ULong def_match_card_;
00294
00295
00296 CORBA::ULong max_match_card_;
00297
00298
00299
00300 CORBA::ULong def_return_card_;
00301
00302
00303 CORBA::ULong max_return_card_;
00304
00305
00306 CORBA::ULong max_list_;
00307
00308
00309
00310 CORBA::ULong def_hop_count_;
00311
00312
00313 CORBA::ULong max_hop_count_;
00314
00315
00316 CosTrading::FollowOption def_follow_policy_;
00317
00318
00319
00320 CosTrading::FollowOption max_follow_policy_;
00321 };
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334 class TAO_Trading_Serv_Export TAO_Trading_Components_i
00335 {
00336 public:
00337
00338
00339 TAO_Trading_Components_i (TAO_Lockable &locker);
00340 ~TAO_Trading_Components_i (void);
00341
00342
00343
00344
00345
00346 CosTrading::Lookup_ptr lookup_if (void) const;
00347
00348
00349 void lookup_if (CosTrading::Lookup_ptr);
00350
00351
00352
00353 CosTrading::Register_ptr register_if (void) const;
00354
00355
00356 void register_if (CosTrading::Register_ptr);
00357
00358
00359
00360 CosTrading::Link_ptr link_if (void) const;
00361
00362
00363 void link_if (CosTrading::Link_ptr);
00364
00365
00366
00367 CosTrading::Proxy_ptr proxy_if (void) const;
00368
00369
00370 void proxy_if (CosTrading::Proxy_ptr);
00371
00372
00373
00374 CosTrading::Admin_ptr admin_if (void) const;
00375
00376
00377 void admin_if (CosTrading::Admin_ptr);
00378
00379 private:
00380
00381 TAO_Lockable &locker_;
00382
00383 CosTrading::Lookup_var lookup_;
00384 CosTrading::Register_var register_;
00385 CosTrading::Link_var link_;
00386 CosTrading::Proxy_var proxy_;
00387 CosTrading::Admin_var admin_;
00388 };
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408 class TAO_Trading_Serv_Export TAO_Trader_Base : public TAO_Lockable
00409 {
00410 public:
00411
00412 enum Trader_Components
00413 {
00414 LOOKUP = 0x001,
00415 REGISTER = 0x002,
00416 LINK = 0x004,
00417 PROXY = 0x008,
00418 ADMIN = 0x010
00419 };
00420
00421 virtual ~TAO_Trader_Base (void);
00422
00423
00424
00425 TAO_Trading_Components_i &trading_components (void);
00426
00427 const TAO_Trading_Components_i &trading_components (void) const;
00428
00429 TAO_Import_Attributes_i &import_attributes (void);
00430
00431 const TAO_Import_Attributes_i &import_attributes (void) const;
00432
00433 TAO_Support_Attributes_i &support_attributes (void);
00434
00435 const TAO_Support_Attributes_i &support_attributes (void) const;
00436
00437 TAO_Link_Attributes_i &link_attributes (void);
00438
00439 const TAO_Link_Attributes_i &link_attributes (void) const;
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450 static CORBA::Boolean is_valid_identifier_name (const char* ident);
00451
00452
00453
00454
00455
00456
00457 static CORBA::Boolean is_valid_property_name (const char* ident);
00458
00459
00460
00461
00462
00463 static CORBA::Boolean is_valid_link_name (const char* ident)
00464 {
00465 return is_valid_property_name (ident);
00466 }
00467
00468 protected:
00469
00470
00471
00472 TAO_Trading_Components_i trading_components_;
00473
00474
00475 TAO_Import_Attributes_i import_attributes_;
00476
00477
00478 TAO_Support_Attributes_i support_attributes_;
00479
00480
00481 TAO_Link_Attributes_i link_attributes_;
00482
00483 protected:
00484
00485
00486 TAO_Trader_Base (void);
00487
00488 private:
00489
00490
00491 TAO_Trader_Base (const TAO_Trader_Base& TAO_Trader_Base);
00492 TAO_Trader_Base& operator= (const TAO_Trader_Base&);
00493 };
00494
00495
00496
00497
00498
00499 typedef ACE_Hash_Map_Manager_Ex<CORBA::ULong, CosTrading::Offer*, ACE_Hash<CORBA::ULong>, ACE_Equal_To<CORBA::ULong>, ACE_Null_Mutex> TAO_Offer_Map;
00500
00501 typedef ACE_Unbounded_Set<CORBA::String_var> TAO_String_Set;
00502 typedef ACE_Unbounded_Queue<char*> TAO_String_Queue;
00503
00504
00505
00506 bool
00507 operator> (const CosTradingRepos::ServiceTypeRepository::IncarnationNumber &l,
00508 const CosTradingRepos::ServiceTypeRepository::IncarnationNumber &r);
00509
00510 bool
00511 operator< (const CosTradingRepos::ServiceTypeRepository::IncarnationNumber &l,
00512 const CosTradingRepos::ServiceTypeRepository::IncarnationNumber &r);
00513
00514 bool
00515 operator== (const CosTrading::Admin::OctetSeq& left,
00516 const CosTrading::Admin::OctetSeq& right);
00517
00518 TAO_END_VERSIONED_NAMESPACE_DECL
00519
00520 #if defined(_MSC_VER)
00521 #pragma warning(pop)
00522 #endif
00523
00524 #include "ace/post.h"
00525 #endif