Trading Service

advertisement
Trading Service
 Outline
 What is trading service
 How to use trading service
 Printer Example
Trading Service
1
Motivation
 Locating objects in location transparent way
 Naming simple but may not be suitable when
 clients do not know server
 there are multiple servers to choose from
 Trading supports locating servers based on service functionality
and quality
 Naming  White pages
 Trading  Yellow Pages
Trading Service
2
Trading Characteristics
 Trader operates as broker between client and server.
 Enables client to change perspective from ´who?´ to ´what?´
Trader
3: invoke
Exporter
Importer
Similar ideas in:
•mortgage broker
•insurance broker
•stock brokerage
Trading Service
3
Trading Characteristics
 Common language between client and server:
 Service types
 Qualities of service
 Server registers service with trader.
 Server defines assured quality of service:
 Static QoS definition
 Dynamic QoS definition.
Trading Service
4
Trading Characteristics
 Clients ask trader for
 a service of a certain type
 at a certain level of quality
 Trader supports
 service matching
 service shopping
Trading Service
5
Example
 Hongkong Telecom video-on-demand server:
Server
Video-ondemand
provider
MGM
User
Warner
Trader
Independent
Trading Service
6
CORBA Trading Service
Server
Client Application
objectImpl
proxy
export()
modify()
withdraw()
Query()
CORBA Trading Service
lookup
register
link
proxy
Trading Service
Admin
7
The Trading Process
 Example: Video-on-demand server
:Client
:Trader
MGM:VoDS
Warner:VoDS
export( )
export( )
Query( )
modify( )
download( )
Trading Service
8
Trading Service Interface
 Service type repository
 Trader components
 Iterators
 Dynamic properties
 Lookup: importers make queries
 Register: exporters advertise new service offers
 Link: admins federate traders
 Admin: admins set policies
 Proxy: legacy mechanisms for advertising services
Trading Service
9
Service Type Definition
 Service types define
 Functionality provided by a service and
 Qualities of Service (QoS) provision.
 Functionality defined by object type
 QoS defined based on properties, i.e.
 property name
 property type
 property value
 property mode
 mandatory/optional
 readonly/modifiable
Trading Service
10
Service Type Example
typedef enum {VGA,SVGA,XGA} Resolution;
service video_on_demand {
interface VideoServer;
readonly mandatory property float fee;
readonly mandatory property Resolution res;
modifiable optional property float bandwidth;
}
Trading Service
11
Service Type Hierarchy
 An object type might have several implementations with
different QoS.
 Same object type might be used in different service types.
 Service type S is subtype of service S’ iff
 object type of S is identical or subtype of object type of S’
 S has at least all properties defined for S’
 Subtype relationship can be exploited by trader for service
matching purposes
Trading Service
12
Constraint Definition
 Importer defines the desired qualities of service as part of the
query:
 Example:
fee<10 AND res >=SGA AND bandwidth>=256
 In a query, trader matches only those offers that meet the
constraint
Trading Service
13
Trading Policies
 Depending on constraint and available services, a large set of
offer might be returned by a query.
 Trading policies are used to restrict the size of the matched
offers
 Specification of an upper limit
 Restriction on service replacements
 Restriction on modifiable properties (these might change between match
making and service requests)
Trading Service
14
Federated Traders
 Scalability demands federation of traders
 A trader participating in a federation
 offers the services it knows about to other traders
 forwards queries it cannot satisfy to other traders
 Problems
 Non-termination of import
 Duplication of matched offers
Trading Service
15
Trading Graph
query.hop_count=4
T1
def_follow_policy=always
max_hop_count=5
T2
max_hop_count=1
T3
Service Offer
T4
Trader Attribute
Link
Trading Service
query.hop_count=0
16
CORBA Trading Service
Application
Objects
Domain
Interfaces
CORBA
facilities
Object Request Broker
Object
Trader
CORBAservices
Trading Service
17
CORBA Trading Interfaces
Admin
list_offers()
…
LinkAttributes
TraderComponents
Link
add_link()
remove_link()
describe_link()
modify_link()
Support Attributes
Lookup
query()
Trading Service
ImportAttributes
Register
export()
withdraw()
modify()
18
Defining Quality of Service
typedef Istring PropertyName;
typedef sequence<PropertyName> PropertyNameSeq;
typedef any PropertyValue;
struct Property {
PropertyName name;
PropertyValue value;
};
typedef sequence<Property> PropertySeq;
enum HowManyProps {none, some, all}
union SpecifiedProps switch (HowManyProps) {
case some : PropertyNameSeq prop_names;
};
Trading Service
19
Trader Interface for Exporters
interface Register {
OfferId export(in Object reference,
in ServiceTypeName type,
in PropertySeq properties)
raises(...);
OfferId withdraw(in OfferId id)
raises(...);
void modify(in OfferId id,
in PropertyNameSeq del_list,
in PropertySeq modify_list)
raises (...);
};
Trading Service
20
Trader Interface for Importers
interface Lookup {
void query(in ServiceTypeName type,
in Constraint const,
in Preference pref,
in PolicySeq policies,
in SpecifiedProps desired_props,
in unsigned long how_many,
out OfferSeq offers,
out OfferIterator offer_itr,
out PolicyNameSeq Limits_applied)
raises (...);
};
Trading Service
21
Service Type Repository
 Service type
 Name
 Interfact type
 Set of properties
 Name
 Typecode
 Read-only/modifiable
 Mandatory/optional
