com.sas.servlet.util
Class InformationMapViewerServlet

com.sas.servlet.util.InformationMapViewerServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class InformationMapViewerServlet

Servlet used to view an information map. The viewer displaying the information map will contain controlls for scrolling, sorting, and modifying the query. Before invoking this servlet, you must set an instance of com.sas.services.session.SessionContextInterface, com.sas.iquery.metadata.IntelligentQueryMetadataServiceInterface, and com.sas.iquery.metadata.business.InformationMap on the session. The keys used to set these attributes on the session must be passed on the request to the InformationMapViewerServlet using the keys SESSIONCONTEXTNAME, IQSERVICENAME, and INFORMATIONMAPNAME.

To create a link that opens an InformationMap with the InformationMapViewerServlet:

<%
com.sas.services.session.SessionContextInterface sessionContext;
com.sas.iquery.metadata.IntelligentQueryMetadataServiceInterface iqueryService;
com.sas.iquery.metadata.business.InformationMap informationMap;
String mapPath = "SBIP://OMR_REPOSITORY_NAME/BIP Tree/YOUR_DIR_NAME/YOUR_MAP_NAME";
sessionContext = PFSUtilities.loginUser(username, password, domain);
iqueryService = IntelligentQueryMetadataServiceFactory.newService();
informationMap = iqueryService.getInformationMap(sessionContext, new PathUrl(mapPath));
session.setAttribute("sc",sessionContext);
session.setAttribute("iqs",iqueryService);
session.setAttribute("imap",informationMap);
%>
<a href="/InformationMapViewerServlet?
&SESSIONCONTEXTNAME=sc&IQSERVICENAME=iqs&INFORMATIONMAPNAME=imap">Open Map</a>

If an instanceof of the InformationMap is not used then the path of the InformationMap can be passed on the request to the servlet using the key fullyQualifiedPath. The fullyQualifiedPath must be of the form "SBIP://OMR_REPOSITORY_NAME/BIP Tree/YOUR_DIR_NAME/YOUR_MAP_NAME".

If the INFORMATIONMAPNAME is set then the fullyQualifiedPath is ignored. If the INFORMATIONMAPNAME is not set then the fullyQualifiedPath is used.

To set the character encoding that will be set on the servlet's response, then you can place the character encoding to be used on the request object or the session. The attribute name of the key used is the String com.sas.web.keys.ComponentKeys.CHARACTER_ENCODING. The order of preference is the request and then the session. If you do not set the character encoding, then the ComponentPropertyManager.getOutputCharacterEncoding() will be used. The default value on the ComponentPropertyManager is UTF-8.

The InformationMapViewerServlet can also be easily as a custom action on the InformationServicesSelector. The following code shows how to set this up:

<jsp:useBean id="ap" class="com.sas.actionprovider.HttpActionProvider" scope="session" />
<jsp:useBean id="iss" class="com.sas.servlet.tbeans.remotefileselector.html.InformationServicesSelector" scope="session" />
<%
if (iss.getRepository() == null)
{
iss.setActionProvider(ap);

//assuming Foundation Services have been deployed
SessionContextInterface sessionContext = PFSUtilities.loginUser(userid, password, domain);
InformationServiceInterface infoService = (InformationServiceInterface)PFSUtilities.findService(InformationServiceInterface.class);
List repos = sessionContext.getUserContext().getRepositories();
RepositoryInterface reposInt = (RepositoryInterface)repos.get(0);
iss.setRepository(reposInt);
iss.setSearchVisible(true);

HttpAction action = (HttpAction)ap.getDefaultAction(
ActionProviderSupportTypes.REMOTE_FILE_SELECTOR_COMPOSITE_SUPPORT,
HttpRemoteFileSelectorTableViewSupport.DATA_CELL_AREA,
HttpRemoteFileSelectorTableViewSupport.SELECT_FILE_ACTION)
action.setURLBase("InformationMapViewerServlet");
IntelligentQueryMetadataServiceInterface iqService = new IntelligentQueryMetadataServiceFactory().newService();

session.setAttribute("sc",sessionContext);
session.setAttribute("iqs",iqService);

action.setAttribute("SESSIONCONTEXTNAME","sc");
action.setAttribute("IQSERVICENAME","iqs");
action.setAttribute( HttpAction.TARGET, "viewer" );
}
else
{
ap.executeCommand(request, response, out);
}

iss.setRequest(request);
iss.setResponse(response);
iss.write(out);
%>

For more info on Foundation Service then see com.sas.services, com.sas.services.discovery and com.sas.services.session packages.

See Also:
Serialized Form

Constructor Summary
InformationMapViewerServlet()
           
 
Method Summary
 java.lang.String getServletInfo()
           
 void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Writes the content bytes to the output stream
 

Constructor Detail

InformationMapViewerServlet

public InformationMapViewerServlet()
Method Detail

getServletInfo

public java.lang.String getServletInfo()
Specified by:
getServletInfo in interface javax.servlet.Servlet
Overrides:
getServletInfo in class javax.servlet.GenericServlet

service

public void service(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws javax.servlet.ServletException,
                    java.io.IOException
Writes the content bytes to the output stream

Overrides:
service in class javax.servlet.http.HttpServlet
Parameters:
request - the servlet request object
response - the servlet response object
Throws:
javax.servlet.ServletException - if a servlet exception occurs
java.io.IOException - if an I/O exception occurs



Copyright © 2009 SAS Institute Inc. All Rights Reserved.