public class Ivy
extends java.lang.Object
This class is the main class of Ivy, which acts as a Facade to all services offered by Ivy:
Ivy ivy = Ivy.newInstance(); ivy.configure(new URL("ivysettings.xml")); ivy.resolve(new URL("ivy.xml"));
If the methods offered by the Ivy
class are not flexible enough and you want to use Ivy
engines directly, you need to call the methods within a single IvyContext
associated to
the Ivy
instance you use.
To do so, it is recommended to use the execute(org.apache.ivy.Ivy.IvyCallback)
method
like this:
Ivy ivy = Ivy.newInstance(); ivy.execute(new IvyCallback() { public Object doInIvyContext(Ivy ivy, IvyContext context) { // obviously we can use regular Ivy methods in the callback ivy.configure(new URL("ivysettings.xml")); // and we can safely use Ivy engines too ivy.getResolveEngine().resolve(new URL("ivy.xml")); return null; } });
Modifier and Type | Class and Description |
---|---|
static interface |
Ivy.IvyCallback
Callback used to execute a set of Ivy related methods within an
IvyContext . |
Modifier and Type | Field and Description |
---|---|
static java.text.SimpleDateFormat |
DATE_FORMAT
Deprecated.
Use the
DateUtil utility class instead. |
Constructor and Description |
---|
Ivy()
The default constructor of Ivy allows to create an instance of Ivy with none of its
dependencies (engines, settings, ...) created.
|
Modifier and Type | Method and Description |
---|---|
void |
bind()
This method is used to bind this Ivy instance to required dependencies, i.e.
|
boolean |
check(java.net.URL ivyFile,
java.lang.String resolvername) |
void |
checkInterrupted()
Check if the current operation has been interrupted, and if it is the case, throw a runtime
exception
|
void |
configure(java.io.File settingsFile) |
void |
configure(java.net.URL settingsURL) |
void |
configureDefault() |
void |
configureDefault14()
Configures Ivy with 1.4 compatible default settings
|
void |
deliver(ModuleRevisionId mrid,
java.lang.String revision,
java.lang.String destIvyPattern) |
void |
deliver(ModuleRevisionId mrid,
java.lang.String revision,
java.lang.String destIvyPattern,
DeliverOptions options)
Example of use: deliver(mrid, "1.5", "target/ivy/ivy-[revision].xml",
DeliverOptions.newInstance(settings).setStatus("release").setValidate(false));
|
void |
deliver(java.lang.String revision,
java.lang.String destIvyPattern,
DeliverOptions options) |
java.lang.Object |
execute(Ivy.IvyCallback callback)
Executes the given callback in the context of this Ivy instance.
|
ResolvedModuleRevision |
findModule(ModuleRevisionId mrid) |
CheckEngine |
getCheckEngine() |
DeliverEngine |
getDeliverEngine() |
EventManager |
getEventManager() |
InstallEngine |
getInstallEngine() |
static java.lang.String |
getIvyDate()
Returns the date at which this version of Ivy has been built.
|
static java.lang.String |
getIvyHomeURL()
Returns the URL at which Ivy web site can be found.
|
static java.lang.String |
getIvyVersion()
Returns the current version of Ivy, as displayed on the console when Ivy is initialized.
|
MessageLoggerEngine |
getLoggerEngine() |
PublishEngine |
getPublishEngine() |
RepositoryManagementEngine |
getRepositoryEngine() |
ResolutionCacheManager |
getResolutionCacheManager() |
ResolveEngine |
getResolveEngine() |
RetrieveEngine |
getRetrieveEngine() |
SearchEngine |
getSearchEngine() |
IvySettings |
getSettings() |
SortEngine |
getSortEngine() |
java.lang.String |
getVariable(java.lang.String name) |
static java.lang.String |
getWorkingRevision() |
ResolveReport |
install(ModuleRevisionId mrid,
java.lang.String from,
java.lang.String to,
InstallOptions options) |
void |
interrupt()
Interrupts the current running operation, no later than interruptTimeout milliseconds after
the call
|
void |
interrupt(java.lang.Thread operatingThread)
Interrupts the current running operation in the given operating thread, no later than
interruptTimeout milliseconds after the call
|
boolean |
isInterrupted() |
ModuleEntry[] |
listModuleEntries(OrganisationEntry org) |
ModuleId[] |
listModules(ModuleId criteria,
PatternMatcher matcher) |
ModuleRevisionId[] |
listModules(ModuleRevisionId criteria,
PatternMatcher matcher) |
java.lang.String[] |
listModules(java.lang.String org) |
OrganisationEntry[] |
listOrganisationEntries() |
java.lang.String[] |
listOrganisations() |
RevisionEntry[] |
listRevisionEntries(ModuleEntry module) |
java.lang.String[] |
listRevisions(java.lang.String org,
java.lang.String module) |
java.lang.String[] |
listTokenValues(java.lang.String token,
java.util.Map otherTokenValues) |
static Ivy |
newInstance() |
static Ivy |
newInstance(IvySettings settings) |
void |
popContext()
Pops the current Ivy context.
|
java.util.Collection |
publish(ModuleRevisionId mrid,
java.util.Collection srcArtifactPattern,
java.lang.String resolverName,
PublishOptions options) |
void |
pushContext()
Pushes a new IvyContext bound to this Ivy instance if the current context is not already
bound to this Ivy instance.
|
ResolveReport |
resolve(java.io.File ivySource) |
ResolveReport |
resolve(java.io.File ivySource,
ResolveOptions options) |
ResolveReport |
resolve(ModuleDescriptor md,
ResolveOptions options) |
ResolveReport |
resolve(ModuleRevisionId mrid,
ResolveOptions options,
boolean changing) |
ResolveReport |
resolve(java.net.URL ivySource) |
ResolveReport |
resolve(java.net.URL ivySource,
ResolveOptions options) |
RetrieveReport |
retrieve(ModuleRevisionId mrid,
RetrieveOptions options) |
int |
retrieve(ModuleRevisionId mrid,
java.lang.String destFilePattern,
RetrieveOptions options) |
void |
setCheckEngine(CheckEngine checkEngine) |
void |
setDeliverEngine(DeliverEngine deliverEngine) |
void |
setEventManager(EventManager eventManager) |
void |
setInstallEngine(InstallEngine installEngine) |
void |
setPublishEngine(PublishEngine publishEngine) |
void |
setRepositoryEngine(RepositoryManagementEngine repositoryEngine) |
void |
setResolveEngine(ResolveEngine resolveEngine) |
void |
setRetrieveEngine(RetrieveEngine retrieveEngine) |
void |
setSearchEngine(SearchEngine searchEngine) |
void |
setSettings(IvySettings settings) |
void |
setSortEngine(SortEngine sortEngine) |
void |
setVariable(java.lang.String varName,
java.lang.String value) |
java.util.List |
sortModuleDescriptors(java.util.Collection moduleDescriptors,
SortOptions options)
Sorts the given ModuleDescriptors from the less dependent to the more dependent.
|
java.util.List |
sortNodes(java.util.Collection nodes,
SortOptions options)
Sorts the collection of IvyNode from the less dependent to the more dependent
|
java.lang.String |
substitute(java.lang.String str) |
@Deprecated public static final java.text.SimpleDateFormat DATE_FORMAT
DateUtil
utility class instead.public Ivy()
public static java.lang.String getIvyVersion()
public static java.lang.String getIvyDate()
May be empty if unknown.
public static java.lang.String getIvyHomeURL()
public static Ivy newInstance()
public static Ivy newInstance(IvySettings settings)
public void bind()
After this call Ivy is still not configured, which means that the settings object is still empty.
public java.lang.Object execute(Ivy.IvyCallback callback)
Alternatively you can use the pushContext()
and popContext()
methods, but
this is not recommended:
Object result = null; pushContext(); try { result = callback.doInIvyContext(this, IvyContext.getContext()); } finally { popContext(); } doSomethingWithResult(result);
callback
- public void pushContext()
popContext()
when you're done.
Alternatively, you can use the execute(org.apache.ivy.Ivy.IvyCallback)
method which
takes care of everything for you.
public void popContext()
You must call this method once and only once for each call to pushContext()
, when
you're done with the your Ivy related work.
Alternatively, you can use the execute(org.apache.ivy.Ivy.IvyCallback)
method which
takes care of everything for you.
public void configure(java.io.File settingsFile) throws java.text.ParseException, java.io.IOException
java.text.ParseException
java.io.IOException
public void configure(java.net.URL settingsURL) throws java.text.ParseException, java.io.IOException
java.text.ParseException
java.io.IOException
public void configureDefault() throws java.text.ParseException, java.io.IOException
java.text.ParseException
java.io.IOException
public void configureDefault14() throws java.text.ParseException, java.io.IOException
java.text.ParseException
java.io.IOException
public boolean check(java.net.URL ivyFile, java.lang.String resolvername)
public ResolveReport resolve(java.io.File ivySource) throws java.text.ParseException, java.io.IOException
java.text.ParseException
java.io.IOException
public ResolveReport resolve(java.net.URL ivySource) throws java.text.ParseException, java.io.IOException
java.text.ParseException
java.io.IOException
public ResolveReport resolve(ModuleRevisionId mrid, ResolveOptions options, boolean changing) throws java.text.ParseException, java.io.IOException
java.text.ParseException
java.io.IOException
public ResolveReport resolve(java.net.URL ivySource, ResolveOptions options) throws java.text.ParseException, java.io.IOException
java.text.ParseException
java.io.IOException
public ResolveReport resolve(java.io.File ivySource, ResolveOptions options) throws java.text.ParseException, java.io.IOException
java.text.ParseException
java.io.IOException
public ResolveReport resolve(ModuleDescriptor md, ResolveOptions options) throws java.text.ParseException, java.io.IOException
java.text.ParseException
java.io.IOException
public ResolveReport install(ModuleRevisionId mrid, java.lang.String from, java.lang.String to, InstallOptions options) throws java.io.IOException
java.io.IOException
public int retrieve(ModuleRevisionId mrid, java.lang.String destFilePattern, RetrieveOptions options) throws java.io.IOException
java.io.IOException
public RetrieveReport retrieve(ModuleRevisionId mrid, RetrieveOptions options) throws java.io.IOException
java.io.IOException
public void deliver(ModuleRevisionId mrid, java.lang.String revision, java.lang.String destIvyPattern) throws java.io.IOException, java.text.ParseException
java.io.IOException
java.text.ParseException
public void deliver(java.lang.String revision, java.lang.String destIvyPattern, DeliverOptions options) throws java.io.IOException, java.text.ParseException
java.io.IOException
java.text.ParseException
public void deliver(ModuleRevisionId mrid, java.lang.String revision, java.lang.String destIvyPattern, DeliverOptions options) throws java.io.IOException, java.text.ParseException
mrid
- revision
- destIvyPattern
- options
- java.io.IOException
java.text.ParseException
public java.util.Collection publish(ModuleRevisionId mrid, java.util.Collection srcArtifactPattern, java.lang.String resolverName, PublishOptions options) throws java.io.IOException
java.io.IOException
public java.util.List sortNodes(java.util.Collection nodes, SortOptions options)
public java.util.List sortModuleDescriptors(java.util.Collection moduleDescriptors, SortOptions options)
moduleDescriptors
- a Collection of ModuleDescriptor to sortoptions
- Options to use to sort the descriptors.CircularDependencyException
- if a circular dependency exists and circular dependency strategy decide to throw
an exceptionpublic ResolvedModuleRevision findModule(ModuleRevisionId mrid)
public ModuleEntry[] listModuleEntries(OrganisationEntry org)
public ModuleId[] listModules(ModuleId criteria, PatternMatcher matcher)
public ModuleRevisionId[] listModules(ModuleRevisionId criteria, PatternMatcher matcher)
public java.lang.String[] listModules(java.lang.String org)
public OrganisationEntry[] listOrganisationEntries()
public java.lang.String[] listOrganisations()
public RevisionEntry[] listRevisionEntries(ModuleEntry module)
public java.lang.String[] listRevisions(java.lang.String org, java.lang.String module)
public java.lang.String[] listTokenValues(java.lang.String token, java.util.Map otherTokenValues)
public void interrupt()
public void interrupt(java.lang.Thread operatingThread)
public boolean isInterrupted()
public void checkInterrupted()
public static java.lang.String getWorkingRevision()
public ResolutionCacheManager getResolutionCacheManager()
public java.lang.String getVariable(java.lang.String name)
public java.lang.String substitute(java.lang.String str)
public void setVariable(java.lang.String varName, java.lang.String value)
public IvySettings getSettings()
public EventManager getEventManager()
public CheckEngine getCheckEngine()
public void setCheckEngine(CheckEngine checkEngine)
public DeliverEngine getDeliverEngine()
public void setDeliverEngine(DeliverEngine deliverEngine)
public InstallEngine getInstallEngine()
public void setInstallEngine(InstallEngine installEngine)
public PublishEngine getPublishEngine()
public void setPublishEngine(PublishEngine publishEngine)
public ResolveEngine getResolveEngine()
public void setResolveEngine(ResolveEngine resolveEngine)
public RetrieveEngine getRetrieveEngine()
public void setRetrieveEngine(RetrieveEngine retrieveEngine)
public SearchEngine getSearchEngine()
public void setSearchEngine(SearchEngine searchEngine)
public SortEngine getSortEngine()
public void setSortEngine(SortEngine sortEngine)
public RepositoryManagementEngine getRepositoryEngine()
public void setRepositoryEngine(RepositoryManagementEngine repositoryEngine)
public void setEventManager(EventManager eventManager)
public void setSettings(IvySettings settings)
public MessageLoggerEngine getLoggerEngine()