From: <jbo...@li...> - 2005-12-17 15:00:11
|
Author: wrzep Date: 2005-12-17 10:00:05 -0500 (Sat, 17 Dec 2005) New Revision: 1832 Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/KosmosStatusPlugin.java Removed: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/KosmosStatusPlugin.java Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/jira/JiraStatusPlugin.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java Log: moved kosmos plugin superclass to plugins package http://jira.jboss.com/jira/browse/JBLAB-415 Pawel Deleted: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/KosmosStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/KosmosStatusPlugin.java 2005-12-17 14:53:48 UTC (rev 1831) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/KosmosStatusPlugin.java 2005-12-17 15:00:05 UTC (rev 1832) @@ -1,110 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.jboss.forge.status; - -import org.jboss.forge.common.XmlTools; -import org.jboss.forge.common.projects.Projects; -import org.jboss.forge.status.plugins.InvalidPluginPropertiesException; -import org.jboss.forge.status.plugins.StatusPlugin; - -import org.jboss.logging.Logger; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.w3c.dom.Node; - -/** -* @author Pawel Wrzeszcz -*/ - -public abstract class KosmosStatusPlugin extends StatusPlugin { - - protected abstract String getKosmosServiceProperty(); - - private Map<String,Map> projectsMaps; - - protected String serviceURL; - - protected Logger log; - - public KosmosStatusPlugin() { - super(); - - log = Logger.getLogger(this.getClass()); - projectsMaps = new HashMap<String,Map>(); - } - - public void init(String name, String id, Projects projects, Node propertiesNode) throws InvalidPluginPropertiesException { - super.init(name, id, projects,propertiesNode); - - Map<String,String> properties = XmlTools.getMapFromNodeElements(propertiesNode); - getProperties(properties); - } - - private void getProperties(Map<String,String> properties) throws InvalidPluginPropertiesException { - - if (properties.isEmpty()) { - throw new InvalidPluginPropertiesException("Missing properties for " + getName() + " plugin."); - } - - serviceURL = properties.get(getKosmosServiceProperty()); - - if (serviceURL == null) { - throw new InvalidPluginPropertiesException( - "Missing " + getKosmosServiceProperty() + " property for " + getName() + " plugin."); - } - } - - protected abstract int getPluginSpecyficValue(Map projectMap); - protected abstract int getPluginSpecyficDefaultValue(); - - protected abstract Map getProjectMap(String projectId); - - protected void printMap(Map map) { //debug - if (map != null) { - - for (Iterator iter = map.keySet().iterator(); iter.hasNext();) { - Object obj = (Object) iter.next(); - System.out.println("object: " + obj + " binding: " + map.get(obj)); - } - } - } - - public int getValue(String projectId) { - - if (!projectsMaps.containsKey(projectId)) { - projectsMaps.put(projectId, getProjectMap(projectId)); - } - - Map projectMap = projectsMaps.get(projectId); - - if (projectMap == null) { - return getPluginSpecyficDefaultValue(); - } - - return getPluginSpecyficValue(projectMap); - } - -} Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/KosmosStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/KosmosStatusPlugin.java 2005-12-17 14:53:48 UTC (rev 1831) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/KosmosStatusPlugin.java 2005-12-17 15:00:05 UTC (rev 1832) @@ -0,0 +1,108 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.forge.status.plugins; + +import org.jboss.forge.common.XmlTools; +import org.jboss.forge.common.projects.Projects; + +import org.jboss.logging.Logger; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.w3c.dom.Node; + +/** +* @author Pawel Wrzeszcz +*/ + +public abstract class KosmosStatusPlugin extends StatusPlugin { + + protected abstract String getKosmosServiceProperty(); + + private Map<String,Map> projectsMaps; + + protected String serviceURL; + + protected Logger log; + + public KosmosStatusPlugin() { + super(); + + log = Logger.getLogger(this.getClass()); + projectsMaps = new HashMap<String,Map>(); + } + + public void init(String name, String id, Projects projects, Node propertiesNode) throws InvalidPluginPropertiesException { + super.init(name, id, projects,propertiesNode); + + Map<String,String> properties = XmlTools.getMapFromNodeElements(propertiesNode); + getProperties(properties); + } + + private void getProperties(Map<String,String> properties) throws InvalidPluginPropertiesException { + + if (properties.isEmpty()) { + throw new InvalidPluginPropertiesException("Missing properties for " + getName() + " plugin."); + } + + serviceURL = properties.get(getKosmosServiceProperty()); + + if (serviceURL == null) { + throw new InvalidPluginPropertiesException( + "Missing " + getKosmosServiceProperty() + " property for " + getName() + " plugin."); + } + } + + protected abstract int getPluginSpecyficValue(Map projectMap); + protected abstract int getPluginSpecyficDefaultValue(); + + protected abstract Map getProjectMap(String projectId); + + protected void printMap(Map map) { //debug + if (map != null) { + + for (Iterator iter = map.keySet().iterator(); iter.hasNext();) { + Object obj = (Object) iter.next(); + System.out.println("object: " + obj + " binding: " + map.get(obj)); + } + } + } + + public int getValue(String projectId) { + + if (!projectsMaps.containsKey(projectId)) { + projectsMaps.put(projectId, getProjectMap(projectId)); + } + + Map projectMap = projectsMaps.get(projectId); + + if (projectMap == null) { + return getPluginSpecyficDefaultValue(); + } + + return getPluginSpecyficValue(projectMap); + } + +} Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/jira/JiraStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/jira/JiraStatusPlugin.java 2005-12-17 14:53:48 UTC (rev 1831) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/jira/JiraStatusPlugin.java 2005-12-17 15:00:05 UTC (rev 1832) @@ -26,7 +26,7 @@ import java.util.List; import java.util.Map; -import org.jboss.forge.status.KosmosStatusPlugin; +import org.jboss.forge.status.plugins.KosmosStatusPlugin; import org.jboss.logging.Logger; import com.caucho.hessian.client.HessianProxyFactory; Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java 2005-12-17 14:53:48 UTC (rev 1831) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java 2005-12-17 15:00:05 UTC (rev 1832) @@ -22,7 +22,7 @@ package org.jboss.forge.status.plugins.svn; -import org.jboss.forge.status.KosmosStatusPlugin; +import org.jboss.forge.status.plugins.KosmosStatusPlugin; import org.jboss.logging.Logger; import java.net.MalformedURLException; |