edu.unh.sdb.datasource
Class RemoteUDPClient

java.lang.Object
  extended by edu.unh.sdb.datasource.DataCollection
      extended by edu.unh.sdb.datasource.DataSource
          extended by edu.unh.sdb.datasource.PhysicalDataSource
              extended by edu.unh.sdb.datasource.RemoteUDPClient
All Implemented Interfaces:
Indexable

public class RemoteUDPClient
extends PhysicalDataSource

This class will read data from a remote datasource using UFTP logic.


Nested Class Summary
static class RemoteUDPClient.ClientAlarm
          Thread class to control how long packet receiving has to be done.
static class RemoteUDPClient.ClientStarter
          Thread class to start the Client.
static class RemoteUDPClient.InterPacketDelay
          Interpacket delay parameter setter.
 
Field Summary
static java.lang.String bounds
           
static int buffer_size
           
static java.net.Socket clientAlarmSocket
           
static int clientControlPort
           
static int clientDataPort
           
static java.net.Socket clientSocket
           
static java.net.Socket connectionSocket
           
static java.net.DatagramSocket ds
           
static byte[] dstByteArray
           
static long end
           
static java.lang.String fileName
           
static int fileSize
           
static int globalVal
           
static java.net.InetAddress ip
           
static int[] lostPacketArray
           
static int lostPacketCounter
           
static int[] lower
           
static java.lang.String missedPacket
           
static int number_packets
           
static int packetSize
           
static int rempart
           
static int serverAlarmPort
           
static int serverControlPort
           
static int serverDataPort
           
static long start
           
static int statusFlag
           
static int times
           
static int[] upper
           
static java.net.ServerSocket welcomeSocket
           
 
Fields inherited from class edu.unh.sdb.datasource.PhysicalDataSource
BIG_ENDIAN, bufferBounds, bufferDimension, bufferSteps, byteBuffers, directMemoryLimit, endian, LITTLE_ENDIAN, maxBufferSize, maxGapSize, readCounter, readLength, url
 
Fields inherited from class edu.unh.sdb.datasource.DataSource
fdlDescriptor, isActivated, name, wsName
 
Fields inherited from class edu.unh.sdb.datasource.DataCollection
attributeOrder, axisOrdering, axisWeights, dataOrder, dimensionality, numAttributes, pointOrder, recordDesc
 
Constructor Summary
RemoteUDPClient(java.lang.String name, RecordDescriptor recordDesc, ISBounds theBounds, AxisOrdering ordering, java.lang.String URL, java.lang.String serverURL)
          RemoteUDPClient class constructor.
 
Method Summary
 void activate()
          Open the server socket on the client side.
static void AlarmThreadStart()
          Method for restarting Alarm thread with different sleepTime quantum.
 void buildBounds(ISBounds srcBounds)
          Builds the bounds string to be sent to the RemoteUDPServer.
static void ClientToServerControlInfo(java.lang.String s)
          TCP Control Traffic to Server about missing packets.
static void closeWelcomeSocket()
          Close welcomeSocket for Control Information.
 void datum(Datum datum, IndexSpaceID did)
          Get the Datum and fill its values in the passed Datum at positions specified by the corresponding IndexSpaceID coordinates.
 void datum(Datum datum, IndexSpaceID did, FieldIDMapper mp)
          Get the Datum and fill its values in the passed Datum at positions specified by the corresponding FieldIDMapper.
 void datum(Datum datum, IndexSpaceID did, RecordSpec recSpec)
          Get the Datum and fill its values in the passed Datum at positions specified by the corresponding RecordSpec.
 Datum datum(IndexSpaceID did)
          Return the Datum corresponding to the given IndexSpaceID.
 Datum datum(IndexSpaceID did, RecordSpec spec)
          Return the Datum corresponding to the given IndexSpaceID.
 void deactivate()
          Close the server socket on the client side.
