Configuration of two XML files in your portlet's WEB-INF folder is required to integrate your portlet with VISA. The first file is the familiar web.xml where listener and filter classes are configured. The second file, also in WEB-INF, must be named viewpoint-portlet.xml, and contains the declaration of your portlet's security domain, in addition to other Viewpoint-specific portlet metadata.

web.xml

The following XML stanza must be configured in the appropriate location in WEB-INF/web.xml:

<listener>
    <listener-class>com.teradata.viewpoint.security.config.ConfigLoaderContextListener</listener-class>
</listener

The ConfigLoaderContextListener class is invoked on startup of the portlet webapp, and simply triggers the loading of the viewpoint-portlet.xml file.

<filter>
    <filter-name>SecurityFilter</filter-name>
    <filter-class>com.teradata.viewpoint.security.web.SecurityFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>SecurityFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

The SecurityFilter class is a key component of the VISA implementation, and must be present in all portlet web.xml files.

viewpoint-portlet.xml

Let's take a look at a relatively simple configuration, from the Calendar portlet.

<?xml version="1.0" encoding="UTF-8"?>
<viewpoint-config>

  <portlet id="Calendar" label="Calendar">
    <version>1.0.0</version>
    <category>Tools</category>
    <web-context>/CalendarPortlet</web-context>
    <config-url />
    <help-url>/CalendarPortlet/help/Calendar/toc.html</help-url>
    <supported-locale>ja</supported-locale>
    <resource-bundle>calendar-portlet</resource-bundle> 

    <domain id="Calendar">
      <permission scope="domain" name="CREATE_EVENT" />
      <permission scope="domain" name="EDIT_ANY_EVENT" />
      <permission scope="domain" name="EDIT_OWN_EVENT"  />
    </domain>
  </portlet>

</viewpoint-config>

Let's look at the each of the XML elements in turn:

Element Description Attributes
viewpoint-config Root element.  
portlet one element must be present for each portlet in the webapp. id: uniquely identify the portlet.
label: the display name for the portlet.
version the version of this portlet  
category the category of this portlet; defines where the portlet appears in hierarchical lists and menus, such as the Add Content menu  
web-context the path at which the webapp containing this portlet is deployed into the servlet container  
config-url the URL of the portlet's configuration screen, if the portlet provides one  
help-url the URL of the portlet's online help  
supported-locale List of languages that this portlet supports   
resource-bundle The name of the properties resource bundle that contains localized strings for portlet title, category and permissions  
domain each portlet stanza must include a domain element with the same idvalue as the portlet element; optionally one or more additional domains may also be declared id: must be unique for the Viewpoint installation
permission one element must be present for each permission in the domain scope: one of domain or resource
name: must be unique for this domain
description: optional informative text
dependency indicates that this domain has a dependency on another domain depends-on-domain: the domain on which this domain has a dependency
depends-on-permission: the permission in the other domain on which this domain depends

Now let's take a look at a slightly more complicated example, this time from the System Health portlet.

<?xml version="1.0" encoding="UTF-8"?>
<viewpoint-config>
  <portlet id="SystemHealth" label="System Health">

    <version>1.0.0</version>
    <category>Monitoring</category>
    <config-url>/SystemHealthPortlet/dataserver/configuration</config-url>
    <help-url>/SystemHealthPortlet/help/SystemHealth/toc.html</help-url>
    <supported-locale>ja</supported-locale>
    <resource-bundle>systemhealth-portlet</resource-bundle> 

    <domain id="SystemHealth">
      <dependency depends-on-domain="com.teradata.viewpoint.globaldataentity.TeradataSystem" depends-on-permission="ACCESS_GLOBAL_ENTITY" />

      <!-- resource permissions -->
      <permission scope="domain" name="SET_PREFS" description="If granted, the user can access the preferencess view" />
      <permission scope="domain" name="SHARE_PORTLET" description="If granted, the user can share the portlet" />
      <permission scope="resource" name="VIEW_SUMMARY" description="If granted, the user can view the summary info for a particular system" />
      <permission scope="resource" name="VIEW_DETAIL" description="If granted, the user can view the detail info (drill down) for a particular system" />
    </domain>
  </portlet>
</viewpoint-config>