use of org.apache.ivy.core.resolve.ResolveEngine in project build-info by JFrogDev.
the class ArtifactoryBuildListener method getEventManager.
/**
* Retrieves all the event managers of all the ivy settings of the project.
*
* @param task the task we need to attach listeners to
* @return the list of event manager for this task
*/
private List<EventManager> getEventManager(Task task) {
List<EventManager> results = new ArrayList<EventManager>();
Project project = task.getProject();
Enumeration<Object> elements = project.getReferences().elements();
// Iterate the project elements, search for ivy:settings and return them:
while (elements.hasMoreElements()) {
Object element = elements.nextElement();
if (element instanceof UnknownElement) {
UnknownElement unknown = (UnknownElement) element;
element = unknown.getRealThing();
if (element == null) {
unknown.maybeConfigure();
element = unknown.getRealThing();
}
}
if (element instanceof IvyAntSettings) {
results.add(((IvyAntSettings) element).getConfiguredIvyInstance(task).getResolveEngine().getEventManager());
}
}
// If no ivy:settings were found (the ivy script might not include them), return the resolve engine:
if (results.isEmpty()) {
ResolveEngine engine = IvyAntSettings.getDefaultInstance(task).getConfiguredIvyInstance(task).getResolveEngine();
results.add(engine.getEventManager());
}
return results;
}
use of org.apache.ivy.core.resolve.ResolveEngine in project ant-ivy by apache.
the class RepositoryManagementEngineTest method setUp.
@Before
public void setUp() {
fixture = new TestFixture();
IvySettings settings = fixture.getSettings();
repository = new RepositoryManagementEngine(settings, new SearchEngine(settings), new ResolveEngine(settings, new EventManager(), new SortEngine(settings)));
}
use of org.apache.ivy.core.resolve.ResolveEngine in project ant-ivy by apache.
the class WarnCircularDependencyStrategyTest method setResolveContext.
private void setResolveContext(String resolveId) {
IvySettings settings = new IvySettings();
IvyContext.getContext().setResolveData(new ResolveData(new ResolveEngine(settings, new EventManager(), new SortEngine(settings)), new ResolveOptions().setResolveId(resolveId)));
}
use of org.apache.ivy.core.resolve.ResolveEngine in project ant-ivy by apache.
the class Ivy method bind.
/**
* This method is used to bind this Ivy instance to required dependencies, i.e. instance of
* settings, engines, and so on.
* <p>
* After this call Ivy is still not configured, which means that the settings object is still
* empty.
* </p>
*/
public void bind() {
pushContext();
try {
if (settings == null) {
settings = new IvySettings();
}
if (eventManager == null) {
eventManager = new EventManager();
}
if (sortEngine == null) {
sortEngine = new SortEngine(settings);
}
if (searchEngine == null) {
searchEngine = new SearchEngine(settings);
}
if (resolveEngine == null) {
resolveEngine = new ResolveEngine(settings, eventManager, sortEngine);
}
if (retrieveEngine == null) {
retrieveEngine = new RetrieveEngine(settings, eventManager);
}
if (deliverEngine == null) {
deliverEngine = new DeliverEngine(settings);
}
if (publishEngine == null) {
publishEngine = new PublishEngine(settings, eventManager);
}
if (installEngine == null) {
installEngine = new InstallEngine(settings, searchEngine, resolveEngine);
}
if (repositoryEngine == null) {
repositoryEngine = new RepositoryManagementEngine(settings, searchEngine, resolveEngine);
}
eventManager.addTransferListener(new TransferListener() {
public void transferProgress(TransferEvent evt) {
ResolveData resolve;
switch(evt.getEventType()) {
case TransferEvent.TRANSFER_PROGRESS:
resolve = IvyContext.getContext().getResolveData();
if (resolve == null || !LogOptions.LOG_QUIET.equals(resolve.getOptions().getLog())) {
Message.progress();
}
break;
case TransferEvent.TRANSFER_COMPLETED:
resolve = IvyContext.getContext().getResolveData();
if (resolve == null || !LogOptions.LOG_QUIET.equals(resolve.getOptions().getLog())) {
Message.endProgress(" (" + (evt.getTotalLength() / KILO) + "kB)");
}
break;
default:
break;
}
}
});
bound = true;
} finally {
popContext();
}
}
use of org.apache.ivy.core.resolve.ResolveEngine in project ant-ivy by apache.
the class ChainResolverTest method setUp.
@Before
public void setUp() {
settings = new IvySettings();
engine = new ResolveEngine(settings, new EventManager(), new SortEngine(settings));
TestHelper.createCache();
data = new ResolveData(engine, new ResolveOptions());
settings.setDefaultCache(TestHelper.cache);
}
Aggregations