public abstract class RootModuleVersionJobAbstractImpl extends Object
ModuleVersion's and
which traverse the reference graph by checking out the ModuleVersion
source code and using ReferenceManagerPlugin and other
(@link NodePlugin}'s to obtain Reference's.
It factors out code that is often encountered in these types of tasks.
After validating the root ModuleVersion's, it iterates over them. For each
ModuleVersion it calls visitModuleVersion(org.azyva.dragom.reference.Reference, org.azyva.dragom.apiutil.ByReference<org.azyva.dragom.model.Version>).
This class does not attempt to completely encapsulate its implementation. It has protected instance variables available to subclasses to simplify implementation.
| Modifier and Type | Class and Description |
|---|---|
static class |
RootModuleVersionJobAbstractImpl.UnsyncChangesBehavior
Possible behaviors related to unsynchronized changes in a user working
directory.
|
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
indAvoidReentry
Indicates that
visitModuleVersion(org.azyva.dragom.reference.Reference, org.azyva.dragom.apiutil.ByReference<org.azyva.dragom.model.Version>) avoids reentry by using
ModuleReentryAvoider. |
protected boolean |
indDepthFirst
Indicates that traversal must be depth first, as opposed to parent first.
|
protected boolean |
indHandleDynamicVersion
Indicates that dynamic
Version's must be considered during the
traversal of the reference graphs. |
protected boolean |
indHandleStaticVersion
Indicates that static
Version's must be considered during the
traversal of the reference graphs. |
protected boolean |
indListModuleVersionRootChanged
Indicates that the List of root
ModuleVersion passed to the constructor
was changed and should be saved by the caller if persisted. |
protected List<String> |
listActionsPerformed
Used to accumulate a description for the actions performed.
|
protected List<org.azyva.dragom.model.ModuleVersion> |
listModuleVersionRoot
List root ModuleVersion's on which to initiate the traversal of the reference
graphs.
|
protected ModuleReentryAvoider |
moduleReentryAvoider
|
protected static String |
MSG_PATTERN_KEY_ACTIONS_PERFORMED
See description in ResourceBundle.
|
protected static String |
MSG_PATTERN_KEY_CANNOT_PROCEED_WITH_UNSYNC_LOCAL_CHANGES
See description in ResourceBundle.
|
protected static String |
MSG_PATTERN_KEY_CONFLICTS_WHILE_UPDATING
See description in ResourceBundle.
|
protected static String |
MSG_PATTERN_KEY_DO_YOU_WANT_TO_UPDATE_UNSYNC_REMOTE_CHANGES
See description in ResourceBundle.
|
protected static String |
MSG_PATTERN_KEY_INITIATING_TRAVERSAL_REFERENCE_GRAPH_ROOT_MODULE_VERSION
See description in ResourceBundle.
|
protected static String |
MSG_PATTERN_KEY_MODULE_VERSION_ALREADY_PROCESSED
See description in ResourceBundle.
|
protected static String |
MSG_PATTERN_KEY_MULTIPLE_WORKSPACE_DIRECTORIES_FOR_MODULE
See description in ResourceBundle.
|
protected static String |
MSG_PATTERN_KEY_NO_ACTIONS_PERFORMED
See description in ResourceBundle.
|
protected static String |
MSG_PATTERN_KEY_ROOT_MODULE_VERSION_NOT_KNOWN
See description in ResourceBundle.
|
protected static String |
MSG_PATTERN_KEY_TRAVERSAL_REFERENCE_GRAPH_ROOT_MODULE_VERSION_COMPLETED
See description in ResourceBundle.
|
protected static String |
MSG_PATTERN_KEY_UPDATE_CHANGED_ROOT_MODULE_VERSION
See description in ResourceBundle.
|
protected static String |
MSG_PATTERN_KEY_UPDATE_ROOT_MODULE_VERSION_TO_DEFAULT
See description in ResourceBundle.
|
protected static String |
MSG_PATTERN_KEY_UPDATE_ROOT_MODULE_VERSION_TO_WORKSPACE_DIRECTORY_VERSION
See description in ResourceBundle.
|
protected static String |
MSG_PATTERN_KEY_UPDATING
See description in ResourceBundle.
|
protected static String |
MSG_PATTERN_KEY_VERSION_DOES_NOT_EXIST
See description in ResourceBundle.
|
protected static String |
MSG_PATTERN_KEY_VISITING_LEAF_MODULE_VERSION
See description in ResourceBundle.
|
protected static String |
MSG_PATTERN_KEY_VISITING_LEAF_REFERENCE_MATCHED
See description in ResourceBundle.
|
protected org.azyva.dragom.reference.ReferencePath |
referencePath
Subclasses can use this variable during the traversal of a reference graph to
maintain the current ReferencePath being visited.
|
protected static ResourceBundle |
resourceBundle
ResourceBundle specific to this class.
|
protected static String |
RUNTIME_PROPERTY_PROJECT_CODE
Runtime property specifying a project code which many job honour when
traversing
ReferenceGraph's. |
protected static String |
RUNTIME_PROPERTY_SYNC_WORKSPACE_DIR
Runtime property of the type
AlwaysNeverYesNoAskUserResponse indicating
whether to synchronize the workspace directory when unsynced remote changes
exist. |
protected RootModuleVersionJobAbstractImpl.UnsyncChangesBehavior |
unsyncChangesBehaviorLocal
Specifies the behavior related to unsynchronized local changes.
|
protected RootModuleVersionJobAbstractImpl.UnsyncChangesBehavior |
unsyncChangesBehaviorRemote
Specifies the behavior related to unsynchronized remote changes.
|
| Modifier | Constructor and Description |
|---|---|
protected |
RootModuleVersionJobAbstractImpl(List<org.azyva.dragom.model.ModuleVersion> listModuleVersionRoot)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterIterateListModuleVersionRoot()
Called by
performJob(). |
protected void |
beforeIterateListModuleVersionRoot()
Called by
performJob(). |
protected void |
beforeValidateListModuleVersionRoot()
Called by
performJob(). |
protected String |
getProjectCode() |
protected org.azyva.dragom.reference.ReferencePathMatcher |
getReferencePathMatcher() |
boolean |
isListModuleVersionRootChanged() |
protected void |
iterateListModuleVersionRoot()
Called by
performJob() to iterate through the List of root
ModuleVersion's calling visitModuleVersion for each root ModuleVersion. |
void |
performJob()
Main method for performing the job.
|
protected void |
setIndAvoidReentry(boolean indAvoidReentry) |
protected void |
setIndDepthFirst(boolean indDepthFirst) |
protected void |
setIndHandleDynamicVersion(boolean indHandleDynamicVersion) |
protected void |
setIndHandleStaticVersion(boolean indHandleStaticVersion) |
protected void |
setIndListModuleVersionRootChanged()
Called by methods of this class or subclasses to indicate that the List of root
ModuleVersion passed to the constructor was changed and should be
saved by the caller if persisted. |
void |
setReferencePathMatcherProvided(org.azyva.dragom.reference.ReferencePathMatcher referencePathMatcherProvided)
Sets the
ReferencePathMatcher profided by the caller defining on which
ModuleVersion's in the reference graphs the job will be applied. |
void |
setUnsyncChangesBehaviorLocal(RootModuleVersionJobAbstractImpl.UnsyncChangesBehavior unsyncChangesBehaviorLocal) |
void |
setUnsyncChangesBehaviorRemote(RootModuleVersionJobAbstractImpl.UnsyncChangesBehavior unsyncChangesBehaviorRemote) |
protected void |
setupReferencePathMatcherForProjectCode()
Setup the
ReferencePathMatcher so that only ModuleVersion's
having the Version attribute dragom-project-code equal to that
defined by the runtime property PROJECT_CODE are matched. |
protected void |
validateListModuleVersionRoot()
Called by
performJob() to validate the root ModuleVersion's. |
protected boolean |
visitMatchedModuleVersion(org.azyva.dragom.reference.Reference reference)
Called by
visitModuleVersion(org.azyva.dragom.reference.Reference, org.azyva.dragom.apiutil.ByReference<org.azyva.dragom.model.Version>) for each matched
ModuleVersion. |
protected boolean |
visitModuleVersion(org.azyva.dragom.reference.Reference reference,
org.azyva.dragom.apiutil.ByReference<org.azyva.dragom.model.Version> byReferenceVersion)
This method is called for each root
ModuleVersion. |
protected static final String RUNTIME_PROPERTY_SYNC_WORKSPACE_DIR
AlwaysNeverYesNoAskUserResponse indicating
whether to synchronize the workspace directory when unsynced remote changes
exist.protected static final String RUNTIME_PROPERTY_PROJECT_CODE
ReferenceGraph's.
This provides a matching mechanism for ModuleVersion's within a
ReferenceGraph. It also has impacts on Version creations.
The idea is that in some cases, Dragom will be used to manage ReferenceGraph's
in the context of a project, in the sense of a time-constrained development
effort. When switching to dynamic Version's of Module's,
(@link SwitchToDynamicVesion} can optionnally specify a project code as a
Version attribute for newly created dynamic Versions. Similarly with
Release for static Versions. And for may other jobs which traverse
a ReferenceGraph (Checkout, MergeMain, etc.), this same project
code specified by this runtime property is used for matching
ModuleVersion's based on their Version's project code attribute, in
addition to the matching performed by ReferencePathMatcher's
(implied "and").
Accessed on the root ClassificationNode.
protected static final String MSG_PATTERN_KEY_ROOT_MODULE_VERSION_NOT_KNOWN
protected static final String MSG_PATTERN_KEY_MULTIPLE_WORKSPACE_DIRECTORIES_FOR_MODULE
protected static final String MSG_PATTERN_KEY_UPDATE_ROOT_MODULE_VERSION_TO_WORKSPACE_DIRECTORY_VERSION
protected static final String MSG_PATTERN_KEY_UPDATE_ROOT_MODULE_VERSION_TO_DEFAULT
protected static final String MSG_PATTERN_KEY_VERSION_DOES_NOT_EXIST
protected static final String MSG_PATTERN_KEY_INITIATING_TRAVERSAL_REFERENCE_GRAPH_ROOT_MODULE_VERSION
protected static final String MSG_PATTERN_KEY_TRAVERSAL_REFERENCE_GRAPH_ROOT_MODULE_VERSION_COMPLETED
protected static final String MSG_PATTERN_KEY_UPDATE_CHANGED_ROOT_MODULE_VERSION
protected static final String MSG_PATTERN_KEY_VISITING_LEAF_MODULE_VERSION
protected static final String MSG_PATTERN_KEY_CANNOT_PROCEED_WITH_UNSYNC_LOCAL_CHANGES
protected static final String MSG_PATTERN_KEY_DO_YOU_WANT_TO_UPDATE_UNSYNC_REMOTE_CHANGES
protected static final String MSG_PATTERN_KEY_UPDATING
protected static final String MSG_PATTERN_KEY_CONFLICTS_WHILE_UPDATING
protected static final String MSG_PATTERN_KEY_VISITING_LEAF_REFERENCE_MATCHED
protected static final String MSG_PATTERN_KEY_MODULE_VERSION_ALREADY_PROCESSED
protected static final String MSG_PATTERN_KEY_ACTIONS_PERFORMED
protected static final String MSG_PATTERN_KEY_NO_ACTIONS_PERFORMED
protected static final ResourceBundle resourceBundle
protected List<org.azyva.dragom.model.ModuleVersion> listModuleVersionRoot
protected boolean indHandleDynamicVersion
Version's must be considered during the
traversal of the reference graphs. The default value is true.protected boolean indHandleStaticVersion
Version's must be considered during the
traversal of the reference graphs. The default value is true.protected boolean indAvoidReentry
visitModuleVersion(org.azyva.dragom.reference.Reference, org.azyva.dragom.apiutil.ByReference<org.azyva.dragom.model.Version>) avoids reentry by using
ModuleReentryAvoider. The default value is true.protected boolean indDepthFirst
protected RootModuleVersionJobAbstractImpl.UnsyncChangesBehavior unsyncChangesBehaviorLocal
protected RootModuleVersionJobAbstractImpl.UnsyncChangesBehavior unsyncChangesBehaviorRemote
protected ModuleReentryAvoider moduleReentryAvoider
ModuleReentryAvoider.
Used by this class when matching ReferencePath if
indAvoidReentry. Available to subclasses as well independently of
indAvoidReentry.
protected org.azyva.dragom.reference.ReferencePath referencePath
protected List<String> listActionsPerformed
protected boolean indListModuleVersionRootChanged
ModuleVersion passed to the constructor
was changed and should be saved by the caller if persisted.protected RootModuleVersionJobAbstractImpl(List<org.azyva.dragom.model.ModuleVersion> listModuleVersionRoot)
listModuleVersionRoot - List of root ModuleVersion's on which to initiate
the traversal of the reference graphs.public void setReferencePathMatcherProvided(org.azyva.dragom.reference.ReferencePathMatcher referencePathMatcherProvided)
ReferencePathMatcher profided by the caller defining on which
ModuleVersion's in the reference graphs the job will be applied.referencePathMatcherProvided - See description.protected String getProjectCode()
protected void setupReferencePathMatcherForProjectCode()
ReferencePathMatcher so that only ModuleVersion's
having the Version attribute dragom-project-code equal to that
defined by the runtime property PROJECT_CODE are matched.protected org.azyva.dragom.reference.ReferencePathMatcher getReferencePathMatcher()
ReferencePath's.
"and" combination of the ReferencePathMatcher provided with
setReferencePathMatcherProvided(org.azyva.dragom.reference.ReferencePathMatcher) and that setup by
setupReferencePathMatcherForProjectCode().protected void setIndHandleDynamicVersion(boolean indHandleDynamicVersion)
indHandleDynamicVersion - Specifies to handle or not dynamic
Version's. The default is to handle dynamic Version.protected void setIndHandleStaticVersion(boolean indHandleStaticVersion)
indHandleStaticVersion - Specifies to handle or not static
Version's. The default is to handle static Version.protected void setIndAvoidReentry(boolean indAvoidReentry)
indAvoidReentry - Specifies to avoid reentry by using
ModuleReentryAvoider. The default is to avoid reentry.protected void setIndDepthFirst(boolean indDepthFirst)
indDepthFirst - Specifies to traverse depth first. The default is to
traverse parent-first.public void setUnsyncChangesBehaviorLocal(RootModuleVersionJobAbstractImpl.UnsyncChangesBehavior unsyncChangesBehaviorLocal)
unsyncChangesBehaviorLocal - Behavior related to unsynchronized local
changes. The default is RootModuleVersionJobAbstractImpl.UnsyncChangesBehavior.DO_NOT_HANDLE.public void setUnsyncChangesBehaviorRemote(RootModuleVersionJobAbstractImpl.UnsyncChangesBehavior unsyncChangesBehaviorRemote)
unsyncChangesBehaviorRemote - Behavior related to unsynchronized remote
changes. The default is RootModuleVersionJobAbstractImpl.UnsyncChangesBehavior.DO_NOT_HANDLE.protected void setIndListModuleVersionRootChanged()
ModuleVersion passed to the constructor was changed and should be
saved by the caller if persisted.public boolean isListModuleVersionRootChanged()
ModuleVersion passed to the
constructor was changed and should be saved by the caller if persisted.public void performJob()
This class provides a default implementation which calls
beforeValidateListModuleVersionRoot(),
validateListModuleVersionRoot(),
beforeIterateListModuleVersionRoot(),
afterIterateListModuleVersionRoot(). If ever this behavior is not
appropriate for the job, subclasses can simply override the method.
Alternatively, the methods mentioned above can be overridden individually.
protected void beforeValidateListModuleVersionRoot()
performJob(). Subclasses can override to introduce
job-specific behavior.
This implementation does nothing.
protected void validateListModuleVersionRoot()
performJob() to validate the root ModuleVersion's.
This performs a first pass to validate the root ModuleVersion's. The reason is that if one ModuleVersion is invalid (module not known to the model or Version does not exist), many actions may have already been performed and it is better for the user to detect the error before doing anything.
protected void beforeIterateListModuleVersionRoot()
performJob(). Subclasses can override to introduce
job-specific behavior.
This implementation does nothing.
protected void iterateListModuleVersionRoot()
performJob() to iterate through the List of root
ModuleVersion's calling visitModuleVersion for each root ModuleVersion.protected boolean visitModuleVersion(org.azyva.dragom.reference.Reference reference,
org.azyva.dragom.apiutil.ByReference<org.azyva.dragom.model.Version> byReferenceVersion)
ModuleVersion. Subclasses can
override it to provide a job-specific behavior at the root ModuleVersion
level.
It could have been called visitRootModuleVersion to make more obvious the
context in which is it called, but it is expected to often be called
recursively by itself for the Reference's within the reference graph,
which this implementation actually does.
This implementation does a traversal of the reference graph rooted at the root
ModuleVersion by recursively invoking itself and for each ModuleVersion
matching the ReferencePathMatcher provided to the class using
setReferencePathMatcherProvided(org.azyva.dragom.reference.ReferencePathMatcher), it calls
visitMatchedModuleVersion(org.azyva.dragom.reference.Reference).
If indDepthFirst, the traversal is depth first. Otherwise it is
parent first.
This implementation returns false as it does not handle Version
changes.
reference - Root ModuleVersion passed as a Reference so that the
initial parent element of the ReferencePath can be created.byReferenceVersion - If the method returns true, contains the new Version
of the root ModuleVersion.protected boolean visitMatchedModuleVersion(org.azyva.dragom.reference.Reference reference)
visitModuleVersion(org.azyva.dragom.reference.Reference, org.azyva.dragom.apiutil.ByReference<org.azyva.dragom.model.Version>) for each matched
ModuleVersion. Subclasses can override it to provide a job-specific
behavior at the matched ModuleVersion level.
If the ReferencePathMatcher is such that a ModuleVeresion is matched and this method is called, it can signal the caller that children must not be visited by returning false. But if the ModuleVersion is not matched, this method is not called and children will be visited. In all cases, the ReferencePathMatcher will be applied to children as well. This applies only if the traversal is parent first.
This implementation raises an exception. This method is not abstract since if the subclass overrides visitModuleVersion, it may not be called or need to be overridden at all.
reference - Reference to the matched ModuleVersion.protected void afterIterateListModuleVersionRoot()
performJob(). Subclasses can override to introduce
job-specific behavior.
This implementation does nothing.
Copyright © 2015–2016 AZYVA INC.. All rights reserved.