1 9 package org.jboss.portal.portlet.plugins.preferences; 10 11 import javax.portlet.PreferencesValidator; 12 13 import org.jboss.portal.common.metadata.MetaData; 14 import org.jboss.portal.portlet.metadata.PortletPreferencesMetaData; 15 import org.jboss.portal.server.Application; 16 import org.jboss.portal.server.Component; 17 import org.jboss.portal.server.plugins.preferences.PreferenceSetPlugin; 18 19 25 public class PortletPreferenceSetPlugin 26 extends PreferenceSetPlugin 27 { 28 29 30 protected PreferencesValidator preferencesValidator; 31 32 public PortletPreferenceSetPlugin() 33 { 34 } 35 36 public void start() throws Exception 37 { 38 try 39 { 40 String preferencesValidatorClassName = ((PortletPreferencesMetaData)metaData).getPreferenceValidator(); 41 if (preferencesValidatorClassName != null) 42 { 43 Component component = (Component)container; 45 Application application = component.getApplication(); 46 ClassLoader loader = application.getClassLoader(); 47 48 Class preferencesValidatorClass = loader.loadClass(preferencesValidatorClassName); 50 preferencesValidator = (PreferencesValidator)preferencesValidatorClass.newInstance(); 51 } 52 } 53 catch (ClassNotFoundException e) 54 { 55 log.error("Class for preference validator not found", e); 56 } 57 catch (InstantiationException e) 58 { 59 log.error("Cannot instantiate preference validator", e); 60 } 61 catch (IllegalAccessException e) 62 { 63 throw new Error (); 64 } 65 66 super.start(); 68 } 69 70 public void setMetaData(MetaData metaData) 71 { 72 super.setMetaData(metaData); 73 } 74 75 public PreferencesValidator getPreferencesValidator() 76 { 77 return preferencesValidator; 78 } 79 80 } 81 | Popular Tags |