aQute.bnd.osgi
Class Processor

java.lang.Object
  extended by aQute.bnd.osgi.Domain
      extended by aQute.bnd.osgi.Processor
All Implemented Interfaces:
Constants, Registry, Report, Reporter, Closeable, Iterable<String>
Direct Known Subclasses:
Analyzer, HeaderReader, MavenCommand, MavenDeployCmd, PomParser, Project, Signer, Verifier, Workspace

public class Processor
extends Domain
implements Reporter, Registry, Constants, Closeable


Nested Class Summary
static class Processor.CL
           
static class 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
static String 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
Processor()
           
Processor(Processor child)
           
Processor(Properties parent)
           
 
Method Summary
 String _basedir(String[] args)
           
 String _native_capability(String[] args)
           Generates a Capability string, in the format specified by the OSGi Provide-Capability header, representing the current native platform according to OSGi RFC 188.
 String _propertiesdir(String[] args)
           
 String _propertiesname(String[] args)
           
 String _random(String[] args)
          Generate a random string, which is guaranteed to be a valid Java identifier (first character is an ASCII letter, subsequent characters are ASCII letters or numbers).
 void addBasicPlugin(Object plugin)
          These plugins are added to the total list of plugins.
 void addClose(Closeable jar)
           
protected  void addExtensions(Set<Object> plugins)
          Is called when all plugins are loaded
 void addIncluded(File file)
           
 void addProperties(File file)
           
 void addProperties(Map<?,?> properties)
           
static String append(String... strings)
           
static String appendPath(String... parts)
          Append two strings to for a path in a ZIP or JAR file.
protected  void begin()
           
protected  Processor beginHandleErrors(String message)
          Set the current command thread.
 boolean check(String... pattern)
           
 void clear()
           
 void close()
           
<T> T[]
concat(Class<T> type, T[] prefix, T suffix)
          Add an element to an array, creating a new one if necessary
protected
<T> T
customize(T plugin, Attrs map)
          Set the initial parameters of a plugin
static Attrs doAttrbutes(Object[] attrs, Clazz clazz, Macro macro)
          Parse the a=b strings and return a map of them.
 void doIncludeFile(File file, boolean overwrite, Properties target)
           
 void doIncludeFile(File file, boolean overwrite, Properties target, String extensionName)
           
protected  void endHandleErrors(Processor previous)
          End a command.
 Reporter.SetLocation error(String string, Object... args)
          Create an error.
 Reporter.SetLocation error(String string, Throwable t, Object... args)
           
 Reporter.SetLocation exception(Throwable t, String format, Object... args)
          Dedicated message for an exception.
 boolean exists()
           
static Processor.FileLine findHeader(File f, Pattern header)
           
static Processor.FileLine findHeader(File f, String header)
           
 void forceRefresh()
           
static String formatArrays(String string, Object... parms)
          This method is the same as String.format but it makes sure that any arrays are transformed to strings.
 String get(String key)
          Overrides for the Domain class
 String get(String key, String deflt)
           
 File getBase()
           
 Class<?> getClass(String type, File jar)
           
static long getDuration(String tm, long dflt)
           
 List<String> getErrors()
          Return the errors.
static Executor getExecutor()
           
static File getFile(File base, String file)
           
 File getFile(String file)
           
 Properties getFlattenedProperties()
          Return the properties but expand all macros.
 Properties getFlattenedProperties(boolean ignoreInstructions)
          Return the properties but expand all macros.
 Processor.FileLine getHeader(Pattern header)
           
 Processor.FileLine getHeader(String header)
          Get a header relative to this processor, tking its parents and includes into account.
 List<File> getIncluded()
           
 void getInfo(Reporter processor)
           
 void getInfo(Reporter processor, String prefix)
           
 Jar getJarFromName(String name, String from)
          Try to get a Jar from a file name/path or a url, or in last resort from the classpath name part of their files.
static int getLine(String s, int index)
           
