appl.parallel.server
Class PartitionDataManager

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by appl.parallel.server.PartitionDataManager
All Implemented Interfaces:
DataServer, PartitionDataServer, Serializable, Remote

public class PartitionDataManager
extends UnicastRemoteObject
implements PartitionDataServer

Manages the all data for the XuluServer. This includes retrieval of partitions from connected resources like the DataServer or, as part of the update of neighborhood regions, from other XuluServers.

Author:
Dominik Appl
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
PartitionDataManager(String[] IPs, CommEventSink remoteEventReceiver, int registryPort)
          Creates and inits a new PartitionDataserver.
PartitionDataManager(String[] IPs, RemoteEventProxy remoteEventReceiver, int registryport, ClientDataServer localSPMDClient)
          Same as PartitionDataManager(String[], CommEventSink, int), but uses a local SPMDClient.
 
Method Summary
 void addData(DataPartition partition)
          Adds a Partition to the server
 void addMultiDataInfos(HashMap<String,MultiDataInfo> newMultiDataInfos)
          Adds MultiDataInfos to the server.
 void addPartitionInfos(Vector<SinglePartitionInfo> singlePartitionInfos)
          Adds PartitionInfos to the server.
 void destroyMultiPartition(String name, int idx)
           
 Object getBaseParameter(String name)
          returns the baseParameter by name
 DataPartition getData(int id)
          Returns the DataPartition associated with the given ID
 DataPartition getData(String name)
          Gets a partition by name
 PartitionInfo getInfo(int id)
          Returns the partition info with the specified id
 DataPartition[] getMultiData(String name)
          Gets a partition of a multi-data element.
 DataPartition getMultiData(String name, int pos)
          Gets a partition of a multi-data element.
 MultiDataInfo getMultiDataInfo(String name)
           
 MultiDataPartitionObject getMultiDataObject(String name)
           
 DataPartition getPartition(int id, Rectangle bounds)
          gets the data with the id of a SplittableRessource
 SinglePartitionInfo getPartitionInfo(int rootID)
           
 void removeData(int id)
          Removes the partition with the specified id.
 void removeData(String name)
          Removes the partition from the database
 void removePartition(DataPartition partition)
          Removes the partition from the database
 void stop()
          unbinds the server from the registry, removes all data and runs the garbage collector
 void unloadToSource(int rootID)
          Unloads the specified resource to the source it was loaded from
 void updateBaseParameter(HashMap<String,Object> newParameters)
          Adds or updates BaseParameters
 void updateFromNeighbors(int id)
          Updates the specified partition.
 void updateFromNeighbors(String name)
          Does the same as updateFromNeighbors(int)
 void updatePartition(int id, DataPartition partition, Rectangle bounds)
          sets the data with the id of a SplittableRessource
 
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
 

Constructor Detail

PartitionDataManager

public PartitionDataManager(String[] IPs,
                            CommEventSink remoteEventReceiver,
                            int registryPort)
                     throws RemoteException
Creates and inits a new PartitionDataserver.

Parameters:
IPs - the IPs of participating Servers for neighborhood updates(may include port specification)
remoteEventReceiver - generated events are forwarded to the receiver
registryPort - port of the registry to which the PartitionDataManager should be bound
Throws:
RemoteException - if a connection to a participating server fails

PartitionDataManager

public PartitionDataManager(String[] IPs,
                            RemoteEventProxy remoteEventReceiver,
                            int registryport,
                            ClientDataServer localSPMDClient)
                     throws RemoteException
Same as PartitionDataManager(String[], CommEventSink, int), but uses a local SPMDClient.
This is used when a Server is running inside the Xulu-Client. It has performance advantages (direct access - no TCP/IP)

Parameters:
IPs - the IPs of participating Servers for neighborhood updates(may include port specification)
remoteEventReceiver - generated events are forwarded to the receiver
registryport - port of the registry to which the PartitionDataManager should be bound
localSPMDClient - a ClientDataServer for fast local access
Throws:
RemoteException
Method Detail

addData

public void addData(DataPartition partition)
             throws RemoteException
Description copied from interface: DataServer
Adds a Partition to the server

Specified by:
addData in interface DataServer
Parameters:
partition - the partition to add
Throws:
RemoteException

addMultiDataInfos

public void addMultiDataInfos(HashMap<String,MultiDataInfo> newMultiDataInfos)
                       throws RemoteException
Description copied from interface: PartitionDataServer
Adds MultiDataInfos to the server.

Specified by:
addMultiDataInfos in interface PartitionDataServer
Throws:
RemoteException

addPartitionInfos

public void addPartitionInfos(Vector<SinglePartitionInfo> singlePartitionInfos)
                       throws RemoteException
Description copied from interface: PartitionDataServer
Adds PartitionInfos to the server. They are submitted in a vector to avoid multiple remote calls.

Specified by:
addPartitionInfos in interface PartitionDataServer
Throws:
RemoteException

destroyMultiPartition

public void destroyMultiPartition(String name,
                                  int idx)
Parameters:
name -
idx -

getBaseParameter

public Object getBaseParameter(String name)
returns the baseParameter by name

Parameters:
name - the name of the parameter
Returns:
the parameter

getData

public DataPartition getData(int id)
                      throws RemoteException
Returns the DataPartition associated with the given ID

Specified by:
getData in interface DataServer
Parameters:
id - the id of the data
Returns:
the data
Throws:
RemoteException - if the connection to the server fails

getData

public DataPartition getData(String name)
Gets a partition by name

Parameters:
name - the name of the resource (probably given by the programmer)
Returns:
the partition or null if not found

getInfo

public PartitionInfo getInfo(int id)
Returns the partition info with the specified id

Parameters:
id - the id of the partition
Returns:
the info

getMultiData

public DataPartition[] getMultiData(String name)
Gets a partition of a multi-data element. NOTE THAT ALL PARTITIONS OF THE MULTIGRID WILL BE LOADED (watch out for loading performance!).

Parameters:
name - the name of the resource (probably given by the programmer)
Returns:
the partition
See Also:
SPMDClientController.addToMultiDataSplitControl(Object[], String)

getMultiData

public DataPartition getMultiData(String name,
                                  int pos)
Gets a partition of a multi-data element. Only the resource at the given position will be loaded.

Parameters:
name - the name of the resource (probably given by the programmer)
pos - the index of the requested element
Returns:
the partition
See Also:
SPMDClientController.addToMultiDataSplitControl(Object[], String)

getMultiDataInfo

public MultiDataInfo getMultiDataInfo(String name)
                               throws RemoteException
Specified by:
getMultiDataInfo in interface PartitionDataServer
Parameters:
name - the name of the associated multi data
Returns:
the MultiDataInfo info
Throws:
RemoteException

getMultiDataObject

public MultiDataPartitionObject getMultiDataObject(String name)
                                            throws RemoteException
Specified by:
getMultiDataObject in interface PartitionDataServer
Parameters:
name - the name of the multiDataObject
Returns:
the MultiDataObject associated with that name
Throws:
RemoteException

getPartition

public DataPartition getPartition(int id,
                                  Rectangle bounds)
                           throws RemoteException
Description copied from interface: PartitionDataServer
gets the data with the id of a SplittableRessource

Specified by:
getPartition in interface DataServer
Specified by:
getPartition in interface PartitionDataServer
Parameters:
id - the ID of a the base data
bounds - the bounds of the partition to retrieve (using global coordinates)
Returns:
the partition
Throws:
RemoteException

getPartitionInfo

public SinglePartitionInfo getPartitionInfo(int rootID)
                                     throws RemoteException
Specified by:
getPartitionInfo in interface PartitionDataServer
Parameters:
rootID - the id of the according partition
Returns:
the the PartitionInfo
Throws:
RemoteException

removeData

public void removeData(int id)
Description copied from interface: DataServer
Removes the partition with the specified id.

Specified by:
removeData in interface DataServer
Parameters:
id - id of the partition to remove

removeData

public void removeData(String name)
Removes the partition from the database

Parameters:
name - the name of the partition to remove

removePartition

public void removePartition(DataPartition partition)
Removes the partition from the database

Parameters:
partition - the Partition to remove

stop

public void stop()
unbinds the server from the registry, removes all data and runs the garbage collector


unloadToSource

public void unloadToSource(int rootID)
                    throws RemoteException
Description copied from interface: PartitionDataServer
Unloads the specified resource to the source it was loaded from

Specified by:
unloadToSource in interface PartitionDataServer
Parameters:
rootID -
Throws:
RemoteException

updateBaseParameter

public void updateBaseParameter(HashMap<String,Object> newParameters)
                         throws RemoteException
Description copied from interface: PartitionDataServer
Adds or updates BaseParameters

Specified by:
updateBaseParameter in interface PartitionDataServer
Throws:
RemoteException

updateFromNeighbors

public void updateFromNeighbors(int id)
Updates the specified partition. For this the the neighborhood partitions are updated from remote DataServers using the SplitMap of the SinglePartitionInfo.

Specified by:
updateFromNeighbors in interface PartitionDataServer
Parameters:
id -

updateFromNeighbors

public void updateFromNeighbors(String name)
Does the same as updateFromNeighbors(int)

Parameters:
name - the name of the resource

updatePartition

public void updatePartition(int id,
                            DataPartition partition,
                            Rectangle bounds)
                     throws RemoteException
Description copied from interface: PartitionDataServer
sets the data with the id of a SplittableRessource

Specified by:
updatePartition in interface DataServer
Specified by:
updatePartition in interface PartitionDataServer
Parameters:
id - the ID of a the base data
partition - the updateData (which may only a partitial update, depending on the bounds set with the last parameter)
bounds - the locatition where the partition is to be updated (using global coordinates)
Throws:
RemoteException