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
Editor
|
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] ^
- auditor\src\java\com\atlassian\confluence\extra\auditer\AuditListener.java
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

