edu.wisc.trace.uch.ta.upnpsatellitebox
Class UpnpSatelliteBoxTAFacade

java.lang.Object
  extended by edu.wisc.trace.uch.ta.upnpsatellitebox.UpnpSatelliteBoxTAFacade
All Implemented Interfaces:
ITA

public class UpnpSatelliteBoxTAFacade
extends Object
implements ITA

Provides the method to Get/Set target Value/State and forward update and received events to ITAListener.

Version:
$Revision: 1.15 $
Author:
Parikshit Thakur & Team, Trace R&D Center

Constructor Summary
UpnpSatelliteBoxTAFacade()
          Default Constructor.
 
Method Summary
 void finalize()
          This method is called by UCH before Un-installing or Unloading the TA.
 List<Map<String,Object>> getDynRes(String targetId, List<Map<String,String>> resProps)
          Get the Dynamic Resources from the TA.
 List<Set<String>> getIndices(String sessionId, List<String> eltIds, List<Integer> indexNos)
          Get Indices available on specific level of dimension of dimensional Element.
 Map<String,String> getLocators(String targetName)
          Get a map of locators containing locatorId and locatorType for a specific target.
 List<String> getRegisteredTargetIds()
          Get the target identifiers that the TA is currently representing.
 List<String> getSessionIds(String targetId, String socketName)
          Get the Session Identifiers for specified targetId and socketName.
 String getSocketDescriptionUri(String targetName, String socketName)
          Get the URI for retrieving the Socket Description for specified targetName and socketName.
 String getSocketFriendlyName(String targetId, String socketName)
          Get the Socket Friendly Name for the specified socketName and targetId.
 String getSocketName(String sessionId)
          Get the SocketName for the specified sessionId.
 List<String> getSocketNames(String targetName)
          Get the List of SocketName for specified targetName.
 Map<String,String> getTAProps()
          Get Target Adapter Properties Map.
 String getTargetDescriptionUri(String targetName)
          Get the URI for retrieving the Target Description.
 String getTargetName(String targetId)
          Get the targetName for specified targetId.
 Map<String,Object> getTargetProps(String targetId)
          Get the Target's Properties for specified targetId.
 Map<String,String> getValues(String sessionId, List<String> paths, List<Boolean> includeSets)
          Returns a value/state of the specified socket elements.
 void init(ITAListener taListener, Map<String,String> taProps, Map<String,String> uchProps)
          When the TA is installed and loaded, this method is called by UCH prior to any other TA function.
 void invokeLocator(String targetId, String locaterId)
          Invoke the specified locator function on a target.
 boolean isElementAvailable(String targetId, String socketName, String eltId)
          Checks whether a given socketElement is available in specified Socket of specified Target or not.
 boolean isImplemented(String functionName)
          Checks whether specified function is implemented by the TA or not.
 Map<String,String> openSessionRequest(String targetId, String socketName, Map<String,String> clientProps, Map<String,IProfile> context)
          The UCH asks for permission to open a session with a specified client on a specified socket.
 void registerTarget(String targetId, Map<String,Object> targetProps, List<Map<String,IProfile>> contexts)
          Register Target Adapter with specified targetId.
 boolean resumeSessionRequest(String sessionId)
          The UCH asks for permission to resume a session.
 void sessionClosed(String sessionId)
          Closes the Session for specified sessionId and do the necessary clean-up for the target.
 void sessionOpened(String targetId, String sessionId, String socketName, Map<String,String> clientProps, Map<String,IProfile> context)
          If the TA has accepted an open session request, and if the UCH succeeded in the necessary steps to open a session with the client, the UCH will call sessionOpened and provide the sessionId pertaining to the new session.
 void sessionResumed(String sessionId)
          The UCH signals the TA that the session has resumed.
 long sessionSuspended(String sessionId, long suggestedTimeout)
          The UCH signals the TA that the client has suspended a session with one of the TA’s targets.
 Map<String,List<String>> setValuesRequest(String sessionId, boolean isValidated, List<String> paths, List<String> operations, List<String> reqValues)
          The client requests to change the target state in one or more operations on specified socket elements.
 boolean suspendSessionRequest(String sessionId)
          The UCH asks for permission to suspend a session.
 void targetContextsAdded(String targetId, List<Map<String,IProfile>> contexts)
          Called when one or more contexts got added to an existing target.
 void targetContextsRemoved(String targetId, List<Map<String,IProfile>> contexts)
          Called when one or more contexts got removed to an existing target.
 void targetRequest(HttpServletRequest request, HttpServletResponse response, Map<String,IProfile> context)
          The UCH calls this function if it has received a request from a target to a URI that the TA has claimed for itself by a previous call to startUriService().It modify the response object according to request object.
 void unregisterTarget(String targetId)
          Called when target has been disappeared from the network.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpnpSatelliteBoxTAFacade

public UpnpSatelliteBoxTAFacade()
Default Constructor.

Method Detail

init

public void init(ITAListener taListener,
                 Map<String,String> taProps,
                 Map<String,String> uchProps)
          throws TAFatalException
Description copied from interface: ITA
When the TA is installed and loaded, this method is called by UCH prior to any other TA function. Within this method the TA initializes itself.

Specified by:
init in interface ITA
Parameters:
taListener - an Object of ITAListener
taProps - a Map<String, String> of ITA Properties
uchProps - a Map<String, String> of UCH Properties
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.init(ITAListener, Map, Map)

registerTarget

public void registerTarget(String targetId,
                           Map<String,Object> targetProps,
                           List<Map<String,IProfile>> contexts)
                    throws TAException,
                           TAFatalException
Description copied from interface: ITA
Register Target Adapter with specified targetId.

Specified by:
registerTarget in interface ITA
Parameters:
targetId - a String value of targetId
targetProps - Map<String, Object>
contexts - a List<Map<String, IProfile>> of user and controller profile map
Throws:
TAException - an Object of TAException
TAFatalException - an Object of TAFatalException
See Also:
ITA.registerTarget(String, Map, List)

openSessionRequest

public Map<String,String> openSessionRequest(String targetId,
                                             String socketName,
                                             Map<String,String> clientProps,
                                             Map<String,IProfile> context)
                                      throws TAFatalException
Description copied from interface: ITA
The UCH asks for permission to open a session with a specified client on a specified socket. If it is permitted then a map returns a keyValue pair {"Result", "A"} i.e. Accept Else it returns a keyValue pair {"Result", "R"} i.e. rejection.

Specified by:
openSessionRequest in interface ITA
Parameters:
targetId - a String value of targetId
socketName - a String value of socketName
clientProps - Map<String, String>
context - a Map<String, IProfile> of user and controller profile
Returns:
Map<String, String>
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.openSessionRequest(String, String, Map, Map)

sessionOpened

public void sessionOpened(String targetId,
                          String sessionId,
                          String socketName,
                          Map<String,String> clientProps,
                          Map<String,IProfile> context)
                   throws TAFatalException
Description copied from interface: ITA
If the TA has accepted an open session request, and if the UCH succeeded in the necessary steps to open a session with the client, the UCH will call sessionOpened and provide the sessionId pertaining to the new session. It opens a new Session for specified socketName with the targetId mentioned.

Specified by:
sessionOpened in interface ITA
Parameters:
targetId - a String value of targetId
sessionId - a String value of sessionId
socketName - a String value of socketName
clientProps - Map<String, String>
context - a Map<String, IProfile> of user and controller profile
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.sessionOpened(String, String, String, Map, Map)

getValues

public Map<String,String> getValues(String sessionId,
                                    List<String> paths,
                                    List<Boolean> includeSets)
                             throws TAFatalException
Description copied from interface: ITA
Returns a value/state of the specified socket elements.

Specified by:
getValues in interface ITA
Parameters:
sessionId - a String value of sessionId
paths - a List<String> of elementPath
includeSets - a List<Boolean> of includeSets
Returns:
a Map<String, String> of values
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.getValues(String, List, List)

setValuesRequest

