Package gov.aps.jca.cas
Class ServerContext
- java.lang.Object
-
- gov.aps.jca.cas.ServerContext
-
- Direct Known Subclasses:
CAJServerContext
public abstract class ServerContext extends 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
Constructors Constructor Description ServerContext()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidaddContextExceptionListener(ContextExceptionListener l)Add a ContextExceptionListener to this context.abstract voidaddContextMessageListener(ContextMessageListener l)Add a ContextMessageListener to this context.abstract voiddestroy()Clear all resources attached to this Contextvoiddispose()Dispose (destroy) server context.abstract ContextExceptionListener[]getContextExceptionListeners()abstract ContextMessageListener[]getContextMessageListeners()abstract VersiongetVersion()abstract voidinitialize(Server server)SetServerimplemenation and initialzie server.voidprintInfo()Prints detailed information about the Context to the standard output stream.voidprintInfo(PrintStream out)Prints detailed information about the Context to the specified output stream.abstract voidremoveContextExceptionListener(ContextExceptionListener l)Removes a ContextExceptionListener from this context.abstract voidremoveContextMessageListener(ContextMessageListener l)Removes a ContextMessageListener from this context.abstract voidrun(int seconds)Run server (process events).abstract voidshutdown()Shutdown (stop executing run() method) of this Context.
-
-
-
Method Detail
-
getVersion
public abstract Version getVersion()
- Returns:
- version of the context implementation.
-
initialize
public abstract void initialize(Server server) throws CAException, IllegalStateException
SetServerimplemenation and initialzie server. This method is called immediately after instance construction (call of constructor).- Parameters:
server-Serverimplementation providingProcessVariableaccess (existance test and attach).- Throws:
CAException- IllegalStateExceptionIllegalStateException
-
run
public abstract void run(int seconds) throws CAException, IllegalStateExceptionRun server (process events).- Parameters:
seconds- time in seconds the server will process events (method will block), if0the method would block untildestory()is called.- Throws:
IllegalStateException- if server is already destroyed.CAException- CA Exception
-
getContextMessageListeners
public abstract ContextMessageListener[] getContextMessageListeners() throws IllegalStateException
- Returns:
- an array containing all ContextMessageListeners attached to this context.
- Throws:
IllegalStateException- if the context has been destroyed.
-
addContextMessageListener
public abstract void addContextMessageListener(ContextMessageListener l) throws CAException, IllegalStateException
Add a ContextMessageListener to this context.- Parameters:
l- the listener to add- Throws:
IllegalStateException- if the context has been destroyed.CAException- CA Exception
-
removeContextMessageListener
public abstract void removeContextMessageListener(ContextMessageListener l) throws CAException, IllegalStateException
Removes a ContextMessageListener from this context.- Parameters:
l- the listener to remove- Throws:
IllegalStateException- if the context has been destroyed.CAException- CA Exception
-
getContextExceptionListeners
public abstract ContextExceptionListener[] getContextExceptionListeners() throws IllegalStateException
- Returns:
- an array containing all ContextExceptionListeners attached to this context.
- Throws:
IllegalStateException- if the context has been destroyed.
-
addContextExceptionListener
public abstract void addContextExceptionListener(ContextExceptionListener l) throws CAException, IllegalStateException
Add a ContextExceptionListener to this context.- Parameters:
l- the listener to add- Throws:
IllegalStateException- if the context has been destroyed.CAException- CA Exception
-
removeContextExceptionListener
public abstract void removeContextExceptionListener(ContextExceptionListener l) throws CAException, IllegalStateException
Removes a ContextExceptionListener from this context.- Parameters:
l- the listener to remove- Throws:
IllegalStateException- if the context has been destroyed.CAException- CA Exception
-
shutdown
public abstract void shutdown() throws CAException, IllegalStateExceptionShutdown (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:
IllegalStateException- if the context has been destroyed.CAException- CA Exception
-
destroy
public abstract void destroy() throws CAException, IllegalStateExceptionClear all resources attached to this Context- Throws:
IllegalStateException- if the context has been destroyed.CAException- CA Exception
-
printInfo
public void printInfo() throws IllegalStateExceptionPrints detailed information about the Context to the standard output stream.- Throws:
IllegalStateException- if the context has been destroyed.
-
printInfo
public void printInfo(PrintStream out) throws IllegalStateException
Prints detailed information about the Context to the specified output stream.- Parameters:
out- the output stream.- Throws:
IllegalStateException- if the context has been destroyed.
-
dispose
public void dispose()
Dispose (destroy) server context.
-
-