JAVA  SHELL
 

Objective
The Objective  of the project is to write a shell in Java. The  Shell will run the commands typed at the command prompt.
 

Team of sstudents who worked on this project
    Sunil, Madhav, Tapan

List of the commands supported by the Shell
    cat
        writes the contents of the files to the standard output
    clear
        clears the screen
   cd
        changes the directory with respect to the current directory
    cp
        makes a copy of the file
    date
        prints the date
    dir
        gives a detailed listing of the files in the directory
   echo
        wirtes the parameters of this command to the standard output
    exit
        exits the shell
   grep
        searches for a pattern in the files and prints the lines which matched the pattern
    help
        gives a help on a command
    ls
        gives a listing of all files in the directory
    mem
        gives the total memory available to the java runtime system and the amount of free memory
    mkdir
        creates a subdirectory with the given name
    mv
        moves the source file to the destination file
    prompt
        changes the prompt to the specified string
    pwd
        prints the current working directory
    rm
        deletes given files from the current directory
    time
        gives the current system time
    wc
        gives the count of number of lines, words and characters in a file
    version
        prints the current version of the shell
   pipe
        pipe ( | ) is not really a command, It is a way of joining two commands togeather. It is similer to unix pipe.
 
 

List of the files and their purpose


    These are the following interfaces defined:
 
        These files contain only decleration of methods. Detais can be found by looking the source file itself.
 

    ConsoleLine.java

    OutputWatcher.java

    ProcessWatcher.java

 

 

    JShell.java
        This is the main file . It creates the main frame and the text area for the console. It parses the commands, if it is the internal command it will execute that., otherwise it loads the class corresponding to a command and executes .
 

   Console.java

        This class extends the text area, and provides a way to read input and write output. It will also handle the keyboard output.
 

  AboutShell.java

        This class extends from JDialog. This class creates a dialog box that shows the version information.
        

  EventOutputStream.java

    This class implements an output stream in which the data is written into a byte array. The buffer automatically grows as data is written to it. In addition to this, whenever something is written to the byte array that info. is also sent to the object that created us.

        The classes implementing the shell commands will write to System.out. This class provides a way to capture that stream and redirects to the text area.
 

    Help.java

        This class provides a way to view the help. This class extends JFrame class, and it contains a textarea and a button for each command. By clicking the button the corresponding file is read and displayed on the text area.

    help.java

        This class provides to see the help with console command. The requested command help file is read and will be displayed.

    set.java

        Provides methods for setting and retriving the properties used in the program.
 

The following classes implements one shell command:

    All the following classes will contain the main method. Each class executes a command specified by name itself.
The main method will take a array of strings as arguments that are given to the respective command. All the commands will write the output the System.out. If we want to print to the other stream set the System.out to the corresponding stream.

ls.java cat.java mkdir.java mv.java rm.java
time.java wc.java cd.java cp.java date.java
dir.java echo.java grep.java GrepInputStream.java mem.java
prompt.java