net.dpml.station.server
Class RemoteApplication

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by net.dpml.station.server.UnicastEventSource
                  extended by net.dpml.station.server.RemoteApplication
All Implemented Interfaces:
Serializable, Remote, Application, Callback

public class RemoteApplication
extends UnicastEventSource
implements Callback, Application

The RemoteApplication is the default implementation of a remotely accessible Aplication.

Version:
1.0.5
Author:
Digital Product Meta Library
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface net.dpml.station.Application
DEFAULT_SHUTDOWN_TIMEOUT, DEFAULT_STARTUP_TIMEOUT
 
Constructor Summary
RemoteApplication(Logger logger, ApplicationDescriptor descriptor, String id, int port)
          Creation of an application instance.
 
Method Summary
 void addApplicationListener(ApplicationListener listener)
          Add an application listener.
 void error(Throwable throwable, boolean fatal)
          Method invoked by a process to signal that the process has encounter an error condition.
 ApplicationDescriptor getApplicationDescriptor()
          Return the profile associated with this application
 String getID()
          Return the application id.
 PID getPID()
          Return the process identifier of the process within which the application is running.
 ProcessState getProcessState()
          Return the current deployment state of the process.
 Provider getProvider()
          Return the component instance handler.
 void info(String message)
          Method invoked by a process to send a arbitary message to the the callback handler.
protected  void processEvent(EventObject eventObject)
          Internal event handler.
 void removeApplicationListener(ApplicationListener listener)
          Remove an application listener.
 void restart()
          Restart the application.
 void start()
          Start the application.
 void started(PID pid, Component handler)
          Method invoked by a process to signal that the process has commenced startup.
 void stop()
          Stop the application.
 void stopped()
          Method invoked by a process to signal its imminent termination.
 
Methods inherited from class net.dpml.station.server.UnicastEventSource
addListener, enqueueEvent, getLogger, listeners, removeListener
 
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

RemoteApplication

public RemoteApplication(Logger logger,
                         ApplicationDescriptor descriptor,
                         String id,
                         int port)
                  throws RemoteException
Creation of an application instance.

Parameters:
logger - the assigned logging channel
descriptor - the application descriptor
id - the application key
port - the rmi registry port on which the station is registered
Throws:
RemoteException - if a remote exception occurs
Method Detail

started

public void started(PID pid,
                    Component handler)
             throws ApplicationException
Method invoked by a process to signal that the process has commenced startup.

Specified by:
started in interface Callback
Parameters:
pid - the process identifier
handler - the component handler
Throws:
ApplicationException - if an application exception occurs

error

public void error(Throwable throwable,
                  boolean fatal)
Method invoked by a process to signal that the process has encounter an error condition.

Specified by:
error in interface Callback
Parameters:
throwable - the error condition
fatal - if true the process is requesting termination

info

public void info(String message)
Method invoked by a process to send a arbitary message to the the callback handler.

Specified by:
info in interface Callback
Parameters:
message - the message

stopped

public void stopped()
Method invoked by a process to signal its imminent termination.

Specified by:
stopped in interface Callback

getPID

public PID getPID()
Return the process identifier of the process within which the application is running. If the application is not running a null value is returned.

Specified by:
getPID in interface Application
Returns:
the pid

getID

public String getID()
Return the application id.

Specified by:
getID in interface Application
Returns:
the id

getApplicationDescriptor

public ApplicationDescriptor getApplicationDescriptor()
Return the profile associated with this application

Specified by:
getApplicationDescriptor in interface Application
Returns:
the application profile

getProcessState

public ProcessState getProcessState()
Return the current deployment state of the process.

Specified by:
getProcessState in interface Application
Returns:
the current process state

start

public void start()
           throws ApplicationException
Start the application.

Specified by:
start in interface Application
Throws:
ApplicationException - if an application error occurs

stop

public void stop()
          throws RemoteException
Stop the application.

Specified by:
stop in interface Application
Throws:
RemoteException - if a rmote error occurs

restart

public void restart()
             throws RemoteException
Restart the application.

Specified by:
restart in interface Application
Throws:
RemoteException - if a rmote error occurs

getProvider

public Provider getProvider()
Return the component instance handler.

Specified by:
getProvider in interface Application
Returns:
the instance handler (possibly null)

addApplicationListener

public void addApplicationListener(ApplicationListener listener)
Add an application listener.

Specified by:
addApplicationListener in interface Application
Parameters:
listener - the listener to add

removeApplicationListener

public void removeApplicationListener(ApplicationListener listener)
Remove an application listener.

Specified by:
removeApplicationListener in interface Application
Parameters:
listener - the listener to remove

processEvent

protected void processEvent(EventObject eventObject)
Internal event handler.

Specified by:
processEvent in class UnicastEventSource
Parameters:
eventObject - the event