aQute.bnd.osgi
Class Builder

java.lang.Object
  extended by aQute.bnd.osgi.Domain
      extended by aQute.bnd.osgi.Processor
          extended by aQute.bnd.osgi.Analyzer
              extended by aQute.bnd.osgi.Builder
All Implemented Interfaces:
Constants, Registry, Report, Reporter, Closeable, Iterable<String>
Direct Known Subclasses:
ProjectBuilder

public class Builder
extends Analyzer

Include-Resource: ( [name '=' ] file )+ Private-Package: package-decl ( ',' package-decl )* Export-Package: package-decl ( ',' package-decl )* Import-Package: package-decl ( ',' package-decl )*

Version:
$Revision: 1.27 $

Nested Class Summary
 
Nested classes/interfaces inherited from class aQute.bnd.osgi.Processor
Processor.CL, Processor.FileLine
 
Nested classes/interfaces inherited from interface aQute.service.reporter.Reporter
Reporter.SetLocation
 
Nested classes/interfaces inherited from interface aQute.service.reporter.Report
Report.Location
 
Field Summary
 
Fields inherited from class aQute.bnd.osgi.Analyzer
msgs
 
Fields inherited from class aQute.bnd.osgi.Processor
LIST_SPLITTER
 
Fields inherited from interface aQute.bnd.osgi.Constants
BASELINE, BASELINEREPO, BLUEPRINT_TIMEOUT_ATTRIBUTE, BLUEPRINT_WAIT_FOR_DEPENDENCIES_ATTRIBUTE, BND_ADDXMLTOTEST, BND_LASTMODIFIED, BNDDRIVER, BNDDRIVER_ANT, BNDDRIVER_BND, BNDDRIVER_ECLIPSE, BNDDRIVER_GRADLE, BNDDRIVER_GRADLE_NATIVE, BNDDRIVER_INTELLIJ, BNDDRIVER_MAVEN, BNDDRIVER_OSMORC, BNDDRIVER_SBT, BUILDFILES, BUILDPACKAGES, BUILDPATH, BUMPPOLICY, BUNDLE_ACTIVATIONPOLICY, BUNDLE_ACTIVATOR, BUNDLE_BLUEPRINT, BUNDLE_CATEGORY, BUNDLE_CLASSPATH, BUNDLE_CONTACTADDRESS, BUNDLE_CONTRIBUTORS, BUNDLE_COPYRIGHT, BUNDLE_DESCRIPTION, BUNDLE_DEVELOPERS, BUNDLE_DOCURL, BUNDLE_ICON, BUNDLE_LICENSE, BUNDLE_LOCALIZATION, BUNDLE_MANIFESTVERSION, BUNDLE_NAME, BUNDLE_NATIVECODE, BUNDLE_REQUIREDEXECUTIONENVIRONMENT, BUNDLE_SPECIFIC_HEADERS, BUNDLE_SYMBOLIC_NAME_ATTRIBUTE, BUNDLE_SYMBOLICNAME, BUNDLE_UPDATELOCATION, BUNDLE_VENDOR, BUNDLE_VERSION, BUNDLE_VERSION_ATTRIBUTE, CACHEDIR, CLASSPATH, COMMAND_DIRECTIVE, COMPILER_SOURCE, COMPILER_TARGET, COMPONENT_ACTIVATE, COMPONENT_CONFIGURATION_POLICY, COMPONENT_DEACTIVATE, COMPONENT_DESCRIPTORS, COMPONENT_DESIGNATE, COMPONENT_DESIGNATEFACTORY, COMPONENT_DYNAMIC, COMPONENT_ENABLED, COMPONENT_FACTORY, COMPONENT_GREEDY, COMPONENT_IMMEDIATE, COMPONENT_IMPLEMENTATION, COMPONENT_MODIFIED, COMPONENT_MULTIPLE, COMPONENT_NAME, COMPONENT_NAMESPACE, COMPONENT_OPTIONAL, COMPONENT_PROPERTIES, COMPONENT_PROVIDE, COMPONENT_SERVICEFACTORY, COMPONENT_VERSION, componentDirectives, CONDITIONAL_PACKAGE, CONDITIONALPACKAGE, CONDUIT, CONSUMER_POLICY, CONTRACT, CREATED_BY, CURRENT_PACKAGE, CURRENT_USES, CURRENT_VERSION, DEBUG, DEFAULT_BAR_EXTENSION, DEFAULT_BND_EXTENSION, DEFAULT_BNDRUN_EXTENSION, DEFAULT_CHARSET, DEFAULT_DO_NOT_COPY, DEFAULT_JAR_EXTENSION, DEFAULT_LAUNCHER_BSN, DEFAULT_PREPROCESSS_MATCHERS, DEFAULT_PROP_BIN_DIR, DEFAULT_PROP_SRC_DIR, DEFAULT_PROP_TARGET_DIR, DEFAULT_PROP_TESTBIN_DIR, DEFAULT_PROP_TESTSRC_DIR, DEFAULT_TESTER_BSN, DEPENDSON, DEPLOY, DEPLOYREPO, DESCRIPTION_ATTRIBUTE, DIFFIGNORE, DIGESTS, directives, DONOTCOPY, DSANNOTATIONS, DUPLICATE_MARKER, DYNAMICIMPORT_PACKAGE, EEPROFILE, EEPROFILE_AUTO_ATTRIBUTE, EFFECTIVE_DIRECTIVE, EMBEDDED_REPO, EMPTY, EMPTY_HEADER, EXCLUDE_DIRECTIVE, EXPERIMENTS, EXPORT, EXPORT_CONTENTS, EXPORT_PACKAGE, EXPORT_SERVICE, EXTENSION, EXTENSION_DIRECTIVE, FAIL_OK, FILTER_DIRECTIVE, FIXUPMESSAGES, FIXUPMESSAGES_IS_DIRECTIVE, FIXUPMESSAGES_IS_ERROR, FIXUPMESSAGES_IS_IGNORE, FIXUPMESSAGES_IS_WARNING, FIXUPMESSAGES_REPLACE_DIRECTIVE, FIXUPMESSAGES_RESTRICT_DIRECTIVE, FRAGMENT_ATTACHMENT_DIRECTIVE, FRAGMENT_HOST, FROM_DIRECTIVE, GESTALT, GESTALT_BATCH, GESTALT_CI, GESTALT_INTERACTIVE, GESTALT_OFFLINE, GESTALT_SHELL, headers, IGNORE_PACKAGE, IMPORT_DIRECTIVE, IMPORT_PACKAGE, IMPORT_PRIVATE, IMPORT_REFERENCE, IMPORT_SERVICE, importDirectives, INCLUDE, INCLUDE_DIRECTIVE, INCLUDE_RESOURCE, INCLUDERESOURCE, INVALIDFILENAMES, JAVAAGENT, JIDENTIFIER, KEYSTORE_LOCATION_DIRECTIVE, KEYSTORE_PASSWORD_DIRECTIVE, KEYSTORE_PROVIDER_DIRECTIVE, LANGUAGE_ATTRIBUTE, LAUNCHER_PLUGIN, LIB_DIRECTIVE, LINK_ATTRIBUTE, LITERAL_ATTRIBUTE, MAKE, MANDATORY_DIRECTIVE, MANIFEST, MANIFEST_NAME, META_PERSISTENCE, METAPACKAGES, METATYPE, METATYPE_ANNOTATIONS, NAME_ATTRIBUTE, NAMESECTION, NAMESPACE_STEM, NO_IMPORT_DIRECTIVE, NOANNOTATIONS, NOBUILDINCACHE, NOBUNDLES, NODEFAULTVERSION, NOEE, NOEXTRAHEADERS, NOJUNIT, NOJUNITOSGI, NOMANIFEST, NONE, NOUSES, options, OSNAME_ATTRIBUTE, OSVERSION_ATTRIBUTE, OUTPUT, OUTPUTMASK, PACKAGE, PACKAGE_JPM, PATH_DIRECTIVE, PEDANTIC, PLUGIN, PLUGINPATH, PLUGINPATH_SHA1_ATTR, PLUGINPATH_URL_ATTR, POM, PREPROCESSMATCHERS, PRESENCE_DIRECTIVE, PRIVATE_DIRECTIVE, PRIVATE_PACKAGE, PRIVATEPACKAGE, PROCESSOR_ATTRIBUTE, PROFILE, PROVIDE_CAPABILITY, PROVIDE_DIRECTIVE, PROVIDER_POLICY, PROVIDER_TYPE_DIRECTIVE, RELEASEREPO, REMOVE_ATTRIBUTE_DIRECTIVE, REMOVEHEADERS, REPORTNEWER, REPOSITORIES, REQUIRE_BND, REQUIRE_BUNDLE, REQUIRE_CAPABILITY, RESOLUTION_DIRECTIVE, RESOLVE, RESOURCEONLY, RUNBLACKLIST, RUNBUILDS, RUNBUNDLES, RUNEE, RUNENV, RUNFRAMEWORK, RUNFRAMEWORK_NONE, RUNFRAMEWORK_SERVICES, RUNFW, RUNJDB, RUNNOREFERENCES, RUNPATH, RUNPATH_LAUNCHER_DIRECTIVE, RUNPATH_MAIN_DIRECTIVE, RUNPROGRAMARGS, RUNPROPERTIES, RUNREPOS, RUNREQUIRE, RUNREQUIRES, RUNSTORAGE, RUNSYSTEMCAPABILITIES, RUNSYSTEMPACKAGES, RUNTIMEOUT, RUNTRACE, RUNVM, SAVEMANIFEST, SELECTION_FILTER_ATTRIBUTE, SERVICE_COMPONENT, SET_COMPONENT_DIRECTIVES, SET_COMPONENT_DIRECTIVES_1_1, SET_COMPONENT_DIRECTIVES_1_2, SIGN, SIGN_PASSWORD_DIRECTIVE, SIGNATURE_TEST, SINGLETON_DIRECTIVE, SIZE_ATTRIBUTE, SNAPSHOT, SOURCEPATH, SOURCES, SPECIFICATION_VERSION, SPLIT_PACKAGE_DIRECTIVE, STRICT, SUB, SYSTEMPROPERTIES, TESTCASES, TESTCONTINUOUS, TESTER_PLUGIN, TESTPACKAGES, TESTPATH, TESTREPORT, TESTSOURCES, TESTSUITES, TESTUNRESOLVED, TOOL, UNDERTEST, UPTO, USES_DIRECTIVE, USES_USES, VALID_PROPERTY_TYPES, VERBOSE, VERSION_ATTR_LATEST, VERSION_ATTR_PROJECT, VERSION_ATTR_SNAPSHOT, VERSION_ATTRIBUTE, VERSION_FILTER, VISIBILITY_DIRECTIVE, WAB, WABLIB
 
Constructor Summary
Builder()
           
Builder(Processor parent)
           
 
Method Summary
 String _githead(String[] args)
           
 String _maven_version(String[] args)
          A macro to convert a maven version to an OSGi version
 String _permissions(String[] args)
           
 boolean addAll(Jar to, Jar sub, Instruction filter)
          Add all the resources in the given jar that match the given filter.
 boolean addAll(Jar to, Jar sub, Instruction filter, String destination)
          Add all the resources in the given jar that match the given filter.
 void addSourcepath(Collection<File> sourcepath)
           
 void addSourcepath(File cp)
           
 void analyze()
          Intercept the call to analyze and cleanup versions after we have analyzed the setup.
 Jar build()
           
 Jar[] builds()
          Build Multiple jars.
protected  void changedFile(File f)
           
 void cleanupVersion(Packages packages, String defaultVersion)
           
 void close()
           
protected  void doBaseline(Jar dot)
          Base line against a previous version.
 void doDiff(Jar dot)
          Diff this bundle to another bundle for the given packages.
protected  void doneBuild(Builder builder)
          Called when we 're done with a builder
 boolean doNotCopy(String v)
          doNotCopy The doNotCopy variable maintains a patter for files that should not be copied.
 String getClasspathEntrySuffix(File resource)
          Answer the string of the resource that it has in the container.
 Pattern getDoNotCopy()
           
