My Mail Portlet

The My Mail portlet lets you configure an e-mail account that uses a POP3 or IMAP standard e-mail protocol. Once your e-mail account is configured, you can send, receive, store, and delete e-mail.

Concepts Demonstrated by this Sample

This Java Page Flow portlet illustrates group collaboration functionality within a portlet. The portlet provides edit mode.

Location of Sample Files

This sample is located in the <BEA_HOME>/<WEBLOGIC_HOME>/samples/portal/portalApp/portalApp.work application.

How to Run the Sample

See Viewing the Samples in Portal Samples.

How to Use the Sample in Your Portals

When this portlet is used in a domain (for example, in the portalApp in the Sample Portal Domain), the EJBs it uses are registered with JNDI names that can be used only once in the domain. That means you can use the following collaboration portlets in only one portal application in a domain: My Mail, My Task List, My Calendar, My Contacts, Discussion Forums, and Discussion Forum Administration. Within that portal application you can create multiple portal Web projects that can each contain multiple portals that reuse these portlets.

  1. Create a portal application in a domain that has not used the collaboration portlets.
  2. Make sure your portal application is open and the server is running (Tools-->WebLogic Server-->Start WebLogic Server).
  3. Import or copy, as appropriate, the following directories and files into your portal application and portal Web project using WebLogic Workshop.

    For example, to import the harmony_portlets.jar file into the Libraries area of Workshop, Select File > Import Library and then browse to the location of harmony_portlets.jar. When you click Open, Workshop saves the .jar file into the APP-INF/lib directory, and it appears in the “Libraries” folder on the Workshop tree. This makes the process of importing libraries easier because you don’t have to know how Workshop organizes the application directories.

    You may need to create the appropriate directories in your application.

    Be sure to add the harmony_portlets.jar library first, as shown in the following table.

    Import this into this WebLogic Workshop directory (create if necessary)
    <WEBLOGIC_HOME>/samples/portal/portalApp/APP-INF/lib/
    harmony_portlets.jar
    <PORTAL_APP>/Libraries/

    <WEBLOGIC_HOME>/samples/portal/portalApp/
    security_ejb.jar
    uniqueid_ejb.jar

    <PORTAL_APP>/Modules/
    <WEBLOGIC_HOME>/samples/portal/portalApp/
    sampleportal/portlets/includes/collaboration/
    native_mail.portlet
    <PORTAL_APP>/<project>/
    portlets/includes/collaboration/

    <WEBLOGIC_HOME>/samples/portal/portalApp/
    sampleportal/portlets/collaboration/nativedb/
    mail/

    <PORTAL_APP>/<project>/portlets/
    collaboration/nativedb/

    Note: If you add the non-JAR resources to directories other than those shown, you must open the portlet file in WebLogic Workshop and edit the Content URI for both the portlet's main content and Edit page content; you must modify the package path and <view-properties> paths in the Java Page Flow files; and you must modify the import statement to the ContentController and modify any other relevant paths in the JSPs.
  4. Add the collaboration tables to your database. If you have already performed this for another collaboration portlet, skip this step.

    Note: If you ran the create_* database script to set up your database, the collaboration tables already exist. Do not run create_* if, for example, you are using the default PointBase database and have already added records to the database. Follow these instructions instead.

    To add the collaboration tables to an existing database, run the following database script:

    <BEA_HOME>/<WEBLOGIC_HOME>/portal/db/<DB_TYPE>/<DB_VERSION>/collaboration_create_tables.sql

    for example

    bea/weblogic81/portal/db/pointbase/44/collaboration_create_tables.sql
  5. To run this script for PointBase:
    1. Start the PointBase Console. In a command window, run

      <DOMAIN>/startPointBaseConsole.cmd(.sh)
    2. Log into the console. The default login is weblogic/weblogic.
    3. Choose File-->Open.
    4. Open the collaboration_create_tables.sql script. The script opens in the Enter SQL Commands window.
    5. Click the Execute All button. The collaboration tables are created.
    6. Close the PointBase Console.
  6. Add entries to <PORTAL_APP>/<PROJECT>/WEB-INF/web.xml.
    1. Open <PORTAL_APP>/<PROJECT>/WEB-INF/web.xml.
    2. Open <BEA_HOME>/<WEBLOGIC_HOME>/samples/portal/portalApp/sampleportal/WEB-INF/web.xml.
    3. From the sampleportal web.xml file, copy the following sections into your project web.xml file in the appropriate locations:
      <!-- Compoze Collaboration Mail Attachment Servlet -->
      <servlet>
      <servlet-name>CompozeNativeMailFileAttachmentServlet</servlet-name>
      <servlet-class>com.compoze.mail.FileAttachmentServlet</servlet-class>
      </servlet>
      .
      .
      .
      <!-- Compoze Collaboration Mail Attachment Servlet Mapping -->
      <servlet-mapping>
      <servlet-name>CompozeNativeMailFileAttachmentServlet</servlet-name>
      <url-pattern>*.compozenativemailfileattachmentservlet</url-pattern>
      </servlet-mapping>
      .
      .
      .
      <ejb-ref>
      <description>Unique ID Generator</description>
      <ejb-ref-name>com.compoze.ejb.uniqueid.IUniqueIDGeneratorHome</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <home>com.compoze.ejb.uniqueid.IUniqueIDGeneratorHome</home>
      <remote>com.compoze.ejb.uniqueid.IUniqueIDGenerator</remote>
      <ejb-link>UniqueIDGenerator</ejb-link> </ejb-ref> <ejb-ref>
      <description>Access Control Manager</description>
      <ejb-ref-name>com.compoze.security.acl.IAccessControllerHome</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <home>com.compoze.security.acl.IAccessControllerHome</home>
      <remote>com.compoze.security.acl.IAccessController</remote>
      <ejb-link>AccessController</ejb-link> </ejb-ref>
    1. Save and close your project web.xml file.
  1. Perform the following steps only if you are using a database other than PointBase.
    1. Stop the server. Choose Tools-->WebLogic Server-->Stop WebLogic Server.
    2. Modify your domain's setDomainEnv.cmd(.sh) to use the correct database.

      In the entry set HARMONY_PORTLETS_PROPERTIES=-Dejbruntime.database=pointbase44, use the commented area above this entry to replace the pointbase44 entry with the name of your database driver. Possible values are listed above that entry.
    3. Save setDomainEnv.cmd(.sh).
    4. Restart the server.
  1. Add the Login to Portal Portlet to your portal Web project. Users must log in to use the collaboration portlets.
  2. Open your portal file and navigate the page where you want the portlet to appear.
  3. In the Data Palette window, drag the My Mail portlet onto the portal page.
  4. In the Property Editor window, set any relevant properties.
  5. Save the portal file.
  6. View your portal with the WebLogic Test Browser or with your default browser.
    • WebLogic Test Browser - In the WebLogic Workshop toolbar, click the Start button (or press Ctrl+F5).
    • Default Browser - In the WebLogic Workshop menu, choose Portal-->Open Current Portal.

For instructions on using the portlet's features, see Compoze Portlets for BEA WebLogic Portal User's Guide at http://e-docs.bea.com/wlp/docs81/pdf/compoze_portlets_users_guide.pdf.

Related Topics

Creating a Portal File

Portal Samples

Guide to Building Page Flows