Interface BuildContext
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
DefaultBuildContext
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe key for specifying the build extensions in the properties file.static final StringThe key for specifying the extensions snapshot repository in the properties file.static final StringThe key for specifying the common configuration and cache directory.static final StringThe key for specifying the builder directory in the properties file.static final StringThe key for specifying the builder version in the properties file. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the context.org.apache.commons.cli.CommandLineThe command line as processed by Apache Commons CLI.default PathThe path to the common cache directory.error()Returns aPrintStreamfor errors.default PathReturns the relative path from a project directory to the JDrupes Builder directory.out()Returns thePrintStreamfor the standard output.Returns the value of the given property.resources(ResourceProvider provider, ResourceRequest<T> request) Obtains the stream of resources of the given type from the given provider.Returns the status line for the current thread.
-
Field Details
-
JDBLD_DIRECTORY
The key for specifying the builder directory in the properties file.- See Also:
-
JDBLD_VERSION
The key for specifying the builder version in the properties file.- See Also:
-
BUILD_EXTENSIONS
The key for specifying the build extensions in the properties file.- See Also:
-
EXTENSIONS_SNAPSHOT_REPOSITORY
The key for specifying the extensions snapshot repository in the properties file.- See Also:
-
JDBLD_COMMON_DIRECTORY
The key for specifying the common configuration and cache directory.- See Also:
-
-
Method Details
-
jdbldDirectory
Returns the relative path from a project directory to the JDrupes Builder directory.- Returns:
- the path
-
commonCacheDirectory
The path to the common cache directory. This may be used by providers to cache information that is shared between projects. Providers must create a sub-directory of this directory, preferably with the same name FQN as the provider.- Returns:
- the path
-
commandLine
org.apache.commons.cli.CommandLine commandLine()The command line as processed by Apache Commons CLI.- Returns:
- the parsed command line
-
resources
Obtains the stream of resources of the given type from the given provider. The result from invoking the provider is evaluated asynchronously and cached. Only when the returned stream is terminated will the invocation block until the result from the provider becomes available.
To avoid duplicate invocations of a non-project provider, any intends are removed from the request before such a provider is invoked.
- Type Parameters:
T- the resource type- Parameters:
provider- the providerrequest- the request- Returns:
- the results
-
property
Returns the value of the given property. Properties are defined by (in order of precedence):
- command line options
- the file
.jdbld.propertiesin the directory of the root project - the file
.jdbld/jdbld.propertiesin the user's home directory
- Parameters:
name- the namedefaultValue- the default value- Returns:
- the string
-
statusLine
Returns the status line for the current thread. The status line may be used by
ResourceProviders to indicate progress during the execution ofResourceProviderSpi.provide(ResourceRequest). AStatusLineis automatically allocated by the context whenresources(ResourceProvider, ResourceRequest)is invoked.When called while not executing
resources(ResourceProvider, ResourceRequest), this method returns a dummy status line that discards all updates.- Returns:
- the status line
-
out
-
error
Returns aPrintStreamfor errors. The data is sent to the standard output stream as without(), but it is marked, typically in red, to indicate an error.- Returns:
- the prints the stream
-
close
void close()Close the context. The re-declaration of this method removes theIOException, which is never thrown.- Specified by:
closein interfaceAutoCloseable
-