edu.wisc.trace.uch.uipm.urchttp
Class UrcHttpUIPM

java.lang.Object
  extended by edu.wisc.trace.uch.uipm.urchttp.UrcHttpUIPM
All Implemented Interfaces:
IUIPM

public class UrcHttpUIPM
extends Object
implements IUIPM

After getting information from ITDMListener regarding Discovery and Discarding of devices, UCH instantiates UrcHttpUIPM if relative target is discovered. UCH informs UIPM about Discovery and Discarding of the devices. It forwards relative call from UCH to ITA and get desired response and forwards to UCH for further process.

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

Constructor Summary
UrcHttpUIPM()
          Default Constructor.
 
Method Summary
 boolean addToSessionIdLastAccessMap(String sessionId, long time)
          Add a new entry for sessionId in sessionIdLastAccessMap.
 boolean addToSessionIdResPropsMap(String sessionId, List<Map<String,List<String>>> resPropsList)
          Add a new entry for Session Id in sessionIdResPropsMap.
 boolean addToSessionIdSocketNameMap(String sessionId, String socketName)
          Add a new entry for Session Id in sessionIdSocketNameMap.
 void clearValueOfMap(String sessionId, List<String> paths)
          Clear the updated values for specified paths of specified session.
 void contextsClosed(List<Map<String,IProfile>> contexts)
          Called when one or more contexts were closed or have expired on the UCH.
 void contextsOpened(List<Map<String,IProfile>> contexts)
          Called when one or more contexts have been opened on the UCH.
 void controllerRequest(HttpServletRequest request, HttpServletResponse response, Map<String,IProfile> context)
          The UCH calls this function if it has received a request from a controller to a URI that the UIPM has claimed for itself by a previous call to startUriService().It call desired methods of IUIPMListener and make changes to response object.
 void finalize()
          The UCH should call finalize() before it uninstalls or unloads the UIPM.
 IUIPMListener getIUIPMListener()
          Return an Object of IUIPMListener.
 List<Map<String,List<String>>> getResPropsCopy(String sessionId)
          Get copy of resProps for specified sessionId.
 String getSocketName(String sessionId)
          Get socketName for specified sessionId.
 Map<String,String> getUIPMProps()
          Returns Properties of UIPM.
 Map<String,List<String>> getUpdatedValuesResponse(String sessionId, List<String> paths)
          Get updated values for specified paths of specified Session.
 List<Map<String,IProfile>> getUriServiceContexts(String uri)
          Get list of contexts for one of the UIPM's service URI.
 void init(IUIPMListener uipmListener, Map<String,String> uipmProps, Map<String,String> uchProps, List<Map<String,IProfile>> contexts)
          When the UIPM is installed and loaded, the UCH calls this method prior to any other UIPM function and allows the UIPM to initialize itself.
 boolean isImplemented(String functionName)
          Checks whether specified function is implemented or not.
 Map<String,String> prepareUpdatedValueMap(String sessionId, Map<String,String> updateResponse)
          Return a Map<String, string> that contains the latest updated values.
 boolean removeFromSessionIdLastAccessMap(String sessionId)
          Remove the entry from sessionIdLastAccessedMap for the specified SessionId.
 boolean removeFromSessionIdResPropsMap(String sessionId)
          Remove the entry from sessionIdResPropsMap for the specified SessionId.
 boolean removeFromSessionIdSocketNameMap(String sessionId)
          Remove the entry from sessionIdSocketNameMap for the specified SessionId.
 void sessionAborted(String sessionId)
          The target has terminated a session.
 void sessionForwardRequest(String sessionId, Map<String,String> forwardInfo)
          The target requests the UIPM to open a session with a different socket.
 void SetTcpIpServer(TcpIpServer tcpIpServer)
          Assign the reference of TcpIpServer to the local variable.
 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)
          This function is called by UCH when a target has been discarded after initialization of the UIPM.
 void targetDiscovered(String targetId, List<Map<String,IProfile>> contexts)
          This function is called by UCH when a new target has been discovered after initialization of the UIPM.
 void updateValues(List<String> sessionIds, List<String> paths, List<String> operations, List<String> values, List<Boolean> hasDynRes)
          The target’s status has changed, affecting one or more sessions.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrcHttpUIPM

public UrcHttpUIPM()
Default Constructor.

Method Detail

getIUIPMListener

public IUIPMListener getIUIPMListener()
Return an Object of IUIPMListener.

Returns:
an Object of IUIPMListener
See Also:
ITDMListener

addToSessionIdLastAccessMap

public boolean addToSessionIdLastAccessMap(String sessionId,
                                           long time)
Add a new entry for sessionId in sessionIdLastAccessMap.

Parameters:
sessionId - a String value of sessionId
time - a log value of time
Returns:
whether the sessionId and time put successfully

removeFromSessionIdLastAccessMap

public boolean removeFromSessionIdLastAccessMap(String sessionId)
Remove the entry from sessionIdLastAccessedMap for the specified SessionId.

Parameters:
sessionId - a String value of sessionId.
Returns:
whether the entry removed successfully or not

addToSessionIdResPropsMap

public boolean addToSessionIdResPropsMap(String sessionId,
                                         List<Map<String,List<String>>> resPropsList)
Add a new entry for Session Id in sessionIdResPropsMap.

Parameters:
sessionId - a String value of SessionId
resPropsList - an Object of List<Map<String, List<String>>>
Returns:
whether the sessionId and resProps put successfully or not

removeFromSessionIdResPropsMap

public boolean removeFromSessionIdResPropsMap(String sessionId)
Remove the entry from sessionIdResPropsMap for the specified SessionId.

Parameters:
sessionId - a String value of SessionId
Returns:
whether the entry removed successfully or not

getResPropsCopy

public List<Map<String,List<String>>> getResPropsCopy(String sessionId)
Get copy of resProps for specified sessionId.

Parameters:
sessionId - a String value of SessionId
Returns:
an Object of List<Map<String, List<String>>>

addToSessionIdSocketNameMap

public boolean addToSessionIdSocketNameMap(String sessionId,
                                           String socketName)
Add a new entry for Session Id in sessionIdSocketNameMap.

Parameters:
sessionId - a String value of SessionId
socketName - a String value of socketName
Returns:
whether the sessionId and socketName put successfully or not

removeFromSessionIdSocketNameMap

public boolean removeFromSessionIdSocketNameMap(String sessionId)
Remove the entry from sessionIdSocketNameMap for the specified SessionId.

Parameters:
sessionId - a String value of SessionId
Returns:
whether the entry removed successfully or not

getSocketName

public String getSocketName(String sessionId)
Get socketName for specified sessionId.

Parameters:
sessionId - a String value of SessionId
Returns:
an Object of String

SetTcpIpServer

public void SetTcpIpServer(TcpIpServer tcpIpServer)
Assign the reference of TcpIpServer to the local variable.

Parameters:
tcpIpServer - an Object of TcpIpServer

init

public void init(IUIPMListener uipmListener,
                 Map<String,String> uipmProps,
                 Map<String,String> uchProps,
                 List<Map<String,IProfile>> contexts)
          throws UIPMFatalException
Description copied from interface: IUIPM
When the UIPM is installed and loaded, the UCH calls this method prior to any other UIPM function and allows the UIPM to initialize itself.

Specified by:
init in interface IUIPM
Parameters:
uipmListener - an Object of IUIPMListener
uipmProps - a Map<String, String> of IUIPM Properties
uchProps - a Map<String, String> of UCH Properties
contexts - a List<Map<String, IProfile>> of user and controller profile map
Throws:
UIPMFatalException - an Object of UIPMFatalException
See Also:
IUIPM.init(IUIPMListener, Map, Map, List)

targetDiscovered

public void targetDiscovered(String targetId,
                             List<Map<String,IProfile>> contexts)
                      throws UIPMFatalException
Description copied from interface: IUIPM
This function is called by UCH when a new target has been discovered after initialization of the UIPM.

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

controllerRequest

public void controllerRequest(HttpServletRequest request,
                              HttpServletResponse response,
                              Map<String,IProfile> context)
Description copied from interface: IUIPM
The UCH calls this function if it has received a request from a controller to a URI that the UIPM has claimed for itself by a previous call to startUriService().It call desired methods of IUIPMListener and make changes to response object.

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

updateValues

public void updateValues(List<String> sessionIds,
                         List<String> paths,
                         List<String> operations,
                         List<String> values,
                         List<Boolean> hasDynRes)
                  throws UIPMFatalException
Description copied from interface: IUIPM
The target’s status has changed, affecting one or more sessions.

Specified by:
updateValues in interface IUIPM
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
Throws:
UIPMFatalException - an Object of UIPMFatalException
See Also:
IUIPM.updateValues(java.util.List, java.util.List, java.util.List, java.util.List, java.util.List)

targetDiscarded

public void targetDiscarded(String targetId)
                     throws UIPMFatalException
Description copied from interface: IUIPM
This function is called by UCH when a target has been discarded after initialization of the UIPM.

Specified by:
targetDiscarded in interface IUIPM
Parameters:
targetId - a String value of targetId
Throws:
UIPMFatalException - an Object of UIPMFatalException
See Also:
IUIPM.targetDiscarded(java.lang.String)

getUIPMProps

public Map<String,String> getUIPMProps()
Description copied from interface: IUIPM
Returns Properties of UIPM.

Specified by:
getUIPMProps in interface IUIPM
Returns:
Map<String, String>
See Also:
IUIPM.getUIPMProps()

isImplemented

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

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

sessionAborted

public void sessionAborted(String sessionId)
                    throws UIPMFatalException
Description copied from interface: IUIPM
The target has terminated a session.

Specified by:
sessionAborted in interface IUIPM
Parameters:
sessionId - a String value of sessionId
Throws:
UIPMFatalException - an Object of UIPMFatalException
See Also:
IUIPM.sessionAborted(java.lang.String)

sessionForwardRequest

public void sessionForwardRequest(String sessionId,
                                  Map<String,String> forwardInfo)
                           throws UIPMFatalException
Description copied from interface: IUIPM
The target requests the UIPM to open a session with a different socket.

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

contextsOpened

public void contextsOpened(List<Map<String,IProfile>> contexts)
                    throws UIPMFatalException
Description copied from interface: IUIPM
Called when one or more contexts have been opened on the UCH.

Specified by:
contextsOpened in interface IUIPM
Parameters:
contexts - a List<Map<String, IProfile>> of user and controller profile map
Throws:
UIPMFatalException - an Object of UIPMFatalException
See Also:
IUIPM.contextsOpened(List)

contextsClosed

public void contextsClosed(List<Map<String,IProfile>> contexts)
                    throws UIPMFatalException
Description copied from interface: IUIPM
Called when one or more contexts were closed or have expired on the UCH.

Specified by:
contextsClosed in interface IUIPM
Parameters:
contexts - a List<Map<String, IProfile>> of user and controller profile map
Throws:
UIPMFatalException - an Object of UIPMFatalException
See Also:
IUIPM.contextsClosed(List)

getUriServiceContexts

public List<Map<String,IProfile>> getUriServiceContexts(String uri)
                                                 throws UIPMFatalException
Description copied from interface: IUIPM
Get list of contexts for one of the UIPM's service URI.

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

targetContextsAdded

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

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

targetContextsRemoved

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

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

finalize

public void finalize()
Description copied from interface: IUIPM
The UCH should call finalize() before it uninstalls or unloads the UIPM.

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

getUpdatedValuesResponse

public Map<String,List<String>> getUpdatedValuesResponse(String sessionId,
                                                         List<String> paths)
Get updated values for specified paths of specified Session.

Parameters:
sessionId - a String value of SessionId
paths - an Object of List<String>
Returns:
an XML String of updated values.

clearValueOfMap

public void clearValueOfMap(String sessionId,
                            List<String> paths)
Clear the updated values for specified paths of specified session.

Parameters:
sessionId - a String value of sessionId
paths - an Object of List<String>

prepareUpdatedValueMap

public Map<String,String> prepareUpdatedValueMap(String sessionId,
                                                 Map<String,String> updateResponse)
Return a Map<String, string> that contains the latest updated values.

Parameters:
sessionId - a String value of sessionId
updateResponse - a return Map<String, String> of IUIPMListener's getValueRequest()/getUpdates()
Returns:
a Map<String, String> of updated values


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