- java.lang.Object
-
- org.omg.CORBA.Context
-
public abstract class Context extends Object
An object used inRequest
operations to specify the context object in which context strings must be resolved before being sent along with the request invocation. AContext
object contains a list of properties in the form ofNamedValue
objects. These properties represent information about the client, the environment, or the circumstances of a request and generally are properties that might be inconvenient to pass as parameters.A
Context
object is created by first calling theORB
methodget_default_context
and then calling the methodcreate_child
on the default context.Each property in a
Context
object is represented by aNamedValue
object. The property name is contained in theNamedValue
object'sname
field, and the value associated with the name is contained in theAny
object that was assigned to theNamedValue
object'svalue
field.Context
properties can represent a portion of a client's or application's environment that is meant to be propagated to (and made implicitly part of) a server's environment. (Examples might be a window identifier or user preference information). Once a server has been invoked (that is, after the properties are propagated), the server may query itsContext
object for these properties using the methodget_values
.When an operation declaration includes a context clause, the stubs and skeletons will have an additional argument added for the context. When an operation invocation occurs, the ORB causes the properties that were named in the operation definition in IDL and that are present in the client's
Context
object to be provided in theContext
object parameter to the invoked method.Context
property names (which are strings) typically have the form of an OMG IDL identifier or a series of OMG IDL identifiers separated by periods. A context property name pattern is either a property name or a property name followed by a single "*". A property name pattern without a trailing "*" is said to match only itself. A property name pattern of the form "<name>*" matches any property name that starts with <name> and continues with zero or more additional characters.Property name patterns are used in the context clause of an operation definition and as a parameter for the method
Context.get_values
.Context
objects may be "chained" together to achieve a particular defaulting behavior. AContext
object created with the methodcreate_child
will be chained to its parent (theContext
object that created it), and that means that the parent will be searched after the child in a search for property names.Properties defined in a particular
Context
object effectively override those properties in the next higher level. The scope used in a search for properties may be restricted by specifying a starting scope and by using the flagCTX_RESTRICT_SCOPE
when invoking the methodget_values
.A
Context
object may be named for purposes of specifying a starting search scope.- Since:
- JDK1.2
-
-
Constructor Summary
Constructors Constructor and Description Context()
-
Method Summary
Methods Modifier and Type Method and Description abstract String
context_name()
Retrieves the name of thisContext
object.abstract Context
create_child(String child_ctx_name)
Creates aContext
object with the given string as its name and with thisContext
object set as its parent.abstract void
delete_values(String propname)
Deletes from thisContext
object theNamedValue
object(s) whosename
field matches the given property name.abstract NVList
get_values(String start_scope, int op_flags, String pattern)
Retrieves theNamedValue
objects whosename
field matches the given name or name pattern.abstract Context
parent()
Retrieves the parent of thisContext
object.abstract void
set_one_value(String propname, Any propvalue)
Creates aNamedValue
object and adds it to thisContext
object.abstract void
set_values(NVList values)
I Sets one or more property values in thisContext
object.
-
-
-
Method Detail
-
context_name
public abstract String context_name()
Retrieves the name of thisContext
object.- Returns:
- the name of this
Context
object
-
parent
public abstract Context parent()
Retrieves the parent of thisContext
object.- Returns:
- the
Context
object that is the parent of thisContext
object
-
create_child
public abstract Context create_child(String child_ctx_name)
Creates aContext
object with the given string as its name and with thisContext
object set as its parent.The new
Context
object is chained into its parentContext
object. This means that in a search for matching property names, if a match is not found in this context, the search will continue in the parent. If that is not successful, the search will continue in the grandparent, if there is one, and so on.- Parameters:
child_ctx_name
- theString
object to be set as the name of the newContext
object- Returns:
- the newly-created child
Context
object initialized with the specified name
-
set_one_value
public abstract void set_one_value(String propname, Any propvalue)
Creates aNamedValue
object and adds it to thisContext
object. Thename
field of the newNamedValue
object is set to the given string, thevalue
field is set to the givenAny
object, and theflags
field is set to zero.- Parameters:
propname
- the name of the property to be setpropvalue
- theAny
object to which the value of the property will be set. TheAny
object'svalue
field contains the value to be associated with the given propname; thekind
field must be set toTCKind.tk_string
.
-
set_values
public abstract void set_values(NVList values)
I Sets one or more property values in thisContext
object. TheNVList
supplied to this method contains one or moreNamedValue
objects. In eachNamedValue
object, thename
field holds the name of the property, and theflags
field must be set to zero. TheNamedValue
object'svalue
field contains anAny
object, which, in turn, contains the value for the property. Since the value is always a string, theAny
object must have thekind
field of itsTypeCode
set toTCKind.tk_string
.- Parameters:
values
- an NVList containing the property names and associated values to be set- See Also:
get_values(java.lang.String, int, java.lang.String)
,NamedValue
,Any
-
delete_values
public abstract void delete_values(String propname)
Deletes from thisContext
object theNamedValue
object(s) whosename
field matches the given property name. If theString
object supplied forpropname
has a trailing wildcard character ("*"), then allNamedValue
objects whosename
fields match will be deleted. The search scope is always limited to thisContext
object.If no matching property is found, an exception is returned.
- Parameters:
propname
- name of the property to be deleted
-
get_values
public abstract NVList get_values(String start_scope, int op_flags, String pattern)
Retrieves theNamedValue
objects whosename
field matches the given name or name pattern. This method allows for wildcard searches, which means that there can be multiple matches and therefore multiple values returned. If the property is not found at the indicated level, the search continues up the context object tree until a match is found or allContext
objects in the chain have been exhausted.If no match is found, an error is returned and no property list is returned.
- Parameters:
start_scope
- aString
object indicating the context object level at which to initiate the search for the specified properties (for example, "_USER", "_GROUP", "_SYSTEM"). Valid scope names are implementation-specific. If a scope name is omitted, the search begins with the specified context object. If the specified scope name is not found, an exception is returned.op_flags
- an operation flag. The one flag that may be specified isCTX_RESTRICT_SCOPE
. If this flag is specified, searching is limited to the specifiedstart_scope
or thisContext
object.pattern
- the property name whose values are to be retrieved.pattern
may be a name or a name with a trailing wildcard character ("*").- Returns:
- an
NVList
containing all the property values (in the form ofNamedValue
objects) whose associated property name matches the given name or name pattern - See Also:
set_values(org.omg.CORBA.NVList)
,NamedValue
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-org/omg/CORBA/Context.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.