Interface IBundleProjectService


  • public interface IBundleProjectService
    Service used to create and configure bundle project descriptions.

    An instance of this service can be obtained from a BundleContext as follows

     BundleContext context = ...
     ServiceReference ref = context.getServiceReference(IBundleContextService.class);
     IBundleContextService service = context.getService(ref);
     ...
     context.ungetService(ref);
     

    Since:
    3.6
    Restriction:
    This interface is not intended to be implemented by clients.
    Restriction:
    This interface is not intended to be extended by clients.
    • Method Detail

      • getDescription

        IBundleProjectDescription getDescription​(IProject project)
                                          throws CoreException
        Returns a bundle description for the given project. If the project does not exist, the description can be used to create a new bundle project. If the project does exist, the description can be used to modify a project.
        Parameters:
        project - project
        Returns:
        bundle description for the associated project
        Throws:
        CoreException - if unable to create a description on an existing project
      • newHost

        IHostDescription newHost​(String name,
                                 VersionRange range)
        Creates and returns a new host description.
        Parameters:
        name - symbolic name of the host
        range - version constraint or null
        Returns:
        host description
      • newPackageImport

        IPackageImportDescription newPackageImport​(String name,
                                                   VersionRange range,
                                                   boolean optional)
        Creates and returns a new package import description.
        Parameters:
        name - fully qualified name of imported package
        range - version constraint or null
        optional - whether the import is optional
        Returns:
        package import description
      • newPackageExport

        IPackageExportDescription newPackageExport​(String name,
                                                   Version version,
                                                   boolean api,
                                                   String[] friends)
        Constructs a new package export description.
        Parameters:
        name - fully qualified package name
        version - version or null
        api - whether the package is considered API
        friends - symbolic names of bundles that are friends, or null; when friends are specified the package will not be API
        Returns:
        package export description
      • newRequiredBundle

        IRequiredBundleDescription newRequiredBundle​(String name,
                                                     VersionRange range,
                                                     boolean optional,
                                                     boolean export)
        Creates and returns a new required bundle description.
        Parameters:
        name - symbolic name of required bundle
        range - version constraint or null
        optional - whether the required bundle is optional
        export - whether the required bundle is re-exported
        Returns:
        required bundle description
      • newBundleClasspathEntry

        IBundleClasspathEntry newBundleClasspathEntry​(IPath sourceFolder,
                                                      IPath binaryFolder,
                                                      IPath library)
        Creates and returns a new bundle classpath entry defining the relationship between a source, binaries, and library on the Bundle-Classpath header.

        When a source folder is specified, the binary folder defines its output folder, or may be null to indicate that the project's default output folder is used by the source folder. When only a binary folder is specified, there is no source associated with the folder. When no source or binary are specified, it indicates the library is included in the project as an archive.

        Parameters:
        sourceFolder - source folder or null
        binaryFolder - binary folder or null
        library - associated entry on the Bundle-Classpath header or null to indicate default entry "."
        Returns:
        a new bundle classpath entry
      • setBundleRoot

        void setBundleRoot​(IProject project,
                           IPath bundleRoot)
                    throws CoreException
        Sets the location within the project where the root of the bundle and its associated artifacts will reside, or null to indicate the default bundle root location should be used (project folder).

        The bundle root is the folder containing the META-INF/ folder. When the bundle root location is modified, existing bundle artifacts at the old root are not moved or modified. When creating a new bundle project IBundleProjectDescription.setBundleRoot(IPath) can be used to specify an initial bundle root location. To modify the bundle root location of an existing project, this method must be used.

        Parameters:
        project - project that must exist and be open
        bundleRoot - project relative path to bundle root artifacts in the project or null
        Throws:
        CoreException - if setting the root fails