org.apache.sling.maven.bundlesupport
Class BundleDeployMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.sling.maven.bundlesupport.BundleDeployMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

public class BundleDeployMojo
extends org.apache.maven.plugin.AbstractMojo

Deploy a JAR representing an OSGi Bundle. This method posts the bundle built by maven to an OSGi Bundle Repository accepting the bundle. The plugin uses a multipart/format-data POST request to just post the file to the URL configured in the obr property.


Field Summary
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
BundleDeployMojo()
           
 
Method Summary
protected  java.io.File changeVersion(java.io.File file, java.lang.String oldVersion, java.lang.String newVersion)
          Change the version in jar
 void execute()
          Execute this Mojo
protected  java.io.File fixBundleVersion(java.io.File jarFile)
          Optionally fixes up the version of the bundle given in the jar File.
protected  java.lang.String getBundleSymbolicName(java.io.File jarFile)
          Returns the symbolic name of the given bundle.
protected  java.lang.String getJarFileName()
          Returns the path and name of the jar file containing the bundle to be uploaded.
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BundleDeployMojo

public BundleDeployMojo()
Method Detail

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException
Execute this Mojo

Specified by:
execute in interface org.apache.maven.plugin.Mojo
Throws:
org.apache.maven.plugin.MojoExecutionException

getJarFileName

protected java.lang.String getJarFileName()
Returns the path and name of the jar file containing the bundle to be uploaded. This method always returns a non-null name but throws a MojoExecutionException if the name is not known.

Returns:
The name of the file to be uploaded, this is never null.

fixBundleVersion

protected java.io.File fixBundleVersion(java.io.File jarFile)
                                 throws org.apache.maven.plugin.MojoExecutionException
Optionally fixes up the version of the bundle given in the jar File. If no version fixup is required the jarFile may just be returned.

Parameters:
jarFile - The file whose bundle version should be fixed
Returns:
The file containing the fixed version or jarFile if the version was not fixed.
Throws:
org.apache.maven.plugin.MojoExecutionException - May be thrown in case of any problems

changeVersion

protected java.io.File changeVersion(java.io.File file,
                                     java.lang.String oldVersion,
                                     java.lang.String newVersion)
                              throws org.apache.maven.plugin.MojoExecutionException
Change the version in jar

Parameters:
newVersion -
file -
Returns:
Throws:
org.apache.maven.plugin.MojoExecutionException

getBundleSymbolicName

protected java.lang.String getBundleSymbolicName(java.io.File jarFile)
Returns the symbolic name of the given bundle. If the jarFile does not contain a manifest with a Bundle-SymbolicName header null is returned. Otherwise the value of the Bundle-SymbolicName header is returned.

This method may also be used to check whether the file is a bundle at all as it is assumed, that only if the file contains an OSGi bundle will the Bundle-SymbolicName manifest header be set.

Parameters:
jarFile - The file providing the bundle whose symbolic name is requested.
Returns:
The bundle's symbolic name from the Bundle-SymbolicName manifest header or null if no manifest exists in the file or the header is not contained in the manifest. However, if null is returned, the file may be assumed to not contain an OSGi bundle.


Copyright © 2007-2009. All Rights Reserved.