Class WebService

java.lang.Object
com.google.common.util.concurrent.AbstractIdleService
org.somda.sdc.dpws.device.WebService
All Implemented Interfaces:
com.google.common.util.concurrent.Service, Interceptor

public abstract class WebService extends com.google.common.util.concurrent.AbstractIdleService implements Interceptor
Web Service base class.

The Web Service is a server interceptor to process incoming requests of a certain Web Service. Moreover, the Web Service base class is capable of providing an event source to send notifications if needed.

The event source is only set if a hosted service has been registered at the Web Service. The hosted service can be registered by first getting the hosting service access followed by adding a hosted service:

  1. Device.getHostingServiceAccess() to get hosting service access, and then
  2. HostingServiceAccess.addHostedService(HostedService) to add the service to a hosting service.
Use this class as a server interceptor when calling HostingServiceAccess.addHostedService(HostedService).
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service

    com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Default constructor that initializes a non-functioning event source stub.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the event sources of this Web Service.
    void
    Allows to register an event source from outside.
    protected void
     
    protected void
     

    Methods inherited from class com.google.common.util.concurrent.AbstractIdleService

    addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, serviceName, startAsync, state, stopAsync, toString

    Methods inherited from class java.lang.Object

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

    • WebService

      protected WebService()
      Default constructor that initializes a non-functioning event source stub.
  • Method Details

    • startUp

      protected void startUp() throws Exception
      Specified by:
      startUp in class com.google.common.util.concurrent.AbstractIdleService
      Throws:
      Exception
    • shutDown

      protected void shutDown() throws Exception
      Specified by:
      shutDown in class com.google.common.util.concurrent.AbstractIdleService
      Throws:
      Exception
    • registerEventSource

      public void registerEventSource(EventSourceDialectHandler eventSource) throws IllegalStateException
      Allows to register an event source from outside.

      This method is not thread-safe and should only be invoked initially by the user prior to start up.

      Parameters:
      eventSource - the event source to inject or null to reset.
      Throws:
      IllegalStateException - if the Web Service is running.
    • getEventSources

      public Collection<EventSourceDialectHandler> getEventSources()
      Gets the event sources of this Web Service.
      Returns:
      the event sources.