protected  Jar getExtra()
          Answer extra packages.
 Collection<File> getSourcePath()
           
 Builder getSubBuilder()
           
 Builder getSubBuilder(File file)
           
 List<Builder> getSubBuilders()
          Answer a list of builders that represent this file or a list of files specified in -sub.
 boolean hasSources()
           
 void init()
          Allow any local initialization by subclasses before we build.
 boolean isInScope(Collection<File> resources)
          Check if the given resource is in scope of this bundle.
 void removeBundleSpecificHeaders()
           
 void report(Map<String,Object> table)
          Create a report of the settings
 void setSourcepath(File[] files)
           
protected  void setTypeSpecificPlugins(Set<Object> list)
           
protected  void startBuild(Builder builder)
          Called when we start to build a builder
 
Methods inherited from class aQute.bnd.osgi.Analyzer
_bsn, _classes, _ee, _exporters, _exports, _findname, _findpath, _frange, _imports, _md5, _sha1, addClasspath, addClasspath, addClasspath, begin, calcManifest, calculateExportsFromContents, cleanupUses, cleanupVersion, clear, doUses, findClass, findResource, getAPIUses, getBndInfo, getBndLastModified, getBndVersion, getBsn, getClasses, getClasspath, getClasspathExports, getClassspace, getClassspace, getContained, getDescriptor, getEEs, getExports, getHighestEE, getImports, getJar, getJarFromName, getLowestEE, getManifest, getOutputFile, getPackageRef, getPrivates, getReferred, getTarget, getTypeRef, getTypeRefFromFQN, getTypeRefFromPath, getUnreachable, getUses, getVersion, getVersionPolicy, getXRef, isImported, isNoBundle, mergeManifest, putAll, referred, referTo, referToByBinaryName, save, setBase, setClasspath, setClasspath, setClasspath, setDefaults, setDiagnostics, setJar, setJar, validResourcePath
 
