Class ServerManager

java.lang.Object
jadex.publishservicejetty.impl.ServerManager

public class ServerManager extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static ServerManager
     
    protected Map<Integer,org.eclipse.jetty.server.Server>
    The servers per port.
    protected Map<jadex.providedservice.IServiceIdentifier,org.eclipse.jetty.server.Server>
    The servers per service id.
    protected Map<jadex.providedservice.IServiceIdentifier,jadex.common.Tuple2<org.eclipse.jetty.server.Server,org.eclipse.jetty.server.handler.ContextHandler>>
    Infos for unpublishing.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addPortServer(int port, org.eclipse.jetty.server.Server server)
     
    void
    addSidServer(jadex.providedservice.IServiceIdentifier sid, org.eclipse.jetty.server.Server server)
     
    void
    addUnpublishInfo(jadex.providedservice.IServiceIdentifier serviceid, org.eclipse.jetty.server.Server server, org.eclipse.jetty.server.handler.ContextHandler ch)
     
    static String[]
     
    getCleanPublishId(String id, jadex.core.IComponent component)
    Get the cleaned publish id.
    jadex.future.IFuture<Object>
    getHttpServer(URI uri, jadex.publishservice.impl.PublishInfo info)
    Get or start an api to the http server.
     
    org.eclipse.jetty.server.Server
    getServer(int port)
     
    void
    publishHMTLPage(String pid, String vhost, String html, jadex.core.IComponent component)
    Publish a static page (without ressources).
    jadex.future.IFuture<Void>
    publishResources(String pid, String rootpath, jadex.core.IComponent component)
    Publish file resources from the classpath.
    jadex.future.IFuture<Void>
    publishService(jadex.providedservice.IServiceIdentifier serviceid, jadex.publishservice.impl.PublishInfo info, jadex.core.IComponent component)
    Publish a service.
    jadex.common.Tuple2<org.eclipse.jetty.server.Server,org.eclipse.jetty.server.handler.ContextHandler>
    removeUnpublishInfo(jadex.providedservice.IServiceIdentifier serviceid)
     
    void
     
    void
    unpublishService(jadex.providedservice.IServiceIdentifier sid)
    Unpublish a service.

    Methods inherited from class java.lang.Object

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

    • sidservers

      protected Map<jadex.providedservice.IServiceIdentifier,org.eclipse.jetty.server.Server> sidservers
      The servers per service id.
    • portservers

      protected Map<Integer,org.eclipse.jetty.server.Server> portservers
      The servers per port.
    • unpublishinfos

      protected Map<jadex.providedservice.IServiceIdentifier,jadex.common.Tuple2<org.eclipse.jetty.server.Server,org.eclipse.jetty.server.handler.ContextHandler>> unpublishinfos
      Infos for unpublishing.
    • instance

      protected static ServerManager instance
  • Constructor Details

    • ServerManager

      public ServerManager()
  • Method Details

    • getInstance

      public static ServerManager getInstance()
    • publishService

      public jadex.future.IFuture<Void> publishService(jadex.providedservice.IServiceIdentifier serviceid, jadex.publishservice.impl.PublishInfo info, jadex.core.IComponent component)
      Publish a service.
      Parameters:
      cl - The classloader.
      service - The original service.
      pid - The publish id (e.g. url or name).
    • getHttpServer

      public jadex.future.IFuture<Object> getHttpServer(URI uri, jadex.publishservice.impl.PublishInfo info)
      Get or start an api to the http server.
    • unpublishService

      public void unpublishService(jadex.providedservice.IServiceIdentifier sid)
      Unpublish a service.
      Parameters:
      sid - The service identifier.
    • publishHMTLPage

      public void publishHMTLPage(String pid, String vhost, String html, jadex.core.IComponent component)
      Publish a static page (without ressources).
    • publishResources

      public jadex.future.IFuture<Void> publishResources(String pid, String rootpath, jadex.core.IComponent component)
      Publish file resources from the classpath.
    • terminateServers

      public void terminateServers(Set<Integer> ports)
    • getCleanPublishId

      public String getCleanPublishId(String id, jadex.core.IComponent component)
      Get the cleaned publish id. Square brackets for the optional host and context part are removed.
    • findVariables

      public static String[] findVariables(String str)
    • getServer

      public org.eclipse.jetty.server.Server getServer(int port)
    • addPortServer

      public void addPortServer(int port, org.eclipse.jetty.server.Server server)
    • addSidServer

      public void addSidServer(jadex.providedservice.IServiceIdentifier sid, org.eclipse.jetty.server.Server server)
    • addUnpublishInfo

      public void addUnpublishInfo(jadex.providedservice.IServiceIdentifier serviceid, org.eclipse.jetty.server.Server server, org.eclipse.jetty.server.handler.ContextHandler ch)
    • removeUnpublishInfo

      public jadex.common.Tuple2<org.eclipse.jetty.server.Server,org.eclipse.jetty.server.handler.ContextHandler> removeUnpublishInfo(jadex.providedservice.IServiceIdentifier serviceid)