trading service 1 outline what is trading service how to use trading service printer example

34
Trading Service 1 Trading Service Outline What is trading service How to use trading service Printer Example

Upload: cullen-rimer

Post on 02-Apr-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 1

Trading Service

Outline What is trading service How to use trading service Printer Example

Page 2: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 2

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

Page 3: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 3

Trading Characteristics Trader operates as broker between client and server. Enables client to change perspective from ´who?´ to ´what?´

Exporter

Trader

Importer3: invoke

1:ex

port 2: Q

uery

Similar ideas in:•mortgage broker•insurance broker•stock brokerage

Page 4: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 4

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.

Page 5: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 5

Trading Characteristics Clients ask trader for

a service of a certain type at a certain level of quality

Trader supports service matching service shopping

Page 6: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 6

Example Hongkong Telecom video-on-demand server:

Trader

MGM

Warner

Independent

Video-on-demand provider

Server

User

Page 7: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 7

CORBA Trading Service

Client Application

proxyobjectImpl

Server

lookup register

link

proxy Admin

Query()export()modify()withdraw()

CORBA Trading Service

Page 8: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 8

The Trading Process Example: Video-on-demand server

:Client:Client :Trader:Trader MGM:VoDSMGM:VoDS Warner:VoDSWarner:VoDS

Query( )

export( )

export( )

modify( )

download( )

Page 9: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 9

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

Page 10: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 10

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

Page 11: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 11

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;

}

Page 12: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 12

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

Page 13: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 13

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

Page 14: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 14

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)

Page 15: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 15

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

Page 16: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 16

Trading Graph

T1

T2 T3

T4

query.hop_count=4

def_follow_policy=always

max_hop_count=5

query.hop_count=0Service OfferTrader AttributeLink

max_hop_count=1

Page 17: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 17

CORBA Trading Service

Application Objects

CORBAfacilities

CORBAservices

DomainInterfaces

Object Request Broker

ObjectTrader

Page 18: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 18

CORBA Trading Interfaces

TraderComponents Support Attributes ImportAttributesLinkAttributes

list_offers()…

export()withdraw()modify()

RegisterLink

add_link()remove_link()describe_link()modify_link()

Lookup

query()

Admin

Page 19: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 19

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;};

Page 20: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 20

Trader Interface for Exportersinterface 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 (...);

};

Page 21: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 21

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 (...);

};

Page 22: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 22

Service Type Repository

Service type Name Interfact type Set of properties

Name Typecode Read-only/modifiable Mandatory/optional

Page 23: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 23

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

Page 24: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 24

Service Type Repository

creating service type

// operation signaturesIncarnationNumber 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

);

Page 25: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 25

Service Type Repository

Removing service type

void remove_type (in CosTrading::ServiceTypeName name) raises (

CosTrading::IllegalServiceType,CosTrading::UnknownServiceType,HasSubTypes);

Page 26: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 26

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

);

Page 27: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 27

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

);

Page 28: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 28

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;};

};

Page 29: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 29

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 {};

};

Page 30: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 30

Printer Example

Printer property Building “A Block”, “A Block” ; “ A Block” Floor 2, 3, 7 LanguagePostScript, PostScript, PostScript Resolution 300, 600, 600 Color black, black, 256color Queue_len - [PrinterObjectRef]->queue_length() Name “12ps”, “monster”, “rib”

Page 31: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 31

Printer Example

Implementing the Printer Interface void print_file(string fn); Short queue_length(); Any evalDP(string name, TypeCode returned_type, Any extra_info);

Page 32: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 32

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

Page 33: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 33

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

Page 34: Trading Service 1  Outline  What is trading service  How to use trading service  Printer Example

Trading Service 34

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