org.apache.ivy.core
public class IvyContext extends Object
See Also: IvyThread
Constructor Summary | |
---|---|
IvyContext() | |
IvyContext(IvyContext ctx) |
Method Summary | |
---|---|
void | checkInterrupted() |
Object | get(String key) |
CircularDependencyStrategy | getCircularDependencyStrategy() |
static IvyContext | getContext() |
DependencyDescriptor | getDependencyDescriptor() |
EventManager | getEventManager() |
Ivy | getIvy()
Returns the current ivy instance.
|
MessageLogger | getMessageLogger() |
Thread | getOperatingThread() |
ResolveData | getResolveData() |
IvySettings | getSettings() |
Object | peek(String key)
Reads the first object from the list saved under given key in the context. |
static Object | peekInContextStack(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.
|
Object | pop(String key)
Removes and returns first object from the list saved under given key in the context. |
boolean | pop(String key, 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(String key, 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(String key, Object value) |
void | setDependencyDescriptor(DependencyDescriptor dd) |
void | setIvy(Ivy ivy) |
void | setResolveData(ResolveData data) |
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
.
Returns: the current ivy instance
Parameters: key context key for the string
Returns: top object from the list (index 0) or null if no key or list empty
This methods does a similar job to peek, except that it considers the whole context stack and not only one instance.
Parameters: key context key for the string
Returns: top object from the list (index 0) of the first context in the stack containing this key or null if no key or list empty in all contexts from the context stack
See Also: peek
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.
Returns: the current ivy instance, or null
if there is no current ivy instance.
Parameters: key context key for the string
Returns: top object from the list (index 0) or null if no key or list empty
Parameters: key context key for the string
Returns: true if the r
Returns: the popped context
Parameters: key key context key for the string value value to be saved under the key
Parameters: context the new context to use in this thread.
Returns: the pushed context
popContext should usually be called when the job for which this context has been pushed is finished.
Returns: the newly pushed context
popContext should usually be called when the job for which this context has been pushed is finished.
Returns: the newly pushed context