Contents Index LogMessage class ServerException class

MobiLink Synchronization User's Guide
  Writing Synchronization Scripts in Java
    MobiLink Java API Reference

ServerContext interface


An instantiation of all the context that is present for the duration of the MobiLink server. This context can be held as static data and used in a background thread. It is valid for the duration of the Java virtual machine invoked by MobiLink.

addShutdownListener 

public void addShutdownListener (ShutdownListener sl)

Adds the specified ShutdownListener that is to receive notification before the server context is destroyed. On shutdown, the method ShutdownListener.shutdownPerformed (ianywhere.ml.script.ServerContext) is called. There is one parameter, sl, which specifies that the ShutdownListener is to be notified on shutdown.

removeShutdownListener 

public void removeShutdownListener (ShutdownListener sl)

Removes the specified ShutdownListener from the list of listeners that are to receive notification before the server context is destroyed. There is one parameter, sl, which specifies the listener that will no longer be notified on shutdown.

shutdown 

public void shutdown( )

Forces the server to shut down.

getStartClassInstances 

public java.lang.Object[ ] getStartClassInstances( )

Gets an array of the start classes that were constructed at server start time. The array length is zero if there are no start classes.

For more information about user-defined start classes, see User-defined start classes.

Following is an example of getStartClassInstances():

Object objs[] = sc.getStartClassInstances();
int i;
for( i=0; i<objs.length; i+=1 ) {
   if( objs[i] instanceof MyClass ) {
       //use class
   }
}
makeConnection method 

public java.sql.Connection makeConnection( )
throws java.sql.SQLException

Opens and returns a new server connection. To access the server context, use DBConnectionContext.getServerContext on the synchronization context for the current connection. If an error occurs opening a new connection, the method throws java.sql.SQLException.

addErrorListener method 

public void addErrorListener( LogListener ll )

Adds the specified LogListener to receive a notification when an error is printed.

ll is the LogListener that is to be notified.

The following method will be called: LogListener.messageLogged(ianywhere.ml.script.ServerContext, ianywhere.ml.script.LogMessage).

removeError Listener method 

public void removeErrorListener( LogListener ll )

Removes the specified LogListener from the list of listeners that are to receive a notification when an error is printed.

ll is the LogListener that is no longer to be notified.

addWarningListener method 

public void addWarningListener( LogListener ll )

Adds the specified LogListener to receive a notification when a warning is printed.

ll is the LogListener that is to be notified.

The following method will be called: LogListener.messageLogged(ianywhere.ml.script.ServerContext, ianywhere.ml.script.LogMessage).

removeWarningListener method 

public void removeWarningListener( LogListener ll )

Removes the specified LogListener from the list of listeners that are to receive a notification when a warning is printed.

ll is the LogListener that is no longer to be notified.


Contents Index LogMessage class ServerException class