portletspec3
  1. portletspec3
  2. PORTLETSPEC3-16

Provide a mechanism to extend annnotation processing in GenericPortlet

    Details

      Description

      When extending GenericPortlet, there is currently no way to extend or reuse the
      annotation processing provided by GenericPortlet. It would be good if the
      GenericPortlet annotation processing could be made extensible in some manner.

      One use case would be to allow support for custom portlet modes.

        Activity

        Hide
        Neil Griffin added a comment -

        I think that the simplest way to achieve this goal would be to have the private maps in GenericPortlet could be exposed with getter methods, and the getter methods could be consulted rather than accessing the private variables directly. For example:

        Method actionMethod = getProcessActionMethodsMap().get(action);
        

        instead of:

        Method actionMethod = processActionHandlingMethodsMap.get(action);
        

        Also, it would be good to change the scope of the GenericPortlet.cacheAnnotatedMethods() method from private to protected so that it can be overridden.

        Show
        Neil Griffin added a comment - I think that the simplest way to achieve this goal would be to have the private maps in GenericPortlet could be exposed with getter methods, and the getter methods could be consulted rather than accessing the private variables directly. For example: Method actionMethod = getProcessActionMethodsMap().get(action); instead of: Method actionMethod = processActionHandlingMethodsMap.get(action); Also, it would be good to change the scope of the GenericPortlet.cacheAnnotatedMethods() method from private to protected so that it can be overridden.
        Hide
        msnicklous added a comment -

        The map methods are not synchronized, and if we make them available, portlet programmers might be tempted to change them, which might not be so good.

        Instead, I propose adding the following methods to GenericPortlet:

        dispatchAnnotatedActionMethod()
        dispatchAnnotatedEventMethod()
        dispatchAnnotatedRenderMethod()

        These methods allow some flexibility, since the annotation name used does not need to be an action parameter, an event name, or a portlet mode. An arbitrary string can be used.

        For example, a developer could annotate a method and access it as follows:

        @RenderMode(name="George")
        myRenderMethod(...) {
           ...
        }
        
        doDispatch(...) {
           ...
           boolean itWorked = dispatchAnnotatedRenderMethod("George", ...);
           if (!itWorked) {
              // show a message
           }
        }
        

        If this proposal is found to be good, I will update GenericPortlet to use these methods internally, test the changes, and update the spec appropriately in order to resolve this issue.

        Show
        msnicklous added a comment - The map methods are not synchronized, and if we make them available, portlet programmers might be tempted to change them, which might not be so good. Instead, I propose adding the following methods to GenericPortlet: dispatchAnnotatedActionMethod() dispatchAnnotatedEventMethod() dispatchAnnotatedRenderMethod() These methods allow some flexibility, since the annotation name used does not need to be an action parameter, an event name, or a portlet mode. An arbitrary string can be used. For example, a developer could annotate a method and access it as follows: @RenderMode(name="George") myRenderMethod(...) { ... } doDispatch(...) { ... boolean itWorked = dispatchAnnotatedRenderMethod("George", ...); if (!itWorked) { // show a message } } If this proposal is found to be good, I will update GenericPortlet to use these methods internally, test the changes, and update the spec appropriately in order to resolve this issue.

          People

          • Assignee:
            msnicklous
            Reporter:
            msnicklous
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: