org.eclipse.core.runtime.internal.adaptor
Class PluginConverterImpl

java.lang.Object
  extended by org.eclipse.core.runtime.internal.adaptor.PluginConverterImpl
All Implemented Interfaces:
PluginConverter

public class PluginConverterImpl
extends java.lang.Object
implements PluginConverter

Internal class.


Field Summary
static boolean DEBUG
           
static java.lang.String FRAGMENT_MANIFEST
           
static java.lang.String GENERATED_FROM
           
static java.lang.String MANIFEST_TYPE_ATTRIBUTE
           
static byte MANIFEST_TYPE_BUNDLE
          bundle manifest type bundle (META-INF/MANIFEST.MF)
static byte MANIFEST_TYPE_FRAGMENT
          bundle manifest type fragment (fragment.xml)
static byte MANIFEST_TYPE_JAR
          bundle manifest type jared bundle
static byte MANIFEST_TYPE_PLUGIN
          bundle manifest type plugin (plugin.xml)
static byte MANIFEST_TYPE_UNKNOWN
          bundle manifest type unknown
protected static java.lang.String PI_BOOT
           
protected static java.lang.String PI_RUNTIME
           
protected static java.lang.String PI_RUNTIME_COMPATIBILITY
           
static java.lang.String PLUGIN_MANIFEST
           
 
Constructor Summary
PluginConverterImpl(FrameworkAdaptor adaptor, BundleContext context)
           
 
Method Summary
 java.util.Dictionary convertManifest(java.io.File pluginBaseLocation, boolean compatibility, java.lang.String target, boolean analyseJars, java.util.Dictionary devProperties)
          Converts a plug-in/fragment manifest at the given source base location (a directory) and generates a corresponding bundle manifest returned as a dictionary.
 java.io.File convertManifest(java.io.File pluginBaseLocation, java.io.File bundleManifestLocation, boolean compatibilityManifest, java.lang.String target, boolean analyseJars, java.util.Dictionary devProperties)
          Converts a plug-in/fragment manifest at the given source base location (a directory) and generates a corresponding bundle manifest at the given default target locaton (a file).
protected  void fillManifest(boolean compatibilityManifest, boolean analyseJars)
           
static PluginConverterImpl getDefault()
           
static long getTimeStamp(java.io.File pluginLocation, byte manifestType)
           
static boolean upToDate(java.io.File generationLocation, java.io.File pluginLocation, byte manifestType)
           
 void writeManifest(java.io.File generationLocation, java.util.Dictionary manifestToWrite, boolean compatibilityManifest)
          Construct a bundle manifest file from the given dictionary and write it out to the specified location in the file system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG

MANIFEST_TYPE_UNKNOWN

public static final byte MANIFEST_TYPE_UNKNOWN
bundle manifest type unknown

See Also:
Constant Field Values

MANIFEST_TYPE_BUNDLE

public static final byte MANIFEST_TYPE_BUNDLE
bundle manifest type bundle (META-INF/MANIFEST.MF)

See Also:
Constant Field Values

MANIFEST_TYPE_PLUGIN

public static final byte MANIFEST_TYPE_PLUGIN
bundle manifest type plugin (plugin.xml)

See Also:
Constant Field Values

MANIFEST_TYPE_FRAGMENT

public static final byte MANIFEST_TYPE_FRAGMENT
bundle manifest type fragment (fragment.xml)

See Also:
Constant Field Values

MANIFEST_TYPE_JAR

public static final byte MANIFEST_TYPE_JAR
bundle manifest type jared bundle

See Also:
Constant Field Values

FRAGMENT_MANIFEST

public static final java.lang.String FRAGMENT_MANIFEST
See Also:
Constant Field Values

GENERATED_FROM

public static final java.lang.String GENERATED_FROM
See Also:
Constant Field Values

MANIFEST_TYPE_ATTRIBUTE

public static final java.lang.String MANIFEST_TYPE_ATTRIBUTE
See Also:
Constant Field Values

PI_RUNTIME

protected static final java.lang.String PI_RUNTIME
See Also:
Constant Field Values

PI_BOOT

protected static final java.lang.String PI_BOOT
See Also:
Constant Field Values

