5949884be9f099350407fc39a0d2f088.ppt
- Количество слайдов: 34
Trading Service i Outline 4 What is trading service 4 How to use trading service 4 Printer Example Trading Service 1
Motivation i Locating objects in location transparent way i Naming simple but may not be suitable when 4 clients do not know server 4 there are multiple servers to choose from i Trading supports locating servers based on service functionality and quality i Naming « White pages i Trading « Yellow Pages Trading Service 2
Trading Characteristics Trader 3: invoke y er 1: ex Qu Exporter 2: po r t i Trader operates as broker between client and server. i Enables client to change perspective from ´who? ´ to ´what? ´ Importer Similar ideas in: • mortgage broker • insurance broker • stock brokerage Trading Service 3
Trading Characteristics i Common language between client and server: 4 Service types 4 Qualities of service i Server registers service with trader. i Server defines assured quality of service: 4 Static Qo. S definition 4 Dynamic Qo. S definition. Trading Service 4
Trading Characteristics i Clients ask trader for 4 a service of a certain type 4 at a certain level of quality i Trader supports 4 service matching 4 service shopping Trading Service 5
Example i Hongkong Telecom video-on-demand server: Server Video-ondemand provider MGM Warner User Trader Independent Trading Service 6
CORBA Trading Service Server Client Application object. Impl proxy export() modify() withdraw() Query() CORBA Trading Service lookup register link proxy Trading Service Admin 7
The Trading Process i Example: Video-on-demand server : Client : Trader MGM: Vo. DS Warner: Vo. DS export( ) Query( ) modify( ) download( ) Trading Service 8
Trading Service Interface i Service type repository i Trader components i Iterators i Dynamic properties i Lookup: importers make queries i Register: exporters advertise new service offers i Link: admins federate traders i Admin: admins set policies i Proxy: legacy mechanisms for advertising services Trading Service 9
Service Type Definition i Service types define 4 Functionality provided by a service and 4 Qualities of Service (Qo. S) provision. i Functionality defined by object type i Qo. S defined based on properties, i. e. 4 property name 4 property type 4 property value 4 property mode h mandatory/optional h readonly/modifiable Trading Service 10
Service Type Example typedef enum {VGA, SVGA, XGA} Resolution; service video_on_demand { interface Video. Server; readonly mandatory property float fee; readonly mandatory property Resolution res; modifiable optional property float bandwidth; } Trading Service 11
Service Type Hierarchy i An object type might have several implementations with different Qo. S. i Same object type might be used in different service types. i Service type S is subtype of service S’ iff 4 object type of S is identical or subtype of object type of S’ 4 S has at least all properties defined for S’ i Subtype relationship can be exploited by trader for service matching purposes Trading Service 12
Constraint Definition i Importer defines the desired qualities of service as part of the query: i Example: fee<10 AND res >=SGA AND bandwidth>=256 i In a query, trader matches only those offers that meet the constraint Trading Service 13
Trading Policies i Depending on constraint and available services, a large set of offer might be returned by a query. i Trading policies are used to restrict the size of the matched offers 4 Specification of an upper limit 4 Restriction on service replacements 4 Restriction on modifiable properties (these might change between match making and service requests) Trading Service 14
Federated Traders i Scalability demands federation of traders i A trader participating in a federation 4 offers the services it knows about to other traders 4 forwards queries it cannot satisfy to other traders i Problems 4 Non-termination of import 4 Duplication of matched offers Trading Service 15
Trading Graph query. hop_count=4 T 1 def_follow_policy=always max_hop_count=5 T 2 max_hop_count=1 T 3 Service Offer T 4 Trader Attribute Link Trading Service query. hop_count=0 16
CORBA Trading Service Application Objects Domain Interfaces CORBA facilities Object Request Broker CORBAservices Trading Service Object Trader 17
CORBA Trading Interfaces Admin list_offers() … Link. Attributes Trader. Components Link add_link() remove_link() describe_link() modify_link() Support Attributes Lookup query() Trading Service Import. Attributes Register export() withdraw() modify() 18
Defining Quality of Service typedef Istring Property. Name; typedef sequence
Trader Interface for Exporters interface Register { Offer. Id export(in Object reference, in Service. Type. Name type, in Property. Seq properties) raises(. . . ); Offer. Id withdraw(in Offer. Id id) raises(. . . ); void modify(in Offer. Id id, in Property. Name. Seq del_list, in Property. Seq modify_list) raises (. . . ); }; Trading Service 20
Trader Interface for Importers interface Lookup { void query(in Service. Type. Name type, in Constraint const, in Preference pref, in Policy. Seq policies, in Specified. Props desired_props, in unsigned long how_many, out Offer. Seq offers, out Offer. Iterator offer_itr, out Policy. Name. Seq Limits_applied) raises (. . . ); }; Trading Service 21
Service Type Repository i Service type 4 Name 4 Interfact type 4 Set of properties h Name h Typecode h Read-only/modifiable h Mandatory/optional Trading Service 22
Service Type Repository i Substitutability of service types 4 The interface type of a derived service type may be a subtype of the interface type in the base service type 4 The property set may be extended in a derived service type with new property name (and their associated type and mode specification) 4 Inherited properties may be strengthened h Optional mandatory h Modifiable read-only Trading Service 23
Service Type Repository i creating service type // operation signatures Incarnation. Number add_type ( in Cos. Trading: : Service. Type. Name name, in Identifier if_name, in Prop. Struct. Seq props, in Service. Type. Name. Seq super_types ) raises ( Cos. Trading: : Illegal. Service. Type, Service. Type. Exists, Interface. Type. Mismatch, Cos. Trading: : Illegal. Property. Name, Cos. Trading: : Duplicate. Property. Name, Value. Type. Redefinition, Cos. Trading: : Unknown. Service. Type, Duplicate. Service. Type. Name ); Trading Service 24
Service Type Repository i Removing service type void remove_type ( in Cos. Trading: : Service. Type. Name name ) raises ( Cos. Trading: : Illegal. Service. Type, Cos. Trading: : Unknown. Service. Type, Has. Sub. Types ); Trading Service 25
Service Type Repository i Obtaining service type info Service. Type. Name. Seq list_types ( in Specified. Service. Types which_types ); Type. Struct describe_type ( in Cos. Trading: : Service. Type. Name name ) raises ( Cos. Trading: : Illegal. Service. Type, Cos. Trading: : Unknown. Service. Type ); Type. Struct fully_describe_type ( in Cos. Trading: : Service. Type. Name name ) raises ( Cos. Trading: : Illegal. Service. Type, Cos. Trading: : Unknown. Service. Type ); Trading Service 26
Service Type Repository i Masking/unmasking types void mask_type ( in Cos. Trading: : Service. Type. Name name ) raises ( Cos. Trading: : Illegal. Service. Type, Cos. Trading: : Unknown. Service. Type, Already. Masked ); void unmask_type ( in Cos. Trading: : Service. Type. Name name ) raises ( Cos. Trading: : Illegal. Service. Type, Cos. Trading: : Unknown. Service. Type, Not. Masked ); Trading Service 27
Service Type Repository i properties interface Service. Type. Repository { enum Property. Mode { PROP_NORMAL, PROP_READONLY, PROP_MANDATORY_READONLY }; struct Prop. Struct { Cos. Trading: : Property. Name name; CORBA: : Type. Code value_type; Property. Mode mode; }; }; Trading Service 28
Printer Example i Printerface Printer { typedef string filename; exception Printer. Off. Line { short code; }; void print_file(in filename fn) raises(Printer. Off. Line); short queue_length() raises(Printer. Off. Line); }; interface Trading. Printer : Printer, Cos. Trading. Dynamic: : Dynamic. Prop. Eval {}; }; Trading Service 29
Printer Example i Printer property 4 Building 4 Floor 4 Language 4 Resolution 4 Color 4 Queue_len 4 Name “A Block”, “A Block” ; “ A Block” 2, 3, 7 Post. Script, Post. Script 300, 600 black, 256 color - [Printer. Object. Ref]->queue_length() “ 12 ps”, “monster”, “rib” Trading Service 30
Printer Example i Implementing the Printer Interface 4 void print_file(string fn); 4 Short queue_length(); 4 Any eval. DP(string name, Type. Code returned_type, Any extra_info); Trading Service 31
Printer Example i Implementing the Printer Server 4 ORB initialization 4 Get trader reference 4 Find service type repository 4 Check for service type existence, if not exist, create it: h Create a prop struct ist with the property name for a printer service type h Add the new service type 4 Create service offer property seq to use for export 4 Create printers (use command-line arguments) and making them available to ORB 4 Update the template service offer to advertise them Trading Service 32
Printer Example i Implementing the Printer Client 4 Arguments: h Name of the file to print h Constraint expression for searching criteria h Preference expression to order the printer service offers returned 4 Implementation: h Check for arguments h Find Lookup object h Process the commend-line arguments h Establish basic policies for a trader query h Make the query h The returned Printer object are tried in order until the file is successfully printed Trading Service 33
Key Points i Distributed objects can be located by naming and trading i Naming binds externally known names to an object reference and supports name resolution to reveal the object reference i Trading supports locating objects based on the functionality that they offer and the quality of service that they guarantee Trading Service 34