Package org.xipki.shell
Class XiAction
- java.lang.Object
-
- org.xipki.shell.XiAction
-
- All Implemented Interfaces:
org.apache.karaf.shell.api.action.Action
- Direct Known Subclasses:
Actions.Base64EnDecode,Actions.Confirm,Actions.CopyDir,Actions.CopyFile,Actions.Curl,Actions.DateTime,Actions.FileExists,Actions.Mkdir,Actions.MoveDir,Actions.MoveFile,Actions.OsInfo,Actions.Replace,Actions.Rm
public abstract class XiAction extends Object implements org.apache.karaf.shell.api.action.Action
Anchor class for all actions. All actions should derive from this one.- Since:
- 3.0.1
- Author:
- Lijun Liao (xipki)
-
-
Field Summary
Fields Modifier and Type Field Description protected org.xipki.password.PasswordResolverpasswordResolverprotected org.apache.karaf.shell.api.console.Sessionsession
-
Constructor Summary
Constructors Constructor Description XiAction()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleanconfirm(String prompt, int maxTries)protected static byte[]derPemEncode(byte[] data, String encodeForm, org.xipki.util.PemEncoder.PemLabel pemLabel)protected org.xipki.util.ConfPairsembedFileContent(org.xipki.util.ConfPairs confPairs)protected static byte[]encodeCert(byte[] data, String encodeForm)protected static byte[]encodeCrl(byte[] data, String encodeForm)protected static byte[]encodeCsr(byte[] data, String encodeForm)Objectexecute()protected abstract Objectexecute0()protected static FileexpandFilepath(File file)protected static StringexpandFilepath(String path)protected static booleanisBlank(String str)protected static booleanisEmpty(Collection<?> col)protected static booleanisEnabled(String enabledS, boolean defaultEnabled, String optionName)protected static booleanisNotBlank(String str)protected static booleanisNotEmpty(Collection<?> col)protected booleanisTrue(Boolean bo)protected voidprint(String message)protected voidprintln(String message)protected char[]readPassword()protected char[]readPassword(String prompt)protected char[]readPasswordIfNotSet(String password)protected char[]readPasswordIfNotSet(String prompt, String password)protected StringreadPrompt(String prompt)protected char[]resolvePassword(String passwordHint)protected voidsave(File file, byte[] encoded)protected voidsave(String file, byte[] encoded)protected voidsaveVerbose(String promptPrefix, File file, byte[] encoded)protected voidsaveVerbose(String promptPrefix, String file, byte[] encoded)protected static List<String>split(String str, String delim)protected static BigIntegertoBigInt(String str)protected static BigIntegertoBigInt(String str, boolean defaultHex)
-
-
-
Method Detail
-
resolvePassword
protected char[] resolvePassword(String passwordHint) throws org.xipki.password.PasswordResolverException
- Throws:
org.xipki.password.PasswordResolverException
-
execute
public Object execute() throws Exception
- Specified by:
executein interfaceorg.apache.karaf.shell.api.action.Action- Throws:
Exception
-
isTrue
protected boolean isTrue(Boolean bo)
-
embedFileContent
protected org.xipki.util.ConfPairs embedFileContent(org.xipki.util.ConfPairs confPairs) throws IOException- Throws:
IOException
-
saveVerbose
protected void saveVerbose(String promptPrefix, String file, byte[] encoded) throws IOException
- Throws:
IOException
-
saveVerbose
protected void saveVerbose(String promptPrefix, File file, byte[] encoded) throws IOException
- Throws:
IOException
-
save
protected void save(String file, byte[] encoded) throws IOException
- Throws:
IOException
-
save
protected void save(File file, byte[] encoded) throws IOException
- Throws:
IOException
-
isEnabled
protected static boolean isEnabled(String enabledS, boolean defaultEnabled, String optionName)
-
readPrompt
protected String readPrompt(String prompt) throws IOException
- Throws:
IOException
-
readPasswordIfNotSet
protected char[] readPasswordIfNotSet(String password) throws IOException, org.xipki.password.PasswordResolverException
- Throws:
IOExceptionorg.xipki.password.PasswordResolverException
-
readPasswordIfNotSet
protected char[] readPasswordIfNotSet(String prompt, String password) throws IOException, org.xipki.password.PasswordResolverException
- Throws:
IOExceptionorg.xipki.password.PasswordResolverException
-
readPassword
protected char[] readPassword() throws IOException, org.xipki.password.PasswordResolverException- Throws:
IOExceptionorg.xipki.password.PasswordResolverException
-
readPassword
protected char[] readPassword(String prompt) throws IOException, org.xipki.password.PasswordResolverException
- Throws:
IOExceptionorg.xipki.password.PasswordResolverException
-
println
protected void println(String message)
-
print
protected void print(String message)
-
isBlank
protected static boolean isBlank(String str)
-
isNotBlank
protected static boolean isNotBlank(String str)
-
isEmpty
protected static boolean isEmpty(Collection<?> col)
-
isNotEmpty
protected static boolean isNotEmpty(Collection<?> col)
-
toBigInt
protected static BigInteger toBigInt(String str)
-
toBigInt
protected static BigInteger toBigInt(String str, boolean defaultHex)
-
encodeCert
protected static byte[] encodeCert(byte[] data, String encodeForm)
-
encodeCrl
protected static byte[] encodeCrl(byte[] data, String encodeForm)
-
encodeCsr
protected static byte[] encodeCsr(byte[] data, String encodeForm)
-
derPemEncode
protected static byte[] derPemEncode(byte[] data, String encodeForm, org.xipki.util.PemEncoder.PemLabel pemLabel)
-
confirm
protected boolean confirm(String prompt, int maxTries) throws IOException
- Throws:
IOException
-
-