1 16 17 package org.apache.jetspeed.modules.actions.portlets; 18 19 20 import java.lang.reflect.Method ; 21 22 import org.apache.jetspeed.portal.Portlet; 23 import org.apache.jetspeed.portal.portlets.VelocityPortlet; 24 25 26 import org.apache.turbine.util.RunData; 28 29 30 import org.apache.velocity.context.Context; 32 33 34 53 public abstract class VelocityPortletAction extends GenericMVCAction 54 { 55 56 57 58 62 protected abstract void buildNormalContext(VelocityPortlet portlet, 63 Context context, 64 RunData rundata) 65 throws Exception ; 66 67 71 protected void buildNormalContext(Portlet portlet, Context context, RunData data) 72 throws Exception 73 { 74 buildNormalContext((VelocityPortlet) portlet, context, data); 75 } 76 77 80 protected void buildConfigureContext(Portlet portlet, Context context, RunData data) 81 throws Exception 82 { 83 try 95 { 96 Method method = 97 this.getClass().getDeclaredMethod( 98 "buildConfigureContext", 99 new Class [] { VelocityPortlet.class, Context.class, RunData.class }); 100 method.setAccessible(true); 101 method.invoke(this, new Object [] { portlet, context, data }); 102 method.setAccessible(false); 103 104 } 105 catch (NoSuchMethodException e) 106 { 107 super.buildConfigureContext(portlet, context, data); 109 } 110 111 } 112 113 117 protected void buildConfigureContext(VelocityPortlet portlet, Context context, RunData data) 118 throws Exception 119 { 120 } 121 122 123 protected void buildMaximizedContext(Portlet portlet, Context context, RunData data) 124 throws Exception 125 { 126 try 138 { 139 Method method = 140 this.getClass().getDeclaredMethod( 141 "buildMaximizedContext", 142 new Class [] { VelocityPortlet.class, Context.class, RunData.class }); 143 method.setAccessible(true); 144 method.invoke(this, new Object [] { portlet, context, data }); 145 method.setAccessible(false); 146 } 147 catch (NoSuchMethodException e) 148 { 149 super.buildMaximizedContext(portlet, context, data); 151 } 152 } 153 154 158 protected void buildMaximizedContext(VelocityPortlet portlet, Context context, RunData data) 159 throws Exception 160 { 161 } 162 163 164 165 166 } 167 | Popular Tags |