Dallas Semiconductor TINI 1.02 Release: Class DefaultTINIShell

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.dalsemi.shell
Class DefaultTINIShell

    java.lang.Object
      |
      +--com.dalsemi.shell.TINIShell
            |
            +--com.dalsemi.shell.DefaultTINIShell

public class DefaultTINIShell
extends TINIShell

The default implementation of a TINIShell. In this shell, all users are assigned the same UID and user name, and all are given adminstrator privileges. This shell has no commands associated with it. For an example of a complete implementation of a TINIShell, see the `slush` shell that is included with the TINI distribution files.

Fields inherited from class com.dalsemi.shell.TINIShell
`adminUID, environment`

Constructor Summary
`DefaultTINIShell()` Creates the initial environment for a shell.

Method Summary
`void` | `execute(java.lang.Object[] commandLine, SystemInputStream in, SystemPrintStream out, SystemPrintStream err, java.util.Hashtable env)` Executes a command in the shell.
`java.util.Hashtable` | `getCurrentEnvironment()` Returns a copy of the current environment.
`byte` | `getCurrentUID()` Returns the user ID of the current user.
`java.lang.String` | `getCurrentUserName()` Returns the name of the current user logged in.
`java.lang.String` | `getFromCurrentEnvironment(java.lang.String key)` Gets the value of the given key from the current environment.
`java.lang.String` | `getName()` Returns the name of the shell.
`int` | `getUIDByUserName(java.lang.String username)` Returns the ID of the user with the given user name.
`java.lang.String` | `getUserNameByUID(byte uid)` Returns the user name of the user with the given user ID.
`java.lang.String` | `getVersion()` Returns the version of the shell.
`int` | `login(java.lang.String userName, java.lang.String password)` Logs a user into the system and sets that user's privilege level correctly.
`void` | `logout(java.lang.Object info)` Does nothing in this implementation.

Methods inherited from class com.dalsemi.shell.TINIShell
`getSystemEnvironment, isAdmin, isCurrentUserAdmin`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultTINIShell

    public DefaultTINIShell()

  Creates the initial environment for a shell. The environment is initialized to hold the current working directory. This value is stored under the "current directory" key.

Method Detail

### getName

    public java.lang.String getName()

  Returns the name of the shell. The name of the default TINI shell is simply "slushLite".
  Overrides:
    `getName` in class `TINIShell`
  Returns:
    the name of the shell

### getVersion

    public java.lang.String getVersion()

  Returns the version of the shell.
  Overrides:
    `getVersion` in class `TINIShell`
  Returns:
    the shell version

### login

    public int login(java.lang.String userName,
                     java.lang.String password)

  Logs a user into the system and sets that user's privilege level correctly. Most shells will have a list of valid users and their corresponding passwords and user id's to consult when this method is called (such as a passwd file). This shell always returns the default adminstrator UID (0x80).
  Overrides:
    `login` in class `TINIShell`
  Parameters:
    `userName` - the user name of the user logging in
    `password` - the password for this user

### logout

    public void logout(java.lang.Object info)

  Does nothing in this implementation.
  Overrides:
    `logout` in class `TINIShell`
  Parameters:
    `info` - any extra information needed in the logout process

### getCurrentUID

    public byte getCurrentUID()

  Returns the user ID of the current user. This implementation will always return the default adminstrator UID (0x80).
  Overrides:
    `getCurrentUID` in class `TINIShell`
  Returns:
    the current user's ID

### getUserNameByUID

    public java.lang.String getUserNameByUID(byte uid)

  Returns the user name of the user with the given user ID. This implementation will always return the default adminstrator name ("root").
  Overrides:
    `getUserNameByUID` in class `TINIShell`
  Parameters:
    `uid` - The uid to check
  Returns:
    the user name of the user with the given user ID

### getUIDByUserName

    public int getUIDByUserName(java.lang.String username)

  Returns the ID of the user with the given user name. This implementation will always return the default adminstrator UID (0x80).
  Overrides:
    `getUIDByUserName` in class `TINIShell`
  Parameters:
    `username` - the username to check
  Returns:
    the ID of the user with the given user name, or -1 if that user does not exist

### getCurrentUserName

    public java.lang.String getCurrentUserName()

  Returns the name of the current user logged in. This implementation will always return the default adminstrator name ("root").
  Overrides:
    `getCurrentUserName` in class `TINIShell`
  Returns:
    the name of the current user

### getCurrentEnvironment

    public java.util.Hashtable getCurrentEnvironment()

  Returns a copy of the current environment.
  Overrides:
    `getCurrentEnvironment` in class `TINIShell`
  Returns:
    the environment

### getFromCurrentEnvironment

    public java.lang.String getFromCurrentEnvironment(java.lang.String key)

  Gets the value of the given key from the current environment.
  Overrides:
    `getFromCurrentEnvironment` in class `TINIShell`
  Parameters:
    `key` - the key to lookup in the current environment
  Returns:
    the value of the key, or an empty String if the key is not set in the current environment

### execute

    public void execute(java.lang.Object[] commandLine,
                        SystemInputStream in,
                        SystemPrintStream out,
                        SystemPrintStream err,
                        java.util.Hashtable env)
                 throws java.lang.Exception

  Executes a command in the shell. This implementation has no commands. A call to this method will print "Command not found." to the given error stream.
  Overrides:
    `execute` in class `TINIShell`
  Parameters:
    `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 element
    `in` - the stream the command will use to get input
    `out` - the stream used to report non-critical messages
    `err` - the stream used to report critical messages
    `env` - a table of environment variables
  Throws:
    `java.lang.Exception` - any exception raised by the command.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD