[jboss-svn-commits] JBL Code SVN: r8335 - in labs/jbosslabs/trunk/portal-extensions: . jmm jmm/jmm-common jmm/jmm-common/src jmm/jmm-common/src/java jmm/jmm-common/src/java/org jmm/jmm-common/src/java/org/jboss jmm/jmm-common/src/java/org/jboss/forge jmm/jmm-common/src/java/org/jboss/forge/jmm jmm/jmm-common/src/java/org/jboss/forge/jmm/common jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools jmm/jmm-portlet jmm/jmm-portlet/src jmm/jmm-portlet/src/java jmm/jmm-portlet/src/java/org jmm/jmm-portlet/src/java/org/jboss jmm/jmm-portlet/src/java/org/jboss/forge jmm/jmm-portlet/src/java/org/jboss/forge/jmm jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates jmm/jmm-port! let/src/web jmm/jmm-portlet/src/web/WEB-INF jmm/jmm-portlet/src/web/WEB-INF/tld jmm/jmm-service jmm/jmm-service/src jmm/jmm-service/src/app jmm/jmm-service/src/app/META-INF jmm/jmm-service/src/etc jmm/jmm-service/src/etc/META-INF jmm/jmm-service/src/java jmm/jmm-service/src/java/org jmm/jmm-service/src/java/org/jboss jmm/jmm-service/src/java/org/jboss/forge jmm/jmm-service/src/java/org/jboss/forge/jmm jmm/jmm-service/src/java/org/jboss/forge/jmm/service jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/protocol jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines jmm/! jmm-service/src/java/org/jboss/forge/jmm/service/plugins/jira jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/docs jmm/jmm-service/src/java/org/jboss/forge/

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Dec 14 18:37:01 EST 2006


Author: wrzep
Date: 2006-12-14 18:36:27 -0500 (Thu, 14 Dec 2006)
New Revision: 8335

Added:
   labs/jbosslabs/trunk/portal-extensions/jmm/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/maven.xml
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/project.properties
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/project.xml
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/Constants.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/Locations.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/Tags.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/GetScoresException.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/InvalidPluginPropertiesException.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/InvalidPluginsConfigurationException.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/ScoresException.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/ScoresSaveException.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/DBService.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresManager.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresRepositoryManager.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresService.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresServiceLocal.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresServiceRemote.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/Configuration.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/Plugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginConf.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginValues.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginValuesRemote.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginsValues.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginsValuesRemote.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/ScoresFactory.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/ScoresUpdater.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/ServiceConf.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/UpdatesConf.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/ConfgurationImpl.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/PluginConfImpl.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/ServiceConfImpl.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/ServiceScoresManager.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/UpdatesConfImpl.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/Plugins.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/ProjectTools.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/ProjectsByNameComparator.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/ProjectsByScoreComparator.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/Tools.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/maven.xml
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/project.properties
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/project.xml
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMM.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMMConfWatcher.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMMDescriptor.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMMPortlet.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMMTools.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/CellTemplate.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/Column.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/Columns.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/MatrixTemplate.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/MetricTemplate.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/RowTemplate.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/jboss-app.xml
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/jboss-web.xml
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/portlet-instances.xml
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/portlet.xml
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/tld/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/tld/forge.tld
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/tld/portlet.tld
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/web.xml
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/build.properties
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/maven.xml
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/project.properties
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/project.xml
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/app/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/app/META-INF/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/app/META-INF/jboss-service.xml
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/etc/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/etc/META-INF/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/etc/META-INF/persistence.xml
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/ScoresDailyUpdater.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/ScoresServiceImpl.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/DBScoresRepositoryManager.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/DBServiceImpl.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/DBScoresFactory.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/PluginValuesEntity.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/PluginsValuesEntity.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/ScoresEntity.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/ValueEntity.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/ShotokuScoresRepositoryManager.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/protocol/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/protocol/PluginValuesImpl.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/protocol/PluginsValuesImpl.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/protocol/ShotokuScoresFactory.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/KosmosPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcBrokenBuildsPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcBuildAttemptsPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcBuildsPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcErrorsPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcSuccessfulBuildsPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcTestsPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/AddedCodeLinesPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/CheckOutEditor.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/CodeLinesEvaluator.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/CodeLinesPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/CodeLinesTotalPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/SlowCodeLinesTotalPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/jira/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/jira/ClosedIssuesPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/jira/JiraPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/jira/OpenIssuesPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/jira/ResolvedIssuesPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/AddPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/ConstPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/DivPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/LastNDaysPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/MathPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/MulPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/RandomPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/WeightedScorePlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/DownloadsPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/JEMSIntegrationPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/PackagedForDownloadPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/ProductizationPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/docs/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/docs/DifferentDocumentationSourcesPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/docs/DocumentationPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/docs/DocumentationTypePlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/forums/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/forums/DifferentForumsPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/forums/ForumTypePlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/forums/ForumsPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/support/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/support/DifferentSupportServicesPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/support/SupportServicesPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/support/SupportTypePlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast31DaysPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast7DaysPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTodayPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTotalPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/RevisionPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/SvnPlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/TotalRepoSizePlugin.java
   labs/jbosslabs/trunk/portal-extensions/jmm/maven.xml
   labs/jbosslabs/trunk/portal-extensions/jmm/project.properties
   labs/jbosslabs/trunk/portal-extensions/jmm/project.xml
