Package adams.flow.standalone
Class SimpleDockerConnection
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.core.AbstractActor
-
- adams.flow.standalone.AbstractStandalone
-
- adams.flow.standalone.SimpleDockerConnection
-
- All Implemented Interfaces:
adams.core.AdditionalInformationHandler,adams.core.CleanUpHandler,adams.core.Destroyable,adams.core.GlobalInfoSupporter,adams.core.logging.LoggingLevelHandler,adams.core.logging.LoggingSupporter,adams.core.option.OptionHandler,adams.core.QuickInfoSupporter,adams.core.ShallowCopySupporter<adams.flow.core.Actor>,adams.core.SizeOfHandler,adams.core.Stoppable,adams.core.StoppableWithFeedback,adams.core.VariablesInspectionHandler,adams.event.VariableChangeListener,adams.flow.core.Actor,adams.flow.core.ErrorHandler,Serializable,Comparable
public class SimpleDockerConnection extends adams.flow.standalone.AbstractStandaloneWraps around the local docker binary and can (optionally) log in to the registry (and log out once the flow finishes).
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-name <java.lang.String> (property: name) The name of the actor. default: SimpleDockerConnection
-annotation <adams.core.base.BaseAnnotation> (property: annotations) The annotations to attach to this actor. default:
-skip <boolean> (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is. default: false
-stop-flow-on-error <boolean> (property: stopFlowOnError) If set to true, the flow execution at this level gets stopped in case this actor encounters an error; the error gets propagated; useful for critical actors. default: false
-silent <boolean> (property: silent) If enabled, then no errors are output in the console; Note: the enclosing actor handler must have this enabled as well. default: false
-registry <java.lang.String> (property: registry) The custom registry to use, uses docker hub if left empty. default:
-user <java.lang.String> (property: user) The registry user to use. default:
-password <adams.core.base.BasePassword> (property: password) The registry password to use. default: {}-binary <adams.core.io.PlaceholderFile> (property: binary) The docker binary to use, uses default if pointing to dir. default: ${CWD}-dir-mapping <adams.core.base.DockerDirectoryMapping> [-dir-mapping ...] (property: dirMappings) The directory mappings to make available to the actual docker commands. default:
-login <boolean> (property: login) Whether to log in to the registry when the flow starts. default: false
-logout <boolean> (property: logout) Whether to log out to the registry when the flow wraps up. default: false
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringm_ActualBinarythe actual docker binary to use.protected adams.core.io.PlaceholderFilem_Binarythe alternative docker binary to use.protected DockerDirectoryMapping[]m_DirMappingsthe directory mappings to use.protected DockerDirectoryMapping[]m_ExpandedDirMappingsthe expanded directory mappings in use.protected booleanm_Loginwhether to login into the registry when starting the flow.protected booleanm_Logoutwhether to logout from the registry when stopping the flow.protected adams.core.base.BasePasswordm_Passwordthe registry password.protected PullTypem_PullTypehow to pull.protected Stringm_Registrythe docker registry to use.protected Stringm_Userthe registry user.-
Fields inherited from class adams.flow.core.AbstractActor
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_LoggingPrefix, m_Name, m_Parent, m_ScopeHandler, m_Self, m_Silent, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
-
-
Constructor Summary
Constructors Constructor Description SimpleDockerConnection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringbinaryTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.StringdirMappingsTipText()Returns the tip text for this property.protected StringdoExecute()Executes the flow item.PullTypegetActualPullType(PullType override)Determines the actual pull type to perform.StringgetAcualBinary()Returns the actual docker binary in use.adams.core.io.PlaceholderFilegetBinary()Returns the docker binary in use.DockerDirectoryMapping[]getDirMappings()Returns the directory mappings to make available to the actual docker commands.DockerDirectoryMapping[]getExpandedDirMappings()Returns the directory mappings to make available to the actual docker commands, with any variables (local and container) and placeholders (local only) expanded.booleangetLogin()Returns whether to log in to the registry when the flow starts.booleangetLogout()Returns whether to log out to the registry when the flow wraps up.adams.core.base.BasePasswordgetPassword()Returns the registry password in use.PullTypegetPullType()Returns how to pull images.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.StringgetRegistry()Returns the custom registry in use.StringgetUser()Returns the registry user in use.StringglobalInfo()Returns a string describing the object.StringloginTipText()Returns the tip text for this property.StringlogoutTipText()Returns the tip text for this property.StringpasswordTipText()Returns the tip text for this property.StringpullTypeTipText()Returns the tip text for this property.StringregistryTipText()Returns the tip text for this property.protected voidreset()Resets the scheme.voidsetBinary(adams.core.io.PlaceholderFile value)Sets the docker binary to use.voidsetDirMappings(DockerDirectoryMapping[] value)Sets the directory mappings to make available to the actual docker commands.voidsetLogin(boolean value)Sets whether to log in to the registry when the flow starts.voidsetLogout(boolean value)Sets whether to log out to the registry when the flow wraps up.voidsetPassword(adams.core.base.BasePassword value)Sets the registry password to use.voidsetPullType(PullType value)Sets how to pull images.voidsetRegistry(String value)Sets the custom registry to use.StringsetUp()Initializes the item for flow execution.voidsetUser(String value)Sets the registry user to use.StringuserTipText()Returns the tip text for this property.voidwrapUp()Cleans up after the execution has finished.-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, backupState, canInspectOptions, canPerformSetUpCheck, cleanUp, compareTo, configureLogger, destroy, equals, execute, finalUpdateVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, initialize, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, postExecute, pruneBackup, pruneBackup, restoreState, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
m_Registry
protected String m_Registry
the docker registry to use.
-
m_User
protected String m_User
the registry user.
-
m_Password
protected adams.core.base.BasePassword m_Password
the registry password.
-
m_Binary
protected adams.core.io.PlaceholderFile m_Binary
the alternative docker binary to use.
-
m_DirMappings
protected DockerDirectoryMapping[] m_DirMappings
the directory mappings to use.
-
m_ExpandedDirMappings
protected transient DockerDirectoryMapping[] m_ExpandedDirMappings
the expanded directory mappings in use.
-
m_Login
protected boolean m_Login
whether to login into the registry when starting the flow.
-
m_Logout
protected boolean m_Logout
whether to logout from the registry when stopping the flow.
-
m_PullType
protected PullType m_PullType
how to pull.
-
m_ActualBinary
protected String m_ActualBinary
the actual docker binary to use.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceadams.core.GlobalInfoSupporter- Specified by:
globalInfoin classadams.core.option.AbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceadams.core.option.OptionHandler- Overrides:
defineOptionsin classadams.flow.core.AbstractActor
-
reset
protected void reset()
Resets the scheme.- Overrides:
resetin classadams.flow.core.AbstractActor
-
setRegistry
public void setRegistry(String value)
Sets the custom registry to use.- Parameters:
value- the registry, empty string for default
-
getRegistry
public String getRegistry()
Returns the custom registry in use.- Returns:
- the registry, empty string for default
-
registryTipText
public String registryTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setUser
public void setUser(String value)
Sets the registry user to use.- Parameters:
value- the user
-
getUser
public String getUser()
Returns the registry user in use.- Returns:
- the user
-
userTipText
public String userTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPassword
public void setPassword(adams.core.base.BasePassword value)
Sets the registry password to use.- Parameters:
value- the password
-
getPassword
public adams.core.base.BasePassword getPassword()
Returns the registry password in use.- Returns:
- the password
-
passwordTipText
public String passwordTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setBinary
public void setBinary(adams.core.io.PlaceholderFile value)
Sets the docker binary to use.- Parameters:
value- the binary, uses default if pointing to dir
-
getBinary
public adams.core.io.PlaceholderFile getBinary()
Returns the docker binary in use.- Returns:
- the binary, uses default if pointing to dir
-
binaryTipText
public String binaryTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setDirMappings
public void setDirMappings(DockerDirectoryMapping[] value)
Sets the directory mappings to make available to the actual docker commands.- Parameters:
value- the mappings
-
getDirMappings
public DockerDirectoryMapping[] getDirMappings()
Returns the directory mappings to make available to the actual docker commands.- Returns:
- the mappings
-
dirMappingsTipText
public String dirMappingsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getExpandedDirMappings
public DockerDirectoryMapping[] getExpandedDirMappings()
Returns the directory mappings to make available to the actual docker commands, with any variables (local and container) and placeholders (local only) expanded.- Returns:
- the mappings
-
setLogin
public void setLogin(boolean value)
Sets whether to log in to the registry when the flow starts.- Parameters:
value- true if to login
-
getLogin
public boolean getLogin()
Returns whether to log in to the registry when the flow starts.- Returns:
- true if to login
-
loginTipText
public String loginTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLogout
public void setLogout(boolean value)
Sets whether to log out to the registry when the flow wraps up.- Parameters:
value- true if to logout
-
getLogout
public boolean getLogout()
Returns whether to log out to the registry when the flow wraps up.- Returns:
- true if to logout
-
logoutTipText
public String logoutTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPullType
public void setPullType(PullType value)
Sets how to pull images.- Parameters:
value- the type
-
getPullType
public PullType getPullType()
Returns how to pull images.- Returns:
- the type
-
pullTypeTipText
public String pullTypeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfoin interfaceadams.flow.core.Actor- Specified by:
getQuickInfoin interfaceadams.core.QuickInfoSupporter- Overrides:
getQuickInfoin classadams.flow.core.AbstractActor- Returns:
- null if no info available, otherwise short string
-
setUp
public String setUp()
Initializes the item for flow execution.- Specified by:
setUpin interfaceadams.flow.core.Actor- Overrides:
setUpin classadams.flow.core.AbstractActor- Returns:
- null if everything is fine, otherwise error message
-
getAcualBinary
public String getAcualBinary()
Returns the actual docker binary in use.- Returns:
- the binary, null if not determined
-
getActualPullType
public PullType getActualPullType(PullType override)
Determines the actual pull type to perform.- Parameters:
override- the (potentical( override from another class- Returns:
- the actual type
-
doExecute
protected String doExecute()
Executes the flow item.- Specified by:
doExecutein classadams.flow.core.AbstractActor- Returns:
- null if everything is fine, otherwise error message
-
wrapUp
public void wrapUp()
Cleans up after the execution has finished. Graphical output is left untouched.- Specified by:
wrapUpin interfaceadams.flow.core.Actor- Overrides:
wrapUpin classadams.flow.core.AbstractActor
-
-