001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016// begin Kuali Foundation modification 017package org.kuali.rice.kns.web.struts.form.pojo; 018 019// deleted some imports 020// end Kuali Foundation modification 021 022 023import org.apache.commons.beanutils.BeanUtilsBean; 024import org.apache.commons.beanutils.ConvertUtilsBean; 025import org.apache.commons.beanutils.PropertyUtilsBean; 026import org.apache.struts.action.ActionServlet; 027import org.apache.struts.action.PlugIn; 028import org.apache.struts.config.ModuleConfig; 029import org.kuali.rice.kns.web.struts.config.KualiControllerConfig; 030 031import javax.servlet.ServletException; 032import java.util.logging.Logger; 033 034/** 035 * begin Kuali Foundation modification 036 * This class is the POJO Plugin implementation of the PlugIn interface. 037 * end Kuali Foundation modification 038 * 039 * @author Kuali Rice Team (rice.collab@kuali.org) 040 */ 041// Kuali Foundation modification: class originally named SL plugin 042public class PojoPlugin implements PlugIn { 043 static final Logger logger = Logger.getLogger(PojoPlugin.class.getName()); 044 045 public static void initBeanUtils() { 046 // begin Kuali Foundation modification 047 ConvertUtilsBean convUtils = new ConvertUtilsBean(); 048 PropertyUtilsBean propUtils = new PojoPropertyUtilsBean(); 049 BeanUtilsBean pojoBeanUtils = new BeanUtilsBean(convUtils, propUtils); 050 051 BeanUtilsBean.setInstance(pojoBeanUtils); 052 logger.fine("Initialized BeanUtilsBean with " + pojoBeanUtils); 053 // end Kuali Foundation modification 054 } 055 056 public PojoPlugin() { 057 } 058 059 public void init(ActionServlet servlet, ModuleConfig config) throws ServletException { 060 initBeanUtils(); 061 // override the Struts ControllerConfig with our own wrapper that knows how to 062 // dynamically find max file upload size according to Rice run-time settings 063 config.setControllerConfig(new KualiControllerConfig(config.getControllerConfig())); 064 } 065 066 public void destroy() { 067 } 068}