portaview.server
Class PortaViewCommands

java.lang.Object
  extended byportaview.server.PortaViewCommands
All Implemented Interfaces:
org.apache.xmlrpc.XmlRpcHandler

public class PortaViewCommands
extends java.lang.Object
implements org.apache.xmlrpc.XmlRpcHandler

Commands for the XML-RPC server. Note that the signatures of class must be compliant to the XML-RPC conversion table.

Version:
$Id: PortaViewCommands.java,v 1.9 2003/12/10 06:18:57 wlee Exp $
Author:
William Lee

Constructor Summary
PortaViewCommands(PortaViewServer server)
           
 
Method Summary
 java.lang.Object execute(java.lang.String method, java.util.Vector params)
          Implements the method to dispatch the methods.
 java.util.Vector getAlbums()
          Returns a Vector of Hashtables that contains the album name and photo names The hastable contains the "name", "icon", and "photos" key.
 byte[] getPhoto(java.lang.String show, int seq)
          Given a show and a sequence number return the photo struct.
 byte[] getPhotoWithName(java.lang.String album, java.lang.String name)
          Given a show and a sequence number return the photo struct.
 java.lang.Object getStatus()
          RPC call for getting the status.
 boolean register(java.lang.String portaViewName, java.lang.String myIP)
          Only would be called if this PortaView is a master.
 java.util.Hashtable registerMaster(java.lang.String masterName, java.lang.String masterIP)
          Registers this PortaView with the master given the master's ip address.
 boolean unregister(java.lang.String portaViewName)
          Unregister the portaview from the master's list.
 boolean update(java.util.Hashtable slide)
          Update this portaview main displayer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortaViewCommands

public PortaViewCommands(PortaViewServer server)
Method Detail

getPhoto

public byte[] getPhoto(java.lang.String show,
                       int seq)
Given a show and a sequence number return the photo struct.

Parameters:
show - show name
seq - sequence number
Returns:
the byte array that represents the jpeg representation of the photo.

getPhotoWithName

public byte[] getPhotoWithName(java.lang.String album,
                               java.lang.String name)
Given a show and a sequence number return the photo struct.

Returns:
the byte array that represents the jpeg representation of the photo.

update

public boolean update(java.util.Hashtable slide)
Update this portaview main displayer. This will also spawn a request to the master server in order to download the image.

Parameters:
slide - the hashtable contains the following key. Here is an example:
  struct.put(ViewerConsts.TOTAL, new Integer(3)); // total number of slides
  struct.put(ViewerConsts.SPEED, new Integer(5)); // speed 0 = stop, >0 = second for the next slide.
  struct.put(ViewerConsts.BORDER_RED, new Integer(0)); // border red
  struct.put(ViewerConsts.BORDER_GREEN, new Integer(255)); // border green
  struct.put(ViewerConsts.BORDER_BLUE, new Integer(0)); // border blue
  struct.put(ViewerConsts.BORDER, new Integer(2)); // border thickness
 
Returns:

getStatus

public java.lang.Object getStatus()
RPC call for getting the status.

Returns:
A hastable like the argument for update.

getAlbums

public java.util.Vector getAlbums()
Returns a Vector of Hashtables that contains the album name and photo names The hastable contains the "name", "icon", and "photos" key. The name is of type String, the icon key contains a byte[], and the photos is a Vector of Strings.

Returns:
a Vector of albums.

registerMaster

public java.util.Hashtable registerMaster(java.lang.String masterName,
                                          java.lang.String masterIP)
                                   throws java.lang.Exception
Registers this PortaView with the master given the master's ip address.

Parameters:
masterName - the Master server's name
masterIP - the Master server's IP
Returns:
A struct like: name=[Name of PortaView], ip=[ip address of the current portaView]
Throws:
java.lang.Exception

register

public boolean register(java.lang.String portaViewName,
                        java.lang.String myIP)
Only would be called if this PortaView is a master. This is called by the remote PortaView to register them to this master.

Parameters:
portaViewName - the PortaView's name.
myIP - the IP address for the PortaView.
Returns:
true if successful, false otherwise.

unregister

public boolean unregister(java.lang.String portaViewName)
Unregister the portaview from the master's list.

Parameters:
portaViewName - name of the PortaView.
Returns:
true if successful, false otherwise.

execute

public java.lang.Object execute(java.lang.String method,
                                java.util.Vector params)
                         throws java.lang.Exception
Implements the method to dispatch the methods. This contains the lookup necessary to redirect to the right call.

Specified by:
execute in interface org.apache.xmlrpc.XmlRpcHandler
Throws:
java.lang.Exception
See Also:
XmlRpcHandler.execute(java.lang.String, java.util.Vector)


Copyright © 2003 The PortaView Team. All Rights Reserved.