Package uk.ac.starlink.topcat

## Class TopcatSender

- java.lang.Object
- - uk.ac.starlink.topcat.TopcatSender

-     public abstract class TopcatSender
      extends java.lang.Object

  Object capable of sending a table location to a running TOPCAT instance.
  Since:
    2 Aug 2011
  Author:
    Mark Taylor

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.String` | `TOPCAT_LOAD_MTYPE` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TopcatSender​(org.astrogrid.samp.client.HubConnection connection, java.lang.String topcatId)` | Constructor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `close()` | Unregisters the client associated with this sender.
    `static TopcatSender` | `createSender​(org.astrogrid.samp.client.ClientProfile profile)` | Attempts to create and return a TopcatSender for a given profile.
    `protected abstract org.astrogrid.samp.Message` | `createSendMessage​(java.lang.String uloc, java.lang.String format)` | Returns a Message that can be sent to TOPCAT to receive a table.
    `org.astrogrid.samp.Response` | `sendTable​(java.lang.String location, java.lang.String format)` | Instructs an external TOPCAT application to load a table with a given location and table format.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### TOPCAT_LOAD_MTYPE

          public static final java.lang.String TOPCAT_LOAD_MTYPE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TopcatSender

          public TopcatSender​(org.astrogrid.samp.client.HubConnection connection,
                              java.lang.String topcatId)

      Constructor.
      Parameters:
        `connection` - registered connection to hub
        `topcatId` - client ID for currently registered TOPCAT client

  - ### Method Detail

    - #### sendTable

          public org.astrogrid.samp.Response sendTable​(java.lang.String location,
                                                       java.lang.String format)
                                                throws java.io.IOException,
                                                       org.astrogrid.samp.client.SampException

      Instructs an external TOPCAT application to load a table with a given location and table format.
      Parameters:
        `location` - table URL or filename
        `format` - STIL-friendly table format (null for auto)
      Returns:
        response from table load message
      Throws:
        `java.io.IOException`
        `org.astrogrid.samp.client.SampException`

    - #### createSendMessage

          protected abstract org.astrogrid.samp.Message createSendMessage​(java.lang.String uloc,
                                                                          java.lang.String format)
                                                                   throws java.io.IOException

      Returns a Message that can be sent to TOPCAT to receive a table.
      Parameters:
        `uloc` - location, if possible in the form of a URL
        `format` - STIL-friendly table format name; may be an empty string (for auto-detection) but may not be null
      Returns:
        load table message
      Throws:
        `java.io.IOException`

    - #### close

          public void close()

      Unregisters the client associated with this sender.

    - #### createSender

          public static TopcatSender createSender​(org.astrogrid.samp.client.ClientProfile profile)

      Attempts to create and return a TopcatSender for a given profile. If none can be constructed (for instance no hub or no external TOPCAT client found), null is returned.
      Parameters:
        `profile` - client profile
      Returns:
        working topcat sender, or null

Copyright © 2003-2018 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.