- All Implemented Interfaces:
- org.azyva.dragom.model.plugin.ClassificationNodePlugin, org.azyva.dragom.model.plugin.FindModuleByArtifactGroupIdPlugin, org.azyva.dragom.model.plugin.NodePlugin
public class SimpleFindModuleByArtifactGroupIdPluginImpl
extends ClassificationNodePluginAbstractImpl
implements org.azyva.dragom.model.plugin.FindModuleByArtifactGroupIdPlugin
Factory for FindModuleByArtifactGroupIdPlugin that assumes a simple equivalence
between a module node path and the ArtifactGroupId using inference
rules.
The value of the property BASE_GROUP_ID is used as the base groupId. Then each
node name in the node path (up to but not the module name) is converted into an
element of the groupId. The conversion algorithm is to convert from PascalCase
to lowercase-with-dash notation.
The groupId obtained must match the groupId of the ArtifactGroupId specified.
Then the plugin constructs a list of module node paths all using the same node
path associated with the plugin. The module names start with the artifactId of
the ArtifactGroupId specified and reduce down to the base artifactId based on -
separating the tokens.
For example if the value of the BASE_GROUP_ID property is com.acme and the node
node path associated with the plugin is Foo/Bar/PascalCaseNodeName/, then only
ArtifactGroupId whose groupId is com.acme.foo.bar.pascal-case-node-name are
considered.
Then if the artifactId of the ArtifactGroupId specified is
my-module-submodule-name-with-many-tokens, the list of NodePath
returned will be in that order:
- Foo/Bar/PascalCaseNodeName/my-module-submodule-name-with-many-tokens
- Foo/Bar/PascalCaseNodeName/my-module-submodule-name-with-many
- Foo/Bar/PascalCaseNodeName/my-module-submodule-name-with
- Foo/Bar/PascalCaseNodeName/my-module-submodule-name
- Foo/Bar/PascalCaseNodeName/my-module-submodule
- Foo/Bar/PascalCaseNodeName/my-module
- Foo/Bar/PascalCaseNodeName/my
If one module in that list already exists (is already created), it will be
returned. If none of the modules already exist, they will be requested one by
one in order and for each of them that actually exist, they will be asked if
their build produces the specified ArtifactGroupId. Among the above list if we
try to make some sense of the module names, it is likely that only the module
whose name is my-module exists and that it will respond that ArtifactGroupId
com.acme.foo.bar.pascal-case-node-name:my-module-submodule-name-with-many-tokens
can possibly be produced. In such a case, this is the module that will be
returned. Alternatively, it may be possible that a module named
my-module-submodule-name-with-many-tokens exists which says it definitively
produces ArtifactGroupId
com.acme.foo.bar.pascal-cas-node-name:my-module-submodule-name-with-many-tokens
in which case this moduel will be returned instead since it appears before in
the list.
- Author:
- David Raymond