|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.dna.graph.ExecutionContext
@Immutable public class ExecutionContext
An ExecutionContext is a representation of the environment or context in which a component or operation is operating. Some components require this context to be passed into individual methods, allowing the context to vary with each method invocation. Other components require the context to be provided before it's used, and will use that context for all its operations (until it is given a different one).
ExecutionContext instances are immutable
, so components may hold onto references to them without concern of
those contexts changing. Contexts may be used to create other contexts that vary the environment and/or security context. For
example, an ExecutionContext could be used to create another context that references the same namespace registry
but which has a different JAAS subject
.
Constructor Summary | |
---|---|
ExecutionContext()
Create an instance of an execution context that uses the current JAAS calling context
, with default implementations for all other components (including default namespaces in the
namespace registry . |
Method Summary | |
---|---|
ExecutionContext |
clone()
|
ExecutionContext |
create(AccessControlContext accessControlContext)
Creates an ExecutionContext that is the same as this context, but which uses the supplied
access control context . |
ExecutionContext |
create(LoginContext loginContext)
Create an ExecutionContext that is the same as this context, but which uses the supplied LoginContext . |
AccessControlContext |
getAccessControlContext()
Get the JAAS access control context for this context. |
ClassLoader |
getClassLoader(String... classpath)
Get a class loader for the supplied classpath. |
Logger |
getLogger(Class<?> clazz)
Return a logger associated with this context. |
Logger |
getLogger(String name)
Return a logger associated with this context. |
LoginContext |
getLoginContext()
Get the JAAS login context for this context. |
MimeTypeDetector |
getMimeTypeDetector()
Return an object that can be used to determine the MIME type of some content, such as the content of a file. |
NamespaceRegistry |
getNamespaceRegistry()
Get the (mutable) namespace registry for this context. |
PropertyFactory |
getPropertyFactory()
Get the factory for creating Property objects. |
Subject |
getSubject()
Get the JAAS subject for which this context was created. |
ValueFactories |
getValueFactories()
Get the factories that should be used to create values for properties . |
String |
toString()
|
ExecutionContext |
with(ClassLoaderFactory classLoaderFactory)
Create a new execution context that mirrors this context but that uses the supplied class loader
factory . |
ExecutionContext |
with(MimeTypeDetector mimeTypeDetector)
Create a new execution context that is the same as this context, but which uses the supplied MIME
type detector . |
ExecutionContext |
with(NamespaceRegistry namespaceRegistry)
Create a new execution context that mirrors this context but that uses the supplied namespace registry. |
ExecutionContext |
with(String name)
Create an ExecutionContext that is the same as this context, but which uses the supplied
application configuration name . |
ExecutionContext |
with(String name,
CallbackHandler callbackHandler)
Create an ExecutionContext that is the same as this context, but which uses the supplied
application configuration name and a JAAS
callback handler (used to handle authentication callbacks). |
ExecutionContext |
with(String name,
Subject subject)
Create an ExecutionContext that is the same as this context, but which uses the supplied
application configuration name and a JAAS subject . |
ExecutionContext |
with(String name,
Subject subject,
CallbackHandler callbackHandler)
Create an ExecutionContext that is the same as this context, but which uses the supplied
application configuration name , a JAAS subject , and
a JAAS callback handler (used to handle authentication callbacks). |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ExecutionContext()
current JAAS calling context
, with default implementations for all other components (including default namespaces in the
namespace registry
.
Method Detail |
---|
public Logger getLogger(Class<?> clazz)
obtain a system logger
.
clazz
- the class that is doing the logging
clazz
; never nullgetLogger(String)
public Logger getLogger(String name)
obtain a system logger
.
name
- the name for the logger
clazz
; never nullgetLogger(Class)
public MimeTypeDetector getMimeTypeDetector()
public AccessControlContext getAccessControlContext()
JAAS access control context
for this context.
null
public LoginContext getLoginContext()
JAAS login context
for this context.
null
public NamespaceRegistry getNamespaceRegistry()
null
public PropertyFactory getPropertyFactory()
Property
objects.
null
public Subject getSubject()
access control context
or login context
.public ValueFactories getValueFactories()
properties
.
public ClassLoader getClassLoader(String... classpath)
getClassLoader
in interface ClassLoaderFactory
classpath
- the classpath to use
ClassLoaderFactory.getClassLoader(java.lang.String[])
public ExecutionContext with(NamespaceRegistry namespaceRegistry)
value factories
and property factory
all make use of
the new namespace registry.
namespaceRegistry
- the new namespace registry implementation, or null if the default implementation should be used
public ExecutionContext with(MimeTypeDetector mimeTypeDetector)
MIME
type detector
.
mimeTypeDetector
- the new MIME type detector implementation, or null if the default implementation should be used
public ExecutionContext with(ClassLoaderFactory classLoaderFactory)
class loader
factory
.
classLoaderFactory
- the new class loader factory implementation, or null if the default implementation should be used
public ExecutionContext create(AccessControlContext accessControlContext)
ExecutionContext
that is the same as this context, but which uses the supplied
access control context
.
accessControlContext
- the JAAS access control context that should be used
IllegalArgumentException
- if accessControlContext
is null
.public ExecutionContext create(LoginContext loginContext)
ExecutionContext
that is the same as this context, but which uses the supplied LoginContext
. A
LoginContext has a variety of constructors, including contructors that take combinations of
application configuration name
, subject
,
callback handlers
, and a JAAS configuration
.
loginContext
- the JAAS login context
IllegalArgumentException
- if the loginContext
is nullpublic ExecutionContext with(String name) throws LoginException
ExecutionContext
that is the same as this context, but which uses the supplied
application configuration name
.
name
- the name of the JAAS application configuration name
IllegalArgumentException
- if the name
is null
LoginException
- if there name
is invalid (or there is no login context named "other"), or if the
default callback handler JAAS property was not set or could not be loadedpublic ExecutionContext with(String name, Subject subject) throws LoginException
ExecutionContext
that is the same as this context, but which uses the supplied
application configuration name
and a JAAS subject
.
name
- the name of the JAAS application configuration name
subject
- the subject to authenticate
LoginException
- if there name
is invalid (or there is no login context named "other"), if the default
callback handler JAAS property was not set or could not be loaded, or if the subject
is null or
unknownpublic ExecutionContext with(String name, CallbackHandler callbackHandler) throws LoginException
ExecutionContext
that is the same as this context, but which uses the supplied
application configuration name
and a JAAS
callback handler
(used to handle authentication callbacks).
name
- the name of the JAAS application configuration name
callbackHandler
- the callback handler that will be used by LoginModule
s to communicate with the user to
authenticate
LoginException
- if there name
is invalid (or there is no login context named "other"), or if the
callbackHandler
is nullpublic ExecutionContext with(String name, Subject subject, CallbackHandler callbackHandler) throws LoginException
ExecutionContext
that is the same as this context, but which uses the supplied
application configuration name
, a JAAS subject
, and
a JAAS callback handler
(used to handle authentication callbacks).
name
- the name of the JAAS application configuration name
subject
- the subject to authenticatecallbackHandler
- the callback handler that will be used by LoginModule
s to communicate with the user to
authenticate
LoginException
- if there name
is invalid (or there is no login context named "other"), if the default
callback handler JAAS property was not set or could not be loaded, if the subject
is null or unknown,
or if the callbackHandler
is nullpublic ExecutionContext clone()
clone
in class Object
Object.clone()
public String toString()
toString
in class Object
Object.toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |