org.voparis
Class WebSampConnector

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by org.voparis.WebSampConnector
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class WebSampConnector
extends java.applet.Applet

VOParis Samp Connector class: communication between a Web browser and a VO software using the IVOA Simple Application Messaging Protocol (SAMP).

Version:
1.5, 2010-04-01
Author:
jberthier & rsavalle & arty
See Also:
WebSampConnector Web site, Serialized Form

Nested Class Summary
static class WebSampConnector.highlightRowHandler
          This class subscribes the table highlight row message handler of SAMP, and implements the processCall() method of the abstract massage handler class.
static class WebSampConnector.pointAtSkyHandler
          This class subscribes the coord.pointAt.sky message handler of SAMP, and implements the processCall() method of the abstract massage handler class.
static class WebSampConnector.selectRowListHandler
          This class subscribes the select row list message handler of SAMP, and implements the processCall() method of the abstract massage handler class.
 class WebSampConnector.WebSampConnectorClient
          This class defines the metadata of a client as seen from the Samp hub.
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
WebSampConnector()
           
 
Method Summary
 void destroy()
          Destructor method to explicitly disconnect the client from the hub
 boolean disconnect()
          This method unregisters the client, terminates the connection and performs any associated required cleanup.
 java.lang.Object[] getRegisteredClients()
          This method retrieves the list of client public IDs for those clients currently registered.
 java.lang.Object[] getSubscribedClients(java.lang.String mtype)
          This method retrieves the list of clients which subscribed a given MType
 void init()
          Init method called by the browser to register the client and to connect to the hub.
 boolean isConnected()
          This method allows the client to know if he is connected or not to a Samp hub
 boolean pointAtSky(double ra, double dec)
          This method allows the client to point a given celestial coordinates
 boolean sendAladinScript(java.lang.String script)
          This method allows the client to send a script to be executed by Aladin
 boolean sendMsg(java.lang.String mType, java.lang.String id, java.lang.String name, java.lang.String url, java.lang.String keyName)
          This method allows the client to broadcast data to VO-compliant applications
 boolean tableHighlightRow(java.lang.String tableId, java.lang.String url, int row)
          This method allows the client to highlight a given row of a table
 boolean tableSelectRowList(java.lang.String tableId, java.lang.String url, int[] rowList)
          This method allows the client to highlight a set of rows of the table
 
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WebSampConnector

public WebSampConnector()
Method Detail

init

public void init()
Init method called by the browser to register the client and to connect to the hub. The method ends with the call of the client's callback function named 'onlineHandler'.

Overrides:
init in class java.applet.Applet

destroy

public void destroy()
Destructor method to explicitly disconnect the client from the hub

Overrides:
destroy in class java.applet.Applet

disconnect

public boolean disconnect()
                   throws java.security.PrivilegedActionException
This method unregisters the client, terminates the connection and performs any associated required cleanup.

Returns:
true if no error occurs, if not false
Throws:
java.security.PrivilegedActionException

isConnected

public boolean isConnected()
                    throws java.security.PrivilegedActionException
This method allows the client to know if he is connected or not to a Samp hub

Returns:
true if connected, if not false
Throws:
java.security.PrivilegedActionException

getRegisteredClients

public java.lang.Object[] getRegisteredClients()
                                        throws java.security.PrivilegedActionException
This method retrieves the list of client public IDs for those clients currently registered.

Returns:
array containing the list of registered clients and their metadata as a WebSampConnectorClient object
Throws:
java.security.PrivilegedActionException

getSubscribedClients

public java.lang.Object[] getSubscribedClients(java.lang.String mtype)
                                        throws java.security.PrivilegedActionException
This method retrieves the list of clients which subscribed a given MType

Parameters:
mtype - the given MType (e.g. table.load.votable)
Returns:
array containing the list of clients which subscribed the given MType, and their metadata as a WebSampConnectorClient object
Throws:
java.security.PrivilegedActionException

sendMsg

public boolean sendMsg(java.lang.String mType,
                       java.lang.String id,
                       java.lang.String name,
                       java.lang.String url,
                       java.lang.String keyName)
                throws java.security.PrivilegedActionException
This method allows the client to broadcast data to VO-compliant applications

Parameters:
mType - the MType of the resource (e.g. table.load.votable)
id - the Id of the resource
name - the name of the resource
url - the URL where is located the resource
keyName - key associated to the resource id (param id) which may be used to refer to the loaded resource in subsequent messages
Returns:
true if no error occurs, if not false (if an exception is rises then a message is printed)
Throws:
java.security.PrivilegedActionException
See Also:
Samp MTypes

pointAtSky

public boolean pointAtSky(double ra,
                          double dec)
                   throws java.security.PrivilegedActionException
This method allows the client to point a given celestial coordinates

Parameters:
ra - the right ascension to point (in degrees)
dec - the declination to point (in degrees)
Returns:
true if no error occurs, if not false
Throws:
java.security.PrivilegedActionException

tableHighlightRow

public boolean tableHighlightRow(java.lang.String tableId,
                                 java.lang.String url,
                                 int row)
                          throws java.security.PrivilegedActionException
This method allows the client to highlight a given row of a table

Parameters:
tableId - the Id of the resource (table)
url - the URL where is located the resource
row - the number of the row to highlight (from 0 to n-1)
Returns:
true if no error occurs, if not false
Throws:
java.security.PrivilegedActionException

tableSelectRowList

public boolean tableSelectRowList(java.lang.String tableId,
                                  java.lang.String url,
                                  int[] rowList)
                           throws java.security.PrivilegedActionException
This method allows the client to highlight a set of rows of the table

Parameters:
tableId - the Id of the resource (table)
url - the URL where is located the resource
rowList - an array of integer providing the list of the row numbers to highlight (from 0 to n-1)
Returns:
true if no error occurs, if not false
Throws:
java.security.PrivilegedActionException

sendAladinScript

public boolean sendAladinScript(java.lang.String script)
                         throws java.security.PrivilegedActionException
This method allows the client to send a script to be executed by Aladin

Parameters:
script - a string containing the Aladin script to be executed
Returns:
true if no error occurs, if not false
Throws:
java.security.PrivilegedActionException