Resources

SAS® AppDev Studio 3.0 Developer's Site

Web Application Example Templates


Overview
General Assumptions
Example Templates
SAS Foundation Services
Web Application Deployment
Troubleshooting

Overview

The Web application example templates are new in SAS AppDev Studio 3.0. They enable you to easily create a variety of Java Web applications that are structured using the Model-View-Controller architecture. These example templates are used as starting boiler plates for the examples portion of the developer site. The example templates are part of the WebApp Project Wizard in webAF software, which you use to create a new Web Application Project. In step 4 of 6 in the wizard, select the Examples radio button (near the bottom of the panel) to display a list of the available example templates. More information about webAF templates can be found in the Built-in Web Application Templates and Options paper.

General Assumptions

The following assumptions have been made for the example templates:

For more information about architecture administration, see the SAS Intelligence Architecture: Planning and Administration Guide.

Example Templates

The following sections contain information about the various types of example templates. The name of some files depend on the Content Name specified in the wizard. The name shown for these files is the name that results when the default value for the Content Name is accepted. How this name is derived is shown in parenthesis below the file name.

The project files shown below assume that Basic Servlet was selected as the servlet template during the wizard. If Build Frame Servlet is selected instead, there will be an additional file matching the servlet's Java file name, but with an ".fml" extension.

Information Map Viewer Servlet (uses SAS Visual Data Explorer) Template

This template is used to create an Information Map Viewer example which uses a servlet to access relational and OLAP data. The information map that is selected via a remote file selector will be viewed with the Visual Data Explorer component.

Default project files:

File Location Purpose
ExamplesSessionBindingListener.java <webappbase>/WEB-INF/classes/listeners An HttpSessionBindingListener class that cleans up resources when an HTTP session expires.
FoundationServicesContextListener.java <webappbase>/WEB-INF/classes/listeners The listener class that deploys local foundation services at application start-up time by reading the sas_metadata_source_omr.properties file.
InfoMapViewerExampleControllerServlet.java
(<Content Name>ControllerServlet.java)
<webappbase>/WEB-INF/classes/servlets The servlet that is used to setup control and business logic.
InfoMapViewerExampleViewer.jsp
(<Content Name>Viewer.jsp)
<webappbase> The JSP file that writes out the remote file selector.
java.webapp.policy root project directory The security policy file for use with this application. The value of the JVM system property, -Djava.security.policy, is set to the location of this file.
login.config root project directory The JAAS login configuration file. The value of the JVM system property, -Djava.security.auth.login.config, is set to the location of this file.
sas_metadata_source_omr.properties <webappbase>/WEB-INF/conf The properties file that defines metadata and local foundation service information.
web.xml <webappbase>/WEB-INF The XML file that contains metadata user information and application configuration information.

Note: The web.xml and sas_metadata_source_omr.properties files must be modified to use the appropriate passwords.

Information Map TableView Servlet Template

This template is used to create an Information Map TableView example which uses a servlet to access the relational data in a specified information map. The information map data will be displayed with a JSP using a TableViewComposite tag.

Default project files:

File Location Purpose
ExamplesSessionBindingListener.java <webappbase>/WEB-INF/classes/listeners An HttpSessionBindingListener class that cleans up resources when an HTTP session expires.
FoundationServicesContextListener.java <webappbase>/WEB-INF/classes/listeners The listener class that deploys local foundation services at application start-up time by reading the sas_metadata_source_omr.properties file.
InfoMapTableViewExampleControllerServlet.java
(<Content Name>ControllerServlet.java)
<webappbase>/WEB-INF/classes/servlets The servlet that is used to setup control and business logic.
InfoMapTableViewExampleViewer.jsp
(<Content Name>Viewer.jsp)
<webappbase> The JSP file that displays the relational information map.
java.webapp.policy root project directory The security policy file for use with this application. The value of the JVM system property, -Djava.security.policy, is set to the location of this file.
login.config root project directory The JAAS login configuration file. The value of the JVM system property, -Djava.security.auth.login.config, is set to the location of this file.
sas_metadata_source_omr.properties <webappbase>/WEB-INF/conf The properties file that defines metadata and local foundation service information.
web.xml <webappbase>/WEB-INF The XML file that contains metadata user information and application configuration information.

Note: The web.xml and sas_metadata_source_omr.properties files must be modified to use the appropriate passwords.

Information Map OLAPTableView Servlet Template

