cs290b.project.computer
Class ComputerImpl

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by cs290b.project.computer.ComputerImpl
All Implemented Interfaces:
Administrable, Computer, SupportManager, java.io.Serializable, java.lang.Runnable, java.rmi.Remote

public class ComputerImpl
extends java.rmi.server.UnicastRemoteObject
implements Computer, SupportManager, java.lang.Runnable

The implementation of the Computer interface.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
ComputerImpl()
          The default constructor for exporting the remote object.
ComputerImpl(Computer2Server server, java.lang.String computerName)
          Constructor used to create the computer impl object.
 
Method Summary
 void exitService()
          Administrable implementation to stop the Computer abruptly.
 int getComputerId()
           
 java.lang.String getComputerName()
           
 java.lang.String getKnownServers()
           
 java.lang.String getServerHostName()
           
 Shared getShared()
          Get the shared object.
static void main(java.lang.String[] args)
           
 void registerListener(RemoteListener listener)
          Register a listener with this computer.
 void run()
           
 void sendEvent(java.lang.Object event)
          Does nothing.
 void setComputation(java.lang.Object input)
          Computer implementation to share common input from the client.
 void setShared(Shared newShared)
          Set the shared object if newer.
 void stopService()
          Administrable implementation to stop the remote object and all executing threads gracefully.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComputerImpl

public ComputerImpl()
             throws java.rmi.RemoteException
The default constructor for exporting the remote object.

Throws:
java.rmi.RemoteException

ComputerImpl

public ComputerImpl(Computer2Server server,
                    java.lang.String computerName)
             throws java.rmi.RemoteException
Constructor used to create the computer impl object.

Parameters:
server - Remote reference to the server.
Throws:
java.rmi.RemoteException
Method Detail

getServerHostName

public java.lang.String getServerHostName()

getKnownServers

public java.lang.String getKnownServers()

getComputerId

public int getComputerId()

getComputerName

public java.lang.String getComputerName()

stopService

public void stopService()
Administrable implementation to stop the remote object and all executing threads gracefully.

Specified by:
stopService in interface Administrable

exitService

public void exitService()
Administrable implementation to stop the Computer abruptly.

Specified by:
exitService in interface Administrable

setComputation

public void setComputation(java.lang.Object input)
                    throws java.rmi.RemoteException
Computer implementation to share common input from the client.

Specified by:
setComputation in interface Computer
Parameters:
input - The input for the tasks.
Throws:
java.rmi.RemoteException

setShared

public void setShared(Shared newShared)
Set the shared object if newer.

Specified by:
setShared in interface Computer
Specified by:
setShared in interface SupportManager
Parameters:
newShared - The possible new value of shared.

getShared

public Shared getShared()
Get the shared object.

Specified by:
getShared in interface SupportManager
Returns:
The shared object.

registerListener

public void registerListener(RemoteListener listener)
Register a listener with this computer.

Specified by:
registerListener in interface Computer
Specified by:
registerListener in interface SupportManager
Parameters:
listener - The listener to register.

sendEvent

public void sendEvent(java.lang.Object event)
Does nothing. Implemented to support the interfaces.

Specified by:
sendEvent in interface SupportManager
Parameters:
event - The event to send (ignored).

run

public void run()
Specified by:
run in interface java.lang.Runnable

main

public static void main(java.lang.String[] args)


Anna Sibirtseva & Chris Ferguson, CS 290B