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.AbstractStandalone
Wraps 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 String
m_ActualBinary
the actual docker binary to use.protected adams.core.io.PlaceholderFile
m_Binary
the alternative docker binary to use.protected DockerDirectoryMapping[]
m_DirMappings
the directory mappings to use.protected DockerDirectoryMapping[]
m_ExpandedDirMappings
the expanded directory mappings in use.protected boolean
m_Login
whether to login into the registry when starting the flow.protected boolean
m_Logout
whether to logout from the registry when stopping the flow.protected adams.core.base.BasePassword
m_Password
the registry password.protected PullType
m_PullType
how to pull.protected String
m_Registry
the docker registry to use.protected String
m_User
the 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 String
binaryTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.String
dirMappingsTipText()
Returns the tip text for this property.protected String
doExecute()
Executes the flow item.PullType
getActualPullType(PullType override)
Determines the actual pull type to perform.String
getAcualBinary()
Returns the actual docker binary in use.adams.core.io.PlaceholderFile
getBinary()
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.boolean
getLogin()
Returns whether to log in to the registry when the flow starts.boolean
getLogout()
Returns whether to log out to the registry when the flow wraps up.adams.core.base.BasePassword
getPassword()
Returns the registry password in use.PullType
getPullType()
Returns how to pull images.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.String
getRegistry()
Returns the custom registry in use.String
getUser()
Returns the registry user in use.String
globalInfo()
Returns a string describing the object.String
loginTipText()
Returns the tip text for this property.String
logoutTipText()
Returns the tip text for this property.String
passwordTipText()
Returns the tip text for this property.String
pullTypeTipText()
Returns the tip text for this property.String
registryTipText()
Returns the tip text for this property.protected void
reset()
Resets the scheme.void
setBinary(adams.core.io.PlaceholderFile value)
Sets the docker binary to use.void
setDirMappings(DockerDirectoryMapping[] value)
Sets the directory mappings to make available to the actual docker commands.void
setLogin(boolean value)
Sets whether to log in to the registry when the flow starts.void
setLogout(boolean value)
Sets whether to log out to the registry when the flow wraps up.void
setPassword(adams.core.base.BasePassword value)
Sets the registry password to use.void
setPullType(PullType value)
Sets how to pull images.void
setRegistry(String value)
Sets the custom registry to use.String
setUp()
Initializes the item for flow execution.void
setUser(String value)
Sets the registry user to use.String
userTipText()
Returns the tip text for this property.void
wrapUp()
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:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in 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:
defineOptions
in interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classadams.flow.core.AbstractActor
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in 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:
getQuickInfo
in interfaceadams.flow.core.Actor
- Specified by:
getQuickInfo
in interfaceadams.core.QuickInfoSupporter
- Overrides:
getQuickInfo
in 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:
setUp
in interfaceadams.flow.core.Actor
- Overrides:
setUp
in 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:
doExecute
in 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:
wrapUp
in interfaceadams.flow.core.Actor
- Overrides:
wrapUp
in classadams.flow.core.AbstractActor
-
-