JBoss Community Archive (Read Only)

WildFly Camel

Repository API

Repository

The concept of a Repository is that of a persistent Resource store that can delegate to other Repositories. A typical Repository setup would look like this

        Repository delegate = new RepositoryAggregator(new DefaultMavenIdentityRepository(propertyProvider));
        Repository repository = new DefaultPersistentRepository(propertyProvider, delegate);

Assuming that the Repository has been populated properly, we start finding Capability providers for given Requirements.

        MavenCoordinates mavenid = MavenCoordinates.parse("org.jboss.logging:jboss-logging:3.1.3.GA");
        Requirement req = new MavenIdentityRequirementBuilder(mavenid).getRequirement();
        Collection<Capability> providers = repository.findProviders(req);
        Assert.assertEquals("One provider", 1, providers.size());

The above code sample would internally do this:

  1. Try to find providers in the local ResourceStore

  2. If not found, delegate to the MavenIdentityRepository

  3. If a repository delegate finds providers, add the associated Resources to the local ResourceStore

  4. Return the Capabilities that match the given Requirements from the local ResourceStore

Subsequent requests for the same Maven identity requirement would not have to contact the Maven repository.

Populating a Repository

Adding Resources to a Repository is a matter of adding them to the associated ResourceStore

        RepositoryStorage storage = repository.adapt(RepositoryStorage.class);
        storage.addResource(resource);
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 13:58:35 UTC, last content change 2013-08-01 12:10:21 UTC.