protected  Processor.CL getLoader()
           
 Report.Location getLocation(String msg)
          Return the errors for the given error or warning.
protected  Object[] getMacroDomains()
          This should be overridden by subclasses to add extra macro command domains on the search list.
static Properties getManifestAsProperties(InputStream in)
          Read a manifest but return a properties object.
 Processor getParent()
           
<T> T
getPlugin(Class<T> clazz)
          Returns the first plugin it can find of the given type.
 Set<Object> getPlugins()
          Return a list of plugins.
<T> List<T>
getPlugins(Class<T> clazz)
          Return a list of plugins that implement the given class.
 Properties getProperties()
          Property handling ...
 File getPropertiesFile()
           
 String getProperty(String key)
           
 String getProperty(String key, String deflt)
          Get a property with preprocessing it with a proper default
 String getProperty(String key, String deflt, String separator)
           
 Set<String> getPropertyKeys(boolean inherit)
          Return all inherited property keys
 Macro getReplacer()
           
 Processor getTop()
           
 String getUnprocessedProperty(String key, String deflt)
          Get a property without preprocessing it with a proper default
 List<String> getWarnings()
          Return the warnings.
 boolean is(String propertyName)
          Simplified way to check booleans
static boolean isDuplicate(String name)
           
 boolean isExceptions()
           
 boolean isFailOk()
          Indicates that this run should ignore errors and succeed anyway
 boolean isMissingPlugin(String name)
          Answer if the name is a missing plugin's command name.
 boolean isOk()
          Check if this report has any relevant errors that should make the run associated with this report invalid.
 boolean isPedantic()
          The provider of the reporter wants pedantic reporting, meaning every possible warning should be reported.
 boolean isPerfect()
           
 boolean isTrace()
           
static boolean isTrue(String value)
           
 Iterator<String> iterator()
           
static String join(Collection<?>... list)
           
static String join(Collection<?> list, String delimeter)
          Join a list.
static String join(Object[] list, String delimeter)
           
static String join(String delimeter, Collection<?>... list)
           
static
<T> String
join(T[] list)
           
 Set<String> keySet()
           
 long lastModified()
           
protected  void loadPlugins(Set<Object> instances, String pluginString, String pluginPathString)
          Magic to load the plugins.
 Properties loadProperties(File file)
          Helper to load a properties file from disk.
static Object makePrintable(Object object)
          Check if the object is an array and turn it into a string if it is, otherwise unchanged.
static String merge(String... strings)
           
 void mergeProperties(File file, boolean override)
           
 void mergeProperties(Properties properties, boolean override)
           
 String mergeProperties(String key)
          Return merged properties.
 String mergeProperties(String key, String separator)
           
static
<K,V> Map<K,V>
newHashMap()
           
<T> List<T>
newList()
           
<T> List<T>
newList(Collection<T> t)
           
static
<K,V> Map<K,V>
newMap()
           
<K,V> Map<K,V>
newMap(Map<K,V> t)
           
<T> Set<T>
newSet()
           
<T> Set<T>
newSet(Collection<T> t)
           
 String normalize(File f)
           
 String normalize(String f)
          Make the file short if it is inside our base directory, otherwise long.
 Parameters parseHeader(String value)
           
static Parameters parseHeader(String value, Processor logger)
          Standard OSGi header parser.
static void printClause(Map<?,?> map, StringBuilder sb)
           
static String printClauses(Map<?,? extends Map<?,?>> exports)
          Print a standard Map based OSGi header.
static String printClauses(Map<?,? extends Map<?,?>> exports, boolean checkMultipleVersions)
           
 int printExceptionSummary(Throwable e, PrintStream out)
           
 void printStackTrace(Throwable e, int count, PrintStream out)
           
 void progress(float progress, String format, Object... args)
          Create a warning.
 void progress(String format, Object... args)
           
 void propertiesChanged()
           
static boolean quote(Appendable sb, String value)
           
static String read(InputStream in)
           
 boolean refresh()
           
 void removeBasicPlugin(Object plugin)
           
 void removeClose(Closeable jar)
           
static String removeDuplicateMarker(String key)
           
static Properties replaceAll(Properties p, String pattern, String replacement)
          Replace a string in all the values of the map.
 String replaceExtension(String s, String extension, String newExtension)
          Utiltity to replace an extension
protected  void report(Appendable out)
           
 void report(Map<String,Object> table)
          Report the details of this processor.
 void set(String key, String value)
           
 void setBase(File base)
           
 void setExceptions(boolean exceptions)
           
 void setFileMustExist(boolean mustexist)
           
 void setForceLocal(Collection<String> local)
           
 void setParent(Processor processor)
           
 void setPedantic(boolean pedantic)
           
 void setProperties(File propertiesFile)
          Set the properties by file.
 void setProperties(File propertiesFile, File base)
           
 void setProperties(Properties properties)
           
 void setProperty(String key, String value)
          Add or override a new property.
 void setTrace(boolean x)
           
protected  void setTypeSpecificPlugins(Set<Object> list)
           
 void signal()
           
 boolean since(Version introduced)
           
static Collection<String> split(String s)
           
static void split(String s, Collection<String> set)
           
static Collection<String> split(String s, String splitter)
           
 String toString()
          Printout of the status of this processor for toString()
 void trace(String msg, Object... parms)
          Create a warning.
 void unsetProperty(String string)
           
 boolean updateModified(long time, String reason)
           
 void use(Processor reporter)
           
 Reporter.SetLocation warning(String string, Object... args)
          Create a 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
 

Field Detail

LIST_SPLITTER

public static final String LIST_SPLITTER
See Also:
Constant Field Values
Constructor Detail

Processor

public Processor()

Processor

public Processor(Properties parent)

Processor

public Processor(Processor child)
Method Detail

setParent

public void setParent(Processor processor)

getParent

public Processor getParent()

getTop

public Processor getTop()

getInfo

public void getInfo(Reporter processor,
                    String prefix)

getInfo

public void getInfo(Reporter processor)

warning

public Reporter.SetLocation warning(String string,
                                    Object... args)
Description copied from interface: Reporter
Create a warning. Implementations must ensure that the given args are not prevented from garbage collecting. The args must have a proper toString method.

Specified by:
warning in interface Reporter
Parameters:
string - The format of the error
args - The arguments of the error
Returns:
a SetLocation to set the location

error

public Reporter.SetLocation error(String string,
                                  Object... args)
Description copied from interface: Reporter
Create an error. Implementations must ensure that the given args are not prevented from garbage collecting. The args must have a proper toString method.

Specified by:
error in interface Reporter
Parameters:
string - The format of the error
args - The arguments of the error
Returns:
a SetLocation to set the location

progress

public void progress(float progress,
                     String format,
                     Object... args)
Description copied from interface: Reporter
Create a warning. Implementations must ensure that the given args are not prevented from garbage collecting. The args must have a proper toString method.

Specified by:
progress in interface Reporter
Parameters:
progress - A value between 0 and 1 indicating the progress. 0 is starting and >=1 is done.
format - The format of the error
args - The arguments of the error

progress

public void progress(String format,
                     Object... args)

exception

public Reporter.SetLocation exception(Throwable t,
                                      String format,
                                      Object... args)
Description copied from interface: Reporter
Dedicated message for an exception.

Specified by:
exception in interface Reporter
Parameters:
t - The exception
args - The arguments

error

public Reporter.SetLocation error(String string,
                                  Throwable t,
                                  Object... args)

printExceptionSummary

public int printExceptionSummary(Throwable e,
                                 PrintStream out)

printStackTrace

public void printStackTrace(Throwable e,
                            int count,
                            PrintStream out)

signal

public void signal()

getWarnings

public List<String> getWarnings()
Description copied from interface: Report
Return the warnings. This list must not be changed and may be immutable.

