Package aQute.bnd.osgi
Class Processor
- java.lang.Object
-
- aQute.bnd.osgi.Domain
-
- aQute.bnd.osgi.Processor
-
- All Implemented Interfaces:
Constants
,Registry
,Report
,Reporter
,java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Iterable<java.lang.String>
- Direct Known Subclasses:
Analyzer
,bnd
,BuildContext
,CommunicationCommands
,EclipseCommand
,HeaderReader
,IndexCommand
,JarPrinter
,Makefile
,MavenCommand
,MavenDeployCmd
,PomParser
,Profiles
,Project
,ProjectLauncher
,ServiceComponent.ComponentMaker
,Signer
,Verifier
,Workspace
,XMLResourceParser
public class Processor extends Domain implements Reporter, Registry, Constants, java.io.Closeable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Processor.CL
static class
Processor.FileLine
(package private) static class
Processor.SetLocationImpl
-
Nested classes/interfaces inherited from interface aQute.service.reporter.Report
Report.Location
-
Nested classes/interfaces inherited from interface aQute.service.reporter.Reporter
Reporter.SetLocation
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.String
_frangeHelp
(package private) static java.lang.String
_uriHelp
private java.io.File
base
private java.net.URI
baseURI
(package private) java.util.Set<java.lang.Object>
basicPlugins
(package private) static int
BUFFER_SIZE
(package private) static java.lang.ThreadLocal<Processor>
current
private static java.lang.invoke.MethodType
defaultConstructor
private static java.util.regex.Pattern
DURATION_P
(package private) java.util.List<java.lang.String>
errors
(package private) boolean
exceptions
private static java.util.concurrent.ThreadPoolExecutor
executor
(package private) boolean
fileMustExist
(package private) java.util.Collection<java.lang.String>
filter
private boolean
fixup
(package private) boolean
fixupMessages
private java.util.concurrent.CopyOnWriteArrayList<java.io.File>
included
private long
lastModified
static java.lang.String
LIST_SPLITTER
(package private) java.util.List<Report.Location>
locations
Create a location object and add it to the locationsstatic Reporter
log
private static org.slf4j.Logger
logger
(package private) java.util.HashSet<java.lang.String>
missingCommand
(package private) Processor
parent
(package private) boolean
pedantic
(package private) Processor.CL
pluginLoader
private java.util.Set<java.lang.Object>
plugins
(package private) java.lang.String
profile
private static org.osgi.util.promise.PromiseFactory
promiseFactory
(package private) java.util.Properties
properties
private java.io.File
propertiesFile
(package private) static java.util.Random
random
private Macro
replacer
private static java.util.concurrent.ScheduledThreadPoolExecutor
scheduledExecutor
(package private) java.lang.Boolean
strict
private java.util.Set<java.io.Closeable>
toBeClosed
(package private) boolean
trace
(package private) Version
upto
This method is about compatibility.(package private) java.util.List<java.lang.String>
warnings
-
Fields inherited from class aQute.bnd.osgi.Domain
translation
-
Fields inherited from interface aQute.bnd.osgi.Constants
ACCESS_ATTRIBUTE, AUGMENT, AUGMENT_CAPABILITY_DIRECTIVE, AUGMENT_RANGE_ATTRIBUTE, AUGMENT_REQUIREMENT_DIRECTIVE, AUTOMATIC_MODULE_NAME, 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, BSN_SOURCE_SUFFIX, BUILDERIGNORE, BUILDFILES, BUILDPACKAGES, BUILDPATH, BUILDREPO, 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_SCM, BUNDLE_SPECIFIC_HEADERS, BUNDLE_SYMBOLIC_NAME_ATTRIBUTE, BUNDLE_SYMBOLICNAME, BUNDLE_UPDATELOCATION, BUNDLE_VENDOR, BUNDLE_VERSION, BUNDLE_VERSION_ATTRIBUTE, BUNDLEANNOTATIONS, CACHEDIR, CARDINALITY_DIRECTIVE, CDIANNOTATIONS, CHECK, CLASS_ATTRIBUTE, 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, COMPRESSION, CONDITIONAL_PACKAGE, CONDITIONALPACKAGE, CONDUIT, CONNECTION_SETTINGS, CONSUMER_POLICY, CONTRACT, CREATED_BY, CURRENT_BUNDLESYMBOLICNAME, CURRENT_BUNDLEVERSION, 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, DEFINE_CONTRACT, DEPENDSON, DEPLOY, DEPLOYREPO, DESCRIPTION_ATTRIBUTE, DIFFIGNORE, DIFFPACKAGES, DIGESTS, directives, DISTRO, DONOTCOPY, DSANNOTATIONS, DSANNOTATIONS_OPTIONS, DUPLICATE_MARKER, DYNAMICIMPORT_PACKAGE, EE_ATTRIBUTE, EEPROFILE, EEPROFILE_AUTO_ATTRIBUTE, EFFECTIVE_DIRECTIVE, EMBEDDED_REPO, EMPTY, EMPTY_HEADER, EXCLUDE_DIRECTIVE, EXECUTABLE, EXPERIMENTS, EXPORT, EXPORT_APIGUARDIAN, EXPORT_BSN, EXPORT_CONTENTS, EXPORT_NAME, EXPORT_PACKAGE, EXPORT_SERVICE, EXPORT_TYPE, EXPORT_VERSION, EXPORTS_ATTRIBUTE, EXPORTTYPE, 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, GENERATE, GESTALT, GESTALT_BATCH, GESTALT_CI, GESTALT_INTERACTIVE, GESTALT_OFFLINE, GESTALT_SHELL, GROUPID, headers, IDENTITY_INITIAL_RESOURCE, IDENTITY_SYSTEM_RESOURCE, IGNORE_ATTRIBUTE, IGNORE_PACKAGE, IGNORE_STANDALONE, IMPORT_DIRECTIVE, IMPORT_PACKAGE, IMPORT_PRIVATE, IMPORT_REFERENCE, IMPORT_SERVICE, importDirectives, INCLUDE, INCLUDE_DIRECTIVE, INCLUDE_RESOURCE, INCLUDEPACKAGE, INCLUDERESOURCE, INIT, INTERNAL_BUNDLESYMBOLICNAME_DIRECTIVE, INTERNAL_BUNDLEVERSION_DIRECTIVE, INTERNAL_EXPORT_TO_MODULES_DIRECTIVE, INTERNAL_EXPORTED_DIRECTIVE, INTERNAL_MODULE_VERSION_DIRECTIVE, INTERNAL_OPEN_TO_MODULES_DIRECTIVE, INTERNAL_SOURCE_DIRECTIVE, INVALIDFILENAMES, JAVA, JAVA_DEBUG, JAVAAGENT, JAVAC, JAVAC_ENCODING, JAVAC_PROFILE, JAVAC_SOURCE, JAVAC_TARGET, JIDENTIFIER, JPMS_MODULE_INFO, JPMS_MODULE_INFO_OPTIONS, KEYSTORE_LOCATION_DIRECTIVE, KEYSTORE_PASSWORD_DIRECTIVE, KEYSTORE_PROVIDER_DIRECTIVE, LANGUAGE_ATTRIBUTE, LAUNCH_ACTIVATION_EAGER, LAUNCH_ACTIVATORS, LAUNCH_RUNBUNDLES_ATTRS, LAUNCH_STARTLEVEL_DEFAULT, LAUNCH_TRACE, LAUNCHER_PLUGIN, LIB_DIRECTIVE, LINK_ATTRIBUTE, LITERAL_ATTRIBUTE, MAIN_CLASS, MAKE, MANDATORY_DIRECTIVE, MANIFEST, MANIFEST_NAME, MAVEN_DEPENDENCIES, MAVEN_RELEASE, MAVEN_SCOPE, META_PERSISTENCE, METAPACKAGES, METATYPE, METATYPE_ANNOTATIONS, METATYPE_ANNOTATIONS_OPTIONS, MIME_TYPE_BUNDLE, MIME_TYPE_JAR, MODULE_INFO_CLASS, MODULES_ATTRIBUTE, NAME_ATTRIBUTE, NAMESECTION, NAMESPACE_STEM, NO_IMPORT_DIRECTIVE, NOANNOTATIONS, NOBUILDINCACHE, NOBUNDLES, NOCLASSFORNAME, NODEFAULTVERSION, NOEE, NOEXTRAHEADERS, NOIMPORTJAVA, NOJUNIT, NOJUNITOSGI, NOMANIFEST, NONE, NOT_A_BUNDLE_S, NOUSES, OPTIONAL, options, OSGI_SYNTAX_HEADERS, OSNAME_ATTRIBUTE, OSVERSION_ATTRIBUTE, OUTPUT, OUTPUTMASK, PACKAGE, PACKAGEINFOTYPE, 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, REMOTEWORKSPACE, REMOVE_ATTRIBUTE_DIRECTIVE, REMOVEHEADERS, REPORTNEWER, REPOSITORIES, REPRODUCIBLE, REQUIRE_BND, REQUIRE_BUNDLE, REQUIRE_CAPABILITY, RESOLUTION, RESOLUTION_DIRECTIVE, RESOLUTION_DYNAMIC, RESOLVE, RESOURCEONLY, RUNBLACKLIST, RUNBUILDS, RUNBUNDLES, RUNBUNDLES_STARTLEVEL_ATTRIBUTE, RUNEE, RUNENV, RUNFRAMEWORK, RUNFRAMEWORK_NONE, RUNFRAMEWORK_SERVICES, RUNFRAMEWORKRESTART, RUNFW, RUNJDB, RUNKEEP, RUNNOREFERENCES, RUNOPTIONS, RUNOPTIONS_EAGER, RUNPATH, RUNPATH_LAUNCHER_DIRECTIVE, RUNPATH_MAIN_DIRECTIVE, RUNPROGRAMARGS, RUNPROPERTIES, RUNPROVIDEDCAPABILITIES, RUNREMOTE, RUNREPOS, RUNREQUIRE, RUNREQUIRES, RUNSTARTLEVEL, RUNSTARTLEVEL_BEGIN, RUNSTARTLEVEL_ORDER, RUNSTARTLEVEL_STEP, RUNSTORAGE, RUNSYSTEMCAPABILITIES, RUNSYSTEMPACKAGES, RUNTIMEOUT, RUNTRACE, RUNVM, SAVEMANIFEST, SELECTION_FILTER_ATTRIBUTE, SERVICE_COMPONENT, SERVICELOADER_NAMESPACE, SERVICELOADER_REGISTER_DIRECTIVE, 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, STALECHECK, STANDALONE, STATIC_ATTRIBUTE, STRICT, SUB, SUBSTITUTE_ATTRIBUTE, SYSTEMPROPERTIES, TESTCASES, TESTCONTINUOUS, TESTER, TESTER_PLUGIN, TESTPACKAGES, TESTPATH, TESTREPORT, TESTSOURCES, TESTSUITES, TESTUNRESOLVED, TOOL, TRANSITIVE_ATTRIBUTE, TSTAMP, UNDERTEST, UPTO, USES_DIRECTIVE, USES_USES, VALID_PROPERTY_TYPES, VERBOSE, VERSION_ATTR_HASH, VERSION_ATTR_LATEST, VERSION_ATTR_PROJECT, VERSION_ATTR_SNAPSHOT, VERSION_ATTRIBUTE, VERSION_FILTER, VISIBILITY_DIRECTIVE, WAB, WABLIB, WORKINGSET, WORKINGSET_MEMBER
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.String
_basedir(java.lang.String[] args)
java.lang.String
_fileuri(java.lang.String[] args)
java.lang.String
_findfile(java.lang.String[] args)
java.lang.String
_frange(java.lang.String[] args)
Return a range expression for a filter from a version.java.lang.String
_native_capability(java.lang.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.java.lang.String
_propertiesdir(java.lang.String[] args)
java.lang.String
_propertiesname(java.lang.String[] args)
java.lang.String
_random(java.lang.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).java.lang.String
_thisfile(java.lang.String[] args)
Return the name of the properties filejava.lang.String
_uri(java.lang.String[] args)
private void
addAll(java.util.List<java.lang.String> to, java.util.List<java.lang.String> from, java.lang.String prefix, Reporter reporter)
void
addBasicPlugin(java.lang.Object plugin)
These plugins are added to the total list of plugins.void
addClose(java.io.Closeable jar)
protected void
addExtensions(java.util.Set<java.lang.Object> p)
Is called when all plugins are loadedvoid
addIncluded(java.io.File file)
private boolean
addIncludedIfAbsent(java.io.File file)
void
addProperties(java.io.File file)
void
addProperties(java.util.Map<?,?> properties)
static java.lang.String
append(java.lang.String... strings)
static java.lang.String
appendPath(java.lang.String... parts)
Append two strings to for a path in a ZIP or JAR file.protected void
begin()
protected Processor
beginHandleErrors(java.lang.String message)
Set the current command thread.boolean
check(java.lang.String... pattern)
void
clear()
void
close()
<T> T[]
concat(java.lang.Class<T> type, T[] prefix, T suffix)
Add an element to an array, creating a new one if necessaryprivate Processor
current()
A processor can mark itself current for a thread.protected <T> T
customize(T plugin, Attrs map)
Set the initial parameters of a pluginParameters
decorated(java.lang.String key)
Parameters
decorated(java.lang.String key, boolean literalsIncluded)
Return a parameters that contains the merged properties of the given key and that is decorated by the merged properties of the key + '+'static Attrs
doAttrbutes(java.lang.Object[] attrs, Clazz clazz, Macro macro)
Parse the a=b strings and return a map of them.private void
doFixup(Instructions instrs, java.util.List<java.lang.String> messages, java.util.List<java.lang.String> other, java.lang.String type)
void
doIncludeFile(java.io.File file, boolean overwrite, java.util.Properties target)
void
doIncludeFile(java.io.File file, boolean overwrite, java.util.Properties target, java.lang.String extensionName)
private void
doIncludes(java.io.File ubase, java.util.Properties p)
Inspect the properties and if you find -includes parse the line included manifest files or properties files.protected void
endHandleErrors(Processor previous)
End a command.Reporter.SetLocation
error(java.lang.String string, java.lang.Object... args)
Create an error.Reporter.SetLocation
error(java.lang.String format, java.lang.Throwable t, java.lang.Object... args)
Reporter.SetLocation
exception(java.lang.Throwable t, java.lang.String format, java.lang.Object... args)
Dedicated message for an exception.boolean
exists()
private java.lang.String
fileName(java.lang.String path)
static Processor.FileLine
findHeader(java.io.File f, java.lang.String header)
static Processor.FileLine
findHeader(java.io.File f, java.util.regex.Pattern header)
static Processor.FileLine
findHeader(java.io.File f, java.util.regex.Pattern header, java.util.regex.Pattern clause)
private void
fixupMessages()
Move errors and warnings to their proper place by scanning the fixup messages property.void
forceRefresh()
static java.lang.String
formatArrays(java.lang.String string, java.lang.Object... parms)
This method is the same as String.format but it makes sure that any arrays are transformed to strings.java.lang.String
get(java.lang.String key)
Overrides for the Domain classjava.lang.String
get(java.lang.String key, java.lang.String deflt)
java.io.File
getBase()
java.net.URI
getBaseURI()
java.lang.String
getChecksum()
A checksum based on the values of the propertiesjava.lang.Class<?>
getClass(java.lang.String type, java.io.File jar)
static long
getDuration(java.lang.String tm, long dflt)
java.util.List<java.lang.String>
getErrors()
Return the errors.static java.util.concurrent.Executor
getExecutor()
static java.io.File
getFile(java.io.File base, java.lang.String file)
java.io.File
getFile(java.lang.String file)
java.util.Properties
getFlattenedProperties()
Return the properties but expand all macros.java.util.Properties
getFlattenedProperties(boolean ignoreInstructions)
Return the properties but expand all macros.Processor.FileLine
getHeader(java.lang.String header)
Get a header relative to this processor, taking its parents and includes into account.Processor.FileLine
getHeader(java.lang.String header, java.lang.String clause)
Processor.FileLine
getHeader(java.util.regex.Pattern header)
Processor.FileLine
getHeader(java.util.regex.Pattern header, java.util.regex.Pattern clause)
private Processor.FileLine
getHeader0(java.util.regex.Pattern header, java.util.regex.Pattern clause)
java.util.List<java.io.File>
getIncluded()
void
getInfo(Reporter processor)
void
getInfo(Reporter processor, java.lang.String prefix)
<T> T
getInstructions(java.lang.Class<T> type)
Return an instance of an interface where each method is mapped to an instruction available from this Processor.Jar
getJarFromName(java.lang.String name, java.lang.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.java.lang.String
getJavaExecutable(java.lang.String java)
static int
getLine(java.lang.String s, int index)
private java.lang.String
getLiteralProperty(java.lang.String key, java.lang.String deflt, Processor source, boolean inherit)
protected Processor.CL
getLoader()
Report.Location
getLocation(java.lang.String msg)
Return the errors for the given error or warning.org.slf4j.Logger
getLogger()
protected java.lang.Object[]
getMacroDomains()
This should be overridden by subclasses to add extra macro command domains on the search list.static java.util.Properties
getManifestAsProperties(java.io.InputStream in)
Read a manifest but return a properties object.Parameters
getMergedParameters(java.lang.String key)
Get a Parameters from merged propertiesParameters
getParameters(java.lang.String key, boolean allowDuplicates)
Processor
getParent()
<T> T
getPlugin(java.lang.Class<T> clazz)
Returns the first plugin it can find of the given type.java.util.Set<java.lang.Object>
getPlugins()
Return a list of plugins.<T> java.util.List<T>
getPlugins(java.lang.Class<T> clazz)
Return a list of plugins that implement the given class.java.lang.String
getProfile()
static org.osgi.util.promise.PromiseFactory
getPromiseFactory()
java.util.Properties
getProperties()
Property handling ...private java.util.Properties
getProperties0()
java.io.File
getPropertiesFile()
java.lang.String
getProperty(java.lang.String key)
java.lang.String
getProperty(java.lang.String key, java.lang.String deflt)
Get a property with preprocessing it with a proper defaultjava.lang.String
getProperty(java.lang.String key, java.lang.String deflt, java.lang.String separator)
private java.lang.String
getProperty(java.lang.String key, java.lang.String deflt, java.lang.String separator, boolean inherit)
java.util.Set<java.lang.String>
getPropertyKeys(boolean inherit)
Return all inherited property keys.Macro
getReplacer()
static java.util.concurrent.ScheduledExecutorService
getScheduledExecutor()
java.util.List<java.io.File>
getSelfAndAncestors()
Return a list of all files that provide the properties for this Processor.private java.util.List<java.io.File>
getSelfAndAncestors(java.util.List<java.io.File> l)
void
getSettings(Processor p)
Copy the settings of another processorProcessor
getTop()
java.lang.String
getUnexpandedProperty(java.lang.String key)
java.lang.String
getUnprocessedProperty(java.lang.String key, java.lang.String deflt)
Get a property without preprocessing it with a proper defaultjava.util.List<java.lang.String>
getWarnings()
Return the warnings.private java.lang.String
getWildcardProperty(java.lang.String deflt, java.lang.String separator, boolean inherit, Instruction ins)
boolean
is(java.lang.String propertyName)
Simplified way to check booleansstatic boolean
isDuplicate(java.lang.String key)
boolean
isExceptions()
boolean
isFailOk()
Indicates that this run should ignore errors and succeed anywayboolean
isInteractive()
Return if this is an interactive environment like Eclipse or runs in batch mode.boolean
isMissingPlugin(java.lang.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()
(package private) boolean
isStrict()
If strict is true, then extra verification is done.boolean
isTrace()
static boolean
isTrue(java.lang.String value)
private java.lang.Iterable<java.lang.String>
iterable(boolean inherit, java.util.function.Predicate<java.lang.String> keyFilter)
java.util.Iterator<java.lang.String>
iterator()
static java.lang.String
join(java.lang.Object[] list, java.lang.String delimeter)
static java.lang.String
join(java.lang.String delimeter, java.util.Collection<?>... lists)
static java.lang.String
join(java.util.Collection<?> list)
Join a list.static java.lang.String
join(java.util.Collection<?>... lists)
static java.lang.String
join(java.util.Collection<?> list, java.lang.String delimeter)
static <T> java.lang.String
join(T[] list)
java.util.Set<java.lang.String>
keySet()
long
lastModified()
private java.lang.Object
loadPlugin(java.lang.ClassLoader loader, Attrs attrs, java.lang.String className, boolean ignoreError)
Load a plugin and customize it.private void
loadPluginPath(java.util.Set<java.lang.Object> instances, java.lang.String pluginPath, Processor.CL loader)
Add the @linkConstants.PLUGINPATH
entries (which are file names) to the class loader.protected void
loadPlugins(java.util.Set<java.lang.Object> instances, java.lang.String pluginString, java.lang.String pluginPathString)
Magic to load the plugins.java.util.Properties
loadProperties(java.io.File file)
Helper to load a properties file from disk.(package private) UTF8Properties
loadProperties0(java.io.File file)
Load Properties from disk.private Reporter.SetLocation
location(java.lang.String s)
static java.lang.Object
makePrintable(java.lang.Object object)
Check if the object is an array and turn it into a string if it is, otherwise unchanged.private static java.lang.Object[]
makePrintableArray(java.lang.Object array)
private java.lang.String
makeWildcard(java.lang.String key)
static java.lang.String
merge(java.lang.String... strings)
java.lang.String
mergeLocalProperties(java.lang.String key)
void
mergeProperties(java.io.File file, boolean override)
java.lang.String
mergeProperties(java.lang.String key)
Return merged properties.java.lang.String
mergeProperties(java.lang.String key, java.lang.String separator)
void
mergeProperties(java.util.Properties properties, boolean override)
static <K,V>
java.util.Map<K,V>newHashMap()
<T> java.util.List<T>
newList()
<T> java.util.List<T>
newList(java.util.Collection<T> t)
static <K,V>
java.util.Map<K,V>newMap()
<K,V>
java.util.Map<K,V>newMap(java.util.Map<K,V> t)
<T> java.util.Set<T>
newSet()
<T> java.util.Set<T>
newSet(java.util.Collection<T> t)
java.lang.String
normalize(java.io.File file)
java.lang.String
normalize(java.lang.String file)
Make the file short if it is inside our base directory, otherwise long.Parameters
parseHeader(java.lang.String value)
static Parameters
parseHeader(java.lang.String value, Processor logger)
Standard OSGi header parser.static void
printClause(java.util.Map<?,?> map, java.lang.StringBuilder sb)
static java.lang.String
printClauses(java.util.Map<?,? extends java.util.Map<?,?>> exports)
Print a standard Map based OSGi header.static java.lang.String
printClauses(java.util.Map<?,? extends java.util.Map<?,?>> exports, boolean checkMultipleVersions)
int
printExceptionSummary(java.lang.Throwable e, java.io.PrintStream out)
void
printStackTrace(java.lang.Throwable e, int count, java.io.PrintStream out)
void
progress(float progress, java.lang.String format, java.lang.Object... args)
Deprecated.Use SLF4J Logger.info() instead.void
progress(java.lang.String format, java.lang.Object... args)
void
propertiesChanged()
static boolean
quote(java.lang.Appendable sb, java.lang.String value)
static java.lang.String
read(java.io.InputStream in)
boolean
refresh()
void
removeBasicPlugin(java.lang.Object plugin)
void
removeClose(java.io.Closeable jar)
static java.lang.String
removeDuplicateMarker(java.lang.String key)
private boolean
removeIncluded(java.io.File file)
static java.util.Properties
replaceAll(java.util.Properties p, java.lang.String pattern, java.lang.String replacement)
Replace a string in all the values of the map.java.lang.String
replaceExtension(java.lang.String s, java.lang.String extension, java.lang.String newExtension)
Utiltity to replace an extensionprotected void
report(java.lang.Appendable out)
void
report(java.util.Map<java.lang.String,java.lang.Object> table)
Report the details of this processor.void
set(java.lang.String key, java.lang.String value)
void
setBase(java.io.File base)
void
setExceptions(boolean exceptions)
void
setFileMustExist(boolean mustexist)
void
setForceLocal(java.util.Collection<java.lang.String> local)
Reporter.SetLocation
setLocation(java.lang.String header, java.lang.String clause, Reporter.SetLocation setLocation)
void
setParent(Processor parent)
void
setPedantic(boolean pedantic)
void
setProperties(java.io.File propertiesFile)
Set the properties by file.void
setProperties(java.io.File propertiesFile, java.io.File base)
void
setProperties(java.io.File base, java.util.Properties properties)
void
setProperties(java.util.Properties properties)
void
setProperty(java.lang.String key, java.lang.String value)
Add or override a new property.void
setTrace(boolean x)
protected void
setTypeSpecificPlugins(java.util.Set<java.lang.Object> list)
void
signal()
boolean
since(Version introduced)
private static boolean
skipPrint(java.lang.String key)
static java.util.Collection<java.lang.String>
split(java.lang.String s)
static java.util.Collection<java.lang.String>
split(java.lang.String s, java.lang.String splitter)
static void
split(java.lang.String s, java.util.Collection<java.lang.String> collection)
java.util.Spliterator<java.lang.String>
spliterator()
(package private) java.util.stream.Stream<java.lang.String>
stream()
private java.util.stream.Stream<java.lang.String>
stream(boolean inherit)
java.lang.String
system(boolean allowFail, java.lang.String command, java.lang.String input)
java.lang.String
system(java.lang.String command, java.lang.String input)
static java.util.regex.Pattern
toFullHeaderPattern(java.lang.String header)
java.lang.String
toString()
Printout of the status of this processor for toString()void
trace(java.lang.String msg, java.lang.Object... parms)
Used to provide verbose commands(package private) void
tree(java.util.List<java.lang.String> list, java.io.File current, java.lang.String path, Instruction instr)
void
unsetProperty(java.lang.String string)
boolean
updateModified(long time, java.lang.String reason)
void
use(Processor reporter)
Reporter.SetLocation
warning(java.lang.String string, java.lang.Object... args)
Create a warning.-
Methods inherited from class aQute.bnd.osgi.Domain
copyFrom, domain, domain, domain, domain, domain, domain, domain, getBundleActivator, getBundleCategory, getBundleClasspath, getBundleClassPath, getBundleContactAddress, getBundleCopyright, getBundleDescription, getBundleDocURL, getBundleName, getBundleNative, getBundleRequiredExecutionEnvironment, getBundleSymbolicName, getBundleVendor, getBundleVersion, getDynamicImportPackage, getExportContents, getExportPackage, getFragmentHost, getIcon, getImportPackage, getIncludeResource, getParameters, getParameters, getParameters, getParameters, getPrivatePackage, getProvideCapability, getRequireBundle, getRequireCapability, getRunblacklist, getRunee, isSources, normalizeKey, setAugment, setBundleActivator, setBundleClasspath, setBundleRequiredExecutionEnvironment, setBundleSymbolicName, setBundleVersion, setBundleVersion, setConditionalPackage, setExportContents, setExportPackage, setFailOk, setImportPackage, setIncludePackage, setIncludeResource, setPrivatePackage, setRunblacklist, setRunee, setRunfw, setRunRequires, setSources, setTranslation, translate, translate
-
-
-
-
Field Detail
-
logger
private static final org.slf4j.Logger logger
-
log
public static Reporter log
-
BUFFER_SIZE
static final int BUFFER_SIZE
- See Also:
- Constant Field Values
-
current
static final java.lang.ThreadLocal<Processor> current
-
scheduledExecutor
private static final java.util.concurrent.ScheduledThreadPoolExecutor scheduledExecutor
-
executor
private static final java.util.concurrent.ThreadPoolExecutor executor
-
promiseFactory
private static final org.osgi.util.promise.PromiseFactory promiseFactory
-
random
static java.util.Random random
-
LIST_SPLITTER
public static final java.lang.String LIST_SPLITTER
- See Also:
- Constant Field Values
-
errors
final java.util.List<java.lang.String> errors
-
warnings
final java.util.List<java.lang.String> warnings
-
basicPlugins
final java.util.Set<java.lang.Object> basicPlugins
-
toBeClosed
private final java.util.Set<java.io.Closeable> toBeClosed
-
plugins
private java.util.Set<java.lang.Object> plugins
-
pedantic
boolean pedantic
-
trace
boolean trace
-
exceptions
boolean exceptions
-
fileMustExist
boolean fileMustExist
-
base
private java.io.File base
-
baseURI
private java.net.URI baseURI
-
properties
java.util.Properties properties
-
profile
java.lang.String profile
-
replacer
private Macro replacer
-
lastModified
private long lastModified
-
propertiesFile
private java.io.File propertiesFile
-
fixup
private boolean fixup
-
parent
Processor parent
-
included
private final java.util.concurrent.CopyOnWriteArrayList<java.io.File> included
-
pluginLoader
Processor.CL pluginLoader
-
filter
java.util.Collection<java.lang.String> filter
-
missingCommand
java.util.HashSet<java.lang.String> missingCommand
-
strict
java.lang.Boolean strict
-
fixupMessages
boolean fixupMessages
-
defaultConstructor
private static final java.lang.invoke.MethodType defaultConstructor
-
_uriHelp
static final java.lang.String _uriHelp
- See Also:
- Constant Field Values
-
DURATION_P
private static final java.util.regex.Pattern DURATION_P
-
locations
java.util.List<Report.Location> locations
Create a location object and add it to the locations
-
upto
Version upto
This method is about compatibility. New behavior can be conditionally introduced by calling this method and passing what version this behavior was introduced. This allows users of bnd to set the -upto instructions to the version that they want to be compatible with. If this instruction is not set, we assume the latest version.
-
_frangeHelp
static final java.lang.String _frangeHelp
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Processor
public Processor()
-
Processor
public Processor(java.util.Properties props)
-
Processor
public Processor(Processor parent)
-
Processor
public Processor(java.util.Properties props, boolean wrap)
-
Processor
public Processor(Processor parent, java.util.Properties props, boolean wrap)
-
-
Method Detail
-
setParent
public void setParent(Processor parent)
-
getParent
public Processor getParent()
-
getTop
public Processor getTop()
-
getInfo
public void getInfo(Reporter processor, java.lang.String prefix)
-
getInfo
public void getInfo(Reporter processor)
-
addAll
private void addAll(java.util.List<java.lang.String> to, java.util.List<java.lang.String> from, java.lang.String prefix, Reporter reporter)
-
current
private Processor current()
A processor can mark itself current for a thread.
-
warning
public Reporter.SetLocation warning(java.lang.String string, java.lang.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.
-
error
public Reporter.SetLocation error(java.lang.String string, java.lang.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.
-
progress
@Deprecated public void progress(float progress, java.lang.String format, java.lang.Object... args)
Deprecated.Use SLF4J Logger.info() instead.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.
-
progress
public void progress(java.lang.String format, java.lang.Object... args)
-
error
public Reporter.SetLocation error(java.lang.String format, java.lang.Throwable t, java.lang.Object... args)
-
exception
public Reporter.SetLocation exception(java.lang.Throwable t, java.lang.String format, java.lang.Object... args)
Description copied from interface:Reporter
Dedicated message for an exception.
-
printExceptionSummary
public int printExceptionSummary(java.lang.Throwable e, java.io.PrintStream out)
-
printStackTrace
public void printStackTrace(java.lang.Throwable e, int count, java.io.PrintStream out)
-
signal
public void signal()
-
getWarnings
public java.util.List<java.lang.String> getWarnings()
Description copied from interface:Report
Return the warnings. This list must not be changed and may be immutable.- Specified by:
getWarnings
in interfaceReport
- Returns:
- the warnings
-
getErrors
public java.util.List<java.lang.String> getErrors()
Description copied from interface:Report
Return the errors. This list must not be changed and may be immutable.
-
parseHeader
public static Parameters parseHeader(java.lang.String value, Processor logger)
Standard OSGi header parser.- Parameters:
value
-
-
parseHeader
public Parameters parseHeader(java.lang.String value)
-
addClose
public void addClose(java.io.Closeable jar)
-
removeClose
public void removeClose(java.io.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 interfaceReporter
- Returns:
- if this is a pedantic reporter.
-
setPedantic
public void setPedantic(boolean pedantic)
-
use
public void use(Processor reporter)
-
getFile
public static java.io.File getFile(java.io.File base, java.lang.String file)
-
getFile
public java.io.File getFile(java.lang.String file)
-
getPlugins
public <T> java.util.List<T> getPlugins(java.lang.Class<T> clazz)
Return a list of plugins that implement the given class.- Specified by:
getPlugins
in interfaceRegistry
- Parameters:
clazz
- Each returned plugin implements this class/interface- Returns:
- A list of plugins
-
getPlugin
public <T> T getPlugin(java.lang.Class<T> clazz)
Returns the first plugin it can find of the given type.
-
getPlugins
public java.util.Set<java.lang.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.
-
addExtensions
protected void addExtensions(java.util.Set<java.lang.Object> p)
Is called when all plugins are loaded- Parameters:
p
-
-
loadPlugins
protected void loadPlugins(java.util.Set<java.lang.Object> instances, java.lang.String pluginString, java.lang.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
-
-
loadPluginPath
private void loadPluginPath(java.util.Set<java.lang.Object> instances, java.lang.String pluginPath, Processor.CL loader)
Add the @linkConstants.PLUGINPATH
entries (which are file names) to the class loader. If this file does not exist, and there is aConstants.PLUGINPATH_URL_ATTR
attribute then we download it first from that url. You can then also specify aConstants.PLUGINPATH_SHA1_ATTR
attribute to verify the file.- Parameters:
pluginPath
- the clauses for the plugin pathloader
- The class loader to extend- See Also:
Constants.PLUGINPATH
-
loadPlugin
private java.lang.Object loadPlugin(java.lang.ClassLoader loader, Attrs attrs, java.lang.String className, boolean ignoreError)
Load a plugin and customize it. If the plugin cannot be loaded then we return null.- Parameters:
loader
- Name of the loaderattrs
-className
-
-
setTypeSpecificPlugins
protected void setTypeSpecificPlugins(java.util.Set<java.lang.Object> list)
-
customize
protected <T> T customize(T plugin, Attrs map)
Set the initial parameters of a plugin- Parameters:
plugin
-map
-
-
isFailOk
public boolean isFailOk()
Indicates that this run should ignore errors and succeed anyway
-
getBase
public java.io.File getBase()
-
getBaseURI
public java.net.URI getBaseURI()
-
setBase
public void setBase(java.io.File base)
-
clear
public void clear()
-
getLogger
public org.slf4j.Logger getLogger()
-
trace
public void trace(java.lang.String msg, java.lang.Object... parms)
Used to provide verbose commands
-
newList
public <T> java.util.List<T> newList()
-
newSet
public <T> java.util.Set<T> newSet()
-
newMap
public static <K,V> java.util.Map<K,V> newMap()
-
newHashMap
public static <K,V> java.util.Map<K,V> newHashMap()
-
newList
public <T> java.util.List<T> newList(java.util.Collection<T> t)
-
newSet
public <T> java.util.Set<T> newSet(java.util.Collection<T> t)
-
newMap
public <K,V> java.util.Map<K,V> newMap(java.util.Map<K,V> t)
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
_basedir
public java.lang.String _basedir(java.lang.String[] args)
-
_propertiesname
public java.lang.String _propertiesname(java.lang.String[] args)
-
_propertiesdir
public java.lang.String _propertiesdir(java.lang.String[] args)
-
_uri
public java.lang.String _uri(java.lang.String[] args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
_fileuri
public java.lang.String _fileuri(java.lang.String[] args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getProperties
public java.util.Properties getProperties()
Property handling ...
-
getProperties0
private java.util.Properties getProperties0()
-
getProperty
public java.lang.String getProperty(java.lang.String key)
-
getUnexpandedProperty
public java.lang.String getUnexpandedProperty(java.lang.String key)
-
mergeProperties
public void mergeProperties(java.io.File file, boolean override)
-
mergeProperties
public void mergeProperties(java.util.Properties properties, boolean override)
-
setProperties
public void setProperties(java.util.Properties properties)
-
setProperties
public void setProperties(java.io.File base, java.util.Properties properties)
-
addProperties
public void addProperties(java.io.File file) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addProperties
public void addProperties(java.util.Map<?,?> properties)
-
addIncluded
public void addIncluded(java.io.File file)
-
addIncludedIfAbsent
private boolean addIncludedIfAbsent(java.io.File file)
-
removeIncluded
private boolean removeIncluded(java.io.File file)
-
doIncludes
private void doIncludes(java.io.File ubase, java.util.Properties p)
Inspect the properties and if you find -includes parse the line included manifest files or properties files. The files are relative from the given base, this is normally the base for the analyzer.- Parameters:
ubase
-p
-- Throws:
java.io.IOException
-
doIncludeFile
public void doIncludeFile(java.io.File file, boolean overwrite, java.util.Properties target) throws java.lang.Exception
- Parameters:
file
-overwrite
-- Throws:
java.io.FileNotFoundException
java.io.IOException
java.lang.Exception
-
doIncludeFile
public void doIncludeFile(java.io.File file, boolean overwrite, java.util.Properties target, java.lang.String extensionName) throws java.lang.Exception
- Parameters:
file
-overwrite
-extensionName
-- Throws:
java.io.FileNotFoundException
java.io.IOException
java.lang.Exception
-
unsetProperty
public void unsetProperty(java.lang.String string)
-
refresh
public boolean refresh()
-
isStrict
boolean isStrict()
If strict is true, then extra verification is done.
-
forceRefresh
public void forceRefresh()
-
propertiesChanged
public void propertiesChanged()
-
setProperties
public void setProperties(java.io.File propertiesFile)
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
-
-
setProperties
public void setProperties(java.io.File propertiesFile, java.io.File base)
-
begin
protected void begin()
-
isTrue
public static boolean isTrue(java.lang.String value)
-
getUnprocessedProperty
public java.lang.String getUnprocessedProperty(java.lang.String key, java.lang.String deflt)
Get a property without preprocessing it with a proper default- Parameters:
key
-deflt
-
-
getProperty
public java.lang.String getProperty(java.lang.String key, java.lang.String deflt)
Get a property with preprocessing it with a proper default- Parameters:
key
-deflt
-
-
getProperty
public java.lang.String getProperty(java.lang.String key, java.lang.String deflt, java.lang.String separator)
-
getProperty
private java.lang.String getProperty(java.lang.String key, java.lang.String deflt, java.lang.String separator, boolean inherit)
-
getWildcardProperty
private java.lang.String getWildcardProperty(java.lang.String deflt, java.lang.String separator, boolean inherit, Instruction ins)
-
getLiteralProperty
private java.lang.String getLiteralProperty(java.lang.String key, java.lang.String deflt, Processor source, boolean inherit)
-
loadProperties
public java.util.Properties loadProperties(java.io.File file) throws java.io.IOException
Helper to load a properties file from disk.- Parameters:
file
-- Throws:
java.io.IOException
-
loadProperties0
UTF8Properties loadProperties0(java.io.File file) throws java.io.IOException
Load Properties from disk. The default encoding is ISO-8859-1 but nowadays all files are encoded with UTF-8. So we try to load it first as UTF-8 and if this fails we fail back to ISO-8859-1- Throws:
java.io.IOException
-
replaceAll
public static java.util.Properties replaceAll(java.util.Properties p, java.lang.String pattern, java.lang.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 java.lang.String printClauses(java.util.Map<?,? extends java.util.Map<?,?>> exports) throws java.io.IOException
Print a standard Map based OSGi header.- Parameters:
exports
- map { name => Map { attribute|directive => value } }- Returns:
- the clauses
- Throws:
java.io.IOException
-
printClauses
public static java.lang.String printClauses(java.util.Map<?,? extends java.util.Map<?,?>> exports, boolean checkMultipleVersions) throws java.io.IOException
- Throws:
java.io.IOException
-
printClause
public static void printClause(java.util.Map<?,?> map, java.lang.StringBuilder sb) throws java.io.IOException
- Throws:
java.io.IOException
-
skipPrint
private static boolean skipPrint(java.lang.String key)
-
quote
public static boolean quote(java.lang.Appendable sb, java.lang.String value) throws java.io.IOException
- Parameters:
sb
-value
-- Throws:
java.io.IOException
-
getReplacer
public Macro getReplacer()
-
getMacroDomains
protected java.lang.Object[] getMacroDomains()
This should be overridden by subclasses to add extra macro command domains on the search list.
-
getFlattenedProperties
public java.util.Properties getFlattenedProperties()
Return the properties but expand all macros. This always returns a new Properties object that can be used in any way.
-
getFlattenedProperties
public java.util.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.
-
getPropertyKeys
public java.util.Set<java.lang.String> getPropertyKeys(boolean inherit)
Return all inherited property keys. The keys are sorted for consistent ordering.
-
updateModified
public boolean updateModified(long time, java.lang.String reason)
-
lastModified
public long lastModified()
-
setProperty
public void setProperty(java.lang.String key, java.lang.String value)
Add or override a new property.- Parameters:
key
-value
-
-
getManifestAsProperties
public static java.util.Properties getManifestAsProperties(java.io.InputStream in) throws java.io.IOException
Read a manifest but return a properties object.- Parameters:
in
-- Throws:
java.io.IOException
-
getPropertiesFile
public java.io.File getPropertiesFile()
-
setFileMustExist
public void setFileMustExist(boolean mustexist)
-
read
public static java.lang.String read(java.io.InputStream in) throws java.lang.Exception
- Throws:
java.lang.Exception
-
join
public static java.lang.String join(java.util.Collection<?> list)
Join a list.
-
join
public static java.lang.String join(java.util.Collection<?> list, java.lang.String delimeter)
-
join
public static java.lang.String join(java.util.Collection<?>... lists)
-
join
public static java.lang.String join(java.lang.String delimeter, java.util.Collection<?>... lists)
-
join
public static java.lang.String join(java.lang.Object[] list, java.lang.String delimeter)
-
join
public static <T> java.lang.String join(T[] list)
-
split
public static void split(java.lang.String s, java.util.Collection<java.lang.String> collection)
-
split
public static java.util.Collection<java.lang.String> split(java.lang.String s)
-
split
public static java.util.Collection<java.lang.String> split(java.lang.String s, java.lang.String splitter)
-
merge
public static java.lang.String merge(java.lang.String... strings)
-
isExceptions
public boolean isExceptions()
-
setExceptions
public void setExceptions(boolean exceptions)
-
normalize
public java.lang.String normalize(java.lang.String file)
Make the file short if it is inside our base directory, otherwise long.- Parameters:
file
-
-
normalize
public java.lang.String normalize(java.io.File file)
-
removeDuplicateMarker
public static java.lang.String removeDuplicateMarker(java.lang.String key)
-
isDuplicate
public static boolean isDuplicate(java.lang.String key)
-
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.
-
fixupMessages
private void fixupMessages()
Move errors and warnings to their proper place by scanning the fixup messages property.
-
doFixup
private void doFixup(Instructions instrs, java.util.List<java.lang.String> messages, java.util.List<java.lang.String> other, java.lang.String type)
-
check
public boolean check(java.lang.String... pattern) throws java.io.IOException
- Throws:
java.io.IOException
-
report
protected void report(java.lang.Appendable out) throws java.io.IOException
- Throws:
java.io.IOException
-
isPerfect
public boolean isPerfect()
-
setForceLocal
public void setForceLocal(java.util.Collection<java.lang.String> local)
-
isMissingPlugin
public boolean isMissingPlugin(java.lang.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
-
-
appendPath
public static java.lang.String appendPath(java.lang.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(java.lang.Object[] attrs, Clazz clazz, Macro macro)
Parse the a=b strings and return a map of them.- Parameters:
attrs
-clazz
-
-
formatArrays
public static java.lang.String formatArrays(java.lang.String string, java.lang.Object... parms)
This method is the same as String.format but it makes sure that any arrays are transformed to strings.- Parameters:
string
-parms
-
-
makePrintable
public static java.lang.Object makePrintable(java.lang.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
-
makePrintableArray
private static java.lang.Object[] makePrintableArray(java.lang.Object array)
-
append
public static java.lang.String append(java.lang.String... strings)
-
getClass
public java.lang.Class<?> getClass(java.lang.String type, java.io.File jar) throws java.lang.Exception
- Throws:
java.lang.Exception
-
isTrace
public boolean isTrace()
-
getDuration
public static long getDuration(java.lang.String tm, long dflt)
-
_random
public java.lang.String _random(java.lang.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 java.lang.String _native_capability(java.lang.String... args) throws java.lang.Exception
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& lt;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:
java.lang.Exception
-
beginHandleErrors
protected Processor beginHandleErrors(java.lang.String message)
Set the current command thread. This must be balanced with theendHandleErrors(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 java.util.concurrent.Executor getExecutor()
-
getScheduledExecutor
public static java.util.concurrent.ScheduledExecutorService getScheduledExecutor()
-
getPromiseFactory
public static org.osgi.util.promise.PromiseFactory getPromiseFactory()
-
addBasicPlugin
public void addBasicPlugin(java.lang.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(java.lang.Object plugin)
-
getIncluded
public java.util.List<java.io.File> getIncluded()
-
get
public java.lang.String get(java.lang.String key)
Overrides for the Domain class
-
get
public java.lang.String get(java.lang.String key, java.lang.String deflt)
-
set
public void set(java.lang.String key, java.lang.String value)
-
stream
java.util.stream.Stream<java.lang.String> stream()
-
stream
private java.util.stream.Stream<java.lang.String> stream(boolean inherit)
-
iterator
public java.util.Iterator<java.lang.String> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<java.lang.String>
-
spliterator
public java.util.Spliterator<java.lang.String> spliterator()
- Specified by:
spliterator
in interfacejava.lang.Iterable<java.lang.String>
-
iterable
private java.lang.Iterable<java.lang.String> iterable(boolean inherit, java.util.function.Predicate<java.lang.String> keyFilter)
-
keySet
public java.util.Set<java.lang.String> keySet()
-
toString
public java.lang.String toString()
Printout of the status of this processor for toString()- Overrides:
toString
in classjava.lang.Object
-
replaceExtension
public java.lang.String replaceExtension(java.lang.String s, java.lang.String extension, java.lang.String newExtension)
Utiltity to replace an extension- Parameters:
s
-extension
-newExtension
-
-
setLocation
public Reporter.SetLocation setLocation(java.lang.String header, java.lang.String clause, Reporter.SetLocation setLocation)
-
location
private Reporter.SetLocation location(java.lang.String s)
-
getLocation
public Report.Location getLocation(java.lang.String msg)
Description copied from interface:Report
Return the errors for the given error or warning. Can return null.- Specified by:
getLocation
in interfaceReport
- Parameters:
msg
- The message- Returns:
- null or the location of the message
-
getHeader
public Processor.FileLine getHeader(java.lang.String header) throws java.lang.Exception
Get a header relative to this processor, taking its parents and includes into account.- Parameters:
header
-- Throws:
java.io.IOException
java.lang.Exception
-
toFullHeaderPattern
public static java.util.regex.Pattern toFullHeaderPattern(java.lang.String header)
-
getHeader
public Processor.FileLine getHeader(java.util.regex.Pattern header) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getHeader
public Processor.FileLine getHeader(java.lang.String header, java.lang.String clause) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getHeader
public Processor.FileLine getHeader(java.util.regex.Pattern header, java.util.regex.Pattern clause) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getHeader0
private Processor.FileLine getHeader0(java.util.regex.Pattern header, java.util.regex.Pattern clause) throws java.lang.Exception
- Throws:
java.lang.Exception
-
findHeader
public static Processor.FileLine findHeader(java.io.File f, java.lang.String header) throws java.io.IOException
- Throws:
java.io.IOException
-
findHeader
public static Processor.FileLine findHeader(java.io.File f, java.util.regex.Pattern header) throws java.io.IOException
- Throws:
java.io.IOException
-
findHeader
public static Processor.FileLine findHeader(java.io.File f, java.util.regex.Pattern header, java.util.regex.Pattern clause) throws java.io.IOException
- Throws:
java.io.IOException
-
getLine
public static int getLine(java.lang.String s, int index)
-
since
public boolean since(Version introduced)
-
report
public void report(java.util.Map<java.lang.String,java.lang.Object> table) throws java.lang.Exception
Report the details of this processor. Should in general be overridden- Parameters:
table
-- Throws:
java.lang.Exception
-
is
public boolean is(java.lang.String propertyName)
Simplified way to check booleans
-
mergeProperties
public java.lang.String mergeProperties(java.lang.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
-
mergeLocalProperties
public java.lang.String mergeLocalProperties(java.lang.String key)
-
mergeProperties
public java.lang.String mergeProperties(java.lang.String key, java.lang.String separator)
-
makeWildcard
private java.lang.String makeWildcard(java.lang.String key)
-
getMergedParameters
public Parameters getMergedParameters(java.lang.String key)
Get a Parameters from merged properties
-
concat
public <T> T[] concat(java.lang.Class<T> type, T[] prefix, T suffix)
Add an element to an array, creating a new one if necessary
-
getJarFromName
public Jar getJarFromName(java.lang.String name, java.lang.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 basefrom
- Message identifying the caller for errors- Returns:
- null or a Jar with the contents for the name
-
fileName
private java.lang.String fileName(java.lang.String path)
-
_thisfile
public java.lang.String _thisfile(java.lang.String[] args)
Return the name of the properties file
-
getSettings
public void getSettings(Processor p)
Copy the settings of another processor
-
_frange
public java.lang.String _frange(java.lang.String[] args)
Return a range expression for a filter from a version. By default this is based on consumer compatibility. You can specify a third argument (true) to get provider compatibility.${frange;1.2.3} -> (&(version>=1.2.3)(!(version>=2.0.0)) ${frange;1.2.3, true} -> (&(version>=1.2.3)(!(version>=1.3.0)) ${frange;[1.2.3,2.3.4)} -> (&(version>=1.2.3)(!(version>=2.3.4))
-
_findfile
public java.lang.String _findfile(java.lang.String[] args)
-
tree
void tree(java.util.List<java.lang.String> list, java.io.File current, java.lang.String path, Instruction instr)
-
getInstructions
public <T> T getInstructions(java.lang.Class<T> type)
Return an instance of an interface where each method is mapped to an instruction available from this Processor. SeeSyntaxAnnotation
for how to annotate this interface.
-
isInteractive
public boolean isInteractive()
Return if this is an interactive environment like Eclipse or runs in batch mode. If interactive, things can get refreshed.
-
getParameters
public Parameters getParameters(java.lang.String key, boolean allowDuplicates)
- Overrides:
getParameters
in classDomain
-
system
public java.lang.String system(boolean allowFail, java.lang.String command, java.lang.String input) throws java.io.IOException, java.lang.InterruptedException
- Throws:
java.io.IOException
java.lang.InterruptedException
-
system
public java.lang.String system(java.lang.String command, java.lang.String input) throws java.io.IOException, java.lang.InterruptedException
- Throws:
java.io.IOException
java.lang.InterruptedException
-
getJavaExecutable
public java.lang.String getJavaExecutable(java.lang.String java)
-
decorated
public Parameters decorated(java.lang.String key, boolean literalsIncluded)
Return a parameters that contains the merged properties of the given key and that is decorated by the merged properties of the key + '+'- Parameters:
key
- The key of the property
-
decorated
public Parameters decorated(java.lang.String key)
-
getProfile
public java.lang.String getProfile()
-
getChecksum
public java.lang.String getChecksum()
A checksum based on the values of the properties- Returns:
- A checksum based on the values of the properties
-
getSelfAndAncestors
public java.util.List<java.io.File> getSelfAndAncestors()
Return a list of all files that provide the properties for this Processor. This includes its own properties file, all included files, and the same for its ancestor Processor.The order of the list is parent?.getSelfAndAncestors(), includes, properties file
- Returns:
- a list of files that this processor depends on
-
getSelfAndAncestors
private java.util.List<java.io.File> getSelfAndAncestors(java.util.List<java.io.File> l)
-
-