com.springsource.bundlor
Interface BundleTransformer

All Known Implementing Classes:
StandardBundleTransformer

public interface BundleTransformer

Main entry point for manifest generation and transformation, detecting class path dependencies and automatically inserting imports and exports. Enables creation of manifests and also transformation of JAR files.

Clients provide a template manifest that is used to determine through pattern matching and various other directives which headers to include from the original manifest (if there is one), and what directives to add to new manifest.

Three basic operations are provided: merge, transform (for which the output is a JAR file) and generateManifest (for which the output is a manifest). The difference between a merge and a transform is related only to directives on imports and exports (like resolution:=optional): a merge always keeps existing directives that do not conflict with the template; a transform removes existing directives and replaces them in imports and exports that are automatically generated.

Concurrent Semantics
Implementations must be threadsafe.

Author:
Rob Harrop, Andy Wilkinson, Christian Dupuis, Dave Syer, Ben Hale

Method Summary
 com.springsource.util.osgi.manifest.BundleManifest generateManifest(com.springsource.util.parser.manifest.ManifestContents existingManifest, com.springsource.util.parser.manifest.ManifestContents manifestTemplate, java.lang.String... classPaths)
          Generates the BundleManifest for classes on the file system using the supplied manifest template
 com.springsource.util.osgi.manifest.BundleManifest generateManifest(java.lang.String inputPath, com.springsource.util.parser.manifest.ManifestContents manifestTemplate)
          Generates the BundleManifest for a JAR using the supplied manifest template
 Result merge(java.lang.String inputPath, com.springsource.util.parser.manifest.ManifestContents templateManifest, java.lang.String outputPath)
          Transforms a JAR, merging its existing manifest with the manifest generated using the supplied manifest template
 com.springsource.util.osgi.manifest.BundleManifest mergeManifest(java.lang.String inputPath, com.springsource.util.parser.manifest.ManifestContents manifestTemplate)
          Generates the BundleManifest for a JAR, merging its existing manifest with the manifest generated using the supplied manifest template
 Result transform(java.lang.String inputPath, com.springsource.util.parser.manifest.ManifestContents templateManifest, java.lang.String outputPath)
          Transforms a JAR, adding in the manifest generated using the supplied manifest template
 

Method Detail

generateManifest

com.springsource.util.osgi.manifest.BundleManifest generateManifest(java.lang.String inputPath,
                                                                    com.springsource.util.parser.manifest.ManifestContents manifestTemplate)
Generates the BundleManifest for a JAR using the supplied manifest template

Parameters:
inputPath - the path to the input JAR
manifestTemplate - the manifest template
Returns:
the resulting BundleManifest

generateManifest

com.springsource.util.osgi.manifest.BundleManifest generateManifest(com.springsource.util.parser.manifest.ManifestContents existingManifest,
                                                                    com.springsource.util.parser.manifest.ManifestContents manifestTemplate,
                                                                    java.lang.String... classPaths)
Generates the BundleManifest for classes on the file system using the supplied manifest template

Parameters:
existingManifest - the existing manifest
manifestTemplate - the manifest template
classPaths - the paths to all class folders to scan for inclusion in scanning
Returns:
the resulting BundleManifest

mergeManifest

com.springsource.util.osgi.manifest.BundleManifest mergeManifest(java.lang.String inputPath,
                                                                 com.springsource.util.parser.manifest.ManifestContents manifestTemplate)
Generates the BundleManifest for a JAR, merging its existing manifest with the manifest generated using the supplied manifest template

Parameters:
inputPath - the path to the input JAR
manifestTemplate - the manifest template
Returns:
the resulting BundleManifest

transform

Result transform(java.lang.String inputPath,
                 com.springsource.util.parser.manifest.ManifestContents templateManifest,
                 java.lang.String outputPath)
Transforms a JAR, adding in the manifest generated using the supplied manifest template

Parameters:
inputPath - the path to the input JAR
templateManifest - the manifest template
outputPath - the path to which the transformed JAR should be written
Returns:
the resulting bundle

merge

Result merge(java.lang.String inputPath,
             com.springsource.util.parser.manifest.ManifestContents templateManifest,
             java.lang.String outputPath)
Transforms a JAR, merging its existing manifest with the manifest generated using the supplied manifest template

Parameters:
inputPath - the path to the input JAR
templateManifest - the manifest template
outputPath - the path to which the transformed JAR should be written
Returns:
the resulting bundle