diff options
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Trader/Lookup.h')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Lookup.h | 313 |
1 files changed, 0 insertions, 313 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Trader/Lookup.h b/TAO/orbsvcs/orbsvcs/Trader/Lookup.h deleted file mode 100644 index 35efd553f52..00000000000 --- a/TAO/orbsvcs/orbsvcs/Trader/Lookup.h +++ /dev/null @@ -1,313 +0,0 @@ -/* -*- C++ -*- */ - -// ============================================================================ -// $Id$ -// -// = LIBRARY -// orbsvcs -// -// = FILENAME -// Lookup.h -// -// = AUTHOR -// Marina Spivak <marina@cs.wustl.edu> -// Seth Widoff <sbw1@cs.wustl.edu> -// Irfan Pyarali <irfan@cs.wustl.edu> -// -// ============================================================================ - -#ifndef TAO_LOOKUP_H -#define TAO_LOOKUP_H - -#include "CosTradingS.h" -#include "Policies.h" -#include "Offer_Filter.h" -#include "Offer_Filter.h" -#include "Property_Filter.h" -#include "Offer_Iterator.h" -#include "Constraint_Interpreter.h" -#include "Preference_Interpreter.h" - -template<class TRADER> -class TAO_Lookup : public POA_CosTrading::Lookup - // - // = TITLE - // This class implements CosTrading::Lookup IDL interface. -{ -public: - - TAO_Lookup (TRADER &trader); - - ~TAO_Lookup (void); - - virtual void - query (const char *type, - const char *constr, - const char *pref, - const CosTrading::PolicySeq& policies, - const CosTrading::Lookup::SpecifiedProps& desired_props, - CORBA::ULong how_many, - CosTrading::OfferSeq_out offers, - CosTrading::OfferIterator_out offer_itr, - CosTrading::PolicyNameSeq_out limits_applied, - CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException, - CosTrading::IllegalServiceType, - CosTrading::UnknownServiceType, - CosTrading::IllegalConstraint, - CosTrading::Lookup::IllegalPreference, - CosTrading::Lookup::IllegalPolicyName, - CosTrading::Lookup::PolicyTypeMismatch, - CosTrading::Lookup::InvalidPolicyValue, - CosTrading::IllegalPropertyName, - CosTrading::DuplicatePropertyName, - CosTrading::DuplicatePolicyName); - - // BEGIN SPEC - // The query operation is the means by which an object can obtain - // references to other objects that provide services meeting its - // requirements. - - // The "type" parameter conveys the required service type. It is key - // to the central purpose of trading: to perform an introduction for - // future type safe interactions between importer and exporter. By - // stating a service type, the importer implies the desired interface - // type and a domain of discourse for talking about properties of the - // service. - - // The trader may return a service offer of a subtype of the "type" - // requested. Sub-typing of service types is discussed in "Service - // Types" on page 16-4. A service subtype can be described by the - // properties of its supertypes. This ensures that a well-formed - // query for the "type" is also a well-formed query with respect to - // any subtypes. However, if the importer specifies the policy of - // exact_type_match = TRUE, then only offers with the exact (no - // subtype) service type requested are returned. - - // The constraint "constr" is the means by which the importer states - // those requirements of a service that are not captured in the - // signature of the interface. These requirements deal with the - // computational behavior of the desired service, non-functional - // aspects, and non-computational aspects (such as the organization - // owning the objects that provide the service). An importer is - // always guaranteed that any returned offer satisfies the matching - // constraint at the time of import. If the "constr" does not obey - // the syntax rules for a legal constraint expression, then an - // IllegalConstraint exception is raised. - - // The "pref" parameter is also used to order those offers that - // match the "constr" so that the offers returned by the trader are - // in the order of greatest interest to the importer. If "pref" does - // not obey the syntax rules for a legal preference expression, then - // an IllegalPreference exception is raised. - - // The "policies" parameter allows the importer to specify how the - // search should be performed as opposed to what sort of services - // should be found in the course of the search. This can be viewed - // as parameterizing the algorithms within the trader - // implementation. The "policies" are a sequence of name-value - // pairs. The names available to an importer depend on the - // implementation of the trader. However, some names are - // standardized where they effect the interpretation of other - // parameters or where they may impact linking and federation of - // traders. - - // The "desired_props" parameter defines the set of properties - // describing returned offers that are to be returned with the - // object reference. There are three possibilities, the importer - // wants one of the properties, all of the properties (but without - // having to name them), or some properties (the names of which are - // provided). - - // The desired_props parameter does not affect whether or not a - // service offer is returned. To avoid "missing" desired properties, - // the importer should specify "exists prop_name" in the - // constraint. - - // The returned offers are passed back in one of two ways (or a - // combination of both). °The "offers" return result conveys a list - // of offers and the "offer_itr" is a reference to an interface at - // which offers can be obtained. The "how_many" parameter states - // how many offers are to be returned via the "offers" result, any - // remaining offers are available via the iterator interface. If the - // "how_many" exceeds the number of offers to be returned, then the - // "offer_itr" will be nil. - - // If any cardinality or other limits were applied by one or more - // traders in responding to a particular query, then the - // "limits_applied" parameter will contain the names of the policies - // which limited the query. The sequence of names returned in - // "limits_applied" from any federated or proxy queries must be - // concatenated onto the names of limits applied locally and - // returned. - // END SPEC - - // = CosTrading::TraderComponents methods. - virtual CosTrading::Lookup_ptr lookup_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns an object reference to the Lookup interface of the trader. - // Returns nil if the trader does not support Lookup interface. - - virtual CosTrading::Register_ptr register_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference for the Register interface of the trader. - // Returns nil if the trader does not support Register interface. - - virtual CosTrading::Link_ptr link_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference for the Link interface of the trader. - // Returns nil if the trader does not support Link interface. - - virtual CosTrading::Proxy_ptr proxy_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference to the Proxy interface of the trader. - // Returns nil if the trader does not support Proxy interface. - - virtual CosTrading::Admin_ptr admin_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference for the Admin interface of the trader. - // Returns nil if the trader does not support Admin interface. - - // = CosTrading::ImportAttributes methods. - - virtual CORBA::ULong def_search_card (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::ULong max_search_card (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - // Search cardinality determines the maximum number of offers searched - // before not considering other offers. - - virtual CORBA::ULong def_match_card (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::ULong max_match_card (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - // Match cardinality determines the maximum number of offers - // matched to the constraints before not considering other offers.. - - virtual CORBA::ULong def_return_card (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::ULong max_return_card (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - // Return cardinality determines the maximum number of offers marked - // to return before not considering other offers. - - - virtual CORBA::ULong max_list (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::ULong def_hop_count (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::ULong max_hop_count (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CosTrading::FollowOption def_follow_policy (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CosTrading::FollowOption max_follow_policy (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - // = CosTrading::SupportAttributes methods. - - virtual CORBA::Boolean supports_modifiable_properties (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::Boolean supports_dynamic_properties (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::Boolean supports_proxy_offers (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CosTrading::TypeRepository_ptr type_repos (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - static const char* NAME; - - // Handy Typedefs - typedef CosTradingRepos::ServiceTypeRepository SERVICE_TYPE_REPOS; - typedef CosTradingRepos::ServiceTypeRepository::TypeStruct_var TYPE_STRUCT; - typedef CosTradingRepos::ServiceTypeRepository::ServiceTypeNameSeq_var TYPE_NAME_SEQ; - -private: - - typedef TRADER::LOCAL_OFFER_ITER LOCAL_OFFER_ITER; - typedef TRADER::SERVICE_TYPE_MAP SERVICE_TYPE_MAP; - typedef pair<CosTrading::OfferId, CosTrading::Offer*> OFFER; - typedef deque <OFFER> LOOKUP_OFFER_LIST; - - TAO_Offer_Iterator* - create_offer_iterator (const char *type, - const TAO_Property_Filter& filter); - // Factory method for creating an appropriate Offer Iterator based - // on the presence of the Register Interface. - - void perform_lookup (const char* type, - const char* constraint, - const char* preferences, - SERVICE_TYPE_MAP& service_type_map, - CosTradingRepos::ServiceTypeRepository_ptr rep, - TAO_Policies& policies, - LOOKUP_OFFER_LIST& ordered_offers, - CORBA::Environment& env) - TAO_THROW_SPEC (CosTrading::IllegalConstraint, - CosTrading::Lookup::IllegalPreference, - CosTrading::Lookup::PolicyTypeMismatch, - CosTrading::Lookup::InvalidPolicyValue, - CosTrading::IllegalServiceType, - CosTrading::UnknownServiceType); - // This method has three phases. The first phase passes the - // offer_map through the constraint interpreter, winnowing away - // those offers that don't match the validated constraint. The - // second phase orders the offers using the specified - // preferences. The last phase places the ordered offers into a list - // for returning. At each phase, the cardinality policies specified - // in the policies structure determine the number of offers - // submitted to each phase. - - void lookup_all_subtypes (const char* type, - SERVICE_TYPE_MAP& service_type_map, - CosTradingRepos::ServiceTypeRepository_ptr rep, - TAO_Constraint_Interpreter& constr_inter, - TAO_Preference_Interpreter& pref_inter, - TAO_Offer_Filter& offer_filter); - // Traverse the type hierarchy to pull the matching offers from all - // subtypes of the root type. - - void lookup_one_type (const char* type, - SERVICE_TYPE_MAP& service_type_map, - TAO_Constraint_Interpreter& constr_inter, - TAO_Preference_Interpreter& pref_inter, - TAO_Offer_Filter& offer_filter); - // Check if offers of a type fit the constraints and order them - // according to the preferences submitted. - - void fill_receptacles (const char* type, - LOOKUP_OFFER_LIST& ordered_offers, - CORBA::ULong how_many, - const CosTrading::Lookup::SpecifiedProps& desired_props, - CosTrading::OfferSeq*& offers, - CosTrading::OfferIterator_ptr& offer_itr, - CORBA::Environment& env) - TAO_THROW_SPEC (CosTrading::IllegalPropertyName, - CosTrading::DuplicatePropertyName); - // This method takes the list of ordered offers and places a number - // of them in the sequence of returned offers and the rest into thr - // iterator. In addition, fill_receptacles uses the - // TAO_Property_Filter to ensure the returned offers contain the - // properties specified in the desired_props in parameter. - - TRADER &trader_; - // A reference to the trader for obtaining offer maps. -}; - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "Lookup.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#endif /* TAO_LOOKUP_H */ |