com.springsource.bundlor.internal.transformer
Class PartialManifestResolver

java.lang.Object
  extended by com.springsource.bundlor.internal.transformer.PartialManifestResolver
All Implemented Interfaces:
TemplateHeaderReader

final class PartialManifestResolver
extends java.lang.Object
implements TemplateHeaderReader

Resolves a StandardReadablePartialManifest against the ManifestContents template, creating a BundleManifest with valid OSGi Import-Package and Export-Package headers.

Author:
Rob Harrop

Field Summary
private static java.lang.String ATTR_BUNDLE_VERSION
           
private static java.lang.String ATTR_EXPORT_TEMPLATE
           
private static java.lang.String ATTR_IMPORT_TEMPLATE
           
 
Constructor Summary
PartialManifestResolver()
           
 
Method Summary
private  void addCommaSeparated(java.util.Collection<java.lang.String> target, java.lang.String value)
          Parses value as a comma-separated value and adds all elements to the supplied Collection.
private  com.springsource.util.osgi.manifest.parse.HeaderDeclaration findMostSpecificDeclaration(java.util.List<com.springsource.util.osgi.manifest.parse.HeaderDeclaration> declarations, java.lang.String packageName)
           
 java.util.List<java.lang.String> getTemplateOnlyHeaderNames()
          Gets the list of header names required by this reader.
private  com.springsource.util.osgi.manifest.Resolution parseResolution(com.springsource.util.osgi.manifest.parse.HeaderDeclaration declaration)
          Parses the resolution directive for the supplied header.
private  java.util.List<com.springsource.util.osgi.manifest.parse.HeaderDeclaration> parseTemplate(java.lang.String template)
           
private  void processExports(com.springsource.util.osgi.manifest.BundleManifest result, com.springsource.util.parser.manifest.ManifestContents templateManifest, ReadablePartialManifest partial)
          Resolves the exports.
private  void processImports(com.springsource.util.osgi.manifest.BundleManifest result, com.springsource.util.parser.manifest.ManifestContents template, ReadablePartialManifest partial)
          Resolves the imports.
 com.springsource.util.osgi.manifest.BundleManifest resolve(com.springsource.util.parser.manifest.ManifestContents templateManifest, ReadablePartialManifest partial)
          Resolves the supplied StandardReadablePartialManifest against the supplied manifest template.
private  java.lang.String resolveVersion(com.springsource.util.osgi.manifest.parse.HeaderDeclaration declaration, java.lang.String defaultVersion)
          Resolves the version for supplied HeaderDeclaration, returning defaultVersion if none is specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR_BUNDLE_VERSION

private static final java.lang.String ATTR_BUNDLE_VERSION
See Also:
Constant Field Values

ATTR_EXPORT_TEMPLATE

private static final java.lang.String ATTR_EXPORT_TEMPLATE
See Also:
Constant Field Values

ATTR_IMPORT_TEMPLATE

private static final java.lang.String ATTR_IMPORT_TEMPLATE
See Also:
Constant Field Values
Constructor Detail

PartialManifestResolver

PartialManifestResolver()
Method Detail

getTemplateOnlyHeaderNames

public java.util.List<java.lang.String> getTemplateOnlyHeaderNames()
Description copied from interface: TemplateHeaderReader
Gets the list of header names required by this reader.

Specified by:
getTemplateOnlyHeaderNames in interface TemplateHeaderReader
Returns:
The list of header names.

resolve

public com.springsource.util.osgi.manifest.BundleManifest resolve(com.springsource.util.parser.manifest.ManifestContents templateManifest,
                                                                  ReadablePartialManifest partial)
Resolves the supplied StandardReadablePartialManifest against the supplied manifest template.

Parameters:
templateManifest - the template.
partial - the partial manifest.
Returns:
the resolved BundleManifest.

processExports

private void processExports(com.springsource.util.osgi.manifest.BundleManifest result,
                            com.springsource.util.parser.manifest.ManifestContents templateManifest,
                            ReadablePartialManifest partial)
Resolves the exports.


processImports

private void processImports(com.springsource.util.osgi.manifest.BundleManifest result,
                            com.springsource.util.parser.manifest.ManifestContents template,
                            ReadablePartialManifest partial)
Resolves the imports.


addCommaSeparated

private void addCommaSeparated(java.util.Collection<java.lang.String> target,
                               java.lang.String value)
Parses value as a comma-separated value and adds all elements to the supplied Collection.


findMostSpecificDeclaration

private com.springsource.util.osgi.manifest.parse.HeaderDeclaration findMostSpecificDeclaration(java.util.List<com.springsource.util.osgi.manifest.parse.HeaderDeclaration> declarations,
                                                                                                java.lang.String packageName)

resolveVersion

private java.lang.String resolveVersion(com.springsource.util.osgi.manifest.parse.HeaderDeclaration declaration,
                                        java.lang.String defaultVersion)
Resolves the version for supplied HeaderDeclaration, returning defaultVersion if none is specified.


parseResolution

private com.springsource.util.osgi.manifest.Resolution parseResolution(com.springsource.util.osgi.manifest.parse.HeaderDeclaration declaration)
Parses the resolution directive for the supplied header.


parseTemplate

private java.util.List<com.springsource.util.osgi.manifest.parse.HeaderDeclaration> parseTemplate(java.lang.String template)