public interface ResourcesGenerator
Extensions.
Although extensions resolve their functionality mainly on runtime,
some configuration resources such as XML schemas, service registration files,
spring bundles, or whatever resource the runtime requires need to be generated
in compile or run time.
Additionally, those resources might reference more than one
Extension,
for example, if a module registers many extensions,
we need only one service registration file for all of them.
This interface provides semantics to generate resources for many
Extensions which might share the
generated resources and when finished, dump all of the generated content to some persistent store.
To do so, implementations will work in tandem with instances of
GenerableResourceContributor which will be
obtained and injected by the platform.
Implementations are to be assumed not thread-safe and to be used in a
fire and forget fashion| Modifier and Type | Method and Description |
|---|---|
List<GeneratedResource> |
dumpAll()
Writes all the
GeneratedResources that were
generated through get(String) and writes them to a persistent store. |
void |
generateFor(Extension extension)
Generates resources for the given
extension. |
GeneratedResource |
get(String filepath)
Returns a
GeneratedResource that
will point to the given filepath. |
GeneratedResource get(String filepath)
GeneratedResource that
will point to the given filepath. If another extension already contributed
to that resource, then the same instance is returned. If no resource has been
contributed to yet, then it's created and registered.filepath - the path in which the resource is to be generatedGeneratedResourcevoid generateFor(Extension extension)
extension. This doesn't mean that
the resource will be generated and written to disk. It means that
the discovered instances of GenerableResourceContributor
will be asked to contribute resources for the given extension. The contributors
will use get(String) to get a hold of the resource in generation
and will contribute their part of the content. Nothing gets written to disk
until dumpAll() is invokedextension - a ExtensionList<GeneratedResource> dumpAll()
GeneratedResources that were
generated through get(String) and writes them to a persistent store.
The details of where and how those files are written are completely up to the implementation.GeneratedResource that was writtenCopyright © 2015 MuleSoft, Inc.. All rights reserved.