edu.wisc.trace.urcsdk.target.facade
Class TargetFacadeForJni

java.lang.Object
  extended by edu.wisc.trace.urcsdk.target.facade.TargetFacadeForJni
All Implemented Interfaces:
ISessionListener, ISocketListener

public class TargetFacadeForJni
extends java.lang.Object
implements ISocketListener, ISessionListener

TargetFacadeForJni A sample implementation for C based targets.

Created on: 21st August, 2006
Known bugs: None
Thread safe: Yes

Version:
$Revision: 1.7 $
Author:
Jamie Tabaka

Constructor Summary
TargetFacadeForJni()
           
 
Method Summary
 void addTunParameter(java.lang.String name, java.lang.String value)
          Add a new parameter to the TunParameterMap
 void beginNativeTarget()
           
 void bindToTargetTun(java.lang.String tunClassName)
          Bind to Target TUN for communicating with Target Devices
 void connectionLost(java.lang.String sessionId)
          Called when the Target can no longer connect to the Client.
 void endNativeTarget()
           
 java.lang.String getElementValueForSession(java.lang.String sessionId, java.lang.String elementId)
           
 java.lang.String getElementValueForTemplate(java.lang.String elementId)
           
 void initialize(java.lang.String codeBase, java.lang.String tdLocation)
          Creates a GenericTarget, which is the base of the C target, and adds each UISocket in the GenericTarget instance to the SocketListener.
 void initNativeTarget()
           
static void initTunParameterSet()
          Clears the TunParameterMap.
 java.lang.String invokeCommandRequest(UISocketCommand uiSocketCommand)
          Called when a command has been invoked by a Urc, but has not yet been executed on the pertaining socket.
 void locate(java.lang.String type)
           
 void notificationAcknowledged(UISocketNotification uiSocketNotification)
          Called when a notification has been acknowledged by a Urc
 boolean reconnect(java.lang.String sessionId)
          Called when a Client attempts to reconnect.
 void sessionClosed(java.lang.String sessionId)
          sessionClosed called when the Client closes a session.
 void sessionOpened(TargetSession session)
          sessionOpened will be invoked when a session is successfully opened by the Client.
 boolean sessionOpenRequest(UISocket uiSocket)
          sessionOpenRequest is called initially to see if the Target will accept a new session.
 boolean setElementStateRequest(UISocketVariable uiSocketVariable, java.lang.Object value)
          Called when the Client tries to change the state of an element.
 void setElementValueForAllSessions(java.lang.String elementId, java.lang.String value)
          Sets the value of an element in all client sessions
 void setElementValueForSession(java.lang.String sessionId, java.lang.String elementId, java.lang.String value)
          Sets the value of an element in the session given
 void setElementValueForTemplate(java.lang.String elementId, java.lang.String value)
          Sets the value of an element in the target's template
 void unbindTargetTun(java.lang.String tunClassName)
          Unbind from Target TUN
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TargetFacadeForJni

public TargetFacadeForJni()
Method Detail

initNativeTarget

public void initNativeTarget()

beginNativeTarget

public void beginNativeTarget()

endNativeTarget

public void endNativeTarget()

sessionOpenRequest

public boolean sessionOpenRequest(UISocket uiSocket)
Description copied from interface: ISocketListener
sessionOpenRequest is called initially to see if the Target will accept a new session. It could return false for example, if the target only wanted to support a limited number of sessions, etc...

Specified by:
sessionOpenRequest in interface ISocketListener
Parameters:
uiSocket - a UISocket value
Returns:
a boolean value if the new session is allowed.

sessionOpened

public void sessionOpened(TargetSession session)
Description copied from interface: ISocketListener
sessionOpened will be invoked when a session is successfully opened by the Client.

Specified by:
sessionOpened in interface ISocketListener
Parameters:
session - TargetSession the newly created Session.

invokeCommandRequest

public java.lang.String invokeCommandRequest(UISocketCommand uiSocketCommand)
Description copied from interface: ISessionListener
Called when a command has been invoked by a Urc, but has not yet been executed on the pertaining socket.