Methods inherited from class aQute.bnd.osgi.Processor
_basedir, _native_capability, _propertiesdir, _propertiesname, _random, addBasicPlugin, addClose, addExtensions, addIncluded, addProperties, addProperties, append, appendPath, beginHandleErrors, check, concat, customize, doAttrbutes, doIncludeFile, doIncludeFile, endHandleErrors, error, error, exception, exists, findHeader, findHeader, forceRefresh, formatArrays, get, get, getBase, getClass, getDuration, getErrors, getExecutor, getFile, getFile, getFlattenedProperties, getFlattenedProperties, getHeader, getHeader, getIncluded, getInfo, getInfo, getLine, getLoader, getLocation, getMacroDomains, getManifestAsProperties, getParent, getPlugin, getPlugins, getPlugins, getProperties, getPropertiesFile, getProperty, getProperty, getProperty, getPropertyKeys, getReplacer, getTop, getUnprocessedProperty, getWarnings, is, isDuplicate, isExceptions, isFailOk, isMissingPlugin, isOk, isPedantic, isPerfect, isTrace, isTrue, iterator, join, join, join, join, join, keySet, lastModified, loadPlugins, loadProperties, makePrintable, merge, mergeProperties, mergeProperties, mergeProperties, mergeProperties, newHashMap, newList, newList, newMap, newMap, newSet, newSet, normalize, normalize, parseHeader, parseHeader, printClause, printClauses, printClauses, printExceptionSummary, printStackTrace, progress, progress, propertiesChanged, quote, read, refresh, removeBasicPlugin, removeClose, removeDuplicateMarker, replaceAll, replaceExtension, report, set, setExceptions, setFileMustExist, setForceLocal, setParent, setPedantic, setProperties, setProperties, setProperties, setProperty, setTrace, signal, since, split, split, split, toString, trace, unsetProperty, updateModified, use, warning
 
Methods inherited from class aQute.bnd.osgi.Domain
domain, domain, domain, domain, getBundleActivator, getBundleClasspath, getBundleClassPath, getBundleRequiredExecutionEnvironment, getBundleSymbolicName, getBundleVersion, getDynamicImportPackage, getExportContents, getExportPackage, getFragmentHost, getIcon, getImportPackage, getIncludeResource, getParameters, getParameters, getParameters, getParameters, getPrivatePackage, getProvideCapability, getRequireBundle, getRequireCapability, isSources, setBundleActivator, setBundleClasspath, setBundleRequiredExecutionEnvironment, setBundleSymbolicName, setBundleVersion, setBundleVersion, setConditionalPackage, setExportPackage, setFailOk, setImportPackage, setIncludeResource, setPrivatePackage, setSources, setTranslation, translate, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Builder

public Builder(Processor parent)

Builder

public Builder()
Method Detail

build

public Jar build()
          throws Exception
Throws:
Exception

init

public void init()
          throws Exception
Allow any local initialization by subclasses before we build.

