SilverStream
Application Server 3.5

com.sssw.srv.busobj
Interface AgiServerListener


public interface AgiServerListener

Implemented by all business objects which listen for server events which include start, stop, error, user login and logout.

When a server event triggered business object is created, SilverStream automatically adds the implements AgiServerListener clause to the object's class definition.


Method Summary
 boolean httpError(AgoHttpErrorEvent e)
          Fires when an HTTP-level error is detected.
 void serverDeactivated(AgoServerDeactivatedEvent e)
          Fires when server deactivation finishes.
 void serverDeactivating(AgoServerDeactivatingEvent e)
           
 void serverError(AgoServerErrorEvent e)
          Fires when a serious error occurs on the server, unless the server was started with the -noserverlisteners option.
 void serverStarted(AgoServerStartEvent e)
          Fires when the server is started but before any requests are received, unless the server was started with the -noserverlisteners option.
 void serverStopped(AgoServerStopEvent e)
          Fires when the server is shutdown in an ordinay manner, unless the server was started with the -noserverlisteners option.
 boolean userLogin(AgoUserLoginEvent e)
          Fires when a user logs in to a session, unless the server was started with the -noserverlisteners option.
 void userLogout(AgoUserLogoutEvent e)
          Fires when a user logs out from the server, unless the server was started with the -noserverlisteners option.
 

Method Detail

serverStarted

public void serverStarted(AgoServerStartEvent e)
Fires when the server is started but before any requests are received, unless the server was started with the -noserverlisteners option.
Parameters:
e - an instance of the AgoServerStartEvent.
Usage:

ServerStart Listeners are fired as one of the last parts of server initialization. If there is a problem with the business object the server may fail to start. The server can be started with the -noserverlisteners option and the server will start as usual with the exception that no Server Listener events will be fired. It is then possible to debug the problem and once fixed, start the server normally, with the ability to fire business object's events restored.

See Also:
AgoServerStartEvent

serverStopped

public void serverStopped(AgoServerStopEvent e)
Fires when the server is shutdown in an ordinay manner, unless the server was started with the -noserverlisteners option.
Parameters:
e - an instance of the AgoServerStopEvent.
Usage:

SilverStream cannot guarantees that these events will be fired in the unlikely event of a server crash.

See Also:
AgoServerStopEvent

serverError

public void serverError(AgoServerErrorEvent e)
Fires when a serious error occurs on the server, unless the server was started with the -noserverlisteners option.
Parameters:
e - an instance of the AgoServerErrorEvent.
Usage:

This event is not meant to be fired for all server errors, only catastrophic ones. At the present time they only fire on one occasion; if a server in a clustered environment loses contact with the cache manager.

See Also:
AgoServerErrorEvent

userLogin

public boolean userLogin(AgoUserLoginEvent e)
Fires when a user logs in to a session, unless the server was started with the -noserverlisteners option. If there is a problem with the business object the server may not start or allow logins. The server can be started with the -noserverlisteners option. The server will start as usual with the exception that no Server Listener events (start, stop, error, user login user logout) will be fired. After debuggin the problem the server can be started normally, restoring the ability fire business object's events.
Parameters:
e - an instance of the AgoUserLoginEvent.
Usage:

Note that this event is fired not when a session is created but when the user logs in to a session. See AgoUserLoginEvent for details.

See Also:
AgoUserLoginEvent

userLogout

public void userLogout(AgoUserLogoutEvent e)
Fires when a user logs out from the server, unless the server was started with the -noserverlisteners option. (What does it mean to logout from the server?) (Does that include client sessions?)
Parameters:
e - an instance of the AgoUserLogoutEvent.
Usage:

Note that this event is fired not when a session is destroyed but when the user logs out of a session. See AgoUserLogoutEvent for details.

See Also:
AgoUserLogoutEvent

serverDeactivating

public void serverDeactivating(AgoServerDeactivatingEvent e)

serverDeactivated

public void serverDeactivated(AgoServerDeactivatedEvent e)
Fires when server deactivation finishes.

httpError

public boolean httpError(AgoHttpErrorEvent e)
Fires when an HTTP-level error is detected. Returns true if the error was handled, or false to pass the error to the default handler.
Usage:
The business object handling the error is responsible for filling out the reply message. This can be done by coding the HTML for the message itself, or by delegating to a dynamic HTML page (using AgiHttpServletRequest.delegateToPage). The error handler can choose to handle some errors itself and allow other errors to "fall through" ( based on, for example, the status code or other conditions).

Note that if there are multiple business objects on the server handling error events, SilverStream does not guarantee the order in which they execute. The first event that returns "true" using this method gets executed, while others do not. Thus if you are using multiple objects to handle errors, be sure that they handle unconnected sets of errors.

See Also:
AgoHttpErrorEvent

SilverStream
Application Server 3.5