edu.wisc.trace.uch
Class TargetListener

java.lang.Object
  extended by edu.wisc.trace.uch.TargetListener
All Implemented Interfaces:
ITAListener, ITDMListener

public class TargetListener
extends Object
implements ITDMListener, ITAListener

It implements ITAListener and ITDMListener and delegates the calls from UCH to TA and vice-versa.

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

Method Summary
 void abortSession(String sessionId)
          The TA has terminated a session, when the TA will have no knowledge about that session.
 String getDocument(String uri, String postData)
          Get specified document through HTTP GET or POST.
static TargetListener getInstance(UCH uipmListener, String tdms)
          Gets the instance of targetListener.
 String getIpAddress()
          Get the IP address of the UCH.
 IUCHStore getLocalUCHStore()
          Get the Local UCH Store.
 List<List<Map<String,List<String>>>> getResources(String sessionId, List<Map<String,List<String>>> resProps)
          Get resource from the UCH specified by Resource Properties.
 Map<String,String> getUCHProps()
          Get a Map of UCH Properties.
 boolean isImplemented(String functionName)
          Checks whether specified function is implemented or not.
 void sessionForwardRequest(String sessionId, Map<String,String> forwardInfo)
          The TA requests the client to open a session with different socket.
 boolean setValidation(ITA ta, boolean activate)
          Check whether to do validation for the TA or not.
 String startUriService(ITA ta, String scheme, int port, boolean portIsFlexible, String basePath, boolean basePathIsFlexible)
          The ITA requests the UCH to start servicing a URI which is made up of a given scheme, port, and base path.
 String startUriService(ITDM tdm, String scheme, int port, boolean portIsFlexible, String basePath, boolean basePathIsFlexible)
          The ITDM requests the UCH to start servicing a URI which is made up of a given scheme, port, and base path.
 void stopUriService(String uri)
          The ITDM requests the UCH to stop servicing a URI that was requested to be serviced in a previous call to startUriService().
 void targetDiscarded(String targetId)
          A TDM calls this function when a target has been disappeared from the network.
 String targetDiscovered(Map<String,Object> targetProps, Map<String,String> taProps)
          This function is called by a TDM when it has discovered a new target and loads appropriate TA for the new target.
 void updateDynRes(List<String> sessionIds, List<String> eltIds)
          Signals that the set of resources pertaining to a specific socket element has been changed.
 void updateValues(List<String> sessionIds, List<String> paths, List<String> operations, List<String> values, List<Boolean> hasDynRes)
          The TA signals a change in the target’s status, affecting one or more sessions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static TargetListener getInstance(UCH uipmListener,
                                         String tdms)
Gets the instance of targetListener.

Parameters:
uipmListener - an Object of UCH
Returns:
an object of TargetListener

updateValues

public void updateValues(List<String> sessionIds,
                         List<String> paths,
                         List<String> operations,
                         List<String> values,
                         List<Boolean> hasDynRes)
Description copied from interface: ITAListener
The TA signals a change in the target’s status, affecting one or more sessions.

Specified by:
updateValues in interface ITAListener
Parameters:
sessionIds - a List<String> of sessionIds
paths - a List<String> of paths
operations - a List<String> of operations
values - a List<String> of values
hasDynRes - a List<Boolean> of hasDynRes
See Also:
ITAListener.updateValues(java.util.List, java.util.List, java.util.List, java.util.List, java.util.List)

abortSession

public void abortSession(String sessionId)
Description copied from interface: ITAListener
The TA has terminated a session, when the TA will have no knowledge about that session.

Specified by:
abortSession in interface ITAListener
Parameters:
sessionId - a String value of sessionId
See Also:
ITAListener.abortSession(java.lang.String)

sessionForwardRequest

public void sessionForwardRequest(String sessionId,
                                  Map<String,String> forwardInfo)
Description copied from interface: ITAListener
The TA requests the client to open a session with different socket.

Specified by:
sessionForwardRequest in interface ITAListener
Parameters:
sessionId - a String value of sessionId
forwardInfo - Map<String, String>
See Also:
ITAListener.sessionForwardRequest(java.lang.String, java.util.Map)

setValidation

public boolean setValidation(ITA ta,
                             boolean activate)
Description copied from interface: ITAListener
Check whether to do validation for the TA or not.

Specified by:
setValidation in interface ITAListener
Parameters:
ta - an Object of ITA
activate - a boolean value of activate
Returns:
boolean whether to do validation for the TA or not
See Also:
ITAListener.setValidation(ITA, boolean)

updateDynRes

public void updateDynRes(List<String> sessionIds,
                         List<String> eltIds)
Description copied from interface: ITAListener
Signals that the set of resources pertaining to a specific socket element has been changed.

Specified by:
updateDynRes in interface ITAListener
Parameters:
sessionIds - a List<String> of sessionIds
eltIds - a List<String> of elementIds
See Also:
ITAListener.updateDynRes(List, List)

startUriService

public String startUriService(ITA ta,
                              String scheme,
                              int port,
                              boolean portIsFlexible,
                              String basePath,
                              boolean basePathIsFlexible)
                       throws UCHException
