java.lang.Object
com.aoapps.hodgepodge.util.ShellInterpreter
com.aoindustries.aoserv.client.aosh.Aosh
- All Implemented Interfaces:
Runnable
Aosh
is a command interpreter and scripting language
based on the Bourne shell. It may be used to control the
AOServ Client
utilities.- Author:
- AO Industries, Inc.
-
Field Summary
Fields inherited from class com.aoapps.hodgepodge.util.ShellInterpreter
err, in, out, status
-
Constructor Summary
ConstructorDescriptionAosh
(AoservConnector connector, Reader in, TerminalWriter out, TerminalWriter err) Aosh
(AoservConnector connector, Reader in, TerminalWriter out, TerminalWriter err, String... args) -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
checkMinParamCount
(String function, String[] args, int minCount, PrintWriter err) static boolean
checkParamCount
(String function, String[] args, int requiredCount, PrintWriter err) static boolean
checkRangeParamCount
(String function, String[] args, int minCount, int maxCount, PrintWriter err) static String
executeCommand
(AoservConnector connector, String[] args) static String
getConfigPassword
(InputStream in, TerminalWriter err) static User.Name
getConfigUsername
(InputStream in, TerminalWriter err) protected String
getName()
protected String
boolean
handleCommand
(String[] args) Processes one command and returns.static void
protected Aosh
newShellInterpreter
(Reader in, TerminalWriter out, TerminalWriter err, String[] args) static Account.Name
parseAccountingCode
(String s, String field) static BigDecimal
parseBigDecimal
(String s, String field) static boolean
parseBoolean
(String s, String field) static Date
static int
parseDecimal2
(String s, String field) static int
parseDecimal3
(String s, String field) static DomainName
parseDomainName
(String s, String field) static Email
parseEmail
(String s, String field) static FirewallZone.Name
parseFirewalldZoneName
(String s, String field) static float
parseFloat
(String s, String field) static User.Gecos
parseGecos
(String s, String field) static Group.Name
parseGroupName
(String s, String field) static HostAddress
parseHostAddress
(String s, String field) static InetAddress
parseInetAddress
(String s, String field) static int
static User.Name
parseLinuxUserName
(String s, String field) static long
static Database.Name
parseMysqlDatabaseName
(String s, String field) static Server.Name
parseMysqlServerName
(String s, String field) static User.Name
parseMysqlUserName
(String s, String field) static int
parseOctalInt
(String s, String field) static long
parseOctalLong
(String s, String field) static Port
static Database.Name
parsePostgresDatabaseName
(String s, String field) static Server.Name
parsePostgresServerName
(String s, String field) static User.Name
parsePostgresUserName
(String s, String field) static short
parseShort
(String s, String field) static PosixPath
parseUnixPath
(String s, String field) static User.Name
parseUserName
(String s, String field) static String
readLine
(InputStream in) static void
readLine
(InputStream in, StringBuilder sb) Methods inherited from class com.aoapps.hodgepodge.util.ShellInterpreter
clear, getPid, getPID, isAlive, isInteractive, jobs, run
-
Constructor Details
-
Aosh
-
Aosh
public Aosh(AoservConnector connector, Reader in, TerminalWriter out, TerminalWriter err, String... args)
-
-
Method Details
-
checkMinParamCount
public static boolean checkMinParamCount(String function, String[] args, int minCount, PrintWriter err) -
checkParamCount
public static boolean checkParamCount(String function, String[] args, int requiredCount, PrintWriter err) -
checkRangeParamCount
public static boolean checkRangeParamCount(String function, String[] args, int minCount, int maxCount, PrintWriter err) -
executeCommand
public static String executeCommand(AoservConnector connector, String[] args) throws IOException, SQLException - Throws:
IOException
SQLException
-
getName
- Specified by:
getName
in classShellInterpreter
-
getPrompt
- Specified by:
getPrompt
in classShellInterpreter
- Throws:
SQLException
IOException
-
handleCommand
Processes one command and returns.- Specified by:
handleCommand
in classShellInterpreter
- Parameters:
args
- the command and argments to process- Returns:
true
if more commands should be processed- Throws:
IOException
SQLException
-
main
-
getConfigUsername
public static User.Name getConfigUsername(InputStream in, TerminalWriter err) throws ConfigurationException, IOException - Throws:
ConfigurationException
IOException
-
getConfigPassword
public static String getConfigPassword(InputStream in, TerminalWriter err) throws ConfigurationException, IOException - Throws:
ConfigurationException
IOException
-
newShellInterpreter
protected Aosh newShellInterpreter(Reader in, TerminalWriter out, TerminalWriter err, String[] args) - Specified by:
newShellInterpreter
in classShellInterpreter
-
parseAccountingCode
-
parseBigDecimal
-
parseBoolean
-
parseDate
- See Also:
-
parseFirewalldZoneName
-
parseHostAddress
-
parseInt
-
parseFloat
-
parseLong
-
parseDecimal3
- See Also:
-
parseOctalInt
-
parseOctalLong
-
parseDecimal2
- See Also:
-
parseShort
-
parseDomainName
-
parseEmail
-
parseGecos
-
parseGroupName
-
parseInetAddress
-
parseLinuxUserName
-
parseMysqlDatabaseName
-
parseMysqlServerName
-
parseMysqlUserName
-
parsePort
-
parsePostgresDatabaseName
-
parsePostgresServerName
-
parsePostgresUserName
-
parseUnixPath
-
parseUserName
-
readLine
- Throws:
IOException
-
readLine
- Throws:
IOException
-