[jboss-svn-commits] JBL Code SVN: r7811 - in labs/jbosslabs/trunk/portal-extensions: forge-common/src/java/org/jboss/forge/common forge-jmm forge-jmm/src/app/META-INF forge-jmm/src/java/org/jboss/forge/jmm/common/tools forge-jmm/src/java/org/jboss/forge/jmm/portlet forge-jmm/src/web/WEB-INF portal-default/src/web/WEB-INF

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Nov 24 10:55:34 EST 2006


Author: wrzep
Date: 2006-11-24 10:55:17 -0500 (Fri, 24 Nov 2006)
New Revision: 7811

Added:
   labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMM.java
   labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMConfWatcher.java
   labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMDescriptor.java
   labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMPortlet.java
Removed:
   labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/Status.java
   labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/StatusConfWatcher.java
   labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/StatusDescriptor.java
   labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/StatusPortlet.java
Modified:
   labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ForgeHelper.java
   labs/jbosslabs/trunk/portal-extensions/forge-jmm/maven.xml
   labs/jbosslabs/trunk/portal-extensions/forge-jmm/project.properties
   labs/jbosslabs/trunk/portal-extensions/forge-jmm/project.xml
   labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/app/META-INF/jboss-service.xml
   labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/common/tools/Tools.java
   labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/web/WEB-INF/jboss-app.xml
   labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/web/WEB-INF/portlet-instances.xml
   labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/web/WEB-INF/portlet.xml
   labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/web/WEB-INF/web.xml
   labs/jbosslabs/trunk/portal-extensions/portal-default/src/web/WEB-INF/default-object.xml
Log:
JBLAB-599
"status" -> "jmm"

Pawel


Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ForgeHelper.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ForgeHelper.java	2006-11-24 15:51:30 UTC (rev 7810)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ForgeHelper.java	2006-11-24 15:55:17 UTC (rev 7811)
@@ -391,7 +391,7 @@
 	 * @return A link to the JMM project page.
 	 */
 	public static String createJMMLink(String portalName, String projectId) {
-		return "/portal/portal/" + portalName + "/status/StatusPortletWindowDefaultStatus?"
+		return "/portal/portal/" + portalName + "/jmm/StatusPortletWindowDefaultStatus?"
 				+ "action=2&action=viewProjectDetails&id=" + projectId;
 		//TODO links like "jmm/projectId" would be appreciated
 	}

Modified: labs/jbosslabs/trunk/portal-extensions/forge-jmm/maven.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/maven.xml	2006-11-24 15:51:30 UTC (rev 7810)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/maven.xml	2006-11-24 15:55:17 UTC (rev 7811)
@@ -18,24 +18,29 @@
 		<attainGoal name="prj-war-build" />
 
 		<attainGoal name="ejb" />
-		<ant:move tofile="target/${status.service.final.name}" file="target/${maven.final.name}.jar" />
+		<ant:move tofile="target/${jmm.service.final.name}" file="target/${maven.final.name}.jar" />
 
 		<attainGoal name="jar" />
-		<ant:move tofile="target/${status.common.final.name}" file="target/${maven.final.name}.jar" />
+		<ant:move tofile="target/${jmm.common.final.name}" file="target/${maven.final.name}.jar" />
 		
-		<ant:copy toDir="${maven.repo.local}/jboss-common/jars/" file="target/${status.common.final.name}" overwrite="true">
+		<ant:copy toDir="${maven.repo.local}/jboss-common/jars/" file="target/${jmm.common.final.name}" overwrite="true">
         </ant:copy>
 
 	</goal>
     
 	<goal name="deploy">	
 		<attainGoal name="prj-war-deploy" />
-		<ant:copy todir="${local.deploy.dir}" file="target/${status.common.final.name}" />
-		<ant:copy todir="${local.deploy.dir}" file="target/${status.service.final.name}" />
+		<ant:copy todir="${local.deploy.dir}" file="target/${jmm.common.final.name}" />
+		<ant:copy todir="${local.deploy.dir}" file="target/${jmm.service.final.name}" />
 	</goal>
 	
 	<goal name="clean">
 		<attainGoal name="prj-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" />
 	</goal>
 
 	<!-- TODO separate dir&conf for JMM sevice -->
