Package uk.ac.starlink.topcat

# Class TopcatSender

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

public abstract class TopcatSender extends 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 final String`
`TOPCAT_LOAD_MTYPE`

## Constructor Summary

Constructors
Constructor
Description
`TopcatSender(org.astrogrid.samp.client.HubConnection connection, String topcatId)`
Constructor.

## Method Summary

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(String uloc, String format)`
Returns a Message that can be sent to TOPCAT to receive a table.
`org.astrogrid.samp.Response`
`sendTable(String location, 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 Details

### TOPCAT_LOAD_MTYPE

public static final String TOPCAT_LOAD_MTYPE

See Also:
  - Constant Field Values

## Constructor Details

### TopcatSender

public TopcatSender(org.astrogrid.samp.client.HubConnection connection, String topcatId)
Constructor.

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

## Method Details

### sendTable

public org.astrogrid.samp.Response sendTable(String location, String format) throws 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:
  `IOException`
  `org.astrogrid.samp.client.SampException`

### createSendMessage

protected abstract org.astrogrid.samp.Message createSendMessage(String uloc, String format) throws 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:
  `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