public Map<String,List<String>> setValuesRequest(String sessionId,
                                                 boolean isValidated,
                                                 List<String> paths,
                                                 List<String> operations,
                                                 List<String> reqValues)
                                          throws TAFatalException
Description copied from interface: ITA
The client requests to change the target state in one or more operations on specified socket elements. The requested operations are coded as cross-indexed arrays of paths, operations, identifiers and requested new values.

Specified by:
setValuesRequest in interface ITA
Parameters:
sessionId - a String value of sessionId
paths - List<String> a List of elementPaths
operations - List<String> a List of operations (allowed operations are "S", "A", "R", "I" or "K" )
reqValues - List<String> a List of Requested Values
Returns:
Map<String, List<String>> of set Values
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.setValuesRequest(String, boolean, List, List, List)

getRegisteredTargetIds

public List<String> getRegisteredTargetIds()
                                    throws TAFatalException
Description copied from interface: ITA
Get the target identifiers that the TA is currently representing.

Specified by:
getRegisteredTargetIds in interface ITA
Returns:
List<String>
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.getRegisteredTargetIds()

getSocketDescriptionUri

public String getSocketDescriptionUri(String targetName,
                                      String socketName)
                               throws TAFatalException
Description copied from interface: ITA
Get the URI for retrieving the Socket Description for specified targetName and socketName.

Specified by:
getSocketDescriptionUri in interface ITA
Parameters:
targetName - a String value of targetName
socketName - a String value of socketName
Returns:
a String representing Socket Description URI
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.getSocketDescriptionUri(java.lang.String, java.lang.String)

getSessionIds

public List<String> getSessionIds(String targetId,
                                  String socketName)
                           throws TAFatalException
Description copied from interface: ITA
Get the Session Identifiers for specified targetId and socketName.

Specified by:
getSessionIds in interface ITA
Parameters:
targetId - a String value of targetId
socketName - a String value of socketName
Returns:
List<String> of sessionId
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.getSessionIds(java.lang.String, java.lang.String)

getSocketName

public String getSocketName(String sessionId)
                     throws TAFatalException
Description copied from interface: ITA
Get the SocketName for the specified sessionId.

Specified by:
getSocketName in interface ITA
Parameters:
sessionId - a String value of sessionId
Returns:
a String of SocketName
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.getSocketName(java.lang.String)

getSocketFriendlyName

public String getSocketFriendlyName(String targetId,
                                    String socketName)
Description copied from interface: ITA
Get the Socket Friendly Name for the specified socketName and targetId.

Specified by:
getSocketFriendlyName in interface ITA
Parameters:
targetId - a String value of targetId
socketName - a String value of socketName
Returns:
a String value of Socket Friendly Name
See Also:
ITA.getSocketFriendlyName(java.lang.String, java.lang.String)

getSocketNames

public List<String> getSocketNames(String targetName)
                            throws TAFatalException
Description copied from interface: ITA
Get the List of SocketName for specified targetName.

Specified by:
getSocketNames in interface ITA
Parameters:
targetName - a String value of targetName
Returns:
List<String> of SocketName
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.getSocketNames(java.lang.String)

getTargetDescriptionUri

public String getTargetDescriptionUri(String targetName)
                               throws TAFatalException
Description copied from interface: ITA
Get the URI for retrieving the Target Description.

Specified by:
getTargetDescriptionUri in interface ITA
Parameters:
targetName - a String value of targetName
Returns:
a String value of Target Description URI
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.getTargetDescriptionUri(java.lang.String)

getTargetName

public String getTargetName(String targetId)
                     throws TAFatalException
Description copied from interface: ITA
Get the targetName for specified targetId.

Specified by:
getTargetName in interface ITA
Parameters:
targetId - a String value of targetId
Returns:
a String value of targetName
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.getTargetName(java.lang.String)

getTargetProps

public Map<String,Object> getTargetProps(String targetId)
                                  throws TAFatalException
Description copied from interface: ITA
Get the Target's Properties for specified targetId.

Specified by:
getTargetProps in interface ITA
Parameters:
targetId - a String value of targetId
Returns:
a Map<String, Object> value of Target Properties
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.getTargetProps(java.lang.String)