Trading Service
22
Service Type Repository
 Substitutability of service types
 The interface type of a derived service type may be a subtype of the interface
type in the base service type
 The property set may be extended in a derived service type with new property
name (and their associated type and mode specification)
 Inherited properties may be strengthened
 Optional  mandatory
 Modifiable  read-only
Trading Service
23
Service Type Repository
 creating service type
// operation signatures
IncarnationNumber add_type (
in CosTrading::ServiceTypeName name,
in Identifier if_name,
in PropStructSeq props,
in ServiceTypeNameSeq super_types
) raises (
CosTrading::IllegalServiceType,
ServiceTypeExists,
InterfaceTypeMismatch,
CosTrading::IllegalPropertyName,
CosTrading::DuplicatePropertyName,
ValueTypeRedefinition,
CosTrading::UnknownServiceType,
DuplicateServiceTypeName
);
Trading Service
24
Service Type Repository
 Removing service type
void remove_type (
in CosTrading::ServiceTypeName name
) raises (
CosTrading::IllegalServiceType,
CosTrading::UnknownServiceType,
HasSubTypes
);
Trading Service
25
Service Type Repository
 Obtaining service type info
ServiceTypeNameSeq list_types (
in SpecifiedServiceTypes which_types
);
TypeStruct describe_type (
in CosTrading::ServiceTypeName name
) raises (
CosTrading::IllegalServiceType,
CosTrading::UnknownServiceType
);
TypeStruct fully_describe_type (
in CosTrading::ServiceTypeName name
) raises (
CosTrading::IllegalServiceType,
CosTrading::UnknownServiceType
);
Trading Service
26
Service Type Repository
 Masking/unmasking types
void mask_type (
in CosTrading::ServiceTypeName name
) raises (
CosTrading::IllegalServiceType,
CosTrading::UnknownServiceType,
AlreadyMasked
);
void unmask_type (
in CosTrading::ServiceTypeName name
) raises (
CosTrading::IllegalServiceType,
CosTrading::UnknownServiceType,
NotMasked
);
Trading Service
27
Service Type Repository
 properties
interface ServiceTypeRepository {
enum PropertyMode {
PROP_NORMAL, PROP_READONLY,
PROP_MANDATORY,
PROP_MANDATORY_READONLY
};
struct PropStruct {
CosTrading::PropertyName name;
CORBA::TypeCode value_type;
PropertyMode mode;
};
};
Trading Service
28
Printer Example
 Printer
interface Printer {
typedef string filename;
exception PrinterOffLine { short code; };
void print_file(in filename fn)
raises(PrinterOffLine);
short queue_length()
raises(PrinterOffLine);
};
interface TradingPrinter :
Printer,
CosTradingDynamic::DynamicPropEval {};
};
Trading Service
29
Printer Example
 Printer property
 Building
 Floor
 Language
 Resolution
 Color
 Queue_len
 Name
“A Block”, “A Block” ; “ A Block”
2, 3, 7
PostScript, PostScript, PostScript
300, 600, 600
black, black, 256color
- [PrinterObjectRef]->queue_length()
“12ps”, “monster”, “rib”
Trading Service
30
Printer Example
 Implementing the Printer Interface
 void print_file(string fn);
 Short queue_length();
 Any evalDP(string name, TypeCode returned_type, Any extra_info);
Trading Service
31
Printer Example
 Implementing the Printer Server
 ORB initialization
 Get trader reference
 Find service type repository
 Check for service type existence, if not exist, create it:
 Create a prop struct ist with the property name for a printer service type
 Add the new service type
 Create service offer property seq to use for export
 Create printers (use command-line arguments) and making them available to
ORB
 Update the template service offer to advertise them
Trading Service
32
Printer Example
 Implementing the Printer Client
 Arguments:
 Name of the file to print
 Constraint expression for searching criteria
 Preference expression to order the printer service offers returned
 Implementation:
 Check for arguments
 Find Lookup object
 Process the commend-line arguments
 Establish basic policies for a trader query
 Make the query
 The returned Printer object are tried in order until the file is successfully printed
Trading Service
33
Key Points
 Distributed objects can be located by naming and trading
 Naming binds externally known names to an object reference
and supports name resolution to reveal the object reference
 Trading supports locating objects based on the functionality that
they offer and the quality of service that they guarantee
Trading Service
34
Download