Throws:
Exception

changedFile

protected void changedFile(File f)

hasSources

public boolean hasSources()

getExtra

protected Jar getExtra()
                throws Exception
Answer extra packages. In this case we implement conditional package. Any

Overrides:
getExtra in class Analyzer
Throws:
Exception

analyze

public void analyze()
             throws Exception
Intercept the call to analyze and cleanup versions after we have analyzed the setup. We do not want to cleanup if we are going to verify.

Overrides:
analyze in class Analyzer
Throws:
IOException
Exception

cleanupVersion

public void cleanupVersion(Packages packages,
                           String defaultVersion)

getSourcePath

public Collection<File> getSourcePath()

addAll

public boolean addAll(Jar to,
                      Jar sub,
                      Instruction filter)
Add all the resources in the given jar that match the given filter.

Parameters:
sub - the jar
filter - a pattern that should match the resoures in sub to be added

addAll

public boolean addAll(Jar to,
                      Jar sub,
                      Instruction filter,
                      String destination)
Add all the resources in the given jar that match the given filter.

Parameters:
sub - the jar
filter - a pattern that should match the resoures in sub to be added

setSourcepath

public void setSourcepath(File[] files)

addSourcepath

public void addSourcepath(File cp)

close

public void close()
Specified by:
close in interface Closeable
Overrides:
close in class Analyzer

builds

public Jar[] builds()
             throws Exception
Build Multiple jars. If the -sub command is set, we filter the file with the given patterns.

Returns:
Throws:
Exception

startBuild

protected void startBuild(Builder builder)
Called when we start to build a builder


doneBuild

protected void doneBuild(Builder builder)
Called when we 're done with a builder


getSubBuilders

public List<Builder> getSubBuilders()
                             throws Exception
Answer a list of builders that represent this file or a list of files specified in -sub. This list can be empty. These builders represents to be created artifacts and are each scoped to such an artifacts. The builders can be used to build the bundles or they can be used to find out information about the to be generated bundles.

Returns:
List of 0..n builders representing artifacts.
Throws:
Exception

getSubBuilder

public Builder getSubBuilder(File file)
                      throws Exception
Throws:
Exception

getSubBuilder

public Builder getSubBuilder()
                      throws Exception
Throws:
Exception

_maven_version

public String _maven_version(String[] args)
A macro to convert a maven version to an OSGi version


_permissions

public String _permissions(String[] args)

removeBundleSpecificHeaders

public void removeBundleSpecificHeaders()

isInScope

public boolean isInScope(Collection<File> resources)
                  throws Exception
Check if the given resource is in scope of this bundle. That is, it checks if the Include-Resource includes this resource or if it is a class file it is on the class path and the Export-Package or Private-Package include this resource.

Parameters:
f -
Returns:
Throws:
Exception

getClasspathEntrySuffix

public String getClasspathEntrySuffix(File resource)
                               throws Exception
Answer the string of the resource that it has in the container. It is possible that the resource is a classpath entry. In that case an empty string is returned.

Parameters:
resource - The resource to look for
Returns:
A suffix on the classpath or "" if the resource is a class path entry
Throws:
Exception

doNotCopy

public boolean doNotCopy(String v)
doNotCopy The doNotCopy variable maintains a patter for files that should not be copied. There is a default Constants.DEFAULT_DO_NOT_COPY but this ca be overridden with the Constants.DONOTCOPY property.


getDoNotCopy

public Pattern getDoNotCopy()

setTypeSpecificPlugins

protected void setTypeSpecificPlugins(Set<Object> list)
Overrides:
setTypeSpecificPlugins in class Processor

doDiff

public void doDiff(Jar dot)
            throws Exception
Diff this bundle to another bundle for the given packages.

Throws:
Exception

addSourcepath

public void addSourcepath(Collection<File> sourcepath)

doBaseline

protected void doBaseline(Jar dot)
                   throws Exception
Base line against a previous version. Should be overridden in the ProjectBuilder where we have access to the repos

Throws:
Exception

_githead

public String _githead(String[] args)
                throws IOException
Throws:
IOException

report

public void report(Map<String,Object> table)
            throws Exception
Create a report of the settings

Overrides:
report in class Analyzer
Throws:
Exception


Copyright © 2014 aQute SARL. All rights reserved.