Class TranslatorKeySettings
java.lang.Object
com.iizigo.translate.TranslatorKeySettings
The key of a translator in its settings container of the workspace settings (
WorkspaceProperties, the file .iiziWorkSpace in the state location of the Designer plug-in). Every read, write and removal of a key goes through this class, so that no caller handles the two names a key has.iiziGo v4 stores the key in plain text, as the StringProp key. This version stores it as a PasswordProp under the name key_, which v4 does not read, and leaves the name key to v4:
- A read takes
key_first. When onlykeyholds a key, the key is migrated: written as thePasswordPropkey_, andkeyremoved. - When both exist,
key_wins and is never overwritten fromkey;keyis only removed (an iiziGo v4 started on the same workspace in between may have stored a key of its own there). - A write stores
key_and removeskey; a removal removes both.
A PasswordProp is obfuscated in the file, not encrypted: its codec has no secret, so anyone with the code can read the key back. It keeps the key from a plain look at the file.
- Author:
- Christopher Mindus
Method Summary
Modifier and TypeMethodDescriptionstatic StringDescribes a key for a log line without revealing it: its length only, never one of its characters.static StringGets the key of a translator, migrating a key stored by iiziGo v4 (see the class description).static voidRemoves the key of a translator under both names.static voidSets the key of a translator: stored as thePasswordPropkey_, and the namekeyof iiziGo v4 removed.
Method Details
getKey
setKey
Sets the key of a translator: stored as thePasswordPropkey_, and the namekeyof iiziGo v4 removed.- Parameters:
settings- The settings container of the translator, null for none.key- The key, null or empty to remove the key.
removeKey
Removes the key of a translator under both names.- Parameters:
settings- The settings container of the translator, null for none.
describe
Describes a key for a log line without revealing it: its length only, never one of its characters. A key is the developer's credential and belongs in no log line, exception message, dialog title or tooltip; the settings dialogs log that a translator was configured through this description.- Parameters:
key- The key, null for none.- Returns:
"no key"for null or an empty key, else the length as"<n> characters".