|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.dalsemi.shell.TINIShell
This abstract class encapsulates all of the functionality of a system shell for TINI. It interacts between a process and the system OS, and provides the current environment and the user ID of the current process. Methods are provided for converting to and from the numerical user ID and the text representation and for determining whether a particular user is an administrator. A user will be considered an administrator if the most significant bit of their user ID is set.
Field Summary | |
static byte |
adminUID
Standard administrator UID. |
protected java.util.Hashtable |
environment
Contains the current environment variables for the process. |
Constructor Summary | |
TINIShell()
Creates the initial environment for a shell. |
Method Summary | |
abstract void |
execute(java.lang.Object[] commandLine,
SystemInputStream in,
SystemPrintStream out,
SystemPrintStream err,
java.util.Hashtable env)
Executes a command in the shell. |
abstract java.util.Hashtable |
getCurrentEnvironment()
Returns a copy of the current environment. |
abstract byte |
getCurrentUID()
Returns the user ID of the current user. |
abstract java.lang.String |
getCurrentUserName()
Returns the name of the current user logged in. |
abstract java.lang.String |
getFromCurrentEnvironment(java.lang.String key)
Gets the value of the given key from the current environment. |
abstract java.lang.String |
getName()
Returns the name of the shell. |
java.util.Hashtable |
getSystemEnvironment()
Returns the system environment (the environment that all processes see when they start up). |
abstract int |
getUIDByUserName(java.lang.String username)
Returns the ID of the user with the given user name. |
abstract java.lang.String |
getUserNameByUID(byte uid)
Returns the user name of the user with the given user ID. |
abstract java.lang.String |
getVersion()
Returns the version of the shell. |
boolean |
isAdmin(byte uid)
Determines if the given user ID has administrative rights. |
boolean |
isCurrentUserAdmin()
Indicates whether or not the current user has admin privileges. |
abstract int |
login(java.lang.String userName,
java.lang.String password)
Logs a user into the system and sets that user's privilege level correctly. |
abstract void |
logout(java.lang.Object info)
Logs the current user out of the system, returning the privilege level of the current process to the default state. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final byte adminUID
protected java.util.Hashtable environment
Constructor Detail |
public TINIShell()
Method Detail |
public abstract int login(java.lang.String userName, java.lang.String password)
userName
- the user name of the user logging inpassword
- the password for this userpublic abstract void logout(java.lang.Object info)
info
- any extra information needed in the logout processpublic abstract java.lang.String getName()
public abstract java.lang.String getVersion()
public boolean isCurrentUserAdmin()
true
if the user has admin rights,
false
otherwisepublic abstract byte getCurrentUID()
public boolean isAdmin(byte uid)
uid
- the user IDtrue
if the user is an administrator,
false
otherwisepublic abstract java.lang.String getUserNameByUID(byte uid)
uid
- the uid to checkpublic abstract int getUIDByUserName(java.lang.String username)
username
- the username to checkpublic abstract java.lang.String getCurrentUserName()
public java.util.Hashtable getSystemEnvironment()
public abstract java.util.Hashtable getCurrentEnvironment()
public abstract java.lang.String getFromCurrentEnvironment(java.lang.String key)
key
- the key to lookup in the current environmentnull
if the key
is not set in the current environmentpublic abstract void execute(java.lang.Object[] commandLine, SystemInputStream in, SystemPrintStream out, SystemPrintStream err, java.util.Hashtable env) throws java.lang.Exception
commandLine
- an Object array containing the command in the first element,
followed by any parameters need for that command in a String[] in the second elementin
- the stream the command will use to get inputout
- the stream used to report non-critical messageserr
- the stream used to report critical messagesenv
- a table of environment variables
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |