edu.wisc.trace.uch
Class UCH

java.lang.Object
  extended by edu.wisc.trace.uch.UCH

public class UCH
extends Object

Provide a central interface to communicate with any module as well as provides intercommunication among modules.

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

Method Summary
 void closeUserContext(HttpServletRequest request)
          Get session from request and found user from it and close context with that user.
 void contextClosed(List<Map<String,IProfile>> contexts)
          Call the same method on TDMListener and UIPMListener.
 void contextOpened(List<Map<String,IProfile>> contexts)
          Call the same method on TDMListener and UIPMListener.
 String convertURI(String uri)
          Convert the uri from docRootUri to baseUri and return it.
 String getCompatibleUIs()
          Call the same method of this class with passing hostName and HttpServletRequest null.
 String getCompatibleUIs(String hostName)
          Call the same method of this class with passing HttpServletRequest null.
 String getCompatibleUIs(String hostName, HttpServletRequest request)
          Get compatible UIs XML response for specified hostName and request user.
 List<Map<String,Object>> getDynRes(String sessionId, List<Map<String,String>> resProps)
          Call the same method on TAListener.
 List<List<Map<String,List<String>>>> getResources(List<Map<String,List<String>>> resProps)
          Get Resources from Local Resources, Resource Server, Target Adapter or Resource Sheet as par the requested resource property resourceType.
 List<List<Map<String,List<String>>>> getResources(String sessionId, List<Map<String,List<String>>> resProps)
          Get Resources from Local Resources, Resource Server, Target Adapter or Resource Sheet as par the requested resource property resourceType.
 void handleCacheRequest(HttpServletRequest request, HttpServletResponse response)
          Handle The http://...cache?name=[resourceName].
 void handleUpdateUserAction(HttpServletRequest request, HttpServletResponse response)
          Update the User Info to communicate with Resource Server.
 void handleUserNameRequest(HttpServletRequest request, HttpServletResponse response)
          Respond with Resource Server UserName.
 boolean isUriContainsResServerAppPath(String uri)
          CHeck whether URI contains Resource Server App Path.
 void openUserContext(HttpServletRequest request, String userName, String password)
          Open Context with specified User.
 void performConfigOperation(String keyValueStr)
          Parse the keyValue String(key1=value1&...&keyN=valueN).
 void postRequest(HttpServletRequest request, HttpServletResponse response)
          It finds related context if session is associated with request.
 boolean validateContextUser(HttpServletRequest request, String userName, String password)
          Check whether specified userName and password is valid or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isUriContainsResServerAppPath

public boolean isUriContainsResServerAppPath(String uri)
CHeck whether URI contains Resource Server App Path.

Parameters:
uri - a String value of URI
Returns:
a boolean value specifies whether URI contains Resource Server App Path

convertURI

public String convertURI(String uri)
Convert the uri from docRootUri to baseUri and return it. docRootUri specifies file path of UCH location in local file system. baseUri specifies http path of UCH.

Parameters:
uri - a String value of uri
Returns:
a String uri converted from file uri to http uri

postRequest

public void postRequest(HttpServletRequest request,
                        HttpServletResponse response)
It finds related context if session is associated with request. And select appropriate IUIPM, ITA or ITDM for further handling.

Parameters:
request - an Object of Request
response - an Object of Response
See Also:
HttpServletRequest, HttpServletResponse

handleCacheRequest

public void handleCacheRequest(HttpServletRequest request,
                               HttpServletResponse response)
Handle The http://...cache?name=[resourceName]. Get the specified resource from Resource Server if it is not already downloaded. If it is a zip file then unzip it and get the index file and redirect with proper URL of that file.

Parameters:
request - an Object of HttpServletRequest
response - an Object of HttpServletResponse

handleUserNameRequest

public void handleUserNameRequest(HttpServletRequest request,
                                  HttpServletResponse response)
Respond with Resource Server UserName.

Parameters:
request - an Object of HttpServletRequest
response - an Object of HttpServletResponse

handleUpdateUserAction

public void handleUpdateUserAction(HttpServletRequest request,
                                   HttpServletResponse response)
Update the User Info to communicate with Resource Server.

Parameters:
request - an Object of HttpServletRequest
response - an Object of HttpServletResponse

performConfigOperation

public void performConfigOperation(String keyValueStr)
Parse the keyValue String(key1=value1&...&keyN=valueN). And clear all or specified type resources from cache.

Parameters:
keyValueStr - a Key Value String

getCompatibleUIs

public String getCompatibleUIs()
Call the same method of this class with passing hostName and HttpServletRequest null.

Returns:
a String representing Compatible UIs

getCompatibleUIs

public String getCompatibleUIs(String hostName)
Call the same method of this class with passing HttpServletRequest null.

Parameters:
hostName - a String value of HostName
Returns:
a String representing Compatible UIs

getCompatibleUIs

public String getCompatibleUIs(String hostName,
                               HttpServletRequest request)
Get compatible UIs XML response for specified hostName and request user. Get SessionId from the request Object and get related context if session is exist. And find compatible UIs for specified user if user context exists else return compatible UIs for anonymous User.

Parameters:
hostName - a String value of HostName
request - an Object of HttpServletRequest
Returns:
a String representing Compatible UIs

getDynRes

public List<Map<String,Object>> getDynRes(String sessionId,
                                          List<Map<String,String>> resProps)
Call the same method on TAListener.

Parameters:
sessionId - a String value of sessionId
resProps - a List<Map<String, String>> value of Resource Properties
Returns:
a List<Object> of resources

getResources

public List<List<Map<String,List<String>>>> getResources(String sessionId,
                                                         List<Map<String,List<String>>> resProps)
Get Resources from Local Resources, Resource Server, Target Adapter or Resource Sheet as par the requested resource property resourceType. If request properties contains property 'http://myurc.org/ns/res#type' and its value is 'http://myurc.org/restypes#atomic' then go for atomic or dynamic resource. Else find resource from local resources and if not found then go to resource server to get it. Filter the responded Resources.

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

getResources

public List<List<Map<String,List<String>>>> getResources(List<Map<String,List<String>>> resProps)
Get Resources from Local Resources, Resource Server, Target Adapter or Resource Sheet as par the requested resource property resourceType. If request properties contains property 'http://myurc.org/ns/res#type' and its value is 'http://myurc.org/restypes#atomic' then go for atomic or dynamic resource. Else find resource from local resources and if not found then go to resource server to get it.

Parameters:
resProps - an Object of List<Map<String, List<String>>>
Returns:
a List<List<Map<String, Object>>> of Resources.

openUserContext

public void openUserContext(HttpServletRequest request,
                            String userName,
                            String password)
Open Context with specified User. Also open a session with same user.

Parameters:
request - an Object of HttpServletRequest
userName - a String value of userName
password - a String value of password

closeUserContext

public void closeUserContext(HttpServletRequest request)
Get session from request and found user from it and close context with that user. Also close same session.

Parameters:
request - an Object of HttpServletRequest

validateContextUser

public boolean validateContextUser(HttpServletRequest request,
                                   String userName,
                                   String password)
Check whether specified userName and password is valid or not.

Parameters:
request - an Object of HttpServletRequest
userName - a String value of userName
password - a String value of password
Returns:
a boolean value specifies whether userName and password is valid or not.

contextOpened

public void contextOpened(List<Map<String,IProfile>> contexts)
Call the same method on TDMListener and UIPMListener. That will further call the same methods on all TAs and UIPMs.

Parameters:
contexts - an Object of List<Map<String, IProfile>>

contextClosed

public void contextClosed(List<Map<String,IProfile>> contexts)
Call the same method on TDMListener and UIPMListener. That will further call the same methods on all TAs and UIPMs.

Parameters:
contexts - an Object of List<Map<String, IProfile>>


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