You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(233) |
Sep
(199) |
Oct
(206) |
Nov
(185) |
Dec
(270) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(232) |
Feb
(426) |
Mar
(623) |
Apr
(592) |
May
(506) |
Jun
(389) |
Jul
(160) |
Aug
(3) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
(5) |
2007 |
Jan
(1) |
Feb
(1) |
Mar
(2) |
Apr
(2) |
May
(4) |
Jun
(2) |
Jul
|
Aug
(3) |
Sep
(5) |
Oct
(9) |
Nov
(6) |
Dec
(6) |
2008 |
Jan
(3) |
Feb
|
Mar
(1) |
Apr
(3) |
May
(3) |
Jun
(5) |
Jul
(10) |
Aug
(2) |
Sep
(12) |
Oct
(10) |
Nov
(54) |
Dec
(49) |
2009 |
Jan
(19) |
Feb
(13) |
Mar
(20) |
Apr
(24) |
May
(44) |
Jun
(29) |
Jul
(32) |
Aug
(10) |
Sep
(7) |
Oct
(10) |
Nov
(4) |
Dec
(17) |
2010 |
Jan
(14) |
Feb
(5) |
Mar
(23) |
Apr
(50) |
May
(31) |
Jun
(9) |
Jul
(5) |
Aug
(4) |
Sep
(7) |
Oct
(5) |
Nov
(2) |
Dec
(3) |
2011 |
Jan
(12) |
Feb
(5) |
Mar
(5) |
Apr
(3) |
May
(4) |
Jun
(3) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2012 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(4) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2015 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
Author: unibrew Date: 2005-11-20 14:17:16 -0500 (Sun, 20 Nov 2005) New Revision: 1609 Added: trunk/forge/portal-extensions/polls/ trunk/forge/portal-extensions/polls/.project trunk/forge/portal-extensions/polls/maven.xml trunk/forge/portal-extensions/polls/project.properties trunk/forge/portal-extensions/polls/project.xml trunk/forge/portal-extensions/polls/src/ trunk/forge/portal-extensions/polls/src/java/ trunk/forge/portal-extensions/polls/src/java/org/ trunk/forge/portal-extensions/polls/src/java/org/jboss/ trunk/forge/portal-extensions/polls/src/java/org/jboss/forge/ trunk/forge/portal-extensions/polls/src/java/org/jboss/forge/polls/ trunk/forge/portal-extensions/polls/src/java/org/jboss/forge/polls/PollsPortlet.java Log: [JBLAB-407] Project folder Added: trunk/forge/portal-extensions/polls/.project =================================================================== --- trunk/forge/portal-extensions/polls/.project 2005-11-20 15:39:09 UTC (rev 1608) +++ trunk/forge/portal-extensions/polls/.project 2005-11-20 19:17:16 UTC (rev 1609) @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<projectDescription> + <name>polls-portlet</name> + <comment> + </comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> \ No newline at end of file Added: trunk/forge/portal-extensions/polls/maven.xml =================================================================== --- trunk/forge/portal-extensions/polls/maven.xml 2005-11-20 15:39:09 UTC (rev 1608) +++ trunk/forge/portal-extensions/polls/maven.xml 2005-11-20 19:17:16 UTC (rev 1609) @@ -0,0 +1,24 @@ +<!-- + 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="prj-all" /> + </goal> + + <goal name="build"> + <attainGoal name="prj-war-build" /> + </goal> + + <goal name="deploy"> + <attainGoal name="prj-war-deploy" /> + </goal> + + <goal name="clean"> + <attainGoal name="prj-clean" /> + </goal> +</project> Added: trunk/forge/portal-extensions/polls/project.properties =================================================================== --- trunk/forge/portal-extensions/polls/project.properties 2005-11-20 15:39:09 UTC (rev 1608) +++ trunk/forge/portal-extensions/polls/project.properties 2005-11-20 19:17:16 UTC (rev 1609) @@ -0,0 +1,3 @@ +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 Added: trunk/forge/portal-extensions/polls/project.xml =================================================================== --- trunk/forge/portal-extensions/polls/project.xml 2005-11-20 15:39:09 UTC (rev 1608) +++ trunk/forge/portal-extensions/polls/project.xml 2005-11-20 19:17:16 UTC (rev 1609) @@ -0,0 +1,88 @@ +<?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>polls-portlet</id> + <name>Polls portlet</name> + <currentVersion>1.0</currentVersion> + <organization> + <name>Ryszard Kozmik and JBoss Labs team</name> + <url>http://mamut.net.pl and http://www.jboss.org</url> + </organization> + <description></description> + + <dependencies> + <dependency> + <groupId>tmate</groupId> + <artifactId>javasvn</artifactId> + <version>1.0</version> + <jar>javasvn.jar</jar> + </dependency> + + <dependency> + <groupId>tmate</groupId> + <artifactId>jsch</artifactId> + <version>1.0</version> + <jar>jsch.jar</jar> + </dependency> + + <dependency> + <groupId>jboss-forge</groupId> + <artifactId>forge-common</artifactId> + <version>1.0</version> + </dependency> + + <dependency> + <groupId>taglibs</groupId> + <artifactId>jstl</artifactId> + <version>1.0</version> + <jar>jstl.jar</jar> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + + <dependency> + <groupId>taglibs</groupId> + <artifactId>standard</artifactId> + <version>1.0</version> + <jar>standard.jar</jar> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + + <dependency> + <groupId>xerces</groupId> + <artifactId>xercesImpl</artifactId> + <version>2.6.2</version> + </dependency> + + <dependency> + <groupId>xerces</groupId> + <artifactId>xmlParserAPIs</artifactId> + <version>2.6.2</version> + </dependency> + + <dependency> + <groupId>xalan</groupId> + <artifactId>xalan</artifactId> + <version>2.6.0</version> + </dependency> + + <dependency> + <id>rome</id> + <version>0.5</version> + </dependency> + + <dependency> + <id>jdom</id> + <version>1.0</version> + </dependency> + </dependencies> +</project> Added: trunk/forge/portal-extensions/polls/src/java/org/jboss/forge/polls/PollsPortlet.java =================================================================== --- trunk/forge/portal-extensions/polls/src/java/org/jboss/forge/polls/PollsPortlet.java 2005-11-20 15:39:09 UTC (rev 1608) +++ trunk/forge/portal-extensions/polls/src/java/org/jboss/forge/polls/PollsPortlet.java 2005-11-20 19:17:16 UTC (rev 1609) @@ -0,0 +1,74 @@ +package org.jboss.forge.polls; + +import java.io.IOException; + +import javax.portlet.PortletException; +import javax.portlet.PortletRequestDispatcher; +import javax.portlet.PortletSession; + +import org.jboss.forge.common.ForgeHelper; +import org.jboss.forge.common.projects.PollTools; +import org.jboss.forge.common.projects.ProjectsHelper; +import org.jboss.portal.common.context.Context; +import org.jboss.portal.common.context.DelegateContext; +import org.jboss.portal.core.model.User; +import org.jboss.portal.core.servlet.jsp.PortalJsp; +import org.jboss.portlet.JBossPortlet; +import org.jboss.portlet.JBossRenderRequest; +import org.jboss.portlet.JBossRenderResponse; +import org.jboss.shotoku.ContentManager; +import org.jboss.shotoku.aop.Inject; + +public class PollsPortlet extends JBossPortlet { + + public static final String VOTED_PARAMETER_NAME = "org.jboss.forge.polls.voted"; + public static final String VOTED_FALSE = "false"; + public static final String VOTED_TRUE = "true"; + + @Inject + ContentManager contentManager; + + public void doView(JBossRenderRequest request, JBossRenderResponse response) + throws IOException, PortletException { + response.setContentType("text/html"); + + String portalName = ForgeHelper.getPortalName(request); + + // Getting name of the project on which the download counter is used. + String projectId = ProjectsHelper.getSelectedProjectId(request); + + ProjectsHelper.prepareRequest(request); + PortletSession session = request.getPortletSession(false); + User user = request.getUser(); + if (user!=null) { + String userName = user.getUserName(); + System.out.println ("USERNAME: "+userName); + } else { + System.out.println ("USER IS NULL"); + } + String voted = request.getParameter(VOTED_PARAMETER_NAME); + Context pollContext=null; + PortletRequestDispatcher rd = null; + if (voted!=null && voted.compareTo(VOTED_TRUE)==0) { + // Getting the poll context. + pollContext = PollTools.getInfoContext(portalName,projectId,contentManager,response); + rd = getPortletContext().getRequestDispatcher( + ForgeHelper.createRepoAccessPath(portalName, PollTools + .getInfoJsp())); + + } else { +// Getting the poll context. + pollContext = PollTools.getVotingContext(portalName,projectId,contentManager,response); + rd = getPortletContext().getRequestDispatcher( + ForgeHelper.createRepoAccessPath(portalName, PollTools + .getVotingJsp())); + } + // Displaying. + request.setAttribute(PortalJsp.CTX_REQUEST, pollContext); + + + + + rd.include(request, response); + } +} |
From: <jbo...@li...> - 2005-11-20 15:39:23
|
Author: aron.gombas Date: 2005-11-20 10:39:09 -0500 (Sun, 20 Nov 2005) New Revision: 1608 Modified: trunk/labs/kosmos/xdocs/reference/reference-manual.xml Log: Serverside locale setting added to the manual Modified: trunk/labs/kosmos/xdocs/reference/reference-manual.xml =================================================================== --- trunk/labs/kosmos/xdocs/reference/reference-manual.xml 2005-11-20 15:21:25 UTC (rev 1607) +++ trunk/labs/kosmos/xdocs/reference/reference-manual.xml 2005-11-20 15:39:09 UTC (rev 1608) @@ -1538,29 +1538,60 @@ <title>I18n</title> - <para>The server component is completely locale-agnostic, you - don't have to do anything there.</para> + <para>Setting the preferred language for the whole application is a + two-step process: + + <itemizedlist> - <para> + <listitem> + <para> + For the server component, you have to set the context parameter + called <literal>locale</literal> in its <filename>web.xml</filename>: + <programlisting><context-param> + <param-name>locale</param-name> + <param-value><emphasis>en</emphasis></param-value> +</context-param></programlisting> + This setting will affect mostly the labels on the chart images, + as these are the only resources generated by the server component + that are language-dependent. + </para> + </listitem> - Setting the preferred locale is simply a change in the - <filename>web.xml</filename> - of the portlet module. You just have to change the - context-param which configures the JSTL library: - <programlisting><context-param> + <listitem> + <para> + For the portlets, you have to set the context parameter + which configures the JSTL library in the portlet module + <filename>web.xml</filename>: + <programlisting><context-param> <param-name>javax.servlet.jsp.jstl.fmt.locale</param-name> <param-value><emphasis>en</emphasis></param-value> </context-param></programlisting> - This parameter accepts the standard Java locale signs as value, + This setting will specify the language for the whole + web-based user interface. + </para> + </listitem> + + </itemizedlist> + </para> + <para> + Both these parameters accept the standard Java locale signs as value, but please make sure that the property file of the selected language is available in your distribution. At the moment, the - supported locales are: English ( - <literal>en</literal> - ) and Hungarian ( - <literal>hu</literal> - ). + supported locales are: English (<literal>en</literal> + ) and Hungarian (<literal>hu</literal>). </para> - + + <para> + For advanced users: as you see, one server supports only one language + set, which is absolutely sufficient in most of the cases. A + multi-language server would require a more complicated caching + mechanism (some parts of the content are language-independent thus + could be shared between client requests with different locale + settings, while others are not), which is necessary only in some + infrequent environments. As workaround, for two languages you can + launch two separate Kosmos servers with different language settings. + </para> + </section> </chapter> |
From: <jbo...@li...> - 2005-11-20 15:21:46
|
Author: aron.gombas Date: 2005-11-20 10:21:25 -0500 (Sun, 20 Nov 2005) New Revision: 1607 Modified: trunk/labs/kosmos/web-portlet/pages/cc_monitoring.jsp trunk/labs/kosmos/web-portlet/pages/svn_monitoring_activity_details.jsp trunk/labs/kosmos/web-portlet/pages/svn_monitoring_repository_details.jsp Log: Decimanl formatting for numeric values Modified: trunk/labs/kosmos/web-portlet/pages/cc_monitoring.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/cc_monitoring.jsp 2005-11-20 15:20:04 UTC (rev 1606) +++ trunk/labs/kosmos/web-portlet/pages/cc_monitoring.jsp 2005-11-20 15:21:25 UTC (rev 1607) @@ -21,7 +21,7 @@ <display:column titleKey="ccproject.name" property="name" sortable="true"/> <display:column titleKey="ccproject.lastBuildLabel" sortProperty="buildLabel" sortable="true"> <c:out value="${projectsIt.buildLabel}"/> - (<c:out value="${projectsIt.modifications}"/> <fmt:message key="ccproject.modifications"/>) + (<fmt:formatNumber value="${projectsIt.modifications}"/> <fmt:message key="ccproject.modifications"/>) </display:column> <display:column titleKey="ccproject.status" sortProperty="status" sortable="true"> <c:choose> Modified: trunk/labs/kosmos/web-portlet/pages/svn_monitoring_activity_details.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/svn_monitoring_activity_details.jsp 2005-11-20 15:20:04 UTC (rev 1606) +++ trunk/labs/kosmos/web-portlet/pages/svn_monitoring_activity_details.jsp 2005-11-20 15:21:25 UTC (rev 1607) @@ -6,27 +6,27 @@ <table> <tr class="portlet-section-body"> <td><fmt:message key="svnrepository.commitsToday"/>:</td> - <td><c:out value="${repository.commitsToday}"/></td> + <td><fmt:formatNumber value="${repository.commitsToday}"/></td> <td><fmt:message key="svnrepository.committersToday"/>:</td> - <td><c:out value="${repository.committersToday}"/></td> + <td><fmt:formatNumber value="${repository.committersToday}"/></td> </tr> <tr class="portlet-section-alternate"> <td><fmt:message key="svnrepository.commitsLast7Days"/>:</td> - <td><c:out value="${repository.commitsLast7Days}"/></td> + <td><fmt:formatNumber value="${repository.commitsLast7Days}"/></td> <td><fmt:message key="svnrepository.committersLast7Days"/>:</td> - <td><c:out value="${repository.committersLast7Days}"/></td> + <td><fmt:formatNumber value="${repository.committersLast7Days}"/></td> </tr> <tr class="portlet-section-body"> <td><fmt:message key="svnrepository.commitsLast31Days"/>:</td> - <td><c:out value="${repository.commitsLast31Days}"/></td> + <td><fmt:formatNumber value="${repository.commitsLast31Days}"/></td> <td><fmt:message key="svnrepository.committersLast31Days"/>:</td> - <td><c:out value="${repository.committersLast31Days}"/></td> + <td><fmt:formatNumber value="${repository.committersLast31Days}"/></td> </tr> <tr class="portlet-section-alternate"> <td><fmt:message key="svnrepository.commitsTotal"/>:</td> - <td><c:out value="${repository.commitsTotal}"/></td> + <td><fmt:formatNumber value="${repository.commitsTotal}"/></td> <td><fmt:message key="svnrepository.committersTotal"/>:</td> - <td><c:out value="${repository.committersTotal}"/></td> + <td><fmt:formatNumber value="${repository.committersTotal}"/></td> </tr> <tr class="portlet-section-body"> <td valign="top"><fmt:message key="svnrepository.commitHistory"/>:</td> Modified: trunk/labs/kosmos/web-portlet/pages/svn_monitoring_repository_details.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/svn_monitoring_repository_details.jsp 2005-11-20 15:20:04 UTC (rev 1606) +++ trunk/labs/kosmos/web-portlet/pages/svn_monitoring_repository_details.jsp 2005-11-20 15:21:25 UTC (rev 1607) @@ -6,15 +6,15 @@ <table> <tr class="portlet-section-body"> <td><fmt:message key="svnrepository.dirs"/>:</td> - <td><c:out value="${repository.dirs}"/></td> + <td><fmt:formatNumber value="${repository.dirs}"/></td> </tr> <tr class="portlet-section-alternate"> <td><fmt:message key="svnrepository.files"/>:</td> - <td><c:out value="${repository.files}"/></td> + <td><fmt:formatNumber value="${repository.files}"/></td> </tr> <tr class="portlet-section-body"> <td><fmt:message key="svnrepository.totalRepositoryEntries"/>:</td> - <td><c:out value="${repository.dirs + repository.files}"/></td> + <td><fmt:formatNumber value="${repository.dirs + repository.files}"/></td> </tr> <tr class="portlet-section-alternate"> <td><fmt:message key="svnrepository.totalFileSize"/>:</td> |
Author: aron.gombas Date: 2005-11-20 10:20:04 -0500 (Sun, 20 Nov 2005) New Revision: 1606 Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/AbstractKosmosService.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraServiceImpl.java trunk/labs/kosmos/web-portlet/WEB-INF/portlet.xml Log: Cached res bundle in the server Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/AbstractKosmosService.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/AbstractKosmosService.java 2005-11-20 14:25:24 UTC (rev 1605) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/AbstractKosmosService.java 2005-11-20 15:20:04 UTC (rev 1606) @@ -44,7 +44,10 @@ /** The timestamp when the cache was most recently updated. */ private Date timestamp; - /** Pluggable cached data store implementation. */ + /** Localized resources. */ + private ResourceBundle resources = null; + + /** Pluggable cached data store implementation. */ private CachedDataStore store; public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { @@ -100,18 +103,20 @@ return value; } - /** TODO */ - protected String getResourcexxx(String baseName, String key) {// TODO rename - ResourceBundle res = null; - - // TODO lazy-init - if(res == null) { + /** + * Returns the localized string resource from the given resource bundle. + * For caching, it assumes that only one bundle is used per service. + * The locale is defined globally for the servlet, not as method parameter. + */ + protected String getResourceString(String baseName, String key) { + // lazy-init the bundle + if(resources == null) { String locale = ctx.getServletContext().getInitParameter("locale"); - log.info(" =======================================> locale: " + locale); - res = StringUtils.isBlank(locale) ? ResourceBundle.getBundle(baseName) : ResourceBundle.getBundle(baseName, new Locale(locale)); + log.info(String.format("Loading resources \"%s\" for locale \"%s\"...", baseName, locale)); + resources = StringUtils.isBlank(locale) ? ResourceBundle.getBundle(baseName) : ResourceBundle.getBundle(baseName, new Locale(locale)); } - return res.getString(key); + return resources.getString(key); } /** Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java 2005-11-20 14:25:24 UTC (rev 1605) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java 2005-11-20 15:20:04 UTC (rev 1606) @@ -134,11 +134,11 @@ List<Map.Entry<ColorCodedKey, Integer>> testsPerCategory = new ArrayList<Map.Entry<ColorCodedKey, Integer>>(); int success = tests - errors - failures; if(success > 0) - testsPerCategory.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.cc.cc_monitoring", "ccproject.testsSucceded"), CcConstants.SUCCESS_COLOR), success).entrySet()); + testsPerCategory.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.cc.cc_monitoring", "ccproject.testsSucceded"), CcConstants.SUCCESS_COLOR), success).entrySet()); if(failures > 0) - testsPerCategory.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.cc.cc_monitoring", "ccproject.failures"), CcConstants.FAILURE_COLOR), failures).entrySet()); + testsPerCategory.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.cc.cc_monitoring", "ccproject.failures"), CcConstants.FAILURE_COLOR), failures).entrySet()); if(errors > 0) - testsPerCategory.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.cc.cc_monitoring", "ccproject.errors"), CcConstants.ERROR_COLOR), errors).entrySet()); + testsPerCategory.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.cc.cc_monitoring", "ccproject.errors"), CcConstants.ERROR_COLOR), errors).entrySet()); ByteArrayOutputStream out = new ByteArrayOutputStream(); ChartUtils.writeChartAsPng(ChartUtils.generateColorCodedPieChart(ChartUtils.collectionToPieDataset(testsPerCategory)), out); Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraServiceImpl.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraServiceImpl.java 2005-11-20 14:25:24 UTC (rev 1605) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraServiceImpl.java 2005-11-20 15:20:04 UTC (rev 1606) @@ -224,15 +224,15 @@ // generate issues-per-status chart List<Map.Entry<ColorCodedKey, Integer>> issuesPerStatusMap = new ArrayList<Map.Entry<ColorCodedKey, Integer>>(); if(openIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.openIssues"), JiraConstants.OPEN_COLOR), openIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.openIssues"), JiraConstants.OPEN_COLOR), openIssues).entrySet()); if(codingInProgressIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.codingInProgressIssues"), JiraConstants.CODING_IN_PROGRESS_COLOR), codingInProgressIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.codingInProgressIssues"), JiraConstants.CODING_IN_PROGRESS_COLOR), codingInProgressIssues).entrySet()); if(reopenedIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.reopenedIssues"), JiraConstants.REOPENED_COLOR), reopenedIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.reopenedIssues"), JiraConstants.REOPENED_COLOR), reopenedIssues).entrySet()); if(resolvedIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.resolvedIssues"), JiraConstants.RESOLVED_COLOR), resolvedIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.resolvedIssues"), JiraConstants.RESOLVED_COLOR), resolvedIssues).entrySet()); if(closedIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.closedIssues"), JiraConstants.CLOSED_COLOR), closedIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.closedIssues"), JiraConstants.CLOSED_COLOR), closedIssues).entrySet()); out.reset(); ChartUtils.writeChartAsPng(ChartUtils.generateColorCodedPieChart(ChartUtils.collectionToPieDataset(issuesPerStatusMap)), out); @@ -241,17 +241,17 @@ // generate issues-per-priority chart List<Map.Entry<ColorCodedKey, Integer>> openIssuesPerPriorityMap = new ArrayList<Map.Entry<ColorCodedKey, Integer>>(); if(blockerOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.blockerOpenIssues"), JiraConstants.BLOCKER_COLOR), blockerOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.blockerOpenIssues"), JiraConstants.BLOCKER_COLOR), blockerOpenIssues).entrySet()); if(criticalOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.criticalOpenIssues"), JiraConstants.CRITICAL_COLOR), criticalOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.criticalOpenIssues"), JiraConstants.CRITICAL_COLOR), criticalOpenIssues).entrySet()); if(majorOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.majorOpenIssues"), JiraConstants.MAJOR_COLOR), majorOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.majorOpenIssues"), JiraConstants.MAJOR_COLOR), majorOpenIssues).entrySet()); if(minorOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.minorOpenIssues"), JiraConstants.MINOR_COLOR), minorOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.minorOpenIssues"), JiraConstants.MINOR_COLOR), minorOpenIssues).entrySet()); if(trivialOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.trivialOpenIssues"), JiraConstants.TRIVIAL_COLOR), trivialOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.trivialOpenIssues"), JiraConstants.TRIVIAL_COLOR), trivialOpenIssues).entrySet()); if(optionalOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.optionalOpenIssues"), JiraConstants.OPTIONAL_COLOR), optionalOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.optionalOpenIssues"), JiraConstants.OPTIONAL_COLOR), optionalOpenIssues).entrySet()); out.reset(); ChartUtils.writeChartAsPng(ChartUtils.generateColorCodedPieChart(ChartUtils.collectionToPieDataset(openIssuesPerPriorityMap)), out); Modified: trunk/labs/kosmos/web-portlet/WEB-INF/portlet.xml =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/portlet.xml 2005-11-20 14:25:24 UTC (rev 1605) +++ trunk/labs/kosmos/web-portlet/WEB-INF/portlet.xml 2005-11-20 15:20:04 UTC (rev 1606) @@ -41,7 +41,7 @@ </supports> <supported-locale>en</supported-locale> <supported-locale>hu</supported-locale> - <resource-bundle>hu.midori.kosmos.portlet.cc.ccmonitoringportlet</resource-bundle> + <resource-bundle>hu.midori.kosmos.portlet.cc.cc_monitoring</resource-bundle> <portlet-info> <title>CruiseControl Monitoring</title> </portlet-info> @@ -80,7 +80,7 @@ </supports> <supported-locale>en</supported-locale> <supported-locale>hu</supported-locale> - <resource-bundle>hu.midori.kosmos.portlet.jira.jiramonitoringportlet</resource-bundle> + <resource-bundle>hu.midori.kosmos.portlet.jira.jira_monitoring</resource-bundle> <portlet-info> <title>JIRA Monitoring</title> </portlet-info> @@ -122,7 +122,7 @@ </supports> <supported-locale>en</supported-locale> <supported-locale>hu</supported-locale> - <resource-bundle>hu.midori.kosmos.portlet.jira.jiramonitoringportlet</resource-bundle> + <resource-bundle>hu.midori.kosmos.portlet.jira.jira_monitoring</resource-bundle> <portlet-info> <title>JIRA Monitoring</title> </portlet-info> @@ -184,7 +184,7 @@ </supports> <supported-locale>en</supported-locale> <supported-locale>hu</supported-locale> - <resource-bundle>hu.midori.kosmos.portlet.jira.jiramonitoringportlet</resource-bundle> + <resource-bundle>hu.midori.kosmos.portlet.jira.jira_monitoring</resource-bundle> <portlet-info> <title>JIRA Monitoring</title> </portlet-info> @@ -219,7 +219,7 @@ </supports> <supported-locale>en</supported-locale> <supported-locale>hu</supported-locale> - <resource-bundle>hu.midori.kosmos.portlet.sf.sfmonitoringportlet</resource-bundle> + <resource-bundle>hu.midori.kosmos.portlet.sf.sf_monitoring</resource-bundle> <portlet-info> <title>SourceForge Monitoring</title> </portlet-info> @@ -249,7 +249,7 @@ </supports> <supported-locale>en</supported-locale> <supported-locale>hu</supported-locale> - <resource-bundle>hu.midori.kosmos.portlet.sf.sfmonitoringportlet</resource-bundle> + <resource-bundle>hu.midori.kosmos.portlet.sf.sf_monitoring</resource-bundle> <portlet-info> <title>SourceForge Monitoring</title> </portlet-info> @@ -280,7 +280,7 @@ </supports> <supported-locale>en</supported-locale> <supported-locale>hu</supported-locale> - <resource-bundle>hu.midori.kosmos.portlet.sf.sfmonitoringportlet</resource-bundle> + <resource-bundle>hu.midori.kosmos.portlet.sf.sf_monitoring</resource-bundle> <portlet-info> <title>SourceForge Monitoring</title> </portlet-info> @@ -316,7 +316,7 @@ </supports> <supported-locale>en</supported-locale> <supported-locale>hu</supported-locale> - <resource-bundle>hu.midori.kosmos.portlet.svn.svnmonitoringportlet</resource-bundle> + <resource-bundle>hu.midori.kosmos.portlet.svn.svn_monitoring</resource-bundle> <portlet-info> <title>Subversion Monitoring</title> </portlet-info> @@ -349,7 +349,7 @@ </supports> <supported-locale>en</supported-locale> <supported-locale>hu</supported-locale> - <resource-bundle>hu.midori.kosmos.portlet.svn.svnmonitoringportlet</resource-bundle> + <resource-bundle>hu.midori.kosmos.portlet.svn.svn_monitoring</resource-bundle> <portlet-info> <title>Subversion Monitoring</title> </portlet-info> |
From: <jbo...@li...> - 2005-11-20 14:25:42
|
Author: aron.gombas Date: 2005-11-20 09:25:24 -0500 (Sun, 20 Nov 2005) New Revision: 1605 Added: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ColorCodedKey.java Log: Oops, this one left out Added: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ColorCodedKey.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ColorCodedKey.java 2005-11-20 14:24:00 UTC (rev 1604) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ColorCodedKey.java 2005-11-20 14:25:24 UTC (rev 1605) @@ -0,0 +1,46 @@ +/* + * Kosmos. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package hu.midori.kosmos.server.util; + +import java.awt.Color; + +/** + * Key for color coded pie sections. + * Wraps immutable label and color values. + * + * @author <a href="mailto:aro...@mi...">Aron Gombas</a> + * @version $Id$ + */ +public class ColorCodedKey implements Comparable { + /** Label for the pie section. */ + private String label; + /** Color for the pie section. */ + private Color color; + + public ColorCodedKey(String label, Color color) { + this.color = color; + this.label = label; + } + + public String getLabel() { + return label; + } + + public Color getColor() { + return color; + } + + /** Ensures that only label string will appear in the charts. */ + @Override + public String toString() { + return label; + } + + public int compareTo(Object obj) { + return getLabel().compareTo(((ColorCodedKey)obj).getLabel()); + } +} |
From: <jbo...@li...> - 2005-11-20 14:24:49
|
Author: aron.gombas Date: 2005-11-20 09:24:00 -0500 (Sun, 20 Nov 2005) New Revision: 1604 Added: trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/cc/cc_monitoring.properties trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/cc/cc_monitoring_hu.properties trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/jira/jira_monitoring.properties trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/jira/jira_monitoring_hu.properties trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/sf/sf_monitoring.properties trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/sf/sf_monitoring_hu.properties trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/svn/svn_monitoring.properties trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/svn/svn_monitoring_hu.properties Removed: trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/cc/ccmonitoringportlet.properties trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/cc/ccmonitoringportlet_hu.properties trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/jira/jiramonitoringportlet.properties trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/jira/jiramonitoringportlet_hu.properties trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/sf/sfmonitoringportlet.properties trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/sf/sfmonitoringportlet_hu.properties trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/svn/svnmonitoringportlet.properties trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/svn/svnmonitoringportlet_hu.properties Log: Localized resource files renamed Added: trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/cc/cc_monitoring.properties =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/cc/cc_monitoring.properties 2005-11-20 14:20:58 UTC (rev 1603) +++ trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/cc/cc_monitoring.properties 2005-11-20 14:24:00 UTC (rev 1604) @@ -0,0 +1,37 @@ +# $Id$ + +portlet.title=CruiseControl Monitoring +portlet.help=This portlet monitors the continuous integration builds managed by <a href="http://cruisecontrol.sourceforge.net">CruiseControl</a>.<br/>Please see the manual for details about the features and configuration. + +ccproject.name=Project +ccproject.lastBuildLabel=Build Label +ccproject.modifications=modifications +ccproject.status=Status +ccproject.successRate=Test Success Rate +ccproject.testDetails=Test Details +ccproject.timestamp=Timestamp +ccproject.lastBuildAge=Last Build Age + +ccproject.buildTime=Build Time +ccproject.testsSucceded=Tests Succeded +ccproject.failures=Failures +ccproject.errors=Errors +ccproject.tests=Tests Total +ccproject.testsPerCategory=Tests Success Rate + +legend.title=Legend +legend.success=Successful build and tests. +legend.warning=Successful build with test failures, errors. +legend.error=Failed build. +legend.buildSuccess=Successful build. +legend.buildError=Failed build. +legend.testSuccess=Successful test. +legend.testWarning=Failed test. +legend.testError=Test error. + +lastupdate=Last Update + +action.refresh=Refresh +action.back=Back +action.show=Show +action.showAll=Show All Added: trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/cc/cc_monitoring_hu.properties =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/cc/cc_monitoring_hu.properties 2005-11-20 14:20:58 UTC (rev 1603) +++ trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/cc/cc_monitoring_hu.properties 2005-11-20 14:24:00 UTC (rev 1604) @@ -0,0 +1,37 @@ +# $Id$ + +portlet.title=CruiseControl Figyel+portlet.help=Ez a portlet ki a <a href="http://cruisecontrol.sourceforge.net">CruiseControl</a> al menedzselt <i>continuous integration build</i>-eket.<br/>Olvasd el a kket, ha rletekre vagy kncsi a funkcil vagy a besokkal kapcsolatban. + +ccproject.name=Projekt +ccproject.lastBuildLabel=Build Ce +ccproject.modifications=voztat+ccproject.status=Stsz +ccproject.successRate=Unit Teszt Sikerar +ccproject.testDetails=Unit Tesztek Rletesen +ccproject.timestamp=Idcproject.lastBuildAge=Build Kora + +ccproject.buildTime=Build Idtam +ccproject.testsSucceded=Sikeres Unit Tesztek +ccproject.failures=Sikertelen Unit Tesztek +ccproject.errors=HibUnit Tesztek +ccproject.tests=Unit Tesztek szesen +ccproject.testsPerCategory=Unit Teszt Eloszl+ +legend.title=Jelmagyart +legend.success=Sikeres build sikeres tesztekkel. +legend.warning=Sikeres build sikertelen vagy hibtesztekkel. +legend.error=Sikertelen build. +legend.buildSuccess=Sikeres build. +legend.buildError=Sikertelen build. +legend.testSuccess=Sikeres unit teszt. +legend.testWarning=Sikertelen unit teszt. +legend.testError=Hibunit teszt. + +lastupdate=Utolsisss + +action.refresh=Friss+action.back=Vissza +action.show=Mutat +action.showAll=szeset Mutat \ No newline at end of file Deleted: trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/cc/ccmonitoringportlet.properties =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/cc/ccmonitoringportlet.properties 2005-11-20 14:20:58 UTC (rev 1603) +++ trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/cc/ccmonitoringportlet.properties 2005-11-20 14:24:00 UTC (rev 1604) @@ -1,37 +0,0 @@ -# $Id$ - -portlet.title=CruiseControl Monitoring -portlet.help=This portlet monitors the continuous integration builds managed by <a href="http://cruisecontrol.sourceforge.net">CruiseControl</a>.<br/>Please see the manual for details about the features and configuration. - -ccproject.name=Project -ccproject.lastBuildLabel=Build Label -ccproject.modifications=modifications -ccproject.status=Status -ccproject.successRate=Test Success Rate -ccproject.testDetails=Test Details -ccproject.timestamp=Timestamp -ccproject.lastBuildAge=Last Build Age - -ccproject.buildTime=Build Time -ccproject.testsSucceded=Tests Succeded -ccproject.failures=Failures -ccproject.errors=Errors -ccproject.tests=Tests Total -ccproject.testsPerCategory=Tests Success Rate - -legend.title=Legend -legend.success=Successful build and tests. -legend.warning=Successful build with test failures, errors. -legend.error=Failed build. -legend.buildSuccess=Successful build. -legend.buildError=Failed build. -legend.testSuccess=Successful test. -legend.testWarning=Failed test. -legend.testError=Test error. - -lastupdate=Last Update - -action.refresh=Refresh -action.back=Back -action.show=Show -action.showAll=Show All Deleted: trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/cc/ccmonitoringportlet_hu.properties =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/cc/ccmonitoringportlet_hu.properties 2005-11-20 14:20:58 UTC (rev 1603) +++ trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/cc/ccmonitoringportlet_hu.properties 2005-11-20 14:24:00 UTC (rev 1604) @@ -1,37 +0,0 @@ -# $Id$ - -portlet.title=CruiseControl Figyel-portlet.help=Ez a portlet ki a <a href="http://cruisecontrol.sourceforge.net">CruiseControl</a> al menedzselt <i>continuous integration build</i>-eket.<br/>Olvasd el a kket, ha rletekre vagy kncsi a funkcil vagy a besokkal kapcsolatban. - -ccproject.name=Projekt -ccproject.lastBuildLabel=Build Ce -ccproject.modifications=voztat-ccproject.status=Stsz -ccproject.successRate=Unit Teszt Sikerar -ccproject.testDetails=Unit Tesztek Rletesen -ccproject.timestamp=Idcproject.lastBuildAge=Build Kora - -ccproject.buildTime=Build Idtam -ccproject.testsSucceded=Sikeres Unit Tesztek -ccproject.failures=Sikertelen Unit Tesztek -ccproject.errors=HibUnit Tesztek -ccproject.tests=Unit Tesztek szesen -ccproject.testsPerCategory=Unit Teszt Eloszl- -legend.title=Jelmagyart -legend.success=Sikeres build sikeres tesztekkel. -legend.warning=Sikeres build sikertelen vagy hibtesztekkel. -legend.error=Sikertelen build. -legend.buildSuccess=Sikeres build. -legend.buildError=Sikertelen build. -legend.testSuccess=Sikeres unit teszt. -legend.testWarning=Sikertelen unit teszt. -legend.testError=Hibunit teszt. - -lastupdate=Utolsisss - -action.refresh=Friss-action.back=Vissza -action.show=Mutat -action.showAll=szeset Mutat \ No newline at end of file Added: trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/jira/jira_monitoring.properties =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/jira/jira_monitoring.properties 2005-11-20 14:20:58 UTC (rev 1603) +++ trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/jira/jira_monitoring.properties 2005-11-20 14:24:00 UTC (rev 1604) @@ -0,0 +1,40 @@ +# $Id$ + +portlet.title=JIRA Monitoring +portlet.help=This portlet monitors the projects in a <a href="http://www.atlassian.com/software/jira">JIRA</a> database.<br/>Please see the manual for details about the features and configuration. + +jiraproject.name=Project +jiraproject.projectDetails=Project Details +jiraproject.key=Key +jiraproject.lead=Lead +jiraproject.issueDetails=Issue Details + +jiraproject.description=Description +jiraproject.projectUrl=Project Site +jiraproject.issuesByStatus=Issues By Status + +jiraproject.openIssues=Open +jiraproject.codingInProgressIssues=Coding In Progress +jiraproject.reopenedIssues=Reopened +jiraproject.resolvedIssues=Resolved +jiraproject.closedIssues=Closed + +jiraproject.openIssuesByPriority=Open Issues By Priority +jiraproject.openIssuesByAssignee=Open Issues By Assignee + +jiraproject.blockerOpenIssues=Blocker +jiraproject.criticalOpenIssues=Critical +jiraproject.majorOpenIssues=Major +jiraproject.minorOpenIssues=Minor +jiraproject.trivialOpenIssues=Trivial +jiraproject.optionalOpenIssues=Optional + +legend.title=Legend +legend.warning=Too many open issues. + +lastupdate=Last Update + +action.refresh=Refresh +action.back=Back +action.show=Show +action.showAll=Show All Added: trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/jira/jira_monitoring_hu.properties =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/jira/jira_monitoring_hu.properties 2005-11-20 14:20:58 UTC (rev 1603) +++ trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/jira/jira_monitoring_hu.properties 2005-11-20 14:24:00 UTC (rev 1604) @@ -0,0 +1,40 @@ +# $Id$ + +portlet.title=JIRA Figyel+portlet.help=Ez a portlet ki a <a href="http://www.atlassian.com/software/jira">JIRA</a> al tlt projekteket.<br/>Olvasd el a kket, ha rletekre vagy kncsi a funkcil vagy a besokkal kapcsolatban. + +jiraproject.name=Projekt +jiraproject.projectDetails=Projekt Rletesen +jiraproject.key=Azonos +jiraproject.lead=Vezetiraproject.issueDetails=HibRletesen + +jiraproject.description=Les +jiraproject.projectUrl=Projekt Weblap +jiraproject.issuesByStatus=HibStsz Szerint + +jiraproject.openIssues=Akt+jiraproject.codingInProgressIssues=Javs Alatt +jiraproject.reopenedIssues=ra Megnyitott +jiraproject.resolvedIssues=Javtt +jiraproject.closedIssues=Lez + +jiraproject.openIssuesByPriority=AktHibPriors Szerint +jiraproject.openIssuesByAssignee=AktHibIllets Szerint + +jiraproject.blockerOpenIssues=Giraproject.criticalOpenIssues=Kritikus +jiraproject.majorOpenIssues=Jelentjiraproject.minorOpenIssues=Csek +jiraproject.trivialOpenIssues=Trivis +jiraproject.optionalOpenIssues=Opcions + +legend.title=Jelmagyart +legend.warning=Tk akthiba. + +lastupdate=Utolsisss + +action.refresh=Friss+action.back=Vissza +action.show=Mutat +action.showAll=szeset Mutat Deleted: trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/jira/jiramonitoringportlet.properties =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/jira/jiramonitoringportlet.properties 2005-11-20 14:20:58 UTC (rev 1603) +++ trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/jira/jiramonitoringportlet.properties 2005-11-20 14:24:00 UTC (rev 1604) @@ -1,40 +0,0 @@ -# $Id$ - -portlet.title=JIRA Monitoring -portlet.help=This portlet monitors the projects in a <a href="http://www.atlassian.com/software/jira">JIRA</a> database.<br/>Please see the manual for details about the features and configuration. - -jiraproject.name=Project -jiraproject.projectDetails=Project Details -jiraproject.key=Key -jiraproject.lead=Lead -jiraproject.issueDetails=Issue Details - -jiraproject.description=Description -jiraproject.projectUrl=Project Site -jiraproject.issuesByStatus=Issues By Status - -jiraproject.openIssues=Open -jiraproject.codingInProgressIssues=Coding In Progress -jiraproject.reopenedIssues=Reopened -jiraproject.resolvedIssues=Resolved -jiraproject.closedIssues=Closed - -jiraproject.openIssuesByPriority=Open Issues By Priority -jiraproject.openIssuesByAssignee=Open Issues By Assignee - -jiraproject.blockerOpenIssues=Blocker -jiraproject.criticalOpenIssues=Critical -jiraproject.majorOpenIssues=Major -jiraproject.minorOpenIssues=Minor -jiraproject.trivialOpenIssues=Trivial -jiraproject.optionalOpenIssues=Optional - -legend.title=Legend -legend.warning=Too many open issues. - -lastupdate=Last Update - -action.refresh=Refresh -action.back=Back -action.show=Show -action.showAll=Show All Deleted: trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/jira/jiramonitoringportlet_hu.properties =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/jira/jiramonitoringportlet_hu.properties 2005-11-20 14:20:58 UTC (rev 1603) +++ trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/jira/jiramonitoringportlet_hu.properties 2005-11-20 14:24:00 UTC (rev 1604) @@ -1,40 +0,0 @@ -# $Id$ - -portlet.title=JIRA Figyel-portlet.help=Ez a portlet ki a <a href="http://www.atlassian.com/software/jira">JIRA</a> al tlt projekteket.<br/>Olvasd el a kket, ha rletekre vagy kncsi a funkcil vagy a besokkal kapcsolatban. - -jiraproject.name=Projekt -jiraproject.projectDetails=Projekt Rletesen -jiraproject.key=Azonos -jiraproject.lead=Vezetiraproject.issueDetails=HibRletesen - -jiraproject.description=Les -jiraproject.projectUrl=Projekt Weblap -jiraproject.issuesByStatus=HibStsz Szerint - -jiraproject.openIssues=Akt-jiraproject.codingInProgressIssues=Javs Alatt -jiraproject.reopenedIssues=ra Megnyitott -jiraproject.resolvedIssues=Javtt -jiraproject.closedIssues=Lez - -jiraproject.openIssuesByPriority=AktHibPriors Szerint -jiraproject.openIssuesByAssignee=AktHibIllets Szerint - -jiraproject.blockerOpenIssues=Giraproject.criticalOpenIssues=Kritikus -jiraproject.majorOpenIssues=Jelentjiraproject.minorOpenIssues=Csek -jiraproject.trivialOpenIssues=Trivis -jiraproject.optionalOpenIssues=Opcions - -legend.title=Jelmagyart -legend.warning=Tk akthiba. - -lastupdate=Utolsisss - -action.refresh=Friss-action.back=Vissza -action.show=Mutat -action.showAll=szeset Mutat Added: trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/sf/sf_monitoring.properties =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/sf/sf_monitoring.properties 2005-11-20 14:20:58 UTC (rev 1603) +++ trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/sf/sf_monitoring.properties 2005-11-20 14:24:00 UTC (rev 1604) @@ -0,0 +1,18 @@ +# $Id$ + +portlet.title=SourceForge Monitoring +portlet.help=This portlet monitors the projects hosted at <a href="http://www.sourceforge.net">SourceForge</a>.<br/>Please see the manual for details about the features and configuration. + +sfRelease.packageName=Package +sfRelease.version=Version +sfRelease.date=Date +sfRelease.age=Age + +legend.title=Legend +legend.new=New release. +legend.old=Inactive project. + +lastupdate=Last Update + +action.refresh=Refresh +action.back=Back Added: trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/sf/sf_monitoring_hu.properties =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/sf/sf_monitoring_hu.properties 2005-11-20 14:20:58 UTC (rev 1603) +++ trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/sf/sf_monitoring_hu.properties 2005-11-20 14:24:00 UTC (rev 1604) @@ -0,0 +1,18 @@ +# $Id$ + +portlet.title=SourceForge Figyel+portlet.help=Ez a portlet ki a <a href="http://www.sourceforge.net">SourceForge</a>-on talatojekteket.<br/>Olvasd el a kket, ha rletekre vagy kncsi a funkcil vagy a besokkal kapcsolatban. + +sfRelease.packageName=Csomag +sfRelease.version=VerzifRelease.date=Dm +sfRelease.age=Kor + +legend.title=Jelmagyart +legend.new= verzilegend.old=Inaktprojekt. + +lastupdate=Utolsisss + +action.refresh=Friss+action.back=Vissza Deleted: trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/sf/sfmonitoringportlet.properties =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/sf/sfmonitoringportlet.properties 2005-11-20 14:20:58 UTC (rev 1603) +++ trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/sf/sfmonitoringportlet.properties 2005-11-20 14:24:00 UTC (rev 1604) @@ -1,18 +0,0 @@ -# $Id$ - -portlet.title=SourceForge Monitoring -portlet.help=This portlet monitors the projects hosted at <a href="http://www.sourceforge.net">SourceForge</a>.<br/>Please see the manual for details about the features and configuration. - -sfRelease.packageName=Package -sfRelease.version=Version -sfRelease.date=Date -sfRelease.age=Age - -legend.title=Legend -legend.new=New release. -legend.old=Inactive project. - -lastupdate=Last Update - -action.refresh=Refresh -action.back=Back Deleted: trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/sf/sfmonitoringportlet_hu.properties =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/sf/sfmonitoringportlet_hu.properties 2005-11-20 14:20:58 UTC (rev 1603) +++ trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/sf/sfmonitoringportlet_hu.properties 2005-11-20 14:24:00 UTC (rev 1604) @@ -1,18 +0,0 @@ -# $Id$ - -portlet.title=SourceForge Figyel-portlet.help=Ez a portlet ki a <a href="http://www.sourceforge.net">SourceForge</a>-on talatojekteket.<br/>Olvasd el a kket, ha rletekre vagy kncsi a funkcil vagy a besokkal kapcsolatban. - -sfRelease.packageName=Csomag -sfRelease.version=VerzifRelease.date=Dm -sfRelease.age=Kor - -legend.title=Jelmagyart -legend.new= verzilegend.old=Inaktprojekt. - -lastupdate=Utolsisss - -action.refresh=Friss-action.back=Vissza Added: trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/svn/svn_monitoring.properties =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/svn/svn_monitoring.properties 2005-11-20 14:20:58 UTC (rev 1603) +++ trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/svn/svn_monitoring.properties 2005-11-20 14:24:00 UTC (rev 1604) @@ -0,0 +1,42 @@ +# $Id$ + +portlet.title=Subversion Monitoring +portlet.help=This portlet monitors the repositories under <a href="http://subversion.tigris.org/">Subversion</a> control.<br/>Please see the manual for details about the features and configuration. + +svnrepository.location=Repository Location +svnrepository.repositoryDetails=Repository Details +svnrepository.revision=Revision +svnrepository.revisionDetails=Revision Details +svnrepository.activityLast7Days=Activity Last 7 Days +svnrepository.activityDetails=Activity Details +svnrepository.latestTouchDate=Latest Touch +svnrepository.latestTouchAge=Latest Touch Age + +svnrepository.dirs=Folders +svnrepository.files=Files +svnrepository.totalRepositoryEntries=Total Repository Entries +svnrepository.totalFileSize=Total File Size +svnrepository.repositoryEntryHistory=Repository Entry History + +svnrepository.mostActiveCommitters=Most Active Committers +svnrepository.mostActiveFiles=Most Active Files + +svnrepository.commitsTotal=Commits Total +svnrepository.commitsToday=Commits Today +svnrepository.commitsLast7Days=Commits Last 7 Days +svnrepository.commitsLast31Days=Commits Last 31 Days +svnrepository.committersTotal=Committers Total +svnrepository.committersToday=Committers Today +svnrepository.committersLast7Days=Committers Last 7 Days +svnrepository.committersLast31Days=Committers Last 31 Days +svnrepository.commitHistory=Commit History + +legend.title=Legend +legend.old=Inactive repository. + +lastupdate=Last Update + +action.refresh=Refresh +action.back=Back +action.show=Show +action.showAll=Show All Added: trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/svn/svn_monitoring_hu.properties =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/svn/svn_monitoring_hu.properties 2005-11-20 14:20:58 UTC (rev 1603) +++ trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/svn/svn_monitoring_hu.properties 2005-11-20 14:24:00 UTC (rev 1604) @@ -0,0 +1,42 @@ +# $Id$ + +portlet.title=Subversion Figyel+portlet.help=Ez a portlet ki a <a href="http://subversion.tigris.org/">Subversion</a> verzietalatt l tl.<br/>Olvasd el a kket, ha rletekre vagy kncsi a funkcil vagy a besokkal kapcsolatban. + +svnrepository.location=Tely +svnrepository.repositoryDetails=Tely Rletesen +svnrepository.revision=Revvnrepository.revisionDetails=Revszletesen +svnrepository.activityLast7Days=Aktivs 7 Nap Sor+svnrepository.activityDetails=Aktivs Rletesen +svnrepository.latestTouchDate=Utolsdoss +svnrepository.latestTouchAge=Kor + +svnrepository.dirs=Ktk +svnrepository.files=Fok +svnrepository.totalRepositoryEntries=Bejegyzk szesen +svnrepository.totalFileSize=Fok szmte +svnrepository.repositoryEntryHistory=Bejegyzk az Idggvn + +svnrepository.mostActiveCommitters=Legaktbb Fejlesztsvnrepository.mostActiveFiles=Legaktbb Fok + +svnrepository.commitsTotal=Msok szesen +svnrepository.commitsToday=Msok Ma +svnrepository.commitsLast7Days=Msok 7 Nap Sor+svnrepository.commitsLast31Days=Msok 31 Nap Sor+svnrepository.committersTotal=Fejlesztsszesen +svnrepository.committersToday=Fejleszta +svnrepository.committersLast7Days=Fejleszt Nap Sor+svnrepository.committersLast31Days=Fejleszt1 Nap Sor+svnrepository.commitHistory=Msok az Idggvn + +legend.title=Jelmagyart +legend.old=Inaktt + +lastupdate=Utolsisss + +action.refresh=Friss+action.back=Vissza +action.show=Mutat +action.showAll=szeset Mutat Deleted: trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/svn/svnmonitoringportlet.properties =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/svn/svnmonitoringportlet.properties 2005-11-20 14:20:58 UTC (rev 1603) +++ trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/svn/svnmonitoringportlet.properties 2005-11-20 14:24:00 UTC (rev 1604) @@ -1,42 +0,0 @@ -# $Id$ - -portlet.title=Subversion Monitoring -portlet.help=This portlet monitors the repositories under <a href="http://subversion.tigris.org/">Subversion</a> control.<br/>Please see the manual for details about the features and configuration. - -svnrepository.location=Repository Location -svnrepository.repositoryDetails=Repository Details -svnrepository.revision=Revision -svnrepository.revisionDetails=Revision Details -svnrepository.activityLast7Days=Activity Last 7 Days -svnrepository.activityDetails=Activity Details -svnrepository.latestTouchDate=Latest Touch -svnrepository.latestTouchAge=Latest Touch Age - -svnrepository.dirs=Folders -svnrepository.files=Files -svnrepository.totalRepositoryEntries=Total Repository Entries -svnrepository.totalFileSize=Total File Size -svnrepository.repositoryEntryHistory=Repository Entry History - -svnrepository.mostActiveCommitters=Most Active Committers -svnrepository.mostActiveFiles=Most Active Files - -svnrepository.commitsTotal=Commits Total -svnrepository.commitsToday=Commits Today -svnrepository.commitsLast7Days=Commits Last 7 Days -svnrepository.commitsLast31Days=Commits Last 31 Days -svnrepository.committersTotal=Committers Total -svnrepository.committersToday=Committers Today -svnrepository.committersLast7Days=Committers Last 7 Days -svnrepository.committersLast31Days=Committers Last 31 Days -svnrepository.commitHistory=Commit History - -legend.title=Legend -legend.old=Inactive repository. - -lastupdate=Last Update - -action.refresh=Refresh -action.back=Back -action.show=Show -action.showAll=Show All Deleted: trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/svn/svnmonitoringportlet_hu.properties =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/svn/svnmonitoringportlet_hu.properties 2005-11-20 14:20:58 UTC (rev 1603) +++ trunk/labs/kosmos/web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet/svn/svnmonitoringportlet_hu.properties 2005-11-20 14:24:00 UTC (rev 1604) @@ -1,42 +0,0 @@ -# $Id$ - -portlet.title=Subversion Figyel-portlet.help=Ez a portlet ki a <a href="http://subversion.tigris.org/">Subversion</a> verzietalatt l tl.<br/>Olvasd el a kket, ha rletekre vagy kncsi a funkcil vagy a besokkal kapcsolatban. - -svnrepository.location=Tely -svnrepository.repositoryDetails=Tely Rletesen -svnrepository.revision=Revvnrepository.revisionDetails=Revszletesen -svnrepository.activityLast7Days=Aktivs 7 Nap Sor-svnrepository.activityDetails=Aktivs Rletesen -svnrepository.latestTouchDate=Utolsdoss -svnrepository.latestTouchAge=Kor - -svnrepository.dirs=Ktk -svnrepository.files=Fok -svnrepository.totalRepositoryEntries=Bejegyzk szesen -svnrepository.totalFileSize=Fok szmte -svnrepository.repositoryEntryHistory=Bejegyzk az Idggvn - -svnrepository.mostActiveCommitters=Legaktbb Fejlesztsvnrepository.mostActiveFiles=Legaktbb Fok - -svnrepository.commitsTotal=Msok szesen -svnrepository.commitsToday=Msok Ma -svnrepository.commitsLast7Days=Msok 7 Nap Sor-svnrepository.commitsLast31Days=Msok 31 Nap Sor-svnrepository.committersTotal=Fejlesztsszesen -svnrepository.committersToday=Fejleszta -svnrepository.committersLast7Days=Fejleszt Nap Sor-svnrepository.committersLast31Days=Fejleszt1 Nap Sor-svnrepository.commitHistory=Msok az Idggvn - -legend.title=Jelmagyart -legend.old=Inaktt - -lastupdate=Utolsisss - -action.refresh=Friss-action.back=Vissza -action.show=Mutat -action.showAll=szeset Mutat |
Author: aron.gombas Date: 2005-11-20 09:20:58 -0500 (Sun, 20 Nov 2005) New Revision: 1603 Modified: trunk/labs/kosmos/build/build.xml trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraServiceImpl.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java trunk/labs/kosmos/web-portlet/WEB-INF/web.xml trunk/labs/kosmos/web-portlet/pages/cc_monitoring.jsp trunk/labs/kosmos/web-portlet/pages/cc_monitoring_help.jsp trunk/labs/kosmos/web-portlet/pages/cc_monitoring_test_details.jsp trunk/labs/kosmos/web-portlet/pages/jira_monitoring.jsp trunk/labs/kosmos/web-portlet/pages/jira_monitoring_help.jsp trunk/labs/kosmos/web-portlet/pages/jira_monitoring_issue_details.jsp trunk/labs/kosmos/web-portlet/pages/jira_monitoring_project_details.jsp trunk/labs/kosmos/web-portlet/pages/sf_monitoring.jsp trunk/labs/kosmos/web-portlet/pages/sf_monitoring_help.jsp trunk/labs/kosmos/web-portlet/pages/svn_monitoring.jsp trunk/labs/kosmos/web-portlet/pages/svn_monitoring_activity_details.jsp trunk/labs/kosmos/web-portlet/pages/svn_monitoring_help.jsp trunk/labs/kosmos/web-portlet/pages/svn_monitoring_repository_details.jsp trunk/labs/kosmos/web-portlet/pages/svn_monitoring_revision_details.jsp trunk/labs/kosmos/web-server/WEB-INF/web.xml trunk/labs/kosmos/xdocs/reference/reference-manual.xml Log: Server and portlets use the same localized resources Modified: trunk/labs/kosmos/build/build.xml =================================================================== --- trunk/labs/kosmos/build/build.xml 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/build/build.xml 2005-11-20 14:20:58 UTC (rev 1603) @@ -20,6 +20,7 @@ <!-- generated paths --> <property name="build.dir" location="build"/> <property name="conf.dir" location="conf-${module.name}"/> + <property name="i18n.dir" location="web-portlet/WEB-INF/classes/hu/midori/kosmos/portlet"/> <property name="src.dir" location="src"/> <property name="web.dir" location="web-${module.name}"/> <property name="xdocs.dir" location="xdocs"/> @@ -56,9 +57,7 @@ </target> <target name="clean" depends="init" description="Cleans up temporary files created during previous builds"> - <delete dir="${dist.root.dir}"/> - <delete dir="${dist-bin.root.dir}"/> - <delete dir="${dist-src.root.dir}"/> + <delete dir="${dist-bin.dir}"/> <delete dir="${test-out.dir}"/> </target> @@ -75,8 +74,8 @@ </filterset> </copy> <!-- convert resource files --> - <native2ascii encoding="ISO-8859-1" src="${web.dir}" dest="${dist-bin.bin.dir}" includes="**/portlet/**/*portlet.properties"/> - <native2ascii encoding="ISO-8859-2" src="${web.dir}" dest="${dist-bin.bin.dir}" includes="**/portlet/**/*portlet_hu.properties"/> + <native2ascii encoding="ISO-8859-1" src="${i18n.dir}" dest="${dist-bin.classes.dir}/hu/midori/kosmos/${module.name}" includes="**/*monitoring.properties"/> + <native2ascii encoding="ISO-8859-2" src="${i18n.dir}" dest="${dist-bin.classes.dir}/hu/midori/kosmos/${module.name}" includes="**/*monitoring_hu.properties"/> <!-- copy other binary files --> <copy todir="${dist-bin.bin.dir}"> <fileset dir="${web.dir}" excludes="**/*.jsp"> Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java 2005-11-20 14:20:58 UTC (rev 1603) @@ -134,11 +134,11 @@ List<Map.Entry<ColorCodedKey, Integer>> testsPerCategory = new ArrayList<Map.Entry<ColorCodedKey, Integer>>(); int success = tests - errors - failures; if(success > 0) - testsPerCategory.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.cc.ccmonitoringportlet", "ccproject.testsSucceded"), CcConstants.SUCCESS_COLOR), success).entrySet()); + testsPerCategory.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.cc.cc_monitoring", "ccproject.testsSucceded"), CcConstants.SUCCESS_COLOR), success).entrySet()); if(failures > 0) - testsPerCategory.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.cc.ccmonitoringportlet", "ccproject.failures"), CcConstants.FAILURE_COLOR), failures).entrySet()); + testsPerCategory.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.cc.cc_monitoring", "ccproject.failures"), CcConstants.FAILURE_COLOR), failures).entrySet()); if(errors > 0) - testsPerCategory.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.cc.ccmonitoringportlet", "ccproject.errors"), CcConstants.ERROR_COLOR), errors).entrySet()); + testsPerCategory.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.cc.cc_monitoring", "ccproject.errors"), CcConstants.ERROR_COLOR), errors).entrySet()); ByteArrayOutputStream out = new ByteArrayOutputStream(); ChartUtils.writeChartAsPng(ChartUtils.generateColorCodedPieChart(ChartUtils.collectionToPieDataset(testsPerCategory)), out); Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraServiceImpl.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraServiceImpl.java 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraServiceImpl.java 2005-11-20 14:20:58 UTC (rev 1603) @@ -224,15 +224,15 @@ // generate issues-per-status chart List<Map.Entry<ColorCodedKey, Integer>> issuesPerStatusMap = new ArrayList<Map.Entry<ColorCodedKey, Integer>>(); if(openIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.openIssues"), JiraConstants.OPEN_COLOR), openIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.openIssues"), JiraConstants.OPEN_COLOR), openIssues).entrySet()); if(codingInProgressIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.codingInProgressIssues"), JiraConstants.CODING_IN_PROGRESS_COLOR), codingInProgressIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.codingInProgressIssues"), JiraConstants.CODING_IN_PROGRESS_COLOR), codingInProgressIssues).entrySet()); if(reopenedIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.reopenedIssues"), JiraConstants.REOPENED_COLOR), reopenedIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.reopenedIssues"), JiraConstants.REOPENED_COLOR), reopenedIssues).entrySet()); if(resolvedIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.resolvedIssues"), JiraConstants.RESOLVED_COLOR), resolvedIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.resolvedIssues"), JiraConstants.RESOLVED_COLOR), resolvedIssues).entrySet()); if(closedIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.closedIssues"), JiraConstants.CLOSED_COLOR), closedIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.closedIssues"), JiraConstants.CLOSED_COLOR), closedIssues).entrySet()); out.reset(); ChartUtils.writeChartAsPng(ChartUtils.generateColorCodedPieChart(ChartUtils.collectionToPieDataset(issuesPerStatusMap)), out); @@ -241,17 +241,17 @@ // generate issues-per-priority chart List<Map.Entry<ColorCodedKey, Integer>> openIssuesPerPriorityMap = new ArrayList<Map.Entry<ColorCodedKey, Integer>>(); if(blockerOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.blockerOpenIssues"), JiraConstants.BLOCKER_COLOR), blockerOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.blockerOpenIssues"), JiraConstants.BLOCKER_COLOR), blockerOpenIssues).entrySet()); if(criticalOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.criticalOpenIssues"), JiraConstants.CRITICAL_COLOR), criticalOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.criticalOpenIssues"), JiraConstants.CRITICAL_COLOR), criticalOpenIssues).entrySet()); if(majorOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.majorOpenIssues"), JiraConstants.MAJOR_COLOR), majorOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.majorOpenIssues"), JiraConstants.MAJOR_COLOR), majorOpenIssues).entrySet()); if(minorOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.minorOpenIssues"), JiraConstants.MINOR_COLOR), minorOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.minorOpenIssues"), JiraConstants.MINOR_COLOR), minorOpenIssues).entrySet()); if(trivialOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.trivialOpenIssues"), JiraConstants.TRIVIAL_COLOR), trivialOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.trivialOpenIssues"), JiraConstants.TRIVIAL_COLOR), trivialOpenIssues).entrySet()); if(optionalOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.optionalOpenIssues"), JiraConstants.OPTIONAL_COLOR), optionalOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.optionalOpenIssues"), JiraConstants.OPTIONAL_COLOR), optionalOpenIssues).entrySet()); out.reset(); ChartUtils.writeChartAsPng(ChartUtils.generateColorCodedPieChart(ChartUtils.collectionToPieDataset(openIssuesPerPriorityMap)), out); Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java 2005-11-20 14:20:58 UTC (rev 1603) @@ -96,7 +96,7 @@ } } - public Object reloadData(Object key) {// TODO localize charts + public Object reloadData(Object key) { String url = key.toString(); List<SvnRepository> repositories = new ArrayList<SvnRepository>(); Modified: trunk/labs/kosmos/web-portlet/WEB-INF/web.xml =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/web.xml 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/web-portlet/WEB-INF/web.xml 2005-11-20 14:20:58 UTC (rev 1603) @@ -12,6 +12,6 @@ <!-- JSTL configuration --> <context-param> <param-name>javax.servlet.jsp.jstl.fmt.locale</param-name> - <param-value>en</param-value> + <param-value>hu</param-value> </context-param> </web-app> Modified: trunk/labs/kosmos/web-portlet/pages/cc_monitoring.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/cc_monitoring.jsp 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/web-portlet/pages/cc_monitoring.jsp 2005-11-20 14:20:58 UTC (rev 1603) @@ -1,7 +1,7 @@ <%@include file="includes/taglibs.jsp"%> <portlet:defineObjects/> -<fmt:setBundle basename="hu.midori.kosmos.portlet.cc.ccmonitoringportlet" scope="application"/> +<fmt:setBundle basename="hu.midori.kosmos.portlet.cc.cc_monitoring" scope="application"/> <display:table name="${projects}" id="projectsIt" requestURI="<%=renderResponse.createRenderURL().toString() %>" requestURIcontext="false"> <c:set var="id" scope="page" value="${projectsIt.id}"/> Modified: trunk/labs/kosmos/web-portlet/pages/cc_monitoring_help.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/cc_monitoring_help.jsp 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/web-portlet/pages/cc_monitoring_help.jsp 2005-11-20 14:20:58 UTC (rev 1603) @@ -1,7 +1,7 @@ <%@include file="includes/taglibs.jsp"%> <portlet:defineObjects/> -<fmt:setBundle basename="hu.midori.kosmos.portlet.cc.ccmonitoringportlet" scope="application"/> +<fmt:setBundle basename="hu.midori.kosmos.portlet.cc.cc_monitoring" scope="application"/> <%@include file="includes/about.jsp"%> Modified: trunk/labs/kosmos/web-portlet/pages/cc_monitoring_test_details.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/cc_monitoring_test_details.jsp 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/web-portlet/pages/cc_monitoring_test_details.jsp 2005-11-20 14:20:58 UTC (rev 1603) @@ -1,7 +1,7 @@ <%@include file="includes/taglibs.jsp"%> <portlet:defineObjects/> -<fmt:setBundle basename="hu.midori.kosmos.portlet.cc.ccmonitoringportlet" scope="application"/> +<fmt:setBundle basename="hu.midori.kosmos.portlet.cc.cc_monitoring" scope="application"/> <table> <tr class="portlet-section-body"> Modified: trunk/labs/kosmos/web-portlet/pages/jira_monitoring.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/jira_monitoring.jsp 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/web-portlet/pages/jira_monitoring.jsp 2005-11-20 14:20:58 UTC (rev 1603) @@ -1,7 +1,7 @@ <%@include file="includes/taglibs.jsp"%> <portlet:defineObjects/> -<fmt:setBundle basename="hu.midori.kosmos.portlet.jira.jiramonitoringportlet" scope="application"/> +<fmt:setBundle basename="hu.midori.kosmos.portlet.jira.jira_monitoring" scope="application"/> <display:table name="${projects}" id="projectsIt" requestURI="<%=renderResponse.createRenderURL().toString() %>" requestURIcontext="false"> <c:set var="id" scope="page" value="${projectsIt.id}"/> @@ -26,24 +26,24 @@ <display:column titleKey="jiraproject.lead" style="white-space:nowrap" property="lead" sortable="true"/> <display:column titleKey="jiraproject.openIssues" style="white-space:nowrap" sortProperty="openIssues" sortable="true"> <c:if test="${projectsIt.openIssues > 10}"><span class="portlet-msg-error"></c:if> - <c:out value="${projectsIt.openIssues}"/> + <fmt:formatNumber value="${projectsIt.openIssues}"/> (<fmt:formatNumber value="${projectsIt.openIssues / projectsIt.totalIssues}" type="percent"/>) <c:if test="${projectsIt.openIssues > 10}"></span></c:if> </display:column> <display:column titleKey="jiraproject.codingInProgressIssues" style="white-space:nowrap" sortProperty="codingInProgressIssues" sortable="true"> - <c:out value="${projectsIt.codingInProgressIssues}"/> + <fmt:formatNumber value="${projectsIt.codingInProgressIssues}"/> (<fmt:formatNumber value="${projectsIt.codingInProgressIssues / projectsIt.totalIssues}" type="percent"/>) </display:column> <display:column titleKey="jiraproject.reopenedIssues" style="white-space:nowrap" sortProperty="reopenedIssues" sortable="true"> - <c:out value="${projectsIt.reopenedIssues}"/> + <fmt:formatNumber value="${projectsIt.reopenedIssues}"/> (<fmt:formatNumber value="${projectsIt.reopenedIssues / projectsIt.totalIssues}" type="percent"/>) </display:column> <display:column titleKey="jiraproject.resolvedIssues" style="white-space:nowrap" sortProperty="resolvedIssues" sortable="true"> - <c:out value="${projectsIt.resolvedIssues}"/> + <fmt:formatNumber value="${projectsIt.resolvedIssues}"/> (<fmt:formatNumber value="${projectsIt.resolvedIssues / projectsIt.totalIssues}" type="percent"/>) </display:column> <display:column titleKey="jiraproject.closedIssues" style="white-space:nowrap" sortProperty="closedIssues" sortable="true"> - <c:out value="${projectsIt.closedIssues}"/> + <fmt:formatNumber value="${projectsIt.closedIssues}"/> (<fmt:formatNumber value="${projectsIt.closedIssues / projectsIt.totalIssues}" type="percent"/>) </display:column> <display:column titleKey="jiraproject.issuesByStatus" sortProperty="openIssues" sortable="true"> Modified: trunk/labs/kosmos/web-portlet/pages/jira_monitoring_help.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/jira_monitoring_help.jsp 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/web-portlet/pages/jira_monitoring_help.jsp 2005-11-20 14:20:58 UTC (rev 1603) @@ -1,7 +1,7 @@ <%@include file="includes/taglibs.jsp"%> <portlet:defineObjects/> -<fmt:setBundle basename="hu.midori.kosmos.portlet.jira.jiramonitoringportlet" scope="application"/> +<fmt:setBundle basename="hu.midori.kosmos.portlet.jira.jira_monitoring" scope="application"/> <%@include file="includes/about.jsp"%> Modified: trunk/labs/kosmos/web-portlet/pages/jira_monitoring_issue_details.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/jira_monitoring_issue_details.jsp 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/web-portlet/pages/jira_monitoring_issue_details.jsp 2005-11-20 14:20:58 UTC (rev 1603) @@ -1,7 +1,7 @@ <%@include file="includes/taglibs.jsp"%> <portlet:defineObjects/> -<fmt:setBundle basename="hu.midori.kosmos.portlet.jira.jiramonitoringportlet" scope="application"/> +<fmt:setBundle basename="hu.midori.kosmos.portlet.jira.jira_monitoring" scope="application"/> <table> <tr class="portlet-section-body"> @@ -10,22 +10,22 @@ <td valign="top"> <table> <tr class="portlet-section-alternate"> - <td><fmt:message key="jiraproject.blockerOpenIssues"/>:</td><td><c:out value="${project.blockerOpenIssues}"/></td> + <td><fmt:message key="jiraproject.blockerOpenIssues"/>:</td><td><fmt:formatNumber value="${project.blockerOpenIssues}"/></td> </tr> <tr class="portlet-section-alternate"> - <td><fmt:message key="jiraproject.criticalOpenIssues"/>:</td><td><c:out value="${project.criticalOpenIssues}"/></td> + <td><fmt:message key="jiraproject.criticalOpenIssues"/>:</td><td><fmt:formatNumber value="${project.criticalOpenIssues}"/></td> </tr> <tr class="portlet-section-alternate"> - <td><fmt:message key="jiraproject.majorOpenIssues"/>:</td><td><c:out value="${project.majorOpenIssues}"/></td> + <td><fmt:message key="jiraproject.majorOpenIssues"/>:</td><td><fmt:formatNumber value="${project.majorOpenIssues}"/></td> </tr> <tr class="portlet-section-alternate"> - <td><fmt:message key="jiraproject.minorOpenIssues"/>:</td><td><c:out value="${project.minorOpenIssues}"/></td> + <td><fmt:message key="jiraproject.minorOpenIssues"/>:</td><td><fmt:formatNumber value="${project.minorOpenIssues}"/></td> </tr> <tr class="portlet-section-alternate"> - <td><fmt:message key="jiraproject.trivialOpenIssues"/>:</td><td><c:out value="${project.trivialOpenIssues}"/></td> + <td><fmt:message key="jiraproject.trivialOpenIssues"/>:</td><td><fmt:formatNumber value="${project.trivialOpenIssues}"/></td> </tr> <tr class="portlet-section-alternate"> - <td><fmt:message key="jiraproject.optionalOpenIssues"/>:</td><td><c:out value="${project.optionalOpenIssues}"/></td> + <td><fmt:message key="jiraproject.optionalOpenIssues"/>:</td><td><fmt:formatNumber value="${project.optionalOpenIssues}"/></td> </tr> </table> </td> Modified: trunk/labs/kosmos/web-portlet/pages/jira_monitoring_project_details.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/jira_monitoring_project_details.jsp 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/web-portlet/pages/jira_monitoring_project_details.jsp 2005-11-20 14:20:58 UTC (rev 1603) @@ -1,7 +1,7 @@ <%@include file="includes/taglibs.jsp"%> <portlet:defineObjects/> -<fmt:setBundle basename="hu.midori.kosmos.portlet.jira.jiramonitoringportlet" scope="application"/> +<fmt:setBundle basename="hu.midori.kosmos.portlet.jira.jira_monitoring" scope="application"/> <table> <tr class="portlet-section-body"> @@ -18,19 +18,19 @@ <td valign="top"> <table> <tr class="portlet-section-alternate"> - <td><fmt:message key="jiraproject.openIssues"/>:</td><td><c:out value="${project.openIssues}"/></td> + <td><fmt:message key="jiraproject.openIssues"/>:</td><td><fmt:formatNumber value="${project.openIssues}"/></td> </tr> <tr class="portlet-section-alternate"> - <td><fmt:message key="jiraproject.codingInProgressIssues"/>:</td><td><c:out value="${project.codingInProgressIssues}"/></td> + <td><fmt:message key="jiraproject.codingInProgressIssues"/>:</td><td><fmt:formatNumber value="${project.codingInProgressIssues}"/></td> </tr> <tr class="portlet-section-alternate"> - <td><fmt:message key="jiraproject.reopenedIssues"/>:</td><td><c:out value="${project.reopenedIssues}"/></td> + <td><fmt:message key="jiraproject.reopenedIssues"/>:</td><td><fmt:formatNumber value="${project.reopenedIssues}"/></td> </tr> <tr class="portlet-section-alternate"> - <td><fmt:message key="jiraproject.resolvedIssues"/>:</td><td><c:out value="${project.resolvedIssues}"/></td> + <td><fmt:message key="jiraproject.resolvedIssues"/>:</td><td><fmt:formatNumber value="${project.resolvedIssues}"/></td> </tr> <tr class="portlet-section-alternate"> - <td><fmt:message key="jiraproject.closedIssues"/>:</td><td><c:out value="${project.closedIssues}"/></td> + <td><fmt:message key="jiraproject.closedIssues"/>:</td><td><fmt:formatNumber value="${project.closedIssues}"/></td> </tr> </table> </td> Modified: trunk/labs/kosmos/web-portlet/pages/sf_monitoring.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/sf_monitoring.jsp 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/web-portlet/pages/sf_monitoring.jsp 2005-11-20 14:20:58 UTC (rev 1603) @@ -1,7 +1,7 @@ <%@include file="includes/taglibs.jsp"%> <portlet:defineObjects/> -<fmt:setBundle basename="hu.midori.kosmos.portlet.sf.sfmonitoringportlet" scope="application"/> +<fmt:setBundle basename="hu.midori.kosmos.portlet.sf.sf_monitoring" scope="application"/> <display:table name="${releases}" id="releasesIt" requestURI="<%=renderResponse.createRenderURL().toString() %>" requestURIcontext="false"> <display:column style="width:20px"> Modified: trunk/labs/kosmos/web-portlet/pages/sf_monitoring_help.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/sf_monitoring_help.jsp 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/web-portlet/pages/sf_monitoring_help.jsp 2005-11-20 14:20:58 UTC (rev 1603) @@ -1,7 +1,7 @@ <%@include file="includes/taglibs.jsp"%> <portlet:defineObjects/> -<fmt:setBundle basename="hu.midori.kosmos.portlet.sf.sfmonitoringportlet" scope="application"/> +<fmt:setBundle basename="hu.midori.kosmos.portlet.sf.sf_monitoring" scope="application"/> <%@include file="includes/about.jsp"%> Modified: trunk/labs/kosmos/web-portlet/pages/svn_monitoring.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/svn_monitoring.jsp 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/web-portlet/pages/svn_monitoring.jsp 2005-11-20 14:20:58 UTC (rev 1603) @@ -1,7 +1,7 @@ <%@include file="includes/taglibs.jsp"%> <portlet:defineObjects/> -<fmt:setBundle basename="hu.midori.kosmos.portlet.svn.svnmonitoringportlet" scope="application"/> +<fmt:setBundle basename="hu.midori.kosmos.portlet.svn.svn_monitoring" scope="application"/> <display:table name="${repositories}" id="repositoriesIt" requestURI="<%=renderResponse.createRenderURL().toString() %>" requestURIcontext="false"> <c:set var="id" scope="page" value="${repositoriesIt.id}"/> Modified: trunk/labs/kosmos/web-portlet/pages/svn_monitoring_activity_details.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/svn_monitoring_activity_details.jsp 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/web-portlet/pages/svn_monitoring_activity_details.jsp 2005-11-20 14:20:58 UTC (rev 1603) @@ -1,7 +1,7 @@ <%@include file="includes/taglibs.jsp"%> <portlet:defineObjects/> -<fmt:setBundle basename="hu.midori.kosmos.portlet.svn.svnmonitoringportlet" scope="application"/> +<fmt:setBundle basename="hu.midori.kosmos.portlet.svn.svn_monitoring" scope="application"/> <table> <tr class="portlet-section-body"> Modified: trunk/labs/kosmos/web-portlet/pages/svn_monitoring_help.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/svn_monitoring_help.jsp 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/web-portlet/pages/svn_monitoring_help.jsp 2005-11-20 14:20:58 UTC (rev 1603) @@ -1,7 +1,7 @@ <%@include file="includes/taglibs.jsp"%> <portlet:defineObjects/> -<fmt:setBundle basename="hu.midori.kosmos.portlet.svn.svnmonitoringportlet" scope="application"/> +<fmt:setBundle basename="hu.midori.kosmos.portlet.svn.svn_monitoring" scope="application"/> <%@include file="includes/about.jsp"%> Modified: trunk/labs/kosmos/web-portlet/pages/svn_monitoring_repository_details.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/svn_monitoring_repository_details.jsp 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/web-portlet/pages/svn_monitoring_repository_details.jsp 2005-11-20 14:20:58 UTC (rev 1603) @@ -1,7 +1,7 @@ <%@include file="includes/taglibs.jsp"%> <portlet:defineObjects/> -<fmt:setBundle basename="hu.midori.kosmos.portlet.svn.svnmonitoringportlet" scope="application"/> +<fmt:setBundle basename="hu.midori.kosmos.portlet.svn.svn_monitoring" scope="application"/> <table> <tr class="portlet-section-body"> Modified: trunk/labs/kosmos/web-portlet/pages/svn_monitoring_revision_details.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/svn_monitoring_revision_details.jsp 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/web-portlet/pages/svn_monitoring_revision_details.jsp 2005-11-20 14:20:58 UTC (rev 1603) @@ -1,7 +1,7 @@ <%@include file="includes/taglibs.jsp"%> <portlet:defineObjects/> -<fmt:setBundle basename="hu.midori.kosmos.portlet.svn.svnmonitoringportlet" scope="application"/> +<fmt:setBundle basename="hu.midori.kosmos.portlet.svn.svn_monitoring" scope="application"/> <table> <tr class="portlet-section-alternate"> Modified: trunk/labs/kosmos/web-server/WEB-INF/web.xml =================================================================== --- trunk/labs/kosmos/web-server/WEB-INF/web.xml 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/web-server/WEB-INF/web.xml 2005-11-20 14:20:58 UTC (rev 1603) @@ -11,7 +11,7 @@ <context-param> <param-name>locale</param-name> - <param-value>en</param-value> + <param-value>hu</param-value> </context-param> <servlet> Modified: trunk/labs/kosmos/xdocs/reference/reference-manual.xml =================================================================== --- trunk/labs/kosmos/xdocs/reference/reference-manual.xml 2005-11-20 13:21:12 UTC (rev 1602) +++ trunk/labs/kosmos/xdocs/reference/reference-manual.xml 2005-11-20 14:20:58 UTC (rev 1603) @@ -1497,7 +1497,7 @@ <portlet-class>hu.midori.kosmos.portlet.sf.SfMonitoringPortlet</portlet-class> <supported-locale>en</supported-locale> <supported-locale>hu</supported-locale> - <resource-bundle>hu.midori.kosmos.portlet.sf.sfmonitoringportlet</resource-bundle> + <resource-bundle>hu.midori.kosmos.portlet.sf.sf_monitoring</resource-bundle> <init-param> <name>monitored.resource</name> <value>Kosmos Dependencies</value> |
Author: aron.gombas Date: 2005-11-20 08:21:12 -0500 (Sun, 20 Nov 2005) New Revision: 1602 Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/cc/CcMonitoringPortlet.java trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/sf/SfMonitoringPortlet.java trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/svn/SvnMonitoringPortlet.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/AbstractKosmosService.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/CachedDataHandler.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/CachedDataStore.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcConstants.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraConstants.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraServiceImpl.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/sf/SfServiceImpl.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ChartUtils.java trunk/labs/kosmos/web-server/WEB-INF/web.xml Log: Initial impl. of localized charts Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/cc/CcMonitoringPortlet.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/cc/CcMonitoringPortlet.java 2005-11-20 11:54:52 UTC (rev 1601) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/cc/CcMonitoringPortlet.java 2005-11-20 13:21:12 UTC (rev 1602) @@ -66,7 +66,7 @@ log.error("Unable to connect to the service", ex); } - // get file-release list if the service was successfully set-up + // get project list if the service was successfully set-up Date timestamp = null; List<CcProject> projects = null; if(service != null) { Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/sf/SfMonitoringPortlet.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/sf/SfMonitoringPortlet.java 2005-11-20 11:54:52 UTC (rev 1601) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/sf/SfMonitoringPortlet.java 2005-11-20 13:21:12 UTC (rev 1602) @@ -65,7 +65,7 @@ log.error("Unable to connect to the service", ex); } - // get release list if the service was successfully set-up + // get file-release list if the service was successfully set-up Date timestamp = null; List<SfRelease> releases = null; if(service != null) { Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/svn/SvnMonitoringPortlet.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/svn/SvnMonitoringPortlet.java 2005-11-20 11:54:52 UTC (rev 1601) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/svn/SvnMonitoringPortlet.java 2005-11-20 13:21:12 UTC (rev 1602) @@ -66,7 +66,7 @@ log.error("Unable to connect to the service", ex); } - // get file-release list if the service was successfully set-up + // get repository list if the service was successfully set-up Date timestamp = null; List<SvnRepository> repositories = null; if(service != null) { Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/AbstractKosmosService.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/AbstractKosmosService.java 2005-11-20 11:54:52 UTC (rev 1601) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/AbstractKosmosService.java 2005-11-20 13:21:12 UTC (rev 1602) @@ -9,10 +9,17 @@ import java.io.InputStream; import java.util.Date; import java.util.HashMap; +import java.util.Locale; import java.util.Map; +import java.util.ResourceBundle; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.web.context.WebApplicationContext; /** * Each Kosmos service must extend this baseclass. Services are implemented as POJOs. @@ -20,12 +27,15 @@ * @author <a href="mailto:aro...@mi...">Aron Gombas</a> * @version $Id$ */ -public abstract class AbstractKosmosService { +public abstract class AbstractKosmosService implements ApplicationContextAware { private final static Log log = LogFactory.getLog(AbstractKosmosService.class); /** Cache timeout in milliseconds: a new request over this period will receive the cached result. */ - private static final int CACHE_TIMEOUT = 10*60*1000;// TODO should be externally configurable + private static final int CACHE_TIMEOUT = 10*60*1000; + /** Spring web-application context. */ + WebApplicationContext ctx; + /** * Caches the result to return by the concrete service. * The key is a service-specific unique string (e.g. a URL or dir name) and the value is a service-specific object. @@ -37,6 +47,10 @@ /** Pluggable cached data store implementation. */ private CachedDataStore store; + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + ctx = (WebApplicationContext)applicationContext; + } + public void setStore(CachedDataStore store) { this.store = store; } @@ -51,13 +65,18 @@ throw new IllegalStateException("Timestamp was not initialized yet. Call the service method before!"); return timestamp; - } + } + /** Updates the timestamp at cache updates. */ + private void setTimestamp(Date timestamp) { + this.timestamp = timestamp; + } + /** * Returns an object through the cache. * @see #cache */ - protected Object getFromCache(Object key, CachedDataHandler handler) { + protected Object getFromCache(Object key, CachedDataHandler handler) { // return info from cache if not expired yet and available Date now = new Date(); Object value = cache.get(key); @@ -67,7 +86,7 @@ } // retrieve info in case of cache miss - timestamp = now; + setTimestamp(now); if((value == null) || !handler.isDataUptodate(key)) { log.debug(String.format("Reloading \"%s\"...", key)); value = handler.reloadData(key); @@ -81,6 +100,20 @@ return value; } + /** TODO */ + protected String getResourcexxx(String baseName, String key) {// TODO rename + ResourceBundle res = null; + + // TODO lazy-init + if(res == null) { + String locale = ctx.getServletContext().getInitParameter("locale"); + log.info(" =======================================> locale: " + locale); + res = StringUtils.isBlank(locale) ? ResourceBundle.getBundle(baseName) : ResourceBundle.getBundle(baseName, new Locale(locale)); + } + + return res.getString(key); + } + /** * Stores the passed stream to an implementation-dependent "storage". * @return the absolute URL that points to the resulted file. Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/CachedDataHandler.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/CachedDataHandler.java 2005-11-20 11:54:52 UTC (rev 1601) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/CachedDataHandler.java 2005-11-20 13:21:12 UTC (rev 1602) @@ -19,9 +19,17 @@ * still up-to-date, even if there was a cache miss caused by timeout. * Implement it simply by returning <code>false</code> if it's not possible to detect * whether the data is still up-to-date without recalculating everything. + * + * @param language can be ignored if the data and the resources referenced by the + * data are not language-dependent. */ - public boolean isDataUptodate(Object key); + public boolean isDataUptodate(Object key);// TODO language ne legyen itt es csak azt vizsgalja, h az adatforras megvaltozott-e => isDataSourceUnchanged() - /** Reloads the service-specific data in the case of stale data (cache miss). */ + /** + * Reloads the service-specific data in the case of stale data (cache miss). + * + * @param language can be ignored if the data and the resources referenced by the + * data are not language-dependent. + */ public Object reloadData(Object key); } Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/CachedDataStore.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/CachedDataStore.java 2005-11-20 11:54:52 UTC (rev 1601) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/CachedDataStore.java 2005-11-20 13:21:12 UTC (rev 1602) @@ -21,5 +21,5 @@ * Stores the passed stream to an implementation-dependent "storage". * @return the absolute URL that points to the resulted file. */ - public String storeFile(String fileName, InputStream in) throws Exception; // TODO exception? + public String storeFile(String fileName, InputStream in) throws Exception; } Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcConstants.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcConstants.java 2005-11-20 11:54:52 UTC (rev 1601) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcConstants.java 2005-11-20 13:21:12 UTC (rev 1602) @@ -6,6 +6,7 @@ */ package hu.midori.kosmos.server.cc; +import java.awt.Color; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -20,7 +21,7 @@ public final static DateFormat CC_BUILD_DATEFORMAT = new SimpleDateFormat("yyyyMMddhhmmss"); /** Color code for the test categories. */ - public final static int SUCCESS_COLOR = 0x00FF00; - public final static int FAILURE_COLOR = 0xFF0000; - public final static int ERROR_COLOR = 0xDD0000; + public final static Color SUCCESS_COLOR = new Color(0x00FF00); + public final static Color FAILURE_COLOR = new Color(0xFF0000); + public final static Color ERROR_COLOR = new Color(0xDD0000); } Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java 2005-11-20 11:54:52 UTC (rev 1601) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java 2005-11-20 13:21:12 UTC (rev 1602) @@ -14,6 +14,7 @@ import hu.midori.kosmos.server.AbstractKosmosService; import hu.midori.kosmos.server.CachedDataHandler; import hu.midori.kosmos.server.util.ChartUtils; +import hu.midori.kosmos.server.util.ColorCodedKey; import hu.midori.kosmos.server.util.ScrapingUtils; import java.io.ByteArrayInputStream; @@ -128,16 +129,16 @@ testCases.add(new CcTest(result_, className, testCaseName)); } - + // generate chart - List<Map.Entry<Integer, Integer>> testsPerCategory = new ArrayList<Map.Entry<Integer, Integer>>(); + List<Map.Entry<ColorCodedKey, Integer>> testsPerCategory = new ArrayList<Map.Entry<ColorCodedKey, Integer>>(); int success = tests - errors - failures; if(success > 0) - testsPerCategory.addAll(Collections.singletonMap(CcConstants.SUCCESS_COLOR, success).entrySet()); + testsPerCategory.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.cc.ccmonitoringportlet", "ccproject.testsSucceded"), CcConstants.SUCCESS_COLOR), success).entrySet()); if(failures > 0) - testsPerCategory.addAll(Collections.singletonMap(CcConstants.FAILURE_COLOR, failures).entrySet()); + testsPerCategory.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.cc.ccmonitoringportlet", "ccproject.failures"), CcConstants.FAILURE_COLOR), failures).entrySet()); if(errors > 0) - testsPerCategory.addAll(Collections.singletonMap(CcConstants.ERROR_COLOR, errors).entrySet()); + testsPerCategory.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.cc.ccmonitoringportlet", "ccproject.errors"), CcConstants.ERROR_COLOR), errors).entrySet()); ByteArrayOutputStream out = new ByteArrayOutputStream(); ChartUtils.writeChartAsPng(ChartUtils.generateColorCodedPieChart(ChartUtils.collectionToPieDataset(testsPerCategory)), out); @@ -160,10 +161,10 @@ /** Finds the latest <i>CruiseControl</i> logfile in the dir. */ protected File findLatestLog(String dirName) { - File dir = new File(dirName); - if(!dir.isDirectory()) - throw new IllegalArgumentException(String.format("Unable to process CruiseControl logs from \"%s\"", dir)); - File files[] = dir.listFiles(new FilenameFilter() { + File monitoredDir = new File(dirName); + if(!monitoredDir.isDirectory()) + throw new IllegalArgumentException(String.format("Unable to process CruiseControl logs from \"%s\"", monitoredDir)); + File files[] = monitoredDir.listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(".xml"); } Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraConstants.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraConstants.java 2005-11-20 11:54:52 UTC (rev 1601) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraConstants.java 2005-11-20 13:21:12 UTC (rev 1602) @@ -6,6 +6,8 @@ */ package hu.midori.kosmos.server.jira; +import java.awt.Color; + /** * <i>JIRA</i>-related constants. * @@ -14,17 +16,17 @@ */ public class JiraConstants { /** Color codes for the issue statuses. */ - public final static int OPEN_COLOR = 0xFF0000; - public final static int CODING_IN_PROGRESS_COLOR = 0xFFFF00; - public final static int REOPENED_COLOR = 0xDD0000; - public final static int RESOLVED_COLOR = 0x00FF00; - public final static int CLOSED_COLOR = 0xDDDDDD; + public final static Color OPEN_COLOR = new Color(0xFF0000); + public final static Color CODING_IN_PROGRESS_COLOR = new Color(0xFFFF00); + public final static Color REOPENED_COLOR = new Color(0xDD0000); + public final static Color RESOLVED_COLOR = new Color(0x00FF00); + public final static Color CLOSED_COLOR = new Color(0xDDDDDD); /** Color codes for issue priorities. */ - public final static int BLOCKER_COLOR = 0xFF0000; - public final static int CRITICAL_COLOR = 0xEE0000; - public final static int MAJOR_COLOR = 0xDD0000; - public final static int MINOR_COLOR = 0xFFFF00; - public final static int TRIVIAL_COLOR = 0xEEEE00; - public final static int OPTIONAL_COLOR = 0xDDDDDD; + public final static Color BLOCKER_COLOR = new Color(0xFF0000); + public final static Color CRITICAL_COLOR = new Color(0xEE0000); + public final static Color MAJOR_COLOR = new Color(0xDD0000); + public final static Color MINOR_COLOR = new Color(0xFFFF00); + public final static Color TRIVIAL_COLOR = new Color(0xEEEE00); + public final static Color OPTIONAL_COLOR = new Color(0xDDDDDD); } Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraServiceImpl.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraServiceImpl.java 2005-11-20 11:54:52 UTC (rev 1601) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/jira/JiraServiceImpl.java 2005-11-20 13:21:12 UTC (rev 1602) @@ -11,6 +11,7 @@ import hu.midori.kosmos.server.AbstractKosmosService; import hu.midori.kosmos.server.CachedDataHandler; import hu.midori.kosmos.server.util.ChartUtils; +import hu.midori.kosmos.server.util.ColorCodedKey; import hu.midori.kosmos.server.util.ScrapingUtils; import java.io.ByteArrayInputStream; @@ -58,9 +59,12 @@ * </ul> */ private class JiraDataHandler implements CachedDataHandler { - /** There is no quick way to decide if the data is stale. */ + /** + * Returns <code>false</code> as there is no way to decide if the data is stale + * without completely recalculating everything. + */ public boolean isDataUptodate(Object key) { - return false; + return false; } public Object reloadData(Object key) { @@ -218,36 +222,36 @@ String openIssuesPerAssigneeChartUrl = storeFile(prefix + "_open_issues_per_assignee.png", new ByteArrayInputStream(out.toByteArray())); // generate issues-per-status chart - List<Map.Entry<Integer, Integer>> issuesPerStatusMap = new ArrayList<Map.Entry<Integer, Integer>>(); + List<Map.Entry<ColorCodedKey, Integer>> issuesPerStatusMap = new ArrayList<Map.Entry<ColorCodedKey, Integer>>(); if(openIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(JiraConstants.OPEN_COLOR, openIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.openIssues"), JiraConstants.OPEN_COLOR), openIssues).entrySet()); if(codingInProgressIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(JiraConstants.CODING_IN_PROGRESS_COLOR, codingInProgressIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.codingInProgressIssues"), JiraConstants.CODING_IN_PROGRESS_COLOR), codingInProgressIssues).entrySet()); if(reopenedIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(JiraConstants.REOPENED_COLOR, reopenedIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.reopenedIssues"), JiraConstants.REOPENED_COLOR), reopenedIssues).entrySet()); if(resolvedIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(JiraConstants.RESOLVED_COLOR, resolvedIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.resolvedIssues"), JiraConstants.RESOLVED_COLOR), resolvedIssues).entrySet()); if(closedIssues > 0) - issuesPerStatusMap.addAll(Collections.singletonMap(JiraConstants.CLOSED_COLOR, closedIssues).entrySet()); + issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.closedIssues"), JiraConstants.CLOSED_COLOR), closedIssues).entrySet()); out.reset(); ChartUtils.writeChartAsPng(ChartUtils.generateColorCodedPieChart(ChartUtils.collectionToPieDataset(issuesPerStatusMap)), out); String issuesPerStatusChartUrl = storeFile(prefix + "_issues_per_status.png", new ByteArrayInputStream(out.toByteArray())); // generate issues-per-priority chart - List<Map.Entry<Integer, Integer>> openIssuesPerPriorityMap = new ArrayList<Map.Entry<Integer, Integer>>(); + List<Map.Entry<ColorCodedKey, Integer>> openIssuesPerPriorityMap = new ArrayList<Map.Entry<ColorCodedKey, Integer>>(); if(blockerOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(JiraConstants.BLOCKER_COLOR, blockerOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.blockerOpenIssues"), JiraConstants.BLOCKER_COLOR), blockerOpenIssues).entrySet()); if(criticalOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(JiraConstants.CRITICAL_COLOR, criticalOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.criticalOpenIssues"), JiraConstants.CRITICAL_COLOR), criticalOpenIssues).entrySet()); if(majorOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(JiraConstants.MAJOR_COLOR, majorOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.majorOpenIssues"), JiraConstants.MAJOR_COLOR), majorOpenIssues).entrySet()); if(minorOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(JiraConstants.MINOR_COLOR, minorOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.minorOpenIssues"), JiraConstants.MINOR_COLOR), minorOpenIssues).entrySet()); if(trivialOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(JiraConstants.TRIVIAL_COLOR, trivialOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.trivialOpenIssues"), JiraConstants.TRIVIAL_COLOR), trivialOpenIssues).entrySet()); if(optionalOpenIssues > 0) - openIssuesPerPriorityMap.addAll(Collections.singletonMap(JiraConstants.OPTIONAL_COLOR, optionalOpenIssues).entrySet()); + openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourcexxx("hu.midori.kosmos.server.jira.jiramonitoringportlet", "jiraproject.optionalOpenIssues"), JiraConstants.OPTIONAL_COLOR), optionalOpenIssues).entrySet()); out.reset(); ChartUtils.writeChartAsPng(ChartUtils.generateColorCodedPieChart(ChartUtils.collectionToPieDataset(openIssuesPerPriorityMap)), out); Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/sf/SfServiceImpl.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/sf/SfServiceImpl.java 2005-11-20 11:54:52 UTC (rev 1601) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/sf/SfServiceImpl.java 2005-11-20 13:21:12 UTC (rev 1602) @@ -48,6 +48,7 @@ * from the <i>SourceForge</i> pages. */ private class SfDataHandler implements CachedDataHandler { + /** Returns <code>false</code> as it is very cheap to reload the SF page again. */ public boolean isDataUptodate(Object key) { return false; } Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java 2005-11-20 11:54:52 UTC (rev 1601) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/svn/SvnServiceImpl.java 2005-11-20 13:21:12 UTC (rev 1602) @@ -96,7 +96,7 @@ } } - public Object reloadData(Object key) { + public Object reloadData(Object key) {// TODO localize charts String url = key.toString(); List<SvnRepository> repositories = new ArrayList<SvnRepository>(); Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ChartUtils.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ChartUtils.java 2005-11-20 11:54:52 UTC (rev 1601) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ChartUtils.java 2005-11-20 13:21:12 UTC (rev 1602) @@ -21,7 +21,6 @@ import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartUtilities; import org.jfree.chart.JFreeChart; -import org.jfree.chart.labels.PieSectionLabelGenerator; import org.jfree.chart.plot.PiePlot; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; import org.jfree.data.general.DefaultPieDataset; @@ -69,10 +68,9 @@ } /** - * Returns the pie-chart generated from the passed data. - * The keys in the dataset are <code>Integer</code> objects to use as - * RGB color values with the appropriate pie sections. It also means - * that the keys won't appear in the pie labels. + * Returns the color-coded pie-chart generated from the passed data. + * The keys in the dataset are <code>ColorCodedKey</code> objects that + * specify both the pie section labels and the pie section colors. */ public static JFreeChart generateColorCodedPieChart(PieDataset dataset) { // generate chart @@ -81,14 +79,7 @@ // apply color-codes PiePlot plot = (PiePlot)chart.getPlot(); for(int i = 0; i < dataset.getItemCount(); i++) - plot.setSectionPaint(i, new Color((Integer)dataset.getKey(i))); - - // remove keys from the labels - plot.setLabelGenerator(new PieSectionLabelGenerator() { - public String generateSectionLabel(PieDataset dataset, Comparable key) { - return dataset.getValue(key).toString(); - } - }); + plot.setSectionPaint(i, ((ColorCodedKey)dataset.getKey(i)).getColor()); return chart; } Modified: trunk/labs/kosmos/web-server/WEB-INF/web.xml =================================================================== --- trunk/labs/kosmos/web-server/WEB-INF/web.xml 2005-11-20 11:54:52 UTC (rev 1601) +++ trunk/labs/kosmos/web-server/WEB-INF/web.xml 2005-11-20 13:21:12 UTC (rev 1602) @@ -8,7 +8,12 @@ <display-name>Kosmos Services Servlet</display-name> <description>Server component of Kosmos. Runs as a regular web application.</description> - + + <context-param> + <param-name>locale</param-name> + <param-value>en</param-value> + </context-param> + <servlet> <servlet-name>kosmos-services</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> @@ -18,4 +23,5 @@ <servlet-name>kosmos-services</servlet-name> <url-pattern>/kosmos-services/*</url-pattern> </servlet-mapping> + </web-app> |
From: <jbo...@li...> - 2005-11-20 11:55:09
|
Author: aron.gombas Date: 2005-11-20 06:54:52 -0500 (Sun, 20 Nov 2005) New Revision: 1601 Modified: trunk/labs/kosmos/web-portlet/pages/cc_monitoring_test_details.jsp Log: Decimal formatting added Modified: trunk/labs/kosmos/web-portlet/pages/cc_monitoring_test_details.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/cc_monitoring_test_details.jsp 2005-11-20 10:16:10 UTC (rev 1600) +++ trunk/labs/kosmos/web-portlet/pages/cc_monitoring_test_details.jsp 2005-11-20 11:54:52 UTC (rev 1601) @@ -11,7 +11,7 @@ <tr class="portlet-section-alternate"> <td><fmt:message key="ccproject.testsSucceded"/>:</td> <td colspan="2"> - <c:out value="${project.testsSucceded}"/> + <fmt:formatNumber value="${project.testsSucceded}"/> (<fmt:formatNumber value="${project.successRate}" type="percent"/>) </td> </tr> @@ -19,7 +19,7 @@ <td><fmt:message key="ccproject.failures"/>:</td> <td colspan="2"> <c:if test="${project.failures > 0}"><span class="portlet-msg-error"></c:if> - <c:out value="${project.failures}"/> + <fmt:formatNumber value="${project.failures}"/> (<fmt:formatNumber value="${project.failures / project.tests}" type="percent"/>) <c:if test="${project.failures > 0}"></span></c:if> </td> @@ -28,7 +28,7 @@ <td><fmt:message key="ccproject.errors"/>:</td> <td colspan="2"> <c:if test="${project.errors > 0}"><span class="portlet-msg-error"></c:if> - <c:out value="${project.errors}"/> + <fmt:formatNumber value="${project.errors}"/> (<fmt:formatNumber value="${project.errors / project.tests}" type="percent"/>) <c:if test="${project.errors > 0}"></span></c:if> </td> @@ -37,7 +37,7 @@ <td><fmt:message key="ccproject.tests"/>:</td> <td colspan="2"> <c:if test="${project.tests == 0}"><span class="portlet-msg-alert"></c:if> - <c:out value="${project.tests}"/> + <fmt:formatNumber value="${project.tests}"/> <c:if test="${project.tests == 0}"></span></c:if> </td> </tr> |
Author: wrzep Date: 2005-11-20 05:16:10 -0500 (Sun, 20 Nov 2005) New Revision: 1600 Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/ScoreAlgorithmFactory.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/WeightedScoreAlgorithmFactory.java Modified: trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java trunk/forge/portal-extensions/forge-status/project.xml trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusDescriptor.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/JiraStatusPlugin.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/ResolvedIssuesStatusPlugin.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/SvnStatusPlugin.java Log: added simlple project score calculating attempts to fix bug (getting data from kosmos-server) - minor code changes, changed hessian jar version, didn't help http://jira.jboss.com/jira/browse/JBLAB-415 Pawel Modified: trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java =================================================================== --- trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java 2005-11-19 19:49:35 UTC (rev 1599) +++ trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java 2005-11-20 10:16:10 UTC (rev 1600) @@ -141,6 +141,8 @@ ItemIF item = (ItemIF) allItemsArr[i]; DelegateContext nodeContext = new DelegateContext(); + // filling the context with item information + nodeContext.put("no", i+1); nodeContext.put("title", item.getTitle()); nodeContext.put("description", item.getDescription()); @@ -157,7 +159,13 @@ if (link != null) { nodeContext.put("link", link.toString()); } + + // itunes tags + + + // filling the context with enclosure information + ItemEnclosureIF enclosure = item.getEnclosure(); if (enclosure != null) { DelegateContext enclosureContext = nodeContext.next("enclosure-link"); @@ -171,6 +179,8 @@ } } + // filling the context with channel information + ChannelIF channel = item.getChannel(); nodeContext.put("channel-title", channel.getTitle()); Modified: trunk/forge/portal-extensions/forge-status/project.xml =================================================================== --- trunk/forge/portal-extensions/forge-status/project.xml 2005-11-19 19:49:35 UTC (rev 1599) +++ trunk/forge/portal-extensions/forge-status/project.xml 2005-11-20 10:16:10 UTC (rev 1600) @@ -61,15 +61,15 @@ <war.bundle>true</war.bundle> </properties> </dependency> + + <dependency> + <groupId>hessian</groupId> + <artifactId>hessian</artifactId> + <version>3.0.1</version> <!-- WE NEED 3.0.13 --> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> - <dependency> - <groupId>com.caucho</groupId> - <artifactId>hessian</artifactId> - <version>2.1.12</version> - <properties> - <war.bundle>true</war.bundle> - </properties> - </dependency> - </dependencies> </project> Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/ScoreAlgorithmFactory.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/ScoreAlgorithmFactory.java 2005-11-19 19:49:35 UTC (rev 1599) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/ScoreAlgorithmFactory.java 2005-11-20 10:16:10 UTC (rev 1600) @@ -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.status; + +import java.util.Collection; + +import org.jboss.forge.status.plugins.StatusPlugin; + +/** +* @author Pawel Wrzeszcz +*/ +public abstract class ScoreAlgorithmFactory { + + public abstract int calculateScore(String projectId, Collection<StatusPlugin> plugins); +} Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2005-11-19 19:49:35 UTC (rev 1599) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2005-11-20 10:16:10 UTC (rev 1600) @@ -51,31 +51,42 @@ import org.w3c.dom.NamedNodeMap; import org.jboss.forge.status.plugins.StatusPlugin; +import org.jboss.forge.status.plugins.OneStatusPlugin; +import org.jboss.forge.status.plugins.SvnStatusPlugin; /** * @author Pawel Wrzeszcz */ public class Status extends AbstractDescriptor { - private final static String PROJECT_ELEMENT = "project"; - private final static String PLUGIN_ELEMENT = "plugin"; + private final static String PROJECT_ELEMENT = "project"; + private final static String PLUGIN_ELEMENT = "plugin"; + + private final static String PLUGIN_ID_ELEMENT = "id"; + private final static String PLUGIN_NAME_ELEMENT = "name"; + private final static String PLUGIN_CLASS_ELEMENT = "class"; + private final static String PLUGIN_WEIGHT_ELEMENT = "weight"; + private String portalName; + private ScoreAlgorithmFactory scoreAlgorithm; private Set<String> projects; private List<StatusPlugin> plugins; - Status(String portalName, Node projectsRoot, Node pluginsRoot) { + Status(String portalName, Node projectsRoot, Node pluginsRoot, ScoreAlgorithmFactory scoreAlgorithm) { this.portalName = portalName; + this.scoreAlgorithm = scoreAlgorithm; - // Get the projects projects = new HashSet<String>(); projects = getStringsFromNode(projectsRoot, PROJECT_ELEMENT); // Get the plugins - Set<String> pluginsNames = getStringsFromNode(pluginsRoot, PLUGIN_ELEMENT); - plugins = getPlugins(pluginsNames); + HashSet<String> pluginElementSet = new HashSet<String>(); + pluginElementSet.add(PLUGIN_ELEMENT); + Set<Node> pluginsNodes = getChildNodesSet(pluginsRoot, pluginElementSet); + plugins = getPlugins(pluginsNodes); } @@ -99,7 +110,8 @@ } - // Fill context with appropiate values for each project + /* Fill the context with appropiate values (from each plugin) for each project, */ + /* including final score as well. */ int position = 1; for (Iterator iter = projects.iterator(); iter.hasNext(); position++) { @@ -118,6 +130,9 @@ projectContext.put("name", projectId); projectContext.put("position", position); + int projectScore = calculateScore(projectId); + projectContext.put("score", projectScore); + fillEntries(projectContext, projectId); } @@ -132,14 +147,24 @@ } } - List<StatusPlugin> getPlugins(Set<String> pluginsNames) { + List<StatusPlugin> getPlugins(Set<Node> pluginsNodes) { ArrayList<StatusPlugin> p = new ArrayList<StatusPlugin>(); - for (Iterator iter = pluginsNames.iterator(); iter.hasNext();) { - String pluginName = (String) iter.next(); + HashSet pluginsElements = new HashSet<String>(); + pluginsElements.add(PLUGIN_ID_ELEMENT); + pluginsElements.add(PLUGIN_NAME_ELEMENT); + pluginsElements.add(PLUGIN_CLASS_ELEMENT); + pluginsElements.add(PLUGIN_WEIGHT_ELEMENT); + + for (Iterator iter = pluginsNodes.iterator(); iter.hasNext();) { + Node pluginNode = (Node) iter.next(); + Map<String,Node> pluginProperties = getChildNodesMap(pluginNode, pluginsElements); + try { - Class pluginClass = Class.forName(pluginName); + String pluginClassString = XmlTools.unmarshallText(pluginProperties.get("class")); + System.out.println("pluginClassString " + pluginClassString); + Class pluginClass = Class.forName(pluginClassString); p.add((StatusPlugin) pluginClass.newInstance()); } catch (Exception e) { e.printStackTrace(); @@ -149,6 +174,9 @@ return p; } + private int calculateScore(String projectId) { + return scoreAlgorithm.calculateScore(projectId, plugins); + } /** * For the given Node, computes Set of it's child Nodes. Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusDescriptor.java 2005-11-19 19:49:35 UTC (rev 1599) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusDescriptor.java 2005-11-20 10:16:10 UTC (rev 1600) @@ -65,8 +65,9 @@ /* if ((root.getNodeType() == Node.ELEMENT_NODE) && (root.getNodeName().equals("projects"))) {}*/ - status = new Status(portalName, projectsRoot, pluginsRoot); + status = new Status(portalName, projectsRoot, pluginsRoot, new WeightedScoreAlgorithmFactory()); + fillContext(); } catch (Exception e) { Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/WeightedScoreAlgorithmFactory.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/WeightedScoreAlgorithmFactory.java 2005-11-19 19:49:35 UTC (rev 1599) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/WeightedScoreAlgorithmFactory.java 2005-11-20 10:16:10 UTC (rev 1600) @@ -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.status; + +import java.util.Collection; +import java.util.Map; +import java.util.HashMap; + +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import org.jboss.forge.status.plugins.StatusPlugin; + +/** +* @author Pawel Wrzeszcz +*/ +public class WeightedScoreAlgorithmFactory extends ScoreAlgorithmFactory { + + public WeightedScoreAlgorithmFactory() {} + + public int calculateScore(String projectId, Collection<StatusPlugin> plugins) { + return 17; + } +} Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/JiraStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/JiraStatusPlugin.java 2005-11-19 19:49:35 UTC (rev 1599) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/JiraStatusPlugin.java 2005-11-20 10:16:10 UTC (rev 1600) @@ -59,11 +59,14 @@ } else { System.out.println("KOSMOS service == null"); } - + /* System.out.println("***\nKOSMOS atlassian\n***"); jiraProjects = service.getProjects("http://jira.atlassian.com"); + + System.out.println("***\nKOSMOS jboss\n***"); jiraProjects = service.getProjects("http://jira.jboss.com"); + */ System.out.println("***\nKOSMOS jblab\n***"); jiraProjects = service.getProjects("http://jira.jboss.com/jira/browse/JBLAB"); Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/ResolvedIssuesStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/ResolvedIssuesStatusPlugin.java 2005-11-19 19:49:35 UTC (rev 1599) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/ResolvedIssuesStatusPlugin.java 2005-11-20 10:16:10 UTC (rev 1600) @@ -36,8 +36,8 @@ public String getId() { return PLUGIN_ID; }; public String getName() { return PLUGIN_NAME; }; - public ResolvedIssuesStatusPlugin() {}; + public ResolvedIssuesStatusPlugin() {getJiraProjects();}; - public String getValue(String projectId) { return "one :-)";} ; + public String getValue(String projectId) { return "3";} ; } \ No newline at end of file Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/SvnStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/SvnStatusPlugin.java 2005-11-19 19:49:35 UTC (rev 1599) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/SvnStatusPlugin.java 2005-11-20 10:16:10 UTC (rev 1600) @@ -35,16 +35,14 @@ public /*abstract*/ class SvnStatusPlugin extends StatusPlugin { - public SvnStatusPlugin() { - //this.getSvnRepositories(); - // TODO Auto-generated constructor stub - } + public SvnStatusPlugin() {getSvnRepositories();} protected static String PLUGIN_NAME = "Svn"; protected static String PLUGIN_ID = "svn"; public String getId() { return PLUGIN_ID; }; public String getName() { return PLUGIN_NAME; }; + public String getValue(String projectId) { return "###"; }; protected List<SvnRepository> getSvnRepositories() { @@ -83,9 +81,11 @@ */ System.out.println("KOSMOS jbosslabs trunk"); - repoUrl = "http://anonsvn.labs.jboss.com/trunk/forge/portal-extensions/"; + repoUrl = "http://anonsvn.labs.jboss.com/trunk/labs/demo"; try { + System.out.println("KOSMOS 02"); repositories = service.getRepositories(repoUrl); + System.out.println("KOSMOS 03"); SvnRepository repo = repositories.get(0); if (repo != null) { System.out.println("total commits " + repo.getCommitsTotal()); |
From: <jbo...@li...> - 2005-11-19 19:49:42
|
Author: wrzep Date: 2005-11-19 14:49:35 -0500 (Sat, 19 Nov 2005) New Revision: 1599 Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/SvnStatusPlugin.java Log: More flexible plugins parsing. Pawel Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2005-11-19 15:14:42 UTC (rev 1598) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2005-11-19 19:49:35 UTC (rev 1599) @@ -31,6 +31,7 @@ import java.util.HashSet; import java.util.List; import java.util.ArrayList; +import java.util.concurrent.Delayed; import org.jboss.forge.common.XmlTools; import org.jboss.forge.common.projects.AbstractDescriptor; @@ -75,8 +76,6 @@ // Get the plugins Set<String> pluginsNames = getStringsFromNode(pluginsRoot, PLUGIN_ELEMENT); plugins = getPlugins(pluginsNames); - - } @@ -88,23 +87,48 @@ */ public void fillContext(DelegateContext context) { - int i = 1; - for (Iterator iter = projects.iterator(); iter.hasNext(); i++) { + // Set collumns names + for (Iterator iter = plugins.iterator(); iter.hasNext();) { + StatusPlugin plugin = (StatusPlugin) iter.next(); + + DelegateContext collumnContext = new DelegateContext(); + collumnContext.put("name", plugin.getName()); + collumnContext.put("id", plugin.getId()); + + context.append("collumn", collumnContext); + } + + + // Fill context with appropiate values for each project + + int position = 1; + for (Iterator iter = projects.iterator(); iter.hasNext(); position++) { String projectName = (String) iter.next(); - DelegateContext projectContext = context.next("project"); - - projectContext.put("name", projectName); - projectContext.put("position", i); - fillProjectContext(projectContext, projectName); + DelegateContext projectContext = new DelegateContext(); + fillProjectContext(projectContext, projectName, position); + + context.append("project", projectContext); } } - private void fillProjectContext(DelegateContext projectContext, String projectId) { + private void fillProjectContext(DelegateContext projectContext, + String projectId, int position) { + + projectContext.put("name", projectId); + projectContext.put("position", position); + + fillEntries(projectContext, projectId); + } + + private void fillEntries(DelegateContext projectContext, String projectId) { for (Iterator iter = plugins.iterator(); iter.hasNext();) { StatusPlugin plugin = (StatusPlugin) iter.next(); + + DelegateContext entryContext = new DelegateContext(); + entryContext.put("value", plugin.getValue(projectId)); - projectContext.put(plugin.getId(), plugin.getValue(projectId)); + projectContext.append("entry", entryContext); } } @@ -122,8 +146,6 @@ } } - -// p.add(new OneStatusPlugin()); return p; } Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/SvnStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/SvnStatusPlugin.java 2005-11-19 15:14:42 UTC (rev 1598) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/SvnStatusPlugin.java 2005-11-19 19:49:35 UTC (rev 1599) @@ -26,55 +26,82 @@ import com.caucho.hessian.client.HessianProxyFactory; -import hu.midori.kosmos.protocol.JiraService; import hu.midori.kosmos.protocol.SvnService; -import hu.midori.kosmos.server.jira.JiraServiceImpl; -import hu.midori.kosmos.model.JiraProject; +import hu.midori.kosmos.model.SvnRepository; /** * @author Pawel Wrzeszcz */ -public abstract class SvnStatusPlugin extends StatusPlugin { +public /*abstract*/ class SvnStatusPlugin extends StatusPlugin { - protected List<JiraProject> getJiraProjects() { + public SvnStatusPlugin() { + //this.getSvnRepositories(); + // TODO Auto-generated constructor stub + } + + protected static String PLUGIN_NAME = "Svn"; + protected static String PLUGIN_ID = "svn"; + + public String getId() { return PLUGIN_ID; }; + public String getName() { return PLUGIN_NAME; }; + public String getValue(String projectId) { return "###"; }; + + protected List<SvnRepository> getSvnRepositories() { //Get the projects from kosmo server - - - List<JiraProject> jiraProjects = null; + List<SvnRepository> repositories = null; System.out.println("KOSMOS 00"); - JiraService service = null; + SvnService service = null; System.out.println("KOSMOS 001"); HessianProxyFactory factory = new HessianProxyFactory(); System.out.println("KOSMOS 002"); - String serviceUrl = "http://localhost:8080/kosmos-server/kosmos-services/jira-service"; + String serviceUrl = "http://localhost:8080/kosmos-server/kosmos-services/svn-service"; System.out.println("KOSMOS 003"); try { System.out.println("KOSMOS 01"); - service = (JiraService) factory.create(JiraService.class, serviceUrl); + service = (SvnService) factory.create(SvnService.class, serviceUrl); if (service != null) { System.out.println("KOSMOS service: " + service.toString()); } else { System.out.println("KOSMOS service == null"); } - System.out.println("***\nKOSMOS atlassian\n***"); - jiraProjects = service.getProjects("http://jira.atlassian.com"); - System.out.println("***\nKOSMOS jboss\n***"); - jiraProjects = service.getProjects("http://jira.jboss.com"); - System.out.println("***\nKOSMOS jblab\n***"); - jiraProjects = service.getProjects("http://jira.jboss.com/jira/browse/JBLAB"); + String repoUrl; + /* + System.out.println("KOSMOS ant"); + repoUrl = "http://svn.apache.org/repos/asf/ant"; + repositories = service.getRepositories(repoUrl); + + System.out.println("KOSMOS jbosslabs"); + repoUrl = "http://anonsvn.labs.jboss.com/"; + repositories = service.getRepositories(repoUrl); + */ + + System.out.println("KOSMOS jbosslabs trunk"); + repoUrl = "http://anonsvn.labs.jboss.com/trunk/forge/portal-extensions/"; + try { + repositories = service.getRepositories(repoUrl); + SvnRepository repo = repositories.get(0); + if (repo != null) { + System.out.println("total commits " + repo.getCommitsTotal()); + } else { + System.out.println("repo == null"); + } + } catch (Exception e) { + e.printStackTrace(); + } + System.out.println("KOSMOS FF"); } catch (Exception e) { e.printStackTrace(); } - return jiraProjects; + return repositories; } } |
From: <jbo...@li...> - 2005-11-19 15:14:50
|
Author: wrzep Date: 2005-11-19 10:14:42 -0500 (Sat, 19 Nov 2005) New Revision: 1598 Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/JiraStatusPlugin.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/OneStatusPlugin.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/ResolvedIssuesStatusPlugin.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/StatusPlugin.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/SvnStatusPlugin.java Removed: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/OneStatusPlugin.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPlugin.java Modified: trunk/forge/portal-extensions/forge-status/project.xml trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java Log: plugins hierarchy (will be extended) Pawel Modified: trunk/forge/portal-extensions/forge-status/project.xml =================================================================== --- trunk/forge/portal-extensions/forge-status/project.xml 2005-11-18 23:47:08 UTC (rev 1597) +++ trunk/forge/portal-extensions/forge-status/project.xml 2005-11-19 15:14:42 UTC (rev 1598) @@ -52,15 +52,24 @@ </properties> </dependency> - <dependency> + <dependency> <groupId>kosmos</groupId> <artifactId>kosmos</artifactId> <jar>kosmos-server.jar</jar> <version>1.0</version> <properties> - <war.bundle>true</war.bundle> + <war.bundle>true</war.bundle> </properties> </dependency> + <dependency> + <groupId>com.caucho</groupId> + <artifactId>hessian</artifactId> + <version>2.1.12</version> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + </dependencies> </project> Deleted: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/OneStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/OneStatusPlugin.java 2005-11-18 23:47:08 UTC (rev 1597) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/OneStatusPlugin.java 2005-11-19 15:14:42 UTC (rev 1598) @@ -1,37 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.jboss.forge.status; - -/** -* @author Pawel Wrzeszcz -*/ - -public class OneStatusPlugin implements StatusPlugin { - - public OneStatusPlugin() {}; - - public String getId() { return "one"; }; - public String getName() { return "One"; }; - public String getValue(String projectId) { return "one :-)";} ; - -} Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2005-11-18 23:47:08 UTC (rev 1597) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2005-11-19 15:14:42 UTC (rev 1598) @@ -22,6 +22,7 @@ package org.jboss.forge.status; +import java.net.MalformedURLException; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -48,8 +49,7 @@ import org.w3c.dom.NodeList; import org.w3c.dom.NamedNodeMap; -import hu.midori.kosmos.server.jira.JiraServiceImpl; -import hu.midori.kosmos.model.JiraProject; +import org.jboss.forge.status.plugins.StatusPlugin; /** * @author Pawel Wrzeszcz @@ -67,6 +67,7 @@ Status(String portalName, Node projectsRoot, Node pluginsRoot) { this.portalName = portalName; + // Get the projects projects = new HashSet<String>(); projects = getStringsFromNode(projectsRoot, PROJECT_ELEMENT); @@ -74,20 +75,12 @@ // Get the plugins Set<String> pluginsNames = getStringsFromNode(pluginsRoot, PLUGIN_ELEMENT); plugins = getPlugins(pluginsNames); + + } - // Get the projects from kosmo server + - JiraServiceImpl kosmosService = new JiraServiceImpl(); - - List<JiraProject> jiraProjects = kosmosService.getProjects("http://jira.jboss.com"); - /* - for (Iterator iter = jiraProjects.iterator(); iter.hasNext();) { - JiraProject project = (JiraProject) iter.next(); - projects.add(project.getName()); - } - */ - /** * Fills the given context with podcast information. * @@ -130,7 +123,7 @@ } - p.add(new OneStatusPlugin()); +// p.add(new OneStatusPlugin()); return p; } Deleted: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPlugin.java 2005-11-18 23:47:08 UTC (rev 1597) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPlugin.java 2005-11-19 15:14:42 UTC (rev 1598) @@ -1,35 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.jboss.forge.status; - -/** -* @author Pawel Wrzeszcz -*/ - -public abstract interface StatusPlugin { - - public String getId(); - public String getName(); - public String getValue(String projectId); - -} Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/JiraStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/JiraStatusPlugin.java 2005-11-18 23:47:08 UTC (rev 1597) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/JiraStatusPlugin.java 2005-11-19 15:14:42 UTC (rev 1598) @@ -0,0 +1,78 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.forge.status.plugins; + +import java.util.List; + +import com.caucho.hessian.client.HessianProxyFactory; + +import hu.midori.kosmos.protocol.JiraService; +import hu.midori.kosmos.protocol.SvnService; +import hu.midori.kosmos.server.jira.JiraServiceImpl; +import hu.midori.kosmos.model.JiraProject; + +/** +* @author Pawel Wrzeszcz +*/ + +public abstract class JiraStatusPlugin extends StatusPlugin { + + protected List<JiraProject> getJiraProjects() { + //Get the projects from kosmo server + + List<JiraProject> jiraProjects = null; + + System.out.println("KOSMOS 00"); + JiraService service = null; + System.out.println("KOSMOS 001"); + HessianProxyFactory factory = new HessianProxyFactory(); + System.out.println("KOSMOS 002"); + String serviceUrl = "http://localhost:8080/kosmos-server/kosmos-services/jira-service"; + System.out.println("KOSMOS 003"); + + try { + + System.out.println("KOSMOS 01"); + service = (JiraService) factory.create(JiraService.class, serviceUrl); + if (service != null) { + System.out.println("KOSMOS service: " + service.toString()); + } else { + System.out.println("KOSMOS service == null"); + } + + System.out.println("***\nKOSMOS atlassian\n***"); + jiraProjects = service.getProjects("http://jira.atlassian.com"); + System.out.println("***\nKOSMOS jboss\n***"); + jiraProjects = service.getProjects("http://jira.jboss.com"); + System.out.println("***\nKOSMOS jblab\n***"); + jiraProjects = service.getProjects("http://jira.jboss.com/jira/browse/JBLAB"); + + System.out.println("KOSMOS FF"); + } catch (Exception e) { + e.printStackTrace(); + } + + return jiraProjects; + } + +} Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/OneStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/OneStatusPlugin.java 2005-11-18 23:47:08 UTC (rev 1597) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/OneStatusPlugin.java 2005-11-19 15:14:42 UTC (rev 1598) @@ -0,0 +1,41 @@ +/* + * 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; + +/** +* @author Pawel Wrzeszcz +*/ + +public class OneStatusPlugin extends StatusPlugin { + + protected static String PLUGIN_NAME = "One"; + protected static String PLUGIN_ID = "one"; + + public OneStatusPlugin() {}; + + public String getId() { return PLUGIN_ID; }; + public String getName() { return PLUGIN_NAME; }; + + public String getValue(String projectId) { return "one :-)";} ; + +} Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/ResolvedIssuesStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/ResolvedIssuesStatusPlugin.java 2005-11-18 23:47:08 UTC (rev 1597) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/ResolvedIssuesStatusPlugin.java 2005-11-19 15:14:42 UTC (rev 1598) @@ -0,0 +1,43 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.forge.status.plugins; + +import java.util.List; + +/** +* @author Pawel Wrzeszcz +*/ + +public class ResolvedIssuesStatusPlugin extends JiraStatusPlugin { + + protected static String PLUGIN_NAME = "Resolved issues"; + protected static String PLUGIN_ID = "resoved"; + + public String getId() { return PLUGIN_ID; }; + public String getName() { return PLUGIN_NAME; }; + + public ResolvedIssuesStatusPlugin() {}; + + public String getValue(String projectId) { return "one :-)";} ; + +} \ No newline at end of file Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/StatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/StatusPlugin.java 2005-11-18 23:47:08 UTC (rev 1597) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/StatusPlugin.java 2005-11-19 15:14:42 UTC (rev 1598) @@ -0,0 +1,37 @@ +/* + * 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; + +/** +* @author Pawel Wrzeszcz +*/ + +public abstract class StatusPlugin { + + public abstract String getId(); + + public abstract String getName(); + + public abstract String getValue(String projectId); + +} Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/SvnStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/SvnStatusPlugin.java 2005-11-18 23:47:08 UTC (rev 1597) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/SvnStatusPlugin.java 2005-11-19 15:14:42 UTC (rev 1598) @@ -0,0 +1,80 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.forge.status.plugins; + +import java.util.List; + +import com.caucho.hessian.client.HessianProxyFactory; + +import hu.midori.kosmos.protocol.JiraService; +import hu.midori.kosmos.protocol.SvnService; +import hu.midori.kosmos.server.jira.JiraServiceImpl; +import hu.midori.kosmos.model.JiraProject; + +/** +* @author Pawel Wrzeszcz +*/ + +public abstract class SvnStatusPlugin extends StatusPlugin { + + protected List<JiraProject> getJiraProjects() { + //Get the projects from kosmo server + + + + List<JiraProject> jiraProjects = null; + + System.out.println("KOSMOS 00"); + JiraService service = null; + System.out.println("KOSMOS 001"); + HessianProxyFactory factory = new HessianProxyFactory(); + System.out.println("KOSMOS 002"); + String serviceUrl = "http://localhost:8080/kosmos-server/kosmos-services/jira-service"; + System.out.println("KOSMOS 003"); + + try { + + System.out.println("KOSMOS 01"); + service = (JiraService) factory.create(JiraService.class, serviceUrl); + if (service != null) { + System.out.println("KOSMOS service: " + service.toString()); + } else { + System.out.println("KOSMOS service == null"); + } + + System.out.println("***\nKOSMOS atlassian\n***"); + jiraProjects = service.getProjects("http://jira.atlassian.com"); + System.out.println("***\nKOSMOS jboss\n***"); + jiraProjects = service.getProjects("http://jira.jboss.com"); + System.out.println("***\nKOSMOS jblab\n***"); + jiraProjects = service.getProjects("http://jira.jboss.com/jira/browse/JBLAB"); + + System.out.println("KOSMOS FF"); + } catch (Exception e) { + e.printStackTrace(); + } + + return jiraProjects; + } + +} |
From: <jbo...@li...> - 2005-11-18 23:47:10
|
Author: dam...@jb... Date: 2005-11-18 18:47:08 -0500 (Fri, 18 Nov 2005) New Revision: 1597 Modified: trunk/forge/portal-extensions/forge-blog/src/web/WEB-INF/portlet.xml Log: Changed the number of entries/headers/blah to 50. Modified: trunk/forge/portal-extensions/forge-blog/src/web/WEB-INF/portlet.xml =================================================================== --- trunk/forge/portal-extensions/forge-blog/src/web/WEB-INF/portlet.xml 2005-11-18 23:33:06 UTC (rev 1596) +++ trunk/forge/portal-extensions/forge-blog/src/web/WEB-INF/portlet.xml 2005-11-18 23:47:08 UTC (rev 1597) @@ -14,17 +14,17 @@ <description>Number of headers to display in a normal, not-main portlet. The following should be true: headersNormal (less or equal to) showEntries+headersMaximized.</description> <name>headersNormal</name> - <value>5</value> + <value>50</value> </init-param> <init-param> <description>Number of entries to display in a main page or maximized portlet.</description> <name>showEntries</name> - <value>3</value> + <value>50</value> </init-param> <init-param> <description>Number of headers to display in a main page or maximized portlet.</description> <name>headersMaximized</name> - <value>2</value> + <value>50</value> </init-param> <init-param> <description>Address of the blog's local feed.</description> |
From: <jbo...@li...> - 2005-11-18 23:33:17
|
Author: adamw Date: 2005-11-18 18:33:06 -0500 (Fri, 18 Nov 2005) New Revision: 1596 Modified: trunk/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/etc/velocity.properties trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnRepository.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/etc/mime-types.txt Log: Velocity logging fixes, mime type for m4v Modified: trunk/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java =================================================================== --- trunk/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java 2005-11-18 20:37:00 UTC (rev 1595) +++ trunk/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java 2005-11-18 23:33:06 UTC (rev 1596) @@ -22,7 +22,6 @@ package org.jboss.forge.projects.freezone; import java.io.IOException; -import java.util.Enumeration; import java.util.List; import javax.portlet.PortletException; Modified: trunk/forge/portal-extensions/shotoku/shotoku-base/src/etc/velocity.properties =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/etc/velocity.properties 2005-11-18 20:37:00 UTC (rev 1595) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/etc/velocity.properties 2005-11-18 23:33:06 UTC (rev 1596) @@ -3,3 +3,5 @@ shotoku.resource.loader.class=org.jboss.shotoku.velocity.ShotokuResourceLoader shotoku.resource.loader.cache=true shotoku.resource.loader.modificationCheckInterval=2 + +runtime.log.logsystem.class=org.apache.velocity.runtime.log.NullLogSystem \ No newline at end of file Modified: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java 2005-11-18 20:37:00 UTC (rev 1595) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java 2005-11-18 23:33:06 UTC (rev 1596) @@ -22,6 +22,7 @@ package org.jboss.shotoku; import java.lang.reflect.Constructor; +import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Properties; @@ -54,7 +55,7 @@ * The key is a string representation of parameters with which an * engine was initialized. */ - private Map<String, VelocityEngine> engines; + private static Map<String, VelocityEngine> engines; /** * Gets a root directory that is represented by this content manager. @@ -150,6 +151,7 @@ representation += key + "=" + overProps.get(key) + ","; } + representation += ";" + prefix + ";" + id + ";"; representation += addIdPrefix; VelocityEngine ve = engines.get(representation); @@ -176,8 +178,6 @@ protected ContentManager(String id, String prefix) { this.id = id; this.prefix = prefix; - - engines = new HashMap<String, VelocityEngine>(); } /* @@ -199,6 +199,8 @@ private static Map<String, Constructor> contentManagers; static { + engines = Collections.synchronizedMap(new HashMap<String, VelocityEngine>()); + contentManagers = new HashMap<String, Constructor>(); // Loading configuration file. Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/etc/mime-types.txt =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/etc/mime-types.txt 2005-11-18 20:37:00 UTC (rev 1595) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/etc/mime-types.txt 2005-11-18 23:33:06 UTC (rev 1596) @@ -685,7 +685,7 @@ video/dl dl video/fli fli video/gl gl -video/mpeg mpeg mpg mpe +video/mpeg mpeg mpg mpe m4v video/mp4 mp4 video/quicktime qt mov video/mp4v-es Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnRepository.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnRepository.java 2005-11-18 20:37:00 UTC (rev 1595) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnRepository.java 2005-11-18 23:33:06 UTC (rev 1596) @@ -93,7 +93,7 @@ /** * Tries to perform a cleanup on the local working copy. Called in case - * of execptions that occure while performing other operations. + * of exceptions that occure while performing other operations. */ private void tryCleanup() { try { |
From: <jbo...@li...> - 2005-11-18 20:37:10
|
Author: wrzep Date: 2005-11-18 15:37:00 -0500 (Fri, 18 Nov 2005) New Revision: 1595 Modified: trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastDescriptor.java trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastNodeWatcher.java trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastPortlet.java trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastTools.java Log: Provided support for local podcasts adresses (/feeds/project/... paths in podcast.xml) Pawel Modified: trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java =================================================================== --- trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java 2005-11-18 19:13:47 UTC (rev 1594) +++ trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java 2005-11-18 20:37:00 UTC (rev 1595) @@ -87,14 +87,16 @@ private static final int BYTES_IN_MB = (1024*1024); private String portalName; + private String serverAdress; /** * <code>allItemsArr</code> - Array if ItemIF objects, containing items from all feeds. */ private Object[] allItemsArr; - Podcast(String portalName, Node root) { + Podcast(String portalName, String serverAdress, Node root) { this.portalName = portalName; + this.serverAdress = serverAdress; podcastsNumber = getPodcastsNumber(root); @@ -247,8 +249,13 @@ Map nodeProperties = (Map<String,Node>) iter.next(); Node urlNode = (Node) nodeProperties.get(URL_ELEMENT); - URL url = new URL(XmlTools.unmarshallText(urlNode)); + String urlString = XmlTools.unmarshallText(urlNode); + if (urlString.charAt(0) == '/') { // local link + urlString = serverAdress + urlString; + } + URL url = new URL(urlString); + ChannelIF channel = FeedParser.parse(new ChannelBuilder(), url); ret.addAll(channel.getItems()); Modified: trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastDescriptor.java 2005-11-18 19:13:47 UTC (rev 1594) +++ trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastDescriptor.java 2005-11-18 20:37:00 UTC (rev 1595) @@ -55,7 +55,7 @@ private HashSet<String> feeds; - public PodcastDescriptor(String portalName, ContentManager cm) { + public PodcastDescriptor(String portalName, String serverAdress, ContentManager cm) { try { feeds = new HashSet<String>(); @@ -68,7 +68,7 @@ if ((root.getNodeType() == Node.ELEMENT_NODE) && (root.getNodeName().equals(Podcast.PODCAST_ELEMENT))) { - podcast = new Podcast(portalName, root); + podcast = new Podcast(portalName, serverAdress, root); } fillContext(); Modified: trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastNodeWatcher.java =================================================================== --- trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastNodeWatcher.java 2005-11-18 19:13:47 UTC (rev 1594) +++ trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastNodeWatcher.java 2005-11-18 20:37:00 UTC (rev 1595) @@ -34,13 +34,15 @@ public class PodcastNodeWatcher implements NodeWatcher { private ResourceWatcher rw; private ContentManager cm; + private String serverAdress; - public PodcastNodeWatcher(ContentManager cm) { + public PodcastNodeWatcher(ContentManager cm, String serverAdress) { this.cm = cm; + this.serverAdress = serverAdress; } private PodcastDescriptor getDesc(String portalName) { - PodcastDescriptor desc = new PodcastDescriptor(portalName, cm); + PodcastDescriptor desc = new PodcastDescriptor(portalName, serverAdress, cm); rw = new ResourceWatcher(cm); rw.watchResource(PodcastTools.getXmlCmPath(portalName)); Modified: trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastPortlet.java =================================================================== --- trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastPortlet.java 2005-11-18 19:13:47 UTC (rev 1594) +++ trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastPortlet.java 2005-11-18 20:37:00 UTC (rev 1595) @@ -51,9 +51,10 @@ response.setContentType("text/html"); String portalName = ForgeHelper.getPortalName(request); + String serverAdress = ForgeHelper.getBaseServerAddress(request); // Getting the podcast context - DelegateContext context = PodcastTools.getDesc(portalName).getContext(request); + DelegateContext context = PodcastTools.getDesc(portalName, serverAdress).getContext(request); // Displaying the JSP request.setAttribute(PortalJsp.CTX_REQUEST, context); Modified: trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastTools.java =================================================================== --- trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastTools.java 2005-11-18 19:13:47 UTC (rev 1594) +++ trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastTools.java 2005-11-18 20:37:00 UTC (rev 1595) @@ -41,7 +41,8 @@ return PODCAST_JSP_DIR + "/" + PODCAST_JSP; } - public static synchronized PodcastDescriptor getDesc(final String portalName) { + public static synchronized PodcastDescriptor getDesc(final String portalName, + final String serverAdress) { String cacheKey = PodcastDescriptor.class.getName(); PodcastDescriptor desc = (PodcastDescriptor) ForgeHelper @@ -51,7 +52,7 @@ desc = (PodcastDescriptor) ForgeHelper.getForgeManagement() .addNodeWatcher(portalName, cacheKey, - new PodcastNodeWatcher(cm)); + new PodcastNodeWatcher(cm, serverAdress)); return desc; } |
From: <jbo...@li...> - 2005-11-18 19:13:58
|
Author: wrzep Date: 2005-11-18 14:13:47 -0500 (Fri, 18 Nov 2005) New Revision: 1594 Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/OneStatusPlugin.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPlugin.java Modified: trunk/forge/portal-extensions/forge-status/project.xml trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusDescriptor.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusTools.java Log: plugins interface Pawel Modified: trunk/forge/portal-extensions/forge-status/project.xml =================================================================== --- trunk/forge/portal-extensions/forge-status/project.xml 2005-11-18 19:12:56 UTC (rev 1593) +++ trunk/forge/portal-extensions/forge-status/project.xml 2005-11-18 19:13:47 UTC (rev 1594) @@ -51,5 +51,16 @@ <war.bundle>true</war.bundle> </properties> </dependency> + + <dependency> + <groupId>kosmos</groupId> + <artifactId>kosmos</artifactId> + <jar>kosmos-server.jar</jar> + <version>1.0</version> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + </dependencies> </project> Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/OneStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/OneStatusPlugin.java 2005-11-18 19:12:56 UTC (rev 1593) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/OneStatusPlugin.java 2005-11-18 19:13:47 UTC (rev 1594) @@ -0,0 +1,37 @@ +/* + * 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; + +/** +* @author Pawel Wrzeszcz +*/ + +public class OneStatusPlugin implements StatusPlugin { + + public OneStatusPlugin() {}; + + public String getId() { return "one"; }; + public String getName() { return "One"; }; + public String getValue(String projectId) { return "one :-)";} ; + +} Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2005-11-18 19:12:56 UTC (rev 1593) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2005-11-18 19:13:47 UTC (rev 1594) @@ -23,10 +23,13 @@ package org.jboss.forge.status; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.HashMap; import java.util.Set; import java.util.HashSet; +import java.util.List; +import java.util.ArrayList; import org.jboss.forge.common.XmlTools; import org.jboss.forge.common.projects.AbstractDescriptor; @@ -45,38 +48,46 @@ import org.w3c.dom.NodeList; import org.w3c.dom.NamedNodeMap; +import hu.midori.kosmos.server.jira.JiraServiceImpl; +import hu.midori.kosmos.model.JiraProject; + /** * @author Pawel Wrzeszcz */ public class Status extends AbstractDescriptor { private final static String PROJECT_ELEMENT = "project"; + private final static String PLUGIN_ELEMENT = "plugin"; private String portalName; - /** - * <code>allItemsArr</code> - Array if ItemIF objects, containing items from all feeds. - */ - private HashSet<String> projects; + private Set<String> projects; + private List<StatusPlugin> plugins; - Status(String portalName, Node root) { + Status(String portalName, Node projectsRoot, Node pluginsRoot) { this.portalName = portalName; - // Get the projects nodes + // Get the projects projects = new HashSet<String>(); + projects = getStringsFromNode(projectsRoot, PROJECT_ELEMENT); - HashSet<String> projectNodes = new HashSet(); - projectNodes.add(PROJECT_ELEMENT); - - Set<Node> prjNodes; - prjNodes = getChildNodesSet(root, projectNodes); - - for (Iterator iter = prjNodes.iterator(); iter.hasNext();) { - Node n = (Node) iter.next(); - projects.add(XmlTools.unmarshallText(n)); - } + // Get the plugins + Set<String> pluginsNames = getStringsFromNode(pluginsRoot, PLUGIN_ELEMENT); + plugins = getPlugins(pluginsNames); } + // Get the projects from kosmo server + + JiraServiceImpl kosmosService = new JiraServiceImpl(); + + List<JiraProject> jiraProjects = kosmosService.getProjects("http://jira.jboss.com"); + /* + for (Iterator iter = jiraProjects.iterator(); iter.hasNext();) { + JiraProject project = (JiraProject) iter.next(); + projects.add(project.getName()); + } + */ + /** * Fills the given context with podcast information. * @@ -89,12 +100,40 @@ String projectName = (String) iter.next(); DelegateContext projectContext = context.next("project"); - + projectContext.put("name", projectName); projectContext.put("position", i); + fillProjectContext(projectContext, projectName); } } + + private void fillProjectContext(DelegateContext projectContext, String projectId) { + for (Iterator iter = plugins.iterator(); iter.hasNext();) { + StatusPlugin plugin = (StatusPlugin) iter.next(); + + projectContext.put(plugin.getId(), plugin.getValue(projectId)); + } + } + List<StatusPlugin> getPlugins(Set<String> pluginsNames) { + ArrayList<StatusPlugin> p = new ArrayList<StatusPlugin>(); + + for (Iterator iter = pluginsNames.iterator(); iter.hasNext();) { + String pluginName = (String) iter.next(); + + try { + Class pluginClass = Class.forName(pluginName); + p.add((StatusPlugin) pluginClass.newInstance()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + p.add(new OneStatusPlugin()); + return p; + } + /** * For the given Node, computes Set of it's child Nodes. @@ -106,7 +145,7 @@ * @return Set containing <code>root</code>'s child Nodes, * but only those with names included in <code>nodeNames</code> Set */ - private Set getChildNodesSet(Node root, Set<String> nodesNames) { + private Set<Node> getChildNodesSet(Node root, Set<String> nodesNames) { HashSet ret = new HashSet<Node>(); NodeList list = root.getChildNodes(); @@ -125,7 +164,7 @@ * Similar to <code>getChildNodesSet(Node,Set)</code>. * Map binds child Nodes names with appropriate Nodes. */ - private Map getChildNodesMap(Node root, Set<String> nodesNames) { + private Map<String,Node> getChildNodesMap(Node root, Set<String> nodesNames) { HashMap ret = new HashMap<String,Node>(); NodeList list = root.getChildNodes(); @@ -140,4 +179,19 @@ return ret; } + private Set<String> getStringsFromNode(Node root, String element) { + HashSet<String> s = new HashSet<String>(); + + HashSet<String> nodesNames = new HashSet<String>(); + nodesNames.add(element); + + Set<Node> nodes = getChildNodesSet(root, nodesNames); + + for (Iterator iter = nodes.iterator(); iter.hasNext();) { + Node n = (Node) iter.next(); + s.add(XmlTools.unmarshallText(n)); + } + + return s; + } } Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusDescriptor.java 2005-11-18 19:12:56 UTC (rev 1593) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusDescriptor.java 2005-11-18 19:13:47 UTC (rev 1594) @@ -31,10 +31,14 @@ import org.jboss.forge.common.projects.ProjectsHelper; import org.jboss.portal.common.context.DelegateContext; import org.jboss.portlet.JBossRenderRequest; + import org.jboss.shotoku.ContentManager; +import org.jboss.shotoku.exceptions.ResourceDoesNotExist; + import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; + import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.jboss.logging.Logger; @@ -52,17 +56,16 @@ public StatusDescriptor(String portalName, ContentManager cm) { try { - - DOMParser parser = new DOMParser(); - parser.parse(new InputSource(cm.getNode(StatusTools - .getPrjXmlCmPath(portalName)).getContentInputStream())); - - Node root = parser.getDocument().getDocumentElement(); + String projectsPath = StatusTools.getPrjXmlCmPath(portalName); + Node projectsRoot = getRoot(cm, projectsPath); + String pluginsPath = StatusTools.getXmlCmPath(portalName,"plugins.xml"); + Node pluginsRoot = getRoot(cm, pluginsPath); + + /* if ((root.getNodeType() == Node.ELEMENT_NODE) - && (root.getNodeName().equals("projects"))) { - status = new Status(portalName, root); - } + && (root.getNodeName().equals("projects"))) {}*/ + status = new Status(portalName, projectsRoot, pluginsRoot); fillContext(); @@ -79,4 +82,12 @@ public DelegateContext getContext(JBossRenderRequest request) { return context; } + + private 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; + } } Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPlugin.java 2005-11-18 19:12:56 UTC (rev 1593) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPlugin.java 2005-11-18 19:13:47 UTC (rev 1594) @@ -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.status; + +/** +* @author Pawel Wrzeszcz +*/ + +public abstract interface StatusPlugin { + + public String getId(); + public String getName(); + public String getValue(String projectId); + +} Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusTools.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusTools.java 2005-11-18 19:12:56 UTC (rev 1593) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusTools.java 2005-11-18 19:13:47 UTC (rev 1594) @@ -37,6 +37,10 @@ return portalName + "/" + MEMBERS_DIR + "/" + PROJECTS_XML; } + public static String getXmlCmPath(String portalName, String filename) { + return portalName + "/" + STATUS_DIR + "/" + filename; + } + /** * Path to the file displaying the podcast feeds. */ |
From: <jbo...@li...> - 2005-11-18 19:12:59
|
Author: wrzep Date: 2005-11-18 14:12:56 -0500 (Fri, 18 Nov 2005) New Revision: 1593 Modified: trunk/forge/portal-extensions/portal-default/src/web/WEB-INF/default-portal.xml Log: podcast portlet on the default page Pawel Modified: trunk/forge/portal-extensions/portal-default/src/web/WEB-INF/default-portal.xml =================================================================== --- trunk/forge/portal-extensions/portal-default/src/web/WEB-INF/default-portal.xml 2005-11-18 16:58:57 UTC (rev 1592) +++ trunk/forge/portal-extensions/portal-default/src/web/WEB-INF/default-portal.xml 2005-11-18 19:12:56 UTC (rev 1593) @@ -52,14 +52,21 @@ <pages> <default-page>default</default-page> <page> - <page-name>default</page-name> - <window> + <page-name>default</page-name> + <window> <window-name>FreezonePortletWindowDefaultDefault</window-name> <instance-ref>prj-freezone.PrjFreezonePortlet.FreezoneDefaultPagePortletInstance</instance-ref> <default>true</default> <region>center</region> <height>0</height> - </window> + </window> + <window> + <window-name>PodcastPortletWindowDefaultDefault</window-name> + <instance-ref>podcast.PodcastPortlet.PodcastPortletInstance</instance-ref> + <region>center</region> + <height>1</height> + <window-state>normal</window-state> + </window> <window> <window-name>PrimatesPortletWindowDefaultDefault</window-name> <instance-ref>primates.PrimatesPortlet.PrimatesPortletInstance</instance-ref> |
From: <jbo...@li...> - 2005-11-18 17:09:44
|
Author: unibrew Date: 2005-11-18 11:57:48 -0500 (Fri, 18 Nov 2005) New Revision: 1591 Modified: trunk/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java trunk/forge/portal-extensions/forge-freezone/src/web/WEB-INF/portlet-instances.xml Log: [FREEZONE] Changes in order to make welcome page. Modified: trunk/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java =================================================================== --- trunk/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java 2005-11-18 16:54:48 UTC (rev 1590) +++ trunk/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java 2005-11-18 16:57:48 UTC (rev 1591) @@ -22,6 +22,7 @@ package org.jboss.forge.projects.freezone; import java.io.IOException; +import java.util.Enumeration; import java.util.List; import javax.portlet.PortletException; @@ -46,6 +47,7 @@ * * @author adamw * @author Tomasz Szymanski + * @author Ryszard Kozmik */ public class Freezone extends JBossLabsPortlet { /** @@ -72,7 +74,14 @@ public void labsDoView(JBossRenderRequest request, JBossRenderResponse response) throws IOException { String requestedPath = request.getParameter(PATH_PARAM); - + + // It is used if an instance have defined preference in instance descriptor. + Object requestedPathFromPref = request.getPreferences().getValue("page",requestedPath); + + if (requestedPath==null && requestedPathFromPref!=null){ + requestedPath= (String)requestedPathFromPref; + } + if (requestedPath == null) { sendResponseNotFound(response); return; Modified: trunk/forge/portal-extensions/forge-freezone/src/web/WEB-INF/portlet-instances.xml =================================================================== --- trunk/forge/portal-extensions/forge-freezone/src/web/WEB-INF/portlet-instances.xml 2005-11-18 16:54:48 UTC (rev 1590) +++ trunk/forge/portal-extensions/forge-freezone/src/web/WEB-INF/portlet-instances.xml 2005-11-18 16:57:48 UTC (rev 1591) @@ -4,4 +4,14 @@ <instance-name>PrjFreezonePortletInstance</instance-name> <component-ref>PrjFreezonePortlet</component-ref> </instance> + <instance> + <instance-name>FreezoneDefaultPagePortletInstance</instance-name> + <component-ref>PrjFreezonePortlet</component-ref> + <preferences> + <preference> + <name>page</name> + <value>default/members/default/freezone/welcome.html</value> + </preference> + </preferences> + </instance> </instances> |
From: <jbo...@li...> - 2005-11-18 16:59:07
|
Author: unibrew Date: 2005-11-18 11:58:57 -0500 (Fri, 18 Nov 2005) New Revision: 1592 Modified: trunk/forge/portal-extensions/forge-ear/src/META-INF/application.xml trunk/forge/portal-extensions/portal-default/src/web/WEB-INF/default-portal.xml Log: [WELCOMEPAGE] Just updating default page. Modified: trunk/forge/portal-extensions/forge-ear/src/META-INF/application.xml =================================================================== --- trunk/forge/portal-extensions/forge-ear/src/META-INF/application.xml 2005-11-18 16:57:48 UTC (rev 1591) +++ trunk/forge/portal-extensions/forge-ear/src/META-INF/application.xml 2005-11-18 16:58:57 UTC (rev 1592) @@ -20,6 +20,11 @@ </module> <module> <web> + <web-uri>primates-portlet.war</web-uri> + </web> + </module> + <module> + <web> <web-uri>kosmos-server.war</web-uri> </web> </module> Modified: trunk/forge/portal-extensions/portal-default/src/web/WEB-INF/default-portal.xml =================================================================== --- trunk/forge/portal-extensions/portal-default/src/web/WEB-INF/default-portal.xml 2005-11-18 16:57:48 UTC (rev 1591) +++ trunk/forge/portal-extensions/portal-default/src/web/WEB-INF/default-portal.xml 2005-11-18 16:58:57 UTC (rev 1592) @@ -52,13 +52,27 @@ <pages> <default-page>default</default-page> <page> - <page-name>default</page-name> - <window> + <page-name>default</page-name> + <window> + <window-name>FreezonePortletWindowDefaultDefault</window-name> + <instance-ref>prj-freezone.PrjFreezonePortlet.FreezoneDefaultPagePortletInstance</instance-ref> + <default>true</default> + <region>center</region> + <height>0</height> + </window> + <window> + <window-name>PrimatesPortletWindowDefaultDefault</window-name> + <instance-ref>primates.PrimatesPortlet.PrimatesPortletInstance</instance-ref> + <region>center</region> + <height>1</height> + <window-state>normal</window-state> + </window> + <window> <window-name>BlogPortletWindowDefaultDefault</window-name> <instance-ref>blog.BlogPortlet.BlogPortletInstance</instance-ref> <default>true</default> <region>center</region> - <height>0</height> + <height>2</height> </window> <window> <window-name>NavigationPortletWindowDefaultDefault</window-name> @@ -74,6 +88,7 @@ <height>2</height> <window-state>normal</window-state> </window> + </page> <!-- login page --> |
From: <jbo...@li...> - 2005-11-18 16:55:08
|
Author: unibrew Date: 2005-11-18 11:54:48 -0500 (Fri, 18 Nov 2005) New Revision: 1590 Added: trunk/forge/portal-extensions/primates/ trunk/forge/portal-extensions/primates/forge-ads.iml trunk/forge/portal-extensions/primates/maven.xml trunk/forge/portal-extensions/primates/project.properties trunk/forge/portal-extensions/primates/project.xml trunk/forge/portal-extensions/primates/src/ trunk/forge/portal-extensions/primates/src/java/ trunk/forge/portal-extensions/primates/src/java/org/ trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/ trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/ trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/ trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/Primate.java trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/Primates.java trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/PrimatesDescriptor.java trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/PrimatesNodeWatcher.java trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/PrimatesPortlet.java trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/PrimatesTools.java trunk/forge/portal-extensions/primates/src/web/ trunk/forge/portal-extensions/primates/src/web/WEB-INF/ trunk/forge/portal-extensions/primates/src/web/WEB-INF/jboss-app.xml trunk/forge/portal-extensions/primates/src/web/WEB-INF/jboss-portlet.xml trunk/forge/portal-extensions/primates/src/web/WEB-INF/jboss-service.xml trunk/forge/portal-extensions/primates/src/web/WEB-INF/jboss-web.xml trunk/forge/portal-extensions/primates/src/web/WEB-INF/jsp/ trunk/forge/portal-extensions/primates/src/web/WEB-INF/jsp/normal.jsp trunk/forge/portal-extensions/primates/src/web/WEB-INF/jsp/primates.jsp trunk/forge/portal-extensions/primates/src/web/WEB-INF/portlet-instances.xml trunk/forge/portal-extensions/primates/src/web/WEB-INF/portlet.xml trunk/forge/portal-extensions/primates/src/web/WEB-INF/tld/ trunk/forge/portal-extensions/primates/src/web/WEB-INF/tld/forge.tld trunk/forge/portal-extensions/primates/src/web/WEB-INF/tld/portlet.tld trunk/forge/portal-extensions/primates/src/web/WEB-INF/web.xml Log: [PRIMATES] Adding primates. Added: trunk/forge/portal-extensions/primates/forge-ads.iml =================================================================== --- trunk/forge/portal-extensions/primates/forge-ads.iml 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/forge-ads.iml 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module version="4" relativePaths="true" type="JAVA_MODULE"> + <component name="ModuleRootManager" /> + <component name="NewModuleRootManager"> + <output url="file://$MODULE_DIR$/target/classes" /> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntryProperties /> + </component> + <component name="org.mevenide.idea.module.ModuleSettings"> + <favoriteGoals> + <list size="0" /> + </favoriteGoals> + </component> +</module> + Added: trunk/forge/portal-extensions/primates/maven.xml =================================================================== --- trunk/forge/portal-extensions/primates/maven.xml 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/maven.xml 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,24 @@ +<!-- + 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="prj-all" /> + </goal> + + <goal name="build"> + <attainGoal name="prj-war-build" /> + </goal> + + <goal name="deploy"> + <attainGoal name="prj-war-deploy" /> + </goal> + + <goal name="clean"> + <attainGoal name="prj-clean" /> + </goal> +</project> Added: trunk/forge/portal-extensions/primates/project.properties =================================================================== --- trunk/forge/portal-extensions/primates/project.properties 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/project.properties 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,3 @@ +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 Added: trunk/forge/portal-extensions/primates/project.xml =================================================================== --- trunk/forge/portal-extensions/primates/project.xml 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/project.xml 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,40 @@ +<?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>primates-portlet</id> + <name>Primates portlet</name> + <currentVersion>1.0</currentVersion> + <organization> + <name>Damon Sicore and JBoss portal team</name> + <url>http://damon.sicore.org and http://www.jboss.org</url> + </organization> + <description></description> + <dependencies> + <dependency> + <groupId>tmate</groupId> + <artifactId>javasvn</artifactId> + <version>1.0</version> + <jar>javasvn.jar</jar> + </dependency> + + <dependency> + <groupId>tmate</groupId> + <artifactId>jsch</artifactId> + <version>1.0</version> + <jar>jsch.jar</jar> + </dependency> + + <dependency> + <groupId>jboss-forge</groupId> + <artifactId>forge-common</artifactId> + <version>1.0</version> + </dependency> + + </dependencies> +</project> Added: trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/Primate.java =================================================================== --- trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/Primate.java 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/Primate.java 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,121 @@ +package org.jbosslabs.portlets.primates; +// asdfasdf + +import java.io.File; +import java.util.HashSet; +import java.util.Set; + +import org.jboss.forge.common.XmlTools; +import org.jboss.forge.common.projects.AbstractDescriptor; +import org.jboss.portal.common.context.DelegateContext; +import org.jboss.shotoku.ContentManager; +import org.jboss.shotoku.exceptions.ResourceDoesNotExist; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * @author Damon Sicore + * @author adamw + * @author Rysiek + * A class representing a primate. + */ +public class Primate extends AbstractDescriptor { + final static String NAME_ELEMENT = "name"; + final static String TITLE_ELEMENT = "title"; + final static String PROJECT_ELEMENT = "project"; + final static String PROJECTS_ELEMENT = "projects"; + final static String MUGSHOT_ELEMENT = "mugshot"; + final static String STATUS_ELEMENT = "status"; + final static String BIO_ELEMENT = "bio"; + final static String COUNTRY_ELEMENT = "country"; + + /** + * <code>name</code> - The name this filthy primate calls itself. + */ + private String name; + /** + * <code>title</code> - A disgustingly self-important title. + */ + private String title; + /** + * <code>mugshot</code> - You will blow lunch when you see this. + */ + private String mugshot; + /** + * <code>status</code> - Whether or not this monkey is slacking. + */ + private String status; + /** + * <code>country</code> - Primate country. + */ + private String country; + /** + * <code>bio</code> - More self-promotion and hot air. + */ + private String bio; + + private Set<String> allProjects; + + + + public Primate(Node root) { + + NodeList nodes = root.getChildNodes(); + allProjects = new HashSet<String>(); + + for (int i = 0; i < nodes.getLength(); i++) { + Node n = nodes.item(i); + + if (n.getNodeType() == Node.ELEMENT_NODE) { + String nodeName = n.getNodeName(); + if (NAME_ELEMENT.equals(nodeName)) { + name = XmlTools.unmarshallText(n); + } else if (TITLE_ELEMENT.equals(nodeName)) { + title = XmlTools.unmarshallText(n); + } else if (MUGSHOT_ELEMENT.equals(nodeName)) { + mugshot = XmlTools.unmarshallText(n); + } else if (COUNTRY_ELEMENT.equals(nodeName)) { + country = XmlTools.unmarshallText(n); + } else if (PROJECTS_ELEMENT.equals(nodeName)) { + NodeList projectList = n.getChildNodes(); + for (int j = 0; j < projectList.getLength(); j++) { + Node project = projectList.item(j); + if (project.getNodeType()==Node.ELEMENT_NODE && PROJECT_ELEMENT.equals(project.getNodeName())) { + allProjects.add(XmlTools.unmarshallText(project)); + } + } + } else if (STATUS_ELEMENT.equals(nodeName)) { + status = XmlTools.unmarshallText(n); + } else if (BIO_ELEMENT.equals(nodeName)) { + bio = XmlTools.unmarshallText(n); + } + } + } + } + + /** + * Method puts primate in the context. + * @param portalName + * @param context + */ + public void setPrimateContextValues (String portalName, DelegateContext context) { + context.put(NAME_ELEMENT,name); + context.put(TITLE_ELEMENT,title); + if (allProjects.size()>0) { + for (String project:allProjects) { + DelegateContext projectCtx = context.next(PROJECTS_ELEMENT); + projectCtx.put(PROJECT_ELEMENT,project); + } + } + context.put(MUGSHOT_ELEMENT,PrimatesTools.getImgCmPath(portalName) + File.separator + mugshot); + context.put(COUNTRY_ELEMENT,country); + context.put(STATUS_ELEMENT,status); + ContentManager cm = ContentManager.getContentManager(); + try { + context.put(BIO_ELEMENT,cm.getNode(PrimatesTools.getBiosCmPath(portalName)+File.separator+bio).getContent()); + } catch (ResourceDoesNotExist e) { + System.out.println ("[PRIMATESPORTLET] Resource containing bios does not exist!"); + e.printStackTrace(); + } + } +} Property changes on: trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/Primate.java ___________________________________________________________________ Name: svn:executable + * Added: trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/Primates.java =================================================================== --- trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/Primates.java 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/Primates.java 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,67 @@ +package org.jbosslabs.portlets.primates; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +import org.jboss.portal.common.context.DelegateContext; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * @author Damon Sicore + * @author adamw + * @author Rysiek + * A class holding other primates. + */ +public class Primates { + final static String PRIMATE_ELEMENT = "primate"; + + /** + * <code>primates</code> - a list of primates. + */ + private List<Primate> primates; + + public Primates(Node root) { + primates = new ArrayList<Primate>(); + + NodeList nodes = root.getChildNodes(); + + for (int i = 0; i < nodes.getLength(); i++) { + Node n = nodes.item(i); + + if ((n.getNodeType() == Node.ELEMENT_NODE) + && (n.getNodeName().equals(PRIMATE_ELEMENT))) { + // Parsing and adding a new primate. + primates.add(new Primate(n)); + } + } + } + + /* + * Returns DelegateContext object containing all primates. + */ + public DelegateContext getPrimatesContext (String portalName) { + DelegateContext context = new DelegateContext(); + DelegateContext primateCtx=null; + for (Primate primate:primates) { + primateCtx=context.next("primate"); + primate.setPrimateContextValues(portalName,primateCtx); + } + return context; + } + + /* + * Returns DelegateContext object containging one random primate. + */ + public DelegateContext getRandomPrimateCtx (String portalName) { + DelegateContext context = new DelegateContext(); + Random random = new Random(); + int rndNbr = random.nextInt(primates.size()); + Primate primate = primates.get(rndNbr); + DelegateContext primateCtx = context.next("primate"); + primate.setPrimateContextValues(portalName,primateCtx); + return context; + } + +} Added: trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/PrimatesDescriptor.java =================================================================== --- trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/PrimatesDescriptor.java 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/PrimatesDescriptor.java 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,50 @@ +package org.jbosslabs.portlets.primates; + +import org.apache.xerces.parsers.DOMParser; +import org.jboss.portal.common.context.DelegateContext; +import org.jboss.shotoku.ContentManager; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.xml.sax.InputSource; + +/** + * @author Damon Sicore + * @author adamw + * A class which handles xml parsing of the primates.xml + */ +public class PrimatesDescriptor { + private Primates primates; + + public PrimatesDescriptor(String portalName, ContentManager cm) { + try { + // Parsing the xml navigation descriptor. + DOMParser parser = new DOMParser(); + parser.parse(new InputSource(cm.getNode(PrimatesTools.getXmlCmPath(portalName)).getContentInputStream())); + Document doc = parser.getDocument(); + // Looking for the root menu element. + Node root = doc.getDocumentElement(); + if ((root.getNodeType() == Node.ELEMENT_NODE) + && (root.getNodeName().equals(PrimatesTools.PRIMATES_ELEMENT))) { + // Found a menu element, parsing and ending the loop. + primates = new Primates(root); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Returns DelegateContext object containing all primates. + */ + public DelegateContext getContext(String portalName) { + return primates.getPrimatesContext(portalName); + } + + /* + * Returns DelegateContext objcet containing one random primate. + */ + public DelegateContext getRandomPrimateCtx (String portalName) { + return primates.getRandomPrimateCtx(portalName); + } + +} Added: trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/PrimatesNodeWatcher.java =================================================================== --- trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/PrimatesNodeWatcher.java 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/PrimatesNodeWatcher.java 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,34 @@ +package org.jbosslabs.portlets.primates; + +import org.jboss.shotoku.ContentManager; +import org.jboss.forge.common.service.NodeWatcher; +import org.jboss.forge.common.service.ResourceWatcher; + +public class PrimatesNodeWatcher implements NodeWatcher { + private ResourceWatcher rw; + private ContentManager cm; + + public PrimatesNodeWatcher(ContentManager cm) { + this.cm = cm; + } + + private PrimatesDescriptor getDesc(String portalName) { + PrimatesDescriptor desc = new PrimatesDescriptor(portalName, cm); + + rw = new ResourceWatcher(cm); + rw.watchResource(PrimatesTools.getXmlCmPath(portalName)); + + return desc; + } + + public Object init(String portalName) { + return getDesc(portalName); + } + + public Object nodeUpdate(String portalName, Object currentValue) { + if ((currentValue == null) || (rw.checkResources())) + return getDesc(portalName); + else + return null; + } +} Added: trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/PrimatesPortlet.java =================================================================== --- trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/PrimatesPortlet.java 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/PrimatesPortlet.java 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,46 @@ +package org.jbosslabs.portlets.primates; + +import java.io.IOException; + +import javax.portlet.PortletException; +import javax.portlet.PortletRequestDispatcher; + +import org.jboss.forge.common.ForgeHelper; +import org.jboss.forge.common.projects.ProjectsHelper; +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; + + +/** + * @author adamw + * @author Rysiek + * Primates portlet. + */ +public class PrimatesPortlet extends JBossPortlet { + public void doView(JBossRenderRequest request, JBossRenderResponse response) + throws IOException, PortletException { + response.setContentType("text/html"); + String portalName = ForgeHelper.getPortalName(request); + ProjectsHelper.prepareRequest(request); + + // Getting the context containing random primate. + DelegateContext primatesContext = PrimatesTools.getDesc(portalName).getRandomPrimateCtx(portalName); + + // Getting the context containing all primates. + //DelegateContext primatesContext = PrimatesTools.getDesc(portalName).getContext(portalName); + + // Displaying. + request.setAttribute(PortalJsp.CTX_REQUEST, primatesContext); + + // Getting JSP from portlet context. + //PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/primates.jsp"); + + // Getting JSP file from cms. + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(ForgeHelper.createRepoAccessPath(portalName, PrimatesTools.getJspCmPath())); + + rd.include(request, response); + } +} Added: trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/PrimatesTools.java =================================================================== --- trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/PrimatesTools.java 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/src/java/org/jbosslabs/portlets/primates/PrimatesTools.java 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,112 @@ +package org.jbosslabs.portlets.primates; + +import org.jboss.forge.common.ForgeHelper; +import java.io.File; +import org.jboss.shotoku.ContentManager; + +/** + * @author adamw + * Common constants and functions. + */ +public class PrimatesTools { + final static String PRIMATES_ELEMENT = "primates"; + + private final static String PRIMATES_XML = "primates.xml"; + private final static String PRIMATES_JSP = "primates.jsp"; + private final static String PRIMATES_DIR = "primates"; + private final static String BIOS_DIR = "html"; + private final static String MUGSHOTS_DIR = "images"; + + private static ContentManager cm; + + static { + cm = ForgeHelper.getContentManager(""); + } + + /** + * Method returns path to XML file. + * @param portalName + * @return + */ + static String getXmlCmPath(String portalName) { + return portalName + File.separator + PRIMATES_DIR + File.separator + PRIMATES_XML; + } + + /** + * Method returns path to JSP file. + * @param portalName + * @return + */ + static String getJspCmPath() { + return PRIMATES_DIR + File.separator + PRIMATES_JSP; + } + + /** + * Method returns images directory path. + * @param portalName + * @return + */ + static String getImgCmPath(String portalName) { + return PRIMATES_DIR + File.separator +MUGSHOTS_DIR; + } + + /** + * Method returns path to Bios directory. + * @param portalName + * @return + */ + static String getBiosCmPath(String portalName) { + return portalName+File.separator+PRIMATES_DIR + File.separator +BIOS_DIR; + } + + static synchronized PrimatesDescriptor getDesc(final String portalName) { + PrimatesDescriptor desc = (PrimatesDescriptor) ForgeHelper + .getForgeManagement().getFromCache(portalName, + PrimatesDescriptor.class.getName()); + + if (desc == null) + desc = (PrimatesDescriptor) ForgeHelper.getForgeManagement() + .addNodeWatcher(portalName, + PrimatesDescriptor.class.getName(), + new PrimatesNodeWatcher(cm)); + + return desc; + } + + private static String NO_PROJECT_PARAM = "&noproject=true"; + + static String prepareLinkForDisplay(String link) { + if (link == null) + return link; + + // To each link, adding a noproject param, unless it's a project link. + if ((!link.contains(NO_PROJECT_PARAM)) && + (!link.contains("project=")) && + (!ForgeHelper.isOutsideLink(link))) + return link + NO_PROJECT_PARAM; + + return link; + } + + static String prepareLinkForChecking(String portalName, String link) { + if (link == null) + return link; + + if (("/portal/".equals(link)) || ("/portal".equals(link)) + || ("//portal".equals(link))) + return ForgeHelper.createPageLink(portalName, "default"); + + // Deleting the noproject parameter, as it is not present in the generated links. + int i = link.indexOf(NO_PROJECT_PARAM); + if (i != -1) + link = link.substring(0, i); + + // Deleting the project=default parameter from freezone link, as it is a dummy + // project and not present in the generated links. + if (link.contains("freezone")) { + link = link.replace("&project=default", ""); + } + + return link; + } +} Added: trunk/forge/portal-extensions/primates/src/web/WEB-INF/jboss-app.xml =================================================================== --- trunk/forge/portal-extensions/primates/src/web/WEB-INF/jboss-app.xml 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/src/web/WEB-INF/jboss-app.xml 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,3 @@ +<jboss-app> + <app-name>primates</app-name> +</jboss-app> Added: trunk/forge/portal-extensions/primates/src/web/WEB-INF/jboss-portlet.xml =================================================================== --- trunk/forge/portal-extensions/primates/src/web/WEB-INF/jboss-portlet.xml 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/src/web/WEB-INF/jboss-portlet.xml 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,6 @@ +<portlet-app> + <portlet> + <portlet-name>PrimatesPortlet</portlet-name> + <security></security> + </portlet> +</portlet-app> Added: trunk/forge/portal-extensions/primates/src/web/WEB-INF/jboss-service.xml =================================================================== --- trunk/forge/portal-extensions/primates/src/web/WEB-INF/jboss-service.xml 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/src/web/WEB-INF/jboss-service.xml 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,2 @@ +<server> +</server> Added: trunk/forge/portal-extensions/primates/src/web/WEB-INF/jboss-web.xml =================================================================== --- trunk/forge/portal-extensions/primates/src/web/WEB-INF/jboss-web.xml 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/src/web/WEB-INF/jboss-web.xml 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,3 @@ +<?xml version="1.0"?> +<jboss-web> +</jboss-web> Added: trunk/forge/portal-extensions/primates/src/web/WEB-INF/jsp/normal.jsp =================================================================== --- trunk/forge/portal-extensions/primates/src/web/WEB-INF/jsp/normal.jsp 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/src/web/WEB-INF/jsp/normal.jsp 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,27 @@ +<!-- + JBoss, the OpenSource J2EE webOS + Distributable under LGPL license. + See terms of license at gnu.org. + --> +<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %> + <%@ taglib uri="/WEB-INF/tld/portlet.tld" prefix="n" %> + <%@ taglib uri="/WEB-INF/tld/forge.tld" prefix="forge" %> + <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %> + <%@ page isELIgnored ="false" %> + <portlet:defineObjects/> + + <h1>Die Mother Fucker Die</h1> +<div id="blog-entry"> + +<n:iterate ctx="menuentry"> + <!-- iterated menuentry --> + <div class="item"> + <a href="${n:out("menuentry.url")}"><img src="<forge:imagePath src="ads/images/${n:out('menuentry.name')}"/>" + width="175" height="64" border="0" /> + </a> + </div> +</n:iterate> + +</div> + + Added: trunk/forge/portal-extensions/primates/src/web/WEB-INF/jsp/primates.jsp =================================================================== --- trunk/forge/portal-extensions/primates/src/web/WEB-INF/jsp/primates.jsp 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/src/web/WEB-INF/jsp/primates.jsp 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,36 @@ +<!-- + JBoss, the OpenSource J2EE webOS + Distributable under LGPL license. + See terms of license at gnu.org. + --> +<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %> + <%@ taglib uri="/WEB-INF/tld/portlet.tld" prefix="n" %> + <%@ taglib uri="/WEB-INF/tld/forge.tld" prefix="forge" %> + <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %> + <%@ page isELIgnored ="false" %> + <portlet:defineObjects/> + + <h1>Random Primate</h1> +<div id="blog-entry"> + +<n:iterate ctx="primate"> + <!-- iterated menuentry --> + <div class="item"> + <img src="<forge:imagePath src="${n:out('primate.mugshot')}" />" border="0" /> + <h3>name:</h3> ${n:out('primate.name')} + <h3>title:</h3> ${n:out('primate.title')} + <h3>bio:</h3> ${n:out('primate.bio')} + <h3>status:</h3> ${n:out("primate.status")} + <h3>country:</h3> ${n:out("primate.country")} + <n:iterate ctx="projects"> + <h3>project:</h3> ${n:out("primate.projects.project")} + <BR /> + </n:iterate> + <hr> + </div> +</n:iterate> + + +</div> + + Added: trunk/forge/portal-extensions/primates/src/web/WEB-INF/portlet-instances.xml =================================================================== --- trunk/forge/portal-extensions/primates/src/web/WEB-INF/portlet-instances.xml 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/src/web/WEB-INF/portlet-instances.xml 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,7 @@ +<?xml version="1.0" standalone="yes"?> +<instances> + <instance> + <instance-name>PrimatesPortletInstance</instance-name> + <component-ref>PrimatesPortlet</component-ref> + </instance> +</instances> Added: trunk/forge/portal-extensions/primates/src/web/WEB-INF/portlet.xml =================================================================== --- trunk/forge/portal-extensions/primates/src/web/WEB-INF/portlet.xml 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/src/web/WEB-INF/portlet.xml 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd /opt/SUNWps/dtd/portlet.xsd" version="1.0"> + <portlet> + <portlet-name>PrimatesPortlet</portlet-name> + <portlet-class>org.jbosslabs.portlets.primates.PrimatesPortlet</portlet-class> + <supported-locale>en</supported-locale> + <supports> + <mime-type>text/html</mime-type> + <portlet-mode>VIEW</portlet-mode> + </supports> + <portlet-info> + <title>JBoss Primates Portlet</title> + </portlet-info> + </portlet> +</portlet-app> Added: trunk/forge/portal-extensions/primates/src/web/WEB-INF/tld/forge.tld =================================================================== --- trunk/forge/portal-extensions/primates/src/web/WEB-INF/tld/forge.tld 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/src/web/WEB-INF/tld/forge.tld 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,139 @@ +<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>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: trunk/forge/portal-extensions/primates/src/web/WEB-INF/tld/portlet.tld =================================================================== --- trunk/forge/portal-extensions/primates/src/web/WEB-INF/tld/portlet.tld 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/src/web/WEB-INF/tld/portlet.tld 2005-11-18 16:54:48 UTC (rev 1590) @@ -0,0 +1,156 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + JBoss, the OpenSource J2EE webOS + Distributable under LGPL license. + See terms of license at gnu.org. + --> +<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd"> + +<taglib> + + <tlib-version>1.0</tlib-version> + <jsp-version>1.2</jsp-version> + <short-name>portlet</short-name> + + <uri>http://java.sun.com/portlet</uri> + + <tag> + + <name>param</name> + <tag-class>org.jboss.portal.portlet.taglib.URLParameterTag</tag-class> + <body-content>empty</body-content> + + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + + </attribute> + <attribute> + <name>value</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + + </attribute> + </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> + + <tag> + <name>if</name> + <tagclass>org.jboss.portal.core.servlet.jsp.taglib.IfTag</tagclass> + <attribute> + <name>ctx</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>iterate</name> + <tagclass>org.jboss.portal.core.servlet.jsp.taglib.IterateTag</tagclass> + <attribute> + <name>ctx</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>include</name> + <tagclass>org.jboss.portal.core.servlet.jsp.taglib.IncludeTag</tagclass> + <attribute> + <name>page</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + + <name>defineObjects</name> + <tag-class>org.jboss.portal.portlet.taglib.DefineObjectsTag</tag-class> + <tei-class>org.jboss.portal.portlet.taglib.DefineObjectsTagTEI</tei-class> + <body-content>empty</body-content> + + </tag> + <tag> + + <name>namespace</name> + <tag-class>org.jboss.portal.portlet.taglib.NamespaceTag</tag-class> + <body-content>empty</body-content> + + </tag> + <tag> + + <name>renderURL</name> + <tag-class>org.jboss.portal.portlet.taglib.RenderURLTag</tag-class> + <tei-class>org.jboss.portal.portlet.taglib.GenerateURLTagTEI</tei-class> + <body-content>JSP</body-content> + + <attribute> + <name>portletMode</name> + <rtexprvalue>true</rtexprvalue> + + </attribute> + <attribute> + <name>secure</name> + <rtexprvalue>true</rtexprvalue> + + </attribute> + <attribute> + <name>var</name> + <rtexprvalue>true</rtexprvalue> + + </attribute> + <attribute> + <name>windowState</name> + <rtexprvalue>true</rtexprvalue> + + </attribute> + </tag> + <tag> + + <name>actionURL</name> + <tag-class>org.jboss.portal.portlet.taglib.ActionURLTag</tag-class> + <tei-class>org.jboss.portal.portlet.taglib.GenerateURLTagTEI</tei-class> + <body-content>JSP</body-content> + + <attribute> + <name>portletMode</name> + <rtexprvalue>true</rtexprvalue> + + </attribute> + <attribute> + <name>secure</name> + <rtexprvalue>true</rtexprvalue> + + </attribute> + <attribute> + <name>var</name> + <rtexprvalue>true</rtexprvalue> + + </attribute> + <attribute> + <name>windowState</name> + <rtexprvalue>true</rtexprvalue> + + </attribute> + </tag> + +</taglib> Added: trunk/forge/portal-extensions/primates/src/web/WEB-INF/web.xml =================================================================== --- trunk/forge/portal-extensions/primates/src/web/WEB-INF/web.xml 2005-11-18 16:28:49 UTC (rev 1589) +++ trunk/forge/portal-extensions/primates/src/web/WEB-INF/web.xml 2005-11-18 16:54:48 UTC (rev 1590) @@ -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> |
From: <jbo...@li...> - 2005-11-18 16:28:56
|
Author: adamw Date: 2005-11-18 11:28:49 -0500 (Fri, 18 Nov 2005) New Revision: 1589 Modified: trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsDescriptor.java trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FileBasedFeed.java trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java Log: Stream closing in finally { }, small corrections. Modified: trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsDescriptor.java 2005-11-17 22:50:57 UTC (rev 1588) +++ trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsDescriptor.java 2005-11-18 16:28:49 UTC (rev 1589) @@ -373,6 +373,7 @@ vc.put("dateFormat", new SimpleDateFormat( dateFormat == null ? "MM/dd/yy" : dateFormat)); vc.put("now", Calendar.getInstance().getTime()); + vc.put("baseServerAddress", baseServerAddress); for (String project : projects) { String feedNameReplaced = feedName.replace(PROJECT_PARAM, @@ -473,7 +474,7 @@ newFeed.generate(new URL(address)); addFeed(feedNameReplaced, type, newFeed); } catch (Exception e) { - log.warn("Can't add feeed " + address + " : " + type + log.debug("Can't add feeed " + address + " : " + type + ".", e); } } Modified: trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FileBasedFeed.java =================================================================== --- trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FileBasedFeed.java 2005-11-17 22:50:57 UTC (rev 1588) +++ trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FileBasedFeed.java 2005-11-18 16:28:49 UTC (rev 1589) @@ -53,26 +53,42 @@ } public void generate(URL url) throws IOException { - InputStream is = url.openStream(); - generate(is); - is.close(); + InputStream is = null; + + try { + is = url.openStream(); + generate(is); + } finally { + if (is != null) { + is.close(); + } + } } public void generate(InputStream is) throws IOException { - file.createNewFile(); + OutputStream os = null; - OutputStream os = new BufferedOutputStream(new FileOutputStream(file)); - - transfer(is, os); - - os.close(); + try { + file.createNewFile(); + os = new BufferedOutputStream(new FileOutputStream(file)); + transfer(is, os); + } finally { + if (os != null) { + os.close(); + } + } } public void write(OutputStream os) throws IOException { - InputStream is = new BufferedInputStream(new FileInputStream(file)); - - transfer(is, os); - is.close(); + InputStream is = null; + try { + is = new BufferedInputStream(new FileInputStream(file)); + transfer(is, os); + } finally { + if (is != null) { + is.close(); + } + } } public Writer getWriter() throws IOException { Modified: trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java =================================================================== --- trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java 2005-11-17 22:50:57 UTC (rev 1588) +++ trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java 2005-11-18 16:28:49 UTC (rev 1589) @@ -94,11 +94,17 @@ if (nw == null) return null; Object currentValue = getFromCache(ck); - Object newValue = nw.nodeUpdate(ck.getPortalName(), - currentValue); - if (newValue != null) - putToCache(ck, newValue); + Object newValue = null; + try { + newValue = nw.nodeUpdate(ck.getPortalName(), + currentValue); + if (newValue != null) + putToCache(ck, newValue); + } catch (Exception e) { + // In case of an error, doing nothing. + } + return newValue == null ? currentValue : newValue; } |
From: <jbo...@li...> - 2005-11-17 22:51:12
|
Author: szimano Date: 2005-11-17 17:50:57 -0500 (Thu, 17 Nov 2005) New Revision: 1588 Added: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/IndexInsidePlugin.java Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/WikiInsidePlugins.xml Log: IndexPage plugin http://jira.jboss.com/jira/browse/JBWIKI-70 Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/WikiInsidePlugins.xml =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/WikiInsidePlugins.xml 2005-11-17 22:16:54 UTC (rev 1587) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/WikiInsidePlugins.xml 2005-11-17 22:50:57 UTC (rev 1588) @@ -4,4 +4,5 @@ <comment>Here are defined inside plugins</comment> <entry key="tomek">org.jboss.wiki.plugins.TomekInsidePlugin</entry> <entry key="InsertPage">org.jboss.wiki.plugins.InsertPageInsidePlugin</entry> +<entry key="IndexPlugin">org.jboss.wiki.plugins.IndexInsidePlugin</entry> </properties> \ No newline at end of file Added: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/IndexInsidePlugin.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/IndexInsidePlugin.java 2005-11-17 22:16:54 UTC (rev 1587) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/IndexInsidePlugin.java 2005-11-17 22:50:57 UTC (rev 1588) @@ -0,0 +1,39 @@ +package org.jboss.wiki.plugins; + +import java.util.HashMap; +import java.util.Set; + +import org.jboss.wiki.WikiInsidePlugin; +import org.jboss.wiki.WikiPage; +import org.jboss.wiki.WikiSession; + +public class IndexInsidePlugin extends WikiInsidePlugin { + + @Override + public String process(WikiPage wikiPage, WikiSession wikiSession, + HashMap<String, String> attributes) { + StringBuffer pluginContent = new StringBuffer(); + + Set<String> allPages = wikiEngine.getAllPageNames(); + + Character chr = ' '; + + String actionURL = (String)wikiSession.getAttribute("actionURL"); + + for (String pageName : allPages) { + if (Character.toUpperCase(pageName.charAt(0)) != chr) { + chr = Character.toUpperCase(pageName.charAt(0)); + pluginContent.append("<h3>").append(chr).append("</h3>\n"); + } + pluginContent.append("<a href=\"").append(actionURL).append("&page=").append(pageName).append("\">").append(pageName).append("</a><br />\n"); + } + + return pluginContent.toString(); + } + + @Override + public void init() { + + } + +} |
From: <jbo...@li...> - 2005-11-17 22:17:04
|
Author: szimano Date: 2005-11-17 17:16:54 -0500 (Thu, 17 Nov 2005) New Revision: 1587 Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java Log: added support of alone wiki/Wiki.jsp http://jira.jboss.com/jira/browse/JBWIKI-68 Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2005-11-17 21:44:11 UTC (rev 1586) +++ trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2005-11-17 22:16:54 UTC (rev 1587) @@ -75,19 +75,19 @@ private String wikiHome; private WikiEngine wikiEngine; - + private static final String oldLink = "Wiki.jsp?page="; /* * private ForgeHelper forgeHelper; private ContentManager contentManager; */ private MimetypesFileTypeMap mimeTypes; - + private Logger log; public void init(FilterConfig conf) { // get wikiEnigne form wikiMenagement - + log = Logger.getLogger(WikiFileAccessFilter.class); WikiCommon wikiCommon = new WikiCommon(); @@ -123,8 +123,7 @@ log.error(e); } - log.info("Loaded attachements path: " - + attachementsPath); + log.info("Loaded attachements path: " + attachementsPath); } public void doFilter(ServletRequest request, ServletResponse response, @@ -145,16 +144,21 @@ wikiSession.setAttribute("hostURL", hostURL); String requestURI = httpRequest.getRequestURI(); - + // get off "/wiki/" from the begining requestURI = requestURI.substring("/wiki/".length()); - + // support old type link with Wiki.jsp?page= - if (requestURI.equals("Wiki.jsp") && httpRequest.getParameter("page") != null) { - httpResponse.sendRedirect(hostURL + wikiHome + "&page=" + httpRequest.getParameter("page")); + if (requestURI.equals("Wiki.jsp")) { + if (httpRequest.getParameter("page") != null) + httpResponse.sendRedirect(hostURL + wikiHome + "&page=" + + httpRequest.getParameter("page")); + else + httpResponse.sendRedirect(hostURL + wikiHome); + return; } - + while (requestURI.endsWith("/")) { // get rid of ending "/" character(s) requestURI = requestURI.substring(0, requestURI.length() - 1); @@ -172,12 +176,12 @@ // Parse URI to get filename and page name String[] tokens = requestURI.split("[/]"); - if ((tokens.length == 1)&&(tokens[0].equals(""))) { - //show Main page - as there is no place to go specified :) - httpResponse.sendRedirect(hostURL + wikiHome ); + if ((tokens.length == 1) && (tokens[0].equals(""))) { + // show Main page - as there is no place to go specified :) + httpResponse.sendRedirect(hostURL + wikiHome); return; } - + // check if all tokens are UpperCase (meanins they are all wiki // pages) boolean isAllUpperCase = true; @@ -209,7 +213,8 @@ } else if (tokens[0].equals(WikiCommon.wikiButtons)) { // show apropriate buttons InputStream imageIS = WikiFileAccessFilter.class - .getResourceAsStream("/images/" + tokens[tokens.length - 1]); + .getResourceAsStream("/images/" + + tokens[tokens.length - 1]); ServletOutputStream os = response.getOutputStream(); @@ -231,7 +236,8 @@ imageIS.close(); } - } else if ((Character.isLowerCase(tokens[0].charAt(0)))&&(tokens.length > 1)) { + } else if ((Character.isLowerCase(tokens[0].charAt(0))) + && (tokens.length > 1)) { boolean isPageNameUC = true; for (int i = 1; i < tokens.length; i++) @@ -254,11 +260,12 @@ pageName = pageName.substring(1); WikiPage page = wikiEngine.getByName(pageName, - new WikiContext(new SimpleCredentials(""), wikiEngine - .getWikiType(wikiTypeName), wikiSession)); + new WikiContext(new SimpleCredentials(""), + wikiEngine.getWikiType(wikiTypeName), + wikiSession)); - httpResponse.setContentType(wikiEngine - .getWikiType(wikiTypeName).getContentType()); + httpResponse.setContentType(wikiEngine.getWikiType( + wikiTypeName).getContentType()); httpResponse.setContentLength(page.getPageContent() .length()); @@ -288,9 +295,11 @@ WikiAttachment wikiAttachment; if (version == -1) { - wikiAttachment = wikiEngine.getAttachment(pageName, fileName); + wikiAttachment = wikiEngine.getAttachment(pageName, + fileName); } else { - wikiAttachment = wikiEngine.getAttachment(pageName, fileName, version); + wikiAttachment = wikiEngine.getAttachment(pageName, + fileName, version); } if (wikiAttachment != null) { @@ -323,8 +332,7 @@ os .println("<html><body><h3>ERROR</h3><br />\nThere is no such file or there is no such version of file</body></html>"); } - } - else { + } else { ServletOutputStream os = response.getOutputStream(); response.setContentType("text/html"); |
From: <jbo...@li...> - 2005-11-17 21:44:38
|
Author: adamw Date: 2005-11-17 16:44:11 -0500 (Thu, 17 Nov 2005) New Revision: 1586 Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnNode.java Log: Mime type fix Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnNode.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnNode.java 2005-11-17 20:04:17 UTC (rev 1585) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnNode.java 2005-11-17 21:44:11 UTC (rev 1586) @@ -71,7 +71,7 @@ } public String getMimeType() { - return mimeTypes.getContentType(getName()); + return mimeTypes.getContentType(getName().toLowerCase()); } public Date getLastModificationDate() { |
From: <jbo...@li...> - 2005-11-16 23:02:42
|
Author: unibrew Date: 2005-11-16 18:02:33 -0500 (Wed, 16 Nov 2005) New Revision: 1582 Added: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Poll.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollDescriptor.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollTools.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollsDescriptor.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollsWatcher.java Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Counter.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCounterTools.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersDescriptor.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersWatcher.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java Log: [JBLAB-407] Core files for PollPortlet task. [JBLAB-263] Small comments update. Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Counter.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Counter.java 2005-11-16 22:44:49 UTC (rev 1581) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Counter.java 2005-11-16 23:02:33 UTC (rev 1582) @@ -1,3 +1,26 @@ + +/* + * 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.common.projects; Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCounterTools.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCounterTools.java 2005-11-16 22:44:49 UTC (rev 1581) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCounterTools.java 2005-11-16 23:02:33 UTC (rev 1582) @@ -161,7 +161,7 @@ * Method constructs path to the DownloadCounterPortlet JSP view file. * * @param portalName - * @return Path to the JSP DownloadCounterPortlet view file. + * @return Path to the DownloadCounterPortlet's JSP view file. */ public static String getJspCmPath() { return FORGE_FILE_ACCESS_DIR + File.separator + DOWNLOADCOUNTER_JSP; Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersDescriptor.java 2005-11-16 22:44:49 UTC (rev 1581) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersDescriptor.java 2005-11-16 23:02:33 UTC (rev 1582) @@ -119,7 +119,7 @@ downloadCounters=getValuesFromNodes(nodes); // Getting Map containing pairs of ProjectId and shotoku Node - // which refers to project download counterdescriptor. + // which refers to projects' download counter descriptor. Map <String,org.jboss.shotoku.Node> descriptors = getDownloadDescriptors(portalName); // Synchronizing tracked links in downloadConters with links from @@ -142,7 +142,7 @@ /** * This method searches through projects direcories in order to find all download counter descriptors. - * Method returns Map containging pairs of String projectId and + * Method returns Map containing pairs of String projectId and * org.jboss.shotoku.Node download counter descriptor file node. * @param portalName * @return A Map<String,org.jboss.shotoku.Node> containing project ids with their download @@ -185,8 +185,8 @@ } /** - * Method removes links which was disabled from counting - * and adds those which was added in their project download counter descriptor. + * Method removes links which were disabled from counting + * and adds those which was added in their project's download counter descriptor. * * @param counters * This Map<Strin,org.jboss.shotoku.Node> contains project ids with their download @@ -233,7 +233,7 @@ } // Changing status to false becouse downloadCounters Map - // is now synchronized with download counters descriptors. + // is now synchronized with projects' download counter descriptors. changeStatus=false; } @@ -364,7 +364,7 @@ * @param link * Counter value for this <code>link</code> will be incremented. */ - synchronized public void increment (String link) { + synchronized public void increment (final String link) { if (downloadCounters.get(link)!=null) { // Status change to inform about counters modification. changeStatus=true; @@ -378,7 +378,7 @@ * If there is no link for this <projectId> tracked method returns false. * * @param projectId - * The id of a project for which occurence of the links will checked. + * The id of a project for which occurence of the links will bechecked. * @return Bool value whether there is a link to this project tracked or not. */ public synchronized boolean checkForProjectCounters(String projectId) { Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersWatcher.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersWatcher.java 2005-11-16 22:44:49 UTC (rev 1581) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersWatcher.java 2005-11-16 23:02:33 UTC (rev 1582) @@ -1,3 +1,26 @@ + +/* + * 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.common.projects; import java.util.Collection; @@ -35,7 +58,7 @@ /** * Method constructs the DownloadCountersDescriptor object registers it - * with the ResourceWatcher as well as all found DownloadCounterDescriptor's. + * with the ResourceWatcher as well as all found DownloadCounterDescriptors. * * @param portalName * @return DownloadCountersDescriptor object. Added: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Poll.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Poll.java 2005-11-16 22:44:49 UTC (rev 1581) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Poll.java 2005-11-16 23:02:33 UTC (rev 1582) @@ -0,0 +1,46 @@ +package org.jboss.forge.common.projects; + +public class Poll { + + String question; + long positive; + long negative; + + public Poll (long positive, long negative, String question) { + this.positive = positive; + this.negative = negative; + this.question = question; + } + + public Poll (String question) { + this.question = question; + } + + public void incrementPositive () { + positive++; + } + + public void incrementNegative () { + negative++; + } + + @Override + public boolean equals(Object obj) { + return ((Poll)obj).getQuestion().equals(question); + } + + public long getNegative() { + return negative; + } + + public long getPositive() { + return positive; + } + + public String getQuestion() { + return question; + } + + + +} Added: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollDescriptor.java 2005-11-16 22:44:49 UTC (rev 1581) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollDescriptor.java 2005-11-16 23:02:33 UTC (rev 1582) @@ -0,0 +1,100 @@ + +/* + * 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.common.projects; + +import java.io.IOException; +import java.io.InputStream; +import java.util.LinkedList; +import java.util.List; + +import org.apache.xerces.parsers.DOMParser; +import org.jboss.forge.common.XmlTools; +import org.jboss.forge.common.projects.XmlInputFactory.XmlNotFoundException; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +public class PollDescriptor extends AbstractDescriptor { + + /** + * This variable contains all polls containing questions from the xml descriptor. + */ + private List<Poll> polls; + + /** + * Name of tag in poll.xml containing poll's question. + */ + public static final String QUESTION = "question"; + + /** + * Name of tag in poll.xml containing poll. + */ + public static final String POLL = "poll"; + + + public PollDescriptor (org.jboss.shotoku.Node pollDescNode) + throws SAXException, IOException,XmlNotFoundException { + + // Opening the download project's poll descriptor. + DOMParser parser = new DOMParser(); + InputStream is = pollDescNode.getContentInputStream(); + parser.parse(new InputSource(is)); + Document doc = parser.getDocument(); + Node n=null,property=null; + NodeList nodes = doc.getDocumentElement().getChildNodes(); + + // Parsing and gettting polls' questions. + polls = new LinkedList<Poll>(); + for (int i = 0; i < nodes.getLength(); i++) { + n = nodes.item(i); + if (n.getNodeType() == Node.ELEMENT_NODE) { + if (n.getNodeName().equals(POLL)) { + NodeList counterProps = n.getChildNodes(); + for (int j=0;j< counterProps.getLength() ; j++) { + property = counterProps.item(j); + if (property.getNodeType()== Node.ELEMENT_NODE){ + if (property.getNodeName().equals(QUESTION) && XmlTools.unmarshallText(property) != null + && !XmlTools.unmarshallText(property).trim().equals("")) { + polls.add(new Poll(XmlTools.unmarshallText(property).trim())); + } + } + } + } + } + } + + } + + /** + * Method simply returns polls builded from xml descriptor. + * @return + * List<Poll> of polls achieved from the descriptor. + */ + public List<Poll> getPolls () { + return polls; + } + +} Added: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollTools.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollTools.java 2005-11-16 22:44:49 UTC (rev 1581) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollTools.java 2005-11-16 23:02:33 UTC (rev 1582) @@ -0,0 +1,73 @@ + +/* + * 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.common.projects; + +import java.io.File; + +public class PollTools { + + /** + * Dir in portal where the JSP view file is. + */ + public static final String POLLS_DIR="polls"; + + /** + * Name of JSP view file. + */ + public static final String POLLS_JSP="normal.jsp"; + + /** + * Method constructs path to polls descriptor. + * + * @param portalName + * @return Path to polls descriptor. + */ + public static String getMainXmlPath (String portalName) { + return portalName + File.separator + ProjectsHelper.MEMBERS_DIR + File.separator + ProjectsHelper.POLLS_DESC; + } + + /** + * Method constructs path to project's poll descriptor. + * + * @param portalName + * @param projectId + * Project id name for which the poll descriptor path will be constructed. + * @return Path to project's poll descriptor. + */ + public static String getProjectXmlPath(String portalName,String projectId) { + return portalName+File.separator+ProjectsHelper.MEMBERS_DIR+File.separator+projectId+ + File.separator+ProjectsHelper.POLL_DESC; + } + + /** + * Method constructs path to the PollPortlet JSP view file. + * + * @param portalName + * @return Path to the PollPortlet's JSP view file. + */ + public static String getJspCmPath() { + return POLLS_DIR + File.separator + POLLS_JSP; + } + +} Added: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollsDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollsDescriptor.java 2005-11-16 22:44:49 UTC (rev 1581) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollsDescriptor.java 2005-11-16 23:02:33 UTC (rev 1582) @@ -0,0 +1,490 @@ + +/* + * 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.common.projects; + +import java.io.File; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.xerces.parsers.DOMParser; +import org.jboss.forge.common.XmlTools; +import org.jboss.shotoku.ContentManager; +import org.jboss.shotoku.Directory; +import org.jboss.shotoku.exceptions.ResourceDoesNotExist; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +public class PollsDescriptor extends AbstractDescriptor { + + + /** + * Name of tag in polls descriptor containing poll's value of positive votes. + */ + public static final String POSITIVE_VOTES = "positive"; + + /** + * Name of tag in polls descriptor containing poll's value of negative votes. + */ + public static final String NEGATIVE_VOTES = "negative"; + + /** + * Name of tag in polls descriptor containing poll's question. + */ + public static final String QUESTION = "question"; + + /** + * Name of tag in polls descriptor containing project id name. + */ + public static final String PROJECT = "project"; + + /** + * Name of tag in polls descriptor containing project id name. + */ + public static final String PROJECT_ID = "id"; + + /** + * Name of tag in polls descriptor containing poll. + */ + public static final String POLL = "poll"; + + /** + * This Map contains all polls for the portal. + * Keys are project id names and values are Lists of polls defined for that project. + */ + private Map<String,List<Poll>> polls; + + /** + * ContentManager is used for getting to file resources. + */ + private ContentManager contentManager; + + /** + * This boolean variable turns to true if one of the polls + * has been incremented. If value is true the polls Map + * will be synchronized with a main xml polls descriptor. + */ + private boolean changeStatus; + + /** GOTOWA!!! + * Constructor for PollsDescriptor. + * While constructing object all information from projects' descriptors + * is being collected and the polls Map is filled with values + * from main xml polls descriptor. + * + * @param portalName + * @param contentManager + */ + public PollsDescriptor (final String portalName, ContentManager contentManager) { + + // Just initializing the changeStatus variable + changeStatus=false; + + // Getting the path to main polls descriptor. + String pathToPollsXml = File.separator + PollTools.getMainXmlPath(portalName); + + // Saving the ContentManager. + this.contentManager = contentManager; + + try { + + // Parsing main download counters descriptor. + DOMParser parser = new DOMParser(); + InputStream is = contentManager.getNode(pathToPollsXml).getContentInputStream(); + parser.parse(new InputSource(is)); + Document doc = parser.getDocument(); + NodeList nodes = doc.getDocumentElement().getChildNodes(); + polls=getValuesFromNodes(nodes); + + // Getting Map containing pairs of ProjectId and shotoku Node + // which refers to projects' poll descriptor. + Map <String,org.jboss.shotoku.Node> descriptors = getPollDescriptors(portalName); + + // Synchronizing polls Map with polls received from + // projects' poll descriptors. + synchronizePolls(descriptors); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** GOTOWA!!! + * Method only returns all polls. + * @return Returns a Map containing polls. + */ + public Map<String,List<Poll>> getPollsMap () { + return polls; + } + + + /** GOTOWA!!! + * This method searches through projects direcories in order to find all poll descriptors. + * Method returns Map containing pairs of String projectId and + * org.jboss.shotoku.Node poll descriptor file node. + * @param portalName + * @return A Map<String,org.jboss.shotoku.Node> containing project ids with their poll's Node. + */ + public Map<String,org.jboss.shotoku.Node> getPollDescriptors (String portalName) { + Map<String,org.jboss.shotoku.Node> nodes = new Hashtable<String,org.jboss.shotoku.Node>(); + + List<Directory> membersProjectDirs=null; + try { + // Getting the members dir. + Directory membersDir = contentManager.getDirectory(portalName+File.separator+ProjectsHelper.MEMBERS_DIR); + + // Getting all projects dirs in members directory. + membersProjectDirs = membersDir.getDirectories(); + } catch (ResourceDoesNotExist exception) { + System.out.println ("[POLLSDESCRIPTOR] Cannot get members dir' project folders!"); + exception.printStackTrace(); + return nodes; + } + + for (Directory projectDir:membersProjectDirs) { + for (org.jboss.shotoku.Node n:projectDir.getNodes().toList()) { + // Checking if node is a node containing poll descriptor. + if (n.getName().compareTo(ProjectsHelper.POLL_DESC)==0) { + String projectId = projectDir.getName(); + try { + projectId = projectDir.getName(); + org.jboss.shotoku.Node poll = projectDir.getNode(ProjectsHelper.POLL_DESC); + nodes.put(projectId,poll); + break; + } catch (ResourceDoesNotExist e) { + System.out.println ("[POLLSDESCRIPTOR] Failed to get "+projectId+" poll descriptor!"); + } + } + } + + } + return nodes; + } + + /** GOTOWA!!! + * Method removes polls which were disabled from working + * and adds those which was added in their project's poll descriptor. + * + * @param projectPolls + * This Map<Strin,org.jboss.shotoku.Node> contains project ids with their download + * counter descriptor's Node. + */ + private void synchronizePolls (Map<String,org.jboss.shotoku.Node> projectPolls) { + + // Iterating through projects nodes containing poll descriptors. + for (String projectId:projectPolls.keySet()){ + try { + // Parsing project's poll descriptor. + PollDescriptor pollDesc = + new PollDescriptor(projectPolls.get(projectId)); + + // Getting list of polls from polls Map for a given projectId name. + List<Poll> xmlProjectPolls = getProjectPolls(projectId); + + // Getting the list of polls from project's poll descriptor. + List<Poll> descPolls = pollDesc.getPolls(); + + // This list will be used for collecting questions which must be + // removed from polls Map. + List<Poll> pollsToDelete = new LinkedList<Poll>(); + + // Searching for polls to remove and polls which are already added. + for (Poll poll:xmlProjectPolls) { + if (descPolls.contains(poll)) { + descPolls.remove(poll); + } else { + pollsToDelete.add(poll); + } + } + + removePollsFromVoting(pollsToDelete); + + addPollsForVoting (descPolls,projectId); + + } catch (Exception e) { + System.out.println ("[POLLSDESCRIPTOR] Problem with opening project "+ + projectId+" poll descriptor."); + e.printStackTrace(); + } + + } + + // Changing status to false becouse polls Map + // is now synchronized with projects' polls descriptors. + changeStatus=false; + } + + /** GOTOWA!!! + * Method removes polls specified in <code>pollsToDelete</code> + * from tracking their votes. + * + * @param pollsToDelete + * List<String> of polls which should be removed. + */ + private synchronized void removePollsFromVoting (List<Poll> pollsToDelete) { + // Removing polls which shouldn't be tracked any more. + for (Poll poll:pollsToDelete) { + polls.remove(poll); + } + } + + /** GOTOWA!!! + * Method adds polls which are wished to be tracked. + * + * @param questions + * List<Poll> of polls wished to be tracked + * @param projectId + * Project id name for which polls containing the questions are added. + */ + private synchronized void addPollsForVoting (List<Poll> newPolls,String projectId) { + // Adding new project id name with ArrayList<Poll> values. + if (polls.get(projectId)==null) { + polls.put(projectId,new ArrayList<Poll>()); + } + for (Poll poll:newPolls) { + if (!polls.get(projectId).contains(poll)){ + polls.get(projectId).add(poll); + } + } + } + + /** GOTOWA !!! + * This method returns a List<Poll> of Poll-s, which + * are now tracked, for project given by <projectId> parameter. + * + * @param projectId + * Id of a project for which polls will be searched. + * @return List<Poll> Containing tracked questions or null. + */ + private synchronized List<Poll> getProjectPolls (String projectId) { + return polls.get(projectId); + } + + /** GOTOWA!!! + * Method synchronizes the polls Map with a main polls descriptor file. + * + * @param portalName + */ + public void synchronizeWithFile(String portalName) { + + String pathToPollsXml = File.separator + PollTools.getMainXmlPath(portalName); + + try { + DOMParser parser = new DOMParser(); + + // Opening main polls descriptor file. + InputStream is = contentManager.getNode(pathToPollsXml).getContentInputStream(); + parser.parse(new InputSource(is)); + Document doc = parser.getDocument(); + Node mainTag = doc.createElement("polls"); + + // Replacing old main descriptor tag with new, empty. + doc.replaceChild(mainTag,doc.getDocumentElement()); + + // Filling the descriptor with new polls. + createDocument(doc); + + DomToXmlTransformer xht = new DomToXmlTransformer(); + + // Getting string containing whole xml. + String xmlString = xht.transformNode(doc.getDocumentElement()); + + // Saving the main polls xml descriptor with a new content. + org.jboss.shotoku.Node xmlFile = contentManager.getNode(pathToPollsXml); + xmlFile.setContent(xmlString); + xmlFile.save ("[Polls] Main xml descriptor file update."); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** GOTOWA!!! + * Method creates content of polls main descriptor by + * copying values from polls Map. + * + * @param doc + * This Document object points to polls main descriptor xml. + */ + private void createDocument (Document doc) { + Set<String> projects = polls.keySet(); + for (String projectId:projects) { + Node newProject = doc.createElement(PROJECT); + Node projectAttribute = doc.createAttribute(PROJECT_ID); + projectAttribute.appendChild(doc.createTextNode(projectId)); + newProject.appendChild(projectAttribute); + for (Poll poll:polls.get(projectId)) { + Node newPoll = doc.createElement(POLL); + + Node newQuestion = doc.createElement(QUESTION); + Node newQuestionText = doc.createTextNode(poll.getQuestion()); + newQuestion.appendChild(newQuestionText); + + Node newPositiveVotes = doc.createElement(POSITIVE_VOTES); + Node newPositiveVotesText = doc.createTextNode(Long.toString(poll.getPositive())); + newPositiveVotes.appendChild(newPositiveVotesText); + + Node newNegativeVotes = doc.createElement(NEGATIVE_VOTES); + Node newNegativeVotesText = doc.createTextNode(Long.toString(poll.getNegative())); + newNegativeVotes.appendChild(newNegativeVotesText); + + newPoll.appendChild(newQuestion); + newPoll.appendChild(newPositiveVotes); + newPoll.appendChild(newNegativeVotes); + + newProject.appendChild(newPoll); + } + + doc.getDocumentElement().appendChild(newProject); + } + } + + /** GOTOWA!!! + * Method simply just increments the positive counter value for + * given in parameters <code>projectId question</code>. + * + * @param question + * Poll's question. + * @param projectId + * Project id name for which is this question. + */ + synchronized public void incrementPositive (String question,String projectId) { + List<Poll> projectPolls = polls.get(projectId); + if (projectPolls!=null) { + int position = projectPolls.indexOf(new Poll(question)); + if (position!=-1) { + // Status change to inform about counters modification. + changeStatus=true; + projectPolls.get(position).incrementPositive(); + } + } + } + + /** GOTOWA!!! + * Method simply just increments the negative counter value for + * given in parameters <code>projectId question</code>. + * + * @param question + * Poll's question. + * @param projectId + * Project id name for which is this question. + */ + synchronized public void incrementNegative (String question,String projectId) { + List<Poll> projectPolls = polls.get(projectId); + if (projectPolls!=null) { + int position = projectPolls.indexOf(new Poll(question)); + if (position!=-1) { + // Status change to inform about counters modification. + changeStatus=true; + projectPolls.get(position).incrementNegative(); + } + } + } + + + + /** GOTOWA!!! + * This method returns true if there is at least one poll, + * connected with given in parameter <projectId>, defined. + * If not method returns false. + * + * @param projectId + * The id of a project for which occurence of the polls will be checked. + * @return boolean value whether there is a poll defined for this project or not. + */ + public synchronized boolean checkForProjectPolls(String projectId) { + return polls.containsKey(projectId); + } + + /** GOTOWA!!! + * Method returns true if there was change in polls Map. + * Othervise it returns false. + * + * @return Returns true if the status of polls has changed. + */ + public boolean hasChanged () { + return changeStatus; + } + + + /** GOTOWA!!! + * Method used for pulling the polls' values and projectIds out from the + * xml file nodes to the <String,List<Poll>> Map. + * @param nodes + * NodeList containing conent of xml descriptor + * @return + * Map<String,List<Poll>> containing polls read from the xml nodes. + */ + private static Map<String,List<Poll>> getValuesFromNodes (NodeList nodes) { + Map<String,List<Poll>> values = new Hashtable<String,List<Poll>>(); + + // Temporary variables used for parsing. + Node projectNode=null,pollNode=null,property=null; + + // Parsing main download counters descriptor. + for (int i = 0; i < nodes.getLength(); i++) { + projectNode = nodes.item(i); + if (projectNode.getNodeType() == Node.ELEMENT_NODE && projectNode.getNodeName().equals(PROJECT)) { + NodeList pollNodes = projectNode.getChildNodes(); + String tempProjectId = XmlTools.getAttributeValue(projectNode,PROJECT_ID); + String tempQuestion = null; + String tempPositiveVotes = null; + String tempNegativeVotes = null; + for (int j=0;j< pollNodes.getLength() ; j++) { + pollNode = pollNodes.item(j); + if (pollNode.getNodeType()== Node.ELEMENT_NODE && pollNode.getNodeName().equals(POLL)){ + NodeList properties = pollNode.getChildNodes(); + for (int k=0;k< properties.getLength() ; k++) { + property = properties.item(k); + if (property.getNodeType()== Node.ELEMENT_NODE){ + String nodeTextCnt = XmlTools.unmarshallText(property); + if (property.getNodeName().equals(QUESTION) && nodeTextCnt != null && !nodeTextCnt.trim().equals("")) { + tempQuestion = nodeTextCnt.trim(); + } else if (property.getNodeName().equals(POSITIVE_VOTES) && nodeTextCnt !=null && !nodeTextCnt.trim().equals("")) { + tempPositiveVotes = nodeTextCnt.trim(); + } else if (property.getNodeName().equals(NEGATIVE_VOTES) && nodeTextCnt !=null && !nodeTextCnt.trim().equals("")) { + tempNegativeVotes = nodeTextCnt.trim(); + } + } + } + } + } + if (tempProjectId!=null && tempQuestion!=null && tempPositiveVotes!=null && tempNegativeVotes!=null) { + if (values.get(tempProjectId)==null) { + values.put(tempProjectId,new ArrayList<Poll>()); + } + values.get(tempProjectId).add(new Poll(tempQuestion)); + } + } + } + return values; + } + +} Added: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollsWatcher.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollsWatcher.java 2005-11-16 22:44:49 UTC (rev 1581) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollsWatcher.java 2005-11-16 23:02:33 UTC (rev 1582) @@ -0,0 +1,95 @@ + +/* + * 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.common.projects; + +import java.util.Collection; + +import org.jboss.forge.common.service.NodeWatcher; +import org.jboss.forge.common.service.ResourceWatcher; +import org.jboss.shotoku.ContentManager; + + +public class PollsWatcher implements NodeWatcher{ + + ContentManager contentManager; + ResourceWatcher rw; + + /** + * Simple constructor saving ContentManager given in parameter + * <code>conentManager</code> + * @param contentManager + */ + public PollsWatcher (ContentManager contentManager) { + this.contentManager = contentManager; + } + + + public Object init(String portalName) { + return getDescriptor(portalName); + } + + /** + * Method constructs the PollsDescriptor object registers it + * with the ResourceWatcher as well as all found PollDescriptors. + * + * @param portalName + * @return PollsDescriptor object. + */ + private Object getDescriptor (String portalName) { + PollsDescriptor descriptor = + new PollsDescriptor(portalName, contentManager); + rw = new ResourceWatcher(contentManager); + // Registering ResourceWatcher to watch for main polls descriptor file change. + rw.watchResource(DownloadCounterTools.getMainXmlPath(portalName)); + + // Getting the project ids names where are poll descriptors. + Collection<String> projects = descriptor.getPollDescriptors(portalName).keySet(); + + // Adding found project poll descriptors to the ResourceWatcher to watch + // for their changes. + for (String id:projects) { + rw.watchResource(PollTools.getProjectXmlPath(portalName,id)); + } + return descriptor; + } + + /** + * Method updates main polls descriptor if there is such a need. + * If the object is changed the method returns new object if not returns null. + */ + public Object nodeUpdate(String portalName, Object currentValue) { + if (currentValue==null || rw.checkResources()) { + return getDescriptor(portalName); + } else if (((PollsDescriptor)currentValue).hasChanged()){ + PollsDescriptor descriptor = + (PollsDescriptor)currentValue; + descriptor.synchronizeWithFile(portalName); + return null; + } + return null; + } + + + +} Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java 2005-11-16 22:44:49 UTC (rev 1581) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java 2005-11-16 23:02:33 UTC (rev 1582) @@ -84,6 +84,8 @@ protected final static String DOWNLOADS_DESC = "downloads.xml"; protected final static String DOWNLOADCOUNTER_DESC = "counter.xml"; protected final static String DOWNLOADCOUNTERMAIN_DESC = "counters.xml"; + protected final static String POLLS_DESC = "polls.xml"; + protected final static String POLL_DESC = "poll.xml"; /** * <code>MEMBERS_DIRECTORY</code> - base repository directory in which |