gov.aps.jca.cas
Class ServerContext

java.lang.Object
  extended by gov.aps.jca.cas.ServerContext

public abstract class ServerContext
extends java.lang.Object

The class representing a CA Server Context. Context are created through the JCALibrary factory class.

Version:
$Id: ServerContext.java,v 1.5 2006/03/16 11:58:49 msekoranja Exp $
Author:
Matej Sekoranja
See Also:
JCALibrary

Constructor Summary
ServerContext()
           
 
Method Summary
abstract  void addContextExceptionListener(ContextExceptionListener l)
          Add a ContextExceptionListener to this context.
abstract  void addContextMessageListener(ContextMessageListener l)
          Add a ContextMessageListener to this context.
abstract  void destroy()
          Clear all resources attached to this Context
 void dispose()
          Dispose (destroy) server context.
abstract  ContextExceptionListener[] getContextExceptionListeners()
           
abstract  ContextMessageListener[] getContextMessageListeners()
           
abstract  Version getVersion()
           
abstract  void initialize(Server server)
          Set Server implemenation and initialzie server.
 void printInfo()
          Prints detailed information about the Context to the standard output stream.
 void printInfo(java.io.PrintStream out)
          Prints detailed information about the Context to the specified output stream.
abstract  void removeContextExceptionListener(ContextExceptionListener l)
          Removes a ContextExceptionListener from this context.
abstract  void removeContextMessageListener(ContextMessageListener l)
          Removes a ContextMessageListener from this context.
abstract  void run(int seconds)
          Run server (process events).
abstract  void shutdown()
          Shutdown (stop executing run() method) of this Context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerContext

public ServerContext()
Method Detail

getVersion

public abstract Version getVersion()
Returns:
version of the context implementation.

initialize

public abstract void initialize(Server server)
                         throws CAException,
                                java.lang.IllegalStateException
Set Server implemenation and initialzie server. This method is called immediately after instance construction (call of constructor).

Parameters:
server - Server implementation providing ProcessVariable access (existance test and attach).
Throws:
CAException
java.lang.IllegalStateException

run

public abstract void run(int seconds)
                  throws CAException,
                         java.lang.IllegalStateException
Run server (process events).

Parameters:
seconds - time in seconds the server will process events (method will block), if 0 the method would block until destory() is called.
Throws:
java.lang.IllegalStateException - if server is already destroyed.
CAException

getContextMessageListeners

public abstract ContextMessageListener[] getContextMessageListeners()
                                                             throws java.lang.IllegalStateException
Returns:
an array containing all ContextMessageListeners attached to this context.
Throws:
java.lang.IllegalStateException - if the context has been destroyed.

addContextMessageListener

public abstract void addContextMessageListener(ContextMessageListener l)
                                        throws CAException,
                                               java.lang.IllegalStateException
Add a ContextMessageListener to this context.

Parameters:
l - the listener to add
Throws:
java.lang.IllegalStateException - if the context has been destroyed.
CAException

removeContextMessageListener

public abstract void removeContextMessageListener(ContextMessageListener l)
                                           throws CAException,
                                                  java.lang.IllegalStateException
Removes a ContextMessageListener from this context.

Parameters:
l - the listener to remove
Throws:
java.lang.IllegalStateException - if the context has been destroyed.
CAException

getContextExceptionListeners

public abstract ContextExceptionListener[] getContextExceptionListeners()
                                                                 throws java.lang.IllegalStateException
Returns:
an array containing all ContextExceptionListeners attached to this context.
Throws:
java.lang.IllegalStateException - if the context has been destroyed.

addContextExceptionListener

public abstract void addContextExceptionListener(ContextExceptionListener l)
                                          throws CAException,
                                                 java.lang.IllegalStateException
Add a ContextExceptionListener to this context.

Parameters:
l - the listener to add
Throws:
java.lang.IllegalStateException - if the context has been destroyed.
CAException

removeContextExceptionListener

public abstract void removeContextExceptionListener(ContextExceptionListener l)
                                             throws CAException,
                                                    java.lang.IllegalStateException
Removes a ContextExceptionListener from this context.

Parameters:
l - the listener to remove
Throws:
java.lang.IllegalStateException - if the context has been destroyed.
CAException

shutdown

public abstract void shutdown()
                       throws CAException,
                              java.lang.IllegalStateException
Shutdown (stop executing run() method) of this Context. After shutdown Context cannot be rerun again, destory() has to be called to clear all used resources.

Throws:
java.lang.IllegalStateException - if the context has been destroyed.
CAException

destroy

public abstract void destroy()
                      throws CAException,
                             java.lang.IllegalStateException
Clear all resources attached to this Context

Throws:
java.lang.IllegalStateException - if the context has been destroyed.
CAException

printInfo

public void printInfo()
               throws java.lang.IllegalStateException
Prints detailed information about the Context to the standard output stream.

Throws:
java.lang.IllegalStateException - if the context has been destroyed.

printInfo

public void printInfo(java.io.PrintStream out)
               throws java.lang.IllegalStateException
Prints detailed information about the Context to the specified output stream.

Parameters:
out - the output stream.
Throws:
java.lang.IllegalStateException - if the context has been destroyed.

dispose

public void dispose()
Dispose (destroy) server context.



Copyright © 2004-2006 Cosylab. All Rights Reserved.