@@ -47,7 +52,7 @@
 	</goal>
 
 	<goal name="service-build">
-	  	<ant:copy todir="target/${jmm.service.sar}" file="target/${status.common.final.name}" />
+	  	<ant:copy todir="target/${jmm.service.sar}" file="target/${jmm.common.final.name}" />
 
 		<ant:copy todir="target/${jmm.service.sar}">
 		       <ant:fileset dir="src/app" flatten="true" overwrite="true">
@@ -57,8 +62,8 @@
 	</goal>
 
 	<goal name="service-deploy">
-	        <ant:delete file="${local.deploy.dir}/${status.service.final.name}" />
-        	<ant:copy todir="${jmm.service.deploy.dir}" file="target/${status.service.final.name}" />
+	        <ant:delete file="${local.deploy.dir}/${jmm.service.final.name}" />
+        	<ant:copy todir="${jmm.service.deploy.dir}" file="target/${jmm.service.final.name}" />
 
 		<ant:copy todir="${jmm.service.deploy.dir}">
 		    <ant:fileset dir="target/" flatten="true" overwrite="true">
@@ -71,7 +76,7 @@
 
 	<goal name="service-clean">
 	  	<ant:delete dir="${jmm.service.deploy.dir}/${jmm.service.sar}" />
-		<ant:delete file="${jmm.service.deploy.dir}/${status.service.final.name}" />
+		<ant:delete file="${jmm.service.deploy.dir}/${jmm.service.final.name}" />
 		<ant:delete file="${jmm.service.deploy.dir}/forge-common-1.0.jar" />
 	</goal>
 

Modified: labs/jbosslabs/trunk/portal-extensions/forge-jmm/project.properties
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/project.properties	2006-11-24 15:51:30 UTC (rev 7810)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/project.properties	2006-11-24 15:55:17 UTC (rev 7811)
@@ -3,10 +3,10 @@
 maven.war.src=${basedir}/src/web
 
 maven.ejb.includes=**/service/**,**/META-INF/**
-maven.jar.excludes=**/StatusPortlet.class,**/service/**,**/persistence.xml
-maven.war.classes.includes=**/StatusPortlet.class
+maven.jar.excludes=**/JMMPortlet.class,**/service/**,**/persistence.xml
+maven.war.classes.includes=**/JMMPortlet.class
 #**/service/impl/db/protocol/*
 
-status.service.final.name=status-service.ejb3
-status.common.final.name=status-common.jar
+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

Modified: labs/jbosslabs/trunk/portal-extensions/forge-jmm/project.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/project.xml	2006-11-24 15:51:30 UTC (rev 7810)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/project.xml	2006-11-24 15:55:17 UTC (rev 7811)
@@ -7,8 +7,8 @@
 <project>
     <pomVersion>3</pomVersion>
     <extend>../common.xml</extend>
-    <id>forge-status</id>
-    <name>Dashboard status portlet</name>
+    <id>forge-jmm</id>
+    <name>JEMS Maturity Matrix</name>
     <currentVersion>1.0</currentVersion>
     <organization>
         <name>Pawel Wrzeszcz</name>

Modified: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/app/META-INF/jboss-service.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/app/META-INF/jboss-service.xml	2006-11-24 15:51:30 UTC (rev 7810)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/app/META-INF/jboss-service.xml	2006-11-24 15:55:17 UTC (rev 7811)
@@ -1,7 +1,7 @@
  <!-- 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.xxml -->
+      <!-- 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>
@@ -10,7 +10,7 @@
       <!-- Invoke invoke(Invocation mi) operation instead of the target method -->
       <attribute name="InvokeTargetMethod">false</attribute>
       <!-- MyService interface -->
-      <attribute name="ExportedInterfaces">org.jboss.forge.status.common.protocol.ScoresService</attribute>
+      <attribute name="ExportedInterfaces">org.jboss.forge.jmm.common.protocol.ScoresService</attribute>
       <attribute name="ClientInterceptors">
           <interceptors>
              <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>