static void getSocketRef(java.net.ServerSocket s)
          Method to provide a reference to the welcomeSocket on client.
static void main(java.lang.String[] args)
          RemoteUDPClient main.
static void openWelcomeSocket()
          Open welcomeSocket for Control Information.
static void PacketRetransmission(java.lang.String s)
          Logic to receive packet retransmissions.
protected  void pdatumUDP(Datum datum, IndexSpaceID did)
          this method will extract data from datasource on remote server using UFTP logic.
protected  void psubblockUDP(BasicBlock dstBlock, ISBounds dstBounds, ISBounds srcBounds)
          this method will extract data from datasource on remote server using UFTP logic.
static int Seqnum_Decoder(byte[] a)
          Finds the integer value of 32 bit binary string.
static void ServerToClientAlarm()
          Server to Client Alarm Information reader.
static void ServerToClientControlInfo()
          Server to Client Control Information regarding file size & packet size.
static void setBasicBlockBounds(java.lang.String s)
          Method to tell server the bounds for basic block construction.
static void setFileName(java.lang.String s)
          Sets the filename for transfer.
 void setRemoteDataSource(java.lang.String xmlFile, java.lang.String dsName)
          set the xml file for the remote datasource.
 void subblock(DataBlock dstBlock, ISBounds dstBounds, ISBounds srcBounds)
          Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds.
 void subblock(DataBlock dstBlock, ISBounds dstBounds, ISBounds srcBounds, FieldIDMapper mp)
          Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds.
 void subblock(DataBlock dstBlock, ISBounds dstBounds, ISBounds srcBounds, RecordSpec recSpec)
          Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds.
 DataBlock subblock(ISBounds db)
          Returns a spatial subset of the DataSource as delimited by the ISBounds argument.
static void TheClient()
          File transfer client program.
 long transmitTime()
           
 
Methods inherited from class edu.unh.sdb.datasource.PhysicalDataSource
allocateBuffer, allocateBuffer, allocateBuffer, allocateBuffer, allocateBuffer, allocateBuffer, allocateBuffer, allocateBuffer, allocateBuffer, deleteBuffer, deleteBuffer, deleteBuffers, equals, getBuffer, getBuffer, getBufferSize, getBufferSize, getByteOrder, getDataFileString, getMaxBufferSize, getReadCounter, getReadLength, getURL, initializeBuffers, isBigEndian, makeBestBuffer, resetReadCounter, setBufferByteOrder, setMaxBufferSize, setMaxGapSize, toString, toString
 
Methods inherited from class edu.unh.sdb.datasource.DataSource
checkActivated, clearCache, copyBestID, create, create, create, createRemote, createRemote, createRemoteClient, createRemoteClient, createRemoteDataSource, createRemoteDataSource, createRemoteDataSourceUDP, createRemoteUDP, createRemoteUDP, dumpData, getName, getValues, isActivated
 
Methods inherited from class edu.unh.sdb.datasource.DataCollection
byteSize, computeOffset, computeOffset, copyBounds, createDataBlock, createDataBlock, createDataBlock, createDatum, createDatum, createDatum, createDatum, createDatum, createDatum, datum, datum, dim, getAxisOrdering, getAxisWeight, getAxisWeights, getBounds, getByte, getBytes, getBytes, getBytes, getBytes, getBytes, getBytes, getBytesByAttribute, getBytesByAttribute, getBytesByPoint, getBytesByPoint, getDataOrder, getDimensionsArray, getDouble, getDoubles, getDoubles, getDoubles, getDoubles, getDoubles, getDoubles, getDoublesByAttribute, getDoublesByAttribute, getDoublesByPoint, getDoublesByPoint, getFloat, getFloats, getFloats, getFloats, getFloats, getFloats, getFloats, getFloatsByAttribute, getFloatsByAttribute, getFloatsByPoint, getFloatsByPoint, getInt, getInts, getInts, getInts, getInts, getInts, getInts, getIntsByAttribute, getIntsByAttribute, getIntsByPoint, getIntsByPoint, getLowerBoundsArray, getNumAttributes, getRecordDescriptor, getShort, getShorts, getShorts, getShorts, getShorts, getShorts, getShorts, getShortsByAttribute, getShortsByAttribute, getShortsByPoint, getShortsByPoint, getStorageType, getValues, getValuesByAttribute, getValuesByPoint, longVolume, setAxisOrdering, setBounds, setRecordDescriptor, size, subblock, subblock, subblock, subblock, subblock, subblock, subblock, subblock, useBytesOnly, volume
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serverDataPort

public static int serverDataPort

serverControlPort

public static int serverControlPort

serverAlarmPort

public static int serverAlarmPort

clientDataPort

public static int clientDataPort

clientControlPort

public static int clientControlPort

welcomeSocket

public static java.net.ServerSocket welcomeSocket

connectionSocket

public static java.net.Socket connectionSocket

clientSocket

public static java.net.Socket clientSocket

clientAlarmSocket

public static java.net.Socket clientAlarmSocket

ds

public static java.net.DatagramSocket ds

ip

public static java.net.InetAddress ip

fileName

public static java.lang.String fileName

fileSize

public static int fileSize

buffer_size

public static int buffer_size

packetSize

public static int packetSize

times

public static int times

rempart

public static int rempart

number_packets

public static int number_packets

lostPacketArray

public static int[] lostPacketArray

lostPacketCounter

public static int lostPacketCounter

missedPacket

public static java.lang.String missedPacket

globalVal

public static int globalVal

start

public static long start

end

public static long end

statusFlag

public static int statusFlag

dstByteArray

public static byte[] dstByteArray

lower

public static int[] lower

upper

public static int[] upper

bounds

public static java.lang.String bounds
Constructor Detail

RemoteUDPClient

public RemoteUDPClient(java.lang.String name,
                       RecordDescriptor recordDesc,
                       ISBounds theBounds,
                       AxisOrdering ordering,
                       java.lang.String URL,
                       java.lang.String serverURL)
RemoteUDPClient class constructor.

Method Detail

setFileName

public static void setFileName(java.lang.String s)
Sets the filename for transfer.


activate

public void activate()
Open the server socket on the client side.

Overrides:
activate in class DataSource

openWelcomeSocket

public static void openWelcomeSocket()
                              throws java.lang.Exception
Open welcomeSocket for Control Information.

Throws:
java.lang.Exception

closeWelcomeSocket

public static void closeWelcomeSocket()
                               throws java.lang.Exception
Close welcomeSocket for Control Information.

Throws:
java.lang.Exception

deactivate

public void deactivate()
Close the server socket on the client side.

Overrides:
deactivate in class PhysicalDataSource

getSocketRef

public static void getSocketRef(java.net.ServerSocket s)
Method to provide a reference to the welcomeSocket on client.


setBasicBlockBounds

public static void setBasicBlockBounds(java.lang.String s)
                                throws java.lang.Exception
Method to tell server the bounds for basic block construction.

Throws:
java.lang.Exception

setRemoteDataSource

public void setRemoteDataSource(java.lang.String xmlFile,
                                java.lang.String dsName)
set the xml file for the remote datasource.


datum

public Datum datum(IndexSpaceID did)
Return the Datum corresponding to the given IndexSpaceID.

Specified by:
datum in interface Indexable
Overrides:
datum in class DataCollection

datum

public void datum(Datum datum,
                  IndexSpaceID did)
Get the Datum and fill its values in the passed Datum at positions specified by the corresponding IndexSpaceID coordinates.

Specified by:
datum in interface Indexable
Overrides:
datum in class DataCollection

datum

public void datum(Datum datum,
                  IndexSpaceID did,
                  RecordSpec recSpec)
Get the Datum and fill its values in the passed Datum at positions specified by the corresponding RecordSpec.

Specified by:
datum in interface Indexable
Overrides:
datum in class DataCollection

datum

public void datum(Datum datum,
                  IndexSpaceID did,
                  FieldIDMapper mp)
Get the Datum and fill its values in the passed Datum at positions specified by the corresponding FieldIDMapper.

Specified by:
datum in interface Indexable
Specified by:
datum in class DataCollection

datum

public Datum datum(IndexSpaceID did,
                   RecordSpec spec)
Return the Datum corresponding to the given IndexSpaceID. The Datum will only contain attributes specified by the RecordSpec argument.

Specified by:
datum in interface Indexable
Overrides:
datum in class DataCollection

pdatumUDP

protected void pdatumUDP(Datum datum,
                         IndexSpaceID did)
this method will extract data from datasource on remote server using UFTP logic.


subblock

public void subblock(DataBlock dstBlock,
                     ISBounds dstBounds,
                     ISBounds srcBounds,
                     FieldIDMapper mp)
Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds. The FieldIDMapper argument determines the mapping between datums in the datasource and datums in the DataBlock. Note that the DataBlock is assumed to already have a valid data array. the dataBlock can be basicBlock or compositeBlock

Specified by:
subblock in interface Indexable
Overrides:
subblock in class PhysicalDataSource

subblock

public void subblock(DataBlock dstBlock,
                     ISBounds dstBounds,
                     ISBounds srcBounds,
                     RecordSpec recSpec)
Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds. The RecordSpec argument specifies a subset of the DataSource attributes to be written into the DataBlock datums. Note that the DataBlock is assumed to already have a valid data array. the DataBlock can be BasicBlock or CompositeBlock

Specified by:
subblock in interface Indexable
Overrides:
subblock in class PhysicalDataSource

subblock

public void subblock(DataBlock dstBlock,
                     ISBounds dstBounds,
                     ISBounds srcBounds)
Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds. The BasicBlock is assumed to be created and a valid data array is already allocated. NOTE: dstBlock can be BasicBlock or CompositeBlock. data is copied from file to BasicBlock or CompositeBlock based on its data type.

Specified by:
subblock in interface Indexable
Overrides:
subblock in class PhysicalDataSource

psubblockUDP

protected void psubblockUDP(BasicBlock dstBlock,
                            ISBounds dstBounds,
                            ISBounds srcBounds)
                     throws java.lang.Exception
this method will extract data from datasource on remote server using UFTP logic.

Throws:
java.lang.Exception

buildBounds

public void buildBounds(ISBounds srcBounds)
Builds the bounds string to be sent to the RemoteUDPServer.


transmitTime

public long transmitTime()

subblock

public DataBlock subblock(ISBounds db)
Returns a spatial subset of the DataSource as delimited by the ISBounds argument. The DataSource data is copied when filling the DataBlock. This method returns a BasicBlock. Need more discussion on this method

Specified by:
subblock in interface Indexable
Overrides:
subblock in class DataCollection

TheClient

public static void TheClient()
File transfer client program.


PacketRetransmission

public static void PacketRetransmission(java.lang.String s)
Logic to receive packet retransmissions.


ServerToClientControlInfo

public static void ServerToClientControlInfo()
                                      throws java.lang.Exception
Server to Client Control Information regarding file size & packet size.

Throws:
java.lang.Exception

ClientToServerControlInfo

public static void ClientToServerControlInfo(java.lang.String s)
                                      throws java.lang.Exception
TCP Control Traffic to Server about missing packets.

Throws:
java.lang.Exception

ServerToClientAlarm

public static void ServerToClientAlarm()
                                throws java.lang.Exception
Server to Client Alarm Information reader.

Throws:
java.lang.Exception

Seqnum_Decoder

public static int Seqnum_Decoder(byte[] a)
Finds the integer value of 32 bit binary string.


AlarmThreadStart

public static void AlarmThreadStart()
Method for restarting Alarm thread with different sleepTime quantum.


main

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