Specified by:
getWarnings in interface Report
Returns:
the warnings

getErrors

public List<String> getErrors()
Description copied from interface: Report
Return the errors. This list must not be changed and may be immutable.

Specified by:
getErrors in interface Report
Returns:
the errors

parseHeader

public static Parameters parseHeader(String value,
                                     Processor logger)
Standard OSGi header parser.

Parameters:
value -
Returns:

parseHeader

public Parameters parseHeader(String value)

addClose

public void addClose(Closeable jar)

removeClose

public void removeClose(Closeable jar)

isPedantic

public boolean isPedantic()
Description copied from interface: Reporter
The provider of the reporter wants pedantic reporting, meaning every possible warning should be reported.

Specified by:
isPedantic in interface Reporter
Returns:
if this is a pedantic reporter.

setPedantic

public void setPedantic(boolean pedantic)

use

public void use(Processor reporter)

getFile

public static File getFile(File base,
                           String file)

getFile

public File getFile(String file)

getPlugins

public <T> List<T> getPlugins(Class<T> clazz)
Return a list of plugins that implement the given class.

Specified by:
getPlugins in interface Registry
Parameters:
clazz - Each returned plugin implements this class/interface
Returns:
A list of plugins

getPlugin

public <T> T getPlugin(Class<T> clazz)
Returns the first plugin it can find of the given type.

Specified by:
getPlugin in interface Registry
Type Parameters:
T -
Parameters:
clazz -
Returns:

getPlugins

public Set<Object> getPlugins()
Return a list of plugins. Plugins are defined with the -plugin command. They are class names, optionally associated with attributes. Plugins can implement the Plugin interface to see these attributes. Any object can be a plugin.

Returns:

addExtensions

protected void addExtensions(Set<Object> plugins)
Is called when all plugins are loaded

Parameters:
plugins -

loadPlugins

protected void loadPlugins(Set<Object> instances,
                           String pluginString,
                           String pluginPathString)
Magic to load the plugins. This is quite tricky actually since we allow plugins to be downloaded (this is mainly intended for repositories since in general plugins should use extensions, however to bootstrap the extensions we need more). Since downloads might need plugins for passwords and protocols we need to first load the paths specified on the plugin clause, then check if there are any local plugins (starting with aQute.bnd and be able to load from our own class loader).

After that, we load the plugin paths, these can use the built in connectors.

Last but not least, we load the remaining plugins.

Parameters:
instances -
pluginString -

setTypeSpecificPlugins

protected void setTypeSpecificPlugins(Set<Object> list)

customize

protected <T> T customize(T plugin,
                          Attrs map)
Set the initial parameters of a plugin

Parameters:
plugin -
entry -

isFailOk

public boolean isFailOk()
Indicates that this run should ignore errors and succeed anyway

Overrides:
isFailOk in class Domain
Returns:
true if this processor should return errors

getBase

public File getBase()

setBase

public void setBase(File base)

clear

public void clear()

trace

public void trace(String msg,
                  Object... parms)
Description copied from interface: Reporter
Create a warning. Implementations must ensure that the given args are not prevented from garbage collecting. The args must have a proper toString method.

Specified by:
trace in interface Reporter
Parameters:
msg - The format of the error
parms - The arguments of the error

newList

public <T> List<T> newList()

newSet

public <T> Set<T> newSet()

newMap

public static <K,V> Map<K,V> newMap()

newHashMap

public static <K,V> Map<K,V> newHashMap()

newList

public <T> List<T> newList(Collection<T> t)

newSet

public <T> Set<T> newSet(Collection<T> t)

newMap

public <K,V> Map<K,V> newMap(Map<K,V> t)

close

public void close()
Specified by:
close in interface Closeable

_basedir

public String _basedir(String[] args)

_propertiesname

public String _propertiesname(String[] args)

_propertiesdir

public String _propertiesdir(String[] args)

getProperties

