edu.wisc.trace.uch
Class TDMListener

java.lang.Object
  extended by edu.wisc.trace.uch.TDMListener
All Implemented Interfaces:
ITDMListener

public class TDMListener
extends Object
implements ITDMListener

Implements the methods of ITDMListener. Also maintain information about TDMs.

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

Method Summary
 void addUriServiceContexts(String uri, List<Map<String,IProfile>> contexts)
          Called when the TDM wants to add one or more contexts to a URI service.
 List<Map<String,IProfile>> getContexts()
          Get currently open contexts.
 String getDocument(String uri, String postData, Map<String,IProfile> context)
          Get specified document through HTTP GET or POST.
 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 removeTDM(ITDM tdm)
          Removes the specified tdm from the UCH.
 void removeUriServiceContexts(String uri, List<Map<String,IProfile>> contexts)
          Called when the TDM wants to close one or more contexts to a URI service.
 String startUriService(ITDM tdm, String scheme, int port, boolean portIsFlexible, String basePath, boolean basePathIsFlexible, List<Map<String,IProfile>> contexts)
          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 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 targetDiscarded(String targetId)
          A TDM calls this function when a target has been disappeared from the network.
 String targetDiscovered(ITDM tdm, Map<String,Object> targetProps, Map<String,String> taProps, List<Map<String,IProfile>> contexts)
          This function is called by a TDM when it has discovered a new target and loads appropriate TA for the new target.
 List<Map<String,String>> uploadResources(List<Map<String,List<String>>> props, List<String> resourceUri)
          Upload Resources on Resource Server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDocument

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

Specified by:
getDocument in interface ITDMListener
Parameters:
uri - a String value of URI
postData - a String value of postData
context - a Map<String, IProfile> of user and controller profile
Returns:
a String value of requested Document
Throws:
UCHException
See Also:
ITDMListener.getDocument(String, String, Map)

getIpAddress

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

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

getLocalUCHStore

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

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

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 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)

getUCHProps

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

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

isImplemented

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

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(java.lang.String)

startUriService

public String startUriService(ITDM tdm,
                              String scheme,
                              int port,
                              boolean portIsFlexible,
                              String basePath,
                              boolean basePathIsFlexible,
                              List<Map<String,IProfile>> contexts)
                       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
contexts - a List<Map<String, IProfile>> of user and controller profile map
Returns:
a String value of URI
Throws:
UCHException - an Object of UCHException
See Also:
ITDMListener.startUriService(ITDM, String, int, boolean, String, boolean, List)

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 ITDMListener
Parameters:
uri - a String value of URI
Throws:
UCHException - an Object of UCHException
See Also:
ITDMListener.stopUriService(String)

uploadResources

public List<Map<String,String>> uploadResources(List<Map<String,List<String>>> props,
                                                List<String> resourceUri)
Description copied from interface: ITDMListener
Upload Resources on Resource Server.

Specified by:
uploadResources in interface ITDMListener
Parameters:
props - an Object of List<Map<String, List<String>>>
resourceUri - an Object of List<String>
Returns:
an Object of Map<String, String>
See Also:
ITDMListener.uploadResources(List, List)

targetDiscovered

public String targetDiscovered(ITDM tdm,
                               Map<String,Object> targetProps,
                               Map<String,String> taProps,
                               List<Map<String,IProfile>> contexts)
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:
tdm - an Object of ITDM
targetProps - a Map<String, Object> of discovered Target Properties
taProps - a Map<String, String> of TA(Target Adapter)'s Properties
contexts - a List<Map<String, IProfile>> of user and controller profile map
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(ITDM, Map, Map, List)

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(String)

removeTDM

public void removeTDM(ITDM tdm)
Description copied from interface: ITDMListener
Removes the specified tdm from the UCH.

Specified by:
removeTDM in interface ITDMListener
Parameters:
tdm - an Object of ITDM
See Also:
ITDMListener.removeTDM(ITDM)

addUriServiceContexts

public void addUriServiceContexts(String uri,
                                  List<Map<String,IProfile>> contexts)
                           throws UCHException
Description copied from interface: ITDMListener
Called when the TDM wants to add one or more contexts to a URI service.

Specified by:
addUriServiceContexts in interface ITDMListener
Parameters:
uri - a String value of URI
contexts - a List<Map<String, IProfile>> of user and controller profile map
Throws:
UCHException - an Object of UCHException
See Also:
ITDMListener.addUriServiceContexts(String, List)

getContexts

public List<Map<String,IProfile>> getContexts()
Description copied from interface: ITDMListener
Get currently open contexts.

Specified by:
getContexts in interface ITDMListener
Returns:
a List<Map<String, IProfile>> of user and controller profile map
See Also:
ITDMListener.getContexts()

removeUriServiceContexts

public void removeUriServiceContexts(String uri,
                                     List<Map<String,IProfile>> contexts)
                              throws UCHException
Description copied from interface: ITDMListener
Called when the TDM wants to close one or more contexts to a URI service.

Specified by:
removeUriServiceContexts in interface ITDMListener
Parameters:
uri - a String value of URI
contexts - a List<Map<String, IProfile>> of user and controller profile map
Throws:
UCHException - an Object of UCHException
See Also:
ITDMListener.removeUriServiceContexts(String, List)

targetContextsAdded

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

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

targetContextsRemoved

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

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


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