isElementAvailable

public boolean isElementAvailable(String targetId,
                                  String socketName,
                                  String eltId)
                           throws TAFatalException
Description copied from interface: ITA
Checks whether a given socketElement is available in specified Socket of specified Target or not.

Specified by:
isElementAvailable in interface ITA
Parameters:
targetId - a String value of targetId
socketName - a String value of socketName
eltId - a String value of eltId
Returns:
boolean whether specified socketElement is exists or not
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.isElementAvailable(java.lang.String, java.lang.String, java.lang.String)

isImplemented

public boolean isImplemented(String functionName)
Description copied from interface: ITA
Checks whether specified function is implemented by the TA or not.

Specified by:
isImplemented in interface ITA
Parameters:
functionName - a String value of functionName
Returns:
boolean whether specified function is implemented by the TA or not.
See Also:
ITA.isImplemented(java.lang.String)

sessionClosed

public void sessionClosed(String sessionId)
                   throws TAFatalException
Description copied from interface: ITA
Closes the Session for specified sessionId and do the necessary clean-up for the target.

Specified by:
sessionClosed in interface ITA
Parameters:
sessionId - a String value of sessionId
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.sessionClosed(java.lang.String)

unregisterTarget

public void unregisterTarget(String targetId)
                      throws TAFatalException
Description copied from interface: ITA
Called when target has been disappeared from the network.

Specified by:
unregisterTarget in interface ITA
Parameters:
targetId - a String value of targetId
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.unregisterTarget(java.lang.String)

getTAProps

public Map<String,String> getTAProps()
Description copied from interface: ITA
Get Target Adapter Properties Map.

Specified by:
getTAProps in interface ITA
Returns:
an object of Map<String, String> of Target Adapter Properties
See Also:
ITA.getTAProps()

getIndices

public List<Set<String>> getIndices(String sessionId,
                                    List<String> eltIds,
                                    List<Integer> indexNos)
Description copied from interface: ITA
Get Indices available on specific level of dimension of dimensional Element.

Specified by:
getIndices in interface ITA
Parameters:
sessionId - a String value of sessionId
eltIds - a List<String> of elementIds
indexNos - a List<Integer> of indexNo
Returns:
a List<Set<Integer> of indices
See Also:
ITA.getIndices(String, List, List)

resumeSessionRequest

public boolean resumeSessionRequest(String sessionId)
                             throws TAFatalException,
                                    TANotImplementedException
Description copied from interface: ITA
The UCH asks for permission to resume a session. If TA does not support this function then throw TANotImplementedException.

Specified by:
resumeSessionRequest in interface ITA
Parameters:
sessionId - a String value of sessionId
Returns:
a a Long value of timeOut
Throws:
TAFatalException - an Object of TAFatalException
TANotImplementedException - an Object of TANotImplementedException
See Also:
ITA.resumeSessionRequest(String)

sessionResumed

public void sessionResumed(String sessionId)
                    throws TAException,
                           TAFatalException,
                           TANotImplementedException
Description copied from interface: ITA
The UCH signals the TA that the session has resumed. A call to this function shall only occur after a resume session request has been granted by the TA.

Specified by:
sessionResumed in interface ITA
Parameters:
sessionId - a string value of sessionId
Throws:
TAException - an Object of TAException
TAFatalException - an Object of TAFatalException
TANotImplementedException - an Object of TANotImplementedException
See Also:
ITA.sessionResumed(String)

sessionSuspended

public long sessionSuspended(String sessionId,
                             long suggestedTimeout)
                      throws TAException,
                             TAFatalException,
                             TANotImplementedException
Description copied from interface: ITA
The UCH signals the TA that the client has suspended a session with one of the TA’s targets. The TA do the necessary actions internally and with the target. The session is now suspended until a subsequent call to resumeSessionRequest(), or until the TA terminates the session for timing out or other reasons, in which case the TA shall call sessionAborted().