public Properties getProperties()
Property handling ...

Returns:

getProperty

public String getProperty(String key)

mergeProperties

public void mergeProperties(File file,
                            boolean override)

mergeProperties

public void mergeProperties(Properties properties,
                            boolean override)

setProperties

public void setProperties(Properties properties)

addProperties

public void addProperties(File file)
                   throws Exception
Throws:
Exception

addProperties

public void addProperties(Map<?,?> properties)

addIncluded

public void addIncluded(File file)

doIncludeFile

public void doIncludeFile(File file,
                          boolean overwrite,
                          Properties target)
                   throws Exception
Parameters:
file -
parent -
done -
overwrite -
Throws:
FileNotFoundException
IOException
Exception

doIncludeFile

public void doIncludeFile(File file,
                          boolean overwrite,
                          Properties target,
                          String extensionName)
                   throws Exception
Parameters:
file -
parent -
done -
overwrite -
extensionName -
Throws:
FileNotFoundException
IOException
Exception

unsetProperty

public void unsetProperty(String string)

refresh

public boolean refresh()

forceRefresh

public void forceRefresh()

propertiesChanged

public void propertiesChanged()

setProperties

public void setProperties(File propertiesFile)
                   throws IOException
Set the properties by file. Setting the properties this way will also set the base for this analyzer. After reading the properties, this will call setProperties(Properties) which will handle the includes.

Parameters:
propertiesFile -
Throws:
FileNotFoundException
IOException

setProperties

public void setProperties(File propertiesFile,
                          File base)

begin

protected void begin()

isTrue

public static boolean isTrue(String value)

getUnprocessedProperty

public String getUnprocessedProperty(String key,
                                     String deflt)
Get a property without preprocessing it with a proper default

Parameters:
headerName -
deflt -
Returns:

getProperty

public String getProperty(String key,
                          String deflt)
Get a property with preprocessing it with a proper default

Parameters:
headerName -
deflt -
Returns:

getProperty

public String getProperty(String key,
                          String deflt,
                          String separator)

loadProperties

public Properties loadProperties(File file)
                          throws IOException
Helper to load a properties file from disk.

Parameters:
file -
Returns:
Throws:
IOException

replaceAll

public static Properties replaceAll(Properties p,
                                    String pattern,
                                    String replacement)
Replace a string in all the values of the map. This can be used to preassign variables that change. I.e. the base directory ${.} for a loaded properties


printClauses

public static String printClauses(Map<?,? extends Map<?,?>> exports)
                           throws IOException
Print a standard Map based OSGi header.

Parameters:
exports - map { name => Map { attribute|directive => value } }
Returns:
the clauses
Throws:
IOException

printClauses

public static String printClauses(Map<?,? extends Map<?,?>> exports,
                                  boolean checkMultipleVersions)
                           throws IOException
Throws:
IOException

printClause

public static void printClause(Map<?,?> map,
                               StringBuilder sb)
                        throws IOException
Throws:
IOException

quote

public static boolean quote(Appendable sb,
                            String value)
                     throws IOException
Parameters:
sb -
value -
Returns:
Throws:
IOException

getReplacer

public Macro getReplacer()

getMacroDomains

protected Object[] getMacroDomains()
This should be overridden by subclasses to add extra macro command domains on the search list.

Returns:

getFlattenedProperties

public Properties getFlattenedProperties()
Return the properties but expand all macros. This always returns a new Properties object that can be used in any way.

Returns:

getFlattenedProperties

public Properties getFlattenedProperties(boolean ignoreInstructions)
Return the properties but expand all macros. This always returns a new Properties object that can be used in any way.

Returns:

getPropertyKeys

public Set<String> getPropertyKeys(boolean inherit)
Return all inherited property keys

Returns:

updateModified

public boolean updateModified(long time,
                              String reason)

lastModified

public long lastModified()

setProperty

public void setProperty(String key,
                        String value)
Add or override a new property.

Parameters:
key -
value -

