Class ExternalComponent

java.lang.Object
org.jivesoftware.whack.ExternalComponent
All Implemented Interfaces:
org.xmpp.component.Component

public class ExternalComponent extends Object implements org.xmpp.component.Component
ExternalComponents are responsible for connecting and authenticating with a remote server and for sending and processing received packets. In fact, an ExternalComponent is a wrapper on a Component that provides remote connection capabilities. The actual processing of the packets is done by the wrapped Component.
Author:
Gaston Dombiak
  • Constructor Details

  • Method Details

    • connect

      @Deprecated public void connect(String host, int port, String subdomain) throws org.xmpp.component.ComponentException
      Deprecated.
      Generates a connection with the server and tries to authenticate. If an error occurs in any of the steps then a ComponentException is thrown.
      Parameters:
      host - the host to connect with.
      port - the port to use.
      subdomain - the subdomain that this component will be handling.
      Throws:
      org.xmpp.component.ComponentException - if an error happens during the connection and authentication steps.
    • connect

      public void connect(String host, int port, String subdomain, boolean startEncrypted) throws org.xmpp.component.ComponentException
      Generates a connection with the server and tries to authenticate. If an error occurs in any of the steps then a ComponentException is thrown.
      Parameters:
      host - the host to connect with.
      port - the port to use.
      subdomain - the subdomain that this component will be handling.
      startEncrypted - true if sockets are started in TLS/SSL mode, otherwise false.
      Throws:
      org.xmpp.component.ComponentException - if an error happens during the connection and authentication steps.
    • getComponent

      public org.xmpp.component.Component getComponent()
    • getName

      public String getName()
      Specified by:
      getName in interface org.xmpp.component.Component
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface org.xmpp.component.Component
    • getDomain

      public String getDomain()
      Returns the domain provided by this component in the connected server. The domain is composed by the subdomain plus the domain of the server. E.g. conference.jivesoftware.com. The domain may change after a connection has been established with the server.
      Returns:
      the domain provided by this component in the connected server.
    • getSubdomain

      public String getSubdomain()
      Returns the subdomain provided by this component in the connected server. E.g. conference.
      Returns:
      the subdomain provided by this component in the connected server.
    • processPacket

      public void processPacket(org.xmpp.packet.Packet packet)
      Specified by:
      processPacket in interface org.xmpp.component.Component
    • send

      public void send(org.xmpp.packet.Packet packet)
    • initialize

      public void initialize(org.xmpp.packet.JID jid, org.xmpp.component.ComponentManager componentManager) throws org.xmpp.component.ComponentException
      Specified by:
      initialize in interface org.xmpp.component.Component
      Throws:
      org.xmpp.component.ComponentException
    • start

      public void start()
      Specified by:
      start in interface org.xmpp.component.Component
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface org.xmpp.component.Component
    • connectionLost

      public void connectionLost()
      Notification message that the connection with the server was lost unexpectedly. We will try to reestablish the connection for ever until the connection has been reestablished or this thread has been stopped.