Specified by:
sessionSuspended in interface ITA
Parameters:
sessionId - a String value of sessionId
suggestedTimeout - a long value of suggestedTimeout
Returns:
whether permission is granted or not
Throws:
TAException - an Object of TAException
TAFatalException - an Object of TAFatalException
TANotImplementedException - an Object of TANotImplementedException
See Also:
ITA.sessionSuspended(String, long)

suspendSessionRequest

public boolean suspendSessionRequest(String sessionId)
                              throws TAFatalException,
                                     TANotImplementedException
Description copied from interface: ITA
The UCH asks for permission to suspend a session. If TA does not support this function then throw TANotImplementedException.

Specified by:
suspendSessionRequest in interface ITA
Parameters:
sessionId - a String value of sessionId
Returns:
whether permission for session suspend is granted or not
Throws:
TAFatalException - an Object of TAFatalException
TANotImplementedException - an Object of TANotImplementedException
See Also:
ITA.suspendSessionRequest(String)

getDynRes

public List<Map<String,Object>> getDynRes(String targetId,
                                          List<Map<String,String>> resProps)
                                   throws TAFatalException
Description copied from interface: ITA
Get the Dynamic Resources from the TA. The UCH shall specify the properties of the requested resource as many as possible.

Specified by:
getDynRes in interface ITA
Parameters:
targetId - a String value of sessionId
resProps - a List<Map<String, String>> value of Resource Properties
Returns:
a List<Object> of resources
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.getDynRes(String, List)

getLocators

public Map<String,String> getLocators(String targetName)
Description copied from interface: ITA
Get a map of locators containing locatorId and locatorType for a specific target.

Specified by:
getLocators in interface ITA
Parameters:
targetName - a String value of targetName
Returns:
a Map<string, String> of LocatorID V/S Locator Type
See Also:
ITA.getLocators(String)

invokeLocator

public void invokeLocator(String targetId,
                          String locaterId)
                   throws TAException,
                          TAFatalException
Description copied from interface: ITA
Invoke the specified locator function on a target. This requires a prior call to registerTarget on this target.

Specified by:
invokeLocator in interface ITA
Parameters:
targetId - a String value of targetId
locaterId - a String value of locaterId
Throws:
TAException - an Object of TAException
TAFatalException - an Object of TAFatalException
See Also:
ITA.invokeLocator(java.lang.String, java.lang.String)

targetContextsAdded

public void targetContextsAdded(String targetId,
                                List<Map<String,IProfile>> contexts)
                         throws TAFatalException
Description copied from interface: ITA
Called when one or more contexts got added to an existing target.

Specified by:
targetContextsAdded in interface ITA
Parameters:
targetId - a String value of targetId
contexts - a List<Map<String, IProfile>> of user and controller profile map
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.targetContextsAdded(String, List)

targetContextsRemoved

public void targetContextsRemoved(String targetId,
                                  List<Map<String,IProfile>> contexts)
                           throws TAFatalException
Description copied from interface: ITA
Called when one or more contexts got removed to an existing target.

Specified by:
targetContextsRemoved in interface ITA
Parameters:
targetId - a String value of targetId
contexts - a List<Map<String, IProfile>> of user and controller profile map
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.targetContextsRemoved(String, List)

targetRequest

public void targetRequest(HttpServletRequest request,
                          HttpServletResponse response,
                          Map<String,IProfile> context)
                   throws TAFatalException
Description copied from interface: ITA
The UCH calls this function if it has received a request from a target to a URI that the TA has claimed for itself by a previous call to startUriService().It modify the response object according to request object.

Specified by:
targetRequest in interface ITA
Parameters:
request - a HttpServletRequest Object
response - a HttpServletResponse Object
context - a Map<String, IProfile> of user and controller profile
Throws:
TAFatalException - an Object of TAFatalException
See Also:
ITA.targetRequest(HttpServletRequest, HttpServletResponse, Map)

finalize

public void finalize()
Description copied from interface: ITA
This method is called by UCH before Un-installing or Unloading the TA.

Specified by:
finalize in interface ITA
Overrides:
finalize in class Object
See Also:
ITA.finalize()


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