Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Equinox p2 Composite Repositories

While regular repositories store their own content, composite repositories consist simply of references to other repositories. This allows users to store large, complex repositories as multiple smaller, more manageable repositories. Similarly, composite repositories allow users to access multiple, dispersed repositories from a single point of entry.

Defining a Composite Repository

Because composite repositories do not have content beyond links to other repositories, all composite repositories will be defined in a similar way. See the example below:

 <repository name='artifact name' type='org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository' version='1'>
   ...
   <children size='2'>
     <child location='http://www.eclipse.org/foo'/>
     <child location='http://www.eclipse.org/bar'/>
   </children>
 </repository>

As we can see this xml defines a CompositeArtifactRepository with 2 children (as indicated by the "size" attribute). The children are the locations of the referenced repositories. Both of these children are remote repositories but local repositories can be defined as follows:

 <child location='file:/<local repository location>'/>

Like all other repository types, composite repositories require the "repository" element to be included. Additionally, composite repositories also support the same "properties" element as other repository types but this has been omitted for simplicity.

Using Composite Repositories

Composite repositories implement the ICompositeRepository interface which includes the following methods:

  • getChildren(): returns an ArrayList containing the locations of the child repositories as URIs.
  • removeAllChildren(): removes all child repositories from the composite repository.
  • addChild(URI): adds the specified location to the list of child repositories
  • removeChild(URI): removes the specified URI from the list of child repositories.

Note that composite repositories treat child repositories only as references and do not directly modify them.

Composite Artifact Repositories

Composite Artifact Repositories implement some special methods not found in other Composite Repositories.

  • validate(String): uses a comparator that extends the "artifactComparators" Extension Point and is specified by a string containing the comparatorID to ensure all child repositories have no conflicting content. Returns a boolean representing if the Composite Repository is in a consistent state.
  • addChild(URI, String): Similar to addChild(URI) ensures that add the specified child repository will not leave the Composite Repository in an inconsistent state using a comparatorID specified by a String. Returns a boolean representing if the child repository was added.

Back to the top