00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Trader_Interfaces.h 00006 * 00007 * Trader_Interfaces.h,v 1.33 2006/04/25 11:35:29 jwillemsen Exp 00008 * 00009 * @author Marina Spivak <marina@cs.wustl.edu> 00010 * @author Seth Widoff <sbw1@cs.wustl.edu> 00011 * @author Irfan Pyarali <irfan@cs.wustl.edu> 00012 */ 00013 //============================================================================= 00014 00015 00016 #ifndef TAO_TRADER_INTERFACES_H 00017 #define TAO_TRADER_INTERFACES_H 00018 #include /**/ "ace/pre.h" 00019 00020 #include "orbsvcs/Trader/Trader_Utils.h" 00021 #include "orbsvcs/Trader/Constraint_Interpreter.h" 00022 #include "orbsvcs/Trader/Offer_Iterators_T.h" 00023 00024 #if defined(_MSC_VER) 00025 #pragma warning(push) 00026 #pragma warning(disable:4250) 00027 #endif /* _MSC_VER */ 00028 00029 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00030 00031 // Hack because g++ forced this inane circular dependecy! 00032 00033 class TAO_Constraint_Interpreter; 00034 class TAO_Constraint_Evaluator; 00035 class TAO_Constraint_Validator; 00036 class TAO_Preference_Interpreter; 00037 00038 template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE> class TAO_Lookup; 00039 template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE> class TAO_Register; 00040 template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE> class TAO_Admin; 00041 template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE> class TAO_Proxy; 00042 template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE> class TAO_Link; 00043 00044 TAO_END_VERSIONED_NAMESPACE_DECL 00045 00046 #include "orbsvcs/Trader/Trader_T.h" 00047 00048 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00049 00050 /** 00051 * @class TAO_Lookup 00052 * 00053 * @brief This class implements CosTrading::Lookup IDL interface. 00054 */ 00055 template<class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE> 00056 class TAO_Lookup : 00057 public TAO_Trader_Components<POA_CosTrading::Lookup>, 00058 public TAO_Support_Attributes<POA_CosTrading::Lookup>, 00059 public TAO_Import_Attributes<POA_CosTrading::Lookup> 00060 { 00061 public: 00062 00063 TAO_Lookup (TAO_Trader<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &trader); 00064 00065 ~TAO_Lookup (void); 00066 00067 virtual void 00068 query (const char *type, 00069 const char *constr, 00070 const char *pref, 00071 const CosTrading::PolicySeq& policies, 00072 const CosTrading::Lookup::SpecifiedProps& desired_props, 00073 CORBA::ULong how_many, 00074 CosTrading::OfferSeq_out offers, 00075 CosTrading::OfferIterator_out offer_itr, 00076 CosTrading::PolicyNameSeq_out limits_applied 00077 ACE_ENV_ARG_DECL) 00078 ACE_THROW_SPEC ((CORBA::SystemException, 00079 CosTrading::IllegalServiceType, 00080 CosTrading::UnknownServiceType, 00081 CosTrading::IllegalConstraint, 00082 CosTrading::Lookup::IllegalPreference, 00083 CosTrading::Lookup::IllegalPolicyName, 00084 CosTrading::Lookup::PolicyTypeMismatch, 00085 CosTrading::Lookup::InvalidPolicyValue, 00086 CosTrading::IllegalPropertyName, 00087 CosTrading::DuplicatePropertyName, 00088 CosTrading::DuplicatePolicyName)); 00089 00090 // BEGIN SPEC 00091 // The query operation is the means by which an object can obtain 00092 // references to other objects that provide services meeting its 00093 // requirements. 00094 00095 // The "type" parameter conveys the required service type. It is key 00096 // to the central purpose of trading: to perform an introduction for 00097 // future type safe interactions between importer and exporter. By 00098 // stating a service type, the importer implies the desired interface 00099 // type and a domain of discourse for talking about properties of the 00100 // service. 00101 00102 // The trader may return a service offer of a subtype of the "type" 00103 // requested. Sub-typing of service types is discussed in "Service 00104 // Types" on page 16-4. A service subtype can be described by the 00105 // properties of its supertypes. This ensures that a well-formed 00106 // query for the "type" is also a well-formed query with respect to 00107 // any subtypes. However, if the importer specifies the policy of 00108 // exact_type_match = TRUE, then only offers with the exact (no 00109 // subtype) service type requested are returned. 00110 00111 // The constraint "constr" is the means by which the importer states 00112 // those requirements of a service that are not captured in the 00113 // signature of the interface. These requirements deal with the 00114 // computational behavior of the desired service, non-functional 00115 // aspects, and non-computational aspects (such as the organization 00116 // owning the objects that provide the service). An importer is 00117 // always guaranteed that any returned offer satisfies the matching 00118 // constraint at the time of import. If the "constr" does not obey 00119 // the syntax rules for a legal constraint expression, then an 00120 // IllegalConstraint exception is raised. 00121 00122 // The "pref" parameter is also used to order those offers that 00123 // match the "constr" so that the offers returned by the trader are 00124 // in the order of greatest interest to the importer. If "pref" does 00125 // not obey the syntax rules for a legal preference expression, then 00126 // an IllegalPreference exception is raised. 00127 00128 // The "policies" parameter allows the importer to specify how the 00129 // search should be performed as opposed to what sort of services 00130 // should be found in the course of the search. This can be viewed 00131 // as parameterizing the algorithms within the trader 00132 // implementation. The "policies" are a sequence of name-value 00133 // pairs. The names available to an importer depend on the 00134 // implementation of the trader. However, some names are 00135 // standardized where they effect the interpretation of other 00136 // parameters or where they may impact linking and federation of 00137 // traders. 00138 00139 // The "desired_props" parameter defines the set of properties 00140 // describing returned offers that are to be returned with the 00141 // object reference. There are three possibilities, the importer 00142 // wants one of the properties, all of the properties (but without 00143 // having to name them), or some properties (the names of which are 00144 // provided). 00145 00146 // The desired_props parameter does not affect whether or not a 00147 // service offer is returned. To avoid "missing" desired properties, 00148 // the importer should specify "exists prop_name" in the 00149 // constraint. 00150 00151 // The returned offers are passed back in one of two ways (or a 00152 // combination of both). °The "offers" return result conveys a list 00153 // of offers and the "offer_itr" is a reference to an interface at 00154 // which offers can be obtained. The "how_many" parameter states 00155 // how many offers are to be returned via the "offers" result, any 00156 // remaining offers are available via the iterator interface. If the 00157 // "how_many" exceeds the number of offers to be returned, then the 00158 // "offer_itr" will be nil. 00159 00160 // If any cardinality or other limits were applied by one or more 00161 // traders in responding to a particular query, then the 00162 // "limits_applied" parameter will contain the names of the policies 00163 // which limited the query. The sequence of names returned in 00164 // "limits_applied" from any federated or proxy queries must be 00165 // concatenated onto the names of limits applied locally and 00166 // returned. 00167 // END SPEC 00168 00169 private: 00170 00171 /// Factory method for creating an appropriate Offer Iterator based 00172 /// on the presence of the Register Interface. 00173 TAO_Offer_Iterator* create_offer_iterator (const TAO_Property_Filter&); 00174 00175 /// Traverse the type hierarchy to pull the matching offers from all 00176 /// subtypes of the root type. 00177 void lookup_all_subtypes (const char* type, 00178 CosTradingRepos::ServiceTypeRepository::IncarnationNumber& inc_num, 00179 TAO_Offer_Database<MAP_LOCK_TYPE>& offer_database, 00180 CosTradingRepos::ServiceTypeRepository_ptr rep, 00181 TAO_Constraint_Interpreter& constr_inter, 00182 TAO_Preference_Interpreter& pref_inter, 00183 TAO_Offer_Filter& offer_filter 00184 ACE_ENV_ARG_DECL_WITH_DEFAULTS); 00185 00186 /// Check if offers of a type fit the constraints and order them 00187 /// according to the preferences submitted. 00188 void lookup_one_type (const char* type, 00189 TAO_Offer_Database<MAP_LOCK_TYPE>& offer_database, 00190 TAO_Constraint_Interpreter& constr_inter, 00191 TAO_Preference_Interpreter& pref_inter, 00192 TAO_Offer_Filter& offer_filter); 00193 00194 /** 00195 * This method takes the list of ordered offers and places a number 00196 * of them in the sequence of returned offers and the rest into thr 00197 * iterator. In addition, fill_receptacles uses the 00198 * TAO_Property_Filter to ensure the returned offers contain the 00199 * properties specified in the desired_props in parameter. 00200 */ 00201 int fill_receptacles (const char *, 00202 CORBA::ULong how_many, 00203 const CosTrading::Lookup::SpecifiedProps& desired_props, 00204 TAO_Policies& policies, 00205 TAO_Preference_Interpreter& pref_inter, 00206 CosTrading::OfferSeq& offers, 00207 CosTrading::OfferIterator_ptr& offer_itr 00208 ACE_ENV_ARG_DECL) 00209 ACE_THROW_SPEC ((CosTrading::IllegalPropertyName, 00210 CosTrading::DuplicatePropertyName)); 00211 00212 /// If a starting_trader policy was specfied, foward the query to the 00213 /// next link in the sequence. 00214 void forward_query (const char* next_hop, 00215 const char *type, 00216 const char *constr, 00217 const char *pref, 00218 const CosTrading::PolicySeq& policy_seq, 00219 const CosTrading::Lookup::SpecifiedProps& desired_props, 00220 CORBA::ULong how_many, 00221 CosTrading::OfferSeq_out offers, 00222 CosTrading::OfferIterator_out offer_itr, 00223 CosTrading::PolicyNameSeq_out limits_applied 00224 ACE_ENV_ARG_DECL) 00225 ACE_THROW_SPEC ((CORBA::SystemException, 00226 CosTrading::IllegalServiceType, 00227 CosTrading::UnknownServiceType, 00228 CosTrading::IllegalConstraint, 00229 CosTrading::Lookup::IllegalPreference, 00230 CosTrading::Lookup::IllegalPolicyName, 00231 CosTrading::Lookup::PolicyTypeMismatch, 00232 CosTrading::Lookup::InvalidPolicyValue, 00233 CosTrading::IllegalPropertyName, 00234 CosTrading::DuplicatePropertyName, 00235 CosTrading::DuplicatePolicyName)); 00236 00237 /** 00238 * Assemble a sequence of links that the federate_query method 00239 * should follow. Use the starting_trader policy, if one's provided, 00240 * otherwise use the Link interface to determine which of the 00241 * registered links should be followed in this query. 00242 */ 00243 CORBA::Boolean retrieve_links (TAO_Policies& policies, 00244 CORBA::ULong offer_returned, 00245 CosTrading::LinkNameSeq_out links 00246 ACE_ENV_ARG_DECL) 00247 ACE_THROW_SPEC ((CORBA::SystemException, 00248 CosTrading::Lookup::PolicyTypeMismatch)); 00249 00250 /** 00251 * Perform and pass on a query over a set of links. Merge the 00252 * results of the federated queries into a single set of results 00253 * suitable for returning to the user. 00254 */ 00255 void federated_query (const CosTrading::LinkNameSeq& links, 00256 const TAO_Policies& policies, 00257 const CosTrading::Admin::OctetSeq& request_id, 00258 TAO_Preference_Interpreter& pref_inter, 00259 const char *type, 00260 const char *constr, 00261 const char *pref, 00262 const CosTrading::Lookup::SpecifiedProps& desired_props, 00263 CORBA::ULong how_many, 00264 CosTrading::OfferSeq& offers, 00265 CosTrading::OfferIterator_ptr& offer_itr, 00266 CosTrading::PolicyNameSeq& limits_applied 00267 ACE_ENV_ARG_DECL) 00268 ACE_THROW_SPEC ((CORBA::SystemException, 00269 CosTrading::IllegalServiceType, 00270 CosTrading::UnknownServiceType, 00271 CosTrading::IllegalConstraint, 00272 CosTrading::Lookup::IllegalPreference, 00273 CosTrading::Lookup::IllegalPolicyName, 00274 CosTrading::Lookup::PolicyTypeMismatch, 00275 CosTrading::Lookup::InvalidPolicyValue, 00276 CosTrading::IllegalPropertyName, 00277 CosTrading::DuplicatePropertyName, 00278 CosTrading::DuplicatePolicyName)); 00279 00280 /// Merge the results from a federated query into the collected results. 00281 void order_merged_sequence (TAO_Preference_Interpreter& pref_inter, 00282 CosTrading::OfferSeq& offers); 00283 00284 CORBA::Boolean seen_request_id (TAO_Policies& policies, 00285 CosTrading::Admin::OctetSeq*& seq 00286 ACE_ENV_ARG_DECL) 00287 ACE_THROW_SPEC ((CORBA::SystemException, 00288 CosTrading::Lookup::PolicyTypeMismatch)); 00289 00290 // = Disallow these operations. 00291 ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_Lookup<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &)) 00292 ACE_UNIMPLEMENTED_FUNC (TAO_Lookup (const TAO_Lookup<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &)) 00293 00294 const unsigned int IDS_SAVED; 00295 00296 /// A reference to the trader for obtaining offer maps. 00297 TAO_Trader<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &trader_; 00298 00299 typedef ACE_Unbounded_Queue<CosTrading::Admin::OctetSeq*> Request_Ids; 00300 00301 /// A list of recent request_id_stems 00302 Request_Ids request_ids_; 00303 00304 /// Lock to secure the set of request ids. 00305 TRADER_LOCK_TYPE lock_; 00306 }; 00307 00308 /** 00309 * @class TAO_Register 00310 * 00311 * @brief This class implements CosTrading::Register IDL interface. 00312 */ 00313 template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE> 00314 class TAO_Register : 00315 public TAO_Trader_Components<POA_CosTrading::Register>, 00316 public TAO_Support_Attributes<POA_CosTrading::Register> 00317 { 00318 public: 00319 00320 TAO_Register (TAO_Trader<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &trader); 00321 00322 virtual ~TAO_Register (void); 00323 00324 virtual CosTrading::OfferId _cxx_export (CORBA::Object_ptr reference, 00325 const char *type, 00326 const CosTrading::PropertySeq& properties 00327 ACE_ENV_ARG_DECL) 00328 ACE_THROW_SPEC ((CORBA::SystemException, 00329 CosTrading::Register::InvalidObjectRef, 00330 CosTrading::IllegalServiceType, 00331 CosTrading::UnknownServiceType, 00332 CosTrading::Register::InterfaceTypeMismatch, 00333 CosTrading::IllegalPropertyName, 00334 CosTrading::PropertyTypeMismatch, 00335 CosTrading::ReadonlyDynamicProperty, 00336 CosTrading::MissingMandatoryProperty, 00337 CosTrading::DuplicatePropertyName)); 00338 00339 // BEGIN SPEC 00340 // The export operation is the means by which a service is 00341 // advertised, via a trader, to a community of potential 00342 // importers. The OfferId returned is the handle with which the 00343 // exporter can identify the exported offer when attempting to 00344 // access it via other operations. The OfferId is only meaningful in 00345 // the context of the trader that generated it. 00346 00347 // The "reference" parameter is the information that enables a client 00348 // to interact with a remote server. If a trader implementation chooses 00349 // to consider certain types of object references (e.g., a nil object 00350 // reference) to be unexportable, then it may return the InvalidObjectRef 00351 // exception in such cases. 00352 00353 // The "type" parameter 00354 // identifies the service type, which contains the interface type of 00355 // the "reference" and a set of named property types that may be 00356 // used in further describing this offer (i.e., it restricts what is 00357 // acceptable in the properties parameter). ° 00358 00359 // If the string 00360 // representation of the "type" does not obey the rules for 00361 // identifiers, then an IllegalServiceType exception is raised. ° If 00362 // the "type" is correct syntactically but a trader is able to 00363 // unambiguously determine that it is not a recognized service type, 00364 // then an UnknownServiceType exception is raised. ° 00365 00366 // If the trader 00367 // can determine that the interface type of the "reference" 00368 // parameter is not a subtype of the interface type specified in 00369 // "type," then an InterfaceTypeMismatch exception is raised. The 00370 // "properties" parameter is a list of named values that conform to 00371 // the property value types defined for those names. They describe 00372 // the service being offered. This description typically covers 00373 // behavioral, non-functional, and non-computational aspects of the 00374 // service. ° 00375 00376 // If any of the property names do not obey the syntax 00377 // rules for PropertyNames, then an IllegalPropertyName exception is 00378 // raised. ° 00379 00380 // If the type of any of the property values is not the 00381 // same as the declared type (declared in the service type), then a 00382 // PropertyTypeMismatch exception is raised. 00383 00384 // ° If an attempt is made to assign a dynamic property value to a 00385 // readonly property, then the ReadonlyDynamicProperty exception is 00386 // raised. ° If the "properties" parameter omits any property 00387 // declared in the service type with a mode of mandatory, then a 00388 // MissingMandatoryProperty exception is raised. ° If two or more 00389 // properties with the same property name are included in this 00390 // parameter, the DuplicatePropertyName exception is raised. 00391 // END SPEC 00392 00393 virtual void withdraw (const char *id ACE_ENV_ARG_DECL) 00394 ACE_THROW_SPEC ((CORBA::SystemException, 00395 CosTrading::IllegalOfferId, 00396 CosTrading::UnknownOfferId, 00397 CosTrading::Register::ProxyOfferId)); 00398 00399 // BEGIN SPEC 00400 // The withdraw operation removes the service offer from the trader 00401 // (i.e., after withdraw the offer can no longer be returned as the 00402 // result of a query). The offer is identified by the "id" parameter 00403 // which was originally returned by export. ° If the string 00404 // representation of "id" does not obey the rules for offer 00405 // identifiers, then an IllegalOfferId exception is raised. ° If the 00406 // "id" is legal but there is no offer within the trader with that 00407 // "id," then an UnknownOfferId exception is raised. ° If the "id" 00408 // identifies a proxy offer rather than an ordinary offer, then a 00409 // ProxyOfferId exception is raised. 00410 // END SPEC 00411 00412 virtual CosTrading::Register::OfferInfo* 00413 describe (const char * id 00414 ACE_ENV_ARG_DECL) 00415 ACE_THROW_SPEC ((CORBA::SystemException, 00416 CosTrading::IllegalOfferId, 00417 CosTrading::UnknownOfferId, 00418 CosTrading::Register::ProxyOfferId)); 00419 00420 // BEGIN SPEC 00421 // The describe operation returns the information about an offered 00422 // service that is held by the trader. It comprises the "reference" 00423 // of the offered service, the "type" of the service offer, and the 00424 // "properties" that describe this offer of service. The offer is 00425 // identified by the "id" parameter which was originally returned by 00426 // export. ° If the string representation of "id" does not obey the 00427 // rules for object identifiers, then an IllegalOfferId exception is 00428 // raised. ° If the "id" is legal but there is no offer within the 00429 // trader with that "id," then an UnknownOfferId exception is 00430 // raised. ° If the "id" identifies a proxy offer rather than an 00431 // ordinary offer, then a ProxyOfferId exception is raised. 00432 // END SPEC 00433 00434 virtual void modify (const char * id, 00435 const CosTrading::PropertyNameSeq& del_list, 00436 const CosTrading::PropertySeq& modify_list 00437 ACE_ENV_ARG_DECL) 00438 ACE_THROW_SPEC ((CORBA::SystemException, 00439 CosTrading::NotImplemented, 00440 CosTrading::IllegalOfferId, 00441 CosTrading::UnknownOfferId, 00442 CosTrading::Register::ProxyOfferId, 00443 CosTrading::IllegalPropertyName, 00444 CosTrading::Register::UnknownPropertyName, 00445 CosTrading::PropertyTypeMismatch, 00446 CosTrading::ReadonlyDynamicProperty, 00447 CosTrading::Register::MandatoryProperty, 00448 CosTrading::Register::ReadonlyProperty, 00449 CosTrading::DuplicatePropertyName)); 00450 00451 // BEGIN SPEC 00452 // The modify operation is used to change the description of a 00453 // service as held within a service offer. The object reference and 00454 // the service type associated with the offer cannot be 00455 // changed. This operation may: ° add new (non-mandatory) properties 00456 // to describe an offer, ° change the values of some existing (not 00457 // readonly) properties, or ° delete existing (neither mandatory nor 00458 // readonly) properties. 00459 00460 // The modify operation either succeeds completely or it fails 00461 // completely. The offer is identified by the "id" parameter which 00462 // was originally returned by export. ° If the string representation 00463 // of "id" does not obey the rules for offer identifiers, then an 00464 // IllegalOfferId exception is raised. ° If the "id" is legal but 00465 // there is no offer within the trader with that "id," then an 00466 // UnknownOfferId exception is raised. ° If the "id" identifies a 00467 // proxy offer rather than an ordinary offer, then a ProxyOfferId 00468 // exception is raised. 00469 00470 // The "del_list" parameter gives the names of the properties that 00471 // are no longer to be recorded for the identified offer. Future 00472 // query and describe operations will not see these properties. ° If 00473 // any of the names within the "del_list" do not obey the rules for 00474 // PropertyName's, then an IllegalPropertyName exception is 00475 // raised. ° If a "name" is legal but there is no property for the 00476 // offer with that "name," then an UnknownPropertyName exception is 00477 // raised. ° If the list includes a property that has a mandatory 00478 // mode, then the MandatoryProperty exception is raised. ° If the 00479 // same property name is included two or more times in this 00480 // parameter, the DuplicatePropertyName exception is raised. 00481 00482 // The "modify_list" parameter gives the names and values of 00483 // properties to be changed. If the property is not in the offer, 00484 // then the modify operation adds it. The modified (or added) 00485 // property values are returned in future query and describe 00486 // operations in place of the original values. ° If any of the names 00487 // within the "modify_list" do not obey the rules for 00488 // PropertyName's, then an IllegalPropertyName exception is 00489 // raised. ° If the list includes a property that has a readonly 00490 // mode, then the ReadonlyProperty exception is raised unless that 00491 // readonly property is not currently recorded for the offer. The 00492 // ReadonlyDynamicProperty exception is raised if an attempt is made 00493 // to assign a dynamic property value to a readonly property. ° If 00494 // the value of any modified property is of a type that is not the 00495 // same as the type expected, then the PropertyTypeMismatch 00496 // exception is raised. ° If two or more properties with the same 00497 // property name are included in this argument, the 00498 // DuplicatePropertyName exception is raised. 00499 00500 // The NotImplemented exception shall be raised if and only if the 00501 // supports_modifiable_properties attribute yields FALSE. 00502 // END SPEC 00503 00504 virtual void withdraw_using_constraint (const char *type, 00505 const char *constr 00506 ACE_ENV_ARG_DECL) 00507 ACE_THROW_SPEC ((CORBA::SystemException, 00508 CosTrading::IllegalServiceType, 00509 CosTrading::UnknownServiceType, 00510 CosTrading::IllegalConstraint, 00511 CosTrading::Register::NoMatchingOffers)); 00512 00513 // BEGIN SPEC 00514 // The withdraw_using_constraint operation withdraws a set of offers 00515 // from within a single trader. This set is identified in the same 00516 // way that a query operation identifies a set of offers to be 00517 // returned to an importer. 00518 00519 // The "type" parameter conveys the required service type. Each 00520 // offer of the specified type will have the constraint expression 00521 // applied to it. If it matches the constraint expression, then the 00522 // offer will be withdrawn.° If "type" does not obey the rules for 00523 // service types, then an IllegalServiceType exception is raised. ° 00524 // If the "type" is correct syntactically but is not recognized as a 00525 // service type by the trader, then an UnknownServiceType exception 00526 // is raised. 00527 00528 // The constraint "constr" is the means by which the client 00529 // restricts the set of offers to those that are intended for 00530 // withdrawal. ° If "constr" does not obey the syntax rules for a 00531 // constraint then an IllegalConstraint exception is raised. ° If 00532 // the constraint fails to match with any offer of the specified 00533 // service type, then a NoMatchingOffers exception is raised. 00534 // END SPEC 00535 00536 virtual CosTrading::Register_ptr 00537 resolve (const CosTrading::TraderName &name 00538 ACE_ENV_ARG_DECL) 00539 ACE_THROW_SPEC ((CORBA::SystemException, 00540 CosTrading::Register::IllegalTraderName, 00541 CosTrading::Register::UnknownTraderName, 00542 CosTrading::Register::RegisterNotSupported)); 00543 00544 // BEGIN SPEC 00545 // This operation is used to resolve a context relative name for 00546 // another trader. In particular, it is used when exporting to a 00547 // trader that is known by a name rather than by an object 00548 // reference. The client provides the name, which will be a sequence 00549 // of name components. ° If the content of the parameter cannot 00550 // yield legal syntax for the first component, then the 00551 // IllegalTraderName exception is raised. Otherwise, the first name 00552 // component is compared against the name held in each link. ° If no 00553 // match is found, or the trader does not support links, the 00554 // UnknownTraderName exception is raised. Otherwise, the trader 00555 // obtains the register_if held as part of the matched link. ° If 00556 // the Register interface is not nil, then the trader binds to the 00557 // Register interface and invokes resolve but passes the TraderName 00558 // with the first component removed; if it is nil, then the 00559 // RegisterNotSupported exception is raised. When a trader is able 00560 // to match the first name component leaving no residual name, that 00561 // trader returns the reference for the Register interface for that 00562 // linked trader. In unwinding the recursion, intermediate traders 00563 // return the Register interface reference to their client (another 00564 // trader). 00565 // END SPEC 00566 00567 protected: 00568 00569 void validate_properties (const char* type, 00570 const CosTradingRepos::ServiceTypeRepository::TypeStruct* type_struct, 00571 const CosTrading::PropertySeq& properties 00572 ACE_ENV_ARG_DECL) 00573 ACE_THROW_SPEC ((CosTrading::IllegalPropertyName, 00574 CosTrading::PropertyTypeMismatch, 00575 CosTrading::ReadonlyDynamicProperty, 00576 CosTrading::MissingMandatoryProperty, 00577 CosTrading::DuplicatePropertyName)); 00578 00579 // = Disallow these operations. 00580 ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_Register<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &)) 00581 ACE_UNIMPLEMENTED_FUNC (TAO_Register (const TAO_Register<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &)) 00582 00583 private: 00584 00585 TAO_Trader<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &trader_; 00586 }; 00587 00588 /** 00589 * @class TAO_Admin 00590 * 00591 * @brief This class implements CosTrading::Admin IDL interface. 00592 * 00593 * DESCRIPTION (FROM SPEC) 00594 * The admin interface enables the values of the trader attributes to 00595 * be read and written. All attributes are defined as readonly in 00596 * either SupportAttributes, ImportAttributes, LinkAttributes, or 00597 * Admin. To set the trader "attribute" to a new value, 00598 * set_<attribute_name> operations are defined in Admin. Each of these 00599 * set operations returns the previous value of the attribute as its 00600 * function value. If the admin interface operation 00601 * set_support_proxy_offers is invoked with a value set to FALSE in a 00602 * trader which supports the proxy interface, the 00603 * set_support_proxy_offer value does not affect the function of 00604 * operations in the proxy interface. However, in this case, it does 00605 * have the effect of making any proxy offers exported via the proxy 00606 * interface for that trader unavailable to satisfy queries on that 00607 * trader's lookup interface. 00608 */ 00609 template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE> 00610 class TAO_Admin : 00611 public TAO_Trader_Components <POA_CosTrading::Admin>, 00612 public TAO_Support_Attributes <POA_CosTrading::Admin>, 00613 public TAO_Import_Attributes <POA_CosTrading::Admin>, 00614 public TAO_Link_Attributes <POA_CosTrading::Admin> 00615 { 00616 public: 00617 00618 TAO_Admin (TAO_Trader<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &trader); 00619 00620 ~TAO_Admin (void); 00621 00622 // = Importing Parameters (used by the Lookup Interface) 00623 00624 /// Search card is the cardinality of the offers searched for 00625 /// constraint compliance. 00626 virtual CORBA::ULong set_def_search_card (CORBA::ULong value 00627 ACE_ENV_ARG_DECL_NOT_USED) 00628 ACE_THROW_SPEC ((CORBA::SystemException)); 00629 virtual CORBA::ULong set_max_search_card (CORBA::ULong value 00630 ACE_ENV_ARG_DECL_NOT_USED) 00631 ACE_THROW_SPEC ((CORBA::SystemException)); 00632 00633 00634 /// Match card is the cardinality of offers found compliant with the 00635 /// constraints. 00636 virtual CORBA::ULong set_def_match_card (CORBA::ULong value 00637 ACE_ENV_ARG_DECL_NOT_USED) 00638 ACE_THROW_SPEC ((CORBA::SystemException)); 00639 virtual CORBA::ULong set_max_match_card (CORBA::ULong value 00640 ACE_ENV_ARG_DECL_NOT_USED) 00641 ACE_THROW_SPEC ((CORBA::SystemException)); 00642 00643 /// Return card is the cardinality of the offers returned from 00644 /// Lookup. 00645 virtual CORBA::ULong set_def_return_card (CORBA::ULong value 00646 ACE_ENV_ARG_DECL_NOT_USED) 00647 ACE_THROW_SPEC ((CORBA::SystemException)); 00648 virtual CORBA::ULong set_max_return_card (CORBA::ULong value 00649 ACE_ENV_ARG_DECL_NOT_USED) 00650 ACE_THROW_SPEC ((CORBA::SystemException)); 00651 00652 /// Types of offers available for consideration. Ween out those 00653 /// offers with modifiable properties 00654 virtual CORBA::ULong set_max_list (CORBA::ULong value 00655 ACE_ENV_ARG_DECL_NOT_USED) 00656 ACE_THROW_SPEC ((CORBA::SystemException)); 00657 virtual CORBA::Boolean 00658 set_supports_modifiable_properties (CORBA::Boolean value 00659 ACE_ENV_ARG_DECL_NOT_USED) 00660 ACE_THROW_SPEC ((CORBA::SystemException)); 00661 virtual CORBA::Boolean 00662 set_supports_dynamic_properties (CORBA::Boolean value 00663 ACE_ENV_ARG_DECL_NOT_USED) 00664 ACE_THROW_SPEC ((CORBA::SystemException)); 00665 virtual CORBA::Boolean 00666 set_supports_proxy_offers (CORBA::Boolean value 00667 ACE_ENV_ARG_DECL_NOT_USED) 00668 ACE_THROW_SPEC ((CORBA::SystemException)); 00669 00670 // = Link Interface parameters 00671 00672 virtual CORBA::ULong set_def_hop_count (CORBA::ULong value 00673 ACE_ENV_ARG_DECL_NOT_USED) 00674 ACE_THROW_SPEC ((CORBA::SystemException)); 00675 virtual CORBA::ULong set_max_hop_count (CORBA::ULong value 00676 ACE_ENV_ARG_DECL_NOT_USED) 00677 ACE_THROW_SPEC ((CORBA::SystemException)); 00678 00679 virtual CosTrading::FollowOption 00680 set_def_follow_policy (CosTrading::FollowOption policy 00681 ACE_ENV_ARG_DECL_NOT_USED) 00682 ACE_THROW_SPEC ((CORBA::SystemException)); 00683 virtual CosTrading::FollowOption 00684 set_max_follow_policy (CosTrading::FollowOption policy 00685 ACE_ENV_ARG_DECL_NOT_USED) 00686 ACE_THROW_SPEC ((CORBA::SystemException)); 00687 virtual CosTrading::FollowOption 00688 set_max_link_follow_policy (CosTrading::FollowOption policy 00689 ACE_ENV_ARG_DECL_NOT_USED) 00690 ACE_THROW_SPEC ((CORBA::SystemException)); 00691 00692 // = Set Type Repository 00693 00694 virtual CosTrading::TypeRepository_ptr 00695 set_type_repos (CosTrading::TypeRepository_ptr repository 00696 ACE_ENV_ARG_DECL_NOT_USED) 00697 ACE_THROW_SPEC ((CORBA::SystemException)); 00698 00699 virtual CosTrading::Admin::OctetSeq* 00700 request_id_stem (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) 00701 ACE_THROW_SPEC ((CORBA::SystemException)); 00702 00703 virtual CosTrading::Admin::OctetSeq* 00704 set_request_id_stem (const CosTrading::Admin::OctetSeq& stem 00705 ACE_ENV_ARG_DECL_NOT_USED) 00706 ACE_THROW_SPEC ((CORBA::SystemException)); 00707 00708 virtual void list_offers (CORBA::ULong how_many, 00709 CosTrading::OfferIdSeq_out ids, 00710 CosTrading::OfferIdIterator_out id_itr 00711 ACE_ENV_ARG_DECL) 00712 ACE_THROW_SPEC ((CORBA::SystemException, 00713 CosTrading::NotImplemented)); 00714 00715 00716 // BEGIN SPEC 00717 // The list_offers operation allows the administrator of a trader to 00718 // perform housekeeping by obtaining a handle on each of the offers 00719 // within a trader (e.g., for garbage collection etc.). Only the 00720 // identifiers of ordinary offers are returned, identifiers of proxy 00721 // offers are not returned via this operation. If the trader does 00722 // not support the Register interface, the NotImplemented exception 00723 // is raised. The returned identifiers are passed back in one of two 00724 // ways (or a combination of both). ° The "ids" return result 00725 // conveys a list of offer identifiers and the "id_itr" is a 00726 // reference to an interface at which additional offer identities 00727 // can be obtained. ° The "how_many" parameter states how many 00728 // identifiers are to be returned via the "ids" result; any 00729 // remaining are available via the iterator interface. If the 00730 // "how_many" exceeds the number of offers held in the trader, then 00731 // the "id_itr" is nil. 00732 // END SPEC 00733 00734 virtual void list_proxies (CORBA::ULong, 00735 CosTrading::OfferIdSeq_out, 00736 CosTrading::OfferIdIterator_out 00737 ACE_ENV_ARG_DECL) 00738 ACE_THROW_SPEC ((CORBA::SystemException, 00739 CosTrading::NotImplemented)); 00740 00741 private: 00742 00743 // = Disallow these operations. 00744 ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_Admin<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &)) 00745 ACE_UNIMPLEMENTED_FUNC (TAO_Admin (const TAO_Admin<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &)) 00746 00747 TAO_Trader<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &trader_; 00748 00749 /// Unique prefix to create a sequence number space. 00750 CosTrading::Admin::OctetSeq stem_id_; 00751 00752 /// Current sequence number. 00753 CORBA::ULong sequence_number_; 00754 00755 TRADER_LOCK_TYPE lock_; 00756 }; 00757 00758 00759 /** 00760 * @class TAO_Link 00761 */ 00762 template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE> 00763 class TAO_Link : 00764 public TAO_Trader_Components <POA_CosTrading::Link>, 00765 public TAO_Support_Attributes <POA_CosTrading::Link>, 00766 public TAO_Link_Attributes <POA_CosTrading::Link> 00767 { 00768 public: 00769 00770 TAO_Link (TAO_Trader<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &trader); 00771 00772 ~TAO_Link (void); 00773 00774 /** 00775 * BEGIN SPEC 00776 * The add_link operation allows a trader subsequently to use the 00777 * service of another trader in the performance of its own trading 00778 * service operations. 00779 */ 00780 virtual void add_link (const char *name, 00781 CosTrading::Lookup_ptr target, 00782 CosTrading::FollowOption def_pass_on_follow_rule, 00783 CosTrading::FollowOption limiting_follow_rule 00784 ACE_ENV_ARG_DECL) 00785 ACE_THROW_SPEC ((CORBA::SystemException, 00786 CosTrading::Link::IllegalLinkName, 00787 CosTrading::Link::DuplicateLinkName, 00788 CosTrading::InvalidLookupRef, 00789 CosTrading::Link::DefaultFollowTooPermissive, 00790 CosTrading::Link::LimitingFollowTooPermissive)); 00791 00792 // The "name" parameter is used in subsequent link management 00793 // operations to identify the intended link. If the parameter is not 00794 // legally formed, then the IllegalLinkName exception is raised. An 00795 // exception of DuplicateLinkName is raised if the link name already 00796 // exists. The link name is also used as a component in a sequence 00797 // of name components in naming a trader for resolving or forwarding 00798 // operations. The sequence of context relative link names provides 00799 // a path to a trader. 00800 00801 // The "target" parameter identifies the Lookup interface at which 00802 // the trading service provided by the target trader can be 00803 // accessed. Should the Lookup interface parameter be nil, then an 00804 // exception of InvalidLookupRef is raised. The target interface is 00805 // used to obtain the associated Register interface, which will be 00806 // subsequently returned as part of a describe_link operation and 00807 // invoked as part of a resolve operation. 00808 00809 // The "def_pass_on_follow_rule" parameter specifies the default 00810 // link behavior for the link if no link behavior is specified on an 00811 // importer's query request. If the "def_pass_on_follow_rule" 00812 // exceeds the "limiting_follow_rule" specified in the next 00813 // parameter, then a DefaultFollowTooPermissive exception is 00814 // raised. 00815 00816 // The "limiting_follow_rule" parameter specifies the most 00817 // permissive link follow behavior that the link is willing to 00818 // tolerate. The exception LimitingFollowTooPermissive is raised if 00819 // this parameter exceeds the trader's attribute of 00820 // "max_link_follow_policy" at the time of the link's creation. Note 00821 // it is possible for a link's "limiting_follow_rule" to exceed the 00822 // trader's "max_link_follow_policy" later in the life of a link, as 00823 // it is possible that the trader could set its 00824 // "max_link_follow_policy" to a more restrictive value after the 00825 // creation of the link. 00826 // END SPEC 00827 00828 virtual void remove_link (const char *name 00829 ACE_ENV_ARG_DECL) 00830 ACE_THROW_SPEC ((CORBA::SystemException, 00831 CosTrading::Link::IllegalLinkName, 00832 CosTrading::Link::UnknownLinkName)); 00833 00834 // BEGIN SPEC 00835 // The remove_link operation removes all knowledge of the target 00836 // trader. The target trader cannot be used subsequently to resolve, 00837 // forward, or propagate trading operations from this trader. 00838 00839 // The "name" parameter identifies the link to be removed. The 00840 // exception IllegalLinkName is raised if the link is formed poorly 00841 // and the UnknownLinkName exception is raised if the named link is 00842 // not in the trader. 00843 // END SPEC 00844 00845 virtual CosTrading::Link::LinkInfo* describe_link (const char *name 00846 ACE_ENV_ARG_DECL_NOT_USED) 00847 ACE_THROW_SPEC ((CORBA::SystemException, 00848 CosTrading::Link::IllegalLinkName, 00849 CosTrading::Link::UnknownLinkName)); 00850 00851 // BEGIN SPEC 00852 // The describe_link operation returns information on a link held in 00853 // the trader. 00854 00855 // The "name" parameter identifies the link whose description is 00856 // required. For a malformed link name, the exception 00857 // IllegalLinkName is raised. An UnknownLinkName exception is raised 00858 // if the named link is not found in the trader. 00859 00860 // The operation returns a LinkInfo structure comprising: ° the 00861 // Lookup interface of the target trading service, ° the Register 00862 // interface of the target trading service, and ° the default, as 00863 // well as the limiting follow behavior of the named link. 00864 00865 // If the target service does not support the Register interface, 00866 // then that field of the LinkInfo structure is nil. Given the 00867 // description of the Register::resolve() operation in "Resolve 00868 // Operation" on page 16-45, most implementations will opt for 00869 // determining the Register interface when add_link is called and 00870 // storing that information statically with the rest of the link 00871 // state. 00872 // END SPEC 00873 00874 virtual CosTrading::LinkNameSeq* list_links (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) 00875 ACE_THROW_SPEC ((CORBA::SystemException)); 00876 00877 // BEGIN SPEC 00878 // The list_links operation returns a list of the names of all 00879 // trading links within the trader. The names can be used 00880 // subsequently for other management operations, such as 00881 // describe_link or remove_link. 00882 // END SPEC 00883 00884 virtual void modify_link (const char *name, 00885 CosTrading::FollowOption def_pass_on_follow_rule, 00886 CosTrading::FollowOption limiting_follow_rule 00887 ACE_ENV_ARG_DECL) 00888 ACE_THROW_SPEC ((CosTrading::Link::IllegalLinkName, 00889 CosTrading::Link::UnknownLinkName, 00890 CosTrading::Link::DefaultFollowTooPermissive, 00891 CosTrading::Link::LimitingFollowTooPermissive)); 00892 00893 // BEGIN SPEC 00894 // The modify_link operation is used to change the existing link 00895 // follow behaviors of an identified link. The Lookup interface 00896 // reference of the target trader and the name of the link cannot be 00897 // changed. 00898 00899 // The "name" parameter identifies the link whose follow behaviors 00900 // are to be changed. A poorly formed "name" raises the 00901 // IllegalLinkName exception. An UnknownLinkName exception is raised 00902 // if the link name is not known to the trader. 00903 00904 // The "def_pass_on_follow_rule" parameter specifies the new default 00905 // link behavior for this link. If the "def_pass_on_follow_rule" 00906 // exceeds the "limiting_follow_rule" specified in the next 00907 // parameter, then a DefaultFollowTooPermissive exception is 00908 // raised. 00909 00910 // The "limiting_follow_rule" parameter specifies the new limit for 00911 // the follow behavior of this link. The exception 00912 // LimitingFollowTooPermissive is raised if the value exceeds the 00913 // current "max_link_follow_policy" of the trader. 00914 // END SPEC 00915 00916 private: 00917 00918 // = Disallow these operations. 00919 ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_Link<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &)) 00920 ACE_UNIMPLEMENTED_FUNC (TAO_Link (const TAO_Link<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &)) 00921 00922 typedef ACE_Hash_Map_Manager_Ex 00923 < 00924 CORBA::String_var, 00925 CosTrading::Link::LinkInfo, 00926 ACE_Hash<CORBA::String_var>, 00927 ACE_Equal_To<CORBA::String_var>, 00928 MAP_LOCK_TYPE 00929 > 00930 Links; 00931 00932 /// The collection of link connecting this trader to others in the 00933 /// federation. 00934 Links links_; 00935 00936 TAO_Trader<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &trader_; 00937 }; 00938 00939 // ************************************************************* 00940 // TAO_Proxy 00941 // ************************************************************* 00942 00943 template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE> 00944 class TAO_Proxy : 00945 public TAO_Trader_Components <POA_CosTrading::Proxy>, 00946 public TAO_Support_Attributes <POA_CosTrading::Proxy> 00947 { 00948 public: 00949 00950 TAO_Proxy (TAO_Trader<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &trader); 00951 00952 ~TAO_Proxy (void); 00953 00954 virtual CosTrading::OfferId 00955 export_proxy (CosTrading::Lookup_ptr, 00956 const char *, 00957 const CosTrading::PropertySeq &, 00958 CORBA::Boolean if_match_all, 00959 const char *, 00960 const CosTrading::PolicySeq & 00961 ACE_ENV_ARG_DECL) 00962 ACE_THROW_SPEC ((CORBA::SystemException, 00963 CosTrading::IllegalServiceType, 00964 CosTrading::UnknownServiceType, 00965 CosTrading::InvalidLookupRef, 00966 CosTrading::IllegalPropertyName, 00967 CosTrading::PropertyTypeMismatch, 00968 CosTrading::ReadonlyDynamicProperty, 00969 CosTrading::MissingMandatoryProperty, 00970 CosTrading::Proxy::IllegalRecipe, 00971 CosTrading::DuplicatePropertyName, 00972 CosTrading::DuplicatePolicyName)); 00973 00974 virtual void withdraw_proxy (const char * 00975 ACE_ENV_ARG_DECL) 00976 ACE_THROW_SPEC ((CORBA::SystemException, 00977 CosTrading::IllegalOfferId, 00978 CosTrading::UnknownOfferId, 00979 CosTrading::Proxy::NotProxyOfferId)); 00980 00981 virtual CosTrading::Proxy::ProxyInfo * 00982 describe_proxy (const char * 00983 ACE_ENV_ARG_DECL) 00984 ACE_THROW_SPEC ((CORBA::SystemException, 00985 CosTrading::IllegalOfferId, 00986 CosTrading::UnknownOfferId, 00987 CosTrading::Proxy::NotProxyOfferId)); 00988 00989 // = CosTrading::TraderComponents methods. 00990 00991 virtual void list_proxies (CORBA::ULong, 00992 CosTrading::OfferIdSeq *&, 00993 CosTrading::OfferIdIterator_ptr & 00994 ACE_ENV_ARG_DECL) 00995 ACE_THROW_SPEC ((CORBA::SystemException, 00996 CosTrading::NotImplemented)); 00997 00998 private: 00999 01000 // = Disallow these operations. 01001 ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_Proxy<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &)) 01002 ACE_UNIMPLEMENTED_FUNC (TAO_Proxy (const TAO_Proxy<TRADER_LOCK_TYPE,MAP_LOCK_TYPE> &)) 01003 01004 01005 TAO_Trader<TRADER_LOCK_TYPE,MAP_LOCK_TYPE>& trader_; 01006 }; 01007 01008 TAO_END_VERSIONED_NAMESPACE_DECL 01009 01010 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 01011 #include "orbsvcs/Trader/Trader_Interfaces.cpp" 01012 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 01013 01014 #if defined(_MSC_VER) 01015 #pragma warning(pop) 01016 #endif /* _MSC_VER */ 01017 01018 #include /**/ "ace/post.h" 01019 #endif /* TAO_TRADER_INTERFACES_H */