Previous Page | Next Page

Sample Portlets

Creating Portlets Using the Testportlet Scripting Facility

The examples in this chapter use the portlet development scripting facility provided with the SAS Information Delivery Portal. The files for this facility can be found in the SAS-configuration-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 9.2 Versioned JAR Repository.

The following steps provide an overview of creating a portlet using the scripting facility. The instructions for creating the sample portlets in this chapter include detailed examples of using the scripting facility.

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.  [cautionend]

  1. Create a configuration directory for the portlet under the SAS-configuration-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 match the name of the portlet that is specified in the name attribute of the <local-portlet> or <remote-portlet> element in the portlet deployment descriptor (portlet.xml) file.

    • The portlet name must be unique.

  2. Copy the contents of the testportlet directory to the new portlet configuration directory.

  3. Create a source directory for the code associated with the portlet. This directory is referred to in subsequent instructions as the portlet source 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.

  5. Run the configuration script, cfg, to create the source directory structure for building the portlet.

    Note:   After running the script, review the customconfig.log file for errors. This file will be located in the directory where the script was run.  [cautionend]

    For local portlets, the following source directory structure is created:

    portlet-source-directory/Configurable/pars/archive-name
    portlet-source-directory/Picklists/pars/archive-name
    portlet-source-directory/Static/lib
    portlet-source-directory/Static/pars/archive-name/context-root/content
    portlet-source-directory/Static/pars/archive-name/context-root/source
    portlet-source-directory/Static/pars/archive-name/context-root/classes

    For remote portlets, the following source directory structure is created:

    portlet-source-directory/Configurable/ears/archive-name/META-INF
    portlet-source-directory/Configurable/pars/archive-name
    portlet-source-directory/Configurable/wars/archive-name/WEB-INF
    portlet-source-directory/Picklists/wars/archive-name
    portlet-source-directory/Static/lib
    portlet-source-directory/Static/ears/archive-name/META-INF
    portlet-source-directory/Static/pars/archive-name/context-root/classes
    portlet-source-directory/Static/wars/archive-name/jsp
    portlet-source-directory/Static/wars/archive-name/source
    portlet-source-directory/Static/wars/archive-name/WEB-INF/classes
    portlet-source-directory/Static/wars/archive-name/WEB-INF/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. Load source files for portlet components into the source directory structure.

  7. Create a 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 repeat the building and deploying of PAR and EAR files for custom portlets.  [cautionend]

  8. Add other JAR files to the project.

  9. Run the configuration script to compile Java classes.

    Note:   After running the script, review the customconfig.log file for errors. This file is located in the directory where the script was run.  [cautionend]

  10. Stop the application server on which the SAS Information Delivery Portal is deployed so that development of the new portlet will not affect the running system.

  11. Run the configuration script to build the appropriate archive files for the portlet. This step will create a PAR file in the SAS Information Delivery Portal's Exploded and Deployed portlet directories. For remote portlets, it will also create the remote portlet Web application.

    Note:   After running the script, review the customconfig.log file for errors. This file is located in the directory where the script was run.  [cautionend]

  12. For remote portlets only: Run the configuration script to deploy the Web application EAR file to the Web application server.

    Note:   After running the script, review the customconfig.log file for errors. This file is located in the directory where the script was run.  [cautionend]

  13. Rebuild the sas.portal4.2.ear file using the SAS Deployment Manager and redeploy the EAR file.

    Note:   If your SAS installation uses restrictive policy files, you might need to update the files to provide appropriate permissions for the portlet.  [cautionend]

  14. Start the application server where the SAS Information Delivery Portal is deployed. The custom portlet should now be available to the portal.

Note:   In order to use the scripting facility, you must have the unrestricted user password for your SAS installation.  [cautionend]

Previous Page | Next Page | Top of Page