getManifestAsProperties

public static Properties getManifestAsProperties(InputStream in)
                                          throws IOException
Read a manifest but return a properties object.

Parameters:
in -
Returns:
Throws:
IOException

getPropertiesFile

public File getPropertiesFile()

setFileMustExist

public void setFileMustExist(boolean mustexist)

read

public static String read(InputStream in)
                   throws Exception
Throws:
Exception

join

public static String join(Collection<?> list,
                          String delimeter)
Join a list.

Parameters:
args -
Returns:

join

public static String join(String delimeter,
                          Collection<?>... list)

join

public static String join(Object[] list,
                          String delimeter)

join

public static String join(Collection<?>... list)

join

public static <T> String join(T[] list)

split

public static void split(String s,
                         Collection<String> set)

split

public static Collection<String> split(String s)

split

public static Collection<String> split(String s,
                                       String splitter)

merge

public static String merge(String... strings)

isExceptions

public boolean isExceptions()

setExceptions

public void setExceptions(boolean exceptions)

normalize

public String normalize(String f)
Make the file short if it is inside our base directory, otherwise long.

Parameters:
f -
Returns:

normalize

public String normalize(File f)

removeDuplicateMarker

public static String removeDuplicateMarker(String key)

isDuplicate

public static boolean isDuplicate(String name)

setTrace

public void setTrace(boolean x)

getLoader

protected Processor.CL getLoader()

exists

public boolean exists()

isOk

public boolean isOk()
Description copied from interface: Report
Check if this report has any relevant errors that should make the run associated with this report invalid. I.e. if this returns false then the run should be disregarded.

Specified by:
isOk in interface Report
Returns:
true if this run should be disregarded due to errors

check

public boolean check(String... pattern)
              throws IOException
Throws:
IOException

report

protected void report(Appendable out)
               throws IOException
Throws:
IOException

isPerfect

public boolean isPerfect()

setForceLocal

public void setForceLocal(Collection<String> local)

isMissingPlugin

public boolean isMissingPlugin(String name)
Answer if the name is a missing plugin's command name. If a bnd file contains the command name of a plugin, and that plugin is not available, then an error is reported during manifest calculation. This allows the plugin to fail to load when it is not needed. We first get the plugins to ensure it is properly initialized.

Parameters:
name -
Returns:

appendPath

public static String appendPath(String... parts)
Append two strings to for a path in a ZIP or JAR file. It is guaranteed to return a string that does not start, nor ends with a '/', while it is properly separated with slashes. Double slashes are properly removed.
  "/" + "abc/def/" becomes "abc/def"
  
 @param prefix
 @param suffix
 @return


doAttrbutes

public static Attrs doAttrbutes(Object[] attrs,
                                Clazz clazz,
                                Macro macro)
Parse the a=b strings and return a map of them.

Parameters:
attrs -
clazz -
Returns:

formatArrays

public static String formatArrays(String string,
                                  Object... parms)
This method is the same as String.format but it makes sure that any arrays are transformed to strings.

Parameters:
string -
parms -
Returns:

makePrintable

public static Object makePrintable(Object object)
Check if the object is an array and turn it into a string if it is, otherwise unchanged.

Parameters:
object - the object to make printable
Returns:
a string if it was an array or the original object

append

public static String append(String... strings)

getClass

public Class<?> getClass(String type,
                         File jar)
                  throws Exception
Throws:
Exception

isTrace

public boolean isTrace()

getDuration

public static long getDuration(String tm,
                               long dflt)

_random

public String _random(String[] args)
Generate a random string, which is guaranteed to be a valid Java identifier (first character is an ASCII letter, subsequent characters are ASCII letters or numbers). Takes an optional parameter for the length of string to generate; default is 8 characters.


_native_capability

public String _native_capability(String[] args)
                          throws IllegalArgumentException

