Class Oort

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.cometd.oort.Oort
All Implemented Interfaces:
org.eclipse.jetty.util.component.Container, org.eclipse.jetty.util.component.Destroyable, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.LifeCycle

@ManagedObject("CometD cloud node") public class Oort extends org.eclipse.jetty.util.component.ContainerLifeCycle

Oort is the cluster manager that links one CometD server to a set of other CometD servers.

This class maintains a collection of OortComet instances to each CometD server, created by calls to observeComet(String).

The key configuration parameter is the Oort URL, which is full public URL of the CometD servlet to which the Oort instance is bound, for example: http://myserver:8080/context/cometd.

Oort instances can be configured with a shared secret, which allows the Oort instance to distinguish handshakes coming from remote clients from handshakes coming from other Oort comets: the firsts may be subject to a stricter authentication policy than the seconds.

  • Field Details Link icon

  • Constructor Details Link icon

  • Method Details Link icon

    • doStart Link icon

      protected void doStart() throws Exception
      Overrides:
      doStart in class org.eclipse.jetty.util.component.ContainerLifeCycle
      Throws:
      Exception
    • doStop Link icon

      protected void doStop() throws Exception
      Overrides:
      doStop in class org.eclipse.jetty.util.component.ContainerLifeCycle
      Throws:
      Exception
    • protectOortChannels Link icon

      protected void protectOortChannels(BayeuxServer bayeux)
    • unprotectOortChannels Link icon

      protected void unprotectOortChannels(BayeuxServer bayeux)
    • getScheduler Link icon

      protected ScheduledExecutorService getScheduler()
    • getBayeuxServer Link icon

      @ManagedAttribute(value="The BayeuxServer of this Oort", readonly=true) public BayeuxServer getBayeuxServer()
    • getURL Link icon

      @ManagedAttribute(value="The URL of this Oort", readonly=true) public String getURL()
      Returns:
      the public absolute URL of the Oort CometD server
    • getId Link icon

      @ManagedAttribute(value="The unique ID of this Oort", readonly=true) public String getId()
    • getSecret Link icon

      @ManagedAttribute("The secret of this Oort") public String getSecret()
    • setSecret Link icon

      public void setSecret(String secret)
    • isAckExtensionEnabled Link icon

      @ManagedAttribute("Whether the acknowledgement extension is enabled") public boolean isAckExtensionEnabled()
    • setAckExtensionEnabled Link icon

      public void setAckExtensionEnabled(boolean value)
    • isBinaryExtensionEnabled Link icon

      @ManagedAttribute("Whether the binary extension is enabled") public boolean isBinaryExtensionEnabled()
    • setBinaryExtensionEnabled Link icon

      public void setBinaryExtensionEnabled(boolean value)
    • getJSONContextClient Link icon

      public JSONContext.Client getJSONContextClient()
    • setJSONContextClient Link icon

      public void setJSONContextClient(JSONContext.Client jsonContext)
    • getClientTransportFactories Link icon

      public List<ClientTransport.Factory> getClientTransportFactories()
    • setClientTransportFactories Link icon

      public void setClientTransportFactories(List<ClientTransport.Factory> factories)
    • observeComet Link icon

      public OortComet observeComet(String cometURL)

      Connects (if not already connected) and observes another Oort instance (identified by the given URL) via a OortComet instance.

      Parameters:
      cometURL - the Oort URL to observe
      Returns:
      The OortComet instance associated to the Oort instance identified by the URL or null if the given Oort URL represent this Oort instance
    • newOortComet Link icon

      public OortComet newOortComet(String cometURL)
    • newOortComet Link icon

      protected OortComet newOortComet(String cometURL, ClientTransport transport, ClientTransport[] otherTransports)
    • configureOortComet Link icon

      protected void configureOortComet(OortComet oortComet)
    • encodeSecret Link icon

      protected String encodeSecret(String secret)
    • connectComet Link icon

      protected void connectComet(OortComet comet, Map<String,Object> fields)
    • deobserveComet Link icon

      public OortComet deobserveComet(String cometURL)
    • getKnownComets Link icon

      @ManagedAttribute(value="URLs of known Oorts in the cluster", readonly=true) public Set<String> getKnownComets()
      Returns:
      the set of known Oort comet servers URLs.
    • getComet Link icon

      public OortComet getComet(String cometURL)
      Parameters:
      cometURL - the URL of a Oort comet
      Returns:
      the OortComet instance connected with the Oort comet with the given URL
    • findComet Link icon

      protected OortComet findComet(String cometURL)
      Parameters:
      cometURL - the URL of a Oort comet
      Returns:
      the OortComet instance connecting or connected with the Oort comet with the given URL
    • observeChannel Link icon

      @ManagedOperation(value="Observes the given channel", impact="ACTION") public void observeChannel(@Name(value="channel",description="The channel to observe") String channelName)

      Observes the given channel, registering to receive messages from the Oort comets connected to this Oort instance.

      Once observed, all OortComet instances subscribe to the channel and will repeat any messages published to the local channel (with loop prevention), so that the messages are distributed to all Oort comet servers.

      Parameters:
      channelName - the channel to observe
    • deobserveChannel Link icon

      @ManagedOperation(value="Deobserves the given channel", impact="ACTION") public void deobserveChannel(@Name(value="channel",description="The channel to deobserve") String channelId)
    • isOort Link icon

      public boolean isOort(ServerSession session)
      Parameters:
      session - the server session to test
      Returns:
      whether the given server session is one of those created by the Oort internal working
      See Also:
    • isOortHandshake Link icon

      public boolean isOortHandshake(Message handshake)
      Parameters:
      handshake - the handshake message to test
      Returns:
      whether the given handshake message is coming from another Oort comet that has been configured with the same secret
      See Also:
    • newOortHandshakeFields Link icon

      public Map<String,Object> newOortHandshakeFields(String cometURL, String oortAliasURL)
    • isCometConnected Link icon

      protected boolean isCometConnected(String oortURL)
      Parameters:
      oortURL - the comet URL to check for connection
      Returns:
      whether the given comet is connected to this comet
    • addCometListener Link icon

      public void addCometListener(Oort.CometListener listener)
      Registers the given listener to be notified of comet events.
      Parameters:
      listener - the listener to add
      See Also:
    • removeCometListener Link icon

      public void removeCometListener(Oort.CometListener listener)
      Deregisters the given listener from being notified of comet events.
      Parameters:
      listener - the listener to remove
      See Also:
    • removeCometListeners Link icon

      public void removeCometListeners()
      Deregisters all comet listeners.
      See Also:
    • joinComets Link icon

      protected void joinComets(Message message)
    • getObservedChannels Link icon

      public Set<String> getObservedChannels()
    • getOortSession Link icon

      public LocalSession getOortSession()
      Returns:
      the oortSession
    • replacePunctuation Link icon

      protected static String replacePunctuation(String source, char replacement)
    • dump Link icon

      public void dump(Appendable out, String indent) throws IOException
      Specified by:
      dump in interface org.eclipse.jetty.util.component.Dumpable
      Overrides:
      dump in class org.eclipse.jetty.util.component.ContainerLifeCycle
      Throws:
      IOException
    • toString Link icon

      public String toString()
      Overrides:
      toString in class org.eclipse.jetty.util.component.AbstractLifeCycle