videoClientCaller
Class PlabClientCallerMain

java.lang.Object
  extended by videoClientCaller.PlabClientCallerMain

public class PlabClientCallerMain
extends java.lang.Object

This is the main class used for communication with PlanetLab nodes which are already setup to communicate over CORBA.
This means that the PlabClient runs on them.

Author:
Leo Bosnjak

Field Summary
private  int CALCBANDWIDTH_MAX_TRIES
          how often should the client be asked for a calcbandwidth result
private  int CALCBANDWIDTH_MAX_WAIT_TIME_IN_SEC
          Calculate the maximum number of seconds to wait until a measurement finishes.
If we exceed this amount, then we won't reach the MIN_ALLOWED_BANDWIDTH_FOR_TIMEOUT and so the measurement can be stopped.
private  long CALCBANDWIDTH_SLEEP_TIME_IN_MS
          wait 30 sec until next try to get the result of the bandwidth calculation
private static int INVALID_CLOSEST_LEADER
          used to know, when a leader was not found
private  int MIN_ALLOWED_BANDWIDTH_FOR_TIMEOUT
          Defines the minimum allowed bandwidth as a result of a mesurement to a node in kbit/s.
After exceeding the calculated CALCBANDWIDTH_MAX_WAIT_TIME_IN_SEC time without a result,
we'll know that the minimum bandwidth can not be reached, and the measurement will be stopped.
This should help the experiment not to last too long.
private  VideoClient myServer
           
private  java.lang.String myServerHostName
           
static java.lang.String SERVER_NAME
          The name of the class which is running on the nodes
private static boolean testLoseFirstMeasurement
          if set to true, the first bandwidth-measurement will be "lost" (useful only for test purposes!!!)
private static int UNUSED_MEASUREMENT_ID
          used to identify a new measurement command
 
Constructor Summary
PlabClientCallerMain()
          Construct the object with default parameters.
 
Method Summary
 structAnalyzeResult analyzeVideo(java.lang.String hostname, java.lang.String videoFileName)
          Analyze the received video file.
call is done via CORBA
 structBandwidthInfo[] calculateBandwidths(X2XProxy sourceProxy, java.util.Vector<X2XProxy> nodes)
          Calculate the bandwidth from sourceProxy to nodes.
call is done via CORBA
 structNetClOutput calculateNetClosenessToLeaders(java.lang.String hostname, structNetClInput leaders)
          Calculates the bandwidth from hostname to leaders.
The values of the closest leader are returned.
Call is done via CORBA
 void cleanUp()
          cleans up the Remote-object ref
static int getINVALID_CLOSEST_LEADER()
           
 int getPlabClientVersion(java.lang.String hostname)
          Get release-version of the source code running on node.
Note that this method is oftenly used to check whether a node is prepared for receiving further commands (bootstrapped).
Call is done via CORBA.
static boolean isClosestLeaderIdxValid(int closestLeaderIdx)
          Tells whether the Index of the closest leader, which is returned by calculateNetClosenessToLeaders(), is valid.
private  org.omg.CosNaming.NamingContextExt retrieveNamingContext(java.lang.String hostName)
          Connects to the orbd of the host and gets its naming-context.
private  VideoClient retrieveVideoClientRef(java.lang.String hostName)
          Retrieves naming-context and reference to a VideoClient object from host.
 void setPlabClientSSHOptions(java.lang.String hostname)
          Sets the SSH daemon options of the client and restarts the daemon.
call is done via CORBA
 void startSession(java.lang.String hostname, structSessionParams params)
          Start RTSP/RTP session from remote node to a remote server.
Call is done via CORBA
 boolean stopMeasurement(java.lang.String hostname)
          Sends a message to the client to stop the running measurement.
call is done via CORBA
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVER_NAME

public static final java.lang.String SERVER_NAME
The name of the class which is running on the nodes

See Also:
Constant Field Values

UNUSED_MEASUREMENT_ID

private static final int UNUSED_MEASUREMENT_ID
used to identify a new measurement command

See Also:
Constant Field Values

INVALID_CLOSEST_LEADER

private static final int INVALID_CLOSEST_LEADER
used to know, when a leader was not found

See Also:
Constant Field Values

MIN_ALLOWED_BANDWIDTH_FOR_TIMEOUT

private final int MIN_ALLOWED_BANDWIDTH_FOR_TIMEOUT
Defines the minimum allowed bandwidth as a result of a mesurement to a node in kbit/s.
After exceeding the calculated CALCBANDWIDTH_MAX_WAIT_TIME_IN_SEC time without a result,
we'll know that the minimum bandwidth can not be reached, and the measurement will be stopped.
This should help the experiment not to last too long.

See Also:
Constant Field Values

CALCBANDWIDTH_SLEEP_TIME_IN_MS

private final long CALCBANDWIDTH_SLEEP_TIME_IN_MS
wait 30 sec until next try to get the result of the bandwidth calculation

See Also:
Constant Field Values

CALCBANDWIDTH_MAX_WAIT_TIME_IN_SEC

