|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.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 security context
.
Field Summary | |
---|---|
static ExecutionContext |
DEFAULT_CONTEXT
|
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 . |
|
ExecutionContext(ExecutionContext original)
Create a copy of the supplied execution context. |
protected |
ExecutionContext(ExecutionContext original,
SecurityContext securityContext)
Create a copy of the supplied execution context, but use the supplied AccessControlContext instead. |
protected |
ExecutionContext(SecurityContext securityContext,
NamespaceRegistry namespaceRegistry,
ValueFactories valueFactories,
PropertyFactory propertyFactory,
MimeTypeDetector mimeTypeDetector,
TextExtractor textExtractor,
ClassLoaderFactory classLoaderFactory,
Map<String,String> data,
String processId)
Create an instance of the execution context by supplying all parameters. |
Method Summary | |
---|---|
ExecutionContext |
clone()
|
ClassLoader |
getClassLoader(String... classpath)
Get a class loader for the supplied classpath. |
protected ClassLoaderFactory |
getClassLoaderFactory()
Get the class loader factory used by this context. |
Map<String,String> |
getData()
Get the immutable map of custom data that is affiliated with this context. |
String |
getId()
Get the unique identifier for this context. |
Logger |
getLogger(Class<?> clazz)
Return a logger associated with this context. |
Logger |
getLogger(String name)
Return a logger associated with 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. |
String |
getProcessId()
Get the identifier for the process in which this context exists. |
PropertyFactory |
getPropertyFactory()
Get the factory for creating Property objects. |
SecurityContext |
getSecurityContext()
Get the security context for this context. |
TextExtractor |
getTextExtractor()
Return an object that can be used to extract text from content, such as the content of a file. |
ValueFactories |
getValueFactories()
Get the factories that should be used to create values for properties . |
protected void |
initializeDefaultNamespaces(NamespaceRegistry namespaceRegistry)
Method that initializes the default namespaces for namespace registries. |
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(Map<String,String> data)
Create a new execution context that mirrors this context but that contains the supplied data. |
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(PropertyFactory propertyFactory)
Create a new execution context that mirrors this context but that uses the supplied factory . |
ExecutionContext |
with(SecurityContext securityContext)
Create an ExecutionContext that is the same as this context, but which uses the supplied security context . |
ExecutionContext |
with(String processId)
Create a new execution context that mirrors this context but that contains the supplied process identifier. |
ExecutionContext |
with(String key,
String value)
Create a new execution context that mirrors this context but that contains the supplied key-value pair in the new context's data. |
ExecutionContext |
with(TextExtractor textExtractor)
Create a new execution context that is the same as this context, but which uses the supplied text
extractor . |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final ExecutionContext DEFAULT_CONTEXT
Constructor Detail |
---|
public ExecutionContext()
current JAAS calling context
, with default implementations for all other components (including default namespaces in the
namespace registry
.
public ExecutionContext(ExecutionContext original)
original
- the original
IllegalArgumentException
- if the original is nullprotected ExecutionContext(ExecutionContext original, SecurityContext securityContext)
AccessControlContext
instead.
original
- the originalsecurityContext
- the security context
IllegalArgumentException
- if the original or access control context are is nullprotected ExecutionContext(SecurityContext securityContext, NamespaceRegistry namespaceRegistry, ValueFactories valueFactories, PropertyFactory propertyFactory, MimeTypeDetector mimeTypeDetector, TextExtractor textExtractor, ClassLoaderFactory classLoaderFactory, Map<String,String> data, String processId)
securityContext
- the security context, or null if there is no associated authenticated usernamespaceRegistry
- the namespace registry implementation, or null if a thread-safe version of
SimpleNamespaceRegistry
instance should be usedvalueFactories
- the ValueFactories
implementation, or null if a StandardValueFactories
instance
should be usedpropertyFactory
- the PropertyFactory
implementation, or null if a BasicPropertyFactory
instance
should be usedmimeTypeDetector
- the MimeTypeDetector
implementation, or null if the context should use a
MimeTypeDetectors
instance with an ExtensionBasedMimeTypeDetector
textExtractor
- the TextExtractor
implementation, or null if the context should use a TextExtractors
instanceclassLoaderFactory
- the ClassLoaderFactory
implementation, or null if a StandardClassLoaderFactory
instance should be useddata
- the custom data for this context, or null if there is no such dataprocessId
- the unique identifier of the process in which this context exists, or null if it should be generatedMethod Detail |
---|
protected ClassLoaderFactory getClassLoaderFactory()
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 TextExtractor getTextExtractor()
public SecurityContext getSecurityContext()
security context
for this context.
null
public NamespaceRegistry getNamespaceRegistry()
null
public final PropertyFactory getPropertyFactory()
Property
objects.
null
public ValueFactories getValueFactories()
properties
.
public ClassLoader getClassLoader(String... classpath)
getClassLoader
in interface ClassLoaderFactory
classpath
- the classpath to use
ClassLoaderFactory.getClassLoader(java.lang.String[])
public String getId()
public String getProcessId()
public Map<String,String> getData()
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 context should use a
MimeTypeDetectors
instance with an ExtensionBasedMimeTypeDetector
public ExecutionContext with(TextExtractor textExtractor)
text
extractor
.
textExtractor
- the new text extractor implementation, or null if the context should use a TextExtractors
instance with no default extractor
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 with(PropertyFactory propertyFactory)
factory
.
propertyFactory
- the new propertyfactory implementation, or null if the default implementation should be used
public ExecutionContext with(SecurityContext securityContext)
ExecutionContext
that is the same as this context, but which uses the supplied security context
.
securityContext
- the new security context to use; may be null
IllegalArgumentException
- if the name
is nullpublic ExecutionContext with(Map<String,String> data)
data
- the data that is to be affiliated with the resulting context or null if the resulting context should have no
data
public ExecutionContext with(String key, String value)
key
- the key for the new data that is to be affiliated with the resulting contextvalue
- the data value to be affiliated with the supplied key in the resulting context, or null if an existing data
affiliated with the key should be removed in the resulting context
public ExecutionContext with(String processId)
processId
- the identifier of the process
public ExecutionContext clone()
clone
in class Object
Object.clone()
public String toString()
toString
in class Object
Object.toString()
protected void initializeDefaultNamespaces(NamespaceRegistry namespaceRegistry)
namespaceRegistry
- the namespace registry
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |