001 /**
002 * Copyright 2005-2012 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 package org.kuali.rice.kew.plugin;
017
018 import org.kuali.rice.core.api.config.property.Config;
019 import org.kuali.rice.core.api.config.property.ConfigContext;
020
021 import java.util.ArrayList;
022 import java.util.List;
023
024
025 /**
026 * A factory for creating {@link PluginRegistry} instances based on the configured client protocol of the application.
027 *
028 * @see PluginRegistry
029 * @author Kuali Rice Team (rice.collab@kuali.org)
030 */
031 public class PluginRegistryFactory {
032
033 public PluginRegistry createPluginRegistry() {
034
035 ServerPluginRegistry registry = new ServerPluginRegistry();
036 String pluginDir = ConfigContext.getCurrentContextConfig().getProperty(Config.PLUGIN_DIR);
037 List<String> pluginDirectories = new ArrayList<String>();
038 // TODO: maybe ensure that if these directories are the same, that
039 // only one gets through
040 if (!org.apache.commons.lang.StringUtils.isEmpty(pluginDir)) {
041 pluginDirectories.add(pluginDir);
042 }
043 registry.setPluginDirectories(pluginDirectories);
044 return registry;
045
046 }
047
048 }