From: <jbo...@li...> - 2005-12-19 11:35:17
|
Author: unibrew Date: 2005-12-19 06:35:11 -0500 (Mon, 19 Dec 2005) New Revision: 1860 Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/DownloadsPlugin.java Log: [JBLAB-577] Adding DownloadsPlugin. Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/DownloadsPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/DownloadsPlugin.java 2005-12-19 11:33:59 UTC (rev 1859) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/DownloadsPlugin.java 2005-12-19 11:35:11 UTC (rev 1860) @@ -0,0 +1,48 @@ + +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.forge.status.plugins; + +import org.jboss.forge.common.projects.DownloadCounterTools; +import org.jboss.shotoku.ContentManager; +import org.jboss.shotoku.aop.Inject; + +/** + * This Plugin returns sum of all downloads for given project id name. + * @author Ryszard Kozmik + * + */ +public class DownloadsPlugin extends StatusPlugin { + + @Inject + ContentManager cm; + + public DownloadsPlugin() { + super(); + } + + public int getValue(String projectId) { + return (int)DownloadCounterTools.getOverallDownloadsForProject(projectId,"default",cm); + } + +} |