[jboss-svn-commits] JBL Code SVN: r6701 - in labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status: common/protocol/conf common/tools plugins service service/impl/protocol/db service/impl/protocol/shotoku service/plugins service/plugins/cc service/plugins/codelines service/plugins/jira service/plugins/math service/plugins/productization service/plugins/productization/docs service/plugins/productization/forums service/plugins/productization/support service/plugins/svn

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Oct 9 06:55:40 EDT 2006


Author: wrzep
Date: 2006-10-09 06:55:24 -0400 (Mon, 09 Oct 2006)
New Revision: 6701

Added:
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/KosmosStatusPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/Plugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcBrokenBuildsPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcBuildAttemptsPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcBuildsPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcStatusPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcSuccessfulBuildsPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/ErrorsStatusPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/TestsStatusPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/AddedCodeLinesPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/CheckOutEditor.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/CodeLinesEvaluator.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/CodeLinesPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/CodeLinesTotalPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/SlowCodeLinesTotalPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/jira/
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/jira/ClosedIssuesStatusPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/jira/JiraStatusPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/jira/OpenIssuesStatusPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/jira/ResolvedIssuesStatusPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/AddPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/ConstPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/DivPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/LastNDaysStatusPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/MathPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/MulPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/RandomPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/WeightedScorePlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/DownloadsPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/JEMSIntegrationPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/PackagedForDownloadPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/ProductizationPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/docs/
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/docs/DifferentDocumentationSourcesPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/docs/DocumentationPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/docs/DocumentationTypePlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/forums/
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/forums/DifferentForumsPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/forums/ForumTypePlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/forums/ForumsPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/support/
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/support/DifferentSupportServicesPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/support/SupportServicesPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/support/SupportTypePlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/CommitsLast31DaysStatusPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/CommitsLast7DaysStatusPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/CommitsTodayStatusPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/CommitsTotalStatusPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/RevisionStatusPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/SvnStatusPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/TotalRepoSizeStatusPlugin.java
Removed:
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/KosmosStatusPlugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/Plugin.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/cc/
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/codelines/
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/jira/
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/math/
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/productization/
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/
Modified:
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/common/protocol/conf/ScoresFactory.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/common/tools/Plugins.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/db/DBScoresFactory.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/db/PluginValuesEntity.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/db/PluginsValuesEntity.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/shotoku/PluginValuesImpl.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/shotoku/PluginsValuesImpl.java
   labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/shotoku/ShotokuScoresFactory.java
