com.esri.client.local
Class LocalServer

java.lang.Object
  extended by com.esri.client.local.LocalServer

public final class LocalServer
extends Object

Singleton class representing the LocalServer. The LocalServer must be licensed with a valid license string prior to attempting to create any LocalService instances. It is not necessary to work with the LocalServer directly. Instead, creating and starting the individual LocalService classes (LocalMapService, LocalFeatureService, LocalGeocodeService and LocalGeoprocessingService) will start the LocalServer if it is not already running. The LocalServer will automatically shutdown a short time after your application exits.
The LocalServer can be controlled directly. Call the isInstallOK() method to check the installation on disk. Once the license string has been set the LocalServer can be started by calling the asynchronous initializeAsync() method and listening for the server initialized event. To determine whether the LocalServer is currently running use the getStatus() method or the isInitialized() method. Finally, when the LocalServer is no longer required the shutdownAsync() method can be called to shutdown the LocalServer and recover any resources being used. Once the LocalServer has shutdown it will trigger the server shutdown event.


Method Summary
 void addServerLifetimeListener(ServerLifetimeListener listener)
          Add a server life time listener.
 void addServerMessageListener(ServerMessageListener listener)
          Adds a listener for server messages.
protected  void fireServerErrorMessageEvent(String message)
          Fires a server error message.
protected  void fireServerInfoMessageEvent(String message)
          Fires a server information message.
protected  void fireServerInitializedEvent()
          Fires server initialized event.
protected  void fireServerShutdownEvent()
          Fires server shutdown event.
 String getInitializationError()
          Gets any initialization errors.
static LocalServer getInstance()
          Get the current LocalServer instance.
 Collection<LocalService> getServices()
          Gets a read only list of local services currently running on the LocalServer.
 LocalServerStatus getStatus()
          Gets the current LocalServer status.
 LocalServerStatus initialize()
          Starts up the LocalServer.
 void initializeAsync()
          Starts up the LocalServer.
 boolean isInitialized()
          Indicates whether or not the server has been initialized.
protected  boolean isLinux()
           
 void removeServerLifetimeListener(ServerLifetimeListener listener)
          Removes a server life time listener.
 void removeServerMessageListener(ServerMessageListener listener)
          Removes a server message listener.
 LocalServerStatus shutdown()
          Shuts down the LocalServer.
 void shutdownAsync()
          Shuts down the LocalServer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initializeAsync

public void initializeAsync()
Starts up the LocalServer. Starts up the LocalServer if it isn't already starting up or already running. Allows the application to remain responsive while the LocalServer is starting. It is recommended that you add a server lifetime listener to determine when initialization is complete and examine any initialization errors.


initialize

public LocalServerStatus initialize()
Starts up the LocalServer. The application will block until the LocalServer has started (or until it has failed to start.)

Returns:
the local server status.

shutdownAsync

public void shutdownAsync()
Shuts down the LocalServer. Allows the application to remain responsive while the LocalServer is starting.


shutdown

public LocalServerStatus shutdown()
Shuts down the LocalServer. The application will block until the LocalServer has shutdown (or until it has failed to shutdown.)

Returns:
the local server status

isInitialized

public boolean isInitialized()
Indicates whether or not the server has been initialized.

Returns:
True if the server is initialized, false otherwise.

getInstance

public static LocalServer getInstance()
Get the current LocalServer instance.

Returns:
Current LocalServer instance.

getStatus

public LocalServerStatus getStatus()
Gets the current LocalServer status.

Returns:
Current status.

getInitializationError

public String getInitializationError()
Gets any initialization errors.

Returns:
Initialization errors.

getServices

public Collection<LocalService> getServices()
Gets a read only list of local services currently running on the LocalServer. These services can be in a starting, stopping, or running state.

Returns:
List of local services running.

addServerMessageListener

public void addServerMessageListener(ServerMessageListener listener)
Adds a listener for server messages.

Parameters:
listener - The listener to add.

removeServerMessageListener

public void removeServerMessageListener(ServerMessageListener listener)
Removes a server message listener.

Parameters:
listener - The listener to remove.

addServerLifetimeListener

public void addServerLifetimeListener(ServerLifetimeListener listener)
Add a server life time listener.

Parameters:
listener - The listener to add.

removeServerLifetimeListener

public void removeServerLifetimeListener(ServerLifetimeListener listener)
Removes a server life time listener.

Parameters:
listener - The listener to remove.

fireServerInfoMessageEvent

protected void fireServerInfoMessageEvent(String message)
Fires a server information message.

Parameters:
message - The message.

fireServerErrorMessageEvent

protected void fireServerErrorMessageEvent(String message)
Fires a server error message.

Parameters:
message - The error message.

fireServerInitializedEvent

protected void fireServerInitializedEvent()
Fires server initialized event.


fireServerShutdownEvent

protected void fireServerShutdownEvent()
Fires server shutdown event.


isLinux

protected boolean isLinux()


Copyright © 2012. All Rights Reserved.