public abstract class Context extends Object
Requestoperations to specify the context object in which context strings must be resolved before being sent along with the request invocation. A
Contextobject contains a list of properties in the form of
NamedValueobjects. 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.
Context object is created by first calling the
and then calling the method
create_child on the
Each property in a
Context object is represented by
NamedValue object. The property name is contained
name field, and
the value associated with the name is contained in the
object that was assigned to the
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 its
for these properties using the method
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
to be provided in the
Context 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
Context objects may be "chained" together to achieve a
particular defaulting behavior. A
object created with the method
be chained to its parent (the
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
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 flag
when invoking the method
Context object may be named for purposes of specifying
a starting search scope.
|Modifier and Type||Method||Description|
Retrieves the name of this
Deletes from this
Retrieves the parent of this
I Sets one or more property values in this
public abstract String context_name()
public abstract Context parent()
Contextobject that is the parent of this
public abstract Context create_child(String child_ctx_name)
Contextobject with the given string as its name and with this
Contextobject set as its parent.
Context object is chained into its parent
Context 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
Stringobject to be set as the name of the new
Contextobject initialized with the specified name
public abstract void set_one_value(String propname, Any propvalue)
NamedValueobject and adds it to this
namefield of the new
NamedValueobject is set to the given string, the
valuefield is set to the given
Anyobject, and the
flagsfield is set to zero.
propname- the name of the property to be set
Anyobject to which the value of the property will be set. The
valuefield contains the value to be associated with the given propname; the
kindfield must be set to
public abstract void set_values(NVList values)
NVListsupplied to this method contains one or more
NamedValueobjects. In each
namefield holds the name of the property, and the
flagsfield must be set to zero. The
valuefield contains an
Anyobject, which, in turn, contains the value for the property. Since the value is always a string, the
Anyobject must have the
kindfield of its
values- an NVList containing the property names and associated values to be set
get_values(java.lang.String, int, java.lang.String),
public abstract void delete_values(String propname)
namefield matches the given property name. If the
Stringobject supplied for
propnamehas a trailing wildcard character ("*"), then all
namefields match will be deleted. The search scope is always limited to this
If no matching property is found, an exception is returned.
propname- name of the property to be deleted
public abstract NVList get_values(String start_scope, int op_flags, String pattern)
namefield 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 all
Contextobjects in the chain have been exhausted.
If no match is found, an error is returned and no property list is returned.
Stringobject 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 is
CTX_RESTRICT_SCOPE. If this flag is specified, searching is limited to the specified
pattern- the property name whose values are to be retrieved.
patternmay be a name or a name with a trailing wildcard character ("*").
NVListcontaining all the property values (in the form of
NamedValueobjects) whose associated property name matches the given name or name pattern
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2017, Oracle and/or its affiliates. 500 Oracle Parkway
Redwood Shores, CA 94065 USA. All rights reserved.