PI_RUNTIME_COMPATIBILITY

protected static final java.lang.String PI_RUNTIME_COMPATIBILITY
See Also:
Constant Field Values

PLUGIN_MANIFEST

public static final java.lang.String PLUGIN_MANIFEST
See Also:
Constant Field Values
Constructor Detail

PluginConverterImpl

public PluginConverterImpl(FrameworkAdaptor adaptor,
                           BundleContext context)
Method Detail

getDefault

public static PluginConverterImpl getDefault()

fillManifest

protected void fillManifest(boolean compatibilityManifest,
                            boolean analyseJars)

writeManifest

public void writeManifest(java.io.File generationLocation,
                          java.util.Dictionary manifestToWrite,
                          boolean compatibilityManifest)
                   throws PluginConversionException
Description copied from interface: PluginConverter
Construct a bundle manifest file from the given dictionary and write it out to the specified location in the file system.

If the compatibilityManifest parameter is true then the generated manifest will include the necessary headers to all the manifest to be run in backwards compatibility mode.

Specified by:
writeManifest in interface PluginConverter
Parameters:
generationLocation - the location for the bundle manifest to be written
manifestToWrite - the dictionary to write into generationLocation file
compatibilityManifest - a boolean indicating if the file should contain headers to allow running in backward compatibility mode
Throws:
PluginConversionException - if an error occurs while writing the given manifest

upToDate

public static boolean upToDate(java.io.File generationLocation,
                               java.io.File pluginLocation,
                               byte manifestType)

getTimeStamp

public static long getTimeStamp(java.io.File pluginLocation,
                                byte manifestType)

convertManifest

public java.util.Dictionary convertManifest(java.io.File pluginBaseLocation,
                                            boolean compatibility,
                                            java.lang.String target,
                                            boolean analyseJars,
                                            java.util.Dictionary devProperties)
                                     throws PluginConversionException
Description copied from interface: PluginConverter
Converts a plug-in/fragment manifest at the given source base location (a directory) and generates a corresponding bundle manifest returned as a dictionary.

Specified by:
convertManifest in interface PluginConverter
Parameters:
pluginBaseLocation - the base location for the plug-in/fragment manifest to be converted (a directory, e.g. the plug-in install location)
compatibility - a boolean indicating if the manifest should contain headers to run in backward compatibility
target - a string indicating the version of the runtime for which the manifest generated is targeted
analyseJars - a boolean indicating if the code jars of the given plugin must be analysed. When set to false the Export-Package header will not be set in the bundle manifest.
devProperties - a dictionary of development time classpath properties. The dictionary contains a mapping from plugin id to development time classpath. A value of null indicates that the default development time classpath properties will be used.
Returns:
the generated manifest as a dictionary, if a bundle manifest was successfully generated, null otherwise
Throws:
PluginConversionException - if an error occurs while converting the manifest

convertManifest

public java.io.File convertManifest(java.io.File pluginBaseLocation,
                                    java.io.File bundleManifestLocation,
                                    boolean compatibilityManifest,
                                    java.lang.String target,
                                    boolean analyseJars,
                                    java.util.Dictionary devProperties)
                             throws PluginConversionException
Description copied from interface: PluginConverter
Converts a plug-in/fragment manifest at the given source base location (a directory) and generates a corresponding bundle manifest at the given default target locaton (a file).

Specified by:
convertManifest in interface PluginConverter
Parameters:
pluginBaseLocation - the base location for the plug-in/fragment manifest to be converted (a directory, e.g. the plug-in install location)
bundleManifestLocation - the location for the bundle manifest to be generated (including the file name).
compatibilityManifest - a boolean indicating if the manifest should contain headers to run in backward compatibility
target - a string indicating the version of the runtime for which the manifest generated is targeted
analyseJars - a boolean indicating if the code jars of the given plugin must be analysed. When set to false the Export-Package header will not be set in the bundle manifest.
devProperties - a dictionary of development time classpath properties. The dictionary contains a mapping from plugin id to development time classpath. A value of null indicates that the default development time classpath properties will be used.
Returns:
the generated manifest file location, if a bundle manifest was successfully generated (or already existed), null otherwise.
Throws:
PluginConversionException - if an error occurs while converting the manifest