Search in sources :

Example 6 with FixedIndexedRepo

use of aQute.bnd.deployer.repository.FixedIndexedRepo in project bnd by bndtools.

the class ResolverValidator method validate.

public List<Resolution> validate() throws Exception {
    FixedIndexedRepo repository = getRepository();
    Set<Resource> resources = getAllResources(repository);
    return validateResources(repository, resources);
}
Also used : Resource(org.osgi.resource.Resource) FixedIndexedRepo(aQute.bnd.deployer.repository.FixedIndexedRepo)

Example 7 with FixedIndexedRepo

use of aQute.bnd.deployer.repository.FixedIndexedRepo in project bnd by bndtools.

the class Utils method createRepo.

public static Repository createRepo(File index, String name) {
    FixedIndexedRepo repo = new FixedIndexedRepo();
    Map<String, String> props = new HashMap<String, String>();
    props.put(FixedIndexedRepo.PROP_LOCATIONS, index.toURI().toString());
    if (name != null)
        props.put(AbstractIndexedRepo.PROP_NAME, name);
    repo.setProperties(props);
    return repo;
}
Also used : HashMap(java.util.HashMap) FixedIndexedRepo(aQute.bnd.deployer.repository.FixedIndexedRepo)

Example 8 with FixedIndexedRepo

use of aQute.bnd.deployer.repository.FixedIndexedRepo in project bnd by bndtools.

the class Utils method createRepo.

public static Repository createRepo(URI uri, String name) {
    FixedIndexedRepo repo = new FixedIndexedRepo();
    Map<String, String> props = new HashMap<String, String>();
    props.put(FixedIndexedRepo.PROP_LOCATIONS, uri.toString());
    if (name != null)
        props.put(AbstractIndexedRepo.PROP_NAME, name);
    repo.setProperties(props);
    return repo;
}
Also used : HashMap(java.util.HashMap) FixedIndexedRepo(aQute.bnd.deployer.repository.FixedIndexedRepo)

Example 9 with FixedIndexedRepo

use of aQute.bnd.deployer.repository.FixedIndexedRepo in project bnd by bndtools.

the class ResolveTest method testMinimalSetup.

/**
	 * Test minimal setup
	 * 
	 * @throws URISyntaxException
	 * @throws MalformedURLException
	 */
public void testMinimalSetup() throws MalformedURLException, URISyntaxException {
    File index = IO.getFile("testdata/repo3.index.xml");
    FixedIndexedRepo fir = new FixedIndexedRepo();
    fir.setLocations(index.toURI().toString());
    Processor model = new Processor();
    model.setProperty("-runfw", "org.apache.felix.framework");
    model.setProperty("-runrequires", "osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.shell)'");
    BndrunResolveContext context = new BndrunResolveContext(model, null, model, log);
    context.setLevel(0);
    context.addRepository(fir);
    context.init();
    Resolver resolver = new BndResolver(new ResolverLogger(4));
    try {
        Map<Resource, List<Wire>> resolved = resolver.resolve(context);
        Set<Resource> resources = resolved.keySet();
        Resource shell = getResource(resources, "org.apache.felix.gogo.shell", "0.10.0");
        assertNotNull(shell);
    } catch (ResolutionException e) {
        e.printStackTrace();
        fail("Resolve failed");
    }
}
Also used : ResolutionException(org.osgi.service.resolver.ResolutionException) Processor(aQute.bnd.osgi.Processor) Resolver(org.osgi.service.resolver.Resolver) Resource(org.osgi.resource.Resource) ArrayList(java.util.ArrayList) List(java.util.List) File(java.io.File) FixedIndexedRepo(aQute.bnd.deployer.repository.FixedIndexedRepo)

Example 10 with FixedIndexedRepo

use of aQute.bnd.deployer.repository.FixedIndexedRepo in project bndtools by bndtools.

the class ReposTemplateLoader method addPreferenceConfiguredRepos.

private static void addPreferenceConfiguredRepos(List<Repository> repos, Reporter reporter) {
    BndPreferences bndPrefs = null;
    try {
        bndPrefs = new BndPreferences();
    } catch (Exception e) {
    // e.printStackTrace();
    }
    if (bndPrefs != null && bndPrefs.getEnableTemplateRepo()) {
        List<String> repoUris = bndPrefs.getTemplateRepoUriList();
        try {
            FixedIndexedRepo prefsRepo = loadRepo(repoUris);
            repos.add(prefsRepo);
        } catch (IOException | URISyntaxException ex) {
            reporter.exception(ex, "Error loading preference repository: %s", repoUris);
        }
    }
}
Also used : BndPreferences(bndtools.preferences.BndPreferences) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) FixedIndexedRepo(aQute.bnd.deployer.repository.FixedIndexedRepo) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException)

Aggregations

FixedIndexedRepo (aQute.bnd.deployer.repository.FixedIndexedRepo)12 File (java.io.File)3 HashMap (java.util.HashMap)3 Workspace (aQute.bnd.build.Workspace)2 HttpTestServer (aQute.http.testservers.HttpTestServer)2 Resource (org.osgi.resource.Resource)2 Processor (aQute.bnd.osgi.Processor)1 BndPreferences (bndtools.preferences.BndPreferences)1 IOException (java.io.IOException)1 HttpURLConnection (java.net.HttpURLConnection)1 URISyntaxException (java.net.URISyntaxException)1 UnknownHostException (java.net.UnknownHostException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 RepositorySystem (org.eclipse.aether.RepositorySystem)1 DefaultServiceLocator (org.eclipse.aether.impl.DefaultServiceLocator)1 ErrorHandler (org.eclipse.aether.impl.DefaultServiceLocator.ErrorHandler)1 LocalRepository (org.eclipse.aether.repository.LocalRepository)1 Builder (org.eclipse.aether.repository.RemoteRepository.Builder)1 AuthenticationBuilder (org.eclipse.aether.util.repository.AuthenticationBuilder)1