• Intro Headers Instructions Macros Commands
Fork me on GitHub
    • Getting Started
      • Introduction
      • How to install bnd
      • Guided Tour Workspace & Projects
      • bnd / bndlib Features and JAR Wrapping Techniques
      • FAQ - Frequently Asked Questions
    • Concepts and Practices
      • Concepts
      • Background
      • Best practices
    • Build and Development
      • Build
      • Generating JARs
      • Versioning
      • Baselining
      • Service Components
      • Metatype
      • Contracts
      • Bundle Annotations
      • Accessor Properties
      • SPI Annotations
    • Dependency and Launching
      • Resolving Dependencies
      • Launching
      • Startlevels
    • Testing
      • Testing
      • Testing with Launchpad
    • Packaging and Distribution
      • Packaging Applications
      • JPMS Libraries
      • Wrapping Libraries to OSGi Bundles
    • Documentation and Tools
      • Generating Documentation
      • bnd CLI Commands
      • For Developers
      • Templates for Workspaces
      • Tips for Windows users
      • Tools bound to bnd
    • Reference Material
      • Reference
      • Headers
      • Instruction Reference
      • Instruction Index
      • Macro Reference
      • Macro Index
      • Plugins
      • External Plugins
    • Configuration and Troubleshooting
      • Settings
      • Errors
      • Warnings
  • Bundle-SymbolicName ::= symbolic-name ( ';' parameter ) *

    Prev Next
    Header
    The Bundle-SymbolicName header specifies a non-localizable name for this bundle. The bundle symbolic name together with a version must identify a unique bundle though it can be installed multiple times in a framework. The bundle symbolic name should be based on the reverse domain name convention, s

    • Example: Bundle-SymbolicName: com.acme.foo.daffy;singleton:=true

    • Values: ${p}

    • Pattern: [-\w]+(:?\.[-\w]+)*

    Options

    • singleton: Indicates that the bundle can only have a single version resolved. A value of true indicates that the bundle is a singleton bundle. The default value is false. The Framework must resolve at most one bundle when multiple versions of a singleton bundle with the same symbolic name are installed. Singleton bundles do not affect the resolution of non-singleton bundles with the same symbolic name.
      • Example: singleton:=false

      • Values: true,false

      • Pattern: true|false|TRUE|FALSE

    • fragment-attachment: Defines how fragments are allowed to be attached, see the fragments in Fragment Bundles on page 73. The following values are valid for this directive:
      • Example: ``

      • Values: always|never|resolve-time

      • Pattern: always|never|resolve-time

    • blueprint.wait-for-dependencies
      • Example: ``

      • Values: true,false

      • Pattern: true|false|TRUE|FALSE

    • blueprint.timeout
      • Example: ``

      • Values: 30000,60000,300000

      • Pattern: \d+



    Bundle-SymbolicName

    The Bundle-SymbolicName header specifies a unique, non-localizable name for the bundle. This name, together with the version, must uniquely identify a bundle, even if it is installed multiple times in a framework. The symbolic name should follow the reverse domain name convention (e.g., com.example.mybundle).

    If not set, bnd will use the name of the main bnd file or, if the file is called bnd.bnd, the name of its directory. The ${project} variable can also be used to set this value.

    Example:

    Bundle-SymbolicName: com.example.mybundle
    

    This header is required for all OSGi bundles.

    The Bundle-SymbolicName header can be set by the user. The default is the name of the main bnd file, or if the main bnd file is called bnd.bnd, it will be the name of the directory of the bnd file. An interesting variable is ${project} that will be set to this default name.

    		private void verifySymbolicName() {
    	Parameters bsn = parseHeader(main.get(Analyzer.BUNDLE_SYMBOLICNAME));
    	if (!bsn.isEmpty()) {
    		if (bsn.size() > 1)
    			error("More than one BSN specified " + bsn);
    
    		String name = bsn.keySet().iterator().next();
    		if (!isBsn(name)) {
    			error("Symbolic Name has invalid format: " + name);
    		}
    	}
    }
    	
    		/**
     * @param name
     * @return
     */
    public static boolean isBsn(String name) {
    	return SYMBOLICNAME.matcher(name).matches();
    }
    
    	
    public final static String	SYMBOLICNAME_STRING				= "[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)*";
    

    TODO Needs review - AI Generated content

Prev Next
Search
    • Home