[jboss-svn-commits] JBL Code SVN: r7815 - in labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm: common portlet portlet/conf service/plugins service/plugins/cc service/plugins/jira service/plugins/math service/plugins/svn
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Nov 24 14:14:33 EST 2006
Author: wrzep
Date: 2006-11-24 14:14:19 -0500 (Fri, 24 Nov 2006)
New Revision: 7815
Added:
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/KosmosPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/CcErrorsPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/CcPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/CcTestsPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/ClosedIssuesPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/JiraPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/OpenIssuesPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/ResolvedIssuesPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/math/LastNDaysPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast31DaysPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast7DaysPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTodayPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTotalPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/RevisionPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/SvnPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/TotalRepoSizePlugin.java
Removed:
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/KosmosStatusPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/CcStatusPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/ErrorsStatusPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/TestsStatusPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/ClosedIssuesStatusPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/JiraStatusPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/OpenIssuesStatusPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/ResolvedIssuesStatusPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/math/LastNDaysStatusPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast31DaysStatusPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast7DaysStatusPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTodayStatusPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTotalStatusPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/RevisionStatusPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/SvnStatusPlugin.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/TotalRepoSizeStatusPlugin.java
Modified:
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/common/Locations.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/common/Tags.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMM.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMConfWatcher.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMDescriptor.java
labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/conf/ConfgurationImpl.java
Log:
JBLAB-599
"status" -> "jmm"
Pawel
Modified: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/common/Locations.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/common/Locations.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/common/Locations.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -16,56 +16,56 @@
public class Locations {
/** <code>STATUS_XML<code> - file defining the list of watched feeds */
- private final static String STATUS_XML = "status.xml";
- private final static String STATUS_PLUGINS_XML = "plugins.xml";
- private final static String STATUS_SERVICE_PROPERTIES = "scores.service.properties";
+ private final static String JMM_XML = "jmm.xml";
+ private final static String JMM_PLUGINS_XML = "plugins.xml";
+ private final static String JMM_SERVICE_PROPERTIES = "jmm.service.properties";
private final static String PROJECTS_SERVICE_PROPERTIES = "projects.service.properties";
private final static String UPDATE_PROPERTIES = "update.properties";
- /** <code>STATUS_DIR</code> - directory in which file <code>STATUS_XML<code> is stored. */
- private final static String STATUS_DIR = "status";
+ /** <code>JMM_DIR</code> - directory in which file <code>JMM_XML<code> is stored. */
+ private final static String JMM_DIR = "jmm";
- private final static String STATUS_JSP = "status.jsp";
- private final static String STATUS_JSP_DIR = "status";
+ private final static String JMM_JSP = "jmm.jsp";
+ private final static String JMM_JSP_DIR = "jmm";
private final static String PROJECT_DETAILS_JSP = "project_details.jsp";
private final static String COLUMN_DETAILS_JSP = "column_details.jsp";
/** Shotoku directory to store historical scores */
- private static final String SHOTOKU_STATUS_DIR = "status";
+ private static final String SHOTOKU_JMM_DIR = "jmm";
/**
* Path to the xml file with the Status Matrix properties.
*/
public static String getXmlCmPath(String portalName) {
- return portalName + "/" + STATUS_DIR + "/" + STATUS_XML;
+ return portalName + "/" + JMM_DIR + "/" + JMM_XML;
}
/**
* Path to the xml file defining Plugins used in the Matrix.
*/
- public static String getXmlStatusPluginsCmPath(String portalName) {
- return portalName + "/" + STATUS_DIR + "/" + STATUS_PLUGINS_XML;
+ public static String getXmlJMMPluginsCmPath(String portalName) {
+ return portalName + "/" + JMM_DIR + "/" + JMM_PLUGINS_XML;
}
/**
* Path to the file containing ejb3 service properties.
*/
public static String getServicePropertiesCmPath(String portalName) {
- return portalName + "/" + STATUS_DIR + "/" + Locations.STATUS_SERVICE_PROPERTIES;
+ return portalName + "/" + JMM_DIR + "/" + Locations.JMM_SERVICE_PROPERTIES;
}
/**
* Path to the file containing Projects Service properties.
*/
public static String getProjectsServicePropertiesCmPath(String portalName) {
- return portalName + "/" + STATUS_DIR + "/" + Locations.PROJECTS_SERVICE_PROPERTIES;
+ return portalName + "/" + JMM_DIR + "/" + Locations.PROJECTS_SERVICE_PROPERTIES;
}
/**
* Path to the file containing auto-update properties
*/
public static String getUpdatePropertiesCmPath(String portalName) {
- return portalName + "/" + STATUS_DIR + "/" + Locations.UPDATE_PROPERTIES;
+ return portalName + "/" + JMM_DIR + "/" + Locations.UPDATE_PROPERTIES;
}
/**
@@ -99,24 +99,24 @@
* Path to the jsp file responsible file displaying the Status Matrix.
*/
public static String getJspCmPath() {
- return STATUS_JSP_DIR + "/" + STATUS_JSP;
+ return JMM_JSP_DIR + "/" + JMM_JSP;
}
/**
* Path to the jsp file responsible for displaying project details.
*/
public static String getPrjDetailsJspCmPath() {
- return STATUS_JSP_DIR + "/" + PROJECT_DETAILS_JSP;
+ return JMM_JSP_DIR + "/" + PROJECT_DETAILS_JSP;
}
/**
* Path to the jsp file responsible displaying column details.
*/
public static String getColumnDetailsJspCmPath() {
- return STATUS_JSP_DIR + "/" + COLUMN_DETAILS_JSP;
+ return JMM_JSP_DIR + "/" + COLUMN_DETAILS_JSP;
}
public static String getShotokuStatusPath(String portalName) {
- return ForgeHelper.DYNAMIC_CONTENT_DIR + "/" + SHOTOKU_STATUS_DIR;
+ return ForgeHelper.DYNAMIC_CONTENT_DIR + "/" + SHOTOKU_JMM_DIR;
}
}
Modified: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/common/Tags.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/common/Tags.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/common/Tags.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -28,7 +28,7 @@
*/
public class Tags {
- /* status.xml file tags */
+ /* jmm.xml file tags */
/* main page */
public static final String MAIN_PAGE_COLUMNS_TAG = "main-page";
Modified: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMM.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMM.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMM.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -71,10 +71,10 @@
/**
* @param portalName portal name
- * @param statusRoot Node with Matrix properites
+ * @param root Node with Matrix properites
* @param scoresManager
*/
- public JMM(String portalName, Node statusRoot,
+ public JMM(String portalName, Node root,
ScoresManager scoresManager)
throws ScoresException {
@@ -87,13 +87,13 @@
// Get columns to display on the main page
Node mainPageRoot =
- XmlTools.getFirstNodeWithName(statusRoot,
+ XmlTools.getFirstNodeWithName(root,
Tags.MAIN_PAGE_COLUMNS_TAG);
mainPageColumns = new Columns(mainPageRoot, projects);
// Get matrix to display on the project page
Node projectPageRoot =
- XmlTools.getFirstNodeWithName(statusRoot,
+ XmlTools.getFirstNodeWithName(root,
Tags.PROJECT_PAGE_COLUMNS_TAG);
matrixTemplate =
new MatrixTemplate(projectPageRoot, projects);
Modified: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMConfWatcher.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMConfWatcher.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMConfWatcher.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -46,7 +46,7 @@
String portalName = key;
addWatchedPath(key, Locations.getXmlCmPath(portalName));
- addWatchedPath(key, Locations.getXmlStatusPluginsCmPath(portalName));
+ addWatchedPath(key, Locations.getXmlJMMPluginsCmPath(portalName));
addWatchedPath(key, Locations.getServicePropertiesCmPath(portalName));
/* Watch projects.xml file */
Modified: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMDescriptor.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMDescriptor.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMDescriptor.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -57,7 +57,7 @@
private String portalName;
private ContentManager cm;
- private JMM status;
+ private JMM jmm;
private Logger log = Logger.getLogger(JMMDescriptor.class);
@@ -93,10 +93,10 @@
try {
- String statusPath = Locations.getXmlCmPath(portalName);
- Node statusRoot = Tools.getRoot(cm , statusPath);
+ String jmmPath = Locations.getXmlCmPath(portalName);
+ Node root = Tools.getRoot(cm , jmmPath);
- status = new JMM(portalName, statusRoot, scoresManager);
+ jmm = new JMM(portalName, root, scoresManager);
} catch (Exception e) {
@@ -106,13 +106,13 @@
private void fillContext() {
- if (status != null) {
+ if (jmm != null) {
context = new DelegateContext();
- status.fillContext(context);
+ jmm.fillContext(context);
- projectContexts = status.getProjectContexts();
- columnContexts = status.getColumnContexts();
+ projectContexts = jmm.getProjectContexts();
+ columnContexts = jmm.getColumnContexts();
}
}
@@ -132,11 +132,11 @@
public synchronized void update() {
- if (status == null) {
+ if (jmm == null) {
initStatus();
}
- status.update();
+ jmm.update();
fillContext();
}
Modified: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/conf/ConfgurationImpl.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/conf/ConfgurationImpl.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/conf/ConfgurationImpl.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -74,7 +74,7 @@
Node updatePropertiesNode = cm.getNode(updatePropertiesPath);
updateConf = new UpdatesConfImpl(updatePropertiesNode);
- String pluginsPath = Locations.getXmlStatusPluginsCmPath(portalName);
+ String pluginsPath = Locations.getXmlJMMPluginsCmPath(portalName);
org.w3c.dom.Node pluginsNode = Tools.getRoot(cm, pluginsPath);
pluginsConf = Tools.getPluginsConfList(pluginsNode);
Added: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/KosmosPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/KosmosPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/KosmosPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -0,0 +1,146 @@
+/*
+ * 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.jmm.service.plugins;
+
+import org.jboss.forge.jmm.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.jmm.common.protocol.ScoresManager;
+import org.jboss.forge.jmm.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 KosmosPlugin 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 KosmosPlugin() {
+ super();
+
+ log = Logger.getLogger(this.getClass());
+ projectServices = new HashMap<String,List>();
+ }
+
+ @Override
+ public void init(String id, String portalName, List<String> projectIds,
+ Plugins plugins, Properties properties, ScoresManager scoresManager)
+ throws InvalidPluginPropertiesException {
+ super.init(id, portalName, projectIds, 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.jmm.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-jmm/src/java/org/jboss/forge/jmm/service/plugins/KosmosStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/KosmosStatusPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/KosmosStatusPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -1,146 +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.jmm.service.plugins;
-
-import org.jboss.forge.jmm.common.exceptions.InvalidPluginPropertiesException;
-import org.jboss.forge.jmm.common.protocol.ScoresManager;
-import org.jboss.forge.jmm.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, List<String> projectIds,
- Plugins plugins, Properties properties, ScoresManager scoresManager)
- throws InvalidPluginPropertiesException {
- super.init(id, portalName, projectIds, 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.jmm.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-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/CcErrorsPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/CcErrorsPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/CcErrorsPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -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.jmm.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 CcErrorsPlugin extends CcPlugin {
+
+ @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-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/CcPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/CcPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/CcPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -0,0 +1,112 @@
+/*
+ * 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.jmm.service.plugins.cc;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.net.MalformedURLException;
+
+import org.jboss.forge.jmm.common.Tags;
+import org.jboss.forge.jmm.common.tools.ProjectTools;
+import org.jboss.forge.jmm.service.plugins.KosmosPlugin;
+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 CcPlugin extends KosmosPlugin {
+
+ private static final String CC_LINK_NAME = "CruiseControl location";
+
+ @Override
+ protected String getKosmosServiceTag() {
+ return Tags.CC_SERVICE_PROPERTY;
+ };
+
+ protected Logger log;
+
+ public CcPlugin() {
+ super();
+
+ log = Logger.getLogger(this.getClass());
+ }
+
+ @Override
+ protected List<CcProject> getProjectServices(String projectId) {
+
+ // Get project cc URLs
+ List<String> ccURLs = ProjectTools.getCcURLs(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);
+ }
+
+ @Override
+ public String getPluginLink(String projectId) {
+
+ List<String> ccURLsString = ProjectTools.getCcURLs(projectId);
+
+ return (ccURLsString == null) ? null : ccURLsString.get(0);
+ }
+
+ @Override
+ public String getPluginLinkName() {
+ return CC_LINK_NAME;
+ }
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/CcStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/CcStatusPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/CcStatusPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -1,112 +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.jmm.service.plugins.cc;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.net.MalformedURLException;
-
-import org.jboss.forge.jmm.common.Tags;
-import org.jboss.forge.jmm.common.tools.ProjectTools;
-import org.jboss.forge.jmm.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 = ProjectTools.getCcURLs(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);
- }
-
- @Override
- public String getPluginLink(String projectId) {
-
- List<String> ccURLsString = ProjectTools.getCcURLs(projectId);
-
- return (ccURLsString == null) ? null : ccURLsString.get(0);
- }
-
- @Override
- public String getPluginLinkName() {
- return CC_LINK_NAME;
- }
-}
Added: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/CcTestsPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/CcTestsPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/CcTestsPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -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.jmm.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 CcTestsPlugin extends CcPlugin {
+
+ @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
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/ErrorsStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/ErrorsStatusPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/ErrorsStatusPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -1,46 +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.jmm.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
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/TestsStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/TestsStatusPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/cc/TestsStatusPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -1,46 +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.jmm.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-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/ClosedIssuesPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/ClosedIssuesPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/ClosedIssuesPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -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.jmm.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 ClosedIssuesPlugin extends JiraPlugin {
+
+ @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
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/ClosedIssuesStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/ClosedIssuesStatusPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/ClosedIssuesStatusPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -1,47 +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.jmm.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-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/JiraPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/JiraPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/JiraPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -0,0 +1,116 @@
+/*
+ * 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.jmm.service.plugins.jira;
+
+import java.util.List;
+import java.net.MalformedURLException;
+
+import org.jboss.forge.common.projects.project.IssueTracker;
+import org.jboss.forge.jmm.common.Tags;
+import org.jboss.forge.jmm.common.tools.ProjectTools;
+import org.jboss.forge.jmm.service.plugins.KosmosPlugin;
+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 JiraPlugin extends KosmosPlugin {
+
+ private static final String JIRA_LINK_NAME = "JIRA location";
+
+ protected String getKosmosServiceTag() {
+ return Tags.JIRA_SERVICE_PROPERTY;
+ };
+
+ protected Logger log;
+
+ public JiraPlugin() {
+ 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 = ProjectTools.getProjectJiraIssueTracker(projectId);
+
+ if (it == null) {
+ return null;
+ }
+
+ return it.getValue();
+ }
+
+ @Override
+ public String getPluginLink(String projectId) {
+ return getJiraURL(projectId);
+ }
+
+ @Override
+ public String getPluginLinkName() {
+ return JIRA_LINK_NAME;
+ }
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/JiraStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/JiraStatusPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/JiraStatusPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -1,116 +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.jmm.service.plugins.jira;
-
-import java.util.List;
-import java.net.MalformedURLException;
-
-import org.jboss.forge.common.projects.project.IssueTracker;
-import org.jboss.forge.jmm.common.Tags;
-import org.jboss.forge.jmm.common.tools.ProjectTools;
-import org.jboss.forge.jmm.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 = ProjectTools.getProjectJiraIssueTracker(projectId);
-
- if (it == null) {
- return null;
- }
-
- return it.getValue();
- }
-
- @Override
- public String getPluginLink(String projectId) {
- return getJiraURL(projectId);
- }
-
- @Override
- public String getPluginLinkName() {
- return JIRA_LINK_NAME;
- }
-}
Added: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/OpenIssuesPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/OpenIssuesPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/OpenIssuesPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -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.jmm.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 OpenIssuesPlugin extends JiraPlugin {
+
+ @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
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/OpenIssuesStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/OpenIssuesStatusPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/OpenIssuesStatusPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -1,47 +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.jmm.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-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/ResolvedIssuesPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/ResolvedIssuesPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/ResolvedIssuesPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -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.jmm.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 ResolvedIssuesPlugin extends JiraPlugin {
+
+ @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
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/ResolvedIssuesStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/ResolvedIssuesStatusPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/jira/ResolvedIssuesStatusPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -1,47 +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.jmm.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-jmm/src/java/org/jboss/forge/jmm/service/plugins/math/LastNDaysPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/math/LastNDaysPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/math/LastNDaysPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -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.jmm.service.plugins.math;
+
+import java.util.Calendar;
+import java.util.List;
+import java.util.Properties;
+
+import org.jboss.forge.jmm.common.Tags;
+import org.jboss.forge.jmm.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.jmm.common.exceptions.ScoresException;
+import org.jboss.forge.jmm.common.protocol.ScoresManager;
+import org.jboss.forge.jmm.common.tools.Plugins;
+import org.jboss.forge.jmm.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 LastNDaysPlugin extends Plugin {
+
+ private Plugin insidePlugin;
+ private int days;
+
+ @Override
+ public void init(String id, String portalName, List<String> projectIds,
+ 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, projectIds, 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 (ScoresException e) {
+ return 0;
+ }
+
+ return (currentValue - prevValue);
+ }
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/math/LastNDaysStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/math/LastNDaysStatusPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/math/LastNDaysStatusPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -1,99 +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.jmm.service.plugins.math;
-
-import java.util.Calendar;
-import java.util.List;
-import java.util.Properties;
-
-import org.jboss.forge.jmm.common.Tags;
-import org.jboss.forge.jmm.common.exceptions.InvalidPluginPropertiesException;
-import org.jboss.forge.jmm.common.exceptions.ScoresException;
-import org.jboss.forge.jmm.common.protocol.ScoresManager;
-import org.jboss.forge.jmm.common.tools.Plugins;
-import org.jboss.forge.jmm.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, List<String> projectIds,
- 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, projectIds, 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 (ScoresException e) {
- return 0;
- }
-
- return (currentValue - prevValue);
- }
-}
Added: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast31DaysPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast31DaysPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast31DaysPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -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.jmm.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 CommitsLast31DaysPlugin extends SvnPlugin {
+
+ public CommitsLast31DaysPlugin() {
+ 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
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast31DaysStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast31DaysStatusPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast31DaysStatusPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -1,49 +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.jmm.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-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast7DaysPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast7DaysPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast7DaysPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -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.jmm.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 CommitsLast7DaysPlugin extends SvnPlugin {
+
+ public CommitsLast7DaysPlugin() {
+ 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
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast7DaysStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast7DaysStatusPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast7DaysStatusPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -1,49 +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.jmm.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-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTodayPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTodayPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTodayPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -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.jmm.service.plugins.svn;
+
+import hu.midori.kosmos.model.SvnRepository;
+
+
+/**
+* @author Pawel Wrzeszcz
+* This provides number of today commits metric.
+*/
+
+public class CommitsTodayPlugin extends SvnPlugin {
+
+ public CommitsTodayPlugin() {
+ 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
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTodayStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTodayStatusPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTodayStatusPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -1,49 +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.jmm.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-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTotalPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTotalPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTotalPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -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.jmm.service.plugins.svn;
+
+import hu.midori.kosmos.model.SvnRepository;
+
+
+/**
+* @author Pawel Wrzeszcz
+* This plugin provides number of commits metric.
+*/
+
+public class CommitsTotalPlugin extends SvnPlugin {
+
+ public CommitsTotalPlugin() {
+ 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
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTotalStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTotalStatusPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTotalStatusPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -1,49 +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.jmm.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-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/RevisionPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/RevisionPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/RevisionPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -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.jmm.service.plugins.svn;
+
+import hu.midori.kosmos.model.SvnRepository;
+
+
+/**
+* @author Pawel Wrzeszcz
+* This plugin provides project revision number metric.
+*/
+
+public class RevisionPlugin extends SvnPlugin {
+
+ public RevisionPlugin() {
+ 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
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/RevisionStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/RevisionStatusPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/RevisionStatusPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -1,51 +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.jmm.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-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/SvnPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/SvnPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/SvnPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -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.jmm.service.plugins.svn;
+
+import java.util.List;
+import java.net.MalformedURLException;
+
+import org.jboss.forge.common.projects.project.Repository;
+import org.jboss.forge.jmm.common.Tags;
+import org.jboss.forge.jmm.common.tools.ProjectTools;
+import org.jboss.forge.jmm.service.plugins.KosmosPlugin;
+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 SvnPlugin extends KosmosPlugin {
+
+ private static final String SVN_LINK_NAME = "Svn repository location";
+
+ protected String getKosmosServiceTag() {
+ return Tags.SVN_SERVICE_PROPERTY;
+ };
+
+ protected Logger log;
+
+ public SvnPlugin() {
+ 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) {
+
+ List<Repository> repoList = ProjectTools.getProjectCcRepositories(projectId);
+
+ if (repoList == null) {
+ return null;
+ }
+
+ Repository repository = repoList.get(0);//TODO
+
+ return repository.getValue();
+ }
+
+ @Override
+ public String getPluginLink(String projectId) {
+ return getRepoURL(projectId);
+ }
+
+ @Override
+ public String getPluginLinkName() {
+ return SVN_LINK_NAME;
+ }
+
+}
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/SvnStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/SvnStatusPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/SvnStatusPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -1,124 +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.jmm.service.plugins.svn;
-
-import java.util.List;
-import java.net.MalformedURLException;
-
-import org.jboss.forge.common.projects.project.Repository;
-import org.jboss.forge.jmm.common.Tags;
-import org.jboss.forge.jmm.common.tools.ProjectTools;
-import org.jboss.forge.jmm.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) {
-
- List<Repository> repoList = ProjectTools.getProjectCcRepositories(projectId);
-
- if (repoList == null) {
- return null;
- }
-
- Repository repository = repoList.get(0);//TODO
-
- return repository.getValue();
- }
-
- @Override
- public String getPluginLink(String projectId) {
- return getRepoURL(projectId);
- }
-
- @Override
- public String getPluginLinkName() {
- return SVN_LINK_NAME;
- }
-
-}
Added: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/TotalRepoSizePlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/TotalRepoSizePlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/TotalRepoSizePlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -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.jmm.service.plugins.svn;
+
+import hu.midori.kosmos.model.SvnRepository;
+
+
+/**
+* @author Pawel Wrzeszcz
+* This plugin provides project repository size metric.
+*/
+
+public class TotalRepoSizePlugin extends SvnPlugin {
+
+ public TotalRepoSizePlugin() {
+ 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
Deleted: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/TotalRepoSizeStatusPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/TotalRepoSizeStatusPlugin.java 2006-11-24 16:18:41 UTC (rev 7814)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/service/plugins/svn/TotalRepoSizeStatusPlugin.java 2006-11-24 19:14:19 UTC (rev 7815)
@@ -1,49 +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.jmm.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