Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Equinox p2 Composite Repositories"

m (typo)
(Using Composite Repositories)
 
(4 intermediate revisions by the same user not shown)
Line 9: Line 9:
 
     ...
 
     ...
 
     <children size='2'>
 
     <children size='2'>
       <child location='http://www.eclipse.org/foo'/>
+
       <child location='<nowiki>http://www.eclipse.org/foo</nowiki>'/>
       <child location='http://www.eclipse.org/bar'/>
+
       <child location='<nowiki>http://www.eclipse.org/bar</nowiki>'/>
 
     </children>
 
     </children>
 
   </repository>
 
   </repository>
  
As we can see this xml defines a CompositeArtifactRepository with 2 children. The children are the locations of the referenced repositories. Both of these children are remote repositories but local repositories can be defined by the following code:
+
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>'/>
 
   <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 all other repositories.
+
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 ==
 
== Using Composite Repositories ==
Composite repositories implement the ICompositeRepository interface with the following functionality:
+
Composite repositories implement the ICompositeRepository interface which includes the following methods:
  
* <b>getChildren():</b> returns an ArrayList containing the locations of the repository's children as URIs.
+
* <b>getChildren()</b>: returns an ArrayList containing the locations of the child repositories as URIs.
* <b>removeAllChildren():</b> removes all children from the composite repository.
+
* <b>removeAllChildren()</b>: removes all child repositories from the composite repository.
* <b>addChild(URI):</b> adds the specified location to the list of child repositories
+
* <b>addChild(URI)</b>: adds the specified location to the list of child repositories
* <b>removeChild(URI):</b> removes the specified URI from the list of child repositories.
+
* <b>removeChild(URI)</b>: removes the specified URI from the list of child repositories.
  
Remember, composite repositories treat child repositories only as references and do not directly modify them.
+
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.
 +
 
 +
* <b>validate(String)</b>: 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.
 +
* <b>addChild(URI, String)</b>: 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.

Latest revision as of 12:16, 8 December 2008

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