New topics: Your Pet, IOU, Baby IQ, The Poisons, Birther II, Games, Future Power

Trying out the documentation theme?

Skip to end of metadata
Go to start of metadata

Preliminaries

See Confluence Development Environment Setup for what was done before this.

Amazon Plugin

  • Confluence Example Plugin - Amazon Web Services Plugin
    The Amazon plugin demonstrates:
    • How to get results from a web service
    • How to parse an XML response
    • How to pretty print an XML response into HTML
    • How to create a product object with fields accessible from Velocity
    • How to make that product object available to render the macro results to HTML using a Velocity Macro
  • [Confluence Example Plugin - Attachments]
    • Extends baseMacro
    • Uses attachmentManager, permissionManager
    • Shows getting parameters (sortBy) from ServletActionContext.getRequst
    • Shows setting a reference to this in the contextMap so that the Velocity template can call back into the macro.
    • Has two velocity macros:
      • attachmentsmacro.vm is fairly complex with javascript and velocity loops.
      • attachmentsmacro-help.vm - probably supplies help system documentation
  • [Confluence Example Plugin - Auditer]
    • Implements an EventListener
    • Sets up a logger
    • Accesses properties via getProperties audit.log4j.properties
    • Listens to every event because it returns an empty array for getHandledEventClasses
    • Very little code, does not do anything with the event other than pass the to log.info
  • [Confluence Example Plugin - Calendar]
  • [Confluence Example Plugin - Chart]
  • [Confluence Example Plugin - Dynamictasklist]
    **
  • [Confluence Example Plugin - favourites-pagelist]
    • Uses web-item plugin in atlassian-plugin.xml to add to system.spaces.pages
  • [Confluence Example Plugin - functestrpc]
    • Includes 5 java files:
      • FuncTestEventQueue
        • Keeps list of 9 events
      • FuncTestRpcDelegator
        • Implements FuncTestRpcHandler
        • massCreateAttachments
        • Calls the FuncTestRpcHandlerImpl for each entry point
      • FuncTestRpcHandler
        • Gives some documentation on the function of each entry point
      • FuncTestRpcHandlerImpl - Largest
        • Contains a wide variety of Managers and Accessors for the system:
          private ConfluenceIndexManager indexManager;
          private SpaceManager spaceManager;
          private PermissionManager permissionManager;
          private UserAccessor userAccessor;
          private AttachmentManager attachmentManager;
          private PageManager pageManager;
          private ThemeManager themeManager;
          private CaptchaManager captchaManager;
          private FuncTestEventQueue funcTestEventQueue;
          private Scheduler scheduler;
          private BandanaManager bandanaManager;
          private BucketHibernateConfigProvider configProvider;
          private ContentPropertyManager contentPropertyManager;
          private ContentEntityManager contentEntityManager;
          private PersonalInformationManager personalInformationManager;
          private CacheManager cacheManager;
        • Shows how to remove all spaces, groups, remove personal spaces, remove all users
        • flushing the index queue
        • Add attachments and then save strings to them with StringInputStream
        • Reset global theme
        • Note all the set*Manager routines at the end.
      • QueueEventListener - Small
        • Implements EventListener
        • Sets this.funcTestEventQueue
        • Listens to all events
        • Similar to [Confluence Example Plugin - Auditer]
  • [Confluence Example Plugin - graphviz]
  • [Confluence Example Plugin - helloworldrpc]
    **
  • [Confluence Example Plugin - helloworldservlet]
    **
  • [Confluence Example Plugin - impresence]
    **
  • [Confluence Example Plugin - information]
    **
  • [Confluence Example Plugin - jira3]
    **
  • [Confluence Example Plugin - layout]
    **
  • [Confluence Example Plugin - livesearch]
    **
  • [Confluence Example Plugin - masterdetail]
    **
  • Confluence Example Plugin - randompage
    • This plugin demonstrates:
      • Making an httpservlet
      • How to create a SessionFactory and connect with the database
      • run a SQL query to retrieve page IDs
      • Logs information about it's operation
  • [Confluence Example Plugin - script]
    **
  • [Confluence Example Plugin - tasklist]
    **
  • [Confluence Example Plugin - userinfo]
    **
  • [Confluence Example Plugin - userlister]
    • Uses web-item plugin in atlassian-plugin.xml to add to system.profile.edit/yourprofile
      **
  • [Confluence Example Plugin - workflow]
    **

Functionality Survey

Grep can be used to survey the plugins to find sources that implement certain functionality

EventListeners

Go to the plugins directory
grep -i -d Listener *.java

C:\projects\confluence-2.4.5.earwar\plugins>grep -d -i Listener *.java
SemWare Grep v2.0 for Win95/98/NT [BETA 1999-5-11 11:58]
Copyright 1996-1999 SemWare Corp. All rights reserved worldwide.

File: C:\projects\confluence-2.4.5.earwar\plugins\amazonmy\src\java\com\atlassian
   \confluence\extra\amazonmy\AmazonListener.java
import com.atlassian.event.EventListener;
public class AmazonListener implements EventListener
    private static Logger log = Logger.getLogger(AmazonListener.class);
    private void initializeAmazonListener()
           initializeAmazonListener();
     * @return an array of Classes of events handled by this listener

File: C:\projects\confluence-2.4.5.earwar\plugins\auditer\src\java\com\atlassian
   \confluence\extra\auditer\AuditListener.java
import com.atlassian.event.EventListener;
public class AuditListener implements EventListener
    private static Logger log = Logger.getLogger(AuditListener.class);
     * @return an array of Classes of events handled by this listener

File: C:\projects\confluence-2.4.5.earwar\plugins\auditer\src\test\com\atlassian
   \confluence\extra\auditer\TestAuditListener.java
public class TestAuditListener extends ConfluenceTestCase
    AuditListener auditListener;
        auditListener = new AuditListener();
        Class[] handledClasses = auditListener.getHandledEventClasses();

File: C:\projects\confluence-2.4.5.earwar\plugins\confluencerpc\src\test\java
   \com\atlassian\confluence\rpc\NoOpEventManager.java
    
public void registerListener(String listenerKey, com.atlassian.event.
                             EventListener listener) { }
    public void unregisterListener(String listenerKey) { }

File: C:\projects\confluence-2.4.5.earwar\plugins\functestrpc\src\java\com
   \atlassian\confluence\test\rpc\QueueEventListener.java
import com.atlassian.event.EventListener;
public class QueueEventListener implements EventListener
    private static Category log = Category.getInstance(QueueEventListener.class);
            log.debug("QueueEventListener.handleEvent: " + event);

File: C:\projects\confluence-2.4.5.earwar\plugins\userlister\src\java\com
   \atlassian\confluence\extra\userlister\UserListener.java
import com.atlassian.event.EventListener;
public class UserListener implements EventListener

File: C:\projects\confluence-2.4.5.earwar\plugins\userlister\src\test\java\com
   \atlassian\confluence\extra\userlister\TestUserListener.java
public class TestUserListener extends ConfluenceTestCase
    UserListener userListener;
        userListener = new UserListener();
        assertEquals("handled classes of UserListener have different length", 
        expectedHandledClasses.length, userListener.getHandledEventClasses().length);
            Class[] actualHandledClasses = userListener.getHandledEventClasses();

File: C:\projects\confluence-2.4.5.earwar\plugins\workflow\src\java\com
   \atlassian\confluence\extra\workflow\PageEditListener.java
import com.atlassian.event.EventListener;
public class PageEditListener implements EventListener

File: C:\projects\confluence-2.4.5.earwar\plugins\workflow\src\java\com
   \atlassian\confluence\extra\workflow\WorkflowListener.java
import com.atlassian.event.EventListener;
public class WorkflowListener implements EventListener

File: C:\projects\confluence-2.4.5.earwar\plugins\workflow\src\java\com
   \atlassian\confluence\extra\workflow\WorkflowMacro.java
            PageEditListener.ignoreEventsForPage(page);
            PageEditListener.acceptEventsForPage(page);
Labels:
plugin plugin Delete
development development Delete
confluence confluence Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.