com.altair.hwm.toolkit.hwpm
Class HWMCommPM

java.lang.Object
  extended by java.lang.Thread
      extended by com.altair.hwm.comm.HWMClientComm
          extended by com.altair.hwm.comm.hm.HWMCommHM
              extended by com.altair.hwm.toolkit.hwpm.HWMCommPM
All Implemented Interfaces:
HWMComm, java.lang.Runnable

public class HWMCommPM
extends HWMCommHM

Title: HWMCommPM

Description: The comm class that handles communication with native library. This is only used in PM mode.

Company: Altair Engineering, Inc.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
HWMCommPM(HWPMInteraction pmInteraction, HWMCommMgr hwmCommMgr, java.lang.String strSessionName)
          Constructor
 
Method Summary
 void ConnectToApplication()
          This is not required as we use JNI to communicate
 HWMResponseHandle CreateFunction(java.lang.String szFuncCode)
          Purpose: Allows a TCL function to be defined, and passed over the socket to be used by HyperMesh.
 HWMResponseHandle CreateFunction(java.lang.String[] szFuncCode)
          Purpose: Allows a TCL function to be defined, and passed over the socket to be used by HyperMesh.
 int CreateServerSocket()
          This is not required as we use JNI to communicate
 void Disconnect()
          Purpose: End this communication
 boolean IsActive()
          Purpose: Returns whether or not the HWMClientComm is Active, which means that it has a client application that has identified itself.
 boolean IsPeerAlive()
          Check if the peer is alive
 boolean IsTerminated()
          Purpose: Returns whether or not the HWMClientComm has terminated
 void run()
          Purpose: Just end the thread.
 void SendActualMessage(java.lang.String szMsg)
          Purpose: Not implemented
 void SendCommand(java.lang.String strMsg)
          Purpose: Sends a command to the client application, adding the command to the m_vectPendingCommand vector.
 HWMResponseHandle SendQuery(java.lang.String strMsg)
          Purpose: Sends a single SYNCHRONOUS query to the slave.
 void SendQueryAsync(HWMResponseListener hwmRespListener, java.lang.String szMsg)
          Purpose: Not implemented.
 void StartApplication()
          This is not required as we use JNI to communicate
 void Terminate()
          Purpose: Set the PM interaction to null to indicate if the client can still send messages to PM/HW
 void WaitForHandShake()
          This is not required as we use JNI to communicate
 
Methods inherited from class com.altair.hwm.comm.hm.HWMCommHM
CreateList, CreateMark, CreateMark, CreateNode, GetMark, LineCreateFromNodes, StartHM, StartMotion
 
Methods inherited from class com.altair.hwm.comm.HWMClientComm
AddCommListener, Connect, GetSessionName, RemoveCommListener, SendMessage
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HWMCommPM

public HWMCommPM(HWPMInteraction pmInteraction,
                 HWMCommMgr hwmCommMgr,
                 java.lang.String strSessionName)
Constructor

Parameters:
pmInteraction - The class used for communicating with the native library
hwmCommMgr - The comm manager class
strSessionName - The session name to use
Method Detail

SendQuery

public HWMResponseHandle SendQuery(java.lang.String strMsg)
Purpose: Sends a single SYNCHRONOUS query to the slave. This command will block until the slave responds.

Overrides:
SendQuery in class HWMClientComm
Parameters:
String - strMsg The unformatted message, exactly as it should be seen by the slave application.

SendCommand

public void SendCommand(java.lang.String strMsg)
Purpose: Sends a command to the client application, adding the command to the m_vectPendingCommand vector.

Overrides:
SendCommand in class HWMClientComm
Parameters:
String - strMsg The unformatted message, exactly as it should be seen by the slave application.

CreateFunction

public HWMResponseHandle CreateFunction(java.lang.String szFuncCode)
                                 throws java.io.IOException
Purpose: Allows a TCL function to be defined, and passed over the socket to be used by HyperMesh. For instance, to calculate a bounding box, instead of sending a seperate Query for each node to determine the X, Y and Z for each node, a TCL Proc can be sent to HyperMesh to do the calculations. In order for this function to work, the entire TCL code should be compressed into a single newline seperated String.

Overrides:
CreateFunction in class HWMCommHM
Parameters:
String - szFuncCode -- The TCL code, seperated by newline characters
Throws:
java.io.IOException

CreateFunction

public HWMResponseHandle CreateFunction(java.lang.String[] szFuncCode)
                                 throws java.io.IOException
Purpose: Allows a TCL function to be defined, and passed over the socket to be used by HyperMesh. For instance, to calculate a bounding box, instead of sending a seperate Query for each node to determine the X, Y and Z for each node, a TCL Proc can be sent to HyperMesh to do the calculations. In order for this function to work, the entire TCL code should be parsed into a String array, with one line of code per element in the array.

Overrides:
CreateFunction in class HWMCommHM
Parameters:
String - szFuncCode -- The TCL code, seperated by newline characters
Throws:
java.io.IOException

Terminate

public void Terminate()
Purpose: Set the PM interaction to null to indicate if the client can still send messages to PM/HW

Overrides:
Terminate in class HWMClientComm

IsActive

public boolean IsActive()
Purpose: Returns whether or not the HWMClientComm is Active, which means that it has a client application that has identified itself.

Overrides:
IsActive in class HWMClientComm

IsTerminated

public boolean IsTerminated()
Purpose: Returns whether or not the HWMClientComm has terminated

Overrides:
IsTerminated in class HWMClientComm

IsPeerAlive

public boolean IsPeerAlive()
Check if the peer is alive

Overrides:
IsPeerAlive in class HWMClientComm
Returns:
boolean Returns true if the peer is alive else false

Disconnect

public void Disconnect()
Purpose: End this communication

Specified by:
Disconnect in interface HWMComm
Overrides:
Disconnect in class HWMCommHM

run

public void run()
Purpose: Just end the thread. This is not required at all.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class HWMClientComm

StartApplication

public void StartApplication()
This is not required as we use JNI to communicate

Overrides:
StartApplication in class HWMClientComm

SendQueryAsync

public void SendQueryAsync(HWMResponseListener hwmRespListener,
                           java.lang.String szMsg)
                    throws java.io.IOException
Purpose: Not implemented.

Throws:
java.io.IOException - Not implemented

SendActualMessage

public void SendActualMessage(java.lang.String szMsg)
                       throws java.io.IOException
Purpose: Not implemented

Throws:
java.io.IOException - Not implemented

CreateServerSocket

public int CreateServerSocket()
                       throws java.io.IOException
This is not required as we use JNI to communicate

Overrides:
CreateServerSocket in class HWMClientComm
Returns:
The port number that the server socket has been created
Throws:
java.io.IOException - Since this is not supported in this class

WaitForHandShake

public void WaitForHandShake()
                      throws java.io.IOException
This is not required as we use JNI to communicate

Overrides:
WaitForHandShake in class HWMClientComm
Throws:
java.io.IOException - Since this is not supported in this class

ConnectToApplication

public void ConnectToApplication()
                          throws java.lang.Exception
This is not required as we use JNI to communicate

Overrides:
ConnectToApplication in class HWMClientComm
Throws:
java.lang.Exception - Since this is not supported in this class