public class IvyContext
extends java.lang.Object
IvyThread
Constructor and Description |
---|
IvyContext() |
IvyContext(IvyContext ctx) |
Modifier and Type | Method and Description |
---|---|
void |
checkInterrupted() |
java.lang.Object |
get(java.lang.String key) |
CircularDependencyStrategy |
getCircularDependencyStrategy() |
static IvyContext |
getContext() |
DependencyDescriptor |
getDependencyDescriptor() |
EventManager |
getEventManager() |
Ivy |
getIvy()
Returns the current ivy instance.
|
MessageLogger |
getMessageLogger() |
java.lang.Thread |
getOperatingThread() |
ResolveData |
getResolveData() |
IvySettings |
getSettings() |
java.lang.Object |
peek(java.lang.String key)
Reads the first object from the list saved under given key in the context.
|
static java.lang.Object |
peekInContextStack(java.lang.String key)
Reads the first object from the list saved under given key in the first context from the
context stack in which this key is defined.
|
Ivy |
peekIvy()
Returns the Ivy instance associated with this context, or
null if no such
instance is currently associated with this context. |
java.lang.Object |
pop(java.lang.String key)
Removes and returns first object from the list saved under given key in the context.
|
boolean |
pop(java.lang.String key,
java.lang.Object expectedValue)
Removes and returns first object from the list saved under given key in the context but only
if it equals the given expectedValue - if not a false value is returned.
|
static IvyContext |
popContext()
Pops one context used with this thread.
|
void |
push(java.lang.String key,
java.lang.Object value)
Puts a new object at the start of the list saved under given key in the context.
|
static IvyContext |
pushContext(IvyContext context)
Changes the context associated with this thread.
|
static IvyContext |
pushNewContext()
Creates a new IvyContext and pushes it as the current context in the current thread.
|
static IvyContext |
pushNewCopyContext()
Creates a new IvyContext as a copy of the current one and pushes it as the current context in
the current thread.
|
void |
set(java.lang.String key,
java.lang.Object value) |
void |
setDependencyDescriptor(DependencyDescriptor dd) |
void |
setIvy(Ivy ivy) |
void |
setResolveData(ResolveData data) |
public IvyContext()
public IvyContext(IvyContext ctx)
public static IvyContext getContext()
public static IvyContext pushNewContext()
popContext()
should usually be called when the job for which this context has been
pushed is finished.
public static IvyContext pushNewCopyContext()
popContext()
should usually be called when the job for which this context has been
pushed is finished.
public static IvyContext pushContext(IvyContext context)
popContext()
when done.context
- the new context to use in this thread.public static IvyContext popContext()
pushNewContext()
or pushContext(IvyContext)
was done
prior to beginning the task.public static java.lang.Object peekInContextStack(java.lang.String key)
This methods does a similar job to peek(String)
, except that it considers the whole
context stack and not only one instance.
key
- context key for the stringpeek(String)
public Ivy getIvy()
When calling any public ivy method on an ivy instance, a reference to this instance is put in this context, and thus accessible using this method, until no code reference this instance and the garbage collector collects it.
Then, or if no ivy method has been called, a default ivy instance is returned by this method,
so that it never returns null
.
public Ivy peekIvy()
null
if no such
instance is currently associated with this context.
If you want get a default Ivy instance in case no instance if currently associated, use
getIvy()
.
null
if there is no current ivy instance.public void setIvy(Ivy ivy)
public IvySettings getSettings()
public CircularDependencyStrategy getCircularDependencyStrategy()
public java.lang.Object get(java.lang.String key)
public void set(java.lang.String key, java.lang.Object value)
public java.lang.Object peek(java.lang.String key)
key
- context key for the stringpublic java.lang.Object pop(java.lang.String key)
key
- context key for the stringpublic boolean pop(java.lang.String key, java.lang.Object expectedValue)
key
- context key for the stringpublic void push(java.lang.String key, java.lang.Object value)
key
- key context key for the stringvalue
- value to be saved under the keypublic java.lang.Thread getOperatingThread()
public MessageLogger getMessageLogger()
public EventManager getEventManager()
public void checkInterrupted()
public void setResolveData(ResolveData data)
public ResolveData getResolveData()
public void setDependencyDescriptor(DependencyDescriptor dd)
public DependencyDescriptor getDependencyDescriptor()