As repositories continually grow in size they become harder to manage. The goal of composite repositories is to make this task easier by allowing site maintainers to have a parent repository which refers to multiple child repositories. Users are then able to reference the parent repository and the content of all the child repositories will be transparently available to them.
With the built-in repository types defined by p2, when a user connects to a server, p2 checks to see if there are any files that are recognized.
In particular for metadata repositories it searches for a
content.xml file or a
content.jar and in the case of
artifact repositories it looks for an
So in order to create a composite repository, all one needs to do is create a new "index" file for the metadata and/or artifact repository and p2 will recognize that a composite repository has been defined and it will load it and its children. Composite repositories use a different index file name to help p2 recognize them as composite repositories.
<?xml version='1.0' encoding='UTF-8'?> <?compositeMetadataRepository version='1.0.0'?> <repository name='"Eclipse Project Test Site"' type='org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository' version='1.0.0'> <properties size='1'> <property name='p2.timestamp' value='1243822502499'/> </properties> <children size='2'> <child location='http://example.eclipse.org/childOne'/> <child location='http://example.eclipse.org/childTwo'/> </children> </repository>
<?xml version='1.0' encoding='UTF-8'?> <?compositeArtifactRepository version='1.0.0'?> <repository name='"Eclipse Project Test Site"' type='org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository' version='1.0.0'> <properties size='1'> <property name='p2.timestamp' value='1243822502440'/> </properties> <children size='2'> <child location='http://example.eclipse.org/childOne'/> <child location='http://example.eclipse.org/childTwo'/> </children> </repository>
In order to automate composite repository actions in release engineering builds, Ant tasks have been provided which can be called to create and
modify composite repositories. The tasks are defined in the
failOnExists- Whether it should fail if the repository already exists. (Default is false)
validate- A comparator-id. Child repositories claiming to contain the same artifact are compared using the given comparator. These are extensions to the
org.eclipse.equinox.p2.artifact.repository.artifactComparatorsextension point. Comparators provided by p2 are:
org.eclipse.equinox.p2.repository.tools.jar.comparator: Compare jars. Class files are disassembled and compared for equivalence, properties and manifest files are compared as such, all other files are compared byte-for-byte.
org.eclipse.equinox.artifact.md5.comparator: Compare the MD5 sums as recorded in the artifact repositories.
add- A nested element containing a list of repositories to add to the composite.
remove- A nested element containing a list repositories to remove from the composite.