Log:
Standalone JMM service (http://jira.jboss.com/jira/browse/JBLAB-781)
refactoring contiuned - service

Pawel


Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/common/protocol/conf/ScoresFactory.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/common/protocol/conf/ScoresFactory.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/common/protocol/conf/ScoresFactory.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -26,7 +26,7 @@
 
 import org.jboss.forge.common.projects.Projects;
 import org.jboss.forge.status.common.tools.Plugins;
-import org.jboss.forge.status.plugins.Plugin;
+import org.jboss.forge.status.service.plugins.Plugin;
 
 /**
 * @author Pawel Wrzeszcz

Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/common/tools/Plugins.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/common/tools/Plugins.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/common/tools/Plugins.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -35,7 +35,7 @@
 import org.jboss.forge.status.common.exceptions.InvalidPluginPropertiesException;
 import org.jboss.forge.status.common.protocol.ScoresManager;
 import org.jboss.forge.status.common.protocol.conf.PluginConf;
-import org.jboss.forge.status.plugins.Plugin;
+import org.jboss.forge.status.service.plugins.Plugin;
 
 import org.jboss.logging.Logger;
 

Deleted: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/KosmosStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/KosmosStatusPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/KosmosStatusPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -1,147 +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.plugins;
-
-import org.jboss.forge.common.projects.Projects;
-import org.jboss.forge.status.common.exceptions.InvalidPluginPropertiesException;
-import org.jboss.forge.status.common.protocol.ScoresManager;
-import org.jboss.forge.status.common.tools.Plugins;
-
-import org.jboss.logging.Logger;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-/**
-* @author Pawel Wrzeszcz
-* Superclass for kosmos-service based plugins.
-*/
-
-public abstract class KosmosStatusPlugin extends Plugin {
-	
-	/**
-	 * Kosmos-service xml tag.
-	 */
-	protected abstract String getKosmosServiceTag();
-
-	/**
-	 * Binds project ids with kosmos-service specyfic Maps.
-	 */
-	private Map<String,List> projectServices;
-	
-	/**
-	 * Kosmos service adress.
-	 */
-	protected String serviceURL;
-	
-	protected Logger log;
-	
-	public KosmosStatusPlugin() {
-		super();
-		
-		log = Logger.getLogger(this.getClass());
-		projectServices = new HashMap<String,List>();
-	}
-	
-	@Override
-	public void init(String id, String portalName, Projects projects,
-			Plugins plugins, Properties properties, ScoresManager scoresManager)
-									throws InvalidPluginPropertiesException {
-		super.init(id, portalName, projects, plugins, properties, scoresManager);
-		
-		getServiceProperty(properties);
-	}
-	
-	/**
-	 * Gets service URL from the given Node with plugin properites. 
-	 * 
-	 * @param propertiesNode Node with plugin specyfic properties 
-	 * @throws InvalidPluginPropertiesException
-	 */
-	private void getServiceProperty(Properties properties)
-		throws InvalidPluginPropertiesException {
-		
-		if ((properties == null) || (properties.isEmpty())) {
-			throw new InvalidPluginPropertiesException(
-					"Missing properties for plugin: " + getId() + ".");
-		}
-	
-		serviceURL = properties.getProperty(getKosmosServiceTag());
-		
-		if (serviceURL == null) {
-			throw new InvalidPluginPropertiesException(
-					"Missing " + getKosmosServiceTag() + 
-					" property for plugin: " + getId() + ".");
-		}
-	}
-
-	/**
-	 * For the given service specyfic Maps, computes plugin specyfic value.
-	 * 
-	 * @param projectMap service specyfic Map
-	 * @return Plugin value
-	 */
-	protected abstract int getPluginSpecyficValue(Object projectMap);
-	
-	
-	/**
-	 * @return Default Plugin value, when service is not specified.
-	 */
-	protected abstract int getPluginSpecyficDefaultValue();
-	
-	/**
-	 * Returns service specyfic Maps for the given project.
-	 * 
-	 * @param projectId
-	 * @return service specyfic Map
-	 */
-	protected abstract List getProjectServices(String projectId);
-	
-	/* (non-Javadoc)
-	 * @see org.jboss.forge.status.Plugin#getValue(java.lang.String)
-	 */
-	@Override
-	protected long getPluginValue(String projectId) {
-		
-		if (!projectServices.containsKey(projectId)) {
-			projectServices.put(projectId, getProjectServices(projectId));
-		}
-		
-		List projectServicesList = projectServices.get(projectId);
-		
-		if (projectServicesList == null) {
-			return getPluginSpecyficDefaultValue();
-		}
-		
-		long value = 0;
-		
-		for (Object projectService : projectServicesList) {
-		
-			value += getPluginSpecyficValue(projectService);
-		}
-		
-		return value;
-	}
-}

Deleted: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/Plugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/Plugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/Plugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -1,236 +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.plugins;
-
-import java.util.Properties;
-import java.util.Set;
-
-import org.jboss.forge.common.projects.Projects;
-import org.jboss.forge.common.projects.permissions.NullPermissionsChecker;
-import org.jboss.forge.status.common.Constants;
-import org.jboss.forge.status.common.Tags;
-import org.jboss.forge.status.common.exceptions.InvalidPluginPropertiesException;
-import org.jboss.forge.status.common.protocol.ScoresManager;
-import org.jboss.forge.status.common.tools.Plugins;
-import org.jboss.logging.Logger;
-
-/**
-* @author Pawel Wrzeszcz
-* Superclass for Status Matrix Plugins.
-*/
-
-public abstract class Plugin {
-	
-	/** Properties specyfic to this plugin */
-	protected Properties properties;
-	
-	/** Plugin id */
-	protected String id;
-	
-	/** Portal name */
-	protected String portalName;
-	
-	/** Projects present in the Status Matrix. */
-	protected Projects projects;
-	
-	/** Plugins loaded before this plugin */
-	protected Plugins plugins;
-	
-	protected ScoresManager scoresManager;
-	
-	protected long minValue;
-	
-	private Logger log = Logger.getLogger(Plugin.class);
-	
-	/**
-	 * @param id Plugin id
-	 * @param portalName Portal name
-	 * @param projects Projects present in the Status Matrix
-	 * @param properties plugin specyfic properties
-	 * or null if properties are not specified
-	 * @param scoresManager 
-	 * @patam plugins Plugins loaded before this plugin
-	 * @throws InvalidPluginPropertiesException
-	 * Thrown when properties passed in <code>propertiesNode</code>
-	 * are incorrect or missing. 
-	 */
-	public void init(String id, String portalName, Projects projects,
-			Plugins plugins, Properties properties, ScoresManager scoresManager)
-						throws InvalidPluginPropertiesException {
-		
-		this.id = id;
-		this.portalName = portalName;
-		this.projects = projects;
-		this.plugins = plugins;
-		this.properties = properties;
-		this.scoresManager = scoresManager;
-		
-		parseProperties(properties);
-	}
-	
-	private void parseProperties(Properties properties2) {
-
-		if (properties == null) {
-			
-			minValue = Constants.PLUGIN_DEFAULT_MIN_VALUE;
-			
-		} else {
-		
-			String minValueString = properties.getProperty(
-													Tags.MIN_VALUE_PROPERTY);
-			minValue = Long.parseLong(minValueString);
-		}
-	}
-
-	/**
-	 * For the given project returns value specyfic to this plugin.
-	 * If an error occured while computing a value, returns
-	 * <code>Constants.DEFAULT_PLUGIN_VALUE</code> 
-	 * 
-	 * @param projectId project id
-	 * @return value computed by plugin for the project
-	 * with the given <code>projectId</code>.
-	 */
-	public final long getValue(String projectId) {
-		
-		long v = Constants.DEFAULT_PLUGIN_VALUE;
-		
-		try {
-		
-			v = getPluginValue(projectId);
-			
-		} catch (Exception e) {
-			
-			log.warn("Exception in plugin (getPluginValue)" + id + 
-												"\nCause: " + e.getMessage());	
-		}
-		
-		return Math.max(v, minValue);
-	}
-	
-	/**
-	 * For the given project returns value specyfic to this plugin.
-	 * 
-	 * @param projectId project id
-	 * @return value computed by plugin for the project
-	 * with the given <code>projectId</code>.
-	 */
-	protected abstract long getPluginValue(String projectId);
-	
-	
-	/** For the given project returns link associated with this plugin
-	 * and project or null if such link does not exsist.
-	 */
-	public final String getLink(String projectId) {
-		
-		String s = null;
-		
-		try {
-		
-			s = getPluginLink(projectId);
-			
-		} catch (Exception e) {
-			
-			log.warn("Exception in plugin (getPluginLink)" + id + 
-												"\nCause: " + e.getMessage());	
-		}
-		
-		return s;
-	}
-	
-	/** For the given project returns link associated with this plugin and project.
-	 * Should be overrided inside plugins that have some links associated with projects.
-	 */
-	protected String getPluginLink(String projectId) {
-		return null;
-	}
-	
-	/** For the given project returns name of link associated with this plugin
-	 * or null if projects have not any link associated with this plugin.
-	 */
-	public final String getLinkName() {
-		
-		String s = null;
-		
-		try {
-		
-			s = getPluginLinkName();
-			
-		} catch (Exception e) {
-			
-			log.warn("Exception in plugin (getPluginLinkName)" + id + 
-												"\nCause: " + e.getMessage());	
-		}
-		
-		return s;
-	}
-	
-	/** For the given project returns name of link associated with this plugin
-	 * or null if projects have not any link associated with this plugin.
-	 * This method should be overrided inside plugins that have some links associated with projects.
-	 */
-	protected String getPluginLinkName() {
-		return null;
-	}
-	
-	/**
-	 * For the given project returns it's rate.
-	 * Rate is computed as project's score share in
-	 * sum of all scores. 
-	 * 
-	 * @param projectId project id
-	 * @return rate computed by plugin for the project
-	 * with the given <code>projectId</code>.
-	 */
-	public final int getRate(String projectId) {
-				
-		long totalScore = getTotalScore();
-			
-		if (totalScore == 0) {
-			return 0;
-		}
-		
-		float r = ((float) getValue(projectId) / (float) totalScore);
-		
-		return (int) (100.0 * r);
-	}
-
-	/**
-	 * @return plugin id
-	 */
-	public final String getId() { return id; };
-
-	private long getTotalScore() {
-		
-		Set<String> projectIds = projects.getProjectIds(
-									new NullPermissionsChecker(), null);
-		
-		long s = 0;
-		
-		for (String projectId : projectIds) {
-			s += getValue(projectId);
-		}
-		
-		return s;
-	}
-}

Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/db/DBScoresFactory.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/db/DBScoresFactory.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/db/DBScoresFactory.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -30,7 +30,7 @@
 import org.jboss.forge.status.common.protocol.conf.PluginsValues;
 import org.jboss.forge.status.common.protocol.conf.ScoresFactory;
 import org.jboss.forge.status.common.tools.Plugins;
-import org.jboss.forge.status.plugins.Plugin;
+import org.jboss.forge.status.service.plugins.Plugin;
 
 
 /**

Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/db/PluginValuesEntity.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/db/PluginValuesEntity.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/db/PluginValuesEntity.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -39,7 +39,7 @@
 import javax.persistence.Table;
 
 import org.jboss.forge.status.common.protocol.conf.PluginValues;
-import org.jboss.forge.status.plugins.Plugin;
+import org.jboss.forge.status.service.plugins.Plugin;
 
 /**
  * @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)

Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/db/PluginsValuesEntity.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/db/PluginsValuesEntity.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/db/PluginsValuesEntity.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -44,7 +44,7 @@
 import org.jboss.forge.status.common.protocol.conf.PluginValues;
 import org.jboss.forge.status.common.protocol.conf.PluginsValues;
 import org.jboss.forge.status.common.tools.Plugins;
-import org.jboss.forge.status.plugins.Plugin;
+import org.jboss.forge.status.service.plugins.Plugin;
 
 /**
  *

Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/shotoku/PluginValuesImpl.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/shotoku/PluginValuesImpl.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/shotoku/PluginValuesImpl.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -27,7 +27,7 @@
 import java.util.Set;
 
 import org.jboss.forge.status.common.protocol.conf.PluginValues;
-import org.jboss.forge.status.plugins.Plugin;
+import org.jboss.forge.status.service.plugins.Plugin;
 
 /**
 * @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)

Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/shotoku/PluginsValuesImpl.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/shotoku/PluginsValuesImpl.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/shotoku/PluginsValuesImpl.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -33,7 +33,7 @@
 import org.jboss.forge.status.common.protocol.conf.PluginValues;
 import org.jboss.forge.status.common.protocol.conf.PluginsValues;
 import org.jboss.forge.status.common.tools.Plugins;
-import org.jboss.forge.status.plugins.Plugin;
+import org.jboss.forge.status.service.plugins.Plugin;
 
 /**
 * @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)

Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/shotoku/ShotokuScoresFactory.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/shotoku/ShotokuScoresFactory.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/impl/protocol/shotoku/ShotokuScoresFactory.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -30,7 +30,7 @@
 import org.jboss.forge.status.common.protocol.conf.PluginsValues;
 import org.jboss.forge.status.common.protocol.conf.ScoresFactory;
 import org.jboss.forge.status.common.tools.Plugins;
-import org.jboss.forge.status.plugins.Plugin;
+import org.jboss.forge.status.service.plugins.Plugin;
 
 
 /**

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/KosmosStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/KosmosStatusPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/KosmosStatusPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,147 @@
+/*
+ * 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.service.plugins;
+
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.status.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.status.common.protocol.ScoresManager;
+import org.jboss.forge.status.common.tools.Plugins;
+
+import org.jboss.logging.Logger;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+* @author Pawel Wrzeszcz
+* Superclass for kosmos-service based plugins.
+*/
+
+public abstract class KosmosStatusPlugin extends Plugin {
+	
+	/**
+	 * Kosmos-service xml tag.
+	 */
+	protected abstract String getKosmosServiceTag();
+
+	/**
+	 * Binds project ids with kosmos-service specyfic Maps.
+	 */
+	private Map<String,List> projectServices;
+	
+	/**
+	 * Kosmos service adress.
+	 */
+	protected String serviceURL;
+	
+	protected Logger log;
+	
+	public KosmosStatusPlugin() {
+		super();
+		
+		log = Logger.getLogger(this.getClass());
+		projectServices = new HashMap<String,List>();
+	}
+	
+	@Override
+	public void init(String id, String portalName, Projects projects,
+			Plugins plugins, Properties properties, ScoresManager scoresManager)
+									throws InvalidPluginPropertiesException {
+		super.init(id, portalName, projects, plugins, properties, scoresManager);
+		
+		getServiceProperty(properties);
+	}
+	
+	/**
+	 * Gets service URL from the given Node with plugin properites. 
+	 * 
+	 * @param propertiesNode Node with plugin specyfic properties 
+	 * @throws InvalidPluginPropertiesException
+	 */
+	private void getServiceProperty(Properties properties)
+		throws InvalidPluginPropertiesException {
+		
+		if ((properties == null) || (properties.isEmpty())) {
+			throw new InvalidPluginPropertiesException(
+					"Missing properties for plugin: " + getId() + ".");
+		}
+	
+		serviceURL = properties.getProperty(getKosmosServiceTag());
+		
+		if (serviceURL == null) {
+			throw new InvalidPluginPropertiesException(
+					"Missing " + getKosmosServiceTag() + 
+					" property for plugin: " + getId() + ".");
+		}
+	}
+
+	/**
+	 * For the given service specyfic Maps, computes plugin specyfic value.
+	 * 
+	 * @param projectMap service specyfic Map
+	 * @return Plugin value
+	 */
+	protected abstract int getPluginSpecyficValue(Object projectMap);
+	
+	
+	/**
+	 * @return Default Plugin value, when service is not specified.
+	 */
+	protected abstract int getPluginSpecyficDefaultValue();
+	
+	/**
+	 * Returns service specyfic Maps for the given project.
+	 * 
+	 * @param projectId
+	 * @return service specyfic Map
+	 */
+	protected abstract List getProjectServices(String projectId);
+	
+	/* (non-Javadoc)
+	 * @see org.jboss.forge.status.Plugin#getValue(java.lang.String)
+	 */
+	@Override
+	protected long getPluginValue(String projectId) {
+		
+		if (!projectServices.containsKey(projectId)) {
+			projectServices.put(projectId, getProjectServices(projectId));
+		}
+		
+		List projectServicesList = projectServices.get(projectId);
+		
+		if (projectServicesList == null) {
+			return getPluginSpecyficDefaultValue();
+		}
+		
+		long value = 0;
+		
+		for (Object projectService : projectServicesList) {
+		
+			value += getPluginSpecyficValue(projectService);
+		}
+		
+		return value;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/Plugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/Plugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/Plugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,236 @@
+/*
+ * 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.service.plugins;
+
+import java.util.Properties;
+import java.util.Set;
+
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.common.projects.permissions.NullPermissionsChecker;
+import org.jboss.forge.status.common.Constants;
+import org.jboss.forge.status.common.Tags;
+import org.jboss.forge.status.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.status.common.protocol.ScoresManager;
+import org.jboss.forge.status.common.tools.Plugins;
+import org.jboss.logging.Logger;
+
+/**
+* @author Pawel Wrzeszcz
+* Superclass for Status Matrix Plugins.
+*/
+
+public abstract class Plugin {
+	
+	/** Properties specyfic to this plugin */
+	protected Properties properties;
+	
+	/** Plugin id */
+	protected String id;
+	
+	/** Portal name */
+	protected String portalName;
+	
+	/** Projects present in the Status Matrix. */
+	protected Projects projects;
+	
+	/** Plugins loaded before this plugin */
+	protected Plugins plugins;
+	
+	protected ScoresManager scoresManager;
+	
+	protected long minValue;
+	
+	private Logger log = Logger.getLogger(Plugin.class);
+	
+	/**
+	 * @param id Plugin id
+	 * @param portalName Portal name
+	 * @param projects Projects present in the Status Matrix
+	 * @param properties plugin specyfic properties
+	 * or null if properties are not specified
+	 * @param scoresManager 
+	 * @patam plugins Plugins loaded before this plugin
+	 * @throws InvalidPluginPropertiesException
+	 * Thrown when properties passed in <code>propertiesNode</code>
+	 * are incorrect or missing. 
+	 */
+	public void init(String id, String portalName, Projects projects,
+			Plugins plugins, Properties properties, ScoresManager scoresManager)
+						throws InvalidPluginPropertiesException {
+		
+		this.id = id;
+		this.portalName = portalName;
+		this.projects = projects;
+		this.plugins = plugins;
+		this.properties = properties;
+		this.scoresManager = scoresManager;
+		
+		parseProperties(properties);
+	}
+	
+	private void parseProperties(Properties properties2) {
+
+		if (properties == null) {
+			
+			minValue = Constants.PLUGIN_DEFAULT_MIN_VALUE;
+			
+		} else {
+		
+			String minValueString = properties.getProperty(
+													Tags.MIN_VALUE_PROPERTY);
+			minValue = Long.parseLong(minValueString);
+		}
+	}
+
+	/**
+	 * For the given project returns value specyfic to this plugin.
+	 * If an error occured while computing a value, returns
+	 * <code>Constants.DEFAULT_PLUGIN_VALUE</code> 
+	 * 
+	 * @param projectId project id
+	 * @return value computed by plugin for the project
+	 * with the given <code>projectId</code>.
+	 */
+	public final long getValue(String projectId) {
+		
+		long v = Constants.DEFAULT_PLUGIN_VALUE;
+		
+		try {
+		
+			v = getPluginValue(projectId);
+			
+		} catch (Exception e) {
+			
+			log.warn("Exception in plugin (getPluginValue)" + id + 
+												"\nCause: " + e.getMessage());	
+		}
+		
+		return Math.max(v, minValue);
+	}
+	
+	/**
+	 * For the given project returns value specyfic to this plugin.
+	 * 
+	 * @param projectId project id
+	 * @return value computed by plugin for the project
+	 * with the given <code>projectId</code>.
+	 */
+	protected abstract long getPluginValue(String projectId);
+	
+	
+	/** For the given project returns link associated with this plugin
+	 * and project or null if such link does not exsist.
+	 */
+	public final String getLink(String projectId) {
+		
+		String s = null;
+		
+		try {
+		
+			s = getPluginLink(projectId);
+			
+		} catch (Exception e) {
+			
+			log.warn("Exception in plugin (getPluginLink)" + id + 
+												"\nCause: " + e.getMessage());	
+		}
+		
+		return s;
+	}
+	
+	/** For the given project returns link associated with this plugin and project.
+	 * Should be overrided inside plugins that have some links associated with projects.
+	 */
+	protected String getPluginLink(String projectId) {
+		return null;
+	}
+	
+	/** For the given project returns name of link associated with this plugin
+	 * or null if projects have not any link associated with this plugin.
+	 */
+	public final String getLinkName() {
+		
+		String s = null;
+		
+		try {
+		
+			s = getPluginLinkName();
+			
+		} catch (Exception e) {
+			
+			log.warn("Exception in plugin (getPluginLinkName)" + id + 
+												"\nCause: " + e.getMessage());	
+		}
+		
+		return s;
+	}
+	
+	/** For the given project returns name of link associated with this plugin
+	 * or null if projects have not any link associated with this plugin.
+	 * This method should be overrided inside plugins that have some links associated with projects.
+	 */
+	protected String getPluginLinkName() {
+		return null;
+	}
+	
+	/**
+	 * For the given project returns it's rate.
+	 * Rate is computed as project's score share in
+	 * sum of all scores. 
+	 * 
+	 * @param projectId project id
+	 * @return rate computed by plugin for the project
+	 * with the given <code>projectId</code>.
+	 */
+	public final int getRate(String projectId) {
+				
+		long totalScore = getTotalScore();
+			
+		if (totalScore == 0) {
+			return 0;
+		}
+		
+		float r = ((float) getValue(projectId) / (float) totalScore);
+		
+		return (int) (100.0 * r);
+	}
+
+	/**
+	 * @return plugin id
+	 */
+	public final String getId() { return id; };
+
+	private long getTotalScore() {
+		
+		Set<String> projectIds = projects.getProjectIds(
+									new NullPermissionsChecker(), null);
+		
+		long s = 0;
+		
+		for (String projectId : projectIds) {
+			s += getValue(projectId);
+		}
+		
+		return s;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcBrokenBuildsPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcBrokenBuildsPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcBrokenBuildsPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,36 @@
+/*
+ * 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.service.plugins.cc;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+*/
+
+public class CcBrokenBuildsPlugin extends CcBuildsPlugin {
+
+	@Override
+	protected String getPattern() {
+		
+		return "Number of Broken Builds";
+	}	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcBuildAttemptsPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcBuildAttemptsPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcBuildAttemptsPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,36 @@
+/*
+ * 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.service.plugins.cc;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+*/
+
+public class CcBuildAttemptsPlugin extends CcBuildsPlugin {
+
+	@Override
+	protected String getPattern() {
+		
+		return "Number of Build Attempts";
+	}
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcBuildsPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcBuildsPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcBuildsPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,131 @@
+/*
+ * 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.service.plugins.cc;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.jboss.forge.status.service.plugins.Plugin;
+import org.jboss.logging.Logger;
+
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+*/
+
+public abstract class CcBuildsPlugin extends Plugin {
+
+	
+	protected abstract String getPattern();
+	
+	protected Logger log = Logger.getLogger(CcBuildsPlugin.class);
+	
+	protected Map<String,Long> cachedValues = new HashMap<String,Long>();
+	
+	@Override
+	public long getPluginValue(String projectId) {
+		
+		if (cachedValues.containsKey(projectId)) {
+			
+			return cachedValues.get(projectId);
+		}
+		
+		List<String> URLs = CcStatusPlugin.getCcURLs(projects, projectId);
+		
+		if (URLs == null) {
+			
+			cachedValues.put(projectId, (long) 0);
+			return 0;
+		}
+		
+		long v = 0;
+		
+		for (String url : URLs) {
+			
+			v += get(url);
+		}
+		
+		cachedValues.put(projectId, v);
+		
+		return v;
+	}
+
+	private long get(String urlString) {
+		
+		urlString = urlString.concat("?tab=metrics");
+		
+		URL url;
+		String string;
+		StringBuilder stringBuilder = new StringBuilder();
+		
+		try {
+			url = new URL(urlString);
+			
+			InputStream is = url.openStream();
+			BufferedReader in = new BufferedReader(new InputStreamReader(is));
+			
+			String decodedString;
+			
+			while ((decodedString = in.readLine()) != null) {
+				
+				stringBuilder.append(decodedString);
+			    
+			}
+			
+			in.close();
+			
+		} catch (IOException e) {
+			
+			log.warn("Could not obtain statistics from " + urlString
+								+ "\nCause: " + e.getMessage());
+			
+			return 0;
+		}
+		
+		string = stringBuilder.toString();
+		
+		Pattern pattern = Pattern.compile("<tr><td>" + getPattern() +
+												"</td><td>([0-9]*)</td></tr>");
+
+	    Matcher matcher = pattern.matcher(string);
+	    
+	    if (!matcher.find()) { 
+        	
+	    	return 0;
+	    }
+	    
+	    String resString = matcher.group(1);
+		
+		return Long.parseLong(resString);
+		
+	}	
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcStatusPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcStatusPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,126 @@
+/*
+ * 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.service.plugins.cc;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.net.MalformedURLException;
+
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.status.common.Tags;
+import org.jboss.forge.status.common.tools.Tools;
+import org.jboss.forge.status.service.plugins.KosmosStatusPlugin;
+import org.jboss.logging.Logger;
+
+import com.caucho.hessian.client.HessianProxyFactory;
+
+import hu.midori.kosmos.model.CcProject;
+import hu.midori.kosmos.protocol.CcService;
+
+/**
+* @author Pawel Wrzeszcz
+* Superclass for plugins affecting CruiseControl.
+*/
+
+public abstract class CcStatusPlugin extends KosmosStatusPlugin {
+	
+	private static final String CC_LINK_NAME 		= "CruiseControl location";
+
+	@Override
+	protected String getKosmosServiceTag() {
+		return Tags.CC_SERVICE_PROPERTY;
+	};
+	
+	protected Logger log;
+	
+	public CcStatusPlugin() {
+		super();
+		
+		log = Logger.getLogger(this.getClass());
+	}
+	
+	@Override
+	protected List<CcProject> getProjectServices(String projectId) {
+		
+		// Get project cc URLs
+	    List<String> ccURLs = getCcURLs(projects, projectId);
+		
+	    if ((ccURLs == null) || (ccURLs.isEmpty())) {
+	    	return null;
+		}
+		
+		// Connect to the kosmos service
+		HessianProxyFactory factory = new HessianProxyFactory();
+		CcService service;
+		
+		try {
+			service = (CcService) factory.create(CcService.class, serviceURL);
+		} catch (MalformedURLException e) {
+			log.error("Can not connect to kosmos cc service: " + serviceURL +
+					"\nCause: " + e.getMessage());
+			return null;
+		}
+		    
+
+		List<CcProject> stats = new ArrayList<CcProject>();
+		
+		for (String ccURL : ccURLs) {
+		
+			//	Get map with the cc statistics
+			try {
+				stats.addAll(service.getProjects(ccURL));
+			} catch (Exception e) {
+				log.warn("Can not analyze cc: " + ccURL + 
+												"\nCause:" + e.getMessage());
+			}
+		}
+		
+		return (stats.isEmpty() ? null : stats);
+	}
+
+
+	public static List<String> getCcURLs(Projects projects, String projectId) {
+		
+		String ccURLsString =
+				projects.getProjectProperty(projectId, Tags.CC_ADRESS_TAG);
+		
+		if (ccURLsString == "") {
+			return null; 
+		}
+	
+		return Tools.getCommaSeparatedStrings(ccURLsString);
+	}
+	
+	@Override
+	public String getPluginLink(String projectId) {
+		
+		List<String> ccURLsString = getCcURLs(projects, projectId);
+		
+		return (ccURLsString == null) ? null : ccURLsString.get(0);
+	}
+
+	@Override
+	public String getPluginLinkName() {
+		return CC_LINK_NAME;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcSuccessfulBuildsPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcSuccessfulBuildsPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/CcSuccessfulBuildsPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,36 @@
+/*
+ * 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.service.plugins.cc;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+*/
+
+public class CcSuccessfulBuildsPlugin extends CcBuildsPlugin {
+
+	@Override
+	protected String getPattern() {
+		
+		return "Number of Successful Builds";
+	}
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/ErrorsStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/ErrorsStatusPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/ErrorsStatusPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,46 @@
+/*
+ * 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.service.plugins.cc;
+
+import hu.midori.kosmos.model.CcProject;
+
+/**
+* @author Pawel Wrzeszcz
+* The plugin provides number of errors occured in the project latest CruiseControl build
+*/
+
+public class ErrorsStatusPlugin extends CcStatusPlugin {
+
+	@Override
+	protected int getPluginSpecyficValue(Object ccProject) {
+		
+		CcProject ccPrj = (CcProject) ccProject;
+		return ccPrj.getErrors();
+	}
+
+	@Override
+	protected int getPluginSpecyficDefaultValue() {
+		return 0;
+	}
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/TestsStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/TestsStatusPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/cc/TestsStatusPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,46 @@
+/*
+ * 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.service.plugins.cc;
+
+import hu.midori.kosmos.model.CcProject;
+
+
+/**
+* @author Pawel Wrzeszcz
+* The plugin provides number of tests in the last project CruiseControl build.
+*/
+
+public class TestsStatusPlugin extends CcStatusPlugin {
+
+	@Override
+	protected int getPluginSpecyficValue(Object ccProject) {
+		CcProject ccPrj = (CcProject) ccProject;
+		return ccPrj.getTests();
+	}
+
+	@Override
+	protected int getPluginSpecyficDefaultValue() {
+		return 0;
+	}
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/AddedCodeLinesPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/AddedCodeLinesPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/AddedCodeLinesPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,80 @@
+/*
+ * 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.service.plugins.codelines;
+
+import java.util.Properties;
+
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.status.common.Tags;
+import org.jboss.forge.status.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.status.common.protocol.ScoresManager;
+import org.jboss.forge.status.common.tools.Plugins;
+
+/**
+* @author Pawel Wrzeszcz
+* Plugin returns number of lines of code added recently
+* to project svn repository within specified number of days.
+*/
+
+public class AddedCodeLinesPlugin extends CodeLinesPlugin {
+
+	private int days;
+	
+	@Override
+	public void init(String id, String portalName, Projects projects,
+									Plugins plugins, Properties properties, ScoresManager scoresManager)
+									throws InvalidPluginPropertiesException {
+		
+		if (properties == null ) {
+			throw new InvalidPluginPropertiesException(
+								"Missing properties.");
+		}
+		
+		String daysString = properties.getProperty(Tags.DAYS_TAG);
+		
+		if (daysString == null) {
+			throw new InvalidPluginPropertiesException(
+											"Missing \'days\' property.");
+		}
+		
+		days = Integer.parseInt(daysString);
+	
+		super.init(id, portalName, projects, plugins, properties, scoresManager);
+	}
+	
+	@Override
+	protected long getPluginValue(String url, String userName, String password) {
+	
+		long ret = 0;
+		
+		if ((userName != null) && (password != null)) {
+			ret = CodeLinesEvaluator.
+							getAddedCodeLines(url, userName, password, days);
+		} else {
+			ret = CodeLinesEvaluator.getAddedCodeLines(url, days);
+		}
+		
+		return Math.max(ret,0); // Do not report decrease of number of lines??
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/CheckOutEditor.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/CheckOutEditor.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/CheckOutEditor.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,202 @@
+/*
+ * 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.service.plugins.codelines;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.LineNumberReader;
+import java.io.OutputStream;
+import java.io.RandomAccessFile;
+
+import org.jboss.logging.Logger;
+import org.tmatesoft.svn.core.SVNCommitInfo;
+import org.tmatesoft.svn.core.SVNErrorCode;
+import org.tmatesoft.svn.core.SVNErrorMessage;
+import org.tmatesoft.svn.core.SVNException;
+import org.tmatesoft.svn.core.SVNProperty;
+import org.tmatesoft.svn.core.io.ISVNEditor;
+import org.tmatesoft.svn.core.io.diff.SVNDeltaProcessor;
+import org.tmatesoft.svn.core.io.diff.SVNDiffWindow;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz [at] jboss . com)
+*/
+
+public class CheckOutEditor implements ISVNEditor {
+
+	private long codeLines;
+	
+	private boolean isTextMimeType;
+
+	private SVNDeltaProcessor myDeltaProcessor;
+	
+	private File file;
+	
+	private Logger log;
+	
+	
+	public CheckOutEditor() {
+		
+		myDeltaProcessor = new SVNDeltaProcessor();
+		
+		log = Logger.getLogger(CheckOutEditor.class);
+		
+		try {
+			file = File.createTempFile("labsTempFileJMM", "CodeLinesEvaluator");
+		} catch (IOException e) {
+
+			log.error("Can't create temp file," +
+											"\nCause: " + e.getMessage());
+		}
+	}
+	
+	public long getCodeLines() {
+		
+		return codeLines;
+	}
+	
+	
+	/* Editor methods */
+
+	public void targetRevision(long arg0) throws SVNException {
+		
+		codeLines = 0;
+	}
+
+	
+	public void addFile(String path, String copyFromPath, long copyFromRevision)
+			throws SVNException {
+		
+		log.debug("File: " + path);
+		
+		isTextMimeType = true;
+	}
+
+	public void changeFileProperty(String path, String name, String value) 
+			throws SVNException {
+		
+		if (name.equals(SVNProperty.MIME_TYPE)) {
+					
+			isTextMimeType = value.startsWith("text/");
+		}
+	}
+
+	public void applyTextDelta(String path, String baseChecksum)
+														throws SVNException {
+		
+		if (!isTextMimeType) {
+			return;
+		}
+		
+		truncateFile(file);
+		
+		myDeltaProcessor.applyTextDelta(null, file, false);
+	}
+
+	private void truncateFile(File file) throws SVNException {
+		
+		try {
+			
+			RandomAccessFile f = new RandomAccessFile(file, "rw");
+			f.setLength(0);
+			
+		} catch (IOException e) {
+			
+			log.warn("Can't truncate file", e);
+			
+			throw new SVNException(SVNErrorMessage.
+											create(SVNErrorCode.UNKNOWN),e);
+		}
+	}
+
+	public OutputStream textDeltaChunk(String path, SVNDiffWindow diffWindow) 
+			throws SVNException {
+		
+		if (!isTextMimeType) {
+			return null;
+		}
+		
+		return myDeltaProcessor.textDeltaChunk(diffWindow);
+	}
+
+	public void textDeltaEnd(String path) throws SVNException {
+
+		if (!isTextMimeType) {
+			return;
+		}
+		
+		myDeltaProcessor.textDeltaEnd();
+		
+		FileReader fileReader;
+		try {
+			
+			fileReader = new FileReader(file);
+			LineNumberReader lnReader = new LineNumberReader(fileReader);
+			lnReader.skip(file.length());
+			
+			codeLines += lnReader.getLineNumber();
+			
+			log.debug("File: " + path + ". Number of code lines: "
+											+ lnReader.getLineNumber() + ".");
+			
+		} catch (Exception e) {
+			
+			throw new SVNException(SVNErrorMessage.
+											create(SVNErrorCode.UNKNOWN),e);
+		}
+
+		
+		file.delete();
+	}
+
+	/* Empty methods */
+	
+	public void abortEdit() throws SVNException {}
+
+	public void absentDir(String arg0) throws SVNException {}
+
+	public void absentFile(String arg0) throws SVNException {}
+
+	public void addDir(String arg0, String arg1, long arg2)
+														throws SVNException {}
+	
+	public void changeDirProperty(String arg0, String arg1) throws SVNException {}
+
+	public void closeDir() throws SVNException {}
+	
+	public void closeFile(String arg0, String arg1) throws SVNException {}
+
+	public SVNCommitInfo closeEdit() throws SVNException {
+		
+		return null;
+	}
+
+	public void deleteEntry(String arg0, long arg1) throws SVNException {}
+
+	public void openDir(String arg0, long arg1) throws SVNException {}
+
+	public void openFile(String arg0, long arg1) throws SVNException {}
+	
+	public void openRoot(long arg0) throws SVNException {}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/CodeLinesEvaluator.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/CodeLinesEvaluator.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/CodeLinesEvaluator.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,398 @@
+/*
+ * 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.service.plugins.codelines;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+import java.util.HashMap;
+
+
+import org.jboss.logging.Logger;
+import org.tmatesoft.svn.core.SVNDirEntry;
+import org.tmatesoft.svn.core.SVNException;
+import org.tmatesoft.svn.core.SVNNodeKind;
+import org.tmatesoft.svn.core.SVNProperty;
+import org.tmatesoft.svn.core.SVNURL;
+import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager;
+import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory;
+import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl;
+import org.tmatesoft.svn.core.io.SVNRepository;
+import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
+import org.tmatesoft.svn.core.wc.SVNDiffClient;
+import org.tmatesoft.svn.core.wc.SVNRevision;
+import org.tmatesoft.svn.core.wc.SVNWCUtil;
+
+/**
+* @author Pawel Wrzeszcz
+* A class providing information about number of code lines in SVN repository files.
+*/
+
+public class CodeLinesEvaluator {
+	
+	private static Logger log = Logger.getLogger(CodeLinesEvaluator.class);
+	
+	private static CheckOutEditor editor = new CheckOutEditor();
+
+	/**
+	 * Evaluates number of code lines in files located in secure SVN repository.
+	 * 
+	 * @param url SVN repository adress
+	 * @param userName user's name used in authorisation 
+	 * @param password user's password used in authorisation
+	 * @return number of code lines
+	 */
+	public static long getCodeLinesNumber(String url, String userName, String password) {
+		
+		SVNRepository repository = getRepository(url, userName, password);
+		
+        return (repository != null) ? getCodeLinesNumber(repository, "") : 0;
+	}
+	
+	/**
+	 * Evaluates number of code lines in files located in secure SVN repository.
+	 * 
+	 * @param url SVN repository adress
+	 * @param userName user's name used in authorisation 
+	 * @param password user's password used in authorisation
+	 * @return number of code lines
+	 * @throws SVNException 
+	 */
+	public static long getCodeLinesNumberFast(String url, String userName,
+										String password) throws SVNException {
+		
+		SVNRepository repository = getRepository(url, userName, password);
+	
+		repository.checkout(SVNRevision.HEAD.getNumber(), "", true, editor);
+        
+        return editor.getCodeLines();
+	}
+
+
+	/**
+	 * Evaluates number of code lines in files located in anonymus SVN repository.
+	 * 
+	 * @param url SVN repository adress
+	 * @return number of code lines
+	 */
+	public static long getCodeLinesNumber(String url) {
+		return getCodeLinesNumber(url, "anonymous", "anonymus");
+	}
+	
+	/**
+	 * Evaluates number of code lines in files located in anonymus SVN repository.
+	 * 
+	 * @param url SVN repository adress
+	 * @return number of code lines
+	 * @throws SVNException 
+	 */
+	public static long getCodeLinesNumberFast(String url) throws SVNException {
+		return getCodeLinesNumberFast(url, "anonymus", "anonymus");
+	}
+	
+	/**
+	 * Evaluates number of code lines added to recently repository
+	 * within specified number of days.
+	 * 
+	 * @param url SVN repository adress
+	 * @param userName user's name used in authorisation 
+	 * @param password user's password used in authorisation
+	 * @param days
+	 * @return number of code lines
+	 */
+	public static long getAddedCodeLines(String url, String userName,
+												String password, int days) {
+		
+		SVNRepository repository = getRepository(url, userName, password);
+		
+        return (repository != null) ?
+        					getAddedCodeLines(repository, "", days) : 0;
+	}
+
+	
+	/**
+	 * Evaluates number of code lines added recently to anonymus SVN repository
+	 * within specified number of days.
+	 * 
+	 * @param url SVN repository adress
+	 * @param days
+	 * @return number of code lines
+	 */
+	public static long getAddedCodeLines(String url, int days) {
+		return getAddedCodeLines(url, "anonymous", "anonymus", days);
+	}
+	
+	/**
+	 * Performs necessary initialization and connects to the repository.
+	 * 
+	 * @param url SVN repository adress
+	 * @param userName user's name used in authorisation 
+	 * @param password user's password used in authorisatio
+	 * @return SVNRepository from the given adress or null if connection was refused 
+	 */
+	private static SVNRepository getRepository(String url, String userName, String password) {
+		
+		setupLibrary();
+		
+		/* Connect to svn repository */
+        SVNRepository repository = connect(url);
+        if (repository == null)
+        	return null;
+
+        /* Authentication handling */
+        ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(userName, password);
+    	repository.setAuthenticationManager(authManager);
+        
+        return repository;
+	}
+	
+	/**
+	 * For the given repository evaluates number of code lines
+	 * in files located in <code>path</code>.
+	 * 
+	 * @param repository SVN repository adress
+	 * @param path path to SVN directory
+	 * @return number of code lines
+	 */
+	private static long getCodeLinesNumber(SVNRepository repository, String path) {
+		
+		log.debug("Analyzing " + path + ".");
+		
+		Collection<SVNDirEntry> dirEntries = getDirEntries(repository, path);
+		
+		if (dirEntries == null) {
+			return 0;
+		}
+		
+		long cl = 0;
+		
+		for (SVNDirEntry entry : dirEntries) {
+			
+			String entryPath = (path.equals("")) ?
+						entry.getName() : path + "/" + entry.getName();
+			
+			if (entry.getKind() == SVNNodeKind.FILE) {
+				cl += analyzeFile(repository, entryPath);
+			} else {
+				if (entry.getKind() == SVNNodeKind.DIR) {
+					cl += getCodeLinesNumber(repository, entryPath);
+				}
+			}
+		
+		}
+        
+        return cl;
+	}
+
+	/**
+	 * Evaluates number of code lines in a single file.
+	 * 
+	 * @param repository SVN repository adress
+	 * @param filePath path to the file to analyze
+	 * @return number of code lines
+	 */
+	private static long analyzeFile(SVNRepository repository, String filePath) {
+
+		long cl = 0;
+		
+		/* Get file */
+		Map<String,String> fileProperties = new HashMap<String,String>();
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		
+        try {
+            repository.getFile(filePath, -1, fileProperties, baos);
+        } catch (SVNException svne) {
+        	log.warn("Error while fetching the file properties: " +
+        			repository.getLocation().toString() + "/" + filePath +
+        			"\nCause:" + svne.getMessage());
+            return 0;
+        }
+        
+		/* Get file type */
+        String mimeType = (String) fileProperties.get(SVNProperty.MIME_TYPE);
+        boolean isTextType = SVNProperty.isTextMimeType(mimeType);
+ 
+        /* Count number of lines */
+        if (isTextType) {
+            cl = estimateCodeLinesNumber(baos.toString());
+        }
+        
+        return cl;
+	}
+
+	public static long estimateCodeLinesNumber(String string) {
+		
+		return string.split("\n").length;
+	}
+
+	/**
+	 * Returns SVN directory entries.
+	 * 
+	 * @param repository SVN repository adress
+	 * @param path SVN directory path
+	 * @return Collection of directory entries
+	 */
+	@SuppressWarnings("unchecked")
+	private static Collection<SVNDirEntry> getDirEntries(SVNRepository repository, String path) {
+		
+        Map fileProperties = new HashMap();
+        Collection<SVNDirEntry> dirEntries = null;
+        
+        try {
+			dirEntries = repository.getDir(path, -1, fileProperties, (Collection) null);
+		} catch (SVNException e) {
+			log.warn("Error fetching directory entries:" +
+					repository.getLocation().toString() + "/" + path +
+					"\nCause: " + e.getMessage());
+		} 
+		
+		return dirEntries;
+	}
+	
+	/**
+	 * For the given repository evaluates number of code lines
+	 * added during last <code>days</days> days in files located
+	 * in <code>path</code>.
+	 * 
+	 * @param repository SVN repository adress
+	 * @param path path to SVN directory
+	 * @param days
+	 * @return number of added code lines
+	 */
+	private static long getAddedCodeLines(SVNRepository repository,
+									String path, int days) {
+		
+		Calendar cal = Calendar.getInstance();
+		cal.add(Calendar.DAY_OF_MONTH, -days);
+		Date prevDate = cal.getTime();
+		
+		SVNRevision fromRev = SVNRevision.create(prevDate);
+		
+		long ret = 0;
+		
+		try {
+			ret = getAddedCodeLines(repository, path,
+											fromRev, SVNRevision.HEAD);
+		} catch (SVNException e) {
+			log.warn("Failed to evaluate added code lines." +
+									"\nCause: " + e.getMessage());
+		}
+		
+		return ret;
+	}
+	
+	/**
+	 * For the given repository evaluates number of code lines
+	 * added from <code>fromRev</code> revision to <code>toRev</code> revision
+	 * in <code>path</code>.
+	 * 
+	 * @param repository SVN repository adress
+	 * @param path path to SVN directory
+	 * @param fromRev
+	 * @param toRev
+	 * @return number of added code lines
+	 * @throws SVNException 
+	 */
+	private static long getAddedCodeLines(SVNRepository repository,
+									String path, SVNRevision fromRev,
+												 SVNRevision toRev)
+														throws SVNException {
+		long cl = 0;
+			
+		OutputStream baos = new ByteArrayOutputStream();
+			
+		ISVNAuthenticationManager authManager =
+						SVNWCUtil.createDefaultAuthenticationManager();
+			
+		SVNDiffClient diffClient = new SVNDiffClient(authManager,null);
+			
+		diffClient.doDiff(repository.getLocation(),
+						  SVNRevision.HEAD,
+						  fromRev,
+						  toRev,
+						  true,
+						  true,
+						  baos);
+			
+		String diffString = baos.toString();
+			
+		cl = getAddedLinesNumber(diffString);	
+        
+        return cl;
+	}
+
+	
+	/**
+	 * Computes number of added lines from string in "svn diff" format
+	 * 
+	 * @param diffString String in "svn diff" format
+	 * @return Number of added lines. Notice it might be below 0.
+	 */
+	private static long getAddedLinesNumber(String diffString) {
+		
+		long cl = 0;
+		
+		String[] lines = diffString.split("\n");
+		
+		for (String line : lines) {
+			
+			if (line.startsWith("+")) cl++;
+			if (line.startsWith("-")) cl--;
+		}
+		
+		return cl;
+	}
+	
+	/**
+	 * Establishes connection with SVN repository.
+	 * 
+	 * @param url SVN repository adress
+	 * @return SVN repository
+	 */
+	private static SVNRepository connect(String url) {
+		
+		SVNRepository repository = null;
+	    try {
+	    	repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url));
+	    } catch (SVNException svne) {
+	       	log.warn("Can not connect to the svn repository: " + url +
+	       			"\nCause: " + svne.getMessage());
+	        return null;
+	    }
+	    
+		return repository;
+	}		
+	
+	/**
+     * Initializes the library to work with a repository either via svn:// 
+     * (and svn+ssh://) or via http:// (and https://)
+     */
+    private static void setupLibrary() {
+        DAVRepositoryFactory.setup(); 	  /* for DAV (over http and https) */
+        SVNRepositoryFactoryImpl.setup(); /* for SVN (over svn and svn+ssh) */
+    }
+
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/CodeLinesPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/CodeLinesPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/CodeLinesPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,91 @@
+/*
+ * 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.service.plugins.codelines;
+
+import java.util.Map;
+import java.util.HashMap;
+
+import org.jboss.forge.common.projects.Repository;
+import org.jboss.forge.status.service.plugins.Plugin;
+import org.jboss.logging.Logger;
+
+/**
+* @author Pawel Wrzeszcz
+* Subclass for Plugin dealing with number of lines of code in project svn repository.
+*/
+
+public abstract class CodeLinesPlugin extends Plugin {
+	
+	/**
+	 * Subclass of <code>CodeLinesPlugin</code> should implement here
+	 * computing value specyfic to the plugin.
+	 * 
+	 * @param url SVN repository adress
+	 * @param userName user's name used in authorisation 
+	 * @param password user's password used in authorisation
+	 * @return value specyfit to the plugin
+	 */
+	protected abstract long getPluginValue(String url, String userName, String password); 
+	
+	/** Binds project ids with their values */
+	private Map<String,Long> cachedValues;
+	
+	protected Logger log = Logger.getLogger(CodeLinesPlugin.class);
+	
+	public CodeLinesPlugin() {
+		super();
+		cachedValues = new HashMap<String,Long>();
+	}
+	
+	@Override
+	public long getPluginValue(String projectId) {
+		
+		if (!cachedValues.containsKey(projectId)) {
+			
+			long cl = 0;
+			
+			Repository repo = projects.getProjectRepository(projectId);
+			
+			if (repo != null) {
+				
+				String url = repo.getLocation();
+				String userName = repo.getUsername();
+				String password = repo.getPassword();
+				
+				log.info("Analyzing repository " + url + 
+											" (project: " + projectId + ")..."); 
+				
+				cl = getPluginValue(url, userName, password);
+				
+				log.info("Project: " + projectId  + " plugin: " + id + 
+															" score: " + cl);
+				
+				cachedValues.put(projectId, new Long(cl));
+			}
+		}
+		
+		Long value = cachedValues.get(projectId);
+	
+		return value == null ? 0 : value.longValue();
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/CodeLinesTotalPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/CodeLinesTotalPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/CodeLinesTotalPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,54 @@
+/*
+ * 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.service.plugins.codelines;
+
+import org.tmatesoft.svn.core.SVNException;
+
+/**
+* @author Pawel Wrzeszcz
+* Plugin returns total number of lines of code in project svn repository.
+*/
+
+public class CodeLinesTotalPlugin extends CodeLinesPlugin {
+	
+	@Override
+	protected long getPluginValue(String url, String userName, String password) {
+		
+		if ((userName != null) && (password != null)) {
+			return CodeLinesEvaluator.getCodeLinesNumber(url, userName, password);
+		}
+		
+		long cl = 0;
+		
+		try {
+			cl = CodeLinesEvaluator.getCodeLinesNumberFast(url);
+		} catch (SVNException e) {
+			
+			log.warn("Unable to evaluate number of code lines. URL: " + url
+											+ "\nCause: " + e.getMessage());
+		}
+		
+		return cl;
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/SlowCodeLinesTotalPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/SlowCodeLinesTotalPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/codelines/SlowCodeLinesTotalPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,42 @@
+/*
+ * 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.service.plugins.codelines;
+
+/**
+* @author Pawel Wrzeszcz
+* Plugin returns total number of lines of code in project svn repository.
+*/
+
+public class SlowCodeLinesTotalPlugin extends CodeLinesPlugin {
+
+	@Override
+	protected long getPluginValue(String url, String userName, String password) {
+		
+		if ((userName != null) && (password != null)) {
+			return CodeLinesEvaluator.getCodeLinesNumber(url, userName, password);
+		}
+		
+		return CodeLinesEvaluator.getCodeLinesNumber(url);
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/jira/ClosedIssuesStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/jira/ClosedIssuesStatusPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/jira/ClosedIssuesStatusPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,47 @@
+/*
+ * 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.service.plugins.jira;
+
+import hu.midori.kosmos.model.JiraProject;
+
+
+/**
+* @author Pawel Wrzeszcz
+* The plugin provides number of closed issues in the project's JIRA.
+*/
+
+public class ClosedIssuesStatusPlugin extends JiraStatusPlugin {
+
+	@Override
+	protected int getPluginSpecyficValue(Object jiraProject) {
+		
+		JiraProject jp = (JiraProject) jiraProject;
+		return jp.getClosedIssues();
+	}
+
+	@Override
+	protected int getPluginSpecyficDefaultValue() {
+		return 0;
+	}
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/jira/JiraStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/jira/JiraStatusPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/jira/JiraStatusPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,115 @@
+/*
+ * 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.service.plugins.jira;
+
+import java.util.List;
+import java.net.MalformedURLException;
+
+import org.jboss.forge.common.projects.IssueTracker;
+import org.jboss.forge.status.common.Tags;
+import org.jboss.forge.status.service.plugins.KosmosStatusPlugin;
+import org.jboss.logging.Logger;
+
+import com.caucho.hessian.client.HessianProxyFactory;
+
+import hu.midori.kosmos.model.JiraProject;
+import hu.midori.kosmos.protocol.JiraService;
+
+/**
+* @author Pawel Wrzeszcz
+* Superclass for plugins affecting JIRA issue tracking system.
+*/
+
+public abstract class JiraStatusPlugin extends KosmosStatusPlugin {
+	
+	private static final String JIRA_LINK_NAME = "JIRA location";
+
+	protected String getKosmosServiceTag() {
+		return Tags.JIRA_SERVICE_PROPERTY;
+	};
+	
+	protected Logger log;
+	
+	public JiraStatusPlugin() {
+		super();
+		
+		log = Logger.getLogger(this.getClass());
+	}
+
+	@Override
+	protected List<JiraProject> getProjectServices(String projectId) {
+		
+		// Get project jira URL
+	    String jiraURL = getJiraURL(projectId);
+		
+	    if (jiraURL == null) {
+	    	return null;
+		}
+		
+		// Connect to kosmos service
+		HessianProxyFactory factory = new HessianProxyFactory();
+		JiraService service;
+		
+		try {
+			service = (JiraService) factory.create(JiraService.class, serviceURL);
+		} catch (MalformedURLException e) {
+			log.error("Can not connect to kosmos jira service: " + serviceURL
+												+ "\nCause: " + e.getMessage());
+			return null;
+		}
+		    
+		// Get map with jira statistics
+		List<JiraProject> projects = null;
+		try {
+			projects = service.getProjects(jiraURL);
+		} catch (Exception e) {
+			log.error("Can not analyze jira: " + jiraURL + 
+												"\nCause: " + e.getMessage());
+			return null;
+		}
+		
+		return projects;
+	}
+
+
+	private String getJiraURL(String projectId) {
+		IssueTracker it = projects.getProjectIssueTracker(projectId);
+		
+		if ((it == null)
+				|| (it.getType() != IssueTracker.JIRA_ISSUE_TRACKER)) {
+			return null;
+		}
+		
+		return it.getLocation();
+	}
+	
+	@Override
+	public String getPluginLink(String projectId) {
+		return getJiraURL(projectId);
+	}
+	
+	@Override
+	public String getPluginLinkName() {
+		return JIRA_LINK_NAME;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/jira/OpenIssuesStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/jira/OpenIssuesStatusPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/jira/OpenIssuesStatusPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,47 @@
+/*
+ * 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.service.plugins.jira;
+
+import hu.midori.kosmos.model.JiraProject;
+
+
+/**
+* @author Pawel Wrzeszcz
+* The plugin provides number of open issues in the project's JIRA.
+*/
+
+public class OpenIssuesStatusPlugin extends JiraStatusPlugin {
+
+	@Override
+	protected int getPluginSpecyficValue(Object jiraProject) {
+		
+		JiraProject jp = (JiraProject) jiraProject;
+		return jp.getOpenIssues();
+	}
+
+	@Override
+	protected int getPluginSpecyficDefaultValue() {
+		return 0;
+	}
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/jira/ResolvedIssuesStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/jira/ResolvedIssuesStatusPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/jira/ResolvedIssuesStatusPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,47 @@
+/*
+ * 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.service.plugins.jira;
+
+import hu.midori.kosmos.model.JiraProject;
+
+
+/**
+* @author Pawel Wrzeszcz
+* The plugin provides number of resolved issues in the project's JIRA.
+*/
+
+public class ResolvedIssuesStatusPlugin extends JiraStatusPlugin {
+
+	@Override
+	protected int getPluginSpecyficValue(Object jiraProject) {
+		
+		JiraProject jp = (JiraProject) jiraProject;
+		return jp.getResolvedIssues();
+	}
+
+	@Override
+	protected int getPluginSpecyficDefaultValue() {
+		return 0;
+	}
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/AddPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/AddPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/AddPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,40 @@
+/*
+ * 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.service.plugins.math;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz [at] jboss . com)
+*/
+
+public class AddPlugin extends MathPlugin {
+
+	@Override
+	public long getPluginValue(String projectId) {
+		
+		long v1 = plugin1.getValue(projectId);
+		long v2 = plugin2.getValue(projectId);		
+		
+		return (v1 + v2);
+		
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/ConstPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/ConstPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/ConstPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,64 @@
+/*
+ * 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.service.plugins.math;
+
+import java.util.Properties;
+
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.status.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.status.common.protocol.ScoresManager;
+import org.jboss.forge.status.common.tools.Plugins;
+import org.jboss.forge.status.service.plugins.Plugin;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz [at] jboss . com)
+*/
+
+public class ConstPlugin extends Plugin {
+
+	private long value;
+	
+	@Override
+	public void init(String id, String portalName, Projects projects,
+		   Plugins plugins, Properties properties, ScoresManager scoresManager)
+								throws InvalidPluginPropertiesException {
+		
+		if ((properties == null) || (!properties.contains("value")) ){
+			throw new InvalidPluginPropertiesException(
+										"Missing plugin property.");		
+		}
+		
+		String valueString = properties.getProperty("value");
+			
+		value = Long.parseLong(valueString);
+		
+		super.init(id, portalName, projects, plugins,
+												properties, scoresManager);
+	}	
+	
+	@Override
+	public long getPluginValue(String projectId) {
+		
+		return value;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/DivPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/DivPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/DivPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,45 @@
+/*
+ * 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.service.plugins.math;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz [at] jboss . com)
+*/
+
+public class DivPlugin extends MathPlugin {
+
+	@Override
+	public long getPluginValue(String projectId) {
+		
+		long v2 = plugin2.getValue(projectId);
+		
+		if (v2 == 0) {
+			return 0;
+		}
+		
+		long v1 = plugin1.getValue(projectId);
+		
+		return (v1 / v2);
+		
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/LastNDaysStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/LastNDaysStatusPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/LastNDaysStatusPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,99 @@
+/*
+ * 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.service.plugins.math;
+
+import java.util.Calendar;
+import java.util.Properties;
+
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.status.common.Tags;
+import org.jboss.forge.status.common.exceptions.GetScoresException;
+import org.jboss.forge.status.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.status.common.protocol.ScoresManager;
+import org.jboss.forge.status.common.tools.Plugins;
+import org.jboss.forge.status.service.plugins.Plugin;
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz at gmail.com)
+* This plugin measures deltas in other plugin scores in a 7 days time.
+*/
+
+public class LastNDaysStatusPlugin extends Plugin {
+	
+	private Plugin insidePlugin;
+	private int days;
+	
+	@Override
+	public void init(String id, String portalName, Projects projects,
+			Plugins plugins, Properties properties, ScoresManager scoresManager)
+								throws InvalidPluginPropertiesException {
+		
+		if (properties == null) {
+			throw new InvalidPluginPropertiesException(
+												"Missing plugin property.");
+		}
+		
+		String insidePluginId = properties.getProperty(Tags.PLUGIN_TAG);
+		if (insidePluginId == null) {
+			throw new InvalidPluginPropertiesException(
+									"Missing \"plugin\" property.");
+		}
+		
+		insidePlugin = plugins.get(insidePluginId);
+		
+		if (insidePlugin == null) {
+			throw new InvalidPluginPropertiesException(
+								"Plugin " + insidePluginId + " not found.");
+		}
+		
+		String daysString = properties.getProperty(Tags.DAYS_TAG);
+		if (daysString == null) {
+			throw new InvalidPluginPropertiesException(
+									"Missing \"days\" property.");
+		}
+		days = Integer.parseInt(daysString);
+		
+		super.init(id, portalName, projects, plugins, properties, scoresManager);
+	}
+
+	@Override
+	public long getPluginValue(String projectId) {
+		
+		long currentValue = insidePlugin.getValue(projectId);
+		long prevValue = 0;
+	
+		Calendar now = Calendar.getInstance();
+		
+		Calendar cal = Calendar.getInstance();
+		cal.add(Calendar.DAY_OF_MONTH,-days);
+		
+		try {
+			prevValue = scoresManager.getValue(
+					insidePlugin.getId(), projectId, cal, now);
+		} catch (GetScoresException e) {
+			return 0;
+		}
+		
+		return (currentValue - prevValue);
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/MathPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/MathPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/MathPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,75 @@
+/*
+ * 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.service.plugins.math;
+
+import java.util.Properties;
+
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.status.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.status.common.protocol.ScoresManager;
+import org.jboss.forge.status.common.tools.Plugins;
+import org.jboss.forge.status.service.plugins.Plugin;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz [at] jboss . com)
+*/
+
+public abstract class MathPlugin extends Plugin {
+	
+	protected Plugin plugin1;
+	protected Plugin plugin2;
+	
+	@Override
+	public void init(String id, String portalName, Projects projects,
+		   Plugins plugins, Properties properties, ScoresManager scoresManager)
+								throws InvalidPluginPropertiesException {
+		
+		if (properties == null) {
+			throw new InvalidPluginPropertiesException(
+										"Missing plugin properties.");		
+		}
+		
+		String plugin1Id = properties.getProperty("plugin1");
+		String plugin2Id = properties.getProperty("plugin2");
+	
+		if ((plugin1Id == null) || (plugin2Id == null)) {
+			throw new InvalidPluginPropertiesException(
+										"Invalid plugin properties.");
+		}	
+		
+		plugin1 = plugins.get(plugin1Id);
+		plugin2 = plugins.get(plugin2Id);
+		
+		if ((plugin1 == null) || (plugin2 == null)) {
+			
+			throw new InvalidPluginPropertiesException(
+					"Invalid plugin properties. Plugin " +
+					(plugin1 == null ? plugin1Id : plugin2Id) + 
+					" does not exist.");
+		}
+		
+		super.init(id, portalName, projects, plugins,
+												properties, scoresManager);
+	}	
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/MulPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/MulPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/MulPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,40 @@
+/*
+ * 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.service.plugins.math;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz [at] jboss . com)
+*/
+
+public class MulPlugin extends MathPlugin {
+
+	@Override
+	public long getPluginValue(String projectId) {
+		
+		long v1 = plugin1.getValue(projectId);
+		long v2 = plugin2.getValue(projectId);
+		
+		return (v1 * v2);
+		
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/RandomPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/RandomPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/RandomPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,66 @@
+/*
+ * 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.service.plugins.math;
+
+import java.util.Properties;
+import java.util.Random;
+
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.status.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.status.common.protocol.ScoresManager;
+import org.jboss.forge.status.common.tools.Plugins;
+import org.jboss.forge.status.service.plugins.Plugin;
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz at gmail.com)
+*/
+
+public class RandomPlugin extends Plugin {
+	
+	private int maxValue;
+	private Random random;
+	
+	private static final int RANDOM_DEFAULT_MAX_VALUE = 1024;
+	
+	@Override
+	public void init(String id, String portalName, Projects projects,
+			Plugins plugins, Properties properties, ScoresManager scoresManager)
+								throws InvalidPluginPropertiesException {
+		
+		maxValue = RANDOM_DEFAULT_MAX_VALUE;
+		
+		if ((properties != null) && (properties.containsKey("max-value"))) {
+			maxValue = Integer.parseInt(properties.getProperty("max-value"));
+		}
+		
+		random = new Random();
+		
+		super.init(id, portalName, projects, plugins, properties, scoresManager);
+	}
+
+	@Override
+	public long getPluginValue(String projectId) {
+		
+		return random.nextInt(maxValue);
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/WeightedScorePlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/WeightedScorePlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/math/WeightedScorePlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,92 @@
+/*
+ * 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.service.plugins.math;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.status.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.status.common.protocol.ScoresManager;
+import org.jboss.forge.status.common.tools.Plugins;
+import org.jboss.forge.status.service.plugins.Plugin;
+
+/**
+ * This plugin gets weights from xml configuration file
+ * and sumarizes all the stats multiplying them firstly by those weights.
+ * 
+ * @author Ryszard Kozmik
+ * @author Pawel Wrzeszcz (pawel.wrzeszcz at gmail.com)
+ *
+ */
+public class WeightedScorePlugin extends Plugin {
+	
+	private Map<String,Float> properties;
+	
+	public WeightedScorePlugin() {
+		super();
+	}
+	
+	@Override
+	public void init(String id, String portalName, Projects projects,
+			Plugins plugins, Properties props, ScoresManager scoresManager)
+								throws InvalidPluginPropertiesException {
+		
+		super.init(id, portalName, projects, plugins, props, scoresManager);
+
+		properties = new Hashtable<String,Float>(props.size());
+		
+		for (Iterator iter = props.keySet().iterator(); iter.hasNext();) {
+			
+			String key = (String) iter.next();
+			
+			try {
+				Float value = Float.parseFloat(props.getProperty(key));
+				properties.put((String) key,value);
+			} catch (NumberFormatException e) {
+				throw new InvalidPluginPropertiesException(
+						"Incorrect weight format in xml descriptor: "
+						+ props.get(key));
+			}
+		}
+	}
+
+	public long getPluginValue(String projectId) {
+		
+		int total = 0;
+		
+		for (String pluginName : plugins.getPluginIds()) {
+			
+			Plugin plugin = plugins.get(pluginName);
+			
+			if (properties.containsKey(pluginName)) {
+				total += plugin.getValue(projectId)*properties.get(pluginName);
+			}
+		}
+		
+		return total; 
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/DownloadsPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/DownloadsPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/DownloadsPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,50 @@
+
+/*
+ * 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.service.plugins.productization;
+
+import org.jboss.forge.common.projects.DownloadCounterTools;
+import org.jboss.forge.status.service.plugins.Plugin;
+import org.jboss.shotoku.ContentManager;
+import org.jboss.shotoku.aop.Inject;
+
+/**
+ * This Plugin returns sum of all downloads for given project id name.
+ * @author Ryszard Kozmik
+ *
+ */
+public class DownloadsPlugin extends Plugin {
+
+	@Inject
+	ContentManager cm;
+	
+	public DownloadsPlugin() {
+		super();
+	}
+		
+	public long getPluginValue(String projectId) {
+		return DownloadCounterTools.
+				getOverallDownloadsForProject(projectId,portalName,cm);
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/JEMSIntegrationPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/JEMSIntegrationPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/JEMSIntegrationPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,65 @@
+/*
+ * 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.service.plugins.productization;
+
+import java.util.Iterator;
+
+import org.jboss.forge.common.projects.permissions.NullPermissionsChecker;
+import org.jboss.forge.status.service.plugins.Plugin;
+import org.jboss.portal.common.context.DelegateContext;
+
+/**
+* @author Pawel Wrzeszcz
+*/
+
+public class JEMSIntegrationPlugin extends Plugin {
+
+	@Override
+	public long getPluginValue(String projectId) {
+
+		//TODO temp workaround before we can use
+		//      List<String> org.jboss.forge.common.projects.test.Project.getJems()
+		DelegateContext projectContext =
+				projects.getProjectContext(
+									new NullPermissionsChecker(), projectId);
+		
+		Iterator it = projectContext.childIterator("jems");
+		
+		if (it == null) {
+			
+			return 0;
+		}
+		
+		int counter = 0;
+		
+		for (; it.hasNext(); ) {
+			
+			it.next();
+			counter++;
+		}
+		
+		return counter;
+	}
+	
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/PackagedForDownloadPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/PackagedForDownloadPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/PackagedForDownloadPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,48 @@
+/*
+ * 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.service.plugins.productization;
+
+import org.jboss.forge.common.projects.permissions.NullPermissionsChecker;
+import org.jboss.forge.status.service.plugins.Plugin;
+import org.jboss.portal.common.context.DelegateContext;
+
+
+/**
+* @author Pawel Wrzeszcz
+*/
+
+public class PackagedForDownloadPlugin extends Plugin {
+
+	@Override
+	public long getPluginValue(String projectId) {
+		
+		DelegateContext ds =
+			projects.getDownloadsContext(new NullPermissionsChecker(),
+										projectId, "");
+		
+		return (ds == null ? 0 : 1);
+		
+	}
+	
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/ProductizationPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/ProductizationPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/ProductizationPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,43 @@
+
+/*
+ * 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.service.plugins.productization;
+
+import org.jboss.forge.common.projects.test.Project;
+
+import org.jboss.forge.status.common.tools.Tools;
+import org.jboss.forge.status.service.plugins.Plugin;
+
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ * 
+ * Superclass for plugins providing productization metrics.
+ */
+public abstract class ProductizationPlugin extends Plugin {
+
+	protected Project getProject(String projectId) {
+		
+		return Tools.getProject(projectId);
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/docs/DifferentDocumentationSourcesPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/docs/DifferentDocumentationSourcesPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/docs/DifferentDocumentationSourcesPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,58 @@
+
+/*
+ * 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.service.plugins.productization.docs;
+
+import java.util.EnumSet;
+import java.util.List;
+import org.jboss.forge.common.projects.test.Documentation;
+import org.jboss.forge.common.projects.test.DocumentationType;
+
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ * 
+ * Evaluates number of different documentation types available for project.
+ */
+public class DifferentDocumentationSourcesPlugin extends DocumentationPlugin {
+
+	@Override
+	protected long getPluginValue(String projectId) {
+		
+		List<Documentation> docs = getDocumentation(projectId);
+		
+		if (docs == null) {
+			return 0;
+		}
+		
+		EnumSet<DocumentationType> docTypes =
+									EnumSet.noneOf(DocumentationType.class);
+		
+		for (Documentation d : docs) {
+			
+			docTypes.add(d.getType());
+		}
+		
+		return docTypes.size();
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/docs/DocumentationPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/docs/DocumentationPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/docs/DocumentationPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,47 @@
+
+/*
+ * 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.service.plugins.productization.docs;
+
+import java.util.List;
+
+import org.jboss.forge.common.projects.test.Documentation;
+import org.jboss.forge.common.projects.test.Project;
+import org.jboss.forge.status.service.plugins.productization.ProductizationPlugin;
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ */
+public abstract class DocumentationPlugin extends ProductizationPlugin {
+
+	protected List<Documentation> getDocumentation(String projectId) {
+		
+		Project project = getProject(projectId);
+		
+		if (project == null) {
+			return null;
+		}
+		
+		return project.getDocumentation();
+	}	
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/docs/DocumentationTypePlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/docs/DocumentationTypePlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/docs/DocumentationTypePlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,110 @@
+
+/*
+ * 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.service.plugins.productization.docs;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.common.projects.test.Documentation;
+import org.jboss.forge.common.projects.test.DocumentationType;
+
+import org.jboss.forge.status.common.Tags;
+import org.jboss.forge.status.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.status.common.protocol.ScoresManager;
+import org.jboss.forge.status.common.tools.Plugins;
+
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ */
+public class DocumentationTypePlugin extends DocumentationPlugin {
+
+	
+	private DocumentationType docType;
+	
+	@Override
+	public void init(String id, String portalName, Projects projects,
+			Plugins plugins, Properties properties, ScoresManager scoresManager)
+								throws InvalidPluginPropertiesException {
+		
+		if (properties == null) {
+			throw new InvalidPluginPropertiesException(
+												"Missing plugin property.");
+		}
+		
+		String docTypeString = properties.getProperty(Tags.DOC_TYPE_TAG);
+		if (docTypeString == null) {
+			throw new InvalidPluginPropertiesException(
+							"Missing " + Tags.DOC_TYPE_TAG + " property.");
+		}
+		
+		docType = getDocType(docTypeString);
+		if (docType == null) {
+			throw new InvalidPluginPropertiesException(
+						"No such decumentation type: " + docTypeString + ".");
+		}
+				
+		super.init(id, portalName, projects, plugins, properties, scoresManager);
+	}
+
+	
+	@Override
+	protected long getPluginValue(String projectId) {
+		
+		List<Documentation> docs = getDocumentation(projectId);
+		
+		if (docs == null) {
+			return 0;
+		}
+		
+		int counter = 0;
+		
+		for (Documentation d : docs) {
+			
+			if (d.getType().equals(docType)) {
+				counter++;
+			}
+		}
+		
+		return counter;
+	}
+
+
+	private DocumentationType getDocType(String docTypeString) {
+		
+		DocumentationType docType = null;
+		
+		try {
+		
+			docType = DocumentationType.fromValue(docTypeString);
+			
+		} catch (IllegalArgumentException e) {
+			
+			// Do nothing
+		}
+		
+		return docType;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/forums/DifferentForumsPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/forums/DifferentForumsPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/forums/DifferentForumsPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,57 @@
+
+/*
+ * 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.service.plugins.productization.forums;
+
+import java.util.EnumSet;
+import java.util.List;
+
+import org.jboss.forge.common.projects.test.Forum;
+import org.jboss.forge.common.projects.test.ForumType;
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ * 
+ * Evaluates number of different forum types available for project.
+ */
+public class DifferentForumsPlugin extends ForumsPlugin {
+
+	@Override
+	protected long getPluginValue(String projectId) {
+		
+		List<Forum> forums = getForums(projectId);
+		
+		if (forums == null) {
+			return 0;
+		}
+		
+		EnumSet<ForumType> forumTypes = EnumSet.noneOf(ForumType.class);
+		
+		for (Forum f : forums) {
+			
+			forumTypes.add(f.getType());
+		}
+		
+		return forumTypes.size();
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/forums/ForumTypePlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/forums/ForumTypePlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/forums/ForumTypePlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,109 @@
+
+/*
+ * 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.service.plugins.productization.forums;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.common.projects.test.Forum;
+import org.jboss.forge.common.projects.test.ForumType;
+import org.jboss.forge.status.common.Tags;
+import org.jboss.forge.status.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.status.common.protocol.ScoresManager;
+import org.jboss.forge.status.common.tools.Plugins;
+
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ */
+public class ForumTypePlugin extends ForumsPlugin {
+
+	
+	private ForumType forumType;
+	
+	@Override
+	public void init(String id, String portalName, Projects projects,
+			Plugins plugins, Properties properties, ScoresManager scoresManager)
+								throws InvalidPluginPropertiesException {
+		
+		if (properties == null) {
+			throw new InvalidPluginPropertiesException(
+												"Missing plugin property.");
+		}
+		
+		String forumTypeString = properties.getProperty(Tags.FORUM_TYPE_TAG);
+		if (forumTypeString == null) {
+			throw new InvalidPluginPropertiesException(
+							"Missing " + Tags.FORUM_TYPE_TAG + " property.");
+		}
+		
+		forumType = getForumType(forumTypeString);
+		if (forumType == null) {
+			throw new InvalidPluginPropertiesException(
+							"No such forum type: " + forumTypeString + ".");
+		}
+				
+		super.init(id, portalName, projects, plugins, properties, scoresManager);
+	}
+
+	
+	@Override
+	protected long getPluginValue(String projectId) {
+		
+		List<Forum> forums = getForums(projectId);
+		
+		if (forums == null) {
+			return 0;
+		}
+		
+		int counter = 0;
+		
+		for (Forum f : forums) {
+			
+			if (f.getType().equals(forumType)) {
+				counter++;
+			}
+		}
+		
+		return counter;
+	}
+
+
+	private ForumType getForumType(String forumTypeString) {
+		
+		ForumType forumType = null;
+		
+		try {
+		
+			forumType = ForumType.fromValue(forumTypeString);
+			
+		} catch (IllegalArgumentException e) {
+			
+			// Do nothing
+		}
+		
+		return forumType;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/forums/ForumsPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/forums/ForumsPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/forums/ForumsPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,47 @@
+
+/*
+ * 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.service.plugins.productization.forums;
+
+import java.util.List;
+
+import org.jboss.forge.common.projects.test.Forum;
+import org.jboss.forge.common.projects.test.Project;
+import org.jboss.forge.status.service.plugins.productization.ProductizationPlugin;
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ */
+public abstract class ForumsPlugin extends ProductizationPlugin {
+
+	protected List<Forum> getForums(String projectId) {
+		
+		Project project = getProject(projectId);
+		
+		if (project == null) {
+			return null;
+		}
+		
+		return project.getForums();
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/support/DifferentSupportServicesPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/support/DifferentSupportServicesPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/support/DifferentSupportServicesPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,57 @@
+
+/*
+ * 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.service.plugins.productization.support;
+
+import java.util.EnumSet;
+import java.util.List;
+
+import org.jboss.forge.common.projects.test.SupportService;
+import org.jboss.forge.common.projects.test.SupportType;
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ * 
+ * Evaluates number of different support service types available for project.
+ */
+public class DifferentSupportServicesPlugin extends SupportServicesPlugin {
+
+	@Override
+	protected long getPluginValue(String projectId) {
+		
+		List<SupportService> supportServices = getSupportServices(projectId);
+		
+		if (supportServices == null) {
+			return 0;
+		}
+		
+		EnumSet<SupportType> supportTypes = EnumSet.noneOf(SupportType.class);
+		
+		for (SupportService s : supportServices) {
+			
+			supportTypes.add(s.getType());
+		}
+		
+		return supportTypes.size();
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/support/SupportServicesPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/support/SupportServicesPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/support/SupportServicesPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,48 @@
+
+/*
+ * 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.service.plugins.productization.support;
+
+import java.util.List;
+
+import org.jboss.forge.common.projects.test.Project;
+import org.jboss.forge.common.projects.test.SupportService;
+
+import org.jboss.forge.status.service.plugins.productization.ProductizationPlugin;
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ */
+public abstract class SupportServicesPlugin extends ProductizationPlugin {
+
+	protected List<SupportService> getSupportServices(String projectId) {
+		
+		Project project = getProject(projectId);
+		
+		if (project == null) {
+			return null;
+		}
+		
+		return project.getSupportServices();
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/support/SupportTypePlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/support/SupportTypePlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/productization/support/SupportTypePlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,110 @@
+
+/*
+ * 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.service.plugins.productization.support;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.common.projects.test.SupportService;
+import org.jboss.forge.common.projects.test.SupportType;
+
+import org.jboss.forge.status.common.Tags;
+import org.jboss.forge.status.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.status.common.protocol.ScoresManager;
+import org.jboss.forge.status.common.tools.Plugins;
+
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ */
+public class SupportTypePlugin extends SupportServicesPlugin {
+
+	
+	private SupportType supportType;
+	
+	@Override
+	public void init(String id, String portalName, Projects projects,
+			Plugins plugins, Properties properties, ScoresManager scoresManager)
+								throws InvalidPluginPropertiesException {
+		
+		if (properties == null) {
+			throw new InvalidPluginPropertiesException(
+												"Missing plugin property.");
+		}
+		
+		String supportTypeString = properties.getProperty(Tags.SUPPORT_TYPE_TAG);
+		if (supportTypeString == null) {
+			throw new InvalidPluginPropertiesException(
+							"Missing " + Tags.SUPPORT_TYPE_TAG + " property.");
+		}
+		
+		supportType = getSupportType(supportTypeString);
+		if (supportType == null) {
+			throw new InvalidPluginPropertiesException(
+							"No such support type: " + supportTypeString + ".");
+		}
+				
+		super.init(id, portalName, projects, plugins, properties, scoresManager);
+	}
+
+	
+	@Override
+	protected long getPluginValue(String projectId) {
+		
+		List<SupportService> supportServices = getSupportServices(projectId);
+		
+		if (supportServices == null) {
+			return 0;
+		}
+		
+		int counter = 0;
+		
+		for (SupportService s : supportServices) {
+			
+			if (s.getType().equals(supportType)) {
+				counter++;
+			}
+		}
+		
+		return counter;
+	}
+
+
+	private SupportType getSupportType(String supportTypeString) {
+		
+		SupportType supportType = null;
+		
+		try {
+		
+			supportType = SupportType.fromValue(supportTypeString);
+			
+		} catch (IllegalArgumentException e) {
+			
+			// Do nothing
+		}
+		
+		return supportType;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/CommitsLast31DaysStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/CommitsLast31DaysStatusPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/CommitsLast31DaysStatusPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,49 @@
+/*
+ * 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.service.plugins.svn;
+
+import hu.midori.kosmos.model.SvnRepository;
+
+
+/**
+* @author Pawel Wrzeszcz
+* This provides number of commits done in last 31 days metric.
+*/
+
+public class CommitsLast31DaysStatusPlugin extends SvnStatusPlugin {
+	
+	public CommitsLast31DaysStatusPlugin() {
+		super();
+	}
+	@Override
+	protected int getPluginSpecyficValue(Object repository) {
+		SvnRepository repo = (SvnRepository) repository;
+		return repo.getCommitsLast31Days();
+	}
+	
+	@Override
+	protected int getPluginSpecyficDefaultValue() {
+		return 0;
+	}
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/CommitsLast7DaysStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/CommitsLast7DaysStatusPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/CommitsLast7DaysStatusPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,49 @@
+/*
+ * 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.service.plugins.svn;
+
+import hu.midori.kosmos.model.SvnRepository;
+
+
+/**
+* @author Pawel Wrzeszcz
+* This provides number of commits done in last 7 days metric.
+*/
+
+public class CommitsLast7DaysStatusPlugin extends SvnStatusPlugin {
+	
+	public CommitsLast7DaysStatusPlugin() {
+		super();
+	}
+	@Override
+	protected int getPluginSpecyficValue(Object repository) {
+		SvnRepository repo = (SvnRepository) repository;
+		return repo.getCommitsLast7Days();
+	}
+	
+	@Override
+	protected int getPluginSpecyficDefaultValue() {
+		return 0;
+	}
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/CommitsTodayStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/CommitsTodayStatusPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/CommitsTodayStatusPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,49 @@
+/*
+ * 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.service.plugins.svn;
+
+import hu.midori.kosmos.model.SvnRepository;
+
+
+/**
+* @author Pawel Wrzeszcz
+* This provides number of today commits metric.
+*/
+
+public class CommitsTodayStatusPlugin extends SvnStatusPlugin {
+	
+	public CommitsTodayStatusPlugin() {
+		super();
+	}
+	@Override
+	protected int getPluginSpecyficValue(Object repository) {
+		SvnRepository repo = (SvnRepository) repository;
+		return repo.getCommitsToday();
+	}
+	
+	@Override
+	protected int getPluginSpecyficDefaultValue() {
+		return 0;
+	}
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/CommitsTotalStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/CommitsTotalStatusPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/CommitsTotalStatusPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,49 @@
+/*
+ * 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.service.plugins.svn;
+
+import hu.midori.kosmos.model.SvnRepository;
+
+
+/**
+* @author Pawel Wrzeszcz
+* This plugin provides number of commits metric. 
+*/
+
+public class CommitsTotalStatusPlugin extends SvnStatusPlugin {
+	
+	public CommitsTotalStatusPlugin() {
+		super();
+	}
+	@Override
+	protected int getPluginSpecyficValue(Object repository) {
+		SvnRepository repo = (SvnRepository) repository;
+		return repo.getCommitsTotal();
+	}
+	
+	@Override
+	protected int getPluginSpecyficDefaultValue() {
+		return 0;
+	}
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/RevisionStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/RevisionStatusPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/RevisionStatusPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,51 @@
+/*
+ * 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.service.plugins.svn;
+
+import hu.midori.kosmos.model.SvnRepository;
+
+
+/**
+* @author Pawel Wrzeszcz
+* This plugin provides project revision number metric.
+*/
+
+public class RevisionStatusPlugin extends SvnStatusPlugin {
+	
+	public RevisionStatusPlugin() {
+		super();
+	}
+	@Override
+	protected int getPluginSpecyficValue(Object repository) {
+		SvnRepository repo = (SvnRepository) repository;
+		
+		return Long.valueOf(repo.getRevision()).intValue();
+		//TODO possible out of range
+	}
+	
+	@Override
+	protected int getPluginSpecyficDefaultValue() {
+		return 0;
+	}
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/SvnStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/SvnStatusPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/SvnStatusPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,124 @@
+/*
+ * 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.service.plugins.svn;
+
+import java.util.List;
+import java.net.MalformedURLException;
+
+import org.jboss.forge.common.projects.Repository;
+import org.jboss.forge.status.common.Tags;
+import org.jboss.forge.status.service.plugins.KosmosStatusPlugin;
+import org.jboss.logging.Logger;
+
+import com.caucho.hessian.client.HessianProxyFactory;
+
+import hu.midori.kosmos.model.SvnRepository;
+import hu.midori.kosmos.protocol.SvnService;
+
+/**
+* @author Pawel Wrzeszcz
+* Superclass for plugins affecting Subversion version control system.
+*/
+
+public abstract class SvnStatusPlugin extends KosmosStatusPlugin {
+	
+	private static final String SVN_LINK_NAME = "Svn repository location";
+
+	protected String getKosmosServiceTag() {
+		return Tags.SVN_SERVICE_PROPERTY;
+	};
+	
+	protected Logger log;
+	
+	public SvnStatusPlugin() {
+		super();
+		
+		log = Logger.getLogger(this.getClass());
+	}
+		
+	@Override
+	protected List<SvnRepository> getProjectServices(String projectId) {
+
+		// Get project repository URL
+	    String repoURL = getRepoURL(projectId);
+		
+	    if (repoURL == null) {
+	    		return null;
+		}
+		
+		// Connect to kosmos service
+		HessianProxyFactory factory = new HessianProxyFactory();
+		SvnService service;
+		
+		try {
+			service = (SvnService) factory.create(SvnService.class, serviceURL);
+		} catch (MalformedURLException e) {
+			log.error("Can not connect to the kosmos svn service: " + serviceURL
+												+ "\nCause: " + e.getMessage());
+			return null;
+		}
+		    
+		// Get map with repository statistics
+		List<SvnRepository> repositories = null;
+		try {
+			repositories = service.getRepositories(repoURL);
+		} catch (Exception e) {
+			log.error("Can not analyze repo: " + repoURL +
+											 "\nCause: " + e.getMessage());
+			e.printStackTrace();
+			return null;
+		}
+		
+		return repositories;
+	}
+	
+	
+	/**
+	 * For the given project id, returns project SVN repository location or
+	 * null if no such project exist or its repository is not SVN repository.
+	 */
+	private String getRepoURL(String projectId) {
+		
+		Repository repository = projects.getProjectRepository(projectId);
+		if (repository == null) {
+			return null;
+		}
+		
+		if (repository.getType() == Repository.SVN_REPOSITORY) {
+			return repository.getLocation();
+		} else {
+			return null;
+		}
+	}
+	
+	@Override
+	public String getPluginLink(String projectId) {
+		return getRepoURL(projectId);
+	}
+	
+	@Override
+	public String getPluginLinkName() {
+		return SVN_LINK_NAME;
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/TotalRepoSizeStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/TotalRepoSizeStatusPlugin.java	2006-10-09 10:42:34 UTC (rev 6700)
+++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/service/plugins/svn/TotalRepoSizeStatusPlugin.java	2006-10-09 10:55:24 UTC (rev 6701)
@@ -0,0 +1,49 @@
+/*
+ * 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.service.plugins.svn;
+
+import hu.midori.kosmos.model.SvnRepository;
+
+
+/**
+* @author Pawel Wrzeszcz
+* This plugin provides project repository size metric.
+*/
+
+public class TotalRepoSizeStatusPlugin extends SvnStatusPlugin {
+	
+	public TotalRepoSizeStatusPlugin() {
+		super();
+	}
+	@Override
+	protected int getPluginSpecyficValue(Object repository) {
+		SvnRepository repo = (SvnRepository) repository;
+		return repo.getTotalFileSize();
+	}
+	
+	@Override
+	protected int getPluginSpecyficDefaultValue() {
+		return 0;
+	}
+	
+}
\ No newline at end of file




More information about the jboss-svn-commits mailing list