queries, or sources of concrete information, useful throughout the build system and perhaps elsewhere.
General "queries" or communication channels pertaining to aspects of how files are used and related.
Permits query implementations to be registered.
The General Queries API provides generic
queries, or sources of
concrete information, useful throughout the build system and perhaps
elsewhere. Each query is split into an API component intended for clients to
find the answer to a particular question without knowledge of the underlying
structure or origin of the answer; and an SPI interface (using lookup)
permitting answers to be provided from any source. These queries currently
pertain to VCS and compilation status and user visibility of files.
Added a new query
VersioningQuery which provides Versioning relevant info like
e.g. if a particular file is managed by a Versioning System.
Added new class
VisibilityQueryChangeEvent which extends
ChangeEvent and can be used by
to fire a change event with additional information attached.
ChangeListener implementions listening on
VisibilityQuery can then check the
event's type when it arrives and use the additional information to their advantage.
Added new methods CollocationQuery.areCollocated(URI, URI) and CollocationQuery.findRoot(URI). Methods query all CollocationQueryImplementation (if possible) and CollocationQueryImplementation2 instances found in global lookup. Deprecated existing methods CollocationQuery.areCollocated(File, File) and CollocationQuery.findRoot(File). Methods query all CollocationQueryImplementation and CollocationQueryImplementation2 instances found in global lookup.
Added new methods SharabilityQuery.getSharability(URI) and SharabilityQuery.getSharability(FileObject). Methods query all SharabilityQueryImplementation (if possible) and SharabilityQueryImplementation2 instances found in global lookup. Deprecated existing method SharabilityQuery.getSharability(File). Method query all SharabilityQueryImplementation and SharabilityQueryImplementation2 instances found in global lookup.
Added new method VisibilityQuery.isVisible(File). It queries all VisibilityQueryImplementation instances found in global lookup. If such instance implements VisibilityQueryImplementation2, it's isVisible(File) method is used directly. If not, it attempts to delegate to the isVisible(FileObject) method. That might not work for non-existing files. All implementations of VisibilityQueryImplementation are encouraged to upgrade to VisibilityQueryImplementation2.
Whenever someone queries for encoding of a file object on default file system (e.g. the one that is provided by layers), it will get UTF-8 as the default encoding and not the system one. As a result all resources on layers should be in UTF-8 encoding.
Particular use cases are enumerated in the Javadoc for each query API. Usage consists of simple static method calls. Potentially a wide variety of modules could use these queries; implementations are typically registered by project type providers, though also by Java library and platform implementations.
Read more about the implementation in the answers to architecture questions.