Search in sources :

Example 1 with ResourceRepositoryImpl

use of aQute.bnd.resource.repository.ResourceRepositoryImpl in project bnd by bndtools.

the class ResourceRepoTest method testStore.

public void testStore() throws Exception {
    assertEquals(0, repoImpl.filter(null, null).size());
    repoImpl.add("x", create("jar/osgi.jar"));
    assertEquals(1, repoImpl.filter(null, null).size());
    repoImpl = new ResourceRepositoryImpl();
    repoImpl.setCache(new File(tmp, "cache"));
    repoImpl.setExecutor(Executors.newCachedThreadPool());
    repoImpl.setIndexFile(new File(tmp, "index.json"));
    assertEquals(1, repoImpl.filter(null, null).size());
}
Also used : ResourceRepositoryImpl(aQute.bnd.resource.repository.ResourceRepositoryImpl) File(java.io.File)

Example 2 with ResourceRepositoryImpl

use of aQute.bnd.resource.repository.ResourceRepositoryImpl in project bnd by bndtools.

the class Workspace method setTypeSpecificPlugins.

@Override
protected void setTypeSpecificPlugins(Set<Object> list) {
    try {
        super.setTypeSpecificPlugins(list);
        list.add(this);
        list.add(maven);
        list.add(settings);
        if (!isTrue(getProperty(NOBUILDINCACHE))) {
            list.add(new CachedFileRepo());
        }
        resourceRepositoryImpl = new ResourceRepositoryImpl();
        resourceRepositoryImpl.setCache(IO.getFile(getProperty(CACHEDIR, "~/.bnd/caches/shas")));
        resourceRepositoryImpl.setExecutor(getExecutor());
        resourceRepositoryImpl.setIndexFile(getFile(getBuildDir(), "repo.json"));
        resourceRepositoryImpl.setURLConnector(new MultiURLConnectionHandler(this));
        customize(resourceRepositoryImpl, null);
        list.add(resourceRepositoryImpl);
        //
        // Exporters
        //
        list.add(new SubsystemExporter());
        try {
            HttpClient client = new HttpClient();
            client.setOffline(getOffline());
            client.setRegistry(this);
            try (ConnectionSettings cs = new ConnectionSettings(this, client)) {
                cs.readSettings();
            }
            list.add(client);
        } catch (Exception e) {
            exception(e, "Failed to load the communication settings");
        }
    } catch (RuntimeException e) {
        throw e;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : ResourceRepositoryImpl(aQute.bnd.resource.repository.ResourceRepositoryImpl) SubsystemExporter(aQute.bnd.exporter.subsystem.SubsystemExporter) HttpClient(aQute.bnd.http.HttpClient) MultiURLConnectionHandler(aQute.bnd.url.MultiURLConnectionHandler) ConnectionSettings(aQute.bnd.connection.settings.ConnectionSettings) IOException(java.io.IOException) TimeLimitExceededException(javax.naming.TimeLimitExceededException)

Aggregations

ResourceRepositoryImpl (aQute.bnd.resource.repository.ResourceRepositoryImpl)2 ConnectionSettings (aQute.bnd.connection.settings.ConnectionSettings)1 SubsystemExporter (aQute.bnd.exporter.subsystem.SubsystemExporter)1 HttpClient (aQute.bnd.http.HttpClient)1 MultiURLConnectionHandler (aQute.bnd.url.MultiURLConnectionHandler)1 File (java.io.File)1 IOException (java.io.IOException)1 TimeLimitExceededException (javax.naming.TimeLimitExceededException)1