What is the Hello Portlet?

Viewpoint
Teradata Viewpoint is Teradata's strategic and innovative SOV (single operational view) for Teradata DB, Aster, and HDP Hadoop systems management and monitoring that enables Teradata's Unified Data Architecture (UDA).
Teradata Employee

What is the Hello Portlet?

The Hello portlet demonstrates the simplest functional portlet that you can build. It has a simple, one-page design. When you add this portlet to your page, it prints the text "Hello, " followed by your portal username.

This portlet also demonstrates a very simple use of portlet preferences. Users of this portlet can personalize the portlet to use their preferred name instead of their portal login username. The user's preferred name is saved in the database using the portlet preferences API.

When finished, the portlet "summary" page looks like this:

The portlet "preferences" page looks like this:

Generating a New Portlet Project

This section describes how to use the Portlet Generator to create the base portlet project on which you can build your portlet. We'll step through the process that was used to create the sample Hello portlet.

Step 1: Generate a New Project

Open a command prompt and navigate to the PDK folder containing portletgenerator.jar. To generate a portlet, run the portlet generator like this:

java -jar portletgenerator.jar

NOTE: Make sure you are running the above command from the same directory as the jar file; otherwise, the process will fail at a later step when generating the project

The portlet generator asks several questions and then creates all of the project files.

Here is an example of how to run the generator to create a project named Hello.

NOTE: Be sure the name of the project contains no spaces and uses capitalized words. If spaces are present, then the build command ant deploy will fail and a list of errors will appear.

> java -jar portletgenerator.jar
Please enter the project name.
The name should contain no spaces and use capitalized words.
For example: MyLoadJobs, WeeklyReports, TopResourceUsers

Project name [Sample]: Hello

Please enter the package name prefix.
This will be the root part of all generated package names.

Package name prefix [com.teradata.portlets.hello]: <RETURN>

In what directory do you want to generate the files?

Directory [.]: /Hello

Creating /Hello\
Creating /Hello\.buildConfig/
Creating /Hello\.buildConfig/buildfiles/
Creating /Hello\.buildConfig/dist/
Creating /Hello\.buildConfig/lib/
Creating /Hello\.buildConfig/properties/
... many more files created ...
Creating /Hello\web/WEB-INF/portlet-jsp/include.jsp
Creating /Hello\web/WEB-INF/portlet-jsp/preferences.jsp
Creating /Hello\web/WEB-INF/portlet-jsp/summary.jsp
Creating /Hello\web/WEB-INF/portlet.xml
Creating /Hello\web/WEB-INF/tdportlet.xml
Creating /Hello\web/WEB-INF/web.xml
Creating /Hello\web/css/hello.css
Done

NOTE: Pay close attention to the directory you specify so you will be able to locate the generated files.  If you press Enter without specifying the directory name, the source contents of the Hello portlet are placed directly into the dist directory. The dist directory is erased and rebuilt each time you build the portlet generator.

 

Step 2: Test the Generated Portlet

The portlet that is generated contains all of the files required for deployment to the Teradata Viewpoint portal. Let's go ahead and do that now to verify that the portlet was generated correctly. If you haven't already done so, you need to install a local development version of the portal. Before you can deploy the portlet, you need to configure the location of the development portal. You can do this by setting the environment variable CATALINA_HOME to the directory where the Teradata Viewpoint Portal is installed.

If you go to the URL http://localhost:8080/ in your browser, the portal should come up. This portal comes with another version of this Hello portlet automatically deployed when it is brought up. It is slightly different than the portlet you are about to deploy even though the names are the same. The existing portlet has the message "Hello, admin!" in its content area. If you would like to verify this, go ahead and open an instance of it from the Sample menu (Add Content->Sample->Hello).

Now you are ready to deploy your portlet. To do this, change to the Hello directory and type:

ant deploy

This will build your portlet and deploy it to the Teradata Viewpoint Portal.

Now open your new Hello portlet from the Sample menu. If you add this portlet, your page should look like this:

Note: The content area for your portlet is [summary page].

Tags (2)
1 REPLY

Re: What is the Hello Portlet?

Are there any other steps or files to edit before using "ant deploy"? After I create the "Hello" directory using portletgenerator i try using "ant deploy" in the directory and I get nothing. The output from "ant deploy" shows the project info, basedir, etc. then says "deploy: BUILD SUCCESSFUL Total Time: 3 Seconds". However, I dont see the portal deployed to the Viewpoint Portal. Any ideas?