summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Trading/Offer_Exporter.h
blob: 52139a623127b8f7b1672c662b636f2ba61cd695 (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
// $Id$

// ========================================================================
//
// = FILE
//     Offer_Exporter.h
//
// = DESCRIPTION
//    Class that tests the Trading Service's Register Interface
//
// = AUTHOR
//     Seth Widoff <sbw1@cs.wustl.edu>
//
// =======================================================================

#ifndef TAO_OFFER_EXPORTER_H
#define TAO_OFFER_EXPORTER_H

#include "TT_Info.h"
#include "Simple_Dynamic.h"

class TAO_Offer_Exporter
{
public:

  TAO_Offer_Exporter (CosTrading::Lookup_ptr lookup_if,
                      CORBA::Boolean verbose,
                      CORBA::Environment& env)
    TAO_THROW_SPEC ((CORBA::SystemException));

  ~TAO_Offer_Exporter (void);

  void export_offers (CORBA::Environment& env)
    TAO_THROW_SPEC ((CORBA::SystemException,
                     CosTrading::Register::InvalidObjectRef,
                     CosTrading::IllegalServiceType,
                     CosTrading::UnknownServiceType,
                     CosTrading::Register::InterfaceTypeMismatch,
                     CosTrading::IllegalPropertyName,
                     CosTrading::PropertyTypeMismatch,
                     CosTrading::ReadonlyDynamicProperty,
                     CosTrading::MissingMandatoryProperty,
                     CosTrading::DuplicatePropertyName));
  // Export a number of offers to the Trading Service.

  void export_offers_to_all (CORBA::Environment& env)
    TAO_THROW_SPEC ((CORBA::SystemException,
                     CosTrading::Register::InvalidObjectRef,
                     CosTrading::IllegalServiceType,
                     CosTrading::UnknownServiceType,
                     CosTrading::Register::InterfaceTypeMismatch,
                     CosTrading::IllegalPropertyName,
                     CosTrading::PropertyTypeMismatch,
                     CosTrading::ReadonlyDynamicProperty,
                     CosTrading::MissingMandatoryProperty,
                     CosTrading::DuplicatePropertyName));
  // Export a number of offers to all traders accessible by the
  // bootstrapped trader.

  void withdraw_offers (CORBA::Environment& env)
    TAO_THROW_SPEC ((CORBA::SystemException,
                     CosTrading::IllegalOfferId,
                     CosTrading::UnknownOfferId,
                     CosTrading::Register::ProxyOfferId));
  // Withdraw all exported offers.

  void describe_offers (CORBA::Environment& env)
    TAO_THROW_SPEC ((CORBA::SystemException,
                     CosTrading::IllegalOfferId,
                     CosTrading::UnknownOfferId,
                     CosTrading::Register::ProxyOfferId));
  // Describe all the offers registered with the bootstrapped trader.

  void modify_offers (CORBA::Environment& env)
    TAO_THROW_SPEC ((CORBA::SystemException,
                     CosTrading::NotImplemented,
                     CosTrading::IllegalOfferId,
                     CosTrading::UnknownOfferId,
                     CosTrading::Register::ProxyOfferId,
                     CosTrading::IllegalPropertyName,
                     CosTrading::Register::UnknownPropertyName,
                     CosTrading::PropertyTypeMismatch,
                     CosTrading::ReadonlyDynamicProperty,
                     CosTrading::Register::MandatoryProperty,
                     CosTrading::Register::ReadonlyProperty,
                     CosTrading::DuplicatePropertyName));
  // Remove some properties and change some properties in each offer.

  void withdraw_offers_using_constraints (CORBA::Environment& env)
    TAO_THROW_SPEC ((CORBA::SystemException,
                     CosTrading::IllegalServiceType,
                     CosTrading::UnknownServiceType,
                     CosTrading::IllegalConstraint,
                     CosTrading::Register::NoMatchingOffers));
  // Withdraw a number of offers based on a constraint string.

private:

  CosTrading::OfferIdSeq* grab_offerids (CORBA::Environment& env)
    TAO_THROW_SPEC ((CORBA::SystemException,
                     CosTrading::NotImplemented));

  void create_offers (void);
  // Fill in each of the offer structures.

  void export_to (CosTrading::Register_ptr reg,
                  CORBA::Environment& _env)
    TAO_THROW_SPEC ((CORBA::SystemException,
                     CosTrading::Register::InvalidObjectRef,
                     CosTrading::IllegalServiceType,
                     CosTrading::UnknownServiceType,
                     CosTrading::Register::InterfaceTypeMismatch,
                     CosTrading::IllegalPropertyName,
                     CosTrading::PropertyTypeMismatch,
                     CosTrading::ReadonlyDynamicProperty,
                     CosTrading::MissingMandatoryProperty,
                     CosTrading::DuplicatePropertyName));
  // Export the offers to the give Register interface.

  typedef ACE_Unbounded_Queue<TAO_Dynamic_Property*> DP_Queue;

  CORBA::Boolean verbose_;
  // True if the user wants verbose output.

  CosTrading::Register_var register_;
  CosTrading::Admin_var admin_;

  TT_Info::Printer printer_[NUM_OFFERS];
  TT_Info::Plotter plotter_[NUM_OFFERS];
  TT_Info::File_System fs_[NUM_OFFERS];
  // The objects being exported.

  CosTrading::PropertySeq props_plotters_[NUM_OFFERS];
  CosTrading::PropertySeq props_printers_[NUM_OFFERS];
  CosTrading::PropertySeq props_fs_[NUM_OFFERS];
  // Property sequences describing each service.

  DP_Queue clean_up_;
  // A list of dynamic properties to clean up upon destruction.
};

#endif /* TAO_OFFER_EXPORTER_H */