com.esri.client.local
Class LocalService

java.lang.Object
  extended by com.esri.client.local.LocalService
Direct Known Subclasses:
LocalGeocodeService, LocalGeoprocessingService, LocalMapService

public abstract class LocalService
extends Object

Class representing a service on the LocalServer.


Field Summary
protected  String _serviceType
           
protected static String CREATE_SERVICE_FILE_PATH
           
protected static String CREATE_SERVICE_NAME
           
protected static String CREATE_SERVICE_TYPE
           
 
Constructor Summary
LocalService()
           
 
Method Summary
 void addLocalServiceStartCompleteListener(LocalServiceStartCompleteListener listener)
          Add a service start complete listener.
 void addLocalServiceStopCompleteListener(LocalServiceStopCompleteListener listener)
          Add service stop complete listener.
protected  void completeStart()
          Override this to perform any service specific tasks at the end of our initialization process.
protected  void deleteService(String name)
          Delete a service.
protected  void failStart(com.esri.client.local.LocalServerError response)
          Fail start.
protected  void failStart(String error)
          Fail start.
protected  void fireLocalServiceStartCompleteEvent()
           
 String getDescription()
          Get a description for the service.
 Map<String,String> getEndpoints()
          Gets the end points for the service.
 String getError()
          Gets any error; for example an error starting the service.
 LocalServiceStatus getStatus()
          Gets the status of the service.
protected  String getUrl()
          Get the URL of the service.
 void removeLocalServiceStartCompleteListener(LocalServiceStartCompleteListener listener)
          Remove service start complete listener.
 void removeLocalServiceStopCompleteListener(LocalServiceStopCompleteListener listener)
          Remove service stop complete listener.
protected  org.codehaus.jackson.JsonParser sendRequest(URL url, String data)
          Sends a request to a URL.
protected  void setError(String error)
          Set an error for the service.
 void setStatus(LocalServiceStatus status)
          Set the status of the service.
abstract  LocalServiceStatus start()
          Starts the service on the LocalServer and blocks the application till the service has stopped.
abstract  void startAsync()
          Starts the service on the LocalServer and allows the application to remain responsive while the service is starting.
protected  void startAsyncInner()
          Asynchronous start up.
protected  LocalServiceStatus startInner()
           
 LocalServiceStatus stop()
          Stops the service and blocks the application till the service has stopped.
 void stopAsync()
          Stops the service and allows the application to remain responsive while the service is starting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CREATE_SERVICE_FILE_PATH

protected static final String CREATE_SERVICE_FILE_PATH
See Also:
Constant Field Values

CREATE_SERVICE_NAME

protected static final String CREATE_SERVICE_NAME
See Also:
Constant Field Values

CREATE_SERVICE_TYPE

protected static final String CREATE_SERVICE_TYPE
See Also:
Constant Field Values

_serviceType

protected String _serviceType
Constructor Detail

LocalService

public LocalService()
Method Detail

getUrl

protected String getUrl()
Get the URL of the service.

Returns:
The URL.

getError

public String getError()
Gets any error; for example an error starting the service.

Returns:
An error string.

getEndpoints

public Map<String,String> getEndpoints()
Gets the end points for the service.

Returns:
The available end points.

setError

protected void setError(String error)
Set an error for the service.

Parameters:
error - The error message.

getStatus

public LocalServiceStatus getStatus()
Gets the status of the service.

Returns:
The service status.

setStatus

public void setStatus(LocalServiceStatus status)
Set the status of the service.

Parameters:
status - Service status to be set.

getDescription

public String getDescription()
Get a description for the service.

Returns:
A description of the service.

startAsync

public abstract void startAsync()
Starts the service on the LocalServer and allows the application to remain responsive while the service is starting. Use the addLocalServiceStartCompleteListener(LocalServiceStartCompleteListener) method to listen for the start complete event. Alternatively, use the getStatus() and getError() methods the LocalServiceStatus is STARTED before using the service.


start

public abstract LocalServiceStatus start()
Starts the service on the LocalServer and blocks the application till the service has stopped.

Returns:
the local service status

stopAsync

public void stopAsync()
Stops the service and allows the application to remain responsive while the service is starting. Use the addLocalServiceStopCompleteListener(LocalServiceStopCompleteListener) method to listen for the stop complete event.


stop

public LocalServiceStatus stop()
Stops the service and blocks the application till the service has stopped.

Returns:
the local service status

addLocalServiceStartCompleteListener

public void addLocalServiceStartCompleteListener(LocalServiceStartCompleteListener listener)
Add a service start complete listener.

Parameters:
listener - The listener to add.

removeLocalServiceStartCompleteListener

public void removeLocalServiceStartCompleteListener(LocalServiceStartCompleteListener listener)
Remove service start complete listener.

Parameters:
listener - The listener to remove.

addLocalServiceStopCompleteListener

public void addLocalServiceStopCompleteListener(LocalServiceStopCompleteListener listener)
Add service stop complete listener.

Parameters:
listener - Listener to add.

removeLocalServiceStopCompleteListener

public void removeLocalServiceStopCompleteListener(LocalServiceStopCompleteListener listener)
Remove service stop complete listener.

Parameters:
listener - Listener to remove.

sendRequest

protected org.codehaus.jackson.JsonParser sendRequest(URL url,
                                                      String data)
Sends a request to a URL.

Parameters:
url - the URL
data - the data
Returns:
the JSON parser

fireLocalServiceStartCompleteEvent

protected void fireLocalServiceStartCompleteEvent()

failStart

protected void failStart(String error)
Fail start.

Parameters:
error - the error

failStart

protected void failStart(com.esri.client.local.LocalServerError response)
Fail start.

Parameters:
response - the response

startAsyncInner

protected void startAsyncInner()
Asynchronous start up.


startInner

protected LocalServiceStatus startInner()

deleteService

protected void deleteService(String name)
Delete a service.

Parameters:
name - the name of the service

completeStart

protected void completeStart()
Override this to perform any service specific tasks at the end of our initialization process.



Copyright © 2012. All Rights Reserved.