This template is used to create an Information Map OLAPTableView example which uses a servlet to access the OLAP data in a specified information map. The information map data will be displayed with a JSP using a OLAPTableViewComposite tag.

Default project files:

File Location Purpose
ExamplesSessionBindingListener.java <webappbase>/WEB-INF/classes/listeners An HttpSessionBindingListener class that cleans up resources when an HTTP session expires.
FoundationServicesContextListener.java <webappbase>/WEB-INF/classes/listeners The listener class that deploys local foundation services at application start-up time by reading the sas_metadata_source_omr.properties file.
InfoMapOLAPTableViewExampleControllerServlet.java
(<Content Name>ControllerServlet.java)
<webappbase>/WEB-INF/classes/servlets The servlet that is used to setup control and business logic.
InfoMapOLAPTableViewExampleViewer.jsp
(<Content Name>Viewer.jsp)
<webappbase> The JSP file that displays the OLAP information map.
java.webapp.policy root project directory The security policy file for use with this application. The value of the JVM system property, -Djava.security.policy, is set to the location of this file.
login.config root project directory The JAAS login configuration file. The value of the JVM system property, -Djava.security.auth.login.config, is set to the location of this file.
sas_metadata_source_omr.properties <webappbase>/WEB-INF/conf The properties file that defines metadata and local foundation service information.
web.xml <webappbase>/WEB-INF The XML file that contains metadata user information and application configuration information.

Note: The web.xml and sas_metadata_source_omr.properties files must be modified to use the appropriate passwords.

Information Map Default Servlet Template

This template is used to create a boiler-plate information map example. Code must be added to the controller servlet to create the information map's model adapter and tags added to the JSP to display the model.

Default project files:

File Location Purpose
ExamplesSessionBindingListener.java <webappbase>/WEB-INF/classes/listeners An HttpSessionBindingListener class that cleans up resources when an HTTP session expires.
FoundationServicesContextListener.java <webappbase>/WEB-INF/classes/listeners The listener class that deploys local foundation services at application start-up time by reading the sas_metadata_source_omr.properties file.
InfoMapDefaultExampleControllerServlet.java
(<Content Name>ControllerServlet.java)
<webappbase>/WEB-INF/classes/servlets The servlet that is used to setup control and business logic. Code must be added where the "//INSERT_MODEL_ADAPTER_CODE_HERE" comment is found.
InfoMapDefaultExampleViewer.jsp
(<Content Name>Viewer.jsp)
<webappbase> The JSP file that displays the information map. Tags to display the model must be added where the "<%-- Add tag(s) to display model here --%>" comment is found.
java.webapp.policy root project directory The security policy file for use with this application. The value of the JVM system property, -Djava.security.policy, is set to the location of this file.
login.config root project directory The JAAS login configuration file. The value of the JVM system property, -Djava.security.auth.login.config, is set to the location of this file.
sas_metadata_source_omr.properties <webappbase>/WEB-INF/conf The properties file that defines metadata and local foundation service information.
web.xml <webappbase>/WEB-INF The XML file that contains metadata user information and application configuration information.

Note: The web.xml and sas_metadata_source_omr.properties files must be modified to use the appropriate passwords.

Report Viewer Servlet (uses SAS Web Report Viewer) Template

This template is used to create a report viewer example, which uses a servlet to access relational and OLAP data. The report that is selected via a remote file selector will be viewed with the SAS Web Report Viewer application.

Note: For this example template, it is assumed that SAS Web Report Viewer has been installed on the development machine and is running on the same machine in the default Tomcat container, port 8080.

Default project files:

File Location Purpose
ExamplesSessionBindingListener.java <webappbase>/WEB-INF/classes/listeners An HttpSessionBindingListener class that cleans up resources when an HTTP session expires.
FoundationServicesContextListener.java <webappbase>/WEB-INF/classes/listeners The listener class that deploys local and remote foundation services at application startup time by reading the sas_metadata_source_omr.properties file.
java.webapp.policy root project directory The security policy file for use with this application. The value of the JVM system property, -Djava.security.policy, is set to the location of this file.
login.config root project directory The JAAS login configuration file. The value of the JVM system property, -Djava.security.auth.login.config, is set to the location of this file.
ReportViewerExampleControllerServlet.java
(<Content Name>ControllerServlet.java)
<webappbase>/WEB-INF/classes/servlets The servlet that is used to set-up control and business logic.
ReportViewerExampleViewer.jsp
(<Content Name>Viewer.jsp)
<webappbase> The JSP file that writes out the remote file selector.
sas_metadata_source_omr.properties <webappbase>/WEB-INF/conf The properties file that defines metadata and local foundation service information.
sas_remote_metadata_source_omr.properties <webappbase>/WEB-INF/conf The properties file that defines metadata and foundation service information (locale and remote).
web.xml <webappbase>/WEB-INF The XML file that contains metadata user information and application configuration information. It also contains the URL for forwarding to SAS Web Report Viewer.

