You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2006/12/12 13:31:55 UTC

svn commit: r486111 - in /lenya/docu/src/documentation/content/xdocs: docs/1_4/reference/notification.xml docs/modules/notification.xml site.xml

Author: andreas
Date: Tue Dec 12 04:31:54 2006
New Revision: 486111

URL: http://svn.apache.org/viewvc?view=rev&rev=486111
Log:
Updated notification docs

Added:
    lenya/docu/src/documentation/content/xdocs/docs/modules/notification.xml
Removed:
    lenya/docu/src/documentation/content/xdocs/docs/1_4/reference/notification.xml
Modified:
    lenya/docu/src/documentation/content/xdocs/site.xml

Added: lenya/docu/src/documentation/content/xdocs/docs/modules/notification.xml
URL: http://svn.apache.org/viewvc/lenya/docu/src/documentation/content/xdocs/docs/modules/notification.xml?view=auto&rev=486111
==============================================================================
--- lenya/docu/src/documentation/content/xdocs/docs/modules/notification.xml (added)
+++ lenya/docu/src/documentation/content/xdocs/docs/modules/notification.xml Tue Dec 12 04:31:54 2006
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+<document>
+  <header>
+    <title>Notification</title>
+  </header>
+  <body>
+    
+  <section>
+    <title>Setup</title>
+    
+    <ul>
+      <li>
+        To enable notification by e-mail, you have to download the JavaMail and JavaBeans Activation
+        Framework libraries from the <a href="http://java.sun.com/products/javamail/">JavaMail website</a>
+        and place them in the <code>&lt;lenya-webapp&gt;/WEB-INF/lib</code> directory.
+      </li>
+      <li>
+        Edit <code>cocoon.xconf</code>, look for the component with the class
+        <code>org.apache.lenya.notification.EmailNotifier</code> and update the
+        attributes of the <code><![CDATA[<smtp>]]></code> element with the
+        settings of your SMTP host.
+        The user and password attributes are optional.
+        <source xml:space="preserve"><![CDATA[<component logger="lenya.notification"
+    role="org.apache.lenya.notification.Notifier"
+    class="org.apache.lenya.notification.EmailNotifier">
+  <smtp host="localhost" username="john" password="swordfish" />
+</component>]]></source>
+      </li>
+      <li>
+        If you test the functionality with the default users lenya and alice,
+        don't forget to configure their e-mail addresses.
+      </li>
+      <li>
+        To check if the notification works, go to your
+        <a href="http://localhost:8888/default/authoring/index.html?lenya.usecase=notification.inbox">Inbox</a>
+        and send a message.
+      </li>
+    </ul>
+    
+  </section>
+    
+<section>
+  <title>How to Send Notification Messages</title>
+  
+  <p>
+    There are two ways to send notification messages - either immediately, or by attaching
+    a notification event to the current session. In the latter case, the notification is
+    sent only if the transaction has been successfully completed.
+  </p>
+  
+  <p>To send notification messages, use the <code>Notifier</code> component which is provided by the
+  <code>notification</code> module. A shortcut to the <code>Notifier</code> functionality
+  is offered by the <code>NotificationUtil</code> utility class. Here's an example how to
+  send a notification message immediately:</p>
+  
+<source xml:space="preserve"><![CDATA[
+protected void notify(User sender, User recipient, document) {
+
+    Identifiable[] recipients = { recipient };
+    
+    // compose message, using parameters for i18n
+    
+    String subject = "publish-notification";
+    String[] subjectParams = {};
+    
+    String body = "document-was-published"
+    String[] bodyParams = { document.getId() };
+    Message message = new Message(subject, subjectParams, body, bodyParams,
+                                  sender, recipients);
+    
+    // send message
+    
+    NotificationUtil.notify(this.manager, message);
+}
+]]></source>
+
+  <p>
+    The following example shows how to attach a notification event to the session,
+    for instance inside a usecase handler:
+  </p>
+  
+  <source xml:space="preserve"><![CDATA[
+    NotificationEventDescriptor descriptor = new NotificationEventDescriptor(message);
+    RepositoryEvent event = RepositoryEventFactory
+        .createEvent(this.manager, authoringDocument, getLogger(), descriptor);
+    getSession().enqueueEvent(event);
+]]></source>
+
+  <p>
+    The message is sent to each particular recipient, translated using the recipient's locale.
+  </p>
+  
+  <p>
+    The default implementation, <code>EmailNotifier</code>, sends an email to each recipient
+    and adds the message to their inboxes.
+    Future implementations could include a message list which is managed by the CMS and is
+    presented to a user after she logs in.
+  </p>
+
+</section>
+
+  </body>
+</document>

Modified: lenya/docu/src/documentation/content/xdocs/site.xml
URL: http://svn.apache.org/viewvc/lenya/docu/src/documentation/content/xdocs/site.xml?view=diff&rev=486111&r1=486110&r2=486111
==============================================================================
--- lenya/docu/src/documentation/content/xdocs/site.xml (original)
+++ lenya/docu/src/documentation/content/xdocs/site.xml Tue Dec 12 04:31:54 2006
@@ -154,7 +154,6 @@
         <siteprotocol href="site.html" label="site:"/>
       </protocols>
       <link-management href="link-management.html" label="Link Management"/>
-      <notification href="notification.html" label="Notification"/>
       <repository href="repository/index.html" label="Repository"/>
     </reference>
     
@@ -204,6 +203,7 @@
       <monitoring href="monitoring.html" label="Monitoring"/>
       <server href="webdav.html" label="WebDAV Servers"/>
     </webdav>
+    <notification href="notification.html" label="Notification"/>
   </modules>
   <!--+
     | Version 1.2 tab



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org