java.lang.Object
com.esri.arcgisruntime.localserver.LocalService
- Direct Known Subclasses:
LocalGeoprocessingService
,LocalMapService
Class representing a service on a local server.
- Since:
- 100.0.0
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
An event which indicates that the status of aLocalService
changed.static interface
The listener interface for receivingLocalService.StatusChangedEvent
changed events fromLocalService
resources. -
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
LocalService
(String packagePath) Creates a local service from a package. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a listener that will be fired when the Local Service status changes.getError()
Returns any error if the service's status is FAILED.getName()
Returns the name of this service on the server.Returns the path to the package used to create this service.Gets the parameters needed to start the local service.Returns the service's status.abstract String
getUrl()
Returns the URL for this service.boolean
Removes a status change listener.Asynchronously starts the service.Asynchronously stops the service.
-
Field Details
-
mEndpoints
-
-
Constructor Details
-
LocalService
Creates a local service from a package.- Parameters:
packagePath
- the path to the package- Throws:
IllegalArgumentException
- if the path is null or empty- Since:
- 100.0.0
-
-
Method Details
-
getParameters
Gets the parameters needed to start the local service.- Returns:
- returns a map containing the parameters
- Throws:
UnsupportedEncodingException
- Since:
- 100.0.0
-
getUrl
Returns the URL for this service.- Returns:
- the URL
- Since:
- 100.0.0
-
getPackagePath
Returns the path to the package used to create this service.- Returns:
- the path to the package
- Since:
- 100.0.0
-
getName
Returns the name of this service on the server. If the name is null or empty a name will be automatically generated. Note that if this method is called on a service that is not running the name maybe changed when the service starts since each service running on a server requires a unique name.- Returns:
- the name
- Since:
- 100.0.0
-
getError
Returns any error if the service's status is FAILED.- Returns:
- the current error, null if there is no error
- Since:
- 100.0.0
-
getStatus
Returns the service's status.- Returns:
- the service's status
- Since:
- 100.0.0
-
startAsync
Asynchronously starts the service. Add a listener to the returned future to know when the service has completed starting. If the service is already starting or started this call will have no effect and theListenableFuture
returned will correspond to the previousstartAsync
that is starting or started the service. The previous ListenableFuture will become unavailable if the service moves from STARTED into the STOPPING state. The service can only be started from the STOPPED state - calling startAsync from other states will cause an exception.- Returns:
- A listenable future that will be complete when the service has started
- Throws:
IllegalStateException
- if the service is not in the STOPPED state and there is no previous future available to return- Since:
- 100.0.0
-
stopAsync
Asynchronously stops the service. Add a listener to the returned future to know when the service has completed stopping. If the service is already stopping or stopped this call will have no effect and theListenableFuture
returned will correspond to the previousstopAsync
that is stopping or stopped the service. The previous ListenableFuture will become unavailable if the service moves from STOPPED into the STARTING state. The service can only be stopped from the STARTED state - calling stopAsync from other states will cause an exception.- Returns:
- A listenable future that will be complete when the server has stopped
- Throws:
IllegalStateException
- if the service is not in the STARTED state and there is no previous future available to return- Since:
- 100.0.0
-
addStatusChangedListener
Adds a listener that will be fired when the Local Service status changes. The listener will be run on the UI thread if the listener is added from the UI thread, otherwise it will be invoked on the current thread.- Parameters:
listener
- the listener- Throws:
IllegalArgumentException
- if listener is null- Since:
- 100.0.0
-
removeStatusChangedListener
Removes a status change listener.- Parameters:
listener
- the listener to remove- Returns:
- true, if successful
- Throws:
IllegalArgumentException
- if listener is null- Since:
- 100.0.0
-