Note: The web.xml, sas_metadata_source_omr.properties, and sas_remote_metadata_source_omr.properties files must be modified to use the appropriate passwords.

JDBC TableView Servlet Template

This template is used to create a JDBC TableView example based on the Model 2 (Model-View-Controller) Web Application Architecture.

Default project files:

File Location Purpose
ExamplesSessionBindingListener.java <webappbase>/WEB-INF/classes/listeners An HttpSessionBindingListener class that cleans up resources when an HTTP session expires.
FoundationServicesContextListener.java <webappbase>/WEB-INF/classes/listeners The listener class that destroys local foundation services at application shutdown time. This is needed to destroy default loggers created by SAS Foundation Services classes and Build Frame servlets.
java.webapp.policy root project directory The security policy file for use with this application. The value of the JVM system property, -Djava.security.policy, is set to the location of this file.
JDBCTableViewExampleControllerServlet.java
(<Content Name>ControllerServlet.java)
<webappbase>/WEB-INF/classes/servlets The servlet that is used to setup control and business logic. It also sets up JDBC connection information.
JDBCTableViewExampleViewer.jsp
(<Content Name>Viewer.jsp)
<webappbase> The JSP file that writes out the TableView using the JSP custom tags.
web.xml <webappbase>/WEB-INF The XMl file that contains application configuration information.

JDBC Default Servlet Template

This example template is used to create a JDBC boiler-plate example based on the Model 2 (Model-View-Controller) Web Application Architecture. Code must be added to the controller servlet to create the JDBC model adapter and tags added to the JSP to display the model.

Default project files:

File Location Purpose
ExamplesSessionBindingListener.java <webappbase>/WEB-INF/classes/listeners An HttpSessionBindingListener class that cleans up resources when an HTTP session expires.
FoundationServicesContextListener.java <webappbase>/WEB-INF/classes/listeners The listener class that destroys local foundation services at application shutdown time. This is needed to destroy default loggers created by SAS Foundation Services classes and Build Frame servlets.
java.webapp.policy root project directory The security policy file for use with this application. The value of the JVM system property, -Djava.security.policy, is set to the location of this file.
JDBCTableViewExampleControllerServlet.java
(<Content Name>ControllerServlet.java)
<webappbase>/WEB-INF/classes/servlets The servlet that is used to setup control and business logic. It also sets up JDBC connection information.
JDBCTableViewExampleViewer.jsp
(<Content Name>Viewer.jsp)
<webappbase> The JSP file that writes out the TableView using the JSP custom tags.
web.xml <webappbase>/WEB-INF The XMl file that contains application configuration information.

Model 2 Servlet Template

This example template is used to create a boilerplate example based on the Model 2 (Model-View-Controller) Web Application Architecture.

Default project files:

File Location Purpose
Model2ExampleControllerServlet.java
(<Content Name>ControllerServlet.java)
<webappbase>/WEB-INF/classes/servlets The servlet that is used to setup control and business logic.
Model2ExampleViewer.jsp
(<Content Name>Viewer.jsp)
<webappbase> The viewer JSP file.
web.xml <webappbase>/WEB-INF The XML file that contains application configuration information.

SAS Foundation Services

