darx
Class Darx

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by darx.Darx
All Implemented Interfaces:
DarxServer, java.io.Serializable, java.rmi.Remote

public class Darx
extends java.rmi.server.UnicastRemoteObject
implements DarxServer

This is the server implementation which, as main objective, provides the means for running DARX tasks on the local host.

See Also:
Serialized Form

Field Summary
protected static java.rmi.registry.Registry local_registry
          The RMIregistry serving this specific location (:).
protected static java.lang.String myName
          The local server's name
protected static int myPortNb
          The local server's port number
protected static java.lang.String myURL
          The local server's URL
protected static int ns_port_nb
          The port number of the name server.
protected static java.lang.String ns_url
          The URL of the name server.
protected static NameServer nserver
          The stub providing access to the name server functionalities.
static java.lang.String SERVICE_NAME
          The generic service name
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
Darx()
          Constructs a new DARX server instance.
 
Method Summary
(package private) static void analyseCommandLine(java.lang.String[] parameters)
          Analyses the command line in order to fill in specific runtime info: the URL and port number of the name server if the default value is not used, as well as the port number of the DARX server if the default value (6789) is not used.
 TaskShellHandle createReplicant(ReplicantInfo info, DarxTask task)
          Creates a task replica on the current server.
 RemoteTask findTask(java.lang.String task_name)
          Generates a remote reference to the current leader of the task which corresponds to the given generic name.
 void killReplicant(java.lang.String task_name)
          Destroys the local replicant corresponding to the specified task.
static void main(java.lang.String[] params)
           
 RemoteTask startTask(DarxTask task)
          Starts the execution of a new replication group leader on the current server.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

nserver

protected static NameServer nserver
The stub providing access to the name server functionalities.


ns_url

protected static java.lang.String ns_url
The URL of the name server.


ns_port_nb

protected static int ns_port_nb
The port number of the name server.


local_registry

protected static java.rmi.registry.Registry local_registry
The RMIregistry serving this specific location (:).


myURL

protected static java.lang.String myURL
The local server's URL


myName

protected static java.lang.String myName
The local server's name


myPortNb

protected static int myPortNb
The local server's port number


SERVICE_NAME

public static final java.lang.String SERVICE_NAME
The generic service name

See Also:
Constant Field Values
Constructor Detail

Darx

public Darx()
     throws java.rmi.RemoteException
Constructs a new DARX server instance.

Throws:
java.rmi.RemoteException
Method Detail

main

public static void main(java.lang.String[] params)

analyseCommandLine

static void analyseCommandLine(java.lang.String[] parameters)
Analyses the command line in order to fill in specific runtime info: the URL and port number of the name server if the default value is not used, as well as the port number of the DARX server if the default value (6789) is not used.

Parameters:
parameters - the String array containing the parameters, can be void if default values are used and debug mode is off

startTask

public RemoteTask startTask(DarxTask task)
                     throws java.rmi.RemoteException
Starts the execution of a new replication group leader on the current server.

Specified by:
startTask in interface DarxServer
Parameters:
task - the DarxTask to be started on this server.
Returns:
the handle for the started task; to be used for user purposes, such as (un)replication or policy modification.
Throws:
java.rmi.RemoteException
See Also:
DarxTask.activateTask(String, int)

createReplicant

public TaskShellHandle createReplicant(ReplicantInfo info,
                                       DarxTask task)
                                throws java.rmi.RemoteException
Creates a task replica on the current server. This method is called by the TaskShell of the group leader when it has to be replicated.

Specified by:
createReplicant in interface DarxServer
Parameters:
info - the ReplicantInfo of the new replica.
task - the DarxTask to be replicated on this server.
Returns:
the remote reference to the newly created replica
Throws:
java.rmi.RemoteException

killReplicant

public void killReplicant(java.lang.String task_name)
                   throws java.rmi.RemoteException
Destroys the local replicant corresponding to the specified task. This includes unreferencing the doomed replicant on the local RMI server and on the name server.

Specified by:
killReplicant in interface DarxServer
Parameters:
task_name - the name of the task to which the replicant belongs
Throws:
java.rmi.RemoteException

findTask

public RemoteTask findTask(java.lang.String task_name)
                    throws java.rmi.RemoteException
Generates a remote reference to the current leader of the task which corresponds to the given generic name. If the current leader cannot be contacted, it is assumed that the host has failed, and therefore a new leader election is launched through the NameServer services.

Specified by:
findTask in interface DarxServer
Throws:
java.rmi.RemoteException