Specified by:
invokeCommandRequest in interface ISessionListener
Parameters:
uiSocketCommand - UISocketCommand value
Returns:
uisocket:basicCommand - return values 'error', 'done', 'inProgress', 'ready' uisocket:timedCommand (Not implemented yet) - milliseconds i.e.countDown remaining, 'error', 'done', 'inProgress', 'ready' uisocket:voidCommand - no return values

notificationAcknowledged

public void notificationAcknowledged(UISocketNotification uiSocketNotification)
Description copied from interface: ISessionListener
Called when a notification has been acknowledged by a Urc

Specified by:
notificationAcknowledged in interface ISessionListener
Parameters:
uiSocketNotification - UISocketNotification value

connectionLost

public void connectionLost(java.lang.String sessionId)
Description copied from interface: ISessionListener
Called when the Target can no longer connect to the Client.

Specified by:
connectionLost in interface ISessionListener
Parameters:
sessionId - a String value

reconnect

public boolean reconnect(java.lang.String sessionId)
Description copied from interface: ISessionListener
Called when a Client attempts to reconnect.

Specified by:
reconnect in interface ISessionListener
Parameters:
sessionId - a String value
Returns:
Return false if the Client should not be allowed to reconnect.

sessionClosed

public void sessionClosed(java.lang.String sessionId)
Description copied from interface: ISessionListener
sessionClosed called when the Client closes a session.

Specified by:
sessionClosed in interface ISessionListener
Parameters:
sessionId - a String value

setElementStateRequest

public boolean setElementStateRequest(UISocketVariable uiSocketVariable,
                                      java.lang.Object value)
Description copied from interface: ISessionListener
Called when the Client tries to change the state of an element.

Specified by:
setElementStateRequest in interface ISessionListener
Parameters:
uiSocketVariable - UISocketVariable value
value - Object
Returns:
boolean Return false if the Target does not allow to change the element state.

locate

public void locate(java.lang.String type)

initTunParameterSet

public static void initTunParameterSet()
Clears the TunParameterMap. The TunParameterMap is a Map which is required to Bind to a particular TUN as mentioned by the requirements of the TUN.


addTunParameter

public void addTunParameter(java.lang.String name,
                            java.lang.String value)
Add a new parameter to the TunParameterMap

Parameters:
name - Parameter Name
value - Parameter Value

bindToTargetTun

public void bindToTargetTun(java.lang.String tunClassName)
Bind to Target TUN for communicating with Target Devices

Parameters:
tunClassName - Fully qualified Java Class Name

unbindTargetTun

public void unbindTargetTun(java.lang.String tunClassName)
Unbind from Target TUN

Parameters:
tunClassName - Fully qualified Java Class Name

setElementValueForTemplate

public void setElementValueForTemplate(java.lang.String elementId,
                                       java.lang.String value)
Sets the value of an element in the target's template

Parameters:
elementId - Name of the element
value - A string representing the new value of the element

setElementValueForAllSessions

public void setElementValueForAllSessions(java.lang.String elementId,
                                          java.lang.String value)
Sets the value of an element in all client sessions

Parameters:
elementId - Name of the element
value - A string representing the new value of the element

setElementValueForSession

public void setElementValueForSession(java.lang.String sessionId,
                                      java.lang.String elementId,
                                      java.lang.String value)
Sets the value of an element in the session given

Parameters:
sessionId - The session in which the element should be set
elementId - Name of the element
value - A string representing the new value of the element

getElementValueForTemplate

public java.lang.String getElementValueForTemplate(java.lang.String elementId)
Parameters:
elementId -
Returns:
String value

getElementValueForSession

public java.lang.String getElementValueForSession(java.lang.String sessionId,
                                                  java.lang.String elementId)
Parameters:
sessionId -
elementId -
Returns:
String value

initialize

public void initialize(java.lang.String codeBase,
                       java.lang.String tdLocation)
Creates a GenericTarget, which is the base of the C target, and adds each UISocket in the GenericTarget instance to the SocketListener.

Parameters:
codeBase - The absolute path of the target
tdLocation - The absolute path of the Target Description


Copyright © 2006 Trace R&D Center, University of Wisconsin-Madison. All Rights Reserved.