Description copied from interface: ITAListener
The ITA requests the UCH to start servicing a URI which is made up of a given scheme, port, and base path. If successful, the UCH will forward all messages that have this URI as its base, to controllerRequest().

Specified by:
startUriService in interface ITAListener
Parameters:
ta - an ITA object
scheme - a String value of schema
port - a port no
portIsFlexible - a boolean value
basePath - a String value of basePath
basePathIsFlexible - a boolean value
Returns:
a String value of URI
Throws:
UCHException
See Also:
ITAListener.startUriService(ITA, String, int, boolean, String, boolean)

stopUriService

public void stopUriService(String uri)
                    throws UCHException
Description copied from interface: ITDMListener
The ITDM requests the UCH to stop servicing a URI that was requested to be serviced in a previous call to startUriService().

Specified by:
stopUriService in interface ITAListener
Specified by:
stopUriService in interface ITDMListener
Parameters:
uri - a String value of URI
Throws:
UCHException
See Also:
ITAListener.stopUriService(String)

getIpAddress

public String getIpAddress()
Description copied from interface: ITDMListener
Get the IP address of the UCH.

Specified by:
getIpAddress in interface ITAListener
Specified by:
getIpAddress in interface ITDMListener
Returns:
return a string value
See Also:
ITAListener.getIpAddress()

targetDiscarded

public void targetDiscarded(String targetId)
Description copied from interface: ITDMListener
A TDM calls this function when a target has been disappeared from the network.

Specified by:
targetDiscarded in interface ITDMListener
Parameters:
targetId - a String value of targetId
See Also:
ITDMListener.targetDiscarded(java.lang.String)

targetDiscovered

public String targetDiscovered(Map<String,Object> targetProps,
                               Map<String,String> taProps)
Description copied from interface: ITDMListener
This function is called by a TDM when it has discovered a new target and loads appropriate TA for the new target. If the corresponding TA is already installed, the new target should be registered with the already installed TA.

Specified by:
targetDiscovered in interface ITDMListener
Parameters:
targetProps - a Map<String, Object> of discovered Target Properties
taProps - a Map<String, String> of TA(Target Adapter)'s Properties
Returns:
a String The UCH shall return the targetId (String) that it has assigned the newly discovered target. This may be identical to the property ‘targetInstance’ in targetProps
See Also:
ITDMListener.targetDiscovered(Map, Map)

getLocalUCHStore

public IUCHStore getLocalUCHStore()
Description copied from interface: ITDMListener
Get the Local UCH Store.

Specified by:
getLocalUCHStore in interface ITAListener
Specified by:
getLocalUCHStore in interface ITDMListener
Returns:
an Object of IUCHStore
See Also:
ITDMListener.getLocalUCHStore()

getUCHProps

public Map<String,String> getUCHProps()
Description copied from interface: ITDMListener
Get a Map of UCH Properties.

Specified by:
getUCHProps in interface ITAListener
Specified by:
getUCHProps in interface ITDMListener
Returns:
an object of Map<String, String> or UCH Properties
See Also:
ITDMListener.getUCHProps()

getDocument

public String getDocument(String uri,
                          String postData)
                   throws UCHException
Description copied from interface: ITDMListener
Get specified document through HTTP GET or POST.

Specified by:
getDocument in interface ITAListener
Specified by:
getDocument in interface ITDMListener
Parameters:
uri - a String value of URI
postData - a String value of postData
Returns:
a String value of requested Document
Throws:
UCHException
See Also:
ITDMListener.getDocument(String, String)

getResources

public List<List<Map<String,List<String>>>> getResources(String sessionId,
                                                         List<Map<String,List<String>>> resProps)
Description copied from interface: ITDMListener
Get resource from the UCH specified by Resource Properties.

Specified by:
getResources in interface ITAListener
Specified by:
getResources in interface ITDMListener
Parameters:
sessionId - a String value of sessionId
resProps - a Map<String, List<String>> of Resource Properties
Returns:
a List<List<Map<String, List<String>>>> value
See Also:
ITDMListener.getResources(String, List)

isImplemented

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

Specified by:
isImplemented in interface ITAListener
Specified by:
isImplemented in interface ITDMListener
Parameters:
functionName - a String value of function Name
Returns:
whether the function is implemented or not
See Also:
ITDMListener.isImplemented(String)

startUriService

public String startUriService(ITDM tdm,
                              String scheme,
                              int port,
                              boolean portIsFlexible,
                              String basePath,
                              boolean basePathIsFlexible)
                       throws UCHException
Description copied from interface: ITDMListener
The ITDM requests the UCH to start servicing a URI which is made up of a given scheme, port, and base path. If successful, then the UCH will forward all messages that have this URI as its base, to controllerRequest().

Specified by:
startUriService in interface ITDMListener
Parameters:
tdm - an Object of ITDM
scheme - a String value of scheme
port - an int value of port number
portIsFlexible - a boolean value
basePath - a String value of basePath
basePathIsFlexible - a boolean value
Returns:
a String value of URI
Throws:
UCHException
See Also:
ITDMListener.startUriService(ITDM, String, int, boolean, String, boolean)


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