Added by Garnet R. Chaney, last edited by Garnet R. Chaney on May 01, 2007  (view change)

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.

Copy plugins\amazon to plugins\amazonmy

Edit amazonmy\src\etc\atlassian-plugin.xml

  • change key to confluence.extra.amazonmy
  • For <macro> change name to asinmy, and key to asinmy, class extra.amazon to extra.amazonmy

rename plugins\amazonmy\src\etc\templates\extra\amazon to amazonmy

rename plugins\amazonmy\src\java\com\atlassian\confluence\extra\amazon to amnazonmy

In *.java change package name from .amazon to .amazonmy

Look for path to velocity macro and change amazon to amazonmy

The confluence logs are here:
C:\Program Files\Apache Software Foundation\Tomcat 5.5\logs

My Environment Setup

Building

  • Go to C:\projects\confluence-2.4.5.earwar\plugins
  • ..\tools\ant\bin\ant -Dlibrary=amazonmy build

Web pages to open

File Explorers To Open

  • C:\projects\confluence-2.4.5.earwar\confluence\WEB-INF\lib
  • Directory of C:\projects\confluence-2.4.5.earwar\plugins\amazonmy\dist

Editor

  • c:\tsepro\g32 amazonmy\src\java\com\atlassian\confluence\extra\amazonmy\AmazonAsinMacro.java

Basic functionality working:

  • Display Amazon book info, plus log to a second page "Asinmy Called" each rendering of the macro.

  • Add an event listener, and mark the occurrence of the macro on the page when the page is edited. Look at [Confluence Example Plugin - Auditer]
    • auditor\src\java\com\atlassian\confluence\extra\auditer\AuditListener.java
      NOTE: Can not add this to the AmazonAsinMacro - Must add to a new file: AmazonListener.java

      Add these imports:
      import com.atlassian.event.Event;
      import com.atlassian.event.EventListener;

      public class AmazonListener implements EventListener
      {

      }

      First error encountered

          [javac] C:\projects\confluence-2.4.5.earwar\plugins\amazonmy\src\java\com\at
      lassian\confluence\extra\amazonmy\AmazonListener.java:42: com.atlassian.confluen
      ce.extra.amazonmy.AmazonListener is not abstract and does not override abstract
      method getHandledEventClasses() in com.atlassian.event.EventListener
          [javac] public class AmazonListener implements EventListener
          [javac]        ^
      

001_AmazonListener.java attached.


Now find a more complicated example of an event listener. Specifically want to get page creation or page edit events.

Try plugins\workflow\src\java\com\atlassian\confluence\extra\workflow\WorkflowListener.java

  • Implements a single WorkflowEvent.class listener, which is an extension to a ConfluenceEvent

Try PageEditListener.java:

Add the listener defintion from atlassian-plugin.xml:

    <listener name='Page Event Listener' 
     class='com.atlassian.confluence.extra.amazonmy.AmazonListener' key='pagelistener'>
        <description>Converts edit/view events on pages into workflow events.</description>
    </listener>

002_AmazonListener.java - Logs a line to "Asinmy Called" everytime a page is edited.


Factor functionality To do:

  • Next: Regexp for factor macro, and modify text of editted page

Amazon linkin functionality To do:

  • Storing per space developer key, or per space affiliate id, configurable within space administration. - unknown
  • Could also be from a list on an admin only page. - Easy, known
Profit from Penny Stocks. Learn from a millionaire who shares everything! Learn from Timothy Sykes.