NOS.system
Class NOSSystem

java.lang.Object
  extended by NOS.system.NOSSystem

public class NOSSystem
extends java.lang.Object


Constructor Summary
NOSSystem(NOSApplet applet, java.lang.String user)
          Creates a new NOSSystem object.
 
Method Summary
 void addStyleListener(NOSStyleListener list)
          Add a NOSStyleListener to the system.
 void appendLogMessage(java.lang.String message)
          Append a message to the system log.
 NOSProcess createProcess(java.lang.String jar, java.lang.String app, java.lang.String[] args)
          Create a new NOSProcess which will run a new application.
 void destroyProcess(java.lang.Integer id)
          Destory the NOSProcess with the given id.
 void displayError(java.lang.Exception e)
          Display a nice error message.
 void downloadFile(NOSFile source, java.io.File targetDir)
          Download a file or folder to the local computer.
 void editFileWithDefaultProgram(NOSFile file)
          Opens a file for editing using the default program as specified in "//settings/defaulteditprogs.rc"
 java.applet.AppletContext getAppletContext()
          Returns the AppletContext object for the NOS applet.
 NOSClassLoader getClassLoader()
          Returns the system classloader.
static NOSDesktop getDesktop()
          Returns the one and only NOSDesktop object, there can be only one!
 java.lang.String getProperty(java.lang.String name)
          Get a system property string.
 Style getStyle()
          Returns the currently active Style.
static NOSSystem getSystem()
          Returns the one and only NOSSystem object, there can be only one!
 void logout()
          Logout of the system.
 void openFileWithDefaultProgram(NOSFile file)
          Opens a file for viewing using the default program as specified in "//settings/defaultopenprogs.rc"
 void removeStyleListener(NOSStyleListener list)
          Remove a NOSStyleListener from the system.
 void setProperty(java.lang.String name, java.lang.String value)
          Set a system property string
 void setStyle(Style style)
          Changes the currently active style to that specified.
 void showControlPanel()
          Show the system control panel window.
 void start()
          Called when the system is created.
 void stop()
          Called when the browser wants to destroy the system
 void uploadFile(java.io.File source, NOSFile targetDir)
          Upload files and folders to NOS
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NOSSystem

public NOSSystem(NOSApplet applet,
                 java.lang.String user)
Creates a new NOSSystem object.

Parameters:
applet - The NOSApplet object
user - The name of the user
Throws:
java.lang.RuntimeException - On failure
Method Detail

editFileWithDefaultProgram

public void editFileWithDefaultProgram(NOSFile file)
Opens a file for editing using the default program as specified in "//settings/defaulteditprogs.rc"

Parameters:
file - The file to be opened for editing

openFileWithDefaultProgram

public void openFileWithDefaultProgram(NOSFile file)
Opens a file for viewing using the default program as specified in "//settings/defaultopenprogs.rc"

Parameters:
file - The file to be opened for viewing

getClassLoader

public NOSClassLoader getClassLoader()
Returns the system classloader.

Returns:
The system class loader.

getSystem

public static NOSSystem getSystem()
Returns the one and only NOSSystem object, there can be only one!

Returns:
The NOSSystem object.

getDesktop

public static NOSDesktop getDesktop()
Returns the one and only NOSDesktop object, there can be only one!

Returns:
The NOSDesktop object.

getStyle

public Style getStyle()
Returns the currently active Style.

Returns:
The currently active Style.

setStyle

public void setStyle(Style style)
Changes the currently active style to that specified. Try to avoid using this method directly, use the NOSDesktop.setStyle method instead.

Parameters:
style - The new style to be applied.

addStyleListener

public void addStyleListener(NOSStyleListener list)
Add a NOSStyleListener to the system.

Parameters:
list - The style listener to be added.

removeStyleListener

public void removeStyleListener(NOSStyleListener list)
Remove a NOSStyleListener from the system.

Parameters:
list - The style listener to be removed.

getProperty

public java.lang.String getProperty(java.lang.String name)
Get a system property string.

Parameters:
name - The name of the property
Returns:
The value of the property

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Set a system property string

Parameters:
name - The name of the property
value - The value of the property

getAppletContext

public java.applet.AppletContext getAppletContext()
Returns the AppletContext object for the NOS applet.

Returns:
The AppletContext object for the NOS applet.

logout

public void logout()
Logout of the system.


downloadFile

public void downloadFile(NOSFile source,
                         java.io.File targetDir)
                  throws java.lang.Exception
Download a file or folder to the local computer.

Parameters:
source - The source of the file
targetDir - The destination folder
Throws:
java.lang.Exception - On failure

uploadFile

public void uploadFile(java.io.File source,
                       NOSFile targetDir)
                throws java.lang.Exception
Upload files and folders to NOS

Parameters:
source - The source file/folder.
targetDir - The target folder.
Throws:
java.lang.Exception - On faliure

start

public void start()
Called when the system is created.


stop

public void stop()
Called when the browser wants to destroy the system


createProcess

public NOSProcess createProcess(java.lang.String jar,
                                java.lang.String app,
                                java.lang.String[] args)
                         throws java.lang.Exception
Create a new NOSProcess which will run a new application.

Parameters:
jar - The jar which the application is stored in.
app - The main-class name for the application.
args - The program arguments.
Returns:
The NOSProcess object that was created
Throws:
java.lang.Exception - On failure.

destroyProcess

public void destroyProcess(java.lang.Integer id)
Destory the NOSProcess with the given id.

Parameters:
id - The process id of the NOSProcess you want to destroy.

displayError

public void displayError(java.lang.Exception e)
Display a nice error message.

Parameters:
e - The exception object to be displayed.

appendLogMessage

public void appendLogMessage(java.lang.String message)
Append a message to the system log.

Parameters:
message - The message to be appeneded.

showControlPanel

public void showControlPanel()
Show the system control panel window.