appl.parallel.util
Class Helper

java.lang.Object
  extended by appl.parallel.util.Helper

public class Helper
extends Object

See method description for details.

Author:
Dominik Appl

Nested Class Summary
 class Helper.SimpleConnectionThread
          if a connection to the given resource is possible the ResourceProperties of this object are returned.
 
Constructor Summary
Helper()
           
 
Method Summary
static void bind(String bindingName, Remote bindingInstance, int registryPort)
          Bind the remote object's stub in the registry.
static double[] calculateWeights(int[] ratings)
          Calculates weights out of ratings.
static Vector<ComputingResourceContainer> getResourceContainersForVector(Vector<ComputingResource> res)
          Gets the remote resources from all given ComputingResource objects.
static void unbind(String bindingName)
          Unbinds a a stub from the registry!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Helper

public Helper()
Method Detail

bind

public static void bind(String bindingName,
                        Remote bindingInstance,
                        int registryPort)
                 throws RemoteException
Bind the remote object's stub in the registry. Creates a registry if no running registry is found.

Parameters:
bindingName - the name to be used for binding (with port specified, if necessary)
bindingInstance - an instance of the type to bind to the registry
registryPort - the default registry port
Throws:
RemoteException - if something goes wrong

unbind

public static void unbind(String bindingName)
Unbinds a a stub from the registry!

Parameters:
bindingName -

getResourceContainersForVector

public static Vector<ComputingResourceContainer> getResourceContainersForVector(Vector<ComputingResource> res)
Gets the remote resources from all given ComputingResource objects. For this all resources are queried. If a ressouce does not respond the Resource is removed form the Vector(!!!!!) and a warning is given to the logger.

Parameters:
res -

calculateWeights

public static double[] calculateWeights(int[] ratings)
Calculates weights out of ratings. A rating is a value >=1. If the rating is 0 an average rating is assumed. This method weights the ratings relative to each other so that a weight is a double value between 0 and 1 and the sum of all calculated weights is 1.

Parameters:
ratings -