资源预览内容
第1页 / 共48页
第2页 / 共48页
第3页 / 共48页
第4页 / 共48页
第5页 / 共48页
第6页 / 共48页
第7页 / 共48页
第8页 / 共48页
第9页 / 共48页
第10页 / 共48页
亲,该文档总共48页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
Dynamic Object Requests,1,Dynamic Object Requests,Outline Motivating Examples Dynamic Invocation Reflection Designing Generic Applications,Dynamic Object Requests,2,Outline,Motivating Examples Dynamic Invocation The CORBA Dynamic Invocation Interface Reflection The CORBA Interface Repository Designing Generic Applications Using CORBA,Dynamic Object Requests,3,Motivation,Dynamic Object Requests,4,What is a dynamic request?,Sometimes clients need to be built before their server interfaces are defined They need to defer request definition until they are executed These are dynamic requests Examples: Object browser Generic bridges Scripting language interpreter,Motivating Example: Object Browser,Dynamic Object Requests,6,Motivating Example: Generic Bridge,Generic and request-level bridge,Dynamic Object Requests,7,Commonalities,Discovery of type information at run-time Use of type information to build client objects that can cope with any type of server objects Definition of object requests at run-time Requires two primitives from middleware: Dynamic invocation interfaces Reflection mechanisms,Dynamic Object Requests,8,Dynamic Invocation,Dynamic Object Requests,9,Dynamic Requests: Principles,Any object request has to identify server object operation name actual parameters data structure for operation result In Dynamic Requests: server object identified by object reference operation name identified by string actual parameters as list of name/value pairs operation result determined by an address,Dynamic Requests in CORBA,Dynamic Object Requests,11,Dynamic Requests in CORBA,Dynamic invocation interface (DII) supports dynamic creation of requests. Requests are objects themselves. Request objects have attributes for operation name, parameters and results. Request objects have operations to change operation parameters, issue the request and obtain the request results.,Dynamic Request in CORBA,Dynamic Object Requests,13,Creating Dynamic CORBA Requests,interface Object ORBstatus create_request ( in Context ctx, / operation context in Identifier operation,/ operation to exec in NVList arg_list, / args of operation inout NamedValue result,/ operation result out Request request / new request object in Flags req_flags / request flags ); . ;,Dynamic Object Requests,14,Manipulating Dynamic CORBA Requests,interface Request Status add_arg ( in Identifier name, / argument name in TypeCode arg_type, / argument datatype in void * value, / argument to be added in long len, / length of argument value in Flags arg_flags / argument flags ); Status invoke ( in Flags invoke_flags / invocation flags ); Status delete (); Status send ( in Flags invoke_flags / invocation flags ); Status get_response ( in Flags response_flags / response flags ) raises (WrongTransaction); ;,Dynamic Object Requests,15,Transparency of Dynamic Invocation,Client programs have to be written differently Use of dynamic invocation interfaces is not transparent to client programmers Server objects are unaware of dynamic invocation Use of DII is transparent,Dynamic Object Requests,16,Reflection,Dynamic Object Requests,17,Reflection Principles,How do clients discover attributes & operations that servers have? Need to capture type information during interface compilation store type information persistently provide an interface for clients to obtain type information during run-time Reflection interfaces provided by CORBA Interface Repository,Dynamic Object Requests,18,CORBA Interface Repository,Makes type information of interfaces available at run-time. Achieves type-safe dynamic invocations. Supports construction of interface browser Used by CORBA implementations themselves Persistent storage of IDL interfaces in abstract syntax trees (ASTs),Interface repository persistently stores ASTs of IDL modules, interfaces, types, operations etc.,Abstract Syntax Trees (ASTs),Dynamic Object Requests,20,AST Node Types,Repository,Dynamic Object Requests,21,Container (node with children),interface Container : IRObject Contained lookup(in ScopedName search_name); sequence contents( in DefinitionKind limit_type, in boolean exclude_inherited); sequence lookup_name( in Identifier search_name, in long levels_to_search, in DefinitionKind limit_type, in boolean exclude_inherited); . ;,Dynamic Object Requests,22,Contained (child),interface Contained : IRObject attribute Identifier name; attribute RepositoryId id; attribute VersionSpec version; readonly attribute Container defined_in; struct Description DefinitionKind kind; any value; ; Description describe(); . ;,Dynamic Object Requests,23,Interface Definition,interface InterfaceDef : Container,Contained attribute sequence base_interfaces; boolean is_a(in RepositoryId interface_id); struct FullInterfaceDescription Identifier name; RepositoryId id; RepositoryId defined_in; RepositoryIdSequence base_interfaces; sequ
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号