private final int CALCBANDWIDTH_MAX_WAIT_TIME_IN_SEC
Calculate the maximum number of seconds to wait until a measurement finishes.
If we exceed this amount, then we won't reach the MIN_ALLOWED_BANDWIDTH_FOR_TIMEOUT and so the measurement can be stopped.
Calculation:
Size in KB / Bandwidth in kbit/s = Time in seconds
ie: 26min must be enough for 30MB file transfer --> ((30MB*1024) / (26min*60)) = 19,7 KB/s * 8 = 157,5 kbit/s


CALCBANDWIDTH_MAX_TRIES

private final int CALCBANDWIDTH_MAX_TRIES
how often should the client be asked for a calcbandwidth result


myServer

private VideoClient myServer

myServerHostName

private java.lang.String myServerHostName

testLoseFirstMeasurement

private static boolean testLoseFirstMeasurement
if set to true, the first bandwidth-measurement will be "lost" (useful only for test purposes!!!)

Constructor Detail

PlabClientCallerMain

public PlabClientCallerMain()
Construct the object with default parameters.

Method Detail

cleanUp

public void cleanUp()
cleans up the Remote-object ref


getPlabClientVersion

public int getPlabClientVersion(java.lang.String hostname)
                         throws java.lang.Exception
Get release-version of the source code running on node.
Note that this method is oftenly used to check whether a node is prepared for receiving further commands (bootstrapped).
Call is done via CORBA.

Returns:
version of the client
Throws:
java.lang.Exception

stopMeasurement

public boolean stopMeasurement(java.lang.String hostname)
                        throws java.lang.Exception
Sends a message to the client to stop the running measurement.
call is done via CORBA

Parameters:
hostname - - The hostname of the client
Returns:
true if successful
Throws:
java.lang.Exception

setPlabClientSSHOptions

public void setPlabClientSSHOptions(java.lang.String hostname)
                             throws java.lang.Exception
Sets the SSH daemon options of the client and restarts the daemon.
call is done via CORBA

Throws:
java.lang.Exception

startSession

public void startSession(java.lang.String hostname,
                         structSessionParams params)
                  throws java.lang.Exception
Start RTSP/RTP session from remote node to a remote server.
Call is done via CORBA

Throws:
java.lang.Exception - - if something went wrong

analyzeVideo

public structAnalyzeResult analyzeVideo(java.lang.String hostname,
                                        java.lang.String videoFileName)
                                 throws java.lang.Exception
Analyze the received video file.
call is done via CORBA

Returns:
true if successful
Throws:
java.lang.Exception

calculateBandwidths

public structBandwidthInfo[] calculateBandwidths(X2XProxy sourceProxy,
                                                 java.util.Vector<X2XProxy> nodes)
                                          throws java.lang.Exception
Calculate the bandwidth from sourceProxy to nodes.
call is done via CORBA

Returns:
true if successful
Throws:
java.lang.Exception

calculateNetClosenessToLeaders

public structNetClOutput calculateNetClosenessToLeaders(java.lang.String hostname,
                                                        structNetClInput leaders)
                                                 throws java.lang.Exception
Calculates the bandwidth from hostname to leaders.
The values of the closest leader are returned.
Call is done via CORBA

Returns:
the result of the measurements, or null if an error happened
Throws:
java.lang.Exception

isClosestLeaderIdxValid

public static boolean isClosestLeaderIdxValid(int closestLeaderIdx)
Tells whether the Index of the closest leader, which is returned by calculateNetClosenessToLeaders(), is valid.

Parameters:
closestLeaderIdx -
Returns:
true if the index is valid, note that this does not mean, that the index is in range, just that it is not set to the invalid value.

retrieveVideoClientRef

private VideoClient retrieveVideoClientRef(java.lang.String hostName)
                                    throws org.omg.CORBA.ORBPackage.InvalidName,
                                           org.omg.CosNaming.NamingContextPackage.NotFound,
                                           org.omg.CosNaming.NamingContextPackage.CannotProceed,
                                           org.omg.CosNaming.NamingContextPackage.InvalidName
Retrieves naming-context and reference to a VideoClient object from host.

Parameters:
hostName - - The name of the host which videoClient is needed.
Returns:
VideoClient - The reference to a VideoClient
Throws:
org.omg.CORBA.ORBPackage.InvalidName
org.omg.CosNaming.NamingContextPackage.NotFound
org.omg.CosNaming.NamingContextPackage.CannotProceed
org.omg.CosNaming.NamingContextPackage.InvalidName

retrieveNamingContext

private org.omg.CosNaming.NamingContextExt retrieveNamingContext(java.lang.String hostName)
                                                          throws org.omg.CORBA.ORBPackage.InvalidName
Connects to the orbd of the host and gets its naming-context.

Parameters:
hostName -
Returns:
NamingContextExt - the ref to the name bindings of the host
Throws:
org.omg.CORBA.ORBPackage.InvalidName

getINVALID_CLOSEST_LEADER

public static int getINVALID_CLOSEST_LEADER()
Returns:
the iNVALID_CLOSEST_LEADER