Class LocalService

    • Constructor Detail

      • LocalService

        protected LocalService​(String packagePath)
        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 Detail

      • getUrl

        public abstract String getUrl()
        Returns the URL for this service.
        Returns:
        the URL
        Since:
        100.0.0
      • getPackagePath

        public String getPackagePath()
        Returns the path to the package used to create this service.
        Returns:
        the path to the package
        Since:
        100.0.0
      • getName

        public String 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

        public ArcGISRuntimeException 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

        public LocalServerStatus getStatus()
        Returns the service's status.
        Returns:
        the service's status
        Since:
        100.0.0
      • startAsync

        public ListenableFuture<Void> 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 the ListenableFuture returned will correspond to the previous startAsync 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

        public ListenableFuture<Void> 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 the ListenableFuture returned will correspond to the previous stopAsync 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

        public void addStatusChangedListener​(LocalService.StatusChangedListener listener)
        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

        public boolean removeStatusChangedListener​(LocalService.StatusChangedListener listener)
        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