|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--galaxy.server.Server
This is the base class for all Galaxy servers implemented in Java. It implements the basic message loop, logging, and the symbolic invocation of the dispatch function defined in the received frame.
You can add a ServerListener
to receive notification of Server
events.
MainServer
,
ServerListener
Field Summary | |
protected MainServer |
mainServer
Reference to the MainServer that started this server. |
Constructor Summary | |
Server(MainServer mainServer,
java.net.Socket socket)
Creates a new server. |
Method Summary | |
protected void |
addContinuationData(int serverTidx,
ContinuationData data)
Stores continuation data associated with a server token index. |
void |
addServerListener(ServerListener listener)
|
void |
addServiceType(java.lang.String serviceType)
Adds a service type to this server's lists of supported service types if it is not already in the list. |
protected void |
addSignature(Signature sig)
Adds new signature information for this server. |
protected void |
cleanup()
This cleanup method is called when this server is preparing to stop. |
protected void |
deleteServerProperties(java.lang.String[] keys)
Deletes the specified server properties. |
protected GVector |
encodeSignatures()
Encodes this server's signature information in a GVector . |
protected GFrame |
evaluateHubFrame(GFrame frame)
Evaluates the Hub frame. |
protected ContinuationData |
getContinuationData(int serverTidx)
Gets the continuation data associated with a server token index. |
Environment |
getCopyOfCurrentEnvironment()
Returns a copy of this server's current execution environment. |
Environment |
getCurrentEnvironment()
Returns this server current execution environment. |
java.lang.String |
getHostAddress()
Gets the host address for this server's local host. |
int |
getHubContactPolicy()
Gets the Hub contact policy (used if this server is a Hub client). |
java.net.InetAddress |
getIPAddress()
Gets the internet address information for this server's local host. |
MainServer |
getMainServer()
Returns the reference to the MainServer that started this
server. |
GFrame |
getServerProperties()
Gets this server's properties. |
GVector |
getServiceTypes()
Gets the service types supported by this server. |
java.lang.String |
getSessionId()
Gets the session id. |
protected Signature |
getSignature(java.lang.String op)
Gets the signature information associated with an operation on this server's interface |
boolean |
getValidate()
Gets the value of the method signature validation flag. |
void |
init()
Called before server starts. |
boolean |
isRunning()
Indicates if this server's thread is marked as running or stopped. |
void |
log(java.lang.String msg)
Deprecated. As of Galaxy Communicator 4.0. Use logMessage(String, int). |
protected void |
logAndSendError(java.lang.String msg)
Deprecated. As of Galaxy Communicator 4.0. Use logAndSendErrorMessage(String). |
protected void |
logAndSendError(java.lang.String msg,
int errno)
Deprecated. As of Galaxy Communicator 4.0. Use logAndSendErrorMessage(String, int). |
protected void |
logAndSendErrorMessage(java.lang.String msg)
|
protected void |
logAndSendErrorMessage(java.lang.String msg,
java.lang.Exception ex)
|
protected void |
logAndSendErrorMessage(java.lang.String msg,
java.lang.Exception ex,
java.lang.String location)
|
protected void |
logAndSendErrorMessage(java.lang.String msg,
int errno)
|
protected void |
logAndSendErrorMessage(java.lang.String msg,
int errno,
java.lang.Exception ex)
|
protected void |
logAndSendErrorMessage(java.lang.String msg,
int errno,
java.lang.Exception ex,
java.lang.String location)
|
protected void |
logAndSendErrorMessage(java.lang.String msg,
int errno,
java.lang.String location)
|
protected void |
logAndSendErrorMessage(java.lang.String msg,
java.lang.String location)
|
void |
logError(java.lang.String msg)
Deprecated. As of Galaxy Communicator 4.0. Use logErrorMessage(String). |
void |
logError(java.lang.String msg,
java.lang.Exception ex)
Deprecated. As of Galaxy Communicator 4.0. Use logErrorMessage(String, Exception). |
void |
logErrorMessage(java.lang.String msg)
Displays an error message to System.err when the current verbosity level is equal to or greater than galaxy.server.MainServer.ERROR_VERBOSITY_LEVEL . |
void |
logErrorMessage(java.lang.String msg,
java.lang.Exception ex)
Displays an error message to System.err when the current verbosity level is equal to or greater than galaxy.server.MainServer.ERROR_VERBOSITY_LEVEL . |
void |
logErrorMessage(java.lang.String msg,
java.lang.Exception ex,
java.lang.String location)
Displays an error message to System.err when the current verbosity level is equal to or greater than galaxy.server.MainServer.ERROR_VERBOSITY_LEVEL . |
void |
logErrorMessage(java.lang.String msg,
java.lang.String location)
Displays an error message to System.err when the current verbosity level is equal to or greater than galaxy.server.MainServer.ERROR_VERBOSITY_LEVEL . |
void |
logFatalError(java.lang.String msg)
Deprecated. As of Galaxy Communicator 4.0. Use logFatalMessage(String). |
void |
logFatalError(java.lang.String msg,
java.lang.Exception ex)
Deprecated. As of Galaxy Communicator 4.0. Use logFatalMessage(String, Exception). |
void |
logFatalMessage(java.lang.String msg)
Displays a fatal error message to System.err when the current verbosity level is equal to or greater than galaxy.server.MainServer.FATAL_VERBOSITY_LEVEL . |
void |
logFatalMessage(java.lang.String msg,
java.lang.Exception ex)
Displays a fatal error message to System.err when the current verbosity level is equal to or greater than galaxy.server.MainServer.FATAL_VERBOSITY_LEVEL . |
void |
logFatalMessage(java.lang.String msg,
java.lang.Exception ex,
java.lang.String location)
Displays a fatal error message to System.err when the current verbosity level is equal to or greater than galaxy.server.MainServer.FATAL_VERBOSITY_LEVEL . |
void |
logFatalMessage(java.lang.String msg,
java.lang.String location)
Displays a fatal error message to System.err when the current verbosity level is equal to or greater than galaxy.server.MainServer.FATAL_VERBOSITY_LEVEL . |
void |
logMessage(java.lang.String msg)
Displays a message to System.out (at any verbosity level). |
void |
logMessage(java.lang.String msg,
int level)
Displays a message to System.out. |
void |
logMessage(java.lang.String msg,
int level,
java.lang.String location)
Displays a message to System.out. |
void |
logWarning(java.lang.String msg)
Deprecated. As of Galaxy Communicator 4.0. Use logWarningMessage(String). |
void |
logWarningMessage(java.lang.String msg)
Displays a warning message to System.err when the current verbosity level is equal to or greater than galaxy.server.MainServer.WARNING_VERBOSITY_LEVEL . |
void |
logWarningMessage(java.lang.String msg,
java.lang.String location)
Displays a warning message to System.err when the current verbosity level is equal to or greater than galaxy.server.MainServer.WARNING_VERBOSITY_LEVEL . |
protected void |
registerOutBroker(DataOutBroker broker)
Registers an outgoing broker that was started by this server. |
void |
removeServerListener(ServerListener listener)
|
void |
run()
This implements the basic message loop. |
void |
serverOpReinitialize(GFrame frame)
Subclasses of Server typically override this method in
order to provide custom reinitialization. |
void |
setHubContactPolicy(int hubContactPolicy)
Sets the Hub contact policy (used if this server is a Hub client). |
protected void |
setServerProperties(GFrame props)
Sets the specified server properties. |
void |
setValidate(boolean validate)
Sets the method signature validation flag. |
void |
stop()
Marks this server's thread as being stopped. |
protected boolean |
unregisterOutBroker(DataOutBroker broker)
Unregisters an outgoing broker that was started by this server. |
protected boolean |
wasHubContactPolicyModified()
Tests if this server's Hub contact policy has been modified since the the server was created. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected MainServer mainServer
MainServer
that started this server.Constructor Detail |
public Server(MainServer mainServer, java.net.Socket socket) throws java.io.IOException
mainServer
- the MainServer
that created this serversocket
- the socket connection to the HubMethod Detail |
public void init() throws java.lang.Exception
public void setValidate(boolean validate)
validate
- true if validation should be done, false otherwisepublic boolean getValidate()
public java.net.InetAddress getIPAddress()
public java.lang.String getHostAddress()
public Environment getCurrentEnvironment()
public Environment getCopyOfCurrentEnvironment()
public MainServer getMainServer()
MainServer
that started this
server.MainServer
public GFrame getServerProperties()
protected void setServerProperties(GFrame props)
props
- the properties to setprotected void deleteServerProperties(java.lang.String[] keys)
keys
- the keys of the properties to deletepublic void addServiceType(java.lang.String serviceType)
serviceType
- the service type to addpublic GVector getServiceTypes()
public void setHubContactPolicy(int hubContactPolicy)
hubContactPolicy
- the policyprotected boolean wasHubContactPolicyModified()
public int getHubContactPolicy()
public java.lang.String getSessionId()
protected void registerOutBroker(DataOutBroker broker)
broker
- the brokerprotected boolean unregisterOutBroker(DataOutBroker broker)
broker
- the brokerpublic void stop()
public boolean isRunning()
protected void cleanup()
Server
cleanup will still take place.public void run()
run
in interface java.lang.Runnable
evaluateHubFrame(galaxy.lang.GFrame)
protected ContinuationData getContinuationData(int serverTidx)
serverTidx
- the server token index associated with the
continuationprotected void addContinuationData(int serverTidx, ContinuationData data)
serverTidx
- the server token index associated with the
continuationdata
- the continuation dataprotected void addSignature(Signature sig)
sig
- the signature informationprotected Signature getSignature(java.lang.String op)
op
- the name of the operationprotected GVector encodeSignatures()
GVector
.protected GFrame evaluateHubFrame(GFrame frame)
op_name
property
is extracted from the frame and the method name formed by prepending
serverOp
when it is called.
For example, if serverOp
is explode
, then the
method serverOpExplode
will be called.public void serverOpReinitialize(GFrame frame)
Server
typically override this method in
order to provide custom reinitialization.public void addServerListener(ServerListener listener)
public void removeServerListener(ServerListener listener)
public void log(java.lang.String msg)
public void logWarning(java.lang.String msg)
public void logError(java.lang.String msg)
public void logError(java.lang.String msg, java.lang.Exception ex)
public void logFatalError(java.lang.String msg)
public void logFatalError(java.lang.String msg, java.lang.Exception ex)
public void logMessage(java.lang.String msg, int level)
DiagnosticLogger
logMessage
in interface DiagnosticLogger
galaxy.util.DiagnosticLogger
msg
- the message to displaylevel
- the minimum verbosity level at which to display the message
(verbosity levels are defined in
galaxy.server.MainServer
)public void logMessage(java.lang.String msg, int level, java.lang.String location)
DiagnosticLogger
logMessage
in interface DiagnosticLogger
galaxy.util.DiagnosticLogger
msg
- the message to displaylevel
- the minimum verbosity level at which to display the message
(verbosity levels are defined in
galaxy.server.MainServer
)location
- "location" of the associated call to this method
(e.g., the class and method name from which this call
was made) which is displayed at verbosity levels
4 and abovepublic void logMessage(java.lang.String msg)
DiagnosticLogger
logMessage
in interface DiagnosticLogger
galaxy.util.DiagnosticLogger
msg
- the message to displaypublic void logWarningMessage(java.lang.String msg)
DiagnosticLogger
galaxy.server.MainServer.WARNING_VERBOSITY_LEVEL
.logWarningMessage
in interface DiagnosticLogger
galaxy.util.DiagnosticLogger
msg
- the message to displaypublic void logWarningMessage(java.lang.String msg, java.lang.String location)
DiagnosticLogger
galaxy.server.MainServer.WARNING_VERBOSITY_LEVEL
.logWarningMessage
in interface DiagnosticLogger
galaxy.util.DiagnosticLogger
msg
- the message to displaylocation
- "location" of the associated call to this method
(e.g., the class and method name from which this call
was made) which is displayed at verbosity levels
4 and abovepublic void logErrorMessage(java.lang.String msg)
DiagnosticLogger
galaxy.server.MainServer.ERROR_VERBOSITY_LEVEL
.logErrorMessage
in interface DiagnosticLogger
galaxy.util.DiagnosticLogger
msg
- the message to displaypublic void logErrorMessage(java.lang.String msg, java.lang.Exception ex)
DiagnosticLogger
galaxy.server.MainServer.ERROR_VERBOSITY_LEVEL
.logErrorMessage
in interface DiagnosticLogger
galaxy.util.DiagnosticLogger
msg
- the message to displayex
- the stack trace of this exception is also displayedpublic void logErrorMessage(java.lang.String msg, java.lang.String location)
DiagnosticLogger
galaxy.server.MainServer.ERROR_VERBOSITY_LEVEL
.logErrorMessage
in interface DiagnosticLogger
galaxy.util.DiagnosticLogger
msg
- the message to displaylocation
- "location" of the associated call to this method
(e.g., the class and method name from which this call
was made) which is displayed at verbosity levels
4 and abovepublic void logErrorMessage(java.lang.String msg, java.lang.Exception ex, java.lang.String location)
DiagnosticLogger
galaxy.server.MainServer.ERROR_VERBOSITY_LEVEL
.logErrorMessage
in interface DiagnosticLogger
galaxy.util.DiagnosticLogger
msg
- the message to displayex
- the stack trace of this exception is also displayedlocation
- "location" of the associated call to this method
(e.g., the class and method name from which this call
was made) which is displayed at verbosity levels
4 and abovepublic void logFatalMessage(java.lang.String msg)
DiagnosticLogger
galaxy.server.MainServer.FATAL_VERBOSITY_LEVEL
.logFatalMessage
in interface DiagnosticLogger
galaxy.util.DiagnosticLogger
msg
- the message to displaypublic void logFatalMessage(java.lang.String msg, java.lang.Exception ex)
DiagnosticLogger
galaxy.server.MainServer.FATAL_VERBOSITY_LEVEL
.logFatalMessage
in interface DiagnosticLogger
galaxy.util.DiagnosticLogger
msg
- the message to displayex
- the stack trace of this exception is also displayedpublic void logFatalMessage(java.lang.String msg, java.lang.String location)
DiagnosticLogger
galaxy.server.MainServer.FATAL_VERBOSITY_LEVEL
.logFatalMessage
in interface DiagnosticLogger
galaxy.util.DiagnosticLogger
msg
- the message to displaylocation
- "location" of the associated call to this method
(e.g., the class and method name from which this call
was made) which is displayed at verbosity levels
4 and abovepublic void logFatalMessage(java.lang.String msg, java.lang.Exception ex, java.lang.String location)
DiagnosticLogger
galaxy.server.MainServer.FATAL_VERBOSITY_LEVEL
.logFatalMessage
in interface DiagnosticLogger
galaxy.util.DiagnosticLogger
msg
- the message to displayex
- the stack trace of this exception is also displayedlocation
- "location" of the associated call to this method
(e.g., the class and method name from which this call
was made) which is displayed at verbosity levels
4 and aboveprotected void logAndSendError(java.lang.String msg)
msg
- the description of the errorprotected void logAndSendError(java.lang.String msg, int errno) throws java.io.IOException
protected void logAndSendErrorMessage(java.lang.String msg) throws java.io.IOException
protected void logAndSendErrorMessage(java.lang.String msg, java.lang.Exception ex) throws java.io.IOException
protected void logAndSendErrorMessage(java.lang.String msg, int errno) throws java.io.IOException
protected void logAndSendErrorMessage(java.lang.String msg, int errno, java.lang.Exception ex) throws java.io.IOException
protected void logAndSendErrorMessage(java.lang.String msg, java.lang.String location) throws java.io.IOException
protected void logAndSendErrorMessage(java.lang.String msg, java.lang.Exception ex, java.lang.String location) throws java.io.IOException
protected void logAndSendErrorMessage(java.lang.String msg, int errno, java.lang.String location) throws java.io.IOException
protected void logAndSendErrorMessage(java.lang.String msg, int errno, java.lang.Exception ex, java.lang.String location) throws java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |