use of aQute.bnd.service.RepositoryPlugin in project bnd by bndtools.
the class AetherRepsitoryTests method testSourceLookup.
public void testSourceLookup() throws Exception {
RepositoryPlugin repo = createRepo();
Map<String, String> attrs = new HashMap<String, String>();
attrs.put("version", "2.5");
attrs.put("bsn", "javax.servlet:servlet-api");
File file = repo.get("servlet-api.source", new Version(2, 5, 0), attrs, listener);
assertTrue(file.exists());
assertEquals("servlet-api-2.5-sources.jar", file.getName());
}
use of aQute.bnd.service.RepositoryPlugin in project bnd by bndtools.
the class AetherRepsitoryTests method testVersionsGAVStyle.
public void testVersionsGAVStyle() throws Exception {
RepositoryPlugin repo = createRepo();
SortedSet<Version> versions = repo.versions("javax.servlet:servlet-api");
assertNotNull(versions);
assertTrue(versions.size() == 2);
assertEquals("2.4.0", versions.first().toString());
assertEquals("2.5.0", versions.last().toString());
}
use of aQute.bnd.service.RepositoryPlugin in project bnd by bndtools.
the class BndrunResolveContext method loadRepositories.
/**
* Load all the OSGi repositories from our registry
* <p>
* TODO Use Instruction ...
*
* @return
* @throws Exception
*/
private Processor loadRepositories() throws Exception {
//
// Get all of the repositories from the plugin registry
//
List<Repository> allRepos = registry.getPlugins(Repository.class);
Collection<Repository> orderedRepositories;
String rn = properties.mergeProperties(Constants.RUNREPOS);
if (rn == null) {
//
// No filter set, so we use all
//
orderedRepositories = allRepos;
} else {
Parameters repoNames = new Parameters(rn, project);
// Map the repository names...
Map<String, Repository> repoNameMap = new HashMap<String, Repository>(allRepos.size());
for (Repository repo : allRepos) {
String name;
if (repo instanceof aQute.bnd.deployer.repository.wrapper.Plugin) {
@SuppressWarnings("resource") aQute.bnd.deployer.repository.wrapper.Plugin wrapper = (aQute.bnd.deployer.repository.wrapper.Plugin) repo;
wrapper.init();
name = wrapper.toString();
} else if (repo instanceof RepositoryPlugin) {
name = ((RepositoryPlugin) repo).getName();
} else {
name = repo.toString();
}
repoNameMap.put(name, repo);
}
// Create the result list
orderedRepositories = new ArrayList<>();
for (String repoName : repoNames.keySet()) {
Repository repo = repoNameMap.get(repoName);
if (repo != null)
orderedRepositories.add(repo);
}
}
Processor repositoryAugments = findRepositoryAugments(orderedRepositories);
Parameters augments = new Parameters(repositoryAugments.mergeProperties(Constants.AUGMENT), project);
augments.putAll(new Parameters(properties.mergeProperties(Constants.AUGMENT), project));
if (!augments.isEmpty()) {
AggregateRepository aggregate = new AggregateRepository(orderedRepositories);
AugmentRepository augment = new AugmentRepository(augments, aggregate);
orderedRepositories = Collections.singleton((Repository) augment);
}
for (Repository repository : orderedRepositories) {
super.addRepository(repository);
}
return repositoryAugments;
}
use of aQute.bnd.service.RepositoryPlugin in project bndtools by bndtools.
the class LocalRepositorySelectionPage method setSelectedRepository.
private void setSelectedRepository(RepositoryPlugin item) {
RepositoryPlugin old = selectedRepository;
selectedRepository = item;
propSupport.firePropertyChange(PROP_SELECTED_REPO, old, selectedRepository);
getContainer().updateButtons();
}
use of aQute.bnd.service.RepositoryPlugin in project bndtools by bndtools.
the class LocalRepositorySelectionPage method createControl.
public void createControl(Composite parent) {
setTitle("Select Local Repository");
setMessage("Bundle will be imported into the selected repository.");
Table table = new Table(parent, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
final TableViewer viewer = new TableViewer(table);
viewer.setContentProvider(new RepositoryTreeContentProvider());
viewer.setLabelProvider(new RepositoryTreeLabelProvider(false));
viewer.setFilters(new ViewerFilter[] { new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
return (element instanceof RepositoryPlugin) && ((RepositoryPlugin) element).canWrite();
}
} });
try {
Workspace workspace = Central.getWorkspace();
viewer.setInput(workspace);
if (selectedRepository != null)
viewer.setSelection(new StructuredSelection(selectedRepository));
validate(workspace);
} catch (Exception e) {
logger.logError("Error querying local repositories", e);
setErrorMessage("Error querying local repositories, see log for details.");
}
// LISTENERS
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
setSelectedRepository((RepositoryPlugin) selection.getFirstElement());
}
});
viewer.addOpenListener(new IOpenListener() {
public void open(OpenEvent evt) {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
setSelectedRepository((RepositoryPlugin) selection.getFirstElement());
IWizardPage nextPage = getNextPage();
if (nextPage != null)
getContainer().showPage(nextPage);
}
});
setControl(table);
}
Aggregations