Log:
http://jira.jboss.com/jira/browse/JBLAB-815
Pawel


Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/maven.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/maven.xml	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/maven.xml	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,28 @@
+<!-- 
+  JBoss, the OpenSource J2EE webOS
+  Distributable under LGPL license.
+  See terms of license at gnu.org. 
+ -->
+<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:u="jelly:util">
+	<!-- Default war-project goals -->
+
+	<goal name="all">
+		<attainGoal name="module-all" />
+	</goal>
+
+	<goal name="build">
+		<attainGoal name="jar" />
+		<ant:move tofile="target/${jmm.common.final.name}" file="target/${maven.final.name}.jar" />	
+	
+		<ant:copy toDir="${maven.repo.local}/jboss-forge/jars/" file="target/${jmm.common.final.name}" overwrite="true"/>
+	</goal>
+    
+	<goal name="deploy">	
+		<ant:copy todir="${local.deploy.dir}" file="target/${jmm.common.final.name}" />
+	</goal>
+	
+	<goal name="clean">
+		<attainGoal name="module-clean" />
+	</goal>
+
+</project>

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/project.properties
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/project.properties	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/project.properties	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,16 @@
+maven.repo.remote=http://repository.atlassian.com,http://www.ibiblio.org/maven,http://dist.codehaus.org/
+maven.junit.fork=yes
+maven.war.src=${basedir}/src/web
+
+#maven.ejb.includes=**/service/**,**/META-INF/**
+#maven.jar.excludes=**/JMMPortlet.class,**/service/**,**/persistence.xml
+#maven.war.classes.includes=**/JMMPortlet.class
+#**/service/impl/db/protocol/*
+
+maven.ejb.includes=**/service/**,**/META-INF/**
+maven.jar.includes=**/common/**
+maven.war.classes.includes=**/portlet/**
+
+jmm.service.final.name=jmm-service.ejb3
+jmm.common.final.name=jmm-common.jar
+jmm.service.sar=jmm-service.sar/
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/project.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/project.xml	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/project.xml	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,132 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+<!-- 
+  JBoss, the OpenSource J2EE webOS
+  Distributable under LGPL license.
+  See terms of license at gnu.org. 
+ -->
+<project>
+    <pomVersion>3</pomVersion>
+    <extend>../project.xml</extend>
+    <id>jmm-common</id>
+    <name>JEMS Maturity Matrix Common Library</name>
+    <currentVersion>1.0</currentVersion>
+    <organization>
+        <name>Pawel Wrzeszcz</name>
+        <url></url>
+    </organization>
+    <description></description>
+    
+    <dependencies>
+    
+	<dependency>
+	    <groupId>jboss-forge</groupId>
+	    <artifactId>forge-common</artifactId>
+	    <version>1.0</version>
+	    <properties>
+                <ejb.manifest.classpath>true</ejb.manifest.classpath>
+				<war.manifest.classpath>true</war.manifest.classpath>
+        </properties>
+	</dependency>
+
+	<dependency>
+	    <groupId>aslibs</groupId>
+	    <artifactId>javax.servlet</artifactId>
+	    <version>1.0</version>
+	    <jar>javax.servlet.jar</jar>
+	</dependency>
+
+  	<dependency>
+		<id>jdom</id>
+		<version>1.0</version>
+		<properties>
+			<war.bundle>true</war.bundle>
+		</properties>
+	</dependency>
+	
+	<dependency>
+	    <groupId>tmate</groupId>
+	    <artifactId>javasvn</artifactId>
+	    <version>1.0</version>
+	    <jar>javasvn.jar</jar>
+	    <properties>
+			<war.bundle>true</war.bundle>
+			<ejb.manifest.classpath>true</ejb.manifest.classpath>
+	    </properties>
+	</dependency>
+	
+	<dependency>
+		<groupId>kosmos</groupId>
+		<artifactId>kosmos</artifactId>
+		<jar>kosmos-server.jar</jar>
+		<version>1.0</version>
+		<properties>
+			<war.bundle>true</war.bundle>
+			<ejb.manifest.classpath>true</ejb.manifest.classpath>
+			<war.manifest.classpath>true</war.manifest.classpath>
+		</properties>
+	</dependency>
+
+    <dependency>
+        <groupId>hessian</groupId>
+        <artifactId>hessian</artifactId>
+        <version>3.0.1</version> 
+	<jar>hessian-3.0.13.jar</jar>
+        <properties>
+		    	<war.bundle>true</war.bundle>
+            <war.manifest.classpath>true</war.manifest.classpath>
+            <ejb.manifest.classpath>true</ejb.manifest.classpath>
+        </properties>
+    </dependency>
+
+	<dependency>
+	    <groupId>shotoku</groupId>
+	    <artifactId>shotoku-base</artifactId>
+	    <version>1.0</version>
+	    <jar>shotoku-base.jar</jar>
+            <properties>
+                <ejb.manifest.classpath>true</ejb.manifest.classpath>
+                <war.manifest.classpath>true</war.manifest.classpath>
+            </properties>
+	</dependency>
+
+  <!-- JBoss EJB3 dependencies -->
+
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>ejb3-persistence</artifactId>
+		<version>3.0RC6</version>
+		<jar>ejb3-persistence.jar</jar>
+	</dependency>
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>jboss-ejb3x</artifactId>
+		<version>3.0RC6</version>
+		<jar>jboss-ejb3x.jar</jar>
+        </dependency>
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>jboss-j2ee</artifactId>
+		<version></version>
+		<jar>jboss-j2ee.jar</jar>
+        </dependency>
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>jboss-annotations-ejb3</artifactId>
+		<version></version>
+		<jar>jboss-annotations-ejb3.jar</jar>
+        </dependency>
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>jbossall-client</artifactId>
+		<version>3.2.3</version>
+        </dependency>
+
+	<dependency>
+		<groupId>jaxb</groupId>
+		<artifactId>JAXB2</artifactId>
+		<version>2.0</version>
+		<jar>jaxb-api.jar</jar>
+        </dependency>
+	   
+    </dependencies>
+</project>

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/Constants.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/Constants.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/Constants.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,52 @@
+package org.jboss.forge.jmm.common;
+
+/**
+ * @author Pawel Wrzeszcz
+ */
+public class Constants {
+	
+	public static final int MAX_ATTEMPTS 				= 10;
+	
+	public static final String JMM_SCORES_SERVICE = "jmm:service=JMMService";
+	
+	public static final String JMM_SERVICE_ADDRESS 	  = "service:jmx:rmi://localhost";
+	
+	public static final String STATUS_LOCAL_SERVICE	= "ScoresService/local"; 
+														  //"java:/ScoresService/local";
+	public static final String STATUS_REMOTE_SERVICE 	= "ScoresService/remote";
+											  			  //"java:/ScoresService/remote";
+	
+	public static final String DAILY_SCORES_UPDATER	= "DailyScoresUpdater/local";
+
+	public static final String DB_SERVICE 			= "ScoresDBService/local";
+
+	public static final String PROJECT_DETAILS_ACTION = "viewProjectDetails";
+
+	public static final String COLUMN_DETAILS_ACTION = "viewColumnDetails";
+
+	public static final long DEFAULT_PLUGIN_VALUE		 = 0;
+	
+	public static final long PLUGIN_DEFAULT_MIN_VALUE = Long.MIN_VALUE;
+
+	public static final long CACHE_INTERVAL 			= 3*60*1000; /* milliseconds */
+						   /* Check for new scores every 3 minutes */
+	
+	public static final int SCORES_UPDATE_INTERVAL_DEFAULT  
+														= 24*60; /* minutes */
+	 							/* By default perform update every 24 hours */
+
+	public static final int FIRST_UPDATE_INTERVAL_DEFAULT   = 1;/* minutes */
+								/* By default perform first update after 1 minute */
+
+								/* By default start at midnight */
+	public static final int UPDATE_START_HOUR_DEFAULT 	= 0;
+
+	public static final int UPDATE_START_MINUTE_DEFAULT = 0;
+
+
+	/**
+	 * This class cannot be instatiated.
+	 */
+	private Constants() {};
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/Locations.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/Locations.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/Locations.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,122 @@
+package org.jboss.forge.jmm.common;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.forge.common.ForgeHelper;
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.common.projects.ProjectsHelper;
+import org.jboss.forge.common.projects.permissions.NullPermissionsChecker;
+import org.jboss.forge.common.projects.permissions.PermissionsChecker;
+
+/**
+ * Common functions.
+ * @author Pawel Wrzeszcz
+ */
+public class Locations {
+	
+	/** <code>STATUS_XML<code> - file defining the list of watched feeds */
+	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>JMM_DIR</code> - directory in which file <code>JMM_XML<code> is stored. */
+	private final static String JMM_DIR 						= "jmm";
+	
+	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_JMM_DIR 				= "jmm";
+	
+	/**
+	 * Path to the xml file with the Status Matrix properties.
+	 */
+	public static String getXmlCmPath(String portalName) {
+		return portalName + "/" + JMM_DIR + "/" + JMM_XML;
+	}
+	
+	/**
+	 * Path to the xml file defining Plugins used in the Matrix.
+	 */
+	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 + "/" + JMM_DIR + "/" + Locations.JMM_SERVICE_PROPERTIES;
+	}
+	
+	/**
+	 * Path to the file containing Projects Service properties.
+	 */
+	public static String getProjectsServicePropertiesCmPath(String portalName) {
+		return portalName + "/" + JMM_DIR + "/" + Locations.PROJECTS_SERVICE_PROPERTIES;
+	}
+	
+	/**
+	 * Path to the file containing auto-update properties
+	 */
+	public static String getUpdatePropertiesCmPath(String portalName) {
+		return portalName + "/" + JMM_DIR + "/" + Locations.UPDATE_PROPERTIES;
+	}
+	
+	/**
+	 * Path to the projects.xml file.
+	 */
+	public static String getProjectsXmlPath(String portalName) {	
+		return portalName + "/" + ProjectsHelper.PROJECTS_DESC;
+	}
+	
+	/**
+	 * Set containing paths to project.xml files for all projects. 
+	 */
+	public static Set<String> getProjectXmlPathsSet(String portalName) {
+		
+		Set<String> pathsSet = new HashSet<String>();
+		
+		Projects projects = ProjectsHelper.getProjects(portalName);
+		Set<String> projectIdsSet = projects.getProjectIds(
+				(PermissionsChecker) new NullPermissionsChecker(), null);
+		
+		for (String projectId : projectIdsSet) {
+			
+			String projectXmlPath = portalName + "/" + ProjectsHelper.MEMBERS_DIR
+								+ "/" + projectId + "/" + ProjectsHelper.PROJECT_DESC;
+			pathsSet.add(projectXmlPath);
+		}
+		return pathsSet;
+	}
+	
+	/**
+	 * Path to the jsp file responsible file displaying the Status Matrix.
+	 */
+	public static String getJspCmPath() {
+		return 	JMM_JSP_DIR	 + "/" + JMM_JSP;
+	}
+
+	/**
+	 * Path to the jsp file responsible for displaying project details.
+	 */
+	public static String getPrjDetailsJspCmPath() {
+		return 	JMM_JSP_DIR	 + "/" + PROJECT_DETAILS_JSP;
+	}
+
+	/**
+	 * Path to the jsp file responsible displaying column details.
+	 */
+	public static String getColumnDetailsJspCmPath() {
+		return JMM_JSP_DIR + "/" + COLUMN_DETAILS_JSP;
+	}
+
+	public static String getShotokuStatusPath(String portalName) {
+		return ForgeHelper.DYNAMIC_CONTENT_DIR + "/" + SHOTOKU_JMM_DIR;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/Tags.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/Tags.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/Tags.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,102 @@
+/*
+ * 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.common;
+
+/**
+* @author Pawel Wrzeszcz
+* Status Matrix xml tags. 
+*/
+public class Tags {
+
+	/* jmm.xml file tags */
+	
+	/* main page */
+	public static final String MAIN_PAGE_COLUMNS_TAG 		= "main-page";
+	
+	public final static String COLUMN_ELEMENT				= "column";
+	public final static String COLUMNS_ELEMENT				= "columns";
+	public static final String COLUMN_NAME_ELEMENT 			= "name";
+	public static final String COLUMN_PLUGIN_ELEMENT 		= "plugin";
+	
+	public final static String ORDER_PLUGIN_ELEMENT 			= "order-plugin";
+	
+	/* project page */
+	public static final String PROJECT_PAGE_COLUMNS_TAG 		= "project-page";
+	
+	public static final String ROWS_ELEMENT 					= "rows";
+	public static final String ROW_ELEMENT 					= "row";
+	public static final String ROW_NAME_ELEMENT 				= "name";
+	
+	public static final String CELLS_ELEMENT 				= "cells";
+	public static final String CELL_ELEMENT 					= "cell";
+	public static final String CELL_NAME_ELEMENT 			= "name";
+	
+	public static final String METRICS_ELEMENT 				= "metrics";
+	public static final String METRIC_ELEMENT 				= "metric";
+	public static final String METRIC_NAME_ELEMENT			= "name";
+	public static final String METRIC_PLUGIN_ELEMENT			= "plugin";
+	public static final String METRIC_BOOLEAN_ELEMENT 		= "boolean";
+	
+	/* update.properties tags */
+	
+	public static final String SERVICE_FIRST_UPDATE_ELEMENT 	= "service.first.update";
+	public static final String SERVICE_UPDATE_START_HOUR_ELEMENT = "service.update.start.hour";
+	public static final String SERVICE_UPDATE_START_MINUTE_ELEMENT = "service.update.start.minute";
+	public static final String SERVICE_UPDATE_INTERVAL_ELEMENT = "service.update.interval";
+	
+	/* plugins.xml tags */
+	
+		/* plugin element*/
+	public final static String PLUGIN_ELEMENT				= "plugin";
+	
+	public final static String PLUGIN_ID_ELEMENT 			= "id";
+	public final static String PLUGIN_CLASS_ELEMENT 			= "class";
+	public final static String PLUGIN_PROPERTIES_ELEMENT 	= "properties";
+	
+		/* general properties */
+	public static final String MIN_VALUE_PROPERTY 			= "min-value";
+	public static final String CACHE_VALUES_PROPERTY 		= "cache-values";
+	
+		/* kosmos plugins */
+	public static final String JIRA_SERVICE_PROPERTY 		= "jira-service";
+	public static final String SVN_SERVICE_PROPERTY			= "svn-service";
+	public static final String CC_SERVICE_PROPERTY 			= "cc-service";
+	
+	public static final String CC_ADRESS_TAG 				= "cc-address";
+	
+		/* productization plugins */
+	public static final String FORUM_TYPE_TAG 				= "forum-type";
+	public static final String DOC_TYPE_TAG 					= "doc-type";
+	public static final String SUPPORT_TYPE_TAG 				= "support-type";
+	
+		/* other plugins */
+	public static final String DAYS_TAG						= "days";
+	public static final String PLUGIN_TAG 					= "plugin";
+
+	
+
+	/**
+	 * This class cannot be instatiated.
+	 */
+	private Tags() {};
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/GetScoresException.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/GetScoresException.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/GetScoresException.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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.common.exceptions;
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz at gmail.com)
+* Indicates that searching for saved scores failed. 
+*/
+
+public class GetScoresException extends ScoresException {
+
+	private static final long serialVersionUID = 7291136165537810321L;
+
+	public GetScoresException() {
+		super();
+	}
+
+	public GetScoresException(Exception e) {
+		super(e);
+	}
+
+	public GetScoresException(String msg) {
+		super(msg);
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/InvalidPluginPropertiesException.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/InvalidPluginPropertiesException.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/InvalidPluginPropertiesException.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,15 @@
+package org.jboss.forge.jmm.common.exceptions;
+
+/**
+ * @author pawel
+ * Signals that properties passed to the plugin are missed or incorrect.
+ */
+public class InvalidPluginPropertiesException extends Exception {
+
+	private static final long serialVersionUID = 3709326670581403244L;
+
+	public InvalidPluginPropertiesException(String msg) {
+		super(msg);
+	}
+
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/InvalidPluginsConfigurationException.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/InvalidPluginsConfigurationException.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/InvalidPluginsConfigurationException.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,15 @@
+package org.jboss.forge.jmm.common.exceptions;
+
+/**
+ * @author pawel
+ * Signals that properties passed to the plugin are missed or incorrect.
+ */
+public class InvalidPluginsConfigurationException extends Exception {
+
+	private static final long serialVersionUID = 3709326670581403244L;
+
+	public InvalidPluginsConfigurationException(String msg) {
+		super(msg);
+	}
+
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/ScoresException.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/ScoresException.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/ScoresException.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,44 @@
+/*
+ * 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.common.exceptions;
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz at gmail.com) 
+*/
+
+public class ScoresException extends Exception {
+
+	private static final long serialVersionUID = -8228803296975062691L;
+
+	public ScoresException() {
+		super();
+	}
+	
+	public ScoresException(Exception e) {
+		super(e);
+	}
+	
+	public ScoresException(String msg) {
+		super(msg);
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/ScoresSaveException.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/ScoresSaveException.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/exceptions/ScoresSaveException.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,38 @@
+/*
+ * 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.common.exceptions;
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz at gmail.com)
+* Indicates that computing or saving scores failed. 
+*/
+
+public class ScoresSaveException extends ScoresException {
+
+	private static final long serialVersionUID = 7291136165537810321L;
+
+	public ScoresSaveException(Exception e) {
+		super(e);
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/DBService.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/DBService.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/DBService.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.common.protocol;
+
+import java.io.Serializable;
+import java.util.Calendar;
+
+import org.jboss.forge.jmm.common.protocol.conf.PluginValues;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValues;
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+*/
+public interface DBService extends Serializable {
+	
+	public void save(PluginsValues pluginsValues);
+	
+	public PluginsValues get(Calendar date);
+
+	public long getValue(String pluginId, String projectId, Calendar cal);
+
+	public boolean hasValue(String pluginId, String projectId, Calendar cal);
+	
+	public PluginValues getPluginValues(String pluginId, Calendar cal);
+
+	public boolean hasPluginValues(String pluginId, Calendar cal);
+
+	public boolean hasValue(String pluginId, String projectId, Calendar start, Calendar end);
+
+	public long getValue(String pluginId, String projectId, Calendar start, Calendar end);
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresManager.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresManager.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresManager.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,56 @@
+/*
+ * 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.common.protocol;
+
+import java.io.Serializable;
+import java.util.Calendar;
+
+import javax.naming.NamingException;
+
+import org.jboss.forge.jmm.common.exceptions.ScoresException;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValues;
+
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+*/
+
+public interface ScoresManager extends Serializable {
+	
+	public boolean hasScores(Calendar cal) throws NamingException, ScoresException;
+	
+	public PluginsValues getScores(Calendar cal)
+										throws ScoresException;
+	
+	public PluginsValues getLatestScores()
+									throws ScoresException; 
+	
+	public long getValue(String pluginId, String projectId,
+											Calendar cal)
+			throws ScoresException;
+
+	public long getValue(String id, String projectId,
+			Calendar start, Calendar end) throws ScoresException;
+
+	public void save() throws ScoresException;
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresRepositoryManager.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresRepositoryManager.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresRepositoryManager.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.common.protocol;
+
+import java.io.Serializable;
+import java.util.Calendar;
+
+import org.jboss.forge.jmm.common.exceptions.GetScoresException;
+import org.jboss.forge.jmm.common.exceptions.ScoresSaveException;
+import org.jboss.forge.jmm.common.protocol.conf.PluginValues;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValues;
+
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+*/
+
+public interface ScoresRepositoryManager extends Serializable {
+	
+	public void save(PluginsValues pluginsValues)
+										throws ScoresSaveException;
+	
+	public PluginsValues get(Calendar cal)
+										throws GetScoresException;
+
+	public PluginValues getPluginValues(String pluginId, Calendar cal)
+										throws GetScoresException;
+	
+	public long getValue(String pluginId, String projectId, Calendar cal)
+										throws GetScoresException;
+
+	public long getValue(String pluginId, String projectId, Calendar start,
+									Calendar end) throws GetScoresException;
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresService.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresService.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresService.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,69 @@
+/*
+ * 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.common.protocol;
+
+import java.io.Serializable;
+import java.util.Calendar;
+
+import org.jboss.forge.jmm.common.exceptions.GetScoresException;
+import org.jboss.forge.jmm.common.exceptions.ScoresException;
+import org.jboss.forge.jmm.common.protocol.conf.Configuration;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValuesRemote;
+
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+*/
+
+public interface ScoresService extends Serializable {
+	
+	public void init(Configuration conf, ScoresManager scoresManager)
+												throws ScoresException;
+	
+	public void update(Configuration conf, ScoresManager scoresManager)
+												throws ScoresException;
+	
+	public void save() throws ScoresException;	
+	
+	public void fillPluginsValues(Calendar cal, PluginsValuesRemote pv)
+												throws GetScoresException;
+	
+	public boolean hasPluginsValues(Calendar cal);
+
+	public long getValue(String pluginId, String projectId, Calendar cal)
+												throws GetScoresException;
+
+	public long getValue(String pluginId, String projectId,
+						  Calendar start, Calendar end)
+												throws GetScoresException;
+	
+	public void ping();
+	
+	public Object invoke(org.jboss.invocation.Invocation mi) throws Exception;
+	
+	//	 Life cycle methods
+	public void start () throws Exception;
+	public void stop () throws Exception;
+
+	public PluginsValuesRemote getPluginsValuesRemote(Calendar cal) throws GetScoresException;
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresServiceLocal.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresServiceLocal.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresServiceLocal.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,34 @@
+/*
+ * 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.common.protocol;
+
+import javax.ejb.Local;
+
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+*/
+ at Local
+public interface ScoresServiceLocal extends ScoresService {
+
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresServiceRemote.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresServiceRemote.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/ScoresServiceRemote.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,34 @@
+/*
+ * 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.common.protocol;
+
+import javax.ejb.Remote;
+
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+*/
+ at Remote
+public interface ScoresServiceRemote extends ScoresService {
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/Configuration.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/Configuration.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/Configuration.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,44 @@
+/*
+ * 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.common.protocol.conf;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz [at] jboss . com)
+*/
+public interface Configuration extends Serializable {
+
+	public String getPortalName();
+	
+	public List<String> getProjectIds();
+	
+	public ServiceConf getScoresServiceConf();
+	
+	public ServiceConf getProjectsServiceConf();
+	
+	public UpdatesConf getUpdateConf();
+	
+	public List<PluginConf> getPluginsConf();
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/Plugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/Plugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/Plugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,261 @@
+/*
+ * 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.common.protocol.conf;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.jboss.forge.jmm.common.Constants;
+import org.jboss.forge.jmm.common.Tags;
+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;
+
+/**
+* @author Pawel Wrzeszcz
+* Superclass for Status Matrix Plugins.
+*/
+
+public abstract class Plugin {
+	
+	/** Properties specyfic to this plugin */
+	protected Properties properties;
+	
+	/** Plugin id */
+	protected String id;
+	
+	/** Portal name */
+	protected String portalName;
+	
+	/** Projects present in the Status Matrix. */
+	protected List<String> projectIds;
+	
+	/** Plugins loaded before this plugin */
+	protected Plugins plugins;
+	
+	protected ScoresManager scoresManager;
+	
+	/** Default min value for plugin */
+	protected long minValue = Constants.PLUGIN_DEFAULT_MIN_VALUE;
+	
+	/** Cache values by default. */
+	protected boolean cacheValues = true;
+	
+	private Map<String,Long> cache;
+	
+	private Logger log = Logger.getLogger(Plugin.class);
+	
+	/**
+	 * @param id Plugin id
+	 * @param portalName Portal name
+	 * @param projectIds Projects present in the Status Matrix
+	 * @param properties plugin specyfic properties
+	 * or null if properties are not specified
+	 * @param scoresManager 
+	 * @patam plugins Plugins loaded before this plugin
+	 * @throws InvalidPluginPropertiesException
+	 * Thrown when properties passed in <code>propertiesNode</code>
+	 * are incorrect or missing. 
+	 */
+	public void init(String id, String portalName, List<String> projectIds,
+			Plugins plugins, Properties properties, ScoresManager scoresManager)
+						throws InvalidPluginPropertiesException {
+		
+		this.id = id;
+		this.portalName = portalName;
+		this.projectIds = projectIds;
+		this.plugins = plugins;
+		this.properties = properties;
+		this.scoresManager = scoresManager;
+		
+		parseProperties();
+		
+		if (cacheValues) {
+			cache = new HashMap<String,Long>();
+		}
+	}
+	
+	private void parseProperties() {
+
+		if (properties == null) {
+			return;
+		}
+		
+		String minValueString = properties.getProperty(
+													Tags.MIN_VALUE_PROPERTY);
+		
+		if (minValueString != null) {
+			minValue = Long.parseLong(minValueString);
+		}
+		
+		String cacheValuesString = properties.getProperty(
+													Tags.CACHE_VALUES_PROPERTY);
+		
+		if (cacheValuesString != null) {
+			cacheValues = Boolean.parseBoolean(cacheValuesString);
+		}
+	}
+
+	/**
+	 * For the given project returns value specyfic to this plugin.
+	 * If an error occured while computing a value, returns
+	 * <code>Constants.DEFAULT_PLUGIN_VALUE</code> 
+	 * 
+	 * @param projectId project id
+	 * @return value computed by plugin for the project
+	 * with the given <code>projectId</code>.
+	 */
+	public final long getValue(String projectId) {
+		
+		if (cacheValues && cache.containsKey(projectId)) {
+			
+			return cache.get(projectId);
+		}
+		
+		long v = Constants.DEFAULT_PLUGIN_VALUE;
+		
+		try {
+		
+			v = getPluginValue(projectId);
+			
+		} catch (Exception e) {
+			
+			log.warn("Exception in plugin (getPluginValue): " + id + 
+												"\nCause: ", e);	
+		}
+		
+		v = Math.max(v, minValue);
+		
+		if (cacheValues) {
+			cache.put(projectId, v);
+		}
+		
+		return v;
+	}
+	
+	/**
+	 * For the given project returns value specyfic to this plugin.
+	 * 
+	 * @param projectId project id
+	 * @return value computed by plugin for the project
+	 * with the given <code>projectId</code>.
+	 */
+	protected abstract long getPluginValue(String projectId);
+	
+	
+	/** For the given project returns link associated with this plugin
+	 * and project or null if such link does not exsist.
+	 */
+	public final String getLink(String projectId) {
+		
+		String s = null;
+		
+		try {
+		
+			s = getPluginLink(projectId);
+			
+		} catch (Exception e) {
+			
+			log.warn("Exception in plugin (getPluginLink)" + id + 
+												"\nCause: " + e.getMessage());	
+		}
+		
+		return s;
+	}
+	
+	/** For the given project returns link associated with this plugin and project.
+	 * Should be overrided inside plugins that have some links associated with projects.
+	 */
+	protected String getPluginLink(String projectId) {
+		return null;
+	}
+	
+	/** For the given project returns name of link associated with this plugin
+	 * or null if projects have not any link associated with this plugin.
+	 */
+	public final String getLinkName() {
+		
+		String s = null;
+		
+		try {
+		
+			s = getPluginLinkName();
+			
+		} catch (Exception e) {
+			
+			log.warn("Exception in plugin (getPluginLinkName)" + id + 
+												"\nCause: " + e.getMessage());	
+		}
+		
+		return s;
+	}
+	
+	/** For the given project returns name of link associated with this plugin
+	 * or null if projects have not any link associated with this plugin.
+	 * This method should be overrided inside plugins that have some links associated with projects.
+	 */
+	protected String getPluginLinkName() {
+		return null;
+	}
+	
+	/**
+	 * For the given project returns it's rate.
+	 * Rate is computed as project's score share in
+	 * sum of all scores. 
+	 * 
+	 * @param projectId project id
+	 * @return rate computed by plugin for the project
+	 * with the given <code>projectId</code>.
+	 */
+	public final int getRate(String projectId) {
+				
+		long totalScore = getTotalScore();
+			
+		if (totalScore == 0) {
+			return 0;
+		}
+		
+		float r = ((float) getValue(projectId) / (float) totalScore);
+		
+		return (int) (100.0 * r);
+	}
+
+	/**
+	 * @return plugin id
+	 */
+	public final String getId() { return id; };
+
+	private long getTotalScore() {
+		
+		long s = 0;
+		
+		for (String projectId : projectIds) {
+			s += getValue(projectId);
+		}
+		
+		return s;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginConf.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginConf.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginConf.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.common.protocol.conf;
+
+import java.io.Serializable;
+import java.util.Properties;
+
+/**
+* @author Pawel Wrzeszcz
+*/
+public interface PluginConf extends Serializable {
+	
+	public String getFieldValue(String fieldName);
+	
+	public Properties getProperties();
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginValues.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginValues.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginValues.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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.common.protocol.conf;
+
+import java.io.Serializable;
+import java.util.Set;
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+*/
+
+public interface PluginValues extends Serializable {
+	
+	public String getPluginId();
+	
+	public long getValue(String projectId);
+
+	public int getRate(String projectId);
+	
+	public String getLink(String projectId);
+	
+	public String getLinkName();
+
+	public Set<String> getProjectIds();
+
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginValuesRemote.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginValuesRemote.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginValuesRemote.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,88 @@
+
+ /*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2006, 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.common.protocol.conf;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+
+import org.jboss.forge.jmm.common.tools.ProjectTools;
+
+/**
+ * @author Pawel Wrzeszcz (pawel.wrzeszcz [at] jboss.com)
+ */
+
+public class PluginValuesRemote implements PluginValues
+{
+	private static final long serialVersionUID = 4142357350367386462L;
+	
+	private String pluginId;
+	private String linkName;
+	
+	private Map<String,Long> values = new HashMap<String,Long>();
+	private Map<String,Integer> rates = new HashMap<String,Integer>();
+	private Map<String,String> links = new HashMap<String,String>();
+		
+	public void fill(PluginValues pluginValues) {
+	
+		// Get plugin properties
+		pluginId = pluginValues.getPluginId();
+		linkName = pluginValues.getLinkName();
+		
+		Set<String> projectIds = pluginValues.getProjectIds();
+		
+		// Get plugin values
+		for (String projectId : projectIds) {
+			
+			values.put(projectId, pluginValues.getValue(projectId));
+			rates.put(projectId, pluginValues.getRate(projectId));
+			links.put(projectId, pluginValues.getLink(projectId));
+		}
+	}
+
+	public String getPluginId() {
+		return pluginId;
+	}
+	
+	public long getValue(String projectId) {
+		return values.get(projectId);
+	}
+
+	public int getRate(String projectId) {
+		return rates.get(projectId);
+	}
+	
+	public String getLink(String projectId) {
+		return links.get(projectId);
+	}
+	
+	public String getLinkName() {
+		return linkName;
+	}
+
+	public Set<String> getProjectIds() {	
+		return values.keySet();
+	}
+    
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginsValues.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginsValues.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginsValues.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,44 @@
+/*
+ * 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.common.protocol.conf;
+
+import java.util.Calendar;
+import java.util.Set;
+import java.io.Serializable;
+
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+*/
+
+public interface PluginsValues extends Serializable {
+	
+	/**
+	 * @return creation date
+	 */
+	public Calendar getDate();
+	
+	public PluginValues getPluginValues(String pluginId);
+
+	public Set<String> getPluginIds();
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginsValuesRemote.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginsValuesRemote.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/PluginsValuesRemote.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,78 @@
+
+ /*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2006, 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.common.protocol.conf;
+
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * @author Pawel Wrzeszcz (pawel.wrzeszcz [at] jboss.com)
+ */
+
+public class PluginsValuesRemote implements PluginsValues
+{
+	
+	private static final long serialVersionUID = 2851669550958357864L;
+
+	private Calendar date;
+    
+	/** Map : pluginId -> pluginValue */
+	private Map<String,PluginValuesRemote> values;
+
+	public Calendar getDate() {
+		return date;
+	}
+
+	public PluginValues getPluginValues(String pluginId) {
+		
+		return values.get(pluginId);
+	}
+	
+	public void fill(PluginsValues pv) {
+		
+		date = pv.getDate();
+		
+		Set<String> pluginIds = pv.getPluginIds();
+		
+		values = new HashMap<String,PluginValuesRemote>();
+		
+		for (String pluginId : pluginIds) {
+			
+			PluginValuesRemote pluginValuesToFill = new PluginValuesRemote();
+			PluginValues pluginValues = pv.getPluginValues(pluginId);
+			
+			pluginValuesToFill.fill(pluginValues);
+			
+			values.put(pluginId,pluginValuesToFill);
+		}
+	}
+
+	public Set<String> getPluginIds() {
+		
+		return values.keySet();
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/ScoresFactory.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/ScoresFactory.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/ScoresFactory.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.common.protocol.conf;
+
+import java.io.Serializable;
+import java.util.List;
+import org.jboss.forge.jmm.common.tools.Plugins;
+
+/**
+* @author Pawel Wrzeszcz
+* 
+* An abstract factory for creating objects that handle scores.
+*/
+public interface ScoresFactory extends Serializable {
+	
+	public PluginsValues createPluginsValues(List<String> projectIds, Plugins plugins);
+	
+	public PluginValues createPluginValues(Plugin plugin, List<String> projectIds);
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/ScoresUpdater.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/ScoresUpdater.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/ScoresUpdater.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.common.protocol.conf;
+
+import java.io.Serializable;
+
+import org.jboss.forge.jmm.common.protocol.ScoresService;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz [at] jboss . com)
+*/
+public interface ScoresUpdater extends Serializable {
+	
+	public void init(ScoresService scoresService, UpdatesConf conf);
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/ServiceConf.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/ServiceConf.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/ServiceConf.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,35 @@
+/*
+ * 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.common.protocol.conf;
+
+import java.io.Serializable;
+import java.util.Properties;
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+*/
+public interface ServiceConf extends Serializable {
+
+	public Properties getProperties();
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/UpdatesConf.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/UpdatesConf.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/UpdatesConf.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.common.protocol.conf;
+
+import java.io.Serializable;
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+*/
+public interface UpdatesConf extends Serializable {
+
+	public int getFirstUpdate();
+	
+	public int getUpdateStartHour();
+	
+	public int getUpdateStartMinute();
+	
+	public int getUpdateInterval();
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/ConfgurationImpl.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/ConfgurationImpl.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/ConfgurationImpl.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,142 @@
+/*
+ * 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.common.protocol.conf.impl;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.common.projects.ProjectsHelper;
+import org.jboss.forge.common.projects.permissions.NullPermissionsChecker;
+import org.jboss.forge.common.projects.permissions.PermissionsChecker;
+import org.jboss.forge.jmm.common.Locations;
+import org.jboss.forge.jmm.common.Tags;
+import org.jboss.forge.jmm.common.exceptions.InvalidPluginsConfigurationException;
+import org.jboss.forge.jmm.common.protocol.conf.Configuration;
+import org.jboss.forge.jmm.common.protocol.conf.PluginConf;
+import org.jboss.forge.jmm.common.protocol.conf.ServiceConf;
+import org.jboss.forge.jmm.common.protocol.conf.UpdatesConf;
+import org.jboss.forge.jmm.common.tools.Tools;
+import org.jboss.logging.Logger;
+import org.jboss.shotoku.ContentManager;
+import org.jboss.shotoku.Node;
+import org.jboss.shotoku.exceptions.RepositoryException;
+import org.jboss.shotoku.exceptions.ResourceDoesNotExist;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz [at] jboss . com)
+*/
+public class ConfgurationImpl implements Configuration {
+
+	private String portalName;
+	private List<String> projectIds;
+	private List<PluginConf> pluginsConf;
+	
+	private ServiceConf scoresServiceConf;
+	private ServiceConf projectsServiceConf;
+	private UpdatesConf updateConf;
+
+	private static final long serialVersionUID = 772452316632341L;
+	private static Logger log = Logger.getLogger(ConfgurationImpl.class);
+	
+	
+	public ConfgurationImpl(String portalName, ContentManager cm)
+							throws RepositoryException, ResourceDoesNotExist,
+								   IOException, SAXException {
+		
+		String servicePath = Locations.getServicePropertiesCmPath(portalName);
+		Node serviceNode = cm.getNode(servicePath);
+		scoresServiceConf = new ServiceConfImpl(serviceNode);
+		
+		String projectsServicePath = Locations.getProjectsServicePropertiesCmPath(portalName);
+		Node projectsServiceNode = cm.getNode(projectsServicePath);
+		projectsServiceConf = new ServiceConfImpl(projectsServiceNode);
+		
+		String updatePropertiesPath = Locations.getUpdatePropertiesCmPath(portalName);
+		Node updatePropertiesNode = cm.getNode(updatePropertiesPath);
+		 updateConf = new UpdatesConfImpl(updatePropertiesNode);
+		
+		String pluginsPath = Locations.getXmlJMMPluginsCmPath(portalName);
+		org.w3c.dom.Node pluginsNode = Tools.getRoot(cm, pluginsPath);
+		pluginsConf = getPluginsConfList(pluginsNode);
+		
+		Projects projects = ProjectsHelper.getProjects(portalName);
+		projectIds = new ArrayList<String>(
+				projects.getProjectIds(
+						(PermissionsChecker) new NullPermissionsChecker(), null));
+		
+	}
+	
+	public String getPortalName() {
+		return portalName;
+	}
+	
+	public List<String> getProjectIds() {
+		return projectIds;
+	}
+	
+	public List<PluginConf> getPluginsConf() {
+		return pluginsConf;
+	}
+	
+	public ServiceConf getProjectsServiceConf() {
+		return projectsServiceConf;
+	}
+	
+	public ServiceConf getScoresServiceConf() {
+		return scoresServiceConf;
+	}
+	
+	public UpdatesConf getUpdateConf() {
+		return updateConf;
+	}
+
+	public static List<PluginConf> getPluginsConfList(org.w3c.dom.Node pluginsRoot) {
+	
+		List<PluginConf> pluginsConfList = new ArrayList<PluginConf>();
+	
+		NodeList pluginNodes = pluginsRoot.getChildNodes();
+		
+		for (int i = 0; i < pluginNodes.getLength(); i++) {
+			org.w3c.dom.Node pluginNode = pluginNodes.item(i);
+	
+			if (pluginNode.getNodeName() != Tags.PLUGIN_ELEMENT) {
+				continue;
+			}
+			
+			try {
+				PluginConfImpl pluginConf = new PluginConfImpl(pluginNode);
+				pluginsConfList.add(pluginConf);
+				
+			} catch (InvalidPluginsConfigurationException e) {
+				log.warn("Invalid plugin configuration. " + e.getMessage());
+			}
+		}
+	
+		return pluginsConfList;
+	}
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/PluginConfImpl.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/PluginConfImpl.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/PluginConfImpl.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,81 @@
+/*
+ * 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.common.protocol.conf.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.jboss.forge.common.XmlTools;
+import org.jboss.forge.jmm.common.Tags;
+import org.jboss.forge.jmm.common.exceptions.InvalidPluginsConfigurationException;
+import org.jboss.forge.jmm.common.protocol.conf.PluginConf;
+import org.w3c.dom.Node;
+
+/**
+* @author Pawel Wrzeszcz
+*/
+public class PluginConfImpl implements PluginConf {
+	
+	private static final long serialVersionUID = 8598887068548048511L;
+
+	private Map<String,String> fields = new HashMap<String,String>();
+	private Properties properties;
+	
+	public PluginConfImpl(Node pluginNode)
+						throws InvalidPluginsConfigurationException {
+		
+		// Parse plugin configuration
+		parseField(pluginNode, Tags.PLUGIN_ID_ELEMENT);
+		parseField(pluginNode, Tags.PLUGIN_CLASS_ELEMENT);
+		
+		// Parse plugin properties
+		Node pluginPropertiesNode =
+				XmlTools.getFirstNodeWithName(pluginNode,
+						Tags.PLUGIN_PROPERTIES_ELEMENT);
+		
+		properties = XmlTools.parseProperties(pluginPropertiesNode); 
+	}
+	
+	public String getFieldValue(String fieldName) {
+		return fields.get(fieldName);
+	}
+	
+	public Properties getProperties() {
+		return properties;
+	}
+	
+	private void parseField(Node pluginNode, String fieldName)
+							throws InvalidPluginsConfigurationException {
+		
+		String fieldValue =
+			XmlTools.getChildNodeValue(pluginNode, fieldName);
+
+		if (fieldValue == null) {
+			throw new InvalidPluginsConfigurationException(
+									"Missing field: " + fieldName);
+		}
+		
+		fields.put(fieldName, fieldValue);
+	}
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/ServiceConfImpl.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/ServiceConfImpl.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/ServiceConfImpl.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,55 @@
+/*
+ * 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.common.protocol.conf.impl;
+
+import java.util.Properties;
+
+import org.jboss.forge.jmm.common.protocol.conf.ServiceConf;
+import org.jboss.forge.jmm.common.tools.Tools;
+import org.jboss.shotoku.Node;
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+*/
+public class ServiceConfImpl implements ServiceConf {
+	
+
+	private static final long serialVersionUID = 9276134986978721L;
+	
+	private Properties properties;
+	
+	
+	public ServiceConfImpl(Node serviceNode) {
+			
+		properties = Tools.parseProperties(serviceNode, null);										
+	}
+
+
+	public Properties getProperties() {
+		
+		return properties;
+	}
+
+
+
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/ServiceScoresManager.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/ServiceScoresManager.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/ServiceScoresManager.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,194 @@
+/*
+ * 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.common.protocol.conf.impl;
+
+
+import java.util.Calendar;
+import java.util.Properties;
+import javax.naming.NamingException;
+
+import org.jboss.forge.jmm.common.Constants;
+import org.jboss.forge.jmm.common.exceptions.GetScoresException;
+import org.jboss.forge.jmm.common.exceptions.ScoresException;
+import org.jboss.forge.jmm.common.protocol.ScoresManager;
+import org.jboss.forge.jmm.common.protocol.ScoresService;
+import org.jboss.forge.jmm.common.protocol.conf.Configuration;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValues;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValuesRemote;
+import org.jboss.forge.jmm.common.tools.Tools;
+
+import org.jboss.logging.Logger;
+
+
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+*/
+
+public class ServiceScoresManager implements ScoresManager {
+
+	private static final long serialVersionUID = -3398452363516977124L;
+
+	private Properties properties;
+	private Configuration conf;
+	private Logger log;
+	
+	public ServiceScoresManager(Configuration conf) throws ScoresException {
+		
+		properties = conf.getScoresServiceConf().getProperties();
+		this.conf = conf;
+		
+		log = Logger.getLogger(this.getClass());
+		
+		initService();
+	}
+
+	public synchronized void save() throws ScoresException {
+
+		ScoresService service = getService();
+		service.save();		
+	}
+	
+	
+	public boolean hasScores(Calendar cal) throws NamingException, ScoresException {
+		
+		ScoresService service = getService();
+		return service.hasPluginsValues(cal);
+	}
+	
+	
+	public PluginsValues getScores(Calendar cal)
+										throws ScoresException {
+
+		log.info("getScores");
+
+		PluginsValuesRemote pluginsValues;
+		try {
+			ScoresService service = getService();
+			pluginsValues = service.getPluginsValuesRemote(cal);
+		} catch (ScoresException e) {
+			throw e;			
+		} catch (Exception e) {
+			throw new GetScoresException(e);
+		}
+
+		if (pluginsValues == null) {
+			throw new GetScoresException("Null plugins values");
+		}
+
+		return pluginsValues;
+	}
+	
+	
+	public PluginsValues getLatestScores()
+									throws ScoresException {
+		
+		Calendar cal = Calendar.getInstance();
+		Tools.truncate(cal);
+		int attempts = 0;
+		
+		for(;;) {
+			
+			log.debug("Trying " + cal.getTime().toString());
+			
+			boolean hasScores;
+			
+			try {
+				hasScores = hasScores(cal);
+			} catch (NamingException e) {
+				throw new GetScoresException(e);
+			}
+			
+			if (hasScores) {
+				return getScores(cal);
+			}
+			
+			if ((++attempts) == Constants.MAX_ATTEMPTS) {
+				throw new GetScoresException(
+						"Can not find any recently saved scores. " +
+						"Gave up after " + attempts + " attempts.");
+			}
+			
+			cal.add(Calendar.DAY_OF_MONTH, -1);
+		}
+	}
+
+
+	/**
+	 * For the specified plugin returns historical project score
+	 * from the given <code>date</code> in the past.
+	 * 
+	 * Notice that only year, month and day matter in passed dates.
+	 * 
+	 * @return project score from the given date for specified plugin
+	 * @throws GetScoresException
+	 */
+	public long getValue(String pluginId, String projectId,
+											Calendar cal)
+			throws ScoresException {
+		
+		ScoresService service = getService();
+		return service.getValue(pluginId, projectId, cal);
+	}
+
+	/**
+	 * For the given plugin and project ids returns stored value.
+	 * 
+	 * @param pluginId plugin id
+	 * @param projectId project id
+	 * @return stored plugin value for specified project
+	 * @throws GetScoresException
+	 * Thrown when requested value was not found
+	 */
+	public long getValue(String pluginId, String projectId,
+			Calendar start, Calendar end) throws ScoresException {
+		
+		ScoresService service = getService();
+		return service.getValue(pluginId, projectId, start, end);
+	}
+	
+	private ScoresService getService() throws ScoresException {
+		
+		try {			
+			ScoresService service = Tools.getScoresService(properties);
+			service.update(conf, this);
+			
+			return service;
+		} catch (NamingException e) {
+			throw new ScoresException(e);
+		}
+	}
+	
+	private void initService() {
+		
+		try {			
+			ScoresService service = Tools.getScoresService(properties);
+			service.init(conf, this);
+		} catch (Exception e) {
+			log.warn("Unable to initialize ScoresService." +
+					"\nCause: " + e.getMessage());
+			log.debug("initService() failed", e);
+		}
+		
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/UpdatesConfImpl.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/UpdatesConfImpl.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/protocol/conf/impl/UpdatesConfImpl.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,89 @@
+/*
+ * 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.common.protocol.conf.impl;
+
+import java.util.Properties;
+
+import org.jboss.forge.jmm.common.Constants;
+import org.jboss.forge.jmm.common.Tags;
+import org.jboss.forge.jmm.common.protocol.conf.UpdatesConf;
+import org.jboss.forge.jmm.common.tools.Tools;
+
+import org.jboss.shotoku.Node;
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+*/
+public class UpdatesConfImpl implements UpdatesConf {
+		
+	
+	private static final long serialVersionUID = 54399755111252464L;
+	
+	private int firstUpdate;
+	private int updateInterval;
+	private int updateStartHour;
+	private int updateStartMinute;
+	
+	public UpdatesConfImpl(Node serviceNode) {
+		
+		Properties properties = Tools.parseProperties(serviceNode, null);
+				
+		firstUpdate = Tools.parseIntProperty(properties,
+								Tags.SERVICE_FIRST_UPDATE_ELEMENT,
+								Constants.FIRST_UPDATE_INTERVAL_DEFAULT);
+		
+		updateInterval = Tools.parseIntProperty(properties,
+								Tags.SERVICE_UPDATE_INTERVAL_ELEMENT,
+								Constants.SCORES_UPDATE_INTERVAL_DEFAULT);
+		
+		updateStartHour = Tools.parseIntProperty(properties,
+								Tags.SERVICE_UPDATE_START_HOUR_ELEMENT,
+								Constants.UPDATE_START_HOUR_DEFAULT);
+		
+		updateStartMinute = Tools.parseIntProperty(properties,
+								Tags.SERVICE_UPDATE_START_MINUTE_ELEMENT,
+								Constants.UPDATE_START_MINUTE_DEFAULT);
+		
+	}
+
+	public int getFirstUpdate() {
+		
+		return firstUpdate;
+	}
+
+	public int getUpdateInterval() {
+		
+		return updateInterval;
+	}
+
+	public int getUpdateStartHour() {
+		
+		return updateStartHour;
+	}
+
+	public int getUpdateStartMinute() {
+		
+		return updateStartMinute;
+	}
+
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/Plugins.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/Plugins.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/Plugins.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,175 @@
+/*
+ * 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.common.tools;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Collection;
+import java.util.Properties;
+import java.util.Set;
+
+import org.jboss.forge.jmm.common.Tags;
+import org.jboss.forge.jmm.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.jmm.common.protocol.ScoresManager;
+import org.jboss.forge.jmm.common.protocol.conf.Plugin;
+import org.jboss.forge.jmm.common.protocol.conf.PluginConf;
+
+import org.jboss.logging.Logger;
+
+/**
+* @author Pawel Wrzeszcz
+* A class storing plugins that occur in the Status Matrix.
+*/
+
+public class Plugins {;
+	
+	/**
+	 * All plugins stored in this class.
+	 */
+	private Map<String, Plugin> plugins;
+	
+	/**
+	 * Projects present in the Status Matrix.
+	 */
+	private List<String> projectIds;
+	
+	private ScoresManager scoresManager;
+	
+	private Logger log;
+	
+	/**
+	 * @param pluginsNode Node with plugins definitions
+	 * @param portalName portal name
+	 * @param projectIds Projects present in the Status Matrix
+	 */
+	public Plugins(List<PluginConf> pluginsConf, String portalName,
+							List<String> projectIds, ScoresManager scoresManager) {
+		
+		this.projectIds = projectIds;
+		this.scoresManager = scoresManager;
+		
+		log = Logger.getLogger(this.getClass());
+		
+		plugins = new HashMap<String,Plugin>();
+
+		addAll(pluginsConf, portalName);
+	}
+	
+	/**
+	 * For the given Node, describing the Plugin, returns Plugin instance.
+	 * 
+	 * @param pluginNode Node with Plugin definition
+	 * @param portalName
+	 * 
+	 * @return Plugin defined in the <code>pluginNode</code>
+	 */
+	public Plugin getPlugin(PluginConf pluginConf, String portalName) {
+		
+		// Get plugin info from pluginNode
+		
+		String pluginClassString = pluginConf.getFieldValue(
+										Tags.PLUGIN_CLASS_ELEMENT);
+						
+		String pluginId = pluginConf.getFieldValue(
+										Tags.PLUGIN_ID_ELEMENT);
+		
+		if ((pluginClassString == null) || (pluginId == null))
+			return null;
+		
+		// Get plugin class
+		
+		Class pluginClass = null;
+		try {
+			pluginClass = Thread.currentThread().getContextClassLoader().loadClass(pluginClassString);
+		} catch (ClassNotFoundException e) {
+			log.error("Plugin class not found: " + pluginClassString);
+			return null;
+		}
+
+		// Get plugin properties
+		Properties pluginProperties = pluginConf.getProperties();
+		
+		// Get plugin instance;
+		Plugin plugin = null;
+		try {
+			plugin = (Plugin) pluginClass.newInstance();
+			
+			plugin.init(pluginId, portalName, projectIds,
+					this, pluginProperties, scoresManager);
+			
+		} catch (InvalidPluginPropertiesException e) {
+			log.warn("Plugin class: " + pluginClassString + 
+						".  Initialization failed.", e);
+			return null;
+		}  catch (Exception e) {
+			log.error("Plugin class: " + pluginClassString +
+						". Instantination failed.", e);
+			return null;
+		}
+		
+		log.info("Added plugin: " + plugin.getId() +
+									" (" + pluginClassString + ").");
+		
+		return plugin;
+	}
+
+	/**
+	 * Returns plugin with the given id.
+	 * 
+	 * @param pluginId
+	 * @return Plugin with the given <code>pluginId</code>
+	 * or null if such plugin does not exist.
+	 */
+	public Plugin get(String pluginId) {
+		
+		return plugins.get(pluginId);
+	}
+
+	/**
+	 * Adds Plugins defined in the given Node.
+	 * 
+	 * @param pluginsNode Node with plugins definitions
+	 * @param portalName portal name
+	 */
+	public void addAll(List<PluginConf> pluginsConf, String portalName) {
+		
+		for (PluginConf pluginConf : pluginsConf) {
+			
+			Plugin plugin = getPlugin(pluginConf, portalName);
+			if (plugin != null) {
+				plugins.put(plugin.getId(), plugin);
+			}
+		}
+	}
+
+	public Collection<Plugin> getPlugins() {
+		
+		return plugins.values();
+	}
+	
+	public Set<String> getPluginIds() {
+		
+		return plugins.keySet();
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/ProjectTools.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/ProjectTools.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/ProjectTools.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,123 @@
+package org.jboss.forge.jmm.common.tools;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+
+import org.jboss.forge.common.projects.project.BuildResult;
+import org.jboss.forge.common.projects.project.BuildType;
+import org.jboss.forge.common.projects.project.Downloads;
+import org.jboss.forge.common.projects.project.IssueTracker;
+import org.jboss.forge.common.projects.project.IssueTrackerType;
+import org.jboss.forge.common.projects.project.Project;
+import org.jboss.forge.common.projects.project.RepoType;
+import org.jboss.forge.common.projects.project.Repository;
+import org.jboss.forge.common.soa.projects.ProjectsService;
+import org.jboss.logging.Logger;
+
+/**
+ * @author Pawel Wrzeszcz
+ */
+public class ProjectTools {
+	
+	private static ProjectsService service = null;
+	
+	private static Logger log = Logger.getLogger(ProjectTools.class);
+	
+
+	public static void init(String portalName,
+				Properties projectsServiceProperties) throws NamingException {
+		
+		try {
+			service = getProjectsService(projectsServiceProperties);
+			
+		} catch (NamingException e) {
+			log.warn("Unable to obtain Projects Service. " +
+					 "\nCause: " + e.getMessage());
+			log.debug("Properties: " + projectsServiceProperties +". ",e);
+			throw e;
+		}
+	}
+
+	private static ProjectsService getProjectsService(Properties properties)
+	  throws NamingException {
+
+		InitialContext ic = new InitialContext(properties);
+		ProjectsService service = (ProjectsService)ic.lookup("ProjectsService");
+
+		return service;
+	}
+
+	public static List<String> getProjectJems(String projectId) {
+		
+		return service.getProjectJems(projectId);
+	}
+
+	public static List<String> getProjectCcURLs(String projectId) {
+
+		List<BuildResult> buildResults = service.getProjectBuildresults(projectId);
+		List<String> ccBuildURLs = new ArrayList<String>();
+		
+		for (BuildResult buildResult : buildResults) {
+			
+			if (buildResult.getType() == BuildType.CRUISE_CONTROL) {
+				ccBuildURLs.add(buildResult.getValue());
+			}
+		}
+		
+		return ccBuildURLs;
+	}
+	
+	public static List<Repository> getProjectSVNRepositories(String projectId) {
+		
+		List<Repository> repoList = service.getProjectRepositories(projectId);
+		List<Repository> svnRepoList = new ArrayList<Repository>();
+		
+		for (Repository repository : repoList) {
+			
+			if (repository.getType() == RepoType.SVN) {
+				svnRepoList.add(repository);
+			}
+		}
+		
+		return svnRepoList;
+	}
+
+	public static IssueTracker getProjectJiraIssueTracker(String projectId) {
+		
+		List<IssueTracker> issueTrackerList = service.getProjectIssueTrackers(projectId);
+		
+		for (IssueTracker tracker : issueTrackerList) {
+			
+			if (tracker.getType() == IssueTrackerType.JIRA) {
+				
+				return tracker;
+			}
+		}
+		
+		return null;
+	}
+
+	public static Project getProject(String projectId) {
+		
+		return service.getProjectByName(projectId);
+	}
+
+	public static Downloads getProjectDownloads(String projectId) {
+		
+		return service.getProjectDownloads(projectId);
+	}
+
+	public static long getOverallDownloadsForProject(String projectId, String portalName) {
+		
+		return service.getOverallDownloadsForProject(projectId, portalName);
+	}
+
+	public static boolean getPackagedForDownload(String projectId) {
+		
+		return service.getPackagedForDownload(projectId);
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/ProjectsByNameComparator.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/ProjectsByNameComparator.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/ProjectsByNameComparator.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.common.tools;
+
+import java.util.Comparator;
+
+import org.jboss.forge.common.projects.Projects;
+
+/**
+ * @author Pawel Wrzeszcz
+ * Implements alphabetical projects order by name.
+ */
+
+public class ProjectsByNameComparator implements Comparator<String> {
+
+	private Projects projects;
+	
+	public ProjectsByNameComparator(Projects projects) {
+		this.projects = projects;
+	}
+	
+	public int compare(String project1Id, String project2Id) {
+		
+		String project1Name = projects.getProjectName(project1Id);
+		String project2Name = projects.getProjectName(project2Id);
+		
+		return project1Name.compareTo(project2Name);
+	}
+
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/ProjectsByScoreComparator.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/ProjectsByScoreComparator.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/ProjectsByScoreComparator.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.common.tools;
+
+import java.util.Comparator;
+
+import org.jboss.forge.jmm.common.protocol.conf.PluginValues;
+
+
+/**
+ * @author Pawel Wrzeszcz
+ * Implements projects order by score.
+ */
+
+public class ProjectsByScoreComparator implements Comparator<String> {
+
+	private PluginValues orderPluginValues;
+
+	/**
+	 * @param orderPlugin Plugin determining projects order
+	 */
+	public ProjectsByScoreComparator(PluginValues orderPluginValues) {
+		this.orderPluginValues = orderPluginValues;
+	}
+	
+	public int compare(String project1Id, String project2Id) {
+		
+		Long project1Score = new Long(orderPluginValues.getValue(project1Id));
+		Long project2Score = new Long(orderPluginValues.getValue(project2Id));
+		
+		return project2Score.compareTo(project1Score);
+	}
+
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/Tools.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/Tools.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-common/src/java/org/jboss/forge/jmm/common/tools/Tools.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,212 @@
+package org.jboss.forge.jmm.common.tools;
+
+import java.io.IOException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnectorServer;
+import javax.management.remote.JMXConnectorServerFactory;
+import javax.management.remote.JMXServiceURL;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.rmi.PortableRemoteObject;
+
+import org.apache.xerces.parsers.DOMParser;
+import org.jboss.forge.jmm.common.Constants;
+import org.jboss.forge.jmm.common.protocol.ScoresService;
+import org.jboss.forge.jmm.common.protocol.conf.ScoresUpdater;
+
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.shotoku.ContentManager;
+import org.jboss.shotoku.exceptions.ResourceDoesNotExist;
+
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * Common functions.
+ * @author Pawel Wrzeszcz
+ */
+public class Tools {
+	
+	private static Logger log = Logger.getLogger(Tools.class);
+	
+	public static void truncate(Calendar cal) {
+		
+		cal.set(Calendar.HOUR_OF_DAY, 0);
+		cal.set(Calendar.MINUTE, 0);
+		cal.set(Calendar.SECOND, 0);
+		cal.set(Calendar.MILLISECOND, 0);
+	}
+
+	public static List<String> getCommaSeparatedStrings(String s) {
+
+		List<String> list = new ArrayList<String>();
+        
+        StringTokenizer tokenizer = new StringTokenizer(s, ",");
+        
+        while(tokenizer.hasMoreTokens()) {
+            list.add(tokenizer.nextToken().trim());
+        }
+        
+        return list;
+	}	
+	
+	public static Node getRoot(ContentManager cm, String path)
+					throws IOException, SAXException, ResourceDoesNotExist {
+		
+		DOMParser parser = new DOMParser();
+		parser.parse(new InputSource(cm.getNode(path).getContentInputStream()));
+
+		Node root = parser.getDocument().getDocumentElement();
+		return root;
+	}
+	
+	public static String formatDate(Calendar cal) {
+		
+		Date date = cal.getTime();
+		
+		DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); 
+		String dateString = dateFormat.format(date) + " GMT";
+		
+		return dateString;
+	}
+
+	public static Calendar nextDay(Calendar date) {
+		
+		Calendar nextDay = (Calendar) date.clone();
+		nextDay.add(Calendar.DAY_OF_MONTH, 1);
+		
+		return nextDay;
+	}
+	
+	public static void startJMXService(String jmxServiceURL) {
+		
+		try {
+			//		 The address of the connector
+			JMXServiceURL address = new JMXServiceURL(jmxServiceURL);
+			
+			//		 The environment map, null in this case
+			Map<String,Object> environment = null;
+
+			JMXConnectorServer cntorServer = JMXConnectorServerFactory.newJMXConnectorServer(address, environment, null);
+
+			//		 The MBeanServer to which the JMXConnectorServer will be registered in
+			MBeanServer server = MBeanServerLocator.locate();
+
+			//		 Register the JMXConnectorServer in the MBeanServer
+			ObjectName cntorServerName = ObjectName.getInstance("connectors:protocol=rmi");
+			server.registerMBean(cntorServer, cntorServerName);
+
+			//		 Start the JMXConnectorServer
+			cntorServer.start();
+			
+		} catch (Exception e) {
+			log.error("Unable to start MBeanRemoteProxy", e);
+		}
+		
+		log.info("MBeanRemoteProxy created successfully.");
+	}
+
+	public static ScoresService getScoresService(Properties properties) throws NamingException {	
+		
+		log.debug("Looking up ScoresService. " +
+				"(Security Manager: " + System.getSecurityManager() + ")");
+			
+		InitialContext ic = new InitialContext(properties);
+		    
+		ScoresService service = (ScoresService)ic.lookup("JMMService");
+		
+		service.ping();
+		log.debug("Ping to ScoresService successful.");
+	
+		return service;
+	}
+		
+	public static ScoresUpdater getScoresUpdater() {
+			
+		ScoresUpdater updater;
+			
+		try {
+			Context context = new InitialContext();
+			
+			//	Perform look up using JNDI name of ejb object
+			String serviceBinding = Constants.DAILY_SCORES_UPDATER;
+				
+			Object ref = context.lookup(serviceBinding);
+				
+			// Narrow the reference of the object returned by lookup() method
+			updater = (ScoresUpdater) PortableRemoteObject.narrow( ref, 
+													ScoresUpdater.class);
+			
+		} catch (NamingException e) {
+			
+			log.warn("Unable to schedule updates." +
+											"\nCause: " + e.getMessage());
+			return null;
+		}
+			
+		
+		return updater;
+	}
+
+	public static Properties parseProperties(org.jboss.shotoku.Node serviceNode,
+											String excludePrefix) {
+		
+		Properties props = new Properties();
+		
+		if (serviceNode == null) {
+			return props;
+		}
+		
+		String propsString = serviceNode.getContent();
+		String[] propsArr = propsString.split("\n");
+		
+		for (String propString : propsArr) {
+			
+			String[] propArr = propString.split("=");
+			
+			if ((propArr != null) && (propArr.length == 2) && 
+					((excludePrefix == null) ||
+								(!propArr[0].startsWith(excludePrefix)))) {
+				
+				props.put(propArr[0], propArr[1]);
+			}
+					
+		}
+		
+		return props;
+	}
+
+	public static int parseIntProperty(Properties properties, String element,
+														int defaultValue) {
+		
+		String string = (String) properties.get(element);
+	
+		if (string != null) {
+			
+			try {
+	
+				return Integer.parseInt(string);
+	
+			} catch (NumberFormatException e) {
+				
+				// Do nothing
+			}
+		}
+				
+		return defaultValue;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/maven.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/maven.xml	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/maven.xml	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,27 @@
+<!-- 
+  JBoss, the OpenSource J2EE webOS
+  Distributable under LGPL license.
+  See terms of license at gnu.org. 
+ -->
+<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:u="jelly:util">
+	<!-- Default war-project goals -->
+
+	<goal name="all">
+		<attainGoal name="module-all" />
+	</goal>
+
+	<goal name="build">
+		<ant:copy todir="src/web/WEB-INF/tld" file="../../forge-common/src/web/WEB-INF/tld/forge.tld" overwrite="true" />
+		<attainGoal name="war" />
+	</goal>
+    
+	<goal name="deploy">	
+	        <ant:echo message="${pom.artifactId}.war"/>
+		<ant:copy todir="${local.deploy.dir}" file="target/${pom.artifactId}.war" />
+	</goal>
+	
+	<goal name="clean">
+		<attainGoal name="module-clean" />
+	</goal>
+	
+</project>

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/project.properties
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/project.properties	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/project.properties	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,16 @@
+maven.repo.remote=http://repository.atlassian.com,http://www.ibiblio.org/maven,http://dist.codehaus.org/
+maven.junit.fork=yes
+maven.war.src=${basedir}/src/web
+
+#maven.ejb.includes=**/service/**,**/META-INF/**
+#maven.jar.excludes=**/JMMPortlet.class,**/service/**,**/persistence.xml
+#maven.war.classes.includes=**/JMMPortlet.class
+#**/service/impl/db/protocol/*
+
+maven.ejb.includes=**/service/**,**/META-INF/**
+maven.jar.includes=**/common/**
+maven.war.classes.includes=**/portlet/**
+
+jmm.service.final.name=jmm-service.ejb3
+jmm.common.final.name=jmm-common.jar
+jmm.service.sar=jmm-service.sar/
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/project.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/project.xml	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/project.xml	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,142 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+<!-- 
+  JBoss, the OpenSource J2EE webOS
+  Distributable under LGPL license.
+  See terms of license at gnu.org. 
+ -->
+<project>
+    <pomVersion>3</pomVersion>
+    <extend>../project.xml</extend>
+    <id>jmm</id>
+    <name>JEMS Maturity Matrix</name>
+    <currentVersion>1.0</currentVersion>
+    <organization>
+        <name>Pawel Wrzeszcz</name>
+        <url></url>
+    </organization>
+    <description></description>
+    
+    <dependencies>
+    
+	<dependency>
+	    <groupId>jboss-forge</groupId>
+	    <artifactId>forge-common</artifactId>
+	    <version>1.0</version>
+	    <properties>
+                <ejb.manifest.classpath>true</ejb.manifest.classpath>
+				<war.manifest.classpath>true</war.manifest.classpath>
+        </properties>
+	</dependency>
+
+	<dependency>
+	    <groupId>jboss-forge</groupId>
+	    <artifactId>jmm-common</artifactId>
+	    <jar>jmm-common.jar</jar>
+	    <properties>
+                <ejb.manifest.classpath>true</ejb.manifest.classpath>
+                <war.manifest.classpath>true</war.manifest.classpath>
+            </properties>
+	</dependency>
+
+	<dependency>
+	    <groupId>aslibs</groupId>
+	    <artifactId>javax.servlet</artifactId>
+	    <version>1.0</version>
+	    <jar>javax.servlet.jar</jar>
+	</dependency>
+
+  	<dependency>
+		<id>jdom</id>
+		<version>1.0</version>
+		<properties>
+			<war.bundle>true</war.bundle>
+		</properties>
+	</dependency>
+	
+	<dependency>
+	    <groupId>tmate</groupId>
+	    <artifactId>javasvn</artifactId>
+	    <version>1.0</version>
+	    <jar>javasvn.jar</jar>
+	    <properties>
+			<war.bundle>true</war.bundle>
+			<ejb.manifest.classpath>true</ejb.manifest.classpath>
+	    </properties>
+	</dependency>
+	
+	<dependency>
+		<groupId>kosmos</groupId>
+		<artifactId>kosmos</artifactId>
+		<jar>kosmos-server.jar</jar>
+		<version>1.0</version>
+		<properties>
+			<war.bundle>true</war.bundle>
+			<ejb.manifest.classpath>true</ejb.manifest.classpath>
+			<war.manifest.classpath>true</war.manifest.classpath>
+		</properties>
+	</dependency>
+
+    <dependency>
+        <groupId>hessian</groupId>
+        <artifactId>hessian</artifactId>
+        <version>3.0.1</version> 
+	<jar>hessian-3.0.13.jar</jar>
+        <properties>
+		    	<war.bundle>true</war.bundle>
+            <war.manifest.classpath>true</war.manifest.classpath>
+            <ejb.manifest.classpath>true</ejb.manifest.classpath>
+        </properties>
+    </dependency>
+
+	<dependency>
+	    <groupId>shotoku</groupId>
+	    <artifactId>shotoku-base</artifactId>
+	    <version>1.0</version>
+	    <jar>shotoku-base.jar</jar>
+            <properties>
+                <ejb.manifest.classpath>true</ejb.manifest.classpath>
+                <war.manifest.classpath>true</war.manifest.classpath>
+            </properties>
+	</dependency>
+
+  <!-- JBoss EJB3 dependencies -->
+
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>ejb3-persistence</artifactId>
+		<version>3.0RC6</version>
+		<jar>ejb3-persistence.jar</jar>
+	</dependency>
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>jboss-ejb3x</artifactId>
+		<version>3.0RC6</version>
+		<jar>jboss-ejb3x.jar</jar>
+        </dependency>
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>jboss-j2ee</artifactId>
+		<version></version>
+		<jar>jboss-j2ee.jar</jar>
+        </dependency>
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>jboss-annotations-ejb3</artifactId>
+		<version></version>
+		<jar>jboss-annotations-ejb3.jar</jar>
+        </dependency>
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>jbossall-client</artifactId>
+		<version>3.2.3</version>
+        </dependency>
+
+	<dependency>
+		<groupId>jaxb</groupId>
+		<artifactId>JAXB2</artifactId>
+		<version>2.0</version>
+		<jar>jaxb-api.jar</jar>
+        </dependency>
+	   
+    </dependencies>
+</project>

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMM.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMM.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMM.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,220 @@
+/*
+ * 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.portlet;
+
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.common.projects.ProjectsHelper;
+import org.jboss.forge.common.projects.permissions.NullPermissionsChecker;
+import org.jboss.forge.common.projects.permissions.PermissionsChecker;
+
+import org.jboss.forge.common.XmlTools;
+
+import org.jboss.forge.jmm.common.Tags;
+import org.jboss.forge.jmm.common.exceptions.ScoresException;
+import org.jboss.forge.jmm.common.protocol.ScoresManager;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValues;
+import org.jboss.forge.jmm.common.tools.Tools;
+import org.jboss.forge.jmm.portlet.templates.Column;
+import org.jboss.forge.jmm.portlet.templates.Columns;
+import org.jboss.forge.jmm.portlet.templates.MatrixTemplate;
+import org.jboss.logging.Logger;
+
+import org.jboss.portal.common.context.DelegateContext;
+
+import org.w3c.dom.Node;
+ 
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+* A class which handles Status Matrix information managment. 
+*/
+public class JMM {
+
+	/** Columns to display on the main page */
+	private Columns mainPageColumns;
+							
+	/** Matrix to display on the project specyfic page */
+	private MatrixTemplate matrixTemplate;
+	
+	/** Projects present in the Status Matrix */
+	private Projects projects;
+	
+	private ScoresManager scoresManager;
+	
+	private Calendar updateDate = null;
+	
+	private Logger log;
+	
+	/**
+	 * @param portalName portal name
+	 * @param root Node with Matrix properites
+	 * @param scoresManager
+	 */
+	public JMM(String portalName, Node root,
+											ScoresManager scoresManager) 
+												throws ScoresException {
+		
+		log = Logger.getLogger(this.getClass());
+		
+		// Get configuration		
+		projects = ProjectsHelper.getProjects(portalName); 
+	
+		this.scoresManager = scoresManager;
+		
+		// Get columns to display on the main page
+		Node mainPageRoot =
+				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(root,
+									Tags.PROJECT_PAGE_COLUMNS_TAG);
+		matrixTemplate =
+				new MatrixTemplate(projectPageRoot, projects);
+	}
+
+	/**
+	 * Fills the given context with the Status Matrix information.
+	 * 
+	 * @param context DelegateContext to fill.
+	 */
+	public void fillContext(DelegateContext context) {
+		
+		if (updateDate == null) {
+			
+			context.next("scoresUnavailable");
+			return;
+		}
+		
+		DelegateContext scoresContext = context.next("scores");
+		scoresContext.put("date", Tools.formatDate(updateDate));
+		
+		mainPageColumns.fillContext(scoresContext);
+	}
+
+	/**
+	 * Returns Map binding project ids with DelegateContexts
+	 * containing project information
+	 * 
+	 * @return Map : project id -> DelegateContext
+	 */
+	public Map<String, DelegateContext> getProjectContexts() {
+		
+		Map<String, DelegateContext> prjMap =
+							new HashMap<String, DelegateContext>();
+		
+		Set<String> projectIdsSet = projects.getProjectIds(
+				(PermissionsChecker) new NullPermissionsChecker(), null);
+		
+		if (updateDate == null) {
+			
+			for (String projectId : projectIdsSet) {
+			
+				DelegateContext context = new DelegateContext();
+				context.next("scoresUnavailable");
+				
+				prjMap.put(projectId, context);
+			}			
+		} else {
+		
+			for (String projectId : projectIdsSet) {
+			
+				DelegateContext context = new DelegateContext();
+				DelegateContext scoresContext = context.next("scores");
+				
+				matrixTemplate.fillContext(scoresContext, projectId);
+				scoresContext.put("date", Tools.formatDate(updateDate));
+			
+				prjMap.put(projectId, context);
+			}
+		}
+		
+		return prjMap;
+	}
+
+	/**
+	 * Returns Map, which has set as a key set.
+	 * For each plugin id the resulting Map contains DelegateContext
+	 * with information about plugin scores for all projects.
+	 * 
+	 * @return Map : plugin id -> DelegateContext
+	 */
+	public Map<String, DelegateContext> getColumnContexts() {
+		
+		Map<String, DelegateContext> colMap
+								= new HashMap<String, DelegateContext>();
+						   
+		if (updateDate == null) {
+			
+			return colMap;			
+		}
+		
+		for (Column  col : mainPageColumns.getColumns()) {
+			
+			DelegateContext context = new DelegateContext();
+			DelegateContext scoresContext = context.next("scores");
+			
+			col.fillContext(scoresContext, projects);
+			scoresContext.put("date", Tools.formatDate(updateDate));
+			
+			colMap.put(col.getId(), context);
+		} 
+		
+		return colMap;
+	}
+
+	public void update() {
+		
+		log.info("Checking for updated scores.");
+		
+		PluginsValues pluginsValues = null;
+		
+		try {
+			pluginsValues = scoresManager.getLatestScores();
+		} catch (ScoresException e) {
+			log.warn("Failed to get the latest scores. " +
+						"\nCause: " + e.getMessage());
+			log.debug("Exception while getting the latest scores.", e);
+			return;
+		}
+			
+		refreshScores(pluginsValues);
+		
+		log.info("Refreshed scores.");
+	}
+	
+	private void refreshScores(PluginsValues pluginsValues) {
+		
+		mainPageColumns.update(pluginsValues);
+		matrixTemplate.update(pluginsValues);
+		
+		updateDate = pluginsValues.getDate();
+	}
+
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMMConfWatcher.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMMConfWatcher.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMMConfWatcher.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,81 @@
+/*
+ * 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.portlet;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.forge.jmm.common.Locations;
+
+import org.jboss.shotoku.cache.ChangeType;
+import org.jboss.shotoku.cache.ShotokuResourceWatcher;
+
+public class JMMConfWatcher extends
+							ShotokuResourceWatcher<String, JMMDescriptor> {
+	
+	public JMMConfWatcher(long interval) {
+		super(interval);
+	}
+	
+	private JMMDescriptor getDesc(String portalName) {
+		return new JMMDescriptor(portalName, getContentManager(portalName));
+	}
+	
+	@Override
+	public JMMDescriptor init(String key) {
+		
+		String portalName = key;
+		
+		addWatchedPath(key, Locations.getXmlCmPath(portalName));
+		addWatchedPath(key, Locations.getXmlJMMPluginsCmPath(portalName));
+		addWatchedPath(key, Locations.getServicePropertiesCmPath(portalName));
+		
+		/* Watch projects.xml file */ 
+		addWatchedPath(key, Locations.getProjectsXmlPath(portalName));
+		
+		/* Watch all project.xml files.
+		 * We assume that they contain entries used by plugins */ 
+		Set<String> projectXmlPathsSet =
+								Locations.getProjectXmlPathsSet(portalName);
+		
+		for (String projectXmlPath : projectXmlPathsSet) {
+			addWatchedPath(key, projectXmlPath);
+		}
+		
+		return getDesc(portalName);
+	}
+
+	@Override
+	/* Called only when some of the watched resources changes. */
+	public void update(String key, JMMDescriptor currentObject,
+											Map<String, ChangeType> changes) {
+		
+		put(key, getDesc(key));
+	}
+	
+	@Override
+	/* Called to check if updated scores are available. */
+	public void update(String key, JMMDescriptor desc) {
+		
+		desc.update();
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMMDescriptor.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMMDescriptor.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMMDescriptor.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,144 @@
+/*
+  * 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.portlet;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.forge.jmm.common.Locations;
+import org.jboss.forge.jmm.common.protocol.ScoresManager;
+import org.jboss.forge.jmm.common.protocol.conf.Configuration;
+import org.jboss.forge.jmm.common.protocol.conf.impl.ConfgurationImpl;
+import org.jboss.forge.jmm.common.protocol.conf.impl.ServiceScoresManager;
+import org.jboss.forge.jmm.common.tools.Tools;
+
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.common.context.DelegateContext;
+
+import org.jboss.shotoku.ContentManager;
+import org.w3c.dom.Node;
+
+/**
+ * @author Pawel Wrzeszcz
+ * A class which handles accessing matrix information.
+ */
+public class JMMDescriptor {
+	
+	private DelegateContext context = new DelegateContext();
+	
+	private Map<String,DelegateContext> projectContexts
+								= new HashMap<String,DelegateContext>();
+	private Map<String,DelegateContext> columnContexts
+	 							= new HashMap<String,DelegateContext>();
+
+	private ScoresManager scoresManager;
+	
+	private String portalName;
+	private ContentManager cm;
+	
+	private JMM jmm;
+	
+	private Logger log = Logger.getLogger(JMMDescriptor.class);
+	
+	
+	public JMMDescriptor(String portalName, ContentManager cm) {
+		
+		this.portalName = portalName;
+		this.cm = cm;
+				
+		init(portalName);
+		
+		initStatus();
+		
+		update();
+	}
+
+	private void init(String portalName) {
+		
+		try {
+		
+			Configuration conf = new ConfgurationImpl(portalName, cm);
+
+			scoresManager = new ServiceScoresManager(conf);
+			
+		} catch (Exception e) {
+	
+			log.warn("Unable to initialize JMMDescriptor.", e);
+		}
+		
+	}
+
+	private void initStatus() {
+				
+		try {
+			
+			String jmmPath = Locations.getXmlCmPath(portalName);
+			Node root = Tools.getRoot(cm , jmmPath);
+							
+			jmm = new JMM(portalName, root, scoresManager);
+			
+		} catch (Exception e) {
+			
+			log.warn("Initialization failed.", e);
+		} 
+	}
+
+	private void fillContext() {
+		
+		if (jmm != null) {
+			
+			context = new DelegateContext();
+			jmm.fillContext(context);
+			
+			projectContexts = jmm.getProjectContexts();
+			columnContexts = jmm.getColumnContexts();
+		}	
+	}
+
+	public DelegateContext getContext() {
+		
+		return context;
+	}
+
+	public DelegateContext getProjectContext(String id) {
+		return projectContexts.get(id);
+	}
+	
+	public DelegateContext getColumnContext(String id) {
+		return columnContexts.get(id);
+	}
+	
+
+	public synchronized void update() {
+		
+		if (jmm == null) {
+			initStatus();
+		}
+		
+		jmm.update();
+		
+		fillContext();
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMMPortlet.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMMPortlet.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMMPortlet.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,85 @@
+ /*
+  * 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.portlet;
+
+import java.io.IOException;
+
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+
+import org.jboss.forge.common.ForgeHelper;
+import org.jboss.forge.jmm.common.Constants;
+import org.jboss.forge.jmm.common.Locations;
+import org.jboss.portal.common.context.DelegateContext;
+import org.jboss.portal.core.servlet.jsp.PortalJsp;
+
+import org.jboss.portlet.JBossPortlet;
+import org.jboss.portlet.JBossRenderRequest;
+import org.jboss.portlet.JBossRenderResponse;
+
+/**
+ * Podcast portlet.
+ * @author Pawel Wrzeszcz
+ */
+public class JMMPortlet extends JBossPortlet {
+
+	@Override
+    public void doView(JBossRenderRequest request, JBossRenderResponse response)
+            throws IOException, PortletException {
+        response.setContentType("text/html");
+	
+        // Get the request parameters
+        String portalName = ForgeHelper.getPortalName(request);
+        String action = request.getParameter("action");
+        String id = request.getParameter("id"); 
+        
+        JMMDescriptor desc = JMMTools.getDesc(portalName);
+
+        // Set the JSP to show and get the appropriate context
+        String jspPath = null;
+        DelegateContext context = null;
+        
+		if ((id != null) && (action.equals(Constants.PROJECT_DETAILS_ACTION))) {
+			jspPath = Locations.getPrjDetailsJspCmPath();
+			context = desc.getProjectContext(id);
+		}
+		
+		if ((id != null) && (action.equals(Constants.COLUMN_DETAILS_ACTION))) {
+			jspPath = Locations.getColumnDetailsJspCmPath();
+			context = desc.getColumnContext(id);
+		}
+		
+		if (id == null) { // Request for main Matrix page
+			jspPath = Locations.getJspCmPath();
+			context = desc.getContext();
+		}
+        
+        // Displaying the JSP
+        request.setAttribute(PortalJsp.CTX_REQUEST, context);
+        
+        PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(
+				ForgeHelper.createRepoAccessPath(portalName, jspPath));
+        rd.include(request, response);
+	
+    }
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMMTools.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMMTools.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/JMMTools.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,38 @@
+/*
+ * 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.portlet;
+
+import org.jboss.forge.jmm.common.Constants;
+import org.jboss.shotoku.aop.CacheItem;
+
+
+public class JMMTools {
+
+	@CacheItem(interval=Constants.CACHE_INTERVAL)
+	private static JMMConfWatcher conf;
+	
+	public static synchronized JMMDescriptor getDesc(final String portalName) {
+		
+		return conf.get(portalName);
+	}
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/CellTemplate.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/CellTemplate.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/CellTemplate.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,113 @@
+/*
+ * 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.portlet.templates;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.forge.common.XmlTools;
+import org.jboss.forge.jmm.common.Tags;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValues;
+import org.jboss.portal.common.context.DelegateContext;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+* @author Pawel Wrzeszcz
+* Holds information about one cell from project matrix.
+*/
+public class CellTemplate {
+
+	private String name;
+	private List<MetricTemplate> metricTemplates;
+	
+	/**
+	 * @param cellNode root Node specfying cell properties
+	 * @param pluginsValues
+	 */
+	public CellTemplate(Node cellNode) {
+		
+		name = XmlTools.getChildNodeValue(cellNode,
+											    Tags.CELL_NAME_ELEMENT);
+		
+		Node metricsNode = XmlTools.getFirstNodeWithName(cellNode,
+												Tags.METRICS_ELEMENT);
+		metricTemplates = parseMetricTemplates(metricsNode);
+	}
+
+	public void update(PluginsValues pluginsValues) {
+		
+		for (MetricTemplate metric : metricTemplates) {
+			
+			metric.update(pluginsValues);
+		}
+	}
+	
+	/**
+	 * Gets metrics information from the given Node.
+	 * 
+	 * @param metricsNode root Node specyfying metrics
+	 * @return List of metrics defined in <code>metricsNode</code>
+	 */
+	private ArrayList<MetricTemplate> parseMetricTemplates(Node metricsNode) {
+
+		ArrayList<MetricTemplate> rt = new ArrayList<MetricTemplate>();
+		
+		NodeList rowsList = metricsNode.getChildNodes();
+			
+		for (int i = 0; i < rowsList.getLength(); i++) {
+				
+			Node metricNode = rowsList.item(i);
+			
+			if (metricNode.getNodeName().equals(Tags.METRIC_ELEMENT)) {
+			
+				MetricTemplate metricTemplate =
+						new MetricTemplate(metricNode);
+				rt.add(metricTemplate);
+			}
+		}
+				
+		return rt;
+
+	}
+
+	/**
+	 * Fills the given context with cell information for specified project.
+	 * 
+	 * @param cellContext DelegateContext to fill
+	 * @param projectId id of project to fill context for
+	 */
+	public void fillContext(DelegateContext cellContext, String projectId) {
+		
+		cellContext.put("name", name);
+		
+		for (MetricTemplate cellTemplate : metricTemplates) {
+			
+			DelegateContext metricContext = cellContext.next("metric");
+			cellTemplate.fillContext(metricContext, projectId);
+		}
+		
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/Column.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/Column.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/Column.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,175 @@
+/*
+ * 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.portlet.templates;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Set;
+
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.common.projects.permissions.NullPermissionsChecker;
+import org.jboss.forge.jmm.common.protocol.conf.PluginValues;
+import org.jboss.forge.jmm.common.tools.ProjectsByScoreComparator;
+import org.jboss.logging.Logger;
+import org.jboss.portal.common.context.DelegateContext;
+
+/**
+* @author Pawel Wrzeszcz
+* A class holding column information in the Status Matrix.
+*/
+public class Column {
+	
+	/** Column name */
+	String name;
+	
+	/** Plugin values to put in project rows */
+	PluginValues pluginValues;
+	
+	protected Logger log;
+	
+	/**
+	 * @param name Column name
+	 */
+	public Column(String name) {
+		
+		this.name = name;
+		
+		log = Logger.getLogger(this.getClass());
+	}
+
+	public void update(PluginValues pluginValues) {
+		
+		this.pluginValues = pluginValues; 
+	}
+	
+	/**
+	 * Fills the given context with information appropriate for
+	 * the Status Matrix cell, located in the project row and this column.
+	 * 
+	 * @param projectContext context to fill
+	 * @param projectId id of the project to fill value for
+	 */
+	public void fillProjectContext(DelegateContext projectContext, String projectId) {
+		
+		DelegateContext entryContext = projectContext.next("entry");
+		
+		fillHeaderInfo(entryContext);
+		fillValue(entryContext, projectId);
+	}
+	
+	public void fillHeaderInfo(DelegateContext columnContext) {
+		
+		columnContext.put("name", getName());
+		columnContext.put("id", getId());
+		
+		if (pluginValues.getLinkName() != null) {
+			columnContext.next("hasLink");
+			columnContext.put("special-link-name", pluginValues.getLinkName());
+		} else {
+			columnContext.next("hasNotLink");
+		}
+	}
+	
+	public void fillValue(DelegateContext entryContext, String projectId) {
+		
+		try {
+			Long value = pluginValues.getValue(projectId);
+			Integer rate = pluginValues.getRate(projectId);
+			
+			if (value != null) {
+				entryContext.put("value", Long.toString(value));
+				entryContext.put("rate", Integer.toString(rate));
+				
+				if (pluginValues.getLinkName() != null) {
+					entryContext.next("hasLink");
+					entryContext.put("special-link",
+											pluginValues.getLink(projectId));
+					
+					if (pluginValues.getLink(projectId) != null) {
+						entryContext.next("project-hasLink");
+					}
+				} else {
+					entryContext.next("hasNotLink");
+				}
+				
+			}
+		} catch (Exception e) {
+			log.error("Could not get value for plugin: "
+								+ pluginValues.getPluginId()
+								+ "\nCause: " + e.getMessage());
+		}
+	}
+
+	/**
+	 * Fills the given context with column information for given projects.
+	 * 
+	 * @param columnContext context to fill
+	 * @param projects projects to fill context for
+	 */
+	public void fillContext(DelegateContext columnContext, Projects projects) {
+		
+		fillHeaderInfo(columnContext);
+		
+		String[] projectIds = getProjectIdsSorted(projects); 
+		
+		for (String projectId : projectIds) {
+			
+			DelegateContext projectContext = columnContext.next("project");
+			
+			projectContext.put("name", projects.getProjectName(projectId));
+			projectContext.put("link", projects.getProjectLink(projectId));
+			projectContext.put("id", projectId);
+			
+			fillValue(projectContext, projectId);
+		}
+	}
+	
+	private String[] getProjectIdsSorted(Projects projects) {
+		
+		Set<String> projectIdsSet =
+					projects.getProjectIds(new NullPermissionsChecker(), null);
+		String[] ids = new String[projectIdsSet.size()];
+		projectIdsSet.toArray(ids);
+		
+		Comparator<String> projectsComparator =
+								new ProjectsByScoreComparator(pluginValues);
+		Arrays.sort(ids, projectsComparator);
+		
+		return ids;
+	}
+
+	/**
+	 * @return Column plugin id
+	 */
+	public String getId() {
+		return pluginValues.getPluginId();
+	}
+	
+	/**
+	 * @return Column name
+	 */
+	public String getName() {
+		return name;
+	}
+
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/Columns.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/Columns.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/Columns.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,262 @@
+/*
+ * 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.portlet.templates;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.forge.common.XmlTools;
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.common.projects.permissions.NullPermissionsChecker;
+import org.jboss.forge.common.projects.permissions.PermissionsChecker;
+
+import org.jboss.forge.jmm.common.Tags;
+import org.jboss.forge.jmm.common.protocol.conf.PluginValues;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValues;
+import org.jboss.forge.jmm.common.tools.ProjectsByNameComparator;
+import org.jboss.forge.jmm.common.tools.ProjectsByScoreComparator;
+
+import org.jboss.portal.common.context.DelegateContext;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+* @author Pawel Wrzeszcz
+* A class holding information about columns to display on one page.
+*/
+public class Columns {
+
+	/** Status Matrix Columns list (Column order matters). */
+	private Map<String,Column> columns;
+	
+	/** Projects present in the Status Matrix */
+	private Projects projects;
+	
+	private PluginsValues pluginsValues;
+	
+	/** Plugin determining project order in the Matrix. */
+	private String orderPluginId;
+	
+	/**
+	 * @param pageRoot root Node specfying Columns properties
+	 * @param projects Projects present in the Status Matrix
+	 */
+	public Columns(Node pageRoot, Projects projects) {
+		
+		this.projects = projects;
+		
+		// Get the columns
+		columns = new LinkedHashMap<String,Column>();
+		Node columnsRoot = XmlTools.getFirstNodeWithName(pageRoot,
+											  Tags.COLUMNS_ELEMENT);
+		
+		if (columnsRoot != null) {
+			addColumns(columnsRoot);
+		}
+		
+		// Get id of plugin determining projects order
+		orderPluginId = XmlTools.getChildNodeValue(pageRoot,
+				Tags.ORDER_PLUGIN_ELEMENT);
+	}
+	
+	public void update(PluginsValues pluginsValues) {
+		
+		this.pluginsValues = pluginsValues;
+		
+		for (String pluginId : columns.keySet()) {
+			
+			PluginValues pluginValues =
+							pluginsValues.getPluginValues(pluginId);
+			
+			Column column = columns.get(pluginId);
+			column.update(pluginValues);
+		}
+	}
+	
+	/**
+	 * Adds to the columns list columns defined in columnsRoot.
+	 * 
+	 * @param columnsRoot Node defining columns list
+	 */
+	private void addColumns(Node columnsRoot) {
+		
+		NodeList columnsList = columnsRoot.getChildNodes();
+		
+		for (int i = 0; i < columnsList.getLength(); i++) {
+			
+			Node columnNode = columnsList.item(i);
+			
+			if ((columnNode.getNodeType() == Node.ELEMENT_NODE) &&
+				(columnNode.getNodeName().equals(Tags.COLUMN_ELEMENT))) {
+				
+				String name = XmlTools.getChildNodeValue(columnNode,
+											Tags.COLUMN_NAME_ELEMENT);
+			
+				String pluginId = XmlTools.getChildNodeValue(columnNode,
+											Tags.COLUMN_PLUGIN_ELEMENT);
+				
+				Column column = new Column(name);
+				columns.put(pluginId,column);
+			}
+		}
+	}
+
+
+	/**
+	 * Fills the given context with the columns information.
+	 * 
+	 * @param context DelegateContext to fill
+	 */
+	public void fillContext(DelegateContext context) {
+		fillColumnNames(context);
+		fillValues(context);
+	}
+	
+	/**
+	 * Fills the given context with the columns information
+	 * for project with the given id.
+	 * 
+	 * @param context DelegateContext to fill
+	 * @param projectId id of project to fill context for
+	 */
+	public void fillContext(DelegateContext context, String projectId) {
+		fillColumnNames(context);
+		fillProjectContext(context, projectId);
+	}
+	
+	/**
+	 * Fills the given context with column names
+	 * 
+	 * @param context DelegateContext to fill
+	 */
+	private void fillColumnNames(DelegateContext context) {
+		
+		for (Column column : columns.values()) {
+			
+			DelegateContext columnContext = new DelegateContext();
+			column.fillHeaderInfo(columnContext);
+			
+			context.append("column", columnContext);
+		}
+	}
+	
+	/** Fills the given context with cell values.
+	 * Context is filled with values for each project and for each column.
+	 * 
+	 *  @param context DelegateContext to fill
+	 */	
+	private void fillValues(DelegateContext context) {
+		
+		String[] projectIds = getProjectIdsSorted();
+
+		for (int i = 0; i < projectIds.length; i++) {
+			
+			String projectId = projectIds[i];
+			
+			DelegateContext projectContext = context.next("project");
+			projectContext.put("position", i + 1);
+			
+			fillProjectContext(projectContext, projectId);
+		}
+	}
+	
+	/**
+	 * @return String[] with project ids sorted by project scores
+	 */
+	private String[] getProjectIdsSorted() {
+		
+		Set<String> projectIdsSet = projects.getProjectIds(
+				(PermissionsChecker) new NullPermissionsChecker(), null);
+		
+		
+		String[] projectIdsArr = new String[projectIdsSet.size()];
+		projectIdsSet.toArray(projectIdsArr);
+		
+		Comparator<String> projectsComparator = null;
+		
+		PluginValues orderPluginValues =
+						(pluginsValues == null) ? null : 
+								pluginsValues.getPluginValues(orderPluginId);
+		
+		if (orderPluginValues != null) {
+			projectsComparator = new ProjectsByScoreComparator(orderPluginValues);
+		} else {
+			projectsComparator = new ProjectsByNameComparator(projects);
+		}
+		
+		Arrays.sort(projectIdsArr, projectsComparator);
+		
+		return projectIdsArr;
+	}
+
+	/**
+	 * Fills the given context with project information
+	 * 
+	 * @param projectContext DelegateContext to fill
+	 * @param projectId project id
+	 */
+	private void fillProjectContext(DelegateContext projectContext, String projectId) {
+
+			projectContext.put("id", projectId);
+			projectContext.put("name", projects.getProjectName(projectId));
+			projectContext.put("link", projects.getProjectLink(projectId));
+			
+			fillEntries(projectContext, projectId);
+	}
+
+	/**
+	 * Fills the given context with cells information in the project row
+	 * 
+	 * @param projectId specifies project row
+	 * @param projectContext DelegateContext to fill
+	 */
+	private void fillEntries(DelegateContext projectContext, String projectId) {
+		
+		
+		for (Column column : columns.values()) {	
+		
+			column.fillProjectContext(projectContext, projectId);
+		}
+	}
+
+	/**
+	 * Adds columns from <code>columnsToAdd</code> to the columns list.
+	 */
+	public void add(Columns columnsToAdd) {
+		
+		for (String pluginId : columnsToAdd.columns.keySet()) {
+			
+			columns.put(pluginId, columnsToAdd.columns.get(pluginId));
+		}
+	
+	}
+
+	public Collection<Column> getColumns() {
+		
+		return columns.values();
+	}
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/MatrixTemplate.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/MatrixTemplate.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/MatrixTemplate.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,129 @@
+/*
+ * 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.portlet.templates;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.jboss.forge.common.XmlTools;
+import org.jboss.forge.common.projects.Projects;
+import org.jboss.forge.jmm.common.Tags;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValues;
+import org.jboss.portal.common.context.DelegateContext;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+* @author Pawel Wrzeszcz
+* A class holding information about content of project matrix.
+*/
+public class MatrixTemplate {
+
+	/** Rows */
+	private List<RowTemplate> rowTemplates;
+	
+	/** Projects present in the matrix */
+	private Projects projects;
+	
+	/**
+	 * @param projectPageRoot root Node specfying matrix properties
+	 * @param projects Projects present in the matrix
+	 */
+	public MatrixTemplate(Node projectPageRoot, Projects projects) {
+		
+		this.projects = projects;
+		
+		Node rowsRoot = XmlTools.getFirstNodeWithName(projectPageRoot,
+													Tags.ROWS_ELEMENT);
+		rowTemplates = parseMatrixTemplate(rowsRoot);
+	}
+
+	public void update(PluginsValues pluginsValues) {
+		
+		for (RowTemplate row : rowTemplates) {
+			
+			row.update(pluginsValues);
+		}
+	}
+	
+	/**
+	 * Gets rows information from the given Node.
+	 * 
+	 * @param rowsNode root Node specyfying rows
+	 * @return List of rows defined in <code>rowsNode</code>
+	 */
+	private List<RowTemplate> parseMatrixTemplate(Node rowsNode) {
+			
+		ArrayList<RowTemplate> mt = new ArrayList<RowTemplate>();
+		
+		NodeList rowsList = rowsNode.getChildNodes();
+			
+		for (int i = 0, rowNumber = 1; i < rowsList.getLength(); i++) {
+				
+			Node rowNode = rowsList.item(i);
+			
+			if (rowNode.getNodeName().equals(Tags.ROW_ELEMENT)) {
+				
+				RowTemplate rowTemplate =
+							new RowTemplate(rowNode, rowNumber);
+				
+				mt.add(rowTemplate);
+				rowNumber++;
+			}
+		}
+				
+		return mt;
+	}
+
+	/**
+	 * Fills the given context with matrix information for specified project.
+	 * 
+	 * @param context DelegateContext to fill
+	 * @param projectId id of project to fill context for
+	 */
+	public void fillContext(DelegateContext context, String projectId) {
+		
+		context.put("projectId", projectId);
+		context.put("name", projects.getProjectName(projectId));
+		context.put("link", projects.getProjectLink(projectId));
+		
+		fillRowsContext(context, projectId);
+	}
+
+	/**
+	 * Fills the given context with rows informaiton.
+	 * 
+	 * @param context DelegateContext to fill
+	 * @param projectId id of project to fill context for
+	 */
+	private void fillRowsContext(DelegateContext context, String projectId) {
+		
+		for (RowTemplate rowTemplate : rowTemplates) {
+			
+			DelegateContext rowContext = context.next("row");
+			rowTemplate.fillContext(rowContext, projectId);
+		}
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/MetricTemplate.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/MetricTemplate.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/MetricTemplate.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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.portlet.templates;
+
+import org.jboss.forge.jmm.common.Tags;
+import org.jboss.forge.jmm.common.protocol.conf.PluginValues;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValues;
+import org.jboss.forge.common.XmlTools;
+import org.jboss.portal.common.context.DelegateContext;
+
+import org.w3c.dom.Node;
+
+/**
+* @author Pawel Wrzeszcz
+* Holds information about one metric in a cell from project matrix.
+*/
+public class MetricTemplate {
+
+	private String name;
+	private String pluginId;
+	private PluginValues pluginValues;
+	private boolean showAsBoolean;
+	
+	/**
+	 * @param cellNode root Node specfying cell properties
+	 */
+	public MetricTemplate(Node cellNode) {
+		
+		name = XmlTools.getChildNodeValue(cellNode,
+										  Tags.METRIC_NAME_ELEMENT);
+		
+		pluginId = XmlTools.getChildNodeValue(cellNode,
+										  Tags.METRIC_PLUGIN_ELEMENT);
+	
+		String booleanString = XmlTools.getChildNodeValue(cellNode,
+										  Tags.METRIC_BOOLEAN_ELEMENT);
+		
+		showAsBoolean = (booleanString == null) ? false :
+												booleanString.equals("true");	
+	}
+	
+	public void update(PluginsValues pluginsValues) {
+		
+		pluginValues = pluginsValues.getPluginValues(pluginId);
+	}
+
+	/**
+	 * Fills the given context with metric information for specified project.
+	 * 
+	 * @param metricContext DelegateContext to fill
+	 * @param projectId id of project to fill context for
+	 */
+	public void fillContext(DelegateContext metricContext, String projectId) {
+		
+		metricContext.put("name", name);
+		
+		if (pluginValues != null) {
+			
+			if (showAsBoolean) {
+			
+				metricContext.put("value",
+					   (pluginValues.getValue(projectId) == 0) ? "no" : "yes");
+				
+				metricContext.next("hasNotRate");
+				
+			} else {
+			
+				metricContext.put("value",
+							Long.toString(pluginValues.getValue(projectId)));
+				
+				metricContext.put("rate",
+							Integer.toString(pluginValues.getRate(projectId)));
+				
+				metricContext.next("hasRate");
+			}
+		}
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/RowTemplate.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/RowTemplate.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/java/org/jboss/forge/jmm/portlet/templates/RowTemplate.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,120 @@
+/*
+ * 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.portlet.templates;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.jboss.forge.common.XmlTools;
+import org.jboss.forge.jmm.common.Tags;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValues;
+import org.jboss.portal.common.context.DelegateContext;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+* @author Pawel Wrzeszcz
+* Holds information about cells from one row in the project matrix.
+*/
+public class RowTemplate {
+
+	/** Cells */
+	private List<CellTemplate> cellTemplates;
+	
+	/** Row name */
+	private String name;
+	
+	/** Row number */
+	private int rowNumber;
+	
+	/**
+	 * @param rowNode root Node specfying row properties
+	 * @param rowNumber
+	 */
+	public RowTemplate(Node rowNode, int rowNumber) {
+		
+		name = XmlTools.getChildNodeValue(rowNode,Tags.ROW_NAME_ELEMENT);
+		this.rowNumber = rowNumber;
+		
+		Node cellsNode = XmlTools.getFirstNodeWithName(rowNode,
+													Tags.CELLS_ELEMENT);	
+		cellTemplates = parseRowTemplate(cellsNode);
+	}
+
+	public void update(PluginsValues pluginsValues) {
+		
+		for (CellTemplate cell : cellTemplates) {
+			
+			cell.update(pluginsValues);
+		}
+	}
+	
+	/**
+	 * Gets cells information from the given Node.
+	 * 
+	 * @param cellsNode root Node specyfying cells
+	 * @return List of cells defined in <code>rowsNode</code>
+	 */
+	private ArrayList<CellTemplate> parseRowTemplate(Node cellsNode) {
+
+		ArrayList<CellTemplate> rt = new ArrayList<CellTemplate>();
+		
+		NodeList rowsList = cellsNode.getChildNodes();
+			
+		for (int i = 0; i < rowsList.getLength(); i++) {
+				
+			Node cellNode = rowsList.item(i);
+			
+			if (cellNode.getNodeName().equals(Tags.CELL_ELEMENT)) {
+			
+				CellTemplate cellTemplate =
+									new CellTemplate(cellNode);
+				rt.add(cellTemplate);
+			}
+		}
+				
+		return rt;
+
+	}
+
+	/**
+	 * Fills the given context with row information for specified project.
+	 * 
+	 * @param rowContext DelegateContext to fill
+	 * @param projectId id of project to fill context for
+	 */
+	public void fillContext(DelegateContext rowContext, String projectId) {
+		
+		rowContext.put("name", name);
+		rowContext.put("number",rowNumber);
+		
+		for (CellTemplate cellTemplate : cellTemplates) {
+			
+			DelegateContext cellContext = rowContext.next("cell");
+			cellTemplate.fillContext(cellContext, projectId);
+		}
+		
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/jboss-app.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/jboss-app.xml	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/jboss-app.xml	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,7 @@
+<jboss-app>
+    <app-name>jmm</app-name>
+    <loader-repository>
+      jmm:service=scores
+    </loader-repository>
+</jboss-app>
+

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/jboss-web.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/jboss-web.xml	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/jboss-web.xml	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<jboss-web>
+</jboss-web>

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/portlet-instances.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/portlet-instances.xml	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/portlet-instances.xml	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployments>
+   <deployment>
+      <if-exists>overwrite</if-exists>
+      <instance>
+         <instance-id>JMMPortletInstance</instance-id>
+         <portlet-ref>JMMPortlet</portlet-ref>
+      </instance>
+   </deployment>
+</deployments>
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/portlet.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/portlet.xml	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/portlet.xml	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" 
+	version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
+	<portlet>
+	    <description>JMM Portlet</description>
+    	    <portlet-name>JMMPortlet</portlet-name>
+    	    <display-name>JEMS Maturity Matrix Portlet</display-name>
+            <portlet-class>org.jboss.forge.jmm.portlet.JMMPortlet</portlet-class>
+    	    <supports>
+		<mime-type>text/html</mime-type>
+		<portlet-mode>VIEW</portlet-mode>
+	    </supports>
+	    <portlet-info>
+		<title>JMM</title>
+	    </portlet-info>
+	</portlet>
+ </portlet-app>

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/tld/forge.tld
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/tld/forge.tld	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/tld/forge.tld	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,174 @@
+<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd"
+  version="2.0">
+  <!-- 
+  JBoss, the OpenSource J2EE webOS
+  Distributable under LGPL license.
+  See terms of license at gnu.org. 
+ -->
+   <tlib-version>1.1</tlib-version>
+   <jsp-version>2.0</jsp-version>
+   <shortname>forge</shortname>
+   <info>Forge tags</info>
+   
+   <tag>
+      <name>pageURL</name>
+      <tagclass>org.jboss.forge.common.taglib.PageURLTag</tagclass>
+      <attribute>
+         <name>page</name>
+         <required>true</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+      <attribute>
+         <name>form</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+   </tag>
+   
+   <tag>
+		<name>tagmeButton</name>
+		<tagclass>org.jboss.forge.common.taglib.TagMeTag</tagclass>
+		<attribute>
+	         <name>div</name>
+	         <required>true</required>
+	         <rtexprvalue>true</rtexprvalue>
+      	</attribute>
+      	<attribute>
+	         <name>service</name>
+	         <required>true</required>
+	         <rtexprvalue>true</rtexprvalue>
+	    </attribute>
+      	<attribute>
+	         <name>user</name>
+	         <required>true</required>
+	         <rtexprvalue>true</rtexprvalue>
+	    </attribute>
+      	<attribute>
+	         <name>path</name>
+	         <required>true</required>
+	         <rtexprvalue>true</rtexprvalue>
+	    </attribute>
+	    <attribute>
+	         <name>id</name>
+	         <required>true</required>
+	         <rtexprvalue>true</rtexprvalue>
+	    </attribute>
+	    <attribute>
+	         <name>website</name>
+	         <required>true</required>
+	         <rtexprvalue>true</rtexprvalue>
+	    </attribute>
+   </tag>
+   
+   <tag>
+      <name>param</name>
+      <tagclass>org.jboss.forge.common.taglib.ParamTag</tagclass>
+      <attribute>
+         <name>name</name>
+         <required>true</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+      <attribute>
+         <name>value</name>
+         <required>true</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+   </tag>
+   
+   <tag>
+      <name>wikiURL</name>
+      <tagclass>org.jboss.forge.common.taglib.WikiURLTag</tagclass>
+      <attribute>
+         <name>page</name>
+         <required>true</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+   </tag>
+   
+   <tag>
+      <name>freezoneURL</name>
+      <tagclass>org.jboss.forge.common.taglib.FreezoneURLTag</tagclass>
+      <attribute>
+         <name>page</name>
+         <required>true</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+   </tag>
+   
+   <tag>
+      <name>projectURL</name>
+      <tagclass>org.jboss.forge.common.taglib.ProjectURLTag</tagclass>
+      <attribute>
+         <name>project</name>
+         <required>true</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+      <attribute>
+         <name>page</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+      <attribute>
+         <name>form</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+   </tag>
+   
+   <tag>
+      <name>categoryURL</name>
+      <tagclass>org.jboss.forge.common.taglib.CategoryURLTag</tagclass>
+      <attribute>
+         <name>category</name>
+         <required>true</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+      <attribute>
+         <name>form</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+   </tag>
+   
+   <tag>
+      <name>selectedProject</name>
+      <tagclass>org.jboss.forge.common.taglib.SelectedProjectTag</tagclass>
+   </tag>
+   
+   <tag>
+      <name>imagePath</name>
+      <tagclass>org.jboss.forge.common.taglib.ImagePathTag</tagclass>
+      <attribute>
+         <name>src</name>
+         <required>true</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+      <attribute>
+         <name>project</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+   </tag>
+   
+   <tag>
+      <name>attrValue</name>
+      <tagclass>org.jboss.forge.common.taglib.AttrValueTag</tagclass>
+      <attribute>
+         <name>name</name>
+         <required>true</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+   </tag>
+   
+   <tag>
+      <name>attrIf</name>
+      <tagclass>org.jboss.forge.common.taglib.AttrIfTag</tagclass>
+      <attribute>
+         <name>name</name>
+         <required>true</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+   </tag>
+</taglib>

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/tld/portlet.tld
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/tld/portlet.tld	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/tld/portlet.tld	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,81 @@
+<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+  version="2.0">
+   <tlib-version>1.1</tlib-version>
+   <short-name>JBoss-Portal-tags</short-name>
+
+   <tag>
+      <name>if</name>
+      <tag-class>org.jboss.portal.core.servlet.jsp.taglib.IfTag</tag-class>
+      <body-content>JSP</body-content>
+      <attribute>
+         <name>ctx</name>
+         <required>true</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+   </tag>
+
+   <tag>
+      <name>iterate</name>
+      <tag-class>org.jboss.portal.core.servlet.jsp.taglib.IterateTag</tag-class>
+      <body-content>JSP</body-content>
+      <attribute>
+         <name>ctx</name>
+         <required>true</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+   </tag>
+
+   <tag>
+      <name>include</name>
+      <tag-class>org.jboss.portal.core.servlet.jsp.taglib.IncludeTag</tag-class>
+      <body-content>JSP</body-content>
+      <attribute>
+         <name>page</name>
+         <required>true</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+   </tag>
+
+   <tag>
+      <name>error</name>
+      <tag-class>org.jboss.portal.core.servlet.jsp.taglib.ErrorTag</tag-class>
+      <body-content>JSP</body-content>
+      <attribute>
+         <name>key</name>
+         <required>true</required>
+         <rtexprvalue>true</rtexprvalue>
+      </attribute>
+   </tag>
+
+   <tag>
+      <name>errors</name>
+      <tag-class>org.jboss.portal.core.servlet.jsp.taglib.ErrorsTag</tag-class>
+      <body-content>JSP</body-content>
+   </tag>
+
+   <tag>
+      <name>success</name>
+      <tag-class>org.jboss.portal.core.servlet.jsp.taglib.SuccessTag</tag-class>
+      <body-content>JSP</body-content>
+   </tag>
+   <function>
+      <name>i18n</name>
+      <function-class>org.jboss.portal.core.servlet.jsp.taglib.PortalLib</function-class>
+      <function-signature>java.lang.String getMessage(java.lang.String)</function-signature>
+   </function>
+
+   <function>
+      <name>out</name>
+      <function-class>org.jboss.portal.core.servlet.jsp.taglib.PortalLib</function-class>
+      <function-signature>java.lang.String out(java.lang.String)</function-signature>
+   </function>
+
+   <function>
+      <name>i18nout</name>
+      <function-class>org.jboss.portal.core.servlet.jsp.taglib.PortalLib</function-class>
+      <function-signature>java.lang.String i18nOut(java.lang.String)</function-signature>
+   </function>
+
+</taglib>

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/web.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/web.xml	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-portlet/src/web/WEB-INF/web.xml	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<!DOCTYPE web-app PUBLIC
+   "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+   "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+	<filter>
+		<filter-name>filesFromRepoFilter</filter-name>
+		<filter-class>org.jboss.forge.common.FilesFromRepoFilter</filter-class>
+	</filter>
+   
+	<filter-mapping>
+		<filter-name>filesFromRepoFilter</filter-name>
+		<url-pattern>/repo-access/*</url-pattern>
+		<dispatcher>INCLUDE</dispatcher>
+	</filter-mapping>
+</web-app>
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/build.properties
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/build.properties	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/build.properties	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,3 @@
+# By default deploy JMM service on the same AS as Labs
+jmm.service.server.dir=${local.deploy.dir}
+jmm.service.deploy.dir=${jmm.service.server.dir}/server/all/deploy
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/maven.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/maven.xml	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/maven.xml	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,79 @@
+<!-- 
+  JBoss, the OpenSource J2EE webOS
+  Distributable under LGPL license.
+  See terms of license at gnu.org. 
+ -->
+<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:u="jelly:util">
+	<!-- Default war-project goals -->
+
+	<goal name="all">
+		<attainGoal name="module-all" />
+	</goal>
+
+	<goal name="build">
+		<attainGoal name="build-ejb"/>
+		<attainGoal name="build-sar"/>
+	</goal>
+    
+    <goal name="build-ejb">
+	    	<ant:copy todir="target/classes/META-INF">
+			<ant:fileset dir="src/etc/META-INF" />
+		</ant:copy>
+		<attainGoal name="ejb" />
+		<ant:move tofile="target/${jmm.service.final.name}" file="target/${maven.final.name}.jar" />
+    </goal>
+    
+    <goal name="build-sar">
+<!--  		<ant:copy todir="target/${jmm.service.sar}" file="../jmm-common/target/${jmm.common.final.name}" />  -->
+		<ant:copy todir="target/${jmm.service.sar}">
+		       <ant:fileset dir="src/app" flatten="true" overwrite="true">
+		          <ant:filename name="**" />
+		       </ant:fileset>
+		 </ant:copy>
+    </goal>
+    
+	<goal name="deploy">
+		<attainGoal name="deploy-sar"/>	
+		<attainGoal name="deploy-ejb"/>
+	</goal>	
+	
+	<goal name="deploy-sar">
+		<ant:copy todir="${jmm.service.deploy.dir}">
+		    <ant:fileset dir="target/" flatten="true" overwrite="true">
+		          <ant:filename name="**/${jmm.service.sar}/**" />
+		    </ant:fileset>
+		</ant:copy>
+<!-- 	<ant:copy todir="${jmm.service.deploy.dir}/${jmm.service.sar}">
+		     <ant:fileset dir="target/forge-jmm/WEB-INF/lib" flatten="true" overwrite="true">
+		          <ant:filename name="*.jar" />
+		    </ant:fileset>
+		</ant:copy>  -->
+	</goal>
+	
+		<goal name="deploy-ejb">
+	  	<ant:copy todir="${jmm.service.deploy.dir}/jmm-service.sar" file="target/${jmm.service.final.name}" />
+	</goal>
+	
+	<goal name="clean">
+		<attainGoal name="module-clean" />
+
+		<!-- Clead old "status" files -->
+		<ant:delete file="${local.deploy.dir}/forge-status.war" />
+		<ant:delete file="${local.deploy.dir}/status-service.ejb3" />
+		<ant:delete file="${local.deploy.dir}/status-common.jar" />
+		
+		<!-- Clean JMM service local files (in case we want to use remote service) -->
+		<ant:delete file="${local.deploy.dir}/jmm-service.ejb3" />
+		<ant:delete file="${local.deploy.dir}/jmm-service.sar" />
+	</goal>
+
+	<!-- TODO INSTALL -->
+	<goal name="service-install">
+	       	<ant:copy todir="${jmm.service.server.dir}/server/all/lib"
+		                  file="${ext.root.dir}/mysql-connector/mysql-connector-java-3.1.12-bin.jar" />
+		<ant:copy todir="${jmm.service.deploy.dir}"
+		                  file="${ext.root.dir}/configuration/to-copy/server/all/deploy/JBLabs-ds.xml" />
+	</goal>
+
+	
+</project>

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/project.properties
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/project.properties	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/project.properties	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,16 @@
+maven.repo.remote=http://repository.atlassian.com,http://www.ibiblio.org/maven,http://dist.codehaus.org/
+maven.junit.fork=yes
+maven.war.src=${basedir}/src/web
+
+#maven.ejb.includes=**/service/**,**/META-INF/**
+#maven.jar.excludes=**/JMMPortlet.class,**/service/**,**/persistence.xml
+#maven.war.classes.includes=**/JMMPortlet.class
+#**/service/impl/db/protocol/*
+
+maven.ejb.includes=**/service/**,**/META-INF/**
+maven.jar.includes=**/common/**
+maven.war.classes.includes=**/portlet/**
+
+jmm.service.final.name=jmm-service.ejb3
+jmm.common.final.name=jmm-common.jar
+jmm.service.sar=jmm-service.sar/
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/project.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/project.xml	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/project.xml	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,139 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+<!-- 
+  JBoss, the OpenSource J2EE webOS
+  Distributable under LGPL license.
+  See terms of license at gnu.org. 
+ -->
+<project>
+    <pomVersion>3</pomVersion>
+    <extend>../project.xml</extend>
+    <id>jmm-service</id>
+    <name>JEMS Maturity Matrix Service</name>
+    <currentVersion>1.0</currentVersion>
+    <organization>
+        <name>Pawel Wrzeszcz</name>
+        <url></url>
+    </organization>
+    <description></description>
+    
+    <dependencies>
+    
+	<dependency>
+	    <groupId>jboss-forge</groupId>
+	    <artifactId>forge-common</artifactId>
+	    <version>1.0</version>
+	    <properties>
+                <ejb.manifest.classpath>true</ejb.manifest.classpath>
+				<ejb.bundle>true</ejb.bundle>
+        </properties>
+	</dependency>
+
+	<dependency>
+	    <groupId>jboss-forge</groupId>
+	    <artifactId>jmm-common</artifactId>
+	    <jar>jmm-common.jar</jar>
+	    <properties>
+                <ejb.manifest.classpath>true</ejb.manifest.classpath>
+                <ejb.bundle>true</ejb.bundle>
+            </properties>
+	</dependency>
+
+	<dependency>
+	    <groupId>aslibs</groupId>
+	    <artifactId>javax.servlet</artifactId>
+	    <version>1.0</version>
+	    <jar>javax.servlet.jar</jar>
+	</dependency>
+
+  	<dependency>
+		<id>jdom</id>
+		<version>1.0</version>
+		<properties>
+			<war.bundle>true</war.bundle>
+		</properties>
+	</dependency>
+	
+	<dependency>
+	    <groupId>tmate</groupId>
+	    <artifactId>javasvn</artifactId>
+	    <version>1.0</version>
+	    <jar>javasvn.jar</jar>
+	    <properties>
+			<war.bundle>true</war.bundle>
+			<ejb.bundle>true</ejb.bundle>
+	    </properties>
+	</dependency>
+	
+	<dependency>
+		<groupId>kosmos</groupId>
+		<artifactId>kosmos</artifactId>
+		<jar>kosmos-server.jar</jar>
+		<version>1.0</version>
+		<properties>
+			<ejb.manifest.classpath>true</ejb.manifest.classpath>
+			<ejb.bundle>true</ejb.bundle>
+		</properties>
+	</dependency>
+
+    <dependency>
+        <groupId>hessian</groupId>
+        <artifactId>hessian</artifactId>
+        <version>3.0.1</version> 
+	<jar>hessian-3.0.13.jar</jar>
+        <properties>
+            <ejb.manifest.classpath>true</ejb.manifest.classpath>
+			<ejb.bundle>true</ejb.bundle>
+        </properties>
+    </dependency>
+<!-- 
+	<dependency>
+	    <groupId>shotoku</groupId>
+	    <artifactId>shotoku-base</artifactId>
+	    <version>1.0</version>
+	    <jar>shotoku-base.jar</jar>
+            <properties>
+                <ejb.manifest.classpath>true</ejb.manifest.classpath>
+            </properties>
+	</dependency>
+ -->
+  <!-- JBoss EJB3 dependencies -->
+
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>ejb3-persistence</artifactId>
+		<version>3.0RC6</version>
+		<jar>ejb3-persistence.jar</jar>
+	</dependency>
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>jboss-ejb3x</artifactId>
+		<version>3.0RC6</version>
+		<jar>jboss-ejb3x.jar</jar>
+        </dependency>
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>jboss-j2ee</artifactId>
+		<version></version>
+		<jar>jboss-j2ee.jar</jar>
+        </dependency>
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>jboss-annotations-ejb3</artifactId>
+		<version></version>
+		<jar>jboss-annotations-ejb3.jar</jar>
+        </dependency>
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>jbossall-client</artifactId>
+		<version>3.2.3</version>
+        </dependency>
+
+	<dependency>
+		<groupId>jaxb</groupId>
+		<artifactId>JAXB2</artifactId>
+		<version>2.0</version>
+		<jar>jaxb-api.jar</jar>
+        </dependency>
+	   
+    </dependencies>
+</project>

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/app/META-INF/jboss-service.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/app/META-INF/jboss-service.xml	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/app/META-INF/jboss-service.xml	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,22 @@
+ <!-- Proxy factory for MyService that will call invoke(Invocation mi) on the target service -->
+   <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
+      name="jboss.jmx:type=adaptor,name=JMMService,protocol=jrmp,service=proxyFactory">
+      <!-- Use the standard JRMPInvoker from conf/jboss-service.xml -->
+      <depends optional-attribute-name="InvokerName">jboss:service=invoker,type=jrmp</depends>
+      <!-- The target MBean -->
+      <depends optional-attribute-name="TargetName">jmm:service=JMMService</depends>
+      <!-- Where to bind the proxy factory -->
+      <attribute name="JndiName">JMMService</attribute>
+      <!-- Invoke invoke(Invocation mi) operation instead of the target method -->
+      <attribute name="InvokeTargetMethod">false</attribute>
+      <!-- MyService interface -->
+      <attribute name="ExportedInterfaces">org.jboss.forge.jmm.common.protocol.ScoresService</attribute>
+      <attribute name="ClientInterceptors">
+          <interceptors>
+             <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
+             <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
+             <interceptor>org.jboss.jmx.connector.invoker.client.InvokerAdaptorClientInterceptor</interceptor>
+             <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
+          </interceptors>
+      </attribute>
+   </mbean>
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/etc/META-INF/persistence.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/etc/META-INF/persistence.xml	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/etc/META-INF/persistence.xml	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence>
+	<persistence-unit name="scores">
+		<jta-data-source>java:/LabsDS</jta-data-source>
+		<properties>
+			<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
+			<property name="hibernate.hbm2ddl.auto" value="update" />
+		</properties>
+	</persistence-unit>
+</persistence>

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/ScoresDailyUpdater.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/ScoresDailyUpdater.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/ScoresDailyUpdater.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,119 @@
+/*
+ * 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.impl;
+
+import java.util.Calendar;
+import javax.annotation.Resource;
+import javax.ejb.Local;
+import javax.ejb.Stateless;
+import javax.ejb.Timeout;
+import javax.ejb.Timer;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+
+import org.jboss.annotation.ejb.LocalBinding;
+import org.jboss.annotation.ejb.TransactionTimeout;
+
+import org.jboss.forge.jmm.common.Constants;
+import org.jboss.forge.jmm.common.exceptions.ScoresException;
+import org.jboss.forge.jmm.common.protocol.ScoresService;
+import org.jboss.forge.jmm.common.protocol.conf.ScoresUpdater;
+import org.jboss.forge.jmm.common.protocol.conf.UpdatesConf;
+
+import org.jboss.logging.Logger;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz [at] jboss . com)
+*/
+
+ at Stateless
+ at Local(ScoresUpdater.class)
+ at LocalBinding(jndiBinding=Constants.DAILY_SCORES_UPDATER)
+public class ScoresDailyUpdater implements ScoresUpdater {
+
+
+	private static final long serialVersionUID = 2272792275281319486L;
+
+	@Resource private javax.ejb.TimerService timerService;
+	
+	private Logger log = Logger.getLogger(ScoresDailyUpdater.class);
+	
+	public void init(ScoresService scoresService, UpdatesConf conf) {
+	
+		log.info("ScoresDailyUpdater initialization");
+		
+		clearSchedule();
+		
+		scheduleUpdates(scoresService, conf);
+	}
+
+	@Timeout
+	@TransactionAttribute(value=TransactionAttributeType.REQUIRED)
+	@TransactionTimeout(value=3000)
+    public void update(Timer timer) {
+		
+       log.info("Updating scores...");
+       
+       ScoresService scoresService = (ScoresService) timer.getInfo();
+      
+       try {
+    	   		scoresService.save();
+    	   
+       } catch (ScoresException e) {
+    	   
+    	   		log.warn("Unable to update scores.\nCause: " + e.getMessage());
+    	   		log.debug("Exception while updating scores:", e);
+       }
+    }
+	
+	private void clearSchedule() {
+    	
+        for (Object obj : timerService.getTimers( )) {
+         
+            Timer timer = (Timer) obj;
+            timer.cancel( );
+        }
+    }
+	
+	private void scheduleUpdates(ScoresService scoresService, UpdatesConf conf) {
+	
+		if (conf.getFirstUpdate() > 0) {
+		
+			long firstUpdateMills = conf.getFirstUpdate() * 60 * 1000;
+			timerService.createTimer(firstUpdateMills, scoresService);
+		}
+		
+		long updateIntervalMills = conf.getUpdateInterval() * 60 * 1000;
+		
+		Calendar cal = Calendar.getInstance();
+		cal.set(Calendar.HOUR_OF_DAY, conf.getUpdateStartHour());
+		cal.set(Calendar.MINUTE, conf.getUpdateStartMinute());
+		
+		if (cal.before(Calendar.getInstance())) {
+			cal.add(Calendar.DATE, 1);
+		}
+		
+		timerService.createTimer(cal.getTime(),
+										updateIntervalMills, scoresService);
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/ScoresServiceImpl.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/ScoresServiceImpl.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/ScoresServiceImpl.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,262 @@
+/*
+ * 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.impl;
+
+import java.util.Calendar;
+import java.util.List;
+import java.util.Properties;
+
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.naming.NamingException;
+
+import org.jboss.annotation.ejb.Management;
+import org.jboss.annotation.ejb.Service;
+
+import org.jboss.forge.jmm.common.Constants;
+import org.jboss.forge.jmm.common.exceptions.GetScoresException;
+import org.jboss.forge.jmm.common.exceptions.ScoresException;
+import org.jboss.forge.jmm.common.protocol.ScoresManager;
+import org.jboss.forge.jmm.common.protocol.ScoresRepositoryManager;
+import org.jboss.forge.jmm.common.protocol.ScoresService;
+import org.jboss.forge.jmm.common.protocol.conf.Configuration;
+import org.jboss.forge.jmm.common.protocol.conf.PluginConf;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValues;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValuesRemote;
+import org.jboss.forge.jmm.common.protocol.conf.ScoresFactory;
+import org.jboss.forge.jmm.common.protocol.conf.ScoresUpdater;
+import org.jboss.forge.jmm.common.tools.Plugins;
+import org.jboss.forge.jmm.common.tools.ProjectTools;
+import org.jboss.forge.jmm.common.tools.Tools;
+
+import org.jboss.forge.jmm.service.impl.db.DBScoresRepositoryManager;
+import org.jboss.forge.jmm.service.impl.db.protocol.DBScoresFactory;
+
+import org.jboss.invocation.Invocation;
+
+import org.jboss.logging.Logger;
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+*/
+
+ at Service(objectName=Constants.JMM_SCORES_SERVICE)
+ at Management(ScoresService.class)
+public class ScoresServiceImpl implements ScoresService {
+
+
+	private static final long serialVersionUID = 2183914957075021104L;
+
+	private Logger log = Logger.getLogger(this.getClass());;
+
+	private String portalName;
+	private Properties projectsServiceProperties;
+	private boolean initialized = false;
+	
+	private ScoresManager scoresManager;
+	private ScoresRepositoryManager repositoryManager;
+	private ScoresFactory scoresFactory;
+
+	private List<PluginConf> pluginsConf;
+	private List<String> projectIds;
+	
+	public void init(Configuration conf, ScoresManager scoresManager)
+													throws ScoresException {
+		
+		log.info("ScoresService initialization");
+		
+		portalName = conf.getPortalName();
+		projectsServiceProperties = conf.getProjectsServiceConf().getProperties();
+		
+		try {
+			ProjectTools.init(portalName, projectsServiceProperties);
+		} catch (NamingException e) {
+			throw new ScoresException("Initialization failed." +
+					"\nCause: " + e.getMessage());
+		}
+		
+		pluginsConf = conf.getPluginsConf();
+		projectIds = conf.getProjectIds();
+		
+		this.scoresManager = scoresManager;
+		
+		try {
+			repositoryManager = new DBScoresRepositoryManager();
+		} catch (NamingException e) {
+			throw new ScoresException("DB service initialization failed." +
+							"\nCause: " + e.getMessage());
+		}
+		
+		scoresFactory = new DBScoresFactory();
+		
+		ScoresUpdater updater = Tools.getScoresUpdater();
+		updater.init(this, conf.getUpdateConf());
+		
+		initialized = true;
+	}
+	
+	/* This method will be called before every get/save call
+	 * to ensure JMM sevice is initialized (it could be not in case of restart)
+	 * TODO Move service conf to service side.
+	 * */
+	public void update(Configuration conf, ScoresManager scoresManager)
+													throws ScoresException {
+		
+		if (initialized) {
+			return;
+		} else {
+			init(conf,scoresManager);
+		}
+	}
+	
+	/**
+	 * Saves current plugin values.
+	 * 
+	 * @param projectIds Projects for which plugin values will be saved
+	 * @param plugins Plugins for which values will be saved
+	 * @param portalName
+	 * @return true iff saving was successful
+	 */
+	@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
+	public void save() throws ScoresException {	
+		
+		log.info("Getting plugins...");
+		
+		// Get plugins from conf
+		Plugins plugins = new Plugins(pluginsConf, portalName, projectIds,
+															scoresManager);
+		
+		log.info("Computing scores...");
+		
+		// Ensure that labs ProjectsService is available
+		try {
+			ProjectTools.init(portalName, projectsServiceProperties);
+		} catch (NamingException e) {
+			throw new ScoresException(e);
+		}
+		
+		// Get plugins values and save them
+		PluginsValues pluginsValues =
+						scoresFactory.createPluginsValues(projectIds, plugins);
+		
+		log.info("Saving...");
+		
+		repositoryManager.save(pluginsValues);
+		
+		log.info("Scores saved successfully");
+	}
+	
+	
+
+	/**
+	 * Returns historical scores from the given <code>date</code> in the past.
+	 * 
+	 * Notice that only year, month and day matter in passed dates.
+	 * 
+	 * @return scores from the given date
+	 * @throws GetScoresException
+	 */
+	private PluginsValues getPluginsValues(Calendar cal)
+									throws GetScoresException {
+				
+		return repositoryManager.get(cal);
+	}
+	
+	public boolean hasPluginsValues(Calendar cal) {
+
+		PluginsValues pluginsValues = null;
+		
+		try {
+			pluginsValues = getPluginsValues(cal);
+		} catch (GetScoresException e) {
+			log.warn("hasPluginsValues", e);
+			return false;
+		}
+		
+		return (pluginsValues != null);
+	}
+
+	public long getValue(String pluginId, String projectId, Calendar cal)
+													throws GetScoresException {
+		
+		return repositoryManager.getValue(pluginId, projectId, cal);
+	}
+
+	public long getValue(String pluginId, String projectId,
+						  Calendar start, Calendar end)
+													throws GetScoresException {
+
+		return repositoryManager.getValue(pluginId, projectId, start, end);
+	}
+
+	public void start() throws Exception {
+		
+		log.info("JMM service started.");
+		
+		Tools.startJMXService(Constants.JMM_SERVICE_ADDRESS);
+		
+		log.info("Connector server for JMM started.");
+	}
+
+	public void stop() throws Exception {
+		
+		log.info("JMM service stopped");
+	}
+
+	public void ping() {
+		
+		log.debug("ping");
+	}
+
+	public Object invoke(Invocation mi) throws Exception {
+		 
+		 Object ret;
+		 
+		 try {
+			 log.debug("ScoresService.invoke> method=" + mi.getMethod().getName());
+			 ret = mi.getMethod().invoke(this,mi.getArguments());
+			 
+		 } catch (Exception e) {
+			 
+			 log.warn("Failed to invoke method " + mi.getMethod().getName(), e);
+			 throw e;
+		 }
+		 
+		 return ret;
+	}
+
+	public void fillPluginsValues(Calendar cal, PluginsValuesRemote pv) throws GetScoresException {
+		
+		PluginsValues pluginsValues = getPluginsValues(cal);
+		pv.fill(pluginsValues);
+	}
+
+	public PluginsValuesRemote getPluginsValuesRemote(Calendar cal) throws GetScoresException{
+		
+		PluginsValuesRemote pvr = new PluginsValuesRemote();
+		PluginsValues pluginsValues = getPluginsValues(cal);
+		pvr.fill(pluginsValues);
+		
+		return pvr;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/DBScoresRepositoryManager.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/DBScoresRepositoryManager.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/DBScoresRepositoryManager.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,125 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.impl.db;
+
+import java.util.Calendar;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.rmi.PortableRemoteObject;
+
+import org.jboss.forge.jmm.common.Constants;
+import org.jboss.forge.jmm.common.exceptions.GetScoresException;
+import org.jboss.forge.jmm.common.exceptions.ScoresSaveException;
+import org.jboss.forge.jmm.common.protocol.DBService;
+import org.jboss.forge.jmm.common.protocol.ScoresRepositoryManager;
+import org.jboss.forge.jmm.common.protocol.conf.PluginValues;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValues;
+
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+*/
+
+public class DBScoresRepositoryManager 
+									implements ScoresRepositoryManager {
+
+	
+	private static final long serialVersionUID = 2623626934114982269L;
+
+	private DBService service;
+	
+	public DBScoresRepositoryManager() throws NamingException {
+		
+		service = getService();
+	};
+	
+	public void save(PluginsValues pluginsValues) throws ScoresSaveException {
+	
+		try {
+			service.save(pluginsValues);
+		} catch (Exception e) {
+			throw new ScoresSaveException(e);
+		}
+	}
+
+	public PluginsValues get(Calendar cal) throws GetScoresException {
+		
+		PluginsValues pv = null;	
+		
+		try {
+			pv = service.get(cal);
+		} catch (Exception e) {
+			throw new GetScoresException(e);
+		}
+		
+		return pv;
+	}
+
+	private DBService getService() throws NamingException {
+			
+		Context context = new InitialContext();
+		
+		//	Perform look up using JNDI name of ejb object
+		Object ref = context.lookup(Constants.DB_SERVICE);
+		
+		// Narrow the reference of the object returned by lookup() method
+		DBService service = 
+			(DBService) PortableRemoteObject.narrow( ref, DBService.class);
+		
+		return service;
+	}
+
+	public long getValue(String pluginId, String projectId, Calendar cal)
+													throws GetScoresException {
+
+		if (!service.hasValue(pluginId, projectId, cal)) {
+			throw new GetScoresException("Value not available.");
+		}
+
+		return service.getValue(pluginId, projectId, cal);
+	}
+
+	public PluginValues getPluginValues(String pluginId, Calendar cal)
+													throws GetScoresException {
+
+		if (!service.hasPluginValues(pluginId, cal)) {
+			throw new GetScoresException("PluginValues not available.");
+		}
+
+		return service.getPluginValues(pluginId, cal);
+	}
+
+	public long getValue(String pluginId, String projectId,
+							Calendar start, Calendar end) throws GetScoresException {
+		
+		
+		if (!service.hasValue(pluginId, projectId, start, end)) {
+			throw new GetScoresException("Value not available.");
+		}
+		
+		return service.getValue(pluginId, projectId, start, end);
+		
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/DBServiceImpl.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/DBServiceImpl.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/DBServiceImpl.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,187 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.impl.db;
+
+import java.util.Calendar;
+import java.util.List;
+
+import javax.ejb.Local;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+import javax.persistence.TemporalType;
+
+import org.jboss.annotation.ejb.LocalBinding;
+
+import org.jboss.forge.jmm.common.Constants;
+import org.jboss.forge.jmm.common.protocol.DBService;
+import org.jboss.forge.jmm.common.protocol.conf.PluginValues;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValues;
+import org.jboss.forge.jmm.common.tools.Tools;
+
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+*/
+
+ at Stateless
+ at Local(DBService.class)
+ at LocalBinding(jndiBinding=Constants.DB_SERVICE)
+public class DBServiceImpl implements DBService {
+
+	private static final long serialVersionUID = -451124503719994227L;
+	
+	@PersistenceContext (unitName="scores")
+    protected EntityManager em;
+	
+	@TransactionAttribute(TransactionAttributeType.REQUIRED)
+	public synchronized void save(PluginsValues toSave) {
+		
+		PluginsValues pv = get(toSave.getDate());
+		
+		if ((pv != null) && 
+				(pv.getDate().equals(toSave.getDate()))) {
+			
+			em.remove(pv);
+		}
+		
+		em.persist(toSave);
+	}
+
+	public PluginsValues get(Calendar date) {
+		
+		Tools.truncate(date);
+		Calendar nextDay = Tools.nextDay(date);
+	
+		List list = null;
+		
+		Query query = em.createQuery(
+				" SELECT c FROM PluginsValuesEntity c " +
+				" LEFT JOIN FETCH c.values cv " +
+				" LEFT JOIN FETCH cv.values " +
+				" WHERE (:date <= c.date) AND (c.date < :nextDay)");
+		
+		query.setParameter("date", date, TemporalType.DATE);
+		query.setParameter("nextDay", nextDay, TemporalType.DATE);
+
+		list = query.getResultList();
+		
+		return (list.size() == 0 ? null : (PluginsValues) list.get(0));
+	}
+
+	public long getValue(String pluginId, String projectId, Calendar date) {
+		
+		Tools.truncate(date);
+		Calendar nextDay = Tools.nextDay(date);
+		
+		Query query = em.createQuery(
+				" SELECT c.value FROM ValueEntity c " +
+				" WHERE c.projectId = :projectId " +
+				  " AND c.pluginValues.pluginId = :pluginId " +
+				  " AND (:date <= c.pluginValues.pluginsValues.date)" +
+				  " AND (c.pluginValues.pluginsValues.date < :nextDay) ");
+		
+		query.setParameter("projectId", projectId);
+		query.setParameter("pluginId", pluginId);
+		query.setParameter("date", date, TemporalType.DATE);
+		query.setParameter("nextDay", nextDay, TemporalType.DATE);
+		
+		return (Long) query.getSingleResult();
+	}
+
+	public boolean hasValue(String pluginId, String projectId, Calendar date) {
+		
+		try {
+			getValue(pluginId, projectId, date);
+		} catch (Exception e) {
+			return false;
+		}
+		
+		return true;
+	}
+
+	public PluginValues getPluginValues(String pluginId, Calendar date) {
+		
+		Tools.truncate(date);
+		Calendar nextDay = Tools.nextDay(date);
+		
+		Query query = em.createQuery(
+				" SELECT c.value FROM PluginValuesEntity c " +
+				" WHERE c.pluginId = :pluginId " +
+				  " AND (:date <= c.pluginsValues.date)" +
+				  " AND (c.pluginsValues.date < :nextDay) ");
+		
+		query.setParameter("pluginId", pluginId);
+		query.setParameter("date", date, TemporalType.DATE);
+		query.setParameter("nextDay", nextDay, TemporalType.DATE);
+		
+		return (PluginValues) query.getSingleResult();
+	}
+
+	public boolean hasPluginValues(String pluginId, Calendar date) {
+		
+		try {
+			getPluginValues(pluginId, date);
+		} catch (Exception e) {
+			return false;
+		}
+		
+		return true;
+	}
+
+	public long getValue(String pluginId, String projectId,
+											Calendar start, Calendar end) {
+		
+		Query query = em.createQuery(
+				" SELECT c.value FROM ValueEntity c " +
+				" WHERE c.projectId = :projectId " +
+				"   AND c.pluginValues.pluginId = :pluginId " +
+				"   AND c.pluginValues.pluginsValues.date >= :start " +
+				"   AND c.pluginValues.pluginsValues.date <= :end " +
+				" ORDER BY c.pluginValues.pluginsValues.date ");
+		
+		query.setParameter("projectId", projectId);
+		query.setParameter("pluginId", pluginId);
+		query.setParameter("start", start, TemporalType.DATE);
+		query.setParameter("end", end, TemporalType.DATE);
+		
+		return (Long) query.getResultList().get(0);
+		
+	}
+
+	public boolean hasValue(String pluginId, String projectId,
+											Calendar start, Calendar end) {
+		
+		try {
+			getValue(pluginId, projectId, start, end);
+		} catch (Exception e) {
+			return false;
+		}
+		
+		return true;
+	}	
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/DBScoresFactory.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/DBScoresFactory.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/DBScoresFactory.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.impl.db.protocol;
+
+import java.util.List;
+
+import org.jboss.forge.jmm.common.protocol.conf.Plugin;
+import org.jboss.forge.jmm.common.protocol.conf.PluginValues;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValues;
+import org.jboss.forge.jmm.common.protocol.conf.ScoresFactory;
+import org.jboss.forge.jmm.common.tools.Plugins;
+
+
+/**
+* @author Pawel Wrzeszcz
+*/
+public class DBScoresFactory implements ScoresFactory {
+
+	private static final long serialVersionUID = -321472354642673L;
+
+	public PluginsValues createPluginsValues(List<String> projectIds, Plugins plugins) {
+		return new PluginsValuesEntity(projectIds, plugins);
+	}
+	
+	public PluginValues createPluginValues(Plugin plugin, List<String> projectIds) {
+		return new PluginValuesEntity(plugin, projectIds, null);
+	}
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/PluginValuesEntity.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/PluginValuesEntity.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/PluginValuesEntity.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,167 @@
+
+ /*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2006, 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.impl.db.protocol;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.MapKey;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import org.jboss.forge.jmm.common.protocol.conf.Plugin;
+import org.jboss.forge.jmm.common.protocol.conf.PluginValues;
+
+/**
+ * @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+ */
+ at Entity
+ at Table(name = "jblab_jmm_plugin_values")
+public class PluginValuesEntity extends ScoresEntity implements PluginValues
+{
+
+	private static final long serialVersionUID = 6211914842083801542L;
+	
+	private long id;
+    private String pluginId;
+    private String linkName;
+    private PluginsValuesEntity pluginsValues;
+    
+    /* Map projectId -> ValueEntity */
+    private Map<String, ValueEntity> values = new HashMap<String, ValueEntity>();
+   
+    /**
+     * Default constructor
+     */
+    public PluginValuesEntity () {}
+        
+    public PluginValuesEntity(Plugin plugin, List<String> projectIds,
+    								PluginsValuesEntity pluginsValues) {
+    	
+		// Get plugin properties
+		pluginId = plugin.getId();
+		linkName = plugin.getLinkName();
+		
+		// Get plugin values
+		for (String projectId : projectIds) {
+			
+			ValueEntity value = new ValueEntity(projectId,
+												plugin.getValue(projectId),
+											    plugin.getRate(projectId),
+											    plugin.getLink(projectId),
+											    this);
+			values.put(projectId, value);
+		}
+		
+		this.pluginsValues = pluginsValues;
+    }
+
+	@Id
+    @GeneratedValue
+    @Column(name = "id")
+    public long getId() {
+		return id;
+	}
+    
+    protected void setId(long id) {
+    	this.id = id;
+    }
+
+	@Column(name = "pluginId")
+	public String getPluginId() {
+		return pluginId;
+	}
+
+	public void setPluginId(String pluginId) {
+		this.pluginId = pluginId;
+	}
+	
+	@Column(name = "linkName")
+	public String getLinkName() {
+		return linkName;
+	}
+
+	protected void setLinkName(String linkName) {
+		this.linkName = linkName;
+	}
+
+	@OneToMany(mappedBy="pluginValues",cascade={CascadeType.ALL})
+	@MapKey(name="projectId") 
+	public Map<String, ValueEntity> getValues() {
+		return values;
+	}
+
+	public void setValues(Map<String, ValueEntity> values) {
+		this.values = values;
+	}
+	
+	@ManyToOne(cascade={CascadeType.ALL})
+    @JoinColumn(name="plugins_values_id")
+	public PluginsValuesEntity getPluginsValues() {
+		return pluginsValues;
+	}
+
+	public void setPluginsValues(PluginsValuesEntity pluginsValues) {
+		this.pluginsValues = pluginsValues;
+	}
+	
+	/* Non-DB methods */	
+
+	public long getValue(String projectId) {
+		
+		ValueEntity valueEntity = values.get(projectId);
+		
+		return (valueEntity == null ? 0 : valueEntity.getValue());
+	}
+
+	public int getRate(String projectId) {
+		
+		ValueEntity valueEntity = values.get(projectId);
+		
+		return (valueEntity == null ? 0 : valueEntity.getRate());
+	}
+	
+	public String getLink(String projectId) {
+
+		ValueEntity valueEntity = values.get(projectId);
+		
+		return (valueEntity == null ? "" : valueEntity.getLink());
+	}
+	
+	@Transient
+	public Set<String> getProjectIds() {
+		
+		return values.keySet();
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/PluginsValuesEntity.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/PluginsValuesEntity.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/PluginsValuesEntity.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,136 @@
+
+ /*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2006, 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.impl.db.protocol;
+
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.MapKey;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import org.jboss.forge.jmm.common.protocol.conf.Plugin;
+import org.jboss.forge.jmm.common.protocol.conf.PluginValues;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValues;
+import org.jboss.forge.jmm.common.tools.Plugins;
+
+/**
+ *
+ * @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+ *
+ * EJB3 Entity used to persist in database all
+ * project scores for Status Matrix.
+ */
+ at Entity
+ at Table(name = "jblab_jmm_plugins_values")
+public class PluginsValuesEntity extends ScoresEntity implements PluginsValues
+{
+
+	private static final long serialVersionUID = 1299912767177909726L;
+
+	private long id;
+	
+	@Temporal(TemporalType.DATE)
+    private Calendar date;
+    
+	/** Map : pluginId -> pluginValue */
+	private Map<String,PluginValuesEntity> values;
+	
+    /**
+     * Default constructor
+     */
+    public PluginsValuesEntity () {}
+    
+	/**
+	 * @param projects Projects present in the Status Matrix
+	 * @param plugins Plugins which values will be stored
+	 */
+	public PluginsValuesEntity(List<String> projectIds, Plugins plugins) {
+		
+		date = Calendar.getInstance();
+		
+		values = new HashMap<String,PluginValuesEntity>();
+		
+		for (Plugin plugin : plugins.getPlugins()) {
+			
+			PluginValuesEntity pluginValues =
+							new PluginValuesEntity(plugin, projectIds, this);
+			
+			values.put(plugin.getId(), pluginValues);
+		}
+	}
+	
+    @Id
+    @GeneratedValue
+    @Column(name = "id")
+    public long getId() {
+		return id;
+	}
+    
+	protected void setId(long id) {
+    	this.id = id;
+    }
+
+	@Column(name = "date")
+	public Calendar getDate() {
+		return date;
+	}
+
+	public void setDate(Calendar date) {
+		this.date = date;
+	}
+
+	@OneToMany(mappedBy="pluginsValues",cascade={CascadeType.ALL})
+	@MapKey(name="pluginId") 
+	public Map<String, PluginValuesEntity> getValues() {
+		return values;
+	}
+
+	public void setValues(Map<String, PluginValuesEntity> values) {
+		this.values = values;
+	}
+
+	public PluginValues getPluginValues(String pluginId) {
+		return values.get(pluginId);
+	}
+
+	@Transient
+	public Set<String> getPluginIds() {
+		
+		return values.keySet();
+	}
+	
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/ScoresEntity.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/ScoresEntity.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/ScoresEntity.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,38 @@
+
+ /*
+  * 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.impl.db.protocol;
+
+import java.io.Serializable;
+
+
+
+
+/**
+ * @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+ */
+
+public abstract class ScoresEntity implements Serializable
+{
+
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/ValueEntity.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/ValueEntity.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/db/protocol/ValueEntity.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,126 @@
+
+ /*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2006, 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.impl.db.protocol;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+
+
+
+
+
+/**
+ * @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+ */
+ at Entity
+ at Table(name = "jblab_jmm_scores")
+public class ValueEntity extends ScoresEntity
+{
+
+	private static final long serialVersionUID = -6722628455147603474L;
+
+	private long id;
+	
+	private String projectId;
+	private long value;
+	private int rate;
+	private String link;
+	private PluginValuesEntity pluginValues;
+	
+	public ValueEntity() {}
+
+	public ValueEntity(String projectId, long value, int rate, String link,
+							PluginValuesEntity pluginValues) {
+		
+		this.projectId = projectId;
+		this.value = value;
+		this.rate = rate;
+		this.link = link;
+		this.pluginValues = pluginValues;
+	}
+
+	@Id
+    @GeneratedValue
+    @Column(name = "id")
+	public long getId() {
+		return id;
+	}
+	
+	protected void setId(long id) {
+		this.id = id;
+	}
+	
+	@Column(name = "projectId")
+	public String getProjectId() {
+		return projectId;
+	}
+
+	public void setProjectId(String projectId) {
+		this.projectId = projectId;
+	}
+
+	@Column(name = "link")
+	public String getLink() {
+		return link;
+	}
+
+	public void setLink(String link) {
+		this.link = link;
+	}
+
+	@Column(name = "rate")
+	public int getRate() {
+		return rate;
+	}
+
+	public void setRate(int rate) {
+		this.rate = rate;
+	}
+
+	@Column(name = "value")
+	public long getValue() {
+		return value;
+	}
+
+	public void setValue(long value) {
+		this.value = value;
+	}
+
+	@ManyToOne(cascade={CascadeType.ALL})
+    @JoinColumn(name="plugin_values_id")
+	public PluginValuesEntity getPluginValues() {
+		return pluginValues;
+	}
+
+	public void setPluginValues(PluginValuesEntity pluginValues) {
+		this.pluginValues = pluginValues;
+	}
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/ShotokuScoresRepositoryManager.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/ShotokuScoresRepositoryManager.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/ShotokuScoresRepositoryManager.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,357 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.impl.shotoku;
+
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.forge.jmm.common.Locations;
+import org.jboss.forge.jmm.common.exceptions.GetScoresException;
+import org.jboss.forge.jmm.common.exceptions.ScoresSaveException;
+import org.jboss.forge.jmm.common.protocol.ScoresRepositoryManager;
+import org.jboss.forge.jmm.common.protocol.conf.PluginValues;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValues;
+import org.jboss.logging.Logger;
+import org.jboss.shotoku.ContentManager;
+import org.jboss.shotoku.Directory;
+import org.jboss.shotoku.Node;
+import org.jboss.shotoku.aop.Inject;
+import org.jboss.shotoku.exceptions.RepositoryException;
+import org.jboss.shotoku.exceptions.ResourceDoesNotExist;
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+*/
+
+public class ShotokuScoresRepositoryManager 
+									implements ScoresRepositoryManager {
+
+	private Logger log = Logger.getLogger(this.getClass());
+	
+	private Map<String,PluginsValues> values
+										= new HashMap<String,PluginsValues>();
+
+	private String portalName;
+	
+	@Inject
+	private ContentManager cm;
+	
+	public ShotokuScoresRepositoryManager(String portalName) {
+		
+		this.portalName = portalName;
+	};
+	
+	public void save(PluginsValues pluginsValues)
+										throws ScoresSaveException {
+		
+		// Get directory where we store historical scores
+		Directory rootDir = cm.getRootDirectory();
+		String dirName = Locations.getShotokuStatusPath(portalName);
+		Directory dir = getDir(rootDir, dirName);
+		
+		// Get node to store scores
+		String nodeName = getCurrentNodeName();
+		Node node = null;
+		
+		log.info("Getting shotoku node...");
+		
+		try {
+			node = dir.getNode(nodeName);
+		} catch (RepositoryException e) {
+			log.error("Error while getting shotoku node: " +
+					dir.getFullName() + "/" + nodeName, e);
+		} catch (ResourceDoesNotExist e) {
+			node = createNode(dir, nodeName);
+		}
+		
+		// Save values and store then in cache
+		values.put(getCurrentNodeName(), pluginsValues);
+		save(node, pluginsValues);
+		
+		log.info("Saved succesfully");
+		/*
+		ScoresEntity se = new ScoresEntity("tttest");
+		em.persist(se);
+		log.info("Saved in DB");*/
+	}
+
+	public PluginsValues get(Calendar cal) throws GetScoresException {
+		
+		String key = getNodeName(cal);
+		log.info("Returning plugins values (" + key + ") ...");
+		
+		// null date means today
+		if (cal == null) {
+			cal = Calendar.getInstance();
+		}
+		
+		PluginsValues v = values.get(key);
+		
+		if (v == null) { // Not in cache => get value and store it
+			
+			log.info("Value not in cache...");
+			Directory rootDir = cm.getRootDirectory();
+			
+			Directory dir;
+			try {
+				dir = rootDir.getDirectory(Locations.
+											getShotokuStatusPath(portalName));	
+			} catch (RepositoryException e) {
+				throw new GetScoresException(e);
+			} catch (ResourceDoesNotExist e) {
+				throw new GetScoresException(e);
+			}
+
+			if (dir != null) {
+				v = getPluginsValues(dir, cal);
+				log.info("Finished.");
+				values.put(key,v);
+			}
+		} else {
+			log.info("Returned cached value.");
+		}
+			
+		return v;
+	}
+	
+	/**
+	 * Saves plugins values in the given Directory.
+	 * 
+	 * @param dir Directory to save values
+	 * @param pluginsValues PluginsValues to save
+	 * @throws ScoresSaveException 
+	 */
+	private synchronized void save(Node node, PluginsValues pluginsValues)
+										throws ScoresSaveException {
+		
+		try {
+			OutputStream os = node.getOutputStream();
+			ObjectOutputStream oos = new ObjectOutputStream(os);
+			oos.writeObject((PluginsValues) pluginsValues);
+			oos.close(); 
+			node.save("update"); /* os is closed inside save() */
+			
+		} catch (Exception e) {
+			log.error("Error while saving shotoku node: " +
+					node.getFullName(), e);
+			throw new ScoresSaveException(e);
+		}
+	}
+	
+	/**
+	 * Creates new shotoku Node.
+	 * 
+	 * @param dir Directory in which new Node will be created
+	 * @param nodeName name of new Node
+	 * @return Node
+	 * @throws ScoresSaveException 
+	 */
+	private Node createNode(Directory dir, String nodeName)
+											throws ScoresSaveException {
+		
+		Node node = null;
+		
+		try {
+			node = dir.newNode(nodeName);
+			node.save("create");
+		} catch (Exception e) {
+			log.error("Error while creating shotoku node: " +
+					dir.getFullName() + "/" + nodeName, e);
+			throw new ScoresSaveException(e);
+		}
+		
+		return node;
+	}
+
+	/**
+	 * Gets shotoku Directory with name <code>dirName</code>
+	 * from specified shotoku Directory.
+	 * If requested Directory does not exist it is created.
+	 * 
+	 * @param rootDir Directory where search will be performed
+	 * @param dirName name of searched Directory
+	 * @return Directory with the given name
+	 * or null when creating Directory failed.  
+	 * @throws ScoresSaveException 
+	 */
+	private Directory getDir(Directory rootDir, String dirName)
+										throws ScoresSaveException {
+		
+		Directory dir = null;
+			
+		try {
+			dir = rootDir.getDirectory(dirName);
+		} catch (RepositoryException e) {
+			log.error("Error while getting shotoku directory " +
+					rootDir.getFullName() + "/" + dirName);
+			throw new ScoresSaveException(e);
+		} catch (ResourceDoesNotExist e) {
+			dir = createDir(rootDir, dirName);
+		}
+			
+		return dir;
+	}
+
+	/**
+	 * Creates new shotoku Directory.
+	 * 
+	 * @param rootDir Directory in which new subdirectory will be created
+	 * @param dirName name of new Directory
+	 * @return Directory or null if errors occured
+	 * @throws ScoresSaveException 
+	 */
+	private Directory createDir(Directory rootDir, String dirName)
+												throws ScoresSaveException {
+		
+		Directory dir = null;
+		
+		try {
+			dir = rootDir.newDirectory(dirName);
+			dir.save("create");
+		} catch (Exception e) {
+			log.error("Error while creating shotoku directory: " +
+					rootDir.getFullName() + "/" + dirName, e);
+			throw new ScoresSaveException(e);
+		}
+		
+		return dir;
+	}
+
+	/**
+	 * Gets name of Node containing saved data from specified datestamp.
+	 * Notice that only year, month and day matter in passed <code>cal</code>.
+	 * 
+	 * @return Node name
+	 */
+	private String getNodeName(Calendar cal) {
+		
+		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
+		
+		Date date = cal.getTime();
+		
+		return df.format(date);
+	}
+	
+	/**
+	 * @return name of Node containging data saved today
+	 */
+	private String getCurrentNodeName() {
+		
+		Calendar today = Calendar.getInstance();
+		
+		return getNodeName(today); 
+	}
+	
+	/**
+	 * Returns historical scores from the specified directory.
+	 * 
+	 * @param dir Directory to read scores from
+	 * @return
+	 * @throws GetScoresException 
+	 */
+	private PluginsValues getPluginsValues(Directory dir, Calendar cal)
+												throws GetScoresException {
+		
+		// Get appropriate node
+		Node node = null;
+		String nodeName = getNodeName(cal);
+		
+		try {
+			node = dir.getNode(nodeName);
+		} catch (Exception e) {
+			log.info("Unable to get shotoku node " +
+					dir.getFullName() + "/" + nodeName);
+			throw new GetScoresException(e);
+		}
+		
+		// Restore values
+		PluginsValues values = null;
+		try {
+			InputStream is = node.getContentInputStream();
+			ObjectInputStream ois = new ObjectInputStream(is);
+			values = (PluginsValues) ois.readObject();
+			ois.close();
+			is.close();
+		} catch (Exception e) {
+			log.error("Error while restoring scores from shotoku node " +
+					dir.getFullName() + "/" + nodeName);
+			throw new GetScoresException(e);
+		}
+		
+		return values;
+	}
+
+	public long getValue(String pluginId, String projectId, Calendar cal)
+												throws GetScoresException {
+		
+		PluginValues pluginValues = getPluginValues(pluginId, cal);
+		
+		if (pluginValues == null) {
+			throw new GetScoresException();
+		}
+		
+		return pluginValues.getValue(projectId);
+	}
+
+	public PluginValues getPluginValues(String pluginId, Calendar cal)
+												throws GetScoresException {
+		
+		PluginsValues pluginsValues = get(cal);
+		
+		if (pluginsValues == null) {
+			throw new GetScoresException();
+		}
+		
+		return pluginsValues.getPluginValues(pluginId);
+	}
+
+	public long getValue(String pluginId, String projectId,
+					Calendar start, Calendar end) throws GetScoresException {
+		
+		long value;
+		Calendar cal = start;
+		
+		for (;;) {
+			
+			if (cal.after(end)) {
+				throw new GetScoresException();
+			}
+			
+			try {
+				value = getValue(pluginId, projectId, cal);
+				return value;
+			} catch (GetScoresException e) {
+				// try next
+				cal.add(Calendar.DAY_OF_MONTH, 1);
+			}	
+		}
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/protocol/PluginValuesImpl.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/protocol/PluginValuesImpl.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/protocol/PluginValuesImpl.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,90 @@
+/*
+ * 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.impl.shotoku.protocol;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.persistence.Transient;
+
+import org.jboss.forge.jmm.common.protocol.conf.Plugin;
+import org.jboss.forge.jmm.common.protocol.conf.PluginValues;
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+* A class used to store plugin values in shotoku.
+*/
+
+public class PluginValuesImpl implements PluginValues {
+	
+	private static final long serialVersionUID = 5196364802717262757L;
+	
+	private String pluginId;
+	private String linkName;
+	
+	private Map<String,Long> values = new HashMap<String,Long>();
+	private Map<String,Integer> rates = new HashMap<String,Integer>();
+	private Map<String,String> links = new HashMap<String,String>();
+		
+	public PluginValuesImpl(Plugin plugin, List<String> projectIds) {
+	
+		// Get plugin properties
+		pluginId = plugin.getId();
+		linkName = plugin.getLinkName();
+		
+		// Get plugin values
+		for (String projectId : projectIds) {
+			
+			values.put(projectId, plugin.getValue(projectId));
+			rates.put(projectId, new Integer(plugin.getRate(projectId)));
+			links.put(projectId, plugin.getLink(projectId));
+		}
+	}
+
+	public String getPluginId() {
+		return pluginId;
+	}
+	
+	public long getValue(String projectId) {
+		return values.get(projectId);
+	}
+
+	public int getRate(String projectId) {
+		return rates.get(projectId);
+	}
+	
+	public String getLink(String projectId) {
+		return links.get(projectId);
+	}
+	
+	public String getLinkName() {
+		return linkName;
+	}
+
+	public Set<String> getProjectIds() {
+		
+		return values.keySet();
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/protocol/PluginsValuesImpl.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/protocol/PluginsValuesImpl.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/protocol/PluginsValuesImpl.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,84 @@
+/*
+ * 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.impl.shotoku.protocol;
+
+import java.util.Calendar;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+
+import org.jboss.forge.jmm.common.protocol.conf.Plugin;
+import org.jboss.forge.jmm.common.protocol.conf.PluginValues;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValues;
+import org.jboss.forge.jmm.common.tools.Plugins;
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com)
+* A class used to store plugins values in shotoku.
+*/
+
+public class PluginsValuesImpl implements PluginsValues {
+
+	private static final long serialVersionUID = -1669515339062166738L;
+
+	/** Map : pluginId -> pluginValue */
+	private Map<String,PluginValues> values;
+	
+	/** Creation date */
+	private Calendar cal;
+	
+	/**
+	 * @param projectId Projects present in the Status Matrix
+	 * @param plugins Plugins which values will be stored
+	 */
+	public PluginsValuesImpl(List<String> projectIds, Plugins plugins) {
+		
+		cal = Calendar.getInstance();
+		
+		values = new HashMap<String,PluginValues>();
+		
+		for (Plugin plugin : plugins.getPlugins()) {
+			
+			PluginValuesImpl pluginValues = new PluginValuesImpl(plugin, projectIds);
+			
+			values.put(plugin.getId(), pluginValues);
+		}
+	}
+	
+	/**
+	 * @return creation date
+	 */
+	public Calendar getDate() {
+		return cal;
+	}
+	
+	public PluginValues getPluginValues(String pluginId) {
+		return values.get(pluginId);
+	}
+
+	public Set<String> getPluginIds() {
+		
+		return values.keySet();
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/protocol/ShotokuScoresFactory.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/protocol/ShotokuScoresFactory.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/impl/shotoku/protocol/ShotokuScoresFactory.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.impl.shotoku.protocol;
+
+import java.util.List;
+
+import org.jboss.forge.jmm.common.protocol.conf.Plugin;
+import org.jboss.forge.jmm.common.protocol.conf.PluginValues;
+import org.jboss.forge.jmm.common.protocol.conf.PluginsValues;
+import org.jboss.forge.jmm.common.protocol.conf.ScoresFactory;
+import org.jboss.forge.jmm.common.tools.Plugins;
+
+
+/**
+* @author Pawel Wrzeszcz
+*/
+public class ShotokuScoresFactory implements ScoresFactory {
+	
+	public PluginsValues createPluginsValues(List<String> projectIds, Plugins plugins) {
+		return new PluginsValuesImpl(projectIds, plugins);
+	}
+	
+	public PluginValues createPluginValues(Plugin plugin, List<String> projectIds) {
+		return new PluginValuesImpl(plugin, projectIds);
+	}
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/KosmosPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/KosmosPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/KosmosPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,147 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.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.protocol.conf.Plugin;
+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;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcBrokenBuildsPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcBrokenBuildsPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcBrokenBuildsPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.cc;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+*/
+
+public class CcBrokenBuildsPlugin extends CcBuildsPlugin {
+
+	@Override
+	protected String getPattern() {
+		
+		return "Number of Broken Builds";
+	}	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcBuildAttemptsPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcBuildAttemptsPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcBuildAttemptsPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.cc;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+*/
+
+public class CcBuildAttemptsPlugin extends CcBuildsPlugin {
+
+	@Override
+	protected String getPattern() {
+		
+		return "Number of Build Attempts";
+	}
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcBuildsPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcBuildsPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcBuildsPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,120 @@
+/*
+ * 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.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.jboss.forge.jmm.common.protocol.conf.Plugin;
+import org.jboss.forge.jmm.common.tools.ProjectTools;
+import org.jboss.logging.Logger;
+
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+*/
+
+public abstract class CcBuildsPlugin extends Plugin {
+
+	
+	protected abstract String getPattern();
+	
+	protected Logger log = Logger.getLogger(CcBuildsPlugin.class);
+	
+	@Override
+	public long getPluginValue(String projectId) {
+		
+		List<String> URLs = ProjectTools.getProjectCcURLs(projectId);
+		
+		if (URLs == null) {
+			
+			return 0;
+		}
+		
+		long v = 0;
+		
+		for (String url : URLs) {
+			
+			v += get(url);
+		}
+		
+		return v;
+	}
+
+	private long get(String urlString) {
+		
+		urlString = urlString.concat("?tab=metrics");
+		
+		URL url;
+		String string;
+		StringBuilder stringBuilder = new StringBuilder();
+		
+		try {
+			url = new URL(urlString);
+			
+			InputStream is = url.openStream();
+			BufferedReader in = new BufferedReader(new InputStreamReader(is));
+			
+			String decodedString;
+			
+			while ((decodedString = in.readLine()) != null) {
+				
+				stringBuilder.append(decodedString);
+			    
+			}
+			
+			in.close();
+			
+		} catch (IOException e) {
+			
+			log.warn("Could not obtain statistics from " + urlString
+								+ "\nCause: " + e.getMessage());
+			
+			return 0;
+		}
+		
+		string = stringBuilder.toString();
+		
+		Pattern pattern = Pattern.compile("<tr><td>" + getPattern() +
+												"</td><td>([0-9]*)</td></tr>");
+
+	    Matcher matcher = pattern.matcher(string);
+	    
+	    if (!matcher.find()) { 
+        	
+	    	return 0;
+	    }
+	    
+	    String resString = matcher.group(1);
+		
+		return Long.parseLong(resString);
+		
+	}	
+	
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcErrorsPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcErrorsPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcErrorsPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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.getProjectCcURLs(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> ccURLs = ProjectTools.getProjectCcURLs(projectId);
+		
+		return ((ccURLs == null) || (ccURLs.size() == 0)) ? null : ccURLs.get(0);
+	}
+
+	@Override
+	public String getPluginLinkName() {
+		return CC_LINK_NAME;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcSuccessfulBuildsPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcSuccessfulBuildsPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcSuccessfulBuildsPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.cc;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+*/
+
+public class CcSuccessfulBuildsPlugin extends CcBuildsPlugin {
+
+	@Override
+	protected String getPattern() {
+		
+		return "Number of Successful Builds";
+	}
+}
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcTestsPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcTestsPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/cc/CcTestsPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/AddedCodeLinesPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/AddedCodeLinesPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/AddedCodeLinesPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.codelines;
+
+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.protocol.ScoresManager;
+import org.jboss.forge.jmm.common.tools.Plugins;
+
+/**
+* @author Pawel Wrzeszcz
+* Plugin returns number of lines of code added recently
+* to project svn repository within specified number of days.
+*/
+
+public class AddedCodeLinesPlugin extends CodeLinesPlugin {
+
+	private int days;
+	
+	@Override
+	public void init(String id, String portalName, List<String> projectIds,
+									Plugins plugins, Properties properties, ScoresManager scoresManager)
+									throws InvalidPluginPropertiesException {
+		
+		if (properties == null ) {
+			throw new InvalidPluginPropertiesException(
+								"Missing properties.");
+		}
+		
+		String daysString = properties.getProperty(Tags.DAYS_TAG);
+		
+		if (daysString == null) {
+			throw new InvalidPluginPropertiesException(
+											"Missing \'days\' property.");
+		}
+		
+		days = Integer.parseInt(daysString);
+	
+		super.init(id, portalName, projectIds, plugins, properties, scoresManager);
+	}
+	
+	@Override
+	protected long getPluginValue(String url, String userName, String password) {
+	
+		long ret = 0;
+		
+		if ((userName != null) && (password != null)) {
+			ret = CodeLinesEvaluator.
+							getAddedCodeLines(url, userName, password, days);
+		} else {
+			ret = CodeLinesEvaluator.getAddedCodeLines(url, days);
+		}
+		
+		return Math.max(ret,0); // Do not report decrease of number of lines??
+	}
+	
+}

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

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/CodeLinesEvaluator.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/CodeLinesEvaluator.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/CodeLinesEvaluator.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,398 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.codelines;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+import java.util.HashMap;
+
+
+import org.jboss.logging.Logger;
+import org.tmatesoft.svn.core.SVNDirEntry;
+import org.tmatesoft.svn.core.SVNException;
+import org.tmatesoft.svn.core.SVNNodeKind;
+import org.tmatesoft.svn.core.SVNProperty;
+import org.tmatesoft.svn.core.SVNURL;
+import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager;
+import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory;
+import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl;
+import org.tmatesoft.svn.core.io.SVNRepository;
+import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
+import org.tmatesoft.svn.core.wc.SVNDiffClient;
+import org.tmatesoft.svn.core.wc.SVNRevision;
+import org.tmatesoft.svn.core.wc.SVNWCUtil;
+
+/**
+* @author Pawel Wrzeszcz
+* A class providing information about number of code lines in SVN repository files.
+*/
+
+public class CodeLinesEvaluator {
+	
+	private static Logger log = Logger.getLogger(CodeLinesEvaluator.class);
+	
+	private static CheckOutEditor editor = new CheckOutEditor();
+
+	/**
+	 * Evaluates number of code lines in files located in secure SVN repository.
+	 * 
+	 * @param url SVN repository adress
+	 * @param userName user's name used in authorisation 
+	 * @param password user's password used in authorisation
+	 * @return number of code lines
+	 */
+	public static long getCodeLinesNumber(String url, String userName, String password) {
+		
+		SVNRepository repository = getRepository(url, userName, password);
+		
+        return (repository != null) ? getCodeLinesNumber(repository, "") : 0;
+	}
+	
+	/**
+	 * Evaluates number of code lines in files located in secure SVN repository.
+	 * 
+	 * @param url SVN repository adress
+	 * @param userName user's name used in authorisation 
+	 * @param password user's password used in authorisation
+	 * @return number of code lines
+	 * @throws SVNException 
+	 */
+	public static long getCodeLinesNumberFast(String url, String userName,
+										String password) throws SVNException {
+		
+		SVNRepository repository = getRepository(url, userName, password);
+	
+		repository.checkout(SVNRevision.HEAD.getNumber(), "", true, editor);
+        
+        return editor.getCodeLines();
+	}
+
+
+	/**
+	 * Evaluates number of code lines in files located in anonymus SVN repository.
+	 * 
+	 * @param url SVN repository adress
+	 * @return number of code lines
+	 */
+	public static long getCodeLinesNumber(String url) {
+		return getCodeLinesNumber(url, "anonymous", "anonymus");
+	}
+	
+	/**
+	 * Evaluates number of code lines in files located in anonymus SVN repository.
+	 * 
+	 * @param url SVN repository adress
+	 * @return number of code lines
+	 * @throws SVNException 
+	 */
+	public static long getCodeLinesNumberFast(String url) throws SVNException {
+		return getCodeLinesNumberFast(url, "anonymus", "anonymus");
+	}
+	
+	/**
+	 * Evaluates number of code lines added to recently repository
+	 * within specified number of days.
+	 * 
+	 * @param url SVN repository adress
+	 * @param userName user's name used in authorisation 
+	 * @param password user's password used in authorisation
+	 * @param days
+	 * @return number of code lines
+	 */
+	public static long getAddedCodeLines(String url, String userName,
+												String password, int days) {
+		
+		SVNRepository repository = getRepository(url, userName, password);
+		
+        return (repository != null) ?
+        					getAddedCodeLines(repository, "", days) : 0;
+	}
+
+	
+	/**
+	 * Evaluates number of code lines added recently to anonymus SVN repository
+	 * within specified number of days.
+	 * 
+	 * @param url SVN repository adress
+	 * @param days
+	 * @return number of code lines
+	 */
+	public static long getAddedCodeLines(String url, int days) {
+		return getAddedCodeLines(url, "anonymous", "anonymus", days);
+	}
+	
+	/**
+	 * Performs necessary initialization and connects to the repository.
+	 * 
+	 * @param url SVN repository adress
+	 * @param userName user's name used in authorisation 
+	 * @param password user's password used in authorisatio
+	 * @return SVNRepository from the given adress or null if connection was refused 
+	 */
+	private static SVNRepository getRepository(String url, String userName, String password) {
+		
+		setupLibrary();
+		
+		/* Connect to svn repository */
+        SVNRepository repository = connect(url);
+        if (repository == null)
+        	return null;
+
+        /* Authentication handling */
+        ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(userName, password);
+    	repository.setAuthenticationManager(authManager);
+        
+        return repository;
+	}
+	
+	/**
+	 * For the given repository evaluates number of code lines
+	 * in files located in <code>path</code>.
+	 * 
+	 * @param repository SVN repository adress
+	 * @param path path to SVN directory
+	 * @return number of code lines
+	 */
+	private static long getCodeLinesNumber(SVNRepository repository, String path) {
+		
+		log.debug("Analyzing " + path + ".");
+		
+		Collection<SVNDirEntry> dirEntries = getDirEntries(repository, path);
+		
+		if (dirEntries == null) {
+			return 0;
+		}
+		
+		long cl = 0;
+		
+		for (SVNDirEntry entry : dirEntries) {
+			
+			String entryPath = (path.equals("")) ?
+						entry.getName() : path + "/" + entry.getName();
+			
+			if (entry.getKind() == SVNNodeKind.FILE) {
+				cl += analyzeFile(repository, entryPath);
+			} else {
+				if (entry.getKind() == SVNNodeKind.DIR) {
+					cl += getCodeLinesNumber(repository, entryPath);
+				}
+			}
+		
+		}
+        
+        return cl;
+	}
+
+	/**
+	 * Evaluates number of code lines in a single file.
+	 * 
+	 * @param repository SVN repository adress
+	 * @param filePath path to the file to analyze
+	 * @return number of code lines
+	 */
+	private static long analyzeFile(SVNRepository repository, String filePath) {
+
+		long cl = 0;
+		
+		/* Get file */
+		Map<String,String> fileProperties = new HashMap<String,String>();
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		
+        try {
+            repository.getFile(filePath, -1, fileProperties, baos);
+        } catch (SVNException svne) {
+        	log.warn("Error while fetching the file properties: " +
+        			repository.getLocation().toString() + "/" + filePath +
+        			"\nCause:" + svne.getMessage());
+            return 0;
+        }
+        
+		/* Get file type */
+        String mimeType = (String) fileProperties.get(SVNProperty.MIME_TYPE);
+        boolean isTextType = SVNProperty.isTextMimeType(mimeType);
+ 
+        /* Count number of lines */
+        if (isTextType) {
+            cl = estimateCodeLinesNumber(baos.toString());
+        }
+        
+        return cl;
+	}
+
+	public static long estimateCodeLinesNumber(String string) {
+		
+		return string.split("\n").length;
+	}
+
+	/**
+	 * Returns SVN directory entries.
+	 * 
+	 * @param repository SVN repository adress
+	 * @param path SVN directory path
+	 * @return Collection of directory entries
+	 */
+	@SuppressWarnings("unchecked")
+	private static Collection<SVNDirEntry> getDirEntries(SVNRepository repository, String path) {
+		
+        Map fileProperties = new HashMap();
+        Collection<SVNDirEntry> dirEntries = null;
+        
+        try {
+			dirEntries = repository.getDir(path, -1, fileProperties, (Collection) null);
+		} catch (SVNException e) {
+			log.warn("Error fetching directory entries:" +
+					repository.getLocation().toString() + "/" + path +
+					"\nCause: " + e.getMessage());
+		} 
+		
+		return dirEntries;
+	}
+	
+	/**
+	 * For the given repository evaluates number of code lines
+	 * added during last <code>days</days> days in files located
+	 * in <code>path</code>.
+	 * 
+	 * @param repository SVN repository adress
+	 * @param path path to SVN directory
+	 * @param days
+	 * @return number of added code lines
+	 */
+	private static long getAddedCodeLines(SVNRepository repository,
+									String path, int days) {
+		
+		Calendar cal = Calendar.getInstance();
+		cal.add(Calendar.DAY_OF_MONTH, -days);
+		Date prevDate = cal.getTime();
+		
+		SVNRevision fromRev = SVNRevision.create(prevDate);
+		
+		long ret = 0;
+		
+		try {
+			ret = getAddedCodeLines(repository, path,
+											fromRev, SVNRevision.HEAD);
+		} catch (SVNException e) {
+			log.warn("Failed to evaluate added code lines." +
+									"\nCause: " + e.getMessage());
+		}
+		
+		return ret;
+	}
+	
+	/**
+	 * For the given repository evaluates number of code lines
+	 * added from <code>fromRev</code> revision to <code>toRev</code> revision
+	 * in <code>path</code>.
+	 * 
+	 * @param repository SVN repository adress
+	 * @param path path to SVN directory
+	 * @param fromRev
+	 * @param toRev
+	 * @return number of added code lines
+	 * @throws SVNException 
+	 */
+	private static long getAddedCodeLines(SVNRepository repository,
+									String path, SVNRevision fromRev,
+												 SVNRevision toRev)
+														throws SVNException {
+		long cl = 0;
+			
+		OutputStream baos = new ByteArrayOutputStream();
+			
+		ISVNAuthenticationManager authManager =
+						SVNWCUtil.createDefaultAuthenticationManager();
+			
+		SVNDiffClient diffClient = new SVNDiffClient(authManager,null);
+			
+		diffClient.doDiff(repository.getLocation(),
+						  SVNRevision.HEAD,
+						  fromRev,
+						  toRev,
+						  true,
+						  true,
+						  baos);
+			
+		String diffString = baos.toString();
+			
+		cl = getAddedLinesNumber(diffString);	
+        
+        return cl;
+	}
+
+	
+	/**
+	 * Computes number of added lines from string in "svn diff" format
+	 * 
+	 * @param diffString String in "svn diff" format
+	 * @return Number of added lines. Notice it might be below 0.
+	 */
+	private static long getAddedLinesNumber(String diffString) {
+		
+		long cl = 0;
+		
+		String[] lines = diffString.split("\n");
+		
+		for (String line : lines) {
+			
+			if (line.startsWith("+")) cl++;
+			if (line.startsWith("-")) cl--;
+		}
+		
+		return cl;
+	}
+	
+	/**
+	 * Establishes connection with SVN repository.
+	 * 
+	 * @param url SVN repository adress
+	 * @return SVN repository
+	 */
+	private static SVNRepository connect(String url) {
+		
+		SVNRepository repository = null;
+	    try {
+	    	repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url));
+	    } catch (SVNException svne) {
+	       	log.warn("Can not connect to the svn repository: " + url +
+	       			"\nCause: " + svne.getMessage());
+	        return null;
+	    }
+	    
+		return repository;
+	}		
+	
+	/**
+     * Initializes the library to work with a repository either via svn:// 
+     * (and svn+ssh://) or via http:// (and https://)
+     */
+    private static void setupLibrary() {
+        DAVRepositoryFactory.setup(); 	  /* for DAV (over http and https) */
+        SVNRepositoryFactoryImpl.setup(); /* for SVN (over svn and svn+ssh) */
+    }
+
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/CodeLinesPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/CodeLinesPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/CodeLinesPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,89 @@
+/*
+ * 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.codelines;
+
+import java.util.List;
+
+import org.jboss.forge.common.projects.project.Repository;
+import org.jboss.forge.jmm.common.protocol.conf.Plugin;
+import org.jboss.forge.jmm.common.tools.ProjectTools;
+import org.jboss.logging.Logger;
+
+/**
+* @author Pawel Wrzeszcz
+* Subclass for Plugin dealing with number of lines of code in project svn repository.
+*/
+
+public abstract class CodeLinesPlugin extends Plugin {
+	
+	/**
+	 * Subclass of <code>CodeLinesPlugin</code> should implement here
+	 * computing value specyfic to the plugin.
+	 * 
+	 * @param url SVN repository adress
+	 * @param userName user's name used in authorisation 
+	 * @param password user's password used in authorisation
+	 * @return value specyfit to the plugin
+	 */
+	protected abstract long getPluginValue(String url, String userName, String password); 
+	
+	protected static Logger log;
+	
+	public CodeLinesPlugin() {
+		super();
+		
+		log = Logger.getLogger(this.getClass());
+	}
+	
+	@Override
+	public long getPluginValue(String projectId) {
+			
+		long cl = 0;
+			
+		List<Repository> repoList = ProjectTools.getProjectSVNRepositories(projectId);
+			
+		if (repoList == null) {
+				
+			return 0;
+		}
+			
+		for (Repository repository : repoList) {
+				
+			cl += analyze(repository.getValue());
+		}
+		
+	
+		return cl;
+	}
+
+	private long analyze(String url) {
+		
+		log.info("Analyzing repository " + url); 
+		
+		long cl = getPluginValue(url, null, null);
+		
+		log.info("Score: " + cl);
+		
+		return cl;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/CodeLinesTotalPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/CodeLinesTotalPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/CodeLinesTotalPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.codelines;
+
+import org.jboss.logging.Logger;
+import org.tmatesoft.svn.core.SVNException;
+
+/**
+* @author Pawel Wrzeszcz
+* Plugin returns total number of lines of code in project svn repository.
+*/
+
+public class CodeLinesTotalPlugin extends CodeLinesPlugin {
+	
+	protected static Logger log = Logger.getLogger(CodeLinesTotalPlugin.class);
+	
+	@Override
+	protected long getPluginValue(String url, String userName, String password) {
+		
+		if ((userName != null) && (password != null)) {
+			return CodeLinesEvaluator.getCodeLinesNumber(url, userName, password);
+		}
+		
+		long cl = 0;
+		
+		try {
+			cl = CodeLinesEvaluator.getCodeLinesNumberFast(url);
+		} catch (SVNException e) {
+			
+			log.warn("Unable to evaluate number of code lines. URL: " + url
+											+ "\nCause: " + e.getMessage());
+			log.debug("Error: ", e);
+		}
+		
+		return cl;
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/SlowCodeLinesTotalPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/SlowCodeLinesTotalPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/codelines/SlowCodeLinesTotalPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.codelines;
+
+/**
+* @author Pawel Wrzeszcz
+* Plugin returns total number of lines of code in project svn repository.
+*/
+
+public class SlowCodeLinesTotalPlugin extends CodeLinesPlugin {
+
+	@Override
+	protected long getPluginValue(String url, String userName, String password) {
+		
+		if ((userName != null) && (password != null)) {
+			return CodeLinesEvaluator.getCodeLinesNumber(url, userName, password);
+		}
+		
+		return CodeLinesEvaluator.getCodeLinesNumber(url);
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/jira/ClosedIssuesPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/jira/ClosedIssuesPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/jira/ClosedIssuesPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/jira/JiraPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/jira/JiraPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/jira/JiraPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/jira/OpenIssuesPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/jira/OpenIssuesPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/jira/OpenIssuesPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/jira/ResolvedIssuesPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/jira/ResolvedIssuesPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/jira/ResolvedIssuesPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/AddPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/AddPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/AddPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.math;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz [at] jboss . com)
+*/
+
+public class AddPlugin extends MathPlugin {
+
+	@Override
+	public long getPluginValue(String projectId) {
+		
+		long v1 = plugin1.getValue(projectId);
+		long v2 = plugin2.getValue(projectId);		
+		
+		return (v1 + v2);
+		
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/ConstPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/ConstPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/ConstPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.math;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.jboss.forge.jmm.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.jmm.common.protocol.ScoresManager;
+import org.jboss.forge.jmm.common.protocol.conf.Plugin;
+import org.jboss.forge.jmm.common.tools.Plugins;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz [at] jboss . com)
+*/
+
+public class ConstPlugin extends Plugin {
+
+	private long value;
+	
+	@Override
+	public void init(String id, String portalName, List<String> projectIds,
+		   Plugins plugins, Properties properties, ScoresManager scoresManager)
+								throws InvalidPluginPropertiesException {
+		
+		if ((properties == null) || (!properties.contains("value")) ){
+			throw new InvalidPluginPropertiesException(
+										"Missing plugin property.");		
+		}
+		
+		String valueString = properties.getProperty("value");
+			
+		value = Long.parseLong(valueString);
+		
+		super.init(id, portalName, projectIds, plugins,
+												properties, scoresManager);
+	}	
+	
+	@Override
+	public long getPluginValue(String projectId) {
+		
+		return value;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/DivPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/DivPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/DivPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.math;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz [at] jboss . com)
+*/
+
+public class DivPlugin extends MathPlugin {
+
+	@Override
+	public long getPluginValue(String projectId) {
+		
+		long v2 = plugin2.getValue(projectId);
+		
+		if (v2 == 0) {
+			return 0;
+		}
+		
+		long v1 = plugin1.getValue(projectId);
+		
+		return (v1 / v2);
+		
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/LastNDaysPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/LastNDaysPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/LastNDaysPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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.protocol.conf.Plugin;
+import org.jboss.forge.jmm.common.tools.Plugins;
+
+/**
+* @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);
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/MathPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/MathPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/MathPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.math;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.jboss.forge.jmm.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.jmm.common.protocol.ScoresManager;
+import org.jboss.forge.jmm.common.protocol.conf.Plugin;
+import org.jboss.forge.jmm.common.tools.Plugins;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz [at] jboss . com)
+*/
+
+public abstract class MathPlugin extends Plugin {
+	
+	protected Plugin plugin1;
+	protected Plugin plugin2;
+	
+	@Override
+	public void init(String id, String portalName, List<String> projectIds,
+		   Plugins plugins, Properties properties, ScoresManager scoresManager)
+								throws InvalidPluginPropertiesException {
+		
+		if (properties == null) {
+			throw new InvalidPluginPropertiesException(
+										"Missing plugin properties.");		
+		}
+		
+		String plugin1Id = properties.getProperty("plugin1");
+		String plugin2Id = properties.getProperty("plugin2");
+	
+		if ((plugin1Id == null) || (plugin2Id == null)) {
+			throw new InvalidPluginPropertiesException(
+										"Invalid plugin properties.");
+		}	
+		
+		plugin1 = plugins.get(plugin1Id);
+		plugin2 = plugins.get(plugin2Id);
+		
+		if ((plugin1 == null) || (plugin2 == null)) {
+			
+			throw new InvalidPluginPropertiesException(
+					"Invalid plugin properties. Plugin " +
+					(plugin1 == null ? plugin1Id : plugin2Id) + 
+					" does not exist.");
+		}
+		
+		super.init(id, portalName, projectIds, plugins,
+												properties, scoresManager);
+	}	
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/MulPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/MulPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/MulPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.math;
+
+/**
+* @author Pawel Wrzeszcz (pawel . wrzeszcz [at] jboss . com)
+*/
+
+public class MulPlugin extends MathPlugin {
+
+	@Override
+	public long getPluginValue(String projectId) {
+		
+		long v1 = plugin1.getValue(projectId);
+		long v2 = plugin2.getValue(projectId);
+		
+		return (v1 * v2);
+		
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/RandomPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/RandomPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/RandomPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.math;
+
+import java.util.List;
+import java.util.Properties;
+import java.util.Random;
+
+import org.jboss.forge.jmm.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.jmm.common.protocol.ScoresManager;
+import org.jboss.forge.jmm.common.protocol.conf.Plugin;
+import org.jboss.forge.jmm.common.tools.Plugins;
+
+/**
+* @author Pawel Wrzeszcz (pawel.wrzeszcz at gmail.com)
+*/
+
+public class RandomPlugin extends Plugin {
+	
+	private int maxValue;
+	private Random random;
+	
+	private static final int RANDOM_DEFAULT_MAX_VALUE = 1024;
+	
+	@Override
+	public void init(String id, String portalName, List<String> projectIds,
+			Plugins plugins, Properties properties, ScoresManager scoresManager)
+								throws InvalidPluginPropertiesException {
+		
+		maxValue = RANDOM_DEFAULT_MAX_VALUE;
+		
+		if ((properties != null) && (properties.containsKey("max-value"))) {
+			maxValue = Integer.parseInt(properties.getProperty("max-value"));
+		}
+		
+		random = new Random();
+		
+		super.init(id, portalName, projectIds, plugins, properties, scoresManager);
+	}
+
+	@Override
+	public long getPluginValue(String projectId) {
+		
+		return random.nextInt(maxValue);
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/WeightedScorePlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/WeightedScorePlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/math/WeightedScorePlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.math;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.jboss.forge.jmm.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.jmm.common.protocol.ScoresManager;
+import org.jboss.forge.jmm.common.protocol.conf.Plugin;
+import org.jboss.forge.jmm.common.tools.Plugins;
+
+/**
+ * This plugin gets weights from xml configuration file
+ * and sumarizes all the stats multiplying them firstly by those weights.
+ * 
+ * @author Ryszard Kozmik
+ * @author Pawel Wrzeszcz (pawel.wrzeszcz at gmail.com)
+ *
+ */
+public class WeightedScorePlugin extends Plugin {
+	
+	private Map<String,Float> properties;
+	
+	public WeightedScorePlugin() {
+		super();
+	}
+	
+	@Override
+	public void init(String id, String portalName, List<String> projectIds,
+			Plugins plugins, Properties props, ScoresManager scoresManager)
+								throws InvalidPluginPropertiesException {
+		
+		super.init(id, portalName, projectIds, plugins, props, scoresManager);
+
+		properties = new Hashtable<String,Float>(props.size());
+		
+		for (Iterator iter = props.keySet().iterator(); iter.hasNext();) {
+			
+			String key = (String) iter.next();
+			
+			try {
+				Float value = Float.parseFloat(props.getProperty(key));
+				properties.put((String) key,value);
+			} catch (NumberFormatException e) {
+				throw new InvalidPluginPropertiesException(
+						"Incorrect weight format in xml descriptor: "
+						+ props.get(key));
+			}
+		}
+	}
+
+	public long getPluginValue(String projectId) {
+		
+		int total = 0;
+		
+		for (String pluginName : plugins.getPluginIds()) {
+			
+			Plugin plugin = plugins.get(pluginName);
+			
+			if (properties.containsKey(pluginName)) {
+				total += plugin.getValue(projectId)*properties.get(pluginName);
+			}
+		}
+		
+		return total; 
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/DownloadsPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/DownloadsPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/DownloadsPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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.productization;
+
+import org.jboss.forge.jmm.common.protocol.conf.Plugin;
+import org.jboss.forge.jmm.common.tools.ProjectTools;
+
+/**
+ * This Plugin returns sum of all downloads for given project id name.
+ * @author Ryszard Kozmik
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz [at] jboss . com)
+ *
+ */
+public class DownloadsPlugin extends Plugin {
+
+	
+	public DownloadsPlugin() {
+		super();
+	}
+		
+	public long getPluginValue(String projectId) {
+		
+		return ProjectTools.getOverallDownloadsForProject(projectId, portalName);
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/JEMSIntegrationPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/JEMSIntegrationPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/JEMSIntegrationPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.productization;
+
+import java.util.List;
+
+import org.jboss.forge.jmm.common.protocol.conf.Plugin;
+import org.jboss.forge.jmm.common.tools.ProjectTools;
+
+/**
+* @author Pawel Wrzeszcz
+*/
+
+public class JEMSIntegrationPlugin extends Plugin {
+
+	@Override
+	public long getPluginValue(String projectId) {
+		
+		List<String> JEMSList = ProjectTools.getProjectJems(projectId);
+		
+		return (JEMSList == null ? 0 : JEMSList.size());
+	}
+	
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/PackagedForDownloadPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/PackagedForDownloadPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/PackagedForDownloadPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.productization;
+
+import org.jboss.forge.jmm.common.protocol.conf.Plugin;
+import org.jboss.forge.jmm.common.tools.ProjectTools;
+
+
+/**
+* @author Pawel Wrzeszcz
+*/
+
+public class PackagedForDownloadPlugin extends Plugin {
+
+	@Override
+	public long getPluginValue(String projectId) {
+		
+		return (ProjectTools.getPackagedForDownload(projectId) ? 1 : 0);
+	}
+	
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/ProductizationPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/ProductizationPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/ProductizationPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,43 @@
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.productization;
+
+import org.jboss.forge.common.projects.project.Project;
+
+import org.jboss.forge.jmm.common.protocol.conf.Plugin;
+import org.jboss.forge.jmm.common.tools.ProjectTools;
+
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ * 
+ * Superclass for plugins providing productization metrics.
+ */
+public abstract class ProductizationPlugin extends Plugin {
+
+	protected Project getProject(String projectId) {
+		
+		return ProjectTools.getProject(projectId);
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/docs/DifferentDocumentationSourcesPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/docs/DifferentDocumentationSourcesPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/docs/DifferentDocumentationSourcesPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,58 @@
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.productization.docs;
+
+import java.util.EnumSet;
+import java.util.List;
+import org.jboss.forge.common.projects.project.Documentation;
+import org.jboss.forge.common.projects.project.DocumentationType;
+
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ * 
+ * Evaluates number of different documentation types available for project.
+ */
+public class DifferentDocumentationSourcesPlugin extends DocumentationPlugin {
+
+	@Override
+	protected long getPluginValue(String projectId) {
+		
+		List<Documentation> docs = getDocumentation(projectId);
+		
+		if (docs == null) {
+			return 0;
+		}
+		
+		EnumSet<DocumentationType> docTypes =
+									EnumSet.noneOf(DocumentationType.class);
+		
+		for (Documentation d : docs) {
+			
+			docTypes.add(d.getType());
+		}
+		
+		return docTypes.size();
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/docs/DocumentationPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/docs/DocumentationPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/docs/DocumentationPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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.productization.docs;
+
+import java.util.List;
+
+import org.jboss.forge.common.projects.project.Documentation;
+import org.jboss.forge.common.projects.project.Project;
+import org.jboss.forge.jmm.service.plugins.productization.ProductizationPlugin;
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ */
+public abstract class DocumentationPlugin extends ProductizationPlugin {
+
+	protected List<Documentation> getDocumentation(String projectId) {
+		
+		Project project = getProject(projectId);
+		
+		if (project == null) {
+			return null;
+		}
+		
+		return project.getDocumentation();
+	}	
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/docs/DocumentationTypePlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/docs/DocumentationTypePlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/docs/DocumentationTypePlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,109 @@
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.productization.docs;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.jboss.forge.common.projects.project.Documentation;
+import org.jboss.forge.common.projects.project.DocumentationType;
+
+import org.jboss.forge.jmm.common.Tags;
+import org.jboss.forge.jmm.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.jmm.common.protocol.ScoresManager;
+import org.jboss.forge.jmm.common.tools.Plugins;
+
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ */
+public class DocumentationTypePlugin extends DocumentationPlugin {
+
+	
+	private DocumentationType docType;
+	
+	@Override
+	public void init(String id, String portalName, List<String> projectIds,
+			Plugins plugins, Properties properties, ScoresManager scoresManager)
+								throws InvalidPluginPropertiesException {
+		
+		if (properties == null) {
+			throw new InvalidPluginPropertiesException(
+												"Missing plugin property.");
+		}
+		
+		String docTypeString = properties.getProperty(Tags.DOC_TYPE_TAG);
+		if (docTypeString == null) {
+			throw new InvalidPluginPropertiesException(
+							"Missing " + Tags.DOC_TYPE_TAG + " property.");
+		}
+		
+		docType = getDocType(docTypeString);
+		if (docType == null) {
+			throw new InvalidPluginPropertiesException(
+						"No such decumentation type: " + docTypeString + ".");
+		}
+				
+		super.init(id, portalName, projectIds, plugins, properties, scoresManager);
+	}
+
+	
+	@Override
+	protected long getPluginValue(String projectId) {
+		
+		List<Documentation> docs = getDocumentation(projectId);
+		
+		if (docs == null) {
+			return 0;
+		}
+		
+		int counter = 0;
+		
+		for (Documentation d : docs) {
+			
+			if (d.getType().equals(docType)) {
+				counter++;
+			}
+		}
+		
+		return counter;
+	}
+
+
+	private DocumentationType getDocType(String docTypeString) {
+		
+		DocumentationType docType = null;
+		
+		try {
+		
+			docType = DocumentationType.fromValue(docTypeString);
+			
+		} catch (IllegalArgumentException e) {
+			
+			// Do nothing
+		}
+		
+		return docType;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/forums/DifferentForumsPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/forums/DifferentForumsPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/forums/DifferentForumsPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,57 @@
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.productization.forums;
+
+import java.util.EnumSet;
+import java.util.List;
+
+import org.jboss.forge.common.projects.project.Forum;
+import org.jboss.forge.common.projects.project.ForumType;
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ * 
+ * Evaluates number of different forum types available for project.
+ */
+public class DifferentForumsPlugin extends ForumsPlugin {
+
+	@Override
+	protected long getPluginValue(String projectId) {
+		
+		List<Forum> forums = getForums(projectId);
+		
+		if (forums == null) {
+			return 0;
+		}
+		
+		EnumSet<ForumType> forumTypes = EnumSet.noneOf(ForumType.class);
+		
+		for (Forum f : forums) {
+			
+			forumTypes.add(f.getType());
+		}
+		
+		return forumTypes.size();
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/forums/ForumTypePlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/forums/ForumTypePlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/forums/ForumTypePlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,108 @@
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.productization.forums;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.jboss.forge.common.projects.project.Forum;
+import org.jboss.forge.common.projects.project.ForumType;
+import org.jboss.forge.jmm.common.Tags;
+import org.jboss.forge.jmm.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.jmm.common.protocol.ScoresManager;
+import org.jboss.forge.jmm.common.tools.Plugins;
+
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ */
+public class ForumTypePlugin extends ForumsPlugin {
+
+	
+	private ForumType forumType;
+	
+	@Override
+	public void init(String id, String portalName, List<String> projectIds,
+			Plugins plugins, Properties properties, ScoresManager scoresManager)
+								throws InvalidPluginPropertiesException {
+		
+		if (properties == null) {
+			throw new InvalidPluginPropertiesException(
+												"Missing plugin property.");
+		}
+		
+		String forumTypeString = properties.getProperty(Tags.FORUM_TYPE_TAG);
+		if (forumTypeString == null) {
+			throw new InvalidPluginPropertiesException(
+							"Missing " + Tags.FORUM_TYPE_TAG + " property.");
+		}
+		
+		forumType = getForumType(forumTypeString);
+		if (forumType == null) {
+			throw new InvalidPluginPropertiesException(
+							"No such forum type: " + forumTypeString + ".");
+		}
+				
+		super.init(id, portalName, projectIds, plugins, properties, scoresManager);
+	}
+
+	
+	@Override
+	protected long getPluginValue(String projectId) {
+		
+		List<Forum> forums = getForums(projectId);
+		
+		if (forums == null) {
+			return 0;
+		}
+		
+		int counter = 0;
+		
+		for (Forum f : forums) {
+			
+			if (f.getType().equals(forumType)) {
+				counter++;
+			}
+		}
+		
+		return counter;
+	}
+
+
+	private ForumType getForumType(String forumTypeString) {
+		
+		ForumType forumType = null;
+		
+		try {
+		
+			forumType = ForumType.fromValue(forumTypeString);
+			
+		} catch (IllegalArgumentException e) {
+			
+			// Do nothing
+		}
+		
+		return forumType;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/forums/ForumsPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/forums/ForumsPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/forums/ForumsPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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.productization.forums;
+
+import java.util.List;
+
+import org.jboss.forge.common.projects.project.Forum;
+import org.jboss.forge.common.projects.project.Project;
+import org.jboss.forge.jmm.service.plugins.productization.ProductizationPlugin;
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ */
+public abstract class ForumsPlugin extends ProductizationPlugin {
+
+	protected List<Forum> getForums(String projectId) {
+		
+		Project project = getProject(projectId);
+		
+		if (project == null) {
+			return null;
+		}
+		
+		return project.getForums();
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/support/DifferentSupportServicesPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/support/DifferentSupportServicesPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/support/DifferentSupportServicesPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,57 @@
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.productization.support;
+
+import java.util.EnumSet;
+import java.util.List;
+
+import org.jboss.forge.common.projects.project.SupportService;
+import org.jboss.forge.common.projects.project.SupportType;
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ * 
+ * Evaluates number of different support service types available for project.
+ */
+public class DifferentSupportServicesPlugin extends SupportServicesPlugin {
+
+	@Override
+	protected long getPluginValue(String projectId) {
+		
+		List<SupportService> supportServices = getSupportServices(projectId);
+		
+		if (supportServices == null) {
+			return 0;
+		}
+		
+		EnumSet<SupportType> supportTypes = EnumSet.noneOf(SupportType.class);
+		
+		for (SupportService s : supportServices) {
+			
+			supportTypes.add(s.getType());
+		}
+		
+		return supportTypes.size();
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/support/SupportServicesPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/support/SupportServicesPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/support/SupportServicesPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,48 @@
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.productization.support;
+
+import java.util.List;
+
+import org.jboss.forge.common.projects.project.Project;
+import org.jboss.forge.common.projects.project.SupportService;
+
+import org.jboss.forge.jmm.service.plugins.productization.ProductizationPlugin;
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ */
+public abstract class SupportServicesPlugin extends ProductizationPlugin {
+
+	protected List<SupportService> getSupportServices(String projectId) {
+		
+		Project project = getProject(projectId);
+		
+		if (project == null) {
+			return null;
+		}
+		
+		return project.getSupportServices();
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/support/SupportTypePlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/support/SupportTypePlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/productization/support/SupportTypePlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,109 @@
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.forge.jmm.service.plugins.productization.support;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.jboss.forge.common.projects.project.SupportService;
+import org.jboss.forge.common.projects.project.SupportType;
+
+import org.jboss.forge.jmm.common.Tags;
+import org.jboss.forge.jmm.common.exceptions.InvalidPluginPropertiesException;
+import org.jboss.forge.jmm.common.protocol.ScoresManager;
+import org.jboss.forge.jmm.common.tools.Plugins;
+
+
+/**
+ * @author Pawel Wrzeszcz (pawel . wrzeszcz @ jboss . com)
+ */
+public class SupportTypePlugin extends SupportServicesPlugin {
+
+	
+	private SupportType supportType;
+	
+	@Override
+	public void init(String id, String portalName, List<String> projectIds,
+			Plugins plugins, Properties properties, ScoresManager scoresManager)
+								throws InvalidPluginPropertiesException {
+		
+		if (properties == null) {
+			throw new InvalidPluginPropertiesException(
+												"Missing plugin property.");
+		}
+		
+		String supportTypeString = properties.getProperty(Tags.SUPPORT_TYPE_TAG);
+		if (supportTypeString == null) {
+			throw new InvalidPluginPropertiesException(
+							"Missing " + Tags.SUPPORT_TYPE_TAG + " property.");
+		}
+		
+		supportType = getSupportType(supportTypeString);
+		if (supportType == null) {
+			throw new InvalidPluginPropertiesException(
+							"No such support type: " + supportTypeString + ".");
+		}
+				
+		super.init(id, portalName, projectIds, plugins, properties, scoresManager);
+	}
+
+	
+	@Override
+	protected long getPluginValue(String projectId) {
+		
+		List<SupportService> supportServices = getSupportServices(projectId);
+		
+		if (supportServices == null) {
+			return 0;
+		}
+		
+		int counter = 0;
+		
+		for (SupportService s : supportServices) {
+			
+			if (s.getType().equals(supportType)) {
+				counter++;
+			}
+		}
+		
+		return counter;
+	}
+
+
+	private SupportType getSupportType(String supportTypeString) {
+		
+		SupportType supportType = null;
+		
+		try {
+		
+			supportType = SupportType.fromValue(supportTypeString);
+			
+		} catch (IllegalArgumentException e) {
+			
+			// Do nothing
+		}
+		
+		return supportType;
+	}
+}

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast31DaysPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast31DaysPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast31DaysPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast7DaysPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast7DaysPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsLast7DaysPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTodayPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTodayPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTodayPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTotalPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTotalPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/CommitsTotalPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/RevisionPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/RevisionPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/RevisionPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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

Added: labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/SvnPlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/SvnPlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/SvnPlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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.getProjectSVNRepositories(projectId);
+		
+		if ((repoList == null) || (repoList.size() == 0)) {
+			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/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/TotalRepoSizePlugin.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/TotalRepoSizePlugin.java	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/jmm-service/src/java/org/jboss/forge/jmm/service/plugins/svn/TotalRepoSizePlugin.java	2006-12-14 23:36:27 UTC (rev 8335)
@@ -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

Added: labs/jbosslabs/trunk/portal-extensions/jmm/maven.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/maven.xml	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/maven.xml	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,53 @@
+<!-- 
+  JBoss, the OpenSource J2EE webOS
+  Distributable under LGPL license.
+  See terms of license at gnu.org. 
+ -->
+<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:u="jelly:util" xmlns:maven="jelly:maven">
+	<!-- Default war-project goals -->
+
+	<goal name="all">
+		<attainGoal name="build" />
+		<attainGoal name="deploy" />
+	</goal>
+
+	<goal name="build">
+		<maven:reactor includes="jmm-common/project.xml" excludes="" basedir="." 
+			       banner="Building" 
+			       goals="clean,build" ignoreFailures="false" />
+		<maven:reactor includes="jmm-portlet/project.xml" excludes="" basedir="." 
+			       banner="Building" 
+			       goals="clean,build" ignoreFailures="false" />
+		<maven:reactor includes="jmm-service/project.xml" excludes="" basedir="." 
+			       banner="Building" 
+			       goals="clean,build" ignoreFailures="false" />
+	</goal>
+    
+	<goal name="deploy">
+		<maven:reactor includes="jmm-common/project.xml" excludes="" basedir="." 
+			       banner="jmm-common.jar" 
+			       goals="deploy" ignoreFailures="false" />
+		<maven:reactor includes="jmm-portlet/project.xml" excludes="" basedir="." 
+			       banner="portlet" 
+			       goals="deploy" ignoreFailures="false" />
+<!--		<maven:reactor includes="jmm-service/project.xml" excludes="" basedir="." 
+			       banner="service" 
+			       goals="deploy" ignoreFailures="false" />	 -->
+	</goal>
+	
+	<goal name="clean"/>
+
+	<!--  helper goals -->
+
+	<goal name="module-clean">
+		<ant:delete dir="${maven.build.dir}"/>
+		<ant:delete dir="${maven.build.dest}"/>
+	</goal>
+	
+	<goal name="module-all">
+		<attainGoal name="clean" />	
+		<attainGoal name="build" />
+		<attainGoal name="deploy" />
+	</goal>
+	
+</project>

Added: labs/jbosslabs/trunk/portal-extensions/jmm/project.properties
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/project.properties	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/project.properties	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,16 @@
+maven.repo.remote=http://repository.atlassian.com,http://www.ibiblio.org/maven,http://dist.codehaus.org/
+maven.junit.fork=yes
+maven.war.src=${basedir}/src/web
+
+#maven.ejb.includes=**/service/**,**/META-INF/**
+#maven.jar.excludes=**/JMMPortlet.class,**/service/**,**/persistence.xml
+#maven.war.classes.includes=**/JMMPortlet.class
+#**/service/impl/db/protocol/*
+
+maven.ejb.includes=**/service/**,**/META-INF/**
+maven.jar.includes=**/common/**
+maven.war.classes.includes=**/portlet/**
+
+jmm.service.final.name=jmm-service.ejb3
+jmm.common.final.name=jmm-common.jar
+jmm.service.sar=jmm-service.sar/
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/jmm/project.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jmm/project.xml	2006-12-14 23:11:47 UTC (rev 8334)
+++ labs/jbosslabs/trunk/portal-extensions/jmm/project.xml	2006-12-14 23:36:27 UTC (rev 8335)
@@ -0,0 +1,142 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+<!-- 
+  JBoss, the OpenSource J2EE webOS
+  Distributable under LGPL license.
+  See terms of license at gnu.org. 
+ -->
+<project>
+    <pomVersion>3</pomVersion>
+    <extend>../common.xml</extend>
+    <id>jmm-common</id>
+    <name>JEMS Maturity Matrix Common Library</name>
+    <currentVersion>1.0</currentVersion>
+    <organization>
+        <name>Pawel Wrzeszcz</name>
+        <url></url>
+    </organization>
+    <description></description>
+    
+    <dependencies>
+    
+	<dependency>
+	    <groupId>jboss-forge</groupId>
+	    <artifactId>forge-common</artifactId>
+	    <version>1.0</version>
+	    <properties>
+                <ejb.manifest.classpath>true</ejb.manifest.classpath>
+				<war.manifest.classpath>true</war.manifest.classpath>
+        </properties>
+	</dependency>
+<!--
+	<dependency>
+	    <groupId>jboss-forge</groupId>
+	    <artifactId>status-common</artifactId>
+	    <jar>status-common.jar</jar>
+	    <properties>
+                <ejb.manifest.classpath>true</ejb.manifest.classpath>
+                <war.manifest.classpath>true</war.manifest.classpath>
+            </properties>
+	</dependency>
+-->
+	<dependency>
+	    <groupId>aslibs</groupId>
+	    <artifactId>javax.servlet</artifactId>
+	    <version>1.0</version>
+	    <jar>javax.servlet.jar</jar>
+	</dependency>
+
+  	<dependency>
+		<id>jdom</id>
+		<version>1.0</version>
+		<properties>
+			<war.bundle>true</war.bundle>
+		</properties>
+	</dependency>
+	
+	<dependency>
+	    <groupId>tmate</groupId>
+	    <artifactId>javasvn</artifactId>
+	    <version>1.0</version>
+	    <jar>javasvn.jar</jar>
+	    <properties>
+			<war.bundle>true</war.bundle>
+			<ejb.manifest.classpath>true</ejb.manifest.classpath>
+	    </properties>
+	</dependency>
+	
+	<dependency>
+		<groupId>kosmos</groupId>
+		<artifactId>kosmos</artifactId>
+		<jar>kosmos-server.jar</jar>
+		<version>1.0</version>
+		<properties>
+			<war.bundle>true</war.bundle>
+			<ejb.manifest.classpath>true</ejb.manifest.classpath>
+			<war.manifest.classpath>true</war.manifest.classpath>
+		</properties>
+	</dependency>
+
+    <dependency>
+        <groupId>hessian</groupId>
+        <artifactId>hessian</artifactId>
+        <version>3.0.1</version> 
+	<jar>hessian-3.0.13.jar</jar>
+        <properties>
+		    	<war.bundle>true</war.bundle>
+            <war.manifest.classpath>true</war.manifest.classpath>
+            <ejb.manifest.classpath>true</ejb.manifest.classpath>
+        </properties>
+    </dependency>
+
+	<dependency>
+	    <groupId>shotoku</groupId>
+	    <artifactId>shotoku-base</artifactId>
+	    <version>1.0</version>
+	    <jar>shotoku-base.jar</jar>
+            <properties>
+                <ejb.manifest.classpath>true</ejb.manifest.classpath>
+                <war.manifest.classpath>true</war.manifest.classpath>
+            </properties>
+	</dependency>
+
+  <!-- JBoss EJB3 dependencies -->
+
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>ejb3-persistence</artifactId>
+		<version>3.0RC6</version>
+		<jar>ejb3-persistence.jar</jar>
+	</dependency>
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>jboss-ejb3x</artifactId>
+		<version>3.0RC6</version>
+		<jar>jboss-ejb3x.jar</jar>
+        </dependency>
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>jboss-j2ee</artifactId>
+		<version></version>
+		<jar>jboss-j2ee.jar</jar>
+        </dependency>
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>jboss-annotations-ejb3</artifactId>
+		<version></version>
+		<jar>jboss-annotations-ejb3.jar</jar>
+        </dependency>
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>jbossall-client</artifactId>
+		<version>3.2.3</version>
+        </dependency>
+
+	<dependency>
+		<groupId>jaxb</groupId>
+		<artifactId>JAXB2</artifactId>
+		<version>2.0</version>
+		<jar>jaxb-api.jar</jar>
+        </dependency>
+	   
+    </dependencies>
+</project>




More information about the jboss-svn-commits mailing list