Package adams.core.git
Class GitSettingsHelper
- java.lang.Object
-
- adams.core.git.GitSettingsHelper
-
public class GitSettingsHelper extends Object
Helper class for the default git.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static StringEMAILthe email.static StringFILENAMEthe props file.static StringFLOW_EDITOR_SUPPORTthe flow editor support.static StringKNOWN_HOSTSthe known_hosts file.static StringLOGGING_LEVELthe logging level.protected booleanm_Modifiedwhether the settings got modified.protected adams.core.Propertiesm_Propertiesthe properties.protected static GitSettingsHelperm_Singletonthe singleton.static StringSSH_DIRthe ssh key dir.static StringUSERthe user.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDefaultKnownHosts()Returns the default known_hosts file.StringgetDefaultSshDir()Returns the default ssh dir.StringgetEmail()Returns the email for commits.booleangetFlowEditorSupport()Returns whether to enable git support in the flow editor.StringgetGlobalEmail()Returns the global email, if possible.StringgetGlobalUser()Returns the global user, if possible.StringgetKnownHosts()Returns the known_hosts file.adams.core.io.PlaceholderFilegetKnownHostsFile()Returns the known_hosts file.adams.core.logging.LoggingLevelgetLoggingLevel()Returns the email for commits.adams.core.PropertiesgetProperties()Returns the current properties.static GitSettingsHelpergetSingleton()Returns the singleton.StringgetSshDir()Returns the ssh key dir.adams.core.io.PlaceholderFilegetSshDirFile()Returns the ssh dir file.StringgetUser()Returns the user for commits.booleanisModified()Whether the settings got modified.voidreload()Reloads the properties file.booleansave()Saves the settings in the user's home directory.voidsetEmail(String value)Updates the email for commits.voidsetFlowEditorSupport(boolean value)Updates whether to enable git support in the flow editor.voidsetKnownHosts(String value)Updates the known_hosts file.voidsetSshDir(String value)Updates the ssh key file.voidsetUser(String value)Updates the user for commits.
-
-
-
Field Detail
-
FILENAME
public static final String FILENAME
the props file.- See Also:
- Constant Field Values
-
SSH_DIR
public static final String SSH_DIR
the ssh key dir.- See Also:
- Constant Field Values
-
KNOWN_HOSTS
public static final String KNOWN_HOSTS
the known_hosts file.- See Also:
- Constant Field Values
-
USER
public static final String USER
the user.- See Also:
- Constant Field Values
-
EMAIL
public static final String EMAIL
the email.- See Also:
- Constant Field Values
-
LOGGING_LEVEL
public static final String LOGGING_LEVEL
the logging level.- See Also:
- Constant Field Values
-
FLOW_EDITOR_SUPPORT
public static final String FLOW_EDITOR_SUPPORT
the flow editor support.- See Also:
- Constant Field Values
-
m_Singleton
protected static GitSettingsHelper m_Singleton
the singleton.
-
m_Properties
protected adams.core.Properties m_Properties
the properties.
-
m_Modified
protected boolean m_Modified
whether the settings got modified.
-
-
Method Detail
-
isModified
public boolean isModified()
Whether the settings got modified.- Returns:
- true if modified
-
getDefaultSshDir
public String getDefaultSshDir()
Returns the default ssh dir.- Returns:
- the default dir
-
getSshDir
public String getSshDir()
Returns the ssh key dir.- Returns:
- the dir, by default the user's home dir + .ssh
-
getSshDirFile
public adams.core.io.PlaceholderFile getSshDirFile()
Returns the ssh dir file.- Returns:
- the directory
-
setSshDir
public void setSshDir(String value)
Updates the ssh key file.- Parameters:
value- the file
-
getDefaultKnownHosts
public String getDefaultKnownHosts()
Returns the default known_hosts file.- Returns:
- the default file
-
getKnownHosts
public String getKnownHosts()
Returns the known_hosts file.- Returns:
- the file, by default the user's home dir + .ssh/known_hosts
-
getKnownHostsFile
public adams.core.io.PlaceholderFile getKnownHostsFile()
Returns the known_hosts file.- Returns:
- the file
-
setKnownHosts
public void setKnownHosts(String value)
Updates the known_hosts file.- Parameters:
value- the file
-
getGlobalUser
public String getGlobalUser()
Returns the global user, if possible.- Returns:
- the global user, empty string if not available
-
getUser
public String getUser()
Returns the user for commits.- Returns:
- the user
-
setUser
public void setUser(String value)
Updates the user for commits.- Parameters:
value- the user
-
getGlobalEmail
public String getGlobalEmail()
Returns the global email, if possible.- Returns:
- the global email, empty string if not available
-
getEmail
public String getEmail()
Returns the email for commits.- Returns:
- the email
-
setEmail
public void setEmail(String value)
Updates the email for commits.- Parameters:
value- the email
-
getLoggingLevel
public adams.core.logging.LoggingLevel getLoggingLevel()
Returns the email for commits.- Returns:
- the email
-
reload
public void reload()
Reloads the properties file. Discards any unsaved settings.
-
getFlowEditorSupport
public boolean getFlowEditorSupport()
Returns whether to enable git support in the flow editor.- Returns:
- true if to enable support
-
setFlowEditorSupport
public void setFlowEditorSupport(boolean value)
Updates whether to enable git support in the flow editor.- Parameters:
value- true if to enable support
-
getProperties
public adams.core.Properties getProperties()
Returns the current properties.- Returns:
- the properties
-
save
public boolean save()
Saves the settings in the user's home directory.- Returns:
- true if successfully saved
-
getSingleton
public static GitSettingsHelper getSingleton()
Returns the singleton.- Returns:
- the singleton
-
-