# Class TablePullHandler

java.lang.Object
org.astrogrid.samp.client.AbstractMessageHandler
uk.ac.starlink.topcat.interop.TablePullHandler

All Implemented Interfaces:
  `org.astrogrid.samp.client.MessageHandler`

public abstract class TablePullHandler extends org.astrogrid.samp.client.AbstractMessageHandler
Message handler for table pull messages. These return a reponse giving the URL of a table held by topcat.

Since:
  28 Feb 2014
Author:
  Mark Taylor

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`TablePullHandler(String mtype)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`static TablePullHandler`
`createFormatTablePullHandler(String mtype, uk.ac.starlink.table.StarTableWriter twriter)`
Returns a message handler for a given fixed table format.
`static TablePullHandler`
`createGenericTablePullHandler(String mtype)`
Returns a message handler where the table format is determined by a "format" parameter in the incoming message.
`protected org.astrogrid.samp.Response`
`createResponse(Map processOutput)`
If it's a Response, use it as is, if not wrap it up as a success.
`protected abstract uk.ac.starlink.table.StarTableWriter`
`getTableWriter(org.astrogrid.samp.Message msg)`
Returns a table writer to use for the given message.
`org.astrogrid.samp.Response`
`processCall(org.astrogrid.samp.client.HubConnection conn, String senderId, org.astrogrid.samp.Message msg)`

### Methods inherited from class org.astrogrid.samp.client.AbstractMessageHandler

`getSubscriptions, receiveCall, receiveNotification, setSubscriptions`

### Methods inherited from class Object

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

## Constructor Details

### TablePullHandler

protected TablePullHandler(String mtype)
Constructor.

Parameters:
  `mtype` - SAMP Mtype

## Method Details

### createResponse

protected org.astrogrid.samp.Response createResponse(Map processOutput)
If it's a Response, use it as is, if not wrap it up as a success.

Overrides:
  `createResponse` in class `org.astrogrid.samp.client.AbstractMessageHandler`

### processCall

public org.astrogrid.samp.Response processCall(org.astrogrid.samp.client.HubConnection conn, String senderId, org.astrogrid.samp.Message msg) throws IOException

Specified by:
  `processCall` in class `org.astrogrid.samp.client.AbstractMessageHandler`
Throws:
  `IOException`

### getTableWriter

protected abstract uk.ac.starlink.table.StarTableWriter getTableWriter(org.astrogrid.samp.Message msg) throws IOException
Returns a table writer to use for the given message.

Parameters:
  `msg` - message
Returns:
  table serializer
Throws:
  `IOException`

### createFormatTablePullHandler

public static TablePullHandler createFormatTablePullHandler(String mtype, uk.ac.starlink.table.StarTableWriter twriter)
Returns a message handler for a given fixed table format.

Parameters:
  `mtype` - SAMP Mtype
  `twriter` - serializer defining table format
Returns:
  new table pull handler

### createGenericTablePullHandler

public static TablePullHandler createGenericTablePullHandler(String mtype)
Returns a message handler where the table format is determined by a "format" parameter in the incoming message.

Parameters:
  `mtype` - SAMP Mtype
Returns:
  new table pull handler