Modified: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/common/tools/Tools.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/common/tools/Tools.java	2006-11-24 15:51:30 UTC (rev 7810)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/common/tools/Tools.java	2006-11-24 15:55:17 UTC (rev 7811)
@@ -28,8 +28,8 @@
 import org.jboss.forge.jmm.common.protocol.ScoresService;
 import org.jboss.forge.jmm.common.protocol.conf.PluginConf;
 import org.jboss.forge.jmm.common.protocol.conf.ScoresUpdater;
-import org.jboss.forge.jmm.portlet.StatusConfWatcher;
-import org.jboss.forge.jmm.portlet.StatusDescriptor;
+import org.jboss.forge.jmm.portlet.JMMConfWatcher;
+import org.jboss.forge.jmm.portlet.JMMDescriptor;
 import org.jboss.forge.jmm.portlet.conf.PluginConfImpl;
 
 import org.jboss.logging.Logger;
@@ -50,11 +50,11 @@
 public class Tools {
 	
 	@CacheItem(interval=Constants.CACHE_INTERVAL)
-	private static StatusConfWatcher conf;
+	private static JMMConfWatcher conf;
 	
 	private static Logger log = Logger.getLogger(Tools.class);
 	
-	public static synchronized StatusDescriptor getDesc(final String portalName) {
+	public static synchronized JMMDescriptor getDesc(final String portalName) {
 		
 		return conf.get(portalName);
 	}

Added: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMM.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMM.java	2006-11-24 15:51:30 UTC (rev 7810)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMM.java	2006-11-24 15:55:17 UTC (rev 7811)
@@ -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 statusRoot Node with Matrix properites
+	 * @param scoresManager
+	 */
+	public JMM(String portalName, Node statusRoot,
+											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(statusRoot,
+									Tags.MAIN_PAGE_COLUMNS_TAG);
+		mainPageColumns = new Columns(mainPageRoot, projects);
+		
+		// Get matrix to display on the project page
+		Node projectPageRoot =
+				XmlTools.getFirstNodeWithName(statusRoot,
+									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/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMConfWatcher.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMConfWatcher.java	2006-11-24 15:51:30 UTC (rev 7810)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMConfWatcher.java	2006-11-24 15:55:17 UTC (rev 7811)
@@ -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.getXmlStatusPluginsCmPath(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/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMDescriptor.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMDescriptor.java	2006-11-24 15:51:30 UTC (rev 7810)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMDescriptor.java	2006-11-24 15:55:17 UTC (rev 7811)
@@ -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.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.tools.Tools;
+
+import org.jboss.forge.jmm.portlet.conf.ConfgurationImpl;
+import org.jboss.forge.jmm.portlet.conf.ServiceScoresManager;
+
+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 status;
+	
+	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 StatusDescriptor.", e);
+		}
+		
+	}
+
+	private void initStatus() {
+				
+		try {
+			
+			String statusPath = Locations.getXmlCmPath(portalName);
+			Node statusRoot = Tools.getRoot(cm , statusPath);
+			
+			//String pluginsPath = Locations.
+			//							getXmlStatusPluginsCmPath(portalName);
+							
+			status = new JMM(portalName, statusRoot, scoresManager);
+			
+		} catch (Exception e) {
+			
+			log.warn("Initialization failed.", e);
+		} 
+	}
+
+	private void fillContext() {
+		
+		if (status != null) {
+			
+			context = new DelegateContext();
+			status.fillContext(context);
+			
+			projectContexts = status.getProjectContexts();
+			columnContexts = status.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 (status == null) {
+			initStatus();
+		}
+		
+		status.update();
+		
+		fillContext();
+	}
+	
+}

Added: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMPortlet.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMPortlet.java	2006-11-24 15:51:30 UTC (rev 7810)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/JMMPortlet.java	2006-11-24 15:55:17 UTC (rev 7811)
@@ -0,0 +1,87 @@
+ /*
+  * 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.forge.jmm.common.tools.Tools;
+
+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 = Tools.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);
+	
+    }
+}

Deleted: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/Status.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/Status.java	2006-11-24 15:51:30 UTC (rev 7810)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/Status.java	2006-11-24 15:55:17 UTC (rev 7811)
@@ -1,220 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.forge.jmm.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 Status {
-
-	/** 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 statusRoot Node with Matrix properites
-	 * @param scoresManager
-	 */
-	public Status(String portalName, Node statusRoot,
-											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(statusRoot,
-									Tags.MAIN_PAGE_COLUMNS_TAG);
-		mainPageColumns = new Columns(mainPageRoot, projects);
-		
-		// Get matrix to display on the project page
-		Node projectPageRoot =
-				XmlTools.getFirstNodeWithName(statusRoot,
-									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

Deleted: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/StatusConfWatcher.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/StatusConfWatcher.java	2006-11-24 15:51:30 UTC (rev 7810)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/StatusConfWatcher.java	2006-11-24 15:55:17 UTC (rev 7811)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.forge.jmm.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 StatusConfWatcher extends
-							ShotokuResourceWatcher<String, StatusDescriptor> {
-	
-	public StatusConfWatcher(long interval) {
-		super(interval);
-	}
-	
-	private StatusDescriptor getDesc(String portalName) {
-		return new StatusDescriptor(portalName, getContentManager(portalName));
-	}
-	
-	@Override
-	public StatusDescriptor init(String key) {
-		
-		String portalName = key;
-		
-		addWatchedPath(key, Locations.getXmlCmPath(portalName));
-		addWatchedPath(key, Locations.getXmlStatusPluginsCmPath(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, StatusDescriptor currentObject,
-											Map<String, ChangeType> changes) {
-		
-		put(key, getDesc(key));
-	}
-	
-	@Override
-	/* Called to check if updated scores are available. */
-	public void update(String key, StatusDescriptor desc) {
-		
-		desc.update();
-	}
-}

Deleted: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/StatusDescriptor.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/StatusDescriptor.java	2006-11-24 15:51:30 UTC (rev 7810)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/java/org/jboss/forge/jmm/portlet/StatusDescriptor.java	2006-11-24 15:55:17 UTC (rev 7811)
@@ -1,147 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-
-package org.jboss.forge.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.tools.Tools;
-
-import org.jboss.forge.jmm.portlet.conf.ConfgurationImpl;
-import org.jboss.forge.jmm.portlet.conf.ServiceScoresManager;
-
-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 StatusDescriptor {
-	
-	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 Status status;
-	
-	private Logger log = Logger.getLogger(StatusDescriptor.class);
-	
-	
-	public StatusDescriptor(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 StatusDescriptor.", e);
-		}
-		
-	}
-
-	private void initStatus() {
-				
-		try {
-			
-			String statusPath = Locations.getXmlCmPath(portalName);
-			Node statusRoot = Tools.getRoot(cm , statusPath);
-			
-			//String pluginsPath = Locations.
-			//							getXmlStatusPluginsCmPath(portalName);
-							
-			status = new Status(portalName, statusRoot, scoresManager);
-			
-		} catch (Exception e) {
-			
-			log.warn("Initialization failed.", e);
-		} 
-	}
-
-	private void fillContext() {
-		
-		if (status != null) {
-			
-			context = new DelegateContext();
-			status.fillContext(context);
-			
-			projectContexts = status.getProjectContexts();
-			columnContexts = status.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 (status == null) {
-			initStatus();
-		}
-		
-		status.update();
-		
-		fillContext();
-	}
-	
-}

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

Modified: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/web/WEB-INF/jboss-app.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/web/WEB-INF/jboss-app.xml	2006-11-24 15:51:30 UTC (rev 7810)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/web/WEB-INF/jboss-app.xml	2006-11-24 15:55:17 UTC (rev 7811)
@@ -1,7 +1,7 @@
 <jboss-app>
-    <app-name>status</app-name>
+    <app-name>jmm</app-name>
     <loader-repository>
-      status:service=scores
+      jmm:service=scores
     </loader-repository>
 </jboss-app>
 

Modified: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/web/WEB-INF/portlet-instances.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/web/WEB-INF/portlet-instances.xml	2006-11-24 15:51:30 UTC (rev 7810)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/web/WEB-INF/portlet-instances.xml	2006-11-24 15:55:17 UTC (rev 7811)
@@ -3,8 +3,8 @@
    <deployment>
       <if-exists>overwrite</if-exists>
       <instance>
-         <instance-id>StatusPortletInstance</instance-id>
-         <portlet-ref>StatusPortlet</portlet-ref>
+         <instance-id>JMMPortletInstance</instance-id>
+         <portlet-ref>JMMPortlet</portlet-ref>
       </instance>
    </deployment>
 </deployments>
\ No newline at end of file

Modified: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/web/WEB-INF/portlet.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/web/WEB-INF/portlet.xml	2006-11-24 15:51:30 UTC (rev 7810)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/web/WEB-INF/portlet.xml	2006-11-24 15:55:17 UTC (rev 7811)
@@ -3,16 +3,16 @@
 	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>Status Portlet</description>
-    	    <portlet-name>StatusPortlet</portlet-name>
-    	    <display-name>Status</display-name>
-            <portlet-class>org.jboss.forge.status.portlet.StatusPortlet</portlet-class>
+	    <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>Status</title>
+		<title>JMM</title>
 	    </portlet-info>
 	</portlet>
  </portlet-app>

Modified: labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/web/WEB-INF/web.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/web/WEB-INF/web.xml	2006-11-24 15:51:30 UTC (rev 7810)
+++ labs/jbosslabs/trunk/portal-extensions/forge-jmm/src/web/WEB-INF/web.xml	2006-11-24 15:55:17 UTC (rev 7811)
@@ -13,23 +13,4 @@
 		<url-pattern>/repo-access/*</url-pattern>
 		<dispatcher>INCLUDE</dispatcher>
 	</filter-mapping>
-	<!--
-	<servlet>
-	   <servlet-name>jmm-service</servlet-name>
-	   <servlet-class>com.caucho.hessian.server.HessianServlet</servlet-class>
-    	   <init-param>
-	      <param-name>home-class</param-name>
-    	  	  <param-value>org.jboss.forge.status.service.impl.ScoresServiceImpl</param-value>
-	   </init-param>
-    	  <init-param>
-      	  <param-name>home-api</param-name>
-      	  <param-value>org.jboss.forge.status.common.protocol.ScoresService</param-value>
-    </init-param>
-  </servlet>
-
-  <servlet-mapping>
-    <url-pattern>/jmm-service</url-pattern>
-    <servlet-name>jmm-service</servlet-name>
-  </servlet-mapping>
--->
 </web-app>
\ No newline at end of file

Modified: labs/jbosslabs/trunk/portal-extensions/portal-default/src/web/WEB-INF/default-object.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/portal-default/src/web/WEB-INF/default-object.xml	2006-11-24 15:51:30 UTC (rev 7810)
+++ labs/jbosslabs/trunk/portal-extensions/portal-default/src/web/WEB-INF/default-object.xml	2006-11-24 15:55:17 UTC (rev 7811)
@@ -459,22 +459,22 @@
 		<if-exists>overwrite</if-exists>
 		<parent-ref>default</parent-ref>
 		<page>
-			<page-name>status</page-name>
+			<page-name>jmm</page-name>
 			<window>
-				<window-name>NavigationPortletWindowDefaultStatus</window-name>
+				<window-name>NavigationPortletWindowDefaultJMM</window-name>
 				<instance-ref>LabsNavigationPortletInstance</instance-ref>
 				<region>left</region>
 				<height>0</height>
 			</window>
 			<window>
-				<window-name>AdsPortletWindowDefaultStatus</window-name>
+				<window-name>AdsPortletWindowDefaultJMM</window-name>
 				<instance-ref>AdsPortletInstance</instance-ref>
 				<region>left</region>
 				<height>2</height>
 			</window>
 			<window>
-				<window-name>StatusPortletWindowDefaultStatus</window-name>
-				<instance-ref>StatusPortletInstance</instance-ref>
+				<window-name>JMMPortletWindowDefaultJMM</window-name>
+				<instance-ref>JMMPortletInstance</instance-ref>
 				<region>center</region>
 				<height>0</height>
 			</window>




More information about the jboss-svn-commits mailing list