Trader_Interfaces.h

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

Generated on Tue Feb 2 17:49:26 2010 for TAO_CosTrader by  doxygen 1.4.7