Knopflerfish OSGi 5.2.0

org.knopflerfish.ant.taskdefs.bundle
Class BundleClasspathTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.knopflerfish.ant.taskdefs.bundle.BundleClasspathTask
All Implemented Interfaces:
java.lang.Cloneable

public class BundleClasspathTask
extends org.apache.tools.ant.Task

Task that translates the value of the OSGi specified manifest header Bundle-Classpath into either a file set or pattern suitable for use as the includes attribute in a file set that will find all classes and jars that the framework may use given the specified Bundle-Classpath manifest attribute.

This task may also be used as a nested element in the bundle info task. In that case it will be used to generate a list of file sets, one for each entry in the given bundle classpath. If the excludes attribute is given the file sets will use that as exclude pattern otherwise the includes attribute is used as includes pattern. If the bundle classpath entry is a jar-file then a ZipFileSet will be created for it with the jar-file as source and the excludes (or includes) attribute as excludes (includes) pattern.

Parameters

Attribute Description Required
BundleClasspath The bundle class path to convert into an includes pattern.

If unset, set to empty string, or set to the special empty value [bundle.emptystring] the default bundle classpath, "." will be used.

Note: The current value of this property will be overwritten by the derived pattern.

No.
Default value is "."
propertyName Name of property that will receive the resulting pattern. Yes.
No default value.
dir The directory to use as root directory in the created fileset. Yes.
No default value.
filesetId Id of a file set with include patterns based on the given BundleClasspath and base directory given by dir. If dir is not given or non-existing then an empty file set is created. No.
No default value.
includes Includes pattern to apply to each file set created from the entries in the bundle classpath when building a list of file sets. At least one of includes and excludes must be given when building a list of file sets from the bundle classpath.
No default value.
excludes Excludes pattern to apply to each file set created from the entires in the bundle classpath when building a list of file sets. Note: This attribute is only used when the <bundleclasspath> is used as a nested element inside a <bundleinfo> element. At least one of includes and excludes must be given when building a list of file sets from the bundle classpath.
No default value.

Examples

The table below shows how different bundle class path entries are translated int patterns.
EntryPattern
.**/*.class
rxtxrxtx/**/*.class
/rxtxrxtx/**/*.class
required.jarrequired.jar
xx/required.jarxx/required.jar
/xx/required.jarxx/required.jar


Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
BundleClasspathTask()
           
 
Method Summary
 void execute()
           
 java.util.List<org.apache.tools.ant.types.FileSet> getFileSets(boolean failOnClassPath)
          Get a collection of file sets selecting all classes in the bundle class path that matches the given pattern.
 void setBundleClasspath(java.lang.String s)
          Set bundle class path to create a pattern for.
 void setDir(java.io.File f)
          Set property receiving the file set root directory.
 void setExcludes(java.lang.String s)
          Set the excludes pattern to use in the collection of file sets returned by getFileSets(boolean).
 void setFilesetId(java.lang.String s)
          Set property receiving the file set id.
 void setIncludes(java.lang.String s)
          Set the includes pattern to use in the collection of file sets returned by getFileSets(boolean).
 void setPropertyName(java.lang.String s)
          Set property receiving the bundle class path pattern.
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BundleClasspathTask

public BundleClasspathTask()
Method Detail

setBundleClasspath

public void setBundleClasspath(java.lang.String s)
Set bundle class path to create a pattern for.


setPropertyName

public void setPropertyName(java.lang.String s)
Set property receiving the bundle class path pattern.


setDir

public void setDir(java.io.File f)
Set property receiving the file set root directory.


setFilesetId

public void setFilesetId(java.lang.String s)
Set property receiving the file set id.


setIncludes

public void setIncludes(java.lang.String s)
Set the includes pattern to use in the collection of file sets returned by getFileSets(boolean).


setExcludes

public void setExcludes(java.lang.String s)
Set the excludes pattern to use in the collection of file sets returned by getFileSets(boolean).


getFileSets

public java.util.List<org.apache.tools.ant.types.FileSet> getFileSets(boolean failOnClassPath)
Get a collection of file sets selecting all classes in the bundle class path that matches the given pattern.

Returns:
A list with file sets, one file set for each entry on the bundle class path. If the entry is for a Jar/Zip file then its list item will be a zip file set.

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Overrides:
execute in class org.apache.tools.ant.Task
Throws:
org.apache.tools.ant.BuildException

Knopflerfish OSGi 5.2.0