Package aQute.bnd.build
Class Workspace
- java.lang.Object
-
- aQute.bnd.osgi.Domain
-
- aQute.bnd.osgi.Processor
-
- aQute.bnd.build.Workspace
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
Workspace.CachedFileRepo
(package private) static class
Workspace.ResourceRepositoryStrategy
Strategy to use when creating a workspace ResourceRepository.(package private) class
Workspace.WorkspaceData
-
Nested classes/interfaces inherited from class aQute.bnd.osgi.Processor
Processor.CL, Processor.FileLine
-
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
_findprovidersHelp
(package private) static java.lang.String
_gestaltHelp
(package private) static java.lang.String
_globalHelp
(package private) static java.lang.String
_projectswhereHelp
Provide a macro that lists all currently loaded project names that match a macro.(package private) static java.lang.String
_repodigestsHelp
static java.lang.String
BND_CACHE_REPONAME
static java.io.File
BND_DEFAULT_WS
(package private) static int
BUFFER_SIZE
private java.io.File
buildDir
static java.lang.String
BUILDFILE
private static java.util.Map<java.io.File,java.lang.ref.WeakReference<Workspace>>
cache
static java.lang.String
CACHEDIR
static java.lang.String
CNFDIR
(package private) java.util.Map<java.lang.String,Action>
commands
private Workspace.WorkspaceData
data
private static java.lang.invoke.MethodType
defaultConstructor
private static Memoize<Processor>
defaults
private java.lang.String
driver
private static java.util.regex.Pattern
ESCAPE_P
static java.lang.String
EXT
private WorkspaceLayout
layout
(package private) static org.slf4j.Logger
logger
(package private) Maven
maven
(package private) WorkspaceNotifier
notifier
private java.util.concurrent.atomic.AtomicBoolean
offline
(package private) static java.lang.String
overallDriver
(package private) static Parameters
overallGestalt
private static java.lang.String
PLUGIN_STANDALONE
private ProjectTracker
projects
private static java.lang.ThreadLocal<java.lang.Boolean>
projectswhereCycleCheck
static boolean
remoteWorkspaces
(package private) ResourceRepositoryImpl
resourceRepositoryImpl
(package private) Settings
settings
(package private) java.lang.ThreadLocal<Reporter>
signalBusy
Signal a BndListener plugin.static java.lang.String
STANDALONE_REPO_CLASS
(package private) java.util.Set<Project>
trail
private static long
WORKSPACE_LOCK_DEFAULT_TIMEOUTMS
private WorkspaceLock
workspaceLock
(package private) WorkspaceRepository
workspaceRepo
-
Fields inherited from class aQute.bnd.osgi.Processor
LIST_SPLITTER, log
-
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, 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, CARDINALITY_DIRECTIVE, CDIANNOTATIONS, CHECK, CLASS_ATTRIBUTE, CLASSPATH, COMMAND_DIRECTIVE, COMPONENT_ACTIVATE, COMPONENT_CONFIGURATION_POLICY, COMPONENT_DEACTIVATE, COMPONENT_DESCRIPTORS, COMPONENT_DESIGNATE, COMPONENT_DESIGNATEFACTORY, COMPONENT_DIRECTIVES, COMPONENT_DIRECTIVES_1_1, COMPONENT_DIRECTIVES_1_2, 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, COMPRESSION, CONDITIONAL_PACKAGE, CONDITIONALPACKAGE, CONDUIT, CONNECTION_SETTINGS, CONSUMER_POLICY, CONTRACT, CREATED_BY, CURRENT_BUNDLESYMBOLICNAME, CURRENT_BUNDLEVERSION, CURRENT_PACKAGE, CURRENT_USES, CURRENT_VERSION, 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_HEADER, EXCLUDE_DIRECTIVE, EXECUTABLE, 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, LIBRARY, 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, 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, RESOLVE_EFFECTIVE, RESOLVE_EXCLUDESYSTEM, RESOLVE_PREFERENCES, RESOLVEDEBUG, RESOURCEONLY, RUNBLACKLIST, RUNBUILDS, RUNBUNDLES, RUNBUNDLES_STARTLEVEL_ATTRIBUTE, RUNEE, RUNENV, RUNFRAMEWORK, RUNFRAMEWORK_NONE, RUNFRAMEWORK_SERVICES, RUNFRAMEWORKRESTART, RUNFW, RUNJDB, RUNKEEP, RUNNOREFERENCES, RUNOPTIONS, RUNOPTIONS_EAGER, RUNPATH, RUNPROGRAMARGS, RUNPROPERTIES, RUNPROVIDEDCAPABILITIES, RUNREMOTE, RUNREPOS, 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, 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, TESTSOURCES, TESTTERMINATE, TESTUNRESOLVED, TOOL, TRANSITIVE_ATTRIBUTE, TSTAMP, UNDERTEST, UPTO, USES_DIRECTIVE, USES_USES, VALID_PROPERTY_TYPES, VERSION_ATTR_HASH, VERSION_ATTR_LATEST, VERSION_ATTR_PROJECT, VERSION_ATTR_SNAPSHOT, VERSION_ATTRIBUTE, VERSION_FILTER, VERSIONDEFAULTS, VISIBILITY_DIRECTIVE, WAB, WABLIB, WORKINGSET, WORKINGSET_MEMBER
-
-
Constructor Summary
Constructors Modifier Constructor Description private
Workspace(WorkspaceLayout layout)
Workspace(java.io.File workspaceDir)
Create a workspace on the given directory, assuming that it contains a cnf directory.Workspace(java.io.File workspaceDir, java.lang.String bndDir)
Create a workspace with the given directory and the bnd directory, normally cnf.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
_driver(java.lang.String[] args)
Macro to return the driver.java.lang.String
_findproviders(java.lang.String[] args)
A macro that returns a set of resources in bundle selection format from the repositories.java.lang.String
_gestalt(java.lang.String[] args)
The macro to access the gestaltjava.lang.String
_global(java.lang.String[] args)
Provide access to the global settings of this machine.java.lang.String
_projectswhere(java.lang.String[] args)
java.lang.Object
_repodigests(java.lang.String[] args)
Return the repository signature digests.java.lang.String
_user(java.lang.String[] args)
java.lang.String
_workspace(java.lang.String[] args)
void
addCommand(java.lang.String menu, Action action)
protected void
addExtensions(PluginsContainer pluginsContainer)
Add any extensions listedstatic void
addGestalt(java.lang.String part, Attrs attrs)
Add a gestalt to all workspaces.boolean
addPlugin(java.lang.Class<?> plugin, java.lang.String alias, java.util.Map<java.lang.String,java.lang.String> parameters, boolean force)
Add a pluginvoid
bracket(boolean begin)
void
changedFile(java.io.File f)
Inform any listeners that we changed a file (created/deleted/changed).void
checkStructure()
void
close()
static Workspace
createDefaultWorkspace()
Project
createProject(java.lang.String name)
Create a project in this workspacestatic Workspace
createStandaloneWorkspace(Processor run, java.net.URI base)
Create a workspace that does not inherit from a cnf directory etc.static Workspace
createWorkspace(java.io.File wsdir)
Create a new Workspaceboolean
doExtend(Processor processor)
Functions that the workspace likes to apply to its children before the properties are processed.private java.lang.Object
escaped(java.lang.String value)
void
fillActions(java.util.Map<java.lang.String,Action> all)
java.util.stream.Stream<org.osgi.resource.Capability>
findProviders(java.lang.String namespace, java.lang.String filter)
Find capability providers in the resources in the workspace's repositories.(package private) java.util.stream.Stream<org.osgi.resource.Capability>
findProviders(java.lang.String namespace, java.lang.String filter, Workspace.ResourceRepositoryStrategy strategy)
static Workspace
findWorkspace(java.io.File base)
/* Return the nearest workspaceprivate void
fixupVersionDefaults()
private void
forceInitialization()
void
forceRefreshProjects()
java.util.Collection<Project>
getAllProjects()
java.io.File
getBuildDir()
java.util.Collection<Project>
getBuildOrder()
private void
getBuildOrder(java.util.Collection<Project> dependsOn, java.util.Set<Project> result)
Result<java.io.File>
getBundle(java.lang.String bsn, Version version, java.util.Map<java.lang.String,java.lang.String> attrs)
Result<java.io.File>
getBundle(java.lang.String bsn, Version version, java.util.Map<java.lang.String,java.lang.String> attrs, Workspace.ResourceRepositoryStrategy strategy)
Result<java.io.File>
getBundle(org.osgi.resource.Resource resource)
Result<java.io.File>
getBundle(org.osgi.resource.Resource resource, Workspace.ResourceRepositoryStrategy strategy)
java.io.File
getCache(java.lang.String name)
java.util.Collection<Project>
getCurrentProjects()
static Processor
getDefaults()
java.lang.String
getDriver()
Get the bnddriver, can be null if not set.Result<java.io.File>
getExpandedInCache(java.lang.String urn, java.io.File file)
Get a cached directory of an inputstream to a Jar.Result<java.io.File>
getExpandedInCache(org.osgi.resource.Resource resource)
Get a cached directory of an expanded resource.WorkspaceExternalPluginHandler
getExternalPlugins()
Execute a function with a class from a plugin loaded from the repositories.Parameters
getGestalt()
Get the complete gestaltAttrs
getGestalt(java.lang.String part)
Get the attrs for a gestalt partorg.osgi.util.promise.Promise<java.util.List<RepositoryPlugin>>
getInitializedRepositories()
Get the repositories and ensure they are all ready.WorkspaceLayout
getLayout()
Get the layout style of the workspace.Maven
getMaven()
java.util.concurrent.atomic.AtomicBoolean
getOffline()
static Project
getProject(java.io.File projectDir)
This static method finds the workspace and creates a project (or returns an existing project)Project
getProject(java.lang.String bsn)
Project
getProjectFromFile(java.io.File projectDir)
java.util.List<RepositoryPlugin>
getRepositories()
RepositoryPlugin
getRepository(java.lang.String repo)
(package private) org.osgi.service.repository.Repository
getResourceRepository(Workspace.ResourceRepositoryStrategy strategy)
Return an aggregate repository of all the repositories to search.static Run
getRun(java.io.File file)
static Workspace
getWorkspace(java.io.File workspaceDir)
static Workspace
getWorkspace(java.io.File workspaceDir, java.lang.String bndDir)
static Workspace
getWorkspace(java.lang.String path)
WorkspaceRepository
getWorkspaceRepository()
Return the workspace repostatic Workspace
getWorkspaceWithoutException(java.io.File workspaceDir)
private java.util.List<RepositoryPlugin>
initRepositories()
boolean
isDefaultWorkspace()
boolean
isInteractive()
Return if this is an interactive environment like Eclipse or runs in batch mode.boolean
isOffline()
boolean
isPresent(java.lang.String name)
boolean
isValid()
private static <T> T
newInstance(java.lang.Class<T> rawClass)
OnWorkspace
on(java.lang.String ownerName)
Get a new notifier that receives notifications from the workspace & projects.void
open()
Open the workspace.void
propertiesChanged()
<T> T
readLocked(java.util.concurrent.Callable<T> callable)
<T> T
readLocked(java.util.concurrent.Callable<T> callable, long timeoutInMs)
<T> T
readLocked(java.util.concurrent.Callable<T> callable, java.util.function.BooleanSupplier canceled)
<T> T
readLocked(java.util.concurrent.Callable<T> callable, java.util.function.BooleanSupplier canceled, long timeoutInMs)
Lock the workspace for reading.boolean
refresh()
void
refresh(RepositoryPlugin repo)
private void
refreshData()
void
refreshProjects()
Signal that the driver has detected a dynamic change in the workspace directory, for example a project was added or removed in the IDE.void
removeCommand(java.lang.String menu)
boolean
removePlugin(java.lang.String alias)
(package private) void
removeProject(Project p)
void
report(java.util.Map<java.lang.String,java.lang.Object> table)
Report details of this workspacestatic void
resetStatic()
Result<java.util.Map<java.lang.String,java.util.List<BundleId>>>
search(java.lang.String partialFqn)
Search for a partial class name.Result<java.util.Map<java.lang.String,java.util.List<BundleId>>>
search(java.lang.String packageName, java.lang.String className)
Search for a class name inside particular package.void
setBuildDir(java.io.File buildDir)
static void
setDriver(java.lang.String driver)
Set the driver of this environmentvoid
setFileSystem(java.io.File workspaceDir, java.lang.String bndDir)
Workspace
setOffline(boolean on)
protected void
setTypeSpecificPlugins(PluginsContainer pluginsContainer)
void
signal()
void
signal(Reporter reporter)
void
syncCache()
java.lang.String
toString()
Printout of the status of this processor for toString()<T> T
writeLocked(java.util.concurrent.Callable<T> callable)
<T> T
writeLocked(java.util.concurrent.Callable<T> callable, long timeoutInMs)
<T> T
writeLocked(java.util.concurrent.Callable<T> callable, java.util.function.BooleanSupplier canceled)
<T> T
writeLocked(java.util.concurrent.Callable<T> callable, java.util.function.BooleanSupplier canceled, long timeoutInMs)
Lock the workspace for all functions including modification.-
Methods inherited from class aQute.bnd.osgi.Processor
_basedir, _fileuri, _findfile, _frange, _native_capability, _propertiesdir, _propertiesname, _random, _thisfile, _uri, addBasicPlugin, addClose, addIncluded, addProperties, addProperties, append, appendPath, begin, beginHandleErrors, check, clear, concat, customize, decorated, decorated, doAttrbutes, doIncludeFile, doIncludeFile, endHandleErrors, error, error, exception, exists, findHeader, findHeader, findHeader, forceRefresh, formatArrays, get, get, getBase, getBaseURI, getChecksum, getClass, getDuration, getErrors, getExecutor, getFile, getFile, getFlattenedProperties, getFlattenedProperties, getHeader, getHeader, getHeader, getHeader, getIncluded, getInfo, getInfo, getInstructions, getJarFromName, getJavaExecutable, getLine, getLoader, getLocation, getLogger, getMacroDomains, getManifestAsProperties, getMergedParameters, getParameters, getParent, getPlugin, getPlugins, getPlugins, getProfile, getPromiseFactory, getProperties, getPropertiesFile, getProperty, getProperty, getProperty, getPropertyKeys, getReplacer, getScheduledExecutor, getSelfAndAncestors, getSettings, getTop, getUnexpandedProperty, getUnprocessedProperty, getWarnings, is, isDuplicate, isExceptions, isFailOk, isMissingPlugin, isOk, isPedantic, isPerfect, isTrace, isTrue, iterator, join, join, join, join, join, join, keySet, lastModified, loadProperties, makePrintable, merge, mergeLocalProperties, mergeProperties, mergeProperties, mergeProperties, mergeProperties, newHashMap, newList, newList, newMap, newMap, newSet, newSet, normalize, normalize, parseHeader, parseHeader, printClause, printClauses, printClauses, printExceptionSummary, printStackTrace, progress, progress, quote, read, removeBasicPlugin, removeClose, removeDuplicateMarker, replaceAll, replaceExtension, report, set, setBase, setExceptions, setFileMustExist, setForceLocal, setLocation, setParent, setPedantic, setProperties, setProperties, setProperties, setProperties, setPropertiesFile, setProperty, setTrace, since, split, split, split, spliterator, system, system, toFullHeaderPattern, trace, unsetProperty, updateModified, use, 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
static final org.slf4j.Logger logger
-
BND_DEFAULT_WS
public static final java.io.File BND_DEFAULT_WS
-
BND_CACHE_REPONAME
public static final java.lang.String BND_CACHE_REPONAME
- See Also:
- Constant Field Values
-
EXT
public static final java.lang.String EXT
- See Also:
- Constant Field Values
-
BUILDFILE
public static final java.lang.String BUILDFILE
- See Also:
- Constant Field Values
-
CNFDIR
public static final java.lang.String CNFDIR
- See Also:
- Constant Field Values
-
CACHEDIR
public static final java.lang.String CACHEDIR
-
STANDALONE_REPO_CLASS
public static final java.lang.String STANDALONE_REPO_CLASS
- See Also:
- Constant Field Values
-
BUFFER_SIZE
static final int BUFFER_SIZE
- See Also:
- Constant Field Values
-
PLUGIN_STANDALONE
private static final java.lang.String PLUGIN_STANDALONE
- See Also:
- Constant Field Values
-
cache
private static final java.util.Map<java.io.File,java.lang.ref.WeakReference<Workspace>> cache
-
commands
final java.util.Map<java.lang.String,Action> commands
-
maven
final Maven maven
-
offline
private final java.util.concurrent.atomic.AtomicBoolean offline
-
settings
Settings settings
-
workspaceRepo
WorkspaceRepository workspaceRepo
-
overallDriver
static java.lang.String overallDriver
-
overallGestalt
static Parameters overallGestalt
-
signalBusy
final java.lang.ThreadLocal<Reporter> signalBusy
Signal a BndListener plugin. We ran an infinite bug loop :-(
-
resourceRepositoryImpl
ResourceRepositoryImpl resourceRepositoryImpl
-
driver
private java.lang.String driver
-
layout
private final WorkspaceLayout layout
-
trail
final java.util.Set<Project> trail
-
data
private volatile Workspace.WorkspaceData data
-
buildDir
private java.io.File buildDir
-
projects
private final ProjectTracker projects
-
workspaceLock
private final WorkspaceLock workspaceLock
-
WORKSPACE_LOCK_DEFAULT_TIMEOUTMS
private static final long WORKSPACE_LOCK_DEFAULT_TIMEOUTMS
- See Also:
- Constant Field Values
-
notifier
final WorkspaceNotifier notifier
-
remoteWorkspaces
public static boolean remoteWorkspaces
-
_globalHelp
static final java.lang.String _globalHelp
- See Also:
- Constant Field Values
-
_repodigestsHelp
static final java.lang.String _repodigestsHelp
- See Also:
- Constant Field Values
-
_gestaltHelp
static final java.lang.String _gestaltHelp
- See Also:
- Constant Field Values
-
defaultConstructor
private static final java.lang.invoke.MethodType defaultConstructor
-
ESCAPE_P
private static final java.util.regex.Pattern ESCAPE_P
-
_projectswhereHelp
static final java.lang.String _projectswhereHelp
Provide a macro that lists all currently loaded project names that match a macro. This macro checks for cycles since I am not sure if calling getAllProjects is safe for some macros in all cases. I.e. the primary use case wants to use it in -dependson${projectswhere;key;glob}
- See Also:
- Constant Field Values
-
projectswhereCycleCheck
private static final java.lang.ThreadLocal<java.lang.Boolean> projectswhereCycleCheck
-
_findprovidersHelp
static final java.lang.String _findprovidersHelp
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Workspace
public Workspace(java.io.File workspaceDir) throws java.lang.Exception
Create a workspace on the given directory, assuming that it contains a cnf directory. SeeWorkspace(File, String)
- Parameters:
workspaceDir
- the worksapce directory- Throws:
java.lang.Exception
-
Workspace
public Workspace(java.io.File workspaceDir, java.lang.String bndDir) throws java.lang.Exception
Create a workspace with the given directory and the bnd directory, normally cnf. (Though there are some use cases where this is in another place.) This will create aWorkspaceLayout.BND
layout set the base to the workspaceDir, and read the properties in the `build.bnd` file in the bndDir sub directory.This will read the version specific defaults after the properties are read from build.bnd in an _intermediate_ processor.
- Parameters:
workspaceDir
- the workspace directorybndDir
- the bnd directory with build.bnd- Throws:
java.lang.Exception
-
Workspace
private Workspace(WorkspaceLayout layout) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-
Method Detail
-
getProject
public static Project getProject(java.io.File projectDir) throws java.lang.Exception
This static method finds the workspace and creates a project (or returns an existing project)- Parameters:
projectDir
-- Throws:
java.lang.Exception
-
getDefaults
public static Processor getDefaults()
-
createDefaultWorkspace
public static Workspace createDefaultWorkspace() throws java.lang.Exception
- Throws:
java.lang.Exception
-
getWorkspace
public static Workspace getWorkspace(java.io.File workspaceDir) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getWorkspaceWithoutException
public static Workspace getWorkspaceWithoutException(java.io.File workspaceDir) throws java.lang.Exception
- Throws:
java.lang.Exception
-
findWorkspace
public static Workspace findWorkspace(java.io.File base) throws java.lang.Exception
/* Return the nearest workspace- Throws:
java.lang.Exception
-
getWorkspace
public static Workspace getWorkspace(java.io.File workspaceDir, java.lang.String bndDir) throws java.lang.Exception
- Throws:
java.lang.Exception
-
open
public void open()
Open the workspace. This will start sending events and, when interactive, might start some processes to create initial configuration like repos.
-
fixupVersionDefaults
private void fixupVersionDefaults() throws java.io.IOException
- Throws:
java.io.IOException
-
setFileSystem
public void setFileSystem(java.io.File workspaceDir, java.lang.String bndDir) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getProjectFromFile
public Project getProjectFromFile(java.io.File projectDir)
-
getProject
public Project getProject(java.lang.String bsn)
-
isPresent
public boolean isPresent(java.lang.String name)
-
refreshProjects
public void refreshProjects()
Signal that the driver has detected a dynamic change in the workspace directory, for example a project was added or removed in the IDE. Since this does not affect the inherited properties we can only change the list of projects.
-
forceRefreshProjects
public void forceRefreshProjects()
-
propertiesChanged
public void propertiesChanged()
- Overrides:
propertiesChanged
in classProcessor
-
forceInitialization
private void forceInitialization()
-
_workspace
public java.lang.String _workspace(java.lang.String[] args)
-
addCommand
public void addCommand(java.lang.String menu, Action action)
-
removeCommand
public void removeCommand(java.lang.String menu)
-
fillActions
public void fillActions(java.util.Map<java.lang.String,Action> all)
-
getAllProjects
public java.util.Collection<Project> getAllProjects()
-
getCurrentProjects
public java.util.Collection<Project> getCurrentProjects()
- See Also:
"Use getAllProjects() instead."
-
changedFile
public void changedFile(java.io.File f)
Inform any listeners that we changed a file (created/deleted/changed).- Parameters:
f
- The changed file
-
bracket
public void bracket(boolean begin)
-
signal
public void signal(Reporter reporter)
-
syncCache
public void syncCache() throws java.lang.Exception
- Throws:
java.lang.Exception
-
getRepositories
public java.util.List<RepositoryPlugin> getRepositories()
-
initRepositories
private java.util.List<RepositoryPlugin> initRepositories()
-
getInitializedRepositories
public org.osgi.util.promise.Promise<java.util.List<RepositoryPlugin>> getInitializedRepositories()
Get the repositories and ensure they are all ready.- Returns:
- a promise with the list of repos
-
getBuildOrder
public java.util.Collection<Project> getBuildOrder() throws java.lang.Exception
- Throws:
java.lang.Exception
-
getBuildOrder
private void getBuildOrder(java.util.Collection<Project> dependsOn, java.util.Set<Project> result) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getWorkspace
public static Workspace getWorkspace(java.lang.String path) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getMaven
public Maven getMaven()
-
setTypeSpecificPlugins
protected void setTypeSpecificPlugins(PluginsContainer pluginsContainer)
- Overrides:
setTypeSpecificPlugins
in classProcessor
-
addExtensions
protected void addExtensions(PluginsContainer pluginsContainer)
Add any extensions listed- Overrides:
addExtensions
in classProcessor
- Parameters:
pluginsContainer
-
-
isOffline
public boolean isOffline()
-
getOffline
public java.util.concurrent.atomic.AtomicBoolean getOffline()
-
setOffline
public Workspace setOffline(boolean on)
-
_global
public java.lang.String _global(java.lang.String[] args) throws java.lang.Exception
Provide access to the global settings of this machine.- Throws:
java.lang.Exception
-
_user
public java.lang.String _user(java.lang.String[] args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
_repodigests
public java.lang.Object _repodigests(java.lang.String[] args) throws java.lang.Exception
Return the repository signature digests. These digests are a unique id for the contents of the repository- Throws:
java.lang.Exception
-
getRun
public static Run getRun(java.io.File file) throws java.lang.Exception
- Throws:
java.lang.Exception
-
report
public void report(java.util.Map<java.lang.String,java.lang.Object> table) throws java.lang.Exception
Report details of this workspace
-
getCache
public java.io.File getCache(java.lang.String name)
-
getWorkspaceRepository
public WorkspaceRepository getWorkspaceRepository()
Return the workspace repo
-
checkStructure
public void checkStructure()
-
getBuildDir
public java.io.File getBuildDir()
-
setBuildDir
public void setBuildDir(java.io.File buildDir)
-
isValid
public boolean isValid()
-
getRepository
public RepositoryPlugin getRepository(java.lang.String repo) throws java.lang.Exception
- Throws:
java.lang.Exception
-
close
public void close()
-
refreshData
private void refreshData()
-
getDriver
public java.lang.String getDriver()
Get the bnddriver, can be null if not set. The overallDriver is the environment that runs this bnd.
-
setDriver
public static void setDriver(java.lang.String driver)
Set the driver of this environment
-
_driver
public java.lang.String _driver(java.lang.String[] args)
Macro to return the driver. Without any arguments, we return the name of the driver. If there are arguments, we check each of the arguments against the name of the driver. If it matches, we return the driver name. If none of the args match the driver name we return an empty string (which is false).
-
addGestalt
public static void addGestalt(java.lang.String part, Attrs attrs)
Add a gestalt to all workspaces. The gestalt is a set of parts describing the environment. Each part has a name and optionally attributes. This method adds a gestalt to the VM. Per workspace it is possible to augment this.
-
getGestalt
public Attrs getGestalt(java.lang.String part)
Get the attrs for a gestalt part
-
getGestalt
public Parameters getGestalt()
Get the complete gestalt
-
getLayout
public WorkspaceLayout getLayout()
Get the layout style of the workspace.
-
_gestalt
public java.lang.String _gestalt(java.lang.String[] args)
The macro to access the gestalt$ gestalt;part[;key[;value]]
-
toString
public java.lang.String toString()
Description copied from class:Processor
Printout of the status of this processor for toString()
-
addPlugin
public boolean addPlugin(java.lang.Class<?> plugin, java.lang.String alias, java.util.Map<java.lang.String,java.lang.String> parameters, boolean force) throws java.lang.Exception
Add a plugin- Parameters:
plugin
-- Throws:
java.lang.Exception
-
newInstance
private static <T> T newInstance(java.lang.Class<T> rawClass) throws java.lang.Exception
- Throws:
java.lang.Exception
-
escaped
private java.lang.Object escaped(java.lang.String value)
-
removePlugin
public boolean removePlugin(java.lang.String alias)
-
createStandaloneWorkspace
public static Workspace createStandaloneWorkspace(Processor run, java.net.URI base) throws java.lang.Exception
Create a workspace that does not inherit from a cnf directory etc.- Parameters:
run
-- Throws:
java.lang.Exception
-
isDefaultWorkspace
public boolean isDefaultWorkspace()
-
isInteractive
public boolean isInteractive()
Description copied from class:Processor
Return if this is an interactive environment like Eclipse or runs in batch mode. If interactive, things can get refreshed.- Overrides:
isInteractive
in classProcessor
-
resetStatic
public static void resetStatic()
-
createProject
public Project createProject(java.lang.String name) throws java.lang.Exception
Create a project in this workspace- Throws:
java.lang.Exception
-
removeProject
void removeProject(Project p) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createWorkspace
public static Workspace createWorkspace(java.io.File wsdir) throws java.lang.Exception
Create a new Workspace- Parameters:
wsdir
-- Throws:
java.lang.Exception
-
readLocked
public <T> T readLocked(java.util.concurrent.Callable<T> callable, java.util.function.BooleanSupplier canceled, long timeoutInMs) throws java.lang.Exception
Lock the workspace for reading. The callable parameter when called can freely use any read function in the workspace.- Parameters:
callable
- the Callable to runcanceled
- Has the operation been cancelled?timeoutInMs
- the timeout in milliseconds- Returns:
- the value of the lambda
- Throws:
java.lang.InterruptedException
- If the thread is interrupted while waiting for the lock.java.util.concurrent.TimeoutException
- If the lock was not obtained within the timeout period or the specified monitor is cancelled while waiting to obtain the lock.java.lang.Exception
- If the callable throws an exception.
-
readLocked
public <T> T readLocked(java.util.concurrent.Callable<T> callable, java.util.function.BooleanSupplier canceled) throws java.lang.Exception
- Throws:
java.lang.Exception
-
readLocked
public <T> T readLocked(java.util.concurrent.Callable<T> callable, long timeoutInMs) throws java.lang.Exception
- Throws:
java.lang.Exception
-
readLocked
public <T> T readLocked(java.util.concurrent.Callable<T> callable) throws java.lang.Exception
- Throws:
java.lang.Exception
-
writeLocked
public <T> T writeLocked(java.util.concurrent.Callable<T> callable, java.util.function.BooleanSupplier canceled, long timeoutInMs) throws java.lang.Exception
Lock the workspace for all functions including modification. The callable parameter when called can freely use any function in the workspace.- Parameters:
callable
- the Callable to runcanceled
- Has the operation been cancelled?timeoutInMs
- the timeout in milliseconds- Returns:
- the value of the lambda
- Throws:
java.lang.InterruptedException
- If the thread is interrupted while waiting for the lock.java.util.concurrent.TimeoutException
- If the lock was not obtained within the timeout period or the specified monitor is cancelled while waiting to obtain the lock.java.lang.Exception
- If the callable throws an exception.
-
writeLocked
public <T> T writeLocked(java.util.concurrent.Callable<T> callable, java.util.function.BooleanSupplier canceled) throws java.lang.Exception
- Throws:
java.lang.Exception
-
writeLocked
public <T> T writeLocked(java.util.concurrent.Callable<T> callable, long timeoutInMs) throws java.lang.Exception
- Throws:
java.lang.Exception
-
writeLocked
public <T> T writeLocked(java.util.concurrent.Callable<T> callable) throws java.lang.Exception
- Throws:
java.lang.Exception
-
_projectswhere
public java.lang.String _projectswhere(java.lang.String[] args)
-
refresh
public void refresh(RepositoryPlugin repo)
-
search
public Result<java.util.Map<java.lang.String,java.util.List<BundleId>>> search(java.lang.String partialFqn) throws java.lang.Exception
Search for a partial class name. The partialFqn name may be a simple class name (Foo) or a fully qualified class name line (foo.bar.Foo), including nested classes, or only a package name prefix (foo.bar or even foo.ba).This method uses the heuristic in
determine()
to split the package name from the (possibly nested) class name - the start of the class name is taken as the first element that starts with a capital letter. This heuristic works fine in most cases, but it is not foolproof. In contexts where you have a better idea of how to separate the package name from the class name, you can usesearch(String, String)
for this purpose.- Parameters:
partialFqn
- a packagename ( '.' classname )*- Returns:
- a multi-map containing the search matches with the matching fully-qualified class name as each entry's key, and a list of matching bundles as the value.
- Throws:
java.lang.Exception
- See Also:
search(String, String)
-
search
public Result<java.util.Map<java.lang.String,java.util.List<BundleId>>> search(java.lang.String packageName, java.lang.String className) throws java.lang.Exception
Search for a class name inside particular package. Use this in preference tosearch(String)
when you know that the qualifier resolves to a package and not to a class.- Parameters:
packageName
- the package to searchclassName
- a classname ( '.' classname )*- Returns:
- a multi-map containing the search matches with the matching fully-qualified class name as each entry's key, and a list of matching bundles as the value.
- Throws:
java.lang.Exception
- See Also:
search(String)
-
getResourceRepository
org.osgi.service.repository.Repository getResourceRepository(Workspace.ResourceRepositoryStrategy strategy) throws java.lang.Exception
Return an aggregate repository of all the repositories to search. This resource repository must be obtained for each operation, it might become stale over time.- Parameters:
strategy
- Strategy to use for which repositories to search.- Returns:
- an aggregate repository
- Throws:
java.lang.Exception
-
_findproviders
public java.lang.String _findproviders(java.lang.String[] args) throws java.lang.Exception
A macro that returns a set of resources in bundle selection format from the repositories. For example:${findproviders;osgi.wiring.package;(osgi.wiring.package=aQute.bnd.build);ALL}
- Throws:
java.lang.Exception
-
findProviders
public java.util.stream.Stream<org.osgi.resource.Capability> findProviders(java.lang.String namespace, java.lang.String filter) throws java.lang.Exception
Find capability providers in the resources in the workspace's repositories.- Parameters:
namespace
- Capability namespace.filter
- Filter expression to limit the capabilities. Optional, may benull
or an empty string.- Returns:
- A stream of capabilities found. May be an empty stream.
- Throws:
java.lang.Exception
-
findProviders
java.util.stream.Stream<org.osgi.resource.Capability> findProviders(java.lang.String namespace, java.lang.String filter, Workspace.ResourceRepositoryStrategy strategy) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getExternalPlugins
public WorkspaceExternalPluginHandler getExternalPlugins()
Execute a function with a class from a plugin loaded from the repositories. SeeWorkspaceExternalPluginHandler
.
-
getBundle
public Result<java.io.File> getBundle(org.osgi.resource.Resource resource)
-
getBundle
public Result<java.io.File> getBundle(org.osgi.resource.Resource resource, Workspace.ResourceRepositoryStrategy strategy)
-
getBundle
public Result<java.io.File> getBundle(java.lang.String bsn, Version version, java.util.Map<java.lang.String,java.lang.String> attrs)
-
getBundle
public Result<java.io.File> getBundle(java.lang.String bsn, Version version, java.util.Map<java.lang.String,java.lang.String> attrs, Workspace.ResourceRepositoryStrategy strategy)
-
on
public OnWorkspace on(java.lang.String ownerName)
Get a new notifier that receives notifications from the workspace & projects. This object should be closed if it is not longer needed.
-
doExtend
public boolean doExtend(Processor processor)
Functions that the workspace likes to apply to its children before the properties are processed. I.e. this should be called inProcessor.propertiesChanged()
This is initially used to do the library functionality but it is open for others where the properties might be affected after some initial processing.
- Parameters:
processor
- the processor to augment- Returns:
- true if the properties were changed
-
getExpandedInCache
public Result<java.io.File> getExpandedInCache(org.osgi.resource.Resource resource)
Get a cached directory of an expanded resource. The resource must be a JAR file.- Parameters:
resource
- a resource- Returns:
- a result with the directory or an error
-
getExpandedInCache
public Result<java.io.File> getExpandedInCache(java.lang.String urn, java.io.File file) throws java.io.IOException
Get a cached directory of an inputstream to a Jar.- Parameters:
urn
- A unique resource name of the structure 'urn:' scheme ':' ...file
- an file of a Jar- Returns:
- a result with the directory or an error
- Throws:
java.io.IOException
-
-