Using the Testportlet Scripting Facility

Overview of the Testportlet Scripting Facility

The Testportlet Scripting Facility is a scripting tool that enables you to initialize your portlet development directories and to compile your portlet source into an EAR file. The files for this facility can be found in the SAS-config-directory\Lev1\CustomAppData\testportlet directory. The scripting facility should be used for portlet development because it provides a process that integrates your custom portlets with the SAS versioned JAR repository.
Note: Before you begin developing a custom portlet, ensure that the SAS Metadata Server is running so that metadata can be accessed during the configuration and deployment processes.

Creating a Portlet by Using the Testportlet Scripting Facility

The following steps provide an overview of creating a portlet using the scripting facility. For a detailed example of creating a portlet, see Sample Portlet: HelloUserJSR168PortletSample.
  1. Create a source directory for the code associated with the portlet. This directory is referred to in subsequent instructions as the portlet source directory.
  2. Create a configuration directory for the portlet under the SAS-config-directory\Lev1\CustomAppData\ directory. Use the portlet name for the configuration directory name.
    The following rules apply to the portlet name and configuration directory structure:
    • Neither portlet names nor their paths can contain spaces.
    • The portlet name must be unique.
  3. Copy the files from SAS-config-directory/Levn/CustomAppData/testportlet to the new directory.
  4. Edit the custom.properties file in the portlet configuration directory to specify the portlet name and title and the locations for the configuration and source files.
    Note: You must use forward slashes (/) in your directory values. For example, C:/SAS/EBI/Lev1/CustomAppData/SampleHelloUserJSR168Portlet.
  5. Enter the following command to create the directory structure for your portlet:
    cfg createJSR168PortletDirectories 
        -Dmetadata.connection.passwd="unrestricted-user-password"
    where unrestricted-user-password is the password for the unrestricted user.
    Note: You can submit a password as clear text or as an encoded string from the PWENCODE procedure. For more information, see Encryption in SAS 9.2.
    Check the customconfig.log file in SAS-config-directory/Levn/CustomAppData/SampleHelloUserJSR168Portlet to ensure that the script completed successfully.
    The following directory structure is created:
    source-directory
       Configurable
          ears
             archive-name
                META-INF
          wars
             archive-name
                WEB-INF
       Picklists
          wars
             archive-name
       Static
          ears
             archive-name
                META-INF
          lib
          wars
             archive-name
                jsp
                source
                WEB-INF
                   classes
                   spring-config
            
    The \Configurable and \Static directory hierarchies are used to store the files needed to create PAR, EAR, and WAR files for the portlet, in the same directory structure as the PAR, EAR, and WAR files themselves. The \Configurable hierarchy is used for files in which values are substituted from the portlet configuration file when the portlet is built. The \Static hierarchy is used for files that do not require substitution. The \Picklists directory hierarchy is used to store picklist files that specify which of the JAR files from the SAS versioned JAR repository need to be included in the portlet. The \Static\lib directory is used to store additional JAR files needed at compile time.
  6. Create source files for your portlet in the source directory structure.
  7. Copy the BI Portlets picklist file to tell the portlet which of the JAR files from the SAS versioned JAR repository need to be included in the portlet.
    Note: After a SAS maintenance release is applied at your site, you must copy the updated picklist and rebuild and redeploy the PAR and EAR files for custom portlets.
  8. Add any additional JAR files to the \Static\Lib directory.
  9. Enter the following command to compile the portlet:
    cfg compileJSR168Portlet -Dmetadata.connection.passwd="unrestricted-user-password"
    where unrestricted-user-password is the password for the unrestricted user.
    Note: You can submit a password as clear text or as an encoded string from the PWENCODE procedure. For more information, see Encryption in SAS 9.2.
    Check the customconfig.log file to ensure that the script completed successfully.
  10. Enter the following command to build the EAR file:
    cfg buildJSR168Webapps -Dmetadata.connection.passwd="unrestricted-user-password"
    where unrestricted-user-password is the password for the unrestricted user.
    Note: You can submit a password as clear text or as an encoded string from the PWENCODE procedure. For more information, see Encryption in SAS 9.2.
    Check the customconfig.log file to ensure that the script completed successfully.
  11. Use the Portlet Deployment Tool to deploy the portlet EAR file into the BI Portlets Web application.
  12. Stop the Web application server on which the SAS Information Delivery Portal and the BI Portlets Web application are running.
  13. Rebuild the SAS Information Delivery Portal and BI Portlets Web applications by using the SAS Deployment Manager. For more information, see "Rebuilding the SAS Web Applications" in the "Middle-Tier Administration" chapter of the SAS Intelligence Platform: Web Application Administration Guide.
  14. Redeploy the EAR files for the SAS Information Delivery Portal and the BI Portlets Web application.
    The EAR files are located at SAS-config-directory/Levn/Web/Staging/.
    For instructions about redeploying Web applications, see "Redeploying Web Applications" in the "Middle-Tier Administration" chapter of the SAS Intelligence Platform: Web Application Administration Guide.
  15. Start the Web application server on which the SAS Information Delivery Portal is deployed. The custom portlet should now be available to the portal.