org.knopflerfish.ant.taskdefs.bundle
public class BundlePackagesInfo extends java.lang.Object
Class and package names should use either '/' or '.' as separator
between package levels during build up phase. When all classes
packages have been added, make a call to toJavaNames() to
convert all class / packages names using the internal Java
representation with '/' as separator to their non-internal
representation with '.' as separator.
Mixing of separator kinds is not supported!
When all classes have been added, before using the package using
map a call to postProcessUsingMap(Set,Set) should be done.
| Constructor and Description |
|---|
BundlePackagesInfo(org.apache.tools.ant.Task task) |
| Modifier and Type | Method and Description |
|---|---|
void |
addProvidedActivatorClass(java.lang.String className)
Adds a named class to the set of classes that implements the
interface
BundleActivator. |
java.lang.String |
addProvidedClass(java.lang.String className)
Adds a named class to the set of classes provided by this
bundle.
|
void |
addProvidedPackage(java.lang.String packageName)
Adds a named package to the set of packages provided by this
bundle.
|
void |
addReferencedClass(java.lang.String referencingPackage,
java.lang.String referencedClass)
Add a reference to a named class from some class in the
referencing Java package.
|
int |
countProvidedActivatorClasses()
Gets the cardinality of the set of provided bundle activator
classes.
|
int |
countProvidedPackages()
Gets the cardinality of the set of provided Java packages.
|
boolean |
equals(java.lang.Object other) |
java.lang.String |
getActivatorClass()
Get the bundle activator from the set of provided bundle
activator classes.
|
java.util.SortedSet<java.lang.String> |
getPackagesReferencedFromPackage(java.lang.String packageName)
Get a the set of Java packages that are referenced by the
given Java package.
|
java.util.SortedSet<java.lang.String> |
getProvidedPackages()
Get a copy of the set of provided Java packages.
|
java.lang.String |
getProvidedPackagesAsExportPackageValue()
Get the provided packages formatted as the value of an
Export-Package-manifest attribute with package versions.
|
Version |
getProvidedPackageVersion(java.lang.String pkgName)
Get the version of a provided package as defined by the
packageinfo-file in the package-directory. |
java.lang.String |
getProvidedPackageVersionSource(java.lang.String pkgName)
Get the path of the file that the version of a provided package
was found in.
|
java.util.SortedSet<java.lang.String> |
getReferencedClasses()
Get a copy of the set of referenced Java classes.
|
java.util.SortedSet<java.lang.String> |
getReferencedPackages()
Get a copy of the set of Java packages that are referenced by
this bundle.
|
java.util.SortedSet<java.lang.String> |
getUnprovidedReferencedPackages()
Get a the set of Java packages that are referenced by this bundle
but not provided by it.
|
static java.lang.String |
packageName(java.lang.String className)
Get package name of class string representation.
|
void |
postProcessUsingMap(java.util.Set<java.lang.String> removeFromReferencedSets,
java.util.Set<java.lang.String> retainInReferencedSets)
Post process the package to referenced packages map.
|
java.lang.String |
providedActivatorClassesAsString()
Return the set of provided activator classes as string suitable
for use in messages.
|
boolean |
providesActivatorClass(java.lang.String className)
Checks if a named class is in the set of provided activator classes.
|
boolean |
providesClass(java.lang.String className)
Checks if a named class is provided by this bundle.
|
boolean |
providesPackage(java.lang.String packageName)
Checks if a named Java package is provided by this bundle.
|
java.lang.String |
setPackageVersion(org.apache.tools.ant.types.Resource res)
Try to assign a version to the Java that the given
packageinfo-file resides in. |
void |
toJavaNames()
Replaces all '/' in class and package names with '.' in all the
collections that this class is holding.
|
java.lang.String |
toString() |
public static java.lang.String packageName(java.lang.String className)
className - A fully qualified class name.public java.lang.String addProvidedClass(java.lang.String className)
className - the name of the class to add.public boolean providesClass(java.lang.String className)
className - the name of the class to check for.true if the given class is in the set of
classes provided by this bundle, false
otherwise.public void addProvidedActivatorClass(java.lang.String className)
BundleActivator.className - the name of the activator class to add.public int countProvidedActivatorClasses()
public boolean providesActivatorClass(java.lang.String className)
className - the name of the activator class to check for.true if the given class is in the set of
provided activator classes, false otherwise.public java.lang.String providedActivatorClassesAsString()
public java.lang.String getActivatorClass()
null.public void addProvidedPackage(java.lang.String packageName)
packageName - the name of the Java package to add.public boolean providesPackage(java.lang.String packageName)
packageName - the name of the package to check for.true if the given package is in the set of
packages provided by this bundle, false
otherwise.public java.util.SortedSet<java.lang.String> getProvidedPackages()
toJavaNames().public java.lang.String getProvidedPackagesAsExportPackageValue()
public int countProvidedPackages()
public Version getProvidedPackageVersion(java.lang.String pkgName)
packageinfo-file in the package-directory.pkgName - The package to get the version of.public java.lang.String getProvidedPackageVersionSource(java.lang.String pkgName)
pkgName - The version-ed package to get the version source of.packageinfo-file that the
version was read from.public java.lang.String setPackageVersion(org.apache.tools.ant.types.Resource res)
packageinfo-file resides in. This code assumes that
the resource has been created in such a way that
res.getName() returns a relative path to the
packageinfo-file that starts in its package
root. I.e., the path is the Java package that the
packageinfo-file provides data for.res - Resource encapsulating a packageinfo-file.null if no valid version was
found.public java.util.SortedSet<java.lang.String> getReferencedClasses()
public java.util.SortedSet<java.lang.String> getUnprovidedReferencedPackages()
public java.util.SortedSet<java.lang.String> getReferencedPackages()
public void addReferencedClass(java.lang.String referencingPackage,
java.lang.String referencedClass)
referencingPackage - The Java package of the class having a
reference to className.referencedClass - Fully qualified name of the referenced
class.public void postProcessUsingMap(java.util.Set<java.lang.String> removeFromReferencedSets,
java.util.Set<java.lang.String> retainInReferencedSets)
removeFromReferencedSets - Packages to removeretainInReferencedSets - Packages to retain.public java.util.SortedSet<java.lang.String> getPackagesReferencedFromPackage(java.lang.String packageName)
packageName - The name of the Java package to get
referenced Java packages for.public void toJavaNames()
public boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object