SAS Foundation Services includes tools to enable application development and service administration for the SAS Foundation Services (see the SAS Foundation Services section in the Integration Technologies Administrator's Guide for more general information on services). The Visual Data Explorer and Web Report Viewer Example Templates make use of various services and assume that they have been registered in the metadata server. Troubleshooting tips can be found on the services section of the Web Application Example Templates Troubleshooting page.

Foundation Services Assumptions

There is an assumption that the metadata information uses the default values from the install. The default values for the default metadata server port, the default logon domain, and the default metadata repository are 8561, DefaultAuth, and Foundation, respectively. To change these values follow these steps:

  1. Users will have to have the SAS Management Console installed with the Foundation Services Plugin installed as well.
  2. After launching the SAS Management Console, expand the Foundation Services Manager node in the tree.
  3. Expand the service deployment and deployment group you are using, such as ADS Local Services and BIP Core Services.
  4. Right click on the Information Service and select Properties.
  5. Select the Service Configuration Tab and select the Edit Configuration button.
  6. Select the Repositories tab and click Edit.
  7. Modify the values to match your environment.

Query and Reporting Services

By default, the "ADS Local Services" are used within AppDev Studio. However, you are able to use other pre-defined services after some modification. If using "Query and Reporting", make the following modifications:

  1. Modify the sas_metadata_source_omr.properties file in the Web application to refer to the 'software_component=Query and Reporting' and the 'deployment_group_1=BIP Core Services'.
  2. Users will have to have the SAS Management Console installed with the FoundationServicesPlugin installed as well.
  3. After launching the SAS Management Console, expand the Foundation Services Manager node in the tree. Then expand Query and Reporting and BIP Core Services.
  4. Right click Platform Information Service and select Properties.
  5. Select the Service Configuration tab and click the Edit Configuration button.
  6. Select the Factories tab. In the Protocol combo box, choose omi. In the Types list, select transformation and then select Edit.
  7. Two types need to be added to the list if they have not already been added. If the table does not have the following two entries, add them using the Add button:
    Type Class Filter
    Constructor com.sas.dataexplorer.OMRBookmarkEntry @TransformRole='Bookmark'
    Constructor com.sas.dataexplorer.OMRDataExplorationEntry @TransformRole='DataExploration'

ID Portal Local Services

By default, the "ADS Local Services" are used within AppDev Studio. However, you are able to use other pre-defined services after some modification. If using "ID Portal Local Services" make the following modifications:

  1. Modify the sas_metadata_source_omr.properties file in the Web application to refer to the 'software_component=ID Portal Local Services' and the 'deployment_group_1=BIP Local Services OMR'.
  2. Add the following JAR files from the SAS Information Delivery Portal install into your Visual Data Explorer webapp: dl.util.concurrent.jar and sas.portal.metadata.jar.

Web Application Deployment

To create a WAR file for easy deployment to other application servers, use the package wizard by selecting Tools [arrow] Wizards [arrow] Package Wizard from the webAF menu bar. A WAR file is created in the project directory and named after your Web application.

You can modify the application files for the default example template to run on another machine or backend:

The following default JVM arguments are added to the example templates that are used when you start Tomcat from inside of webAF software. When you deploy this application to another application server, these JVM arguments must be set when you start the server. Some of these arguments may not be required for certain templates, such as when certain servers are not being used. The specific arguments that are needed are available in webAF when you select File [arrow] Project Properties. They are listed under Startup in the text box labeled For this project, pass additional arguments to the Java interpreter.

JVM Argument List:

JVM property Value
-Djava.security.auth.login.config {path}/login.config
-Djava.security.manager Not set to anything. Tells JVM to run with Java security.
-Djava.security.policy {path}/java.webapp.policy
-Dsas.dav.host The machine name for DAV host name used by the java.webapp.policy file to grant socket permissions.
-Dsas.dav.port The DAV server port used by the java.webapp.policy file to grant socket permissions. The default port for Apache is 80.
-Dsas.olap.host The machine name for the OLAP server host name used by the java.webapp.policy file to grant socket permissions.
-Dsas.omr.host The machine name for the metadata server host name used by the java.webapp.policy file to grant socket permissions.
-Dsas.omr.port The metadata server port used by the java.webapp.policy file to grant socket permissions.
-Dsas.rmi.host The RMI server host name used by the java.webapp.policy file to grant socket permissions.
-Dsas.stp.host The stored process host name used by the java.webapp.policy file to grant socket permissions.
-Dsas.workspace.host The workspace server host name used by the java.webapp.policy file to grant socket permissions.
-Dwebapp.home The location of this Web application used by the java.webapp.policy file to grant socket permissions.

When deploying with a security manager, the Web application portion of the java.webapp.policy file should be appended to the Web server's policy file. If multiple Web applications are deployed there, it may be necessary to change the name of the webapp.home property file to something less generic and to make corresponding changes to the appended permissions. For more information about deployment, see the Deploying Web Applications paper.