Download presentation
Presentation is loading. Please wait.
Published byLionel York Modified over 9 years ago
1
www.objectweb.org Towards a Naming & Binding Framework for ObjectWeb Sacha Krakowiak Univ. of Grenoble & INRIA
2
www.objectweb.org Naming Framework - 2 -4/7/2002 Motivations & Objectives è Most ObjectWeb projects need some form of naming and binding è All currently proposed frameworks are derived from Jonathan, with some variations è Goal: propose a single framework that could be reused by all projects
3
www.objectweb.org Naming Framework - 3 -4/7/2002 A brief refresher on Naming è A name designates an object To distinguish it from other objects To get access to the object è A name is defined in a naming context A naming context = a part of the “universe” A context may have a name in another context (hence the notion of a context graph) A context graph may have any structure; usually there is some form of hierarchy
4
www.objectweb.org Naming Framework - 4 -4/7/2002 A context graph A name A naming context An object foo a bar alpha beta zzz tau u here
5
www.objectweb.org Naming Framework - 5 -4/7/2002 Name resolution è Resolving a name in a context is finding the object (if any) designated by this name è Name resolution is a recursive process (walking through a chain of naming contexts) The target of an individual resolution may be A typed value - resolution stops An address - resolution stops A new name in a new context - resolution recurses è Binding = interconnecting a set of objects in a computing system Special case: binding a name to an object in a naming context, i.e. creating an access path from the name fo the object
6
www.objectweb.org Naming Framework - 6 -4/7/2002 Binding in the ODP Model A binding (the chain connecting the name to the object) is itself a (possibly composite) object. Example: A binding is created by a binding factory (for that type of binding) A binding factory (or binder) is a special case (an extension) of a naming context client stub session server skeleton binding object
7
www.objectweb.org Naming Framework - 7 -4/7/2002 A pattern for binding è The export-bind pattern è export “Advertise” an object in a naming context by providing it a name for it in that context As an optimization: may perform additional operations, to prepare for effective later access to the object è bind Get access to an object through a name Access may be direct (bind returns the object) or indirect (bind returns a proxy) The object must have previously been exported
8
www.objectweb.org Naming Framework - 8 -4/7/2002 Rationale for a proposal è Should answer current needs (as identified in current projects) è Should be “minimal” è Should be easily extended for future needs, not yet precisely defined è Conversion to the framework should be easy for existing projects
9
www.objectweb.org Naming Framework - 9 -4/7/2002 Naming in ObjectWeb è Basic types Name Special case: Identifier, a simple, one-level name NamingContext Binder (extends NamingContext) è Two kinds of operations needed Operations that only act on names: navigation, (de)composition, encoding, decoding Operations that have to do with the name-object relationship: (un)binding, name resolution
10
www.objectweb.org Naming Framework - 10 -4/7/2002 public interface Name { /* Returns the NamingContext that created this name. */ NamingContext getContext (); /* Returns the object designated by the given name (may be a Name in another context). */ Object resolve (); /* Returns an object that gives access to the object designated by the target name. * hints: optional additional information. * throws RuntimeException if the binding fails, or is not supported */ Object bind (Object hints); byte[] encode (Name n); byte[] encode (Name n, byte[] b, int off); }
11
www.objectweb.org Naming Framework - 11 -4/7/2002 public interface NamingContext { /* Creates and returns a name in this context to designates the given object. * o: the object to be exported. This object may be a name of another context. * hints: optional additional information. */ Name export (Object o, Object hints); /* Encodes the given name as an array of bytes and returns this array. * n: the name to be encoded (must belong to this context) */ byte[] encode (Name n); /* Encodes the given name in the given array of bytes. * n: the name to be encoded (must belong to this context) * b: the byte array where the encoded name must be put. * off: the index at which the first byte of the encoded name must be put. * returns the length len of the encoded name.. * throws RuntimeException if the given array is too small for the encoded name */ byte[] encode (Name n, byte[] b, int off); /* Decodes the given encoded name and returns that name. * b: an array of bytes containing the encoding of a name created by this context. * throws RuntimeException if the given encode name cannot be decoded. */ Name decode (byte[] b); /* Decodes the given encoded name. * b: an array of byte containing the encoded form of a name created by this context. * off offset of the first byte of the encoded name in b. * len length of the encoded name, in bytes. * throws RuntimeException if the given encoded name cannot be decoded. */ Name decode (byte[] b, int off, int len); }
12
www.objectweb.org Naming Framework - 12 -4/7/2002 public interface Binder extends NamingContext { /* Returns an object that gives access to the object designated by the given name. * n: a name of this context. * hints: optional additional information. * throws RuntimeException if the binding fails, or is not supported */ Object bind (Name n, Object hints); void unbind(Name n); }
13
www.objectweb.org Naming Framework - 13 -4/7/2002 Main issues A remark on bind: it may refer to an operation of a name server (e.g. RmiRegistry, etc.). This is not in contradiction with our definition of bind (in both cases, gives access to an object) è Which operations should be borne by Name and which by NamingContext? è What type for hints? may be Object or Context (not NamingContext, but a set of (name, value) pairs) è What about resolve? Two possibilities: Just reserved for name manipulation (i.e. returns the “next” component of a name, or fails) Strict inverse of export (i.e. returns either the next name or an object)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.