Class JobBasedServerModulePublisher

java.lang.Object
com.e1c.g5.dt.internal.applications.wst.JobBasedServerModulePublisher
All Implemented Interfaces:
IServerModulePublisher

public class JobBasedServerModulePublisher extends Object implements IServerModulePublisher
Publishes server module using a separate job.

This implementation of IServerModulePublisher tries to provide both:

  • Thread safety of IServer.publish(int, List, org.eclipse.core.runtime.IAdaptable, org.eclipse.wst.server.core.IServer.IOperationListener) by doing actual publishing in a background job as required by WST API.
  • Integration with IProgressMonitor in terms of user ability to cancel the operation.
When specified progress monitor is cancelled then, an actual job that publishes module is cancelled as well. The job is also cancelled when caller thread is interrupted. The same way, when publishing job is cancelled (as indicated by its status) then this is propagated to the progress monitor specified by the caller (which is also cancelled in this case).

Control is released to the caller when any of the following happen:

  • Operation has already been cancelled upon the call and this is reported as IStatus.CANCEL.
  • Publishing job finishes as a result of finishing publish process, an error or responding to cancellation. The same status returned as by publishing job.
  • Caller thread gets interrupted and this is reported as IStatus.CANCEL.
  • Progress monitor specified by the caller gets cancelled and this is reported as IStatus.CANCEL.
  • If publishing job cannot be run. For example, if job manager is suspended then no jobs are scheduled. This case is indicated by Optional.empty().
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Optional<org.eclipse.core.runtime.IStatus>
    publish(int kind, org.eclipse.wst.server.core.IServer server, org.eclipse.wst.server.core.IModule module, org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.swt.widgets.Shell shell)
    Publishes specified server module.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JobBasedServerModulePublisher

      public JobBasedServerModulePublisher()
  • Method Details

    • publish

      public Optional<org.eclipse.core.runtime.IStatus> publish(int kind, org.eclipse.wst.server.core.IServer server, org.eclipse.wst.server.core.IModule module, org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.swt.widgets.Shell shell)
      Description copied from interface: IServerModulePublisher
      Publishes specified server module.
      Specified by:
      publish in interface IServerModulePublisher
      Parameters:
      kind - Type of publishing. Should be one of the following:
      • IServer.PUBLISH_INCREMENTAL
      • IServer.PUBLISH_FULL
      • IServer.PUBLISH_AUTO
      • IServer.PUBLISH_CLEAN
      server - Server where the module should be published. Must not be null.
      module - Module to be published. Must not be null.
      monitor - Progress monitor that user can cancel to cancel publication process. Must not be null.
      shell - Shell to be used to prompt user if necessary or null if not available.
      Returns:
      Status of publication process or an empty value if publication operation has not been done. Never null.