Generates a Capability string, in the format specified by the OSGi Provide-Capability header, representing the current native platform according to OSGi RFC 188. For example on Windows7 running on an x86_64 processor it should generate the following:

 osgi.native;osgi.native.osname:List<String>="Windows7,Windows 7,Win32";osgi.native.osversion:Version=6.1.0;osgi.native.processor:List<String>="x86-64,amd64,em64t,x86_64"
 

Parameters:
args - The array of properties. For example: the macro invocation of "${native_capability;osversion=3.2.4;osname=Linux}" results in an args array of [native_capability, osversion=3.2.4, osname=Linux]
Throws:
IllegalArgumentException

beginHandleErrors

protected Processor beginHandleErrors(String message)
Set the current command thread. This must be balanced with the #end(Processor) method. The method returns the previous command owner or null. The command owner will receive all warnings and error reports.


endHandleErrors

protected void endHandleErrors(Processor previous)
End a command. Will restore the previous command owner.

Parameters:
previous -

getExecutor

public static Executor getExecutor()

addBasicPlugin

public void addBasicPlugin(Object plugin)
These plugins are added to the total list of plugins. The separation is necessary because the list of plugins is refreshed now and then so we need to be able to add them at any moment in time.

Parameters:
plugin -

removeBasicPlugin

public void removeBasicPlugin(Object plugin)

getIncluded

public List<File> getIncluded()

get

public String get(String key)
Overrides for the Domain class

Specified by:
get in class Domain

get

public String get(String key,
                  String deflt)
Overrides:
get in class Domain

set

public void set(String key,
                String value)
Specified by:
set in class Domain

iterator

public Iterator<String> iterator()
Specified by:
iterator in interface Iterable<String>
Specified by:
iterator in class Domain

keySet

public Set<String> keySet()

toString

public String toString()
Printout of the status of this processor for toString()

Overrides:
toString in class Object

replaceExtension

public String replaceExtension(String s,
                               String extension,
                               String newExtension)
Utiltity to replace an extension

Parameters:
s -
extension -
newExtension -
Returns:

getLocation

public Report.Location getLocation(String msg)
Description copied from interface: Report
Return the errors for the given error or warning. Can return null.

Specified by:
getLocation in interface Report
Parameters:
msg - The message
Returns:
null or the location of the message

getHeader

public Processor.FileLine getHeader(String header)
                             throws Exception
Get a header relative to this processor, tking its parents and includes into account.

Parameters:
location -
header -
Returns:
Throws:
IOException
Exception

getHeader

public Processor.FileLine getHeader(Pattern header)
                             throws Exception
Throws:
Exception

findHeader

public static Processor.FileLine findHeader(File f,
                                            String header)
                                     throws IOException
Throws:
IOException

findHeader

public static Processor.FileLine findHeader(File f,
                                            Pattern header)
                                     throws IOException
Throws:
IOException

getLine

public static int getLine(String s,
                          int index)

since

public boolean since(Version introduced)

report

public void report(Map<String,Object> table)
            throws Exception
Report the details of this processor. Should in general be overridden

Parameters:
table -
Throws:
Exception

is

public boolean is(String propertyName)
Simplified way to check booleans


mergeProperties

public String mergeProperties(String key)
Return merged properties. The parameters provide a list of property names which are concatenated in the output, separated by a comma. Not only are those property names looked for, also all property names that have that constant as a prefix, a '.', and then whatever (.*). The result is either null if nothing was found or a list of properties


mergeProperties

public String mergeProperties(String key,
                              String separator)

concat

public <T> T[] concat(Class<T> type,
                      T[] prefix,
                      T suffix)
Add an element to an array, creating a new one if necessary


getJarFromName

public Jar getJarFromName(String name,
                          String from)
Try to get a Jar from a file name/path or a url, or in last resort from the classpath name part of their files.

Parameters:
name - URL or filename relative to the base
from - Message identifying the caller for errors
Returns:
null or a Jar with the contents for the name


Copyright © 2014 aQute SARL. All rights reserved.