Class XMLResourceGenerator

java.lang.Object
aQute.bnd.osgi.repository.XMLResourceGenerator

public class XMLResourceGenerator extends Object
Can turn an OSGi repository into an http://www.osgi.org/xmlns/repository/v1.0.0 XML file. See the Repository spec in OSGi.
  • Constructor Details

    • XMLResourceGenerator

      public XMLResourceGenerator()
      Creates a new instance of XMLResourceGenerator with an empty repository.
  • Method Details

    • save

      public void save(File location) throws IOException
      Saves the contents of this generator to the specified file.
      Parameters:
      location - The file to save the contents to.
      Throws:
      IOException - If an I/O error occurs.
    • save

      public void save(OutputStream out) throws IOException
      Saves the contents of this generator to the specified output stream.
      Parameters:
      out - The output stream to save the contents to.
      Throws:
      IOException - If an I/O error occurs.
    • name

      public XMLResourceGenerator name(String name)
      Note that calling name(String) sets increment to System.currentTimeMillis(). In order to retain backward compatibility that is not change. Therefore, in order to specify a value increment(long) should be called after.
      Parameters:
      name -
      Returns:
      this
    • increment

      public XMLResourceGenerator increment(long increment)
      Note that calling name(String) sets increment to System.currentTimeMillis(). In order to retain backward compatibility that is not change. Therefore, in order to specify a value increment(long) should be called after.
      Parameters:
      increment -
      Returns:
      this
    • referral

      public XMLResourceGenerator referral(URI reference, int depth)
      Adds a referral to this generator.
      Parameters:
      reference - The URI of the referral.
      depth - The depth of the referral.
      Returns:
      This generator.
    • repository

      public XMLResourceGenerator repository(org.osgi.service.repository.Repository repository)
      Adds all the resources in the specified repository to this generator.
      Parameters:
      repository - The repository whose resources to add.
      Returns:
      This generator.
    • resources

      public XMLResourceGenerator resources(Collection<? extends org.osgi.resource.Resource> resources)
      Adds all the resources in the specified collection to this generator.
      Parameters:
      resources - The resources to add.
      Returns:
      This generator.
    • resource

      public XMLResourceGenerator resource(org.osgi.resource.Resource resource)
      Adds the specified resource to this generator.
      Parameters:
      resource - The resource to add.
      Returns:
      This generator.
    • indent

      public XMLResourceGenerator indent(int n)
      Sets the indentation level for the generated XML document.
      Parameters:
      n - The number of spaces for each indentation level.
      Returns:
      This generator.
    • compress

      public XMLResourceGenerator compress()
      Enables compression for the generated XML document.
      Returns:
      This generator.
    • base

      public XMLResourceGenerator base(URI base)
      Parameters:
      base - the base URI from which the index urls are relative