From: <jbo...@li...> - 2006-01-07 18:08:00
|
Author: wrzep Date: 2006-01-07 13:07:55 -0500 (Sat, 07 Jan 2006) New Revision: 2018 Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Column.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Plugins.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusNodeWatcher.java Log: comments & cleanup http://jira.jboss.com/jira/browse/JBLAB-415 Pawel Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Column.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Column.java 2006-01-07 17:00:46 UTC (rev 2017) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Column.java 2006-01-07 18:07:55 UTC (rev 2018) @@ -60,8 +60,8 @@ } /** - * Fills the given context with the appropiate Status Matrix cell, - * located in the project row and this column. + * Fills the given context with information appropriate for + * the Status Matrix cell, located in the project row and this column. * * @param projectContext context to fill * @param projectId id of the project to fill value for Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java 2006-01-07 17:00:46 UTC (rev 2017) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java 2006-01-07 18:07:55 UTC (rev 2018) @@ -42,18 +42,18 @@ /** * @author Pawel Wrzeszcz -* A class holding column information about columns on the one page to display. +* A class holding information about columns to display on one page. */ public class Columns { - /** Status Matrix Columns list (Column order matters) */ + /** Status Matrix Columns list (Column order matters). */ private List<Column> columns; /** Projects present in the Status Matrix */ private Projects projects; /** - * ScorePlugin, which determine projects order in the Matrix + * Plugin determining project order in the Matrix. */ private Plugin orderPlugin; @@ -109,12 +109,12 @@ } /** - * Retruns Plugin used to determine projects order - * in the StatusMatrix + * Retruns Plugin determining project order in the Status Matrix. * * @param pageRoot Node specfying Columns properties * @param plugins Plugins used by Columns * @return Plugin determining projects order + * or null if it is not specified in the properties */ private Plugin getOrderPlugin(Node pageRoot, Plugins plugins) { @@ -130,7 +130,7 @@ /** - * Fills the given context with columns information + * Fills the given context with the columns information. * * @param context DelegateContext to fill */ @@ -139,6 +139,13 @@ fillValues(context); } + /** + * Fills the given context with the columns information + * for project with the given id. + * + * @param context DelegateContext to fill + * @param projectId id of project to fill context for + */ public void fillContext(DelegateContext context, String projectId) { fillColumnsNames(context); fillProjectContext(context, projectId); @@ -161,8 +168,8 @@ } } - /** Fills the given context with the cell values - * (for each column and for each project). + /** Fills the given context with cell values. + * Context is filled with values for each project and for each column. * * @param context DelegateContext to fill */ @@ -195,10 +202,10 @@ Comparator<String> projectsComparator = null; - if (orderPlugin != null) { + if (orderPlugin == null) { + projectsComparator = new ProjectsByNameComparator(projects); + } else { projectsComparator = new ProjectsByScoreComparator(orderPlugin); - } else { - projectsComparator = new ProjectsByNameComparator(projects); } Arrays.sort(projectIdsArr, projectsComparator); @@ -207,7 +214,7 @@ } /** - * Fills the given context with the project informationcell value + * Fills the given context with project information * * @param projectContext DelegateContext to fill * @param projectId project id @@ -222,7 +229,7 @@ } /** - * Fills the given context with the cells information in the project row + * Fills the given context with cells information in the project row * * @param projectId specifies project row * @param projectContext DelegateContext to fill @@ -235,4 +242,4 @@ column.fillProjectContext(projectContext, projectId); } } -} +} \ No newline at end of file Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Plugins.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Plugins.java 2006-01-07 17:00:46 UTC (rev 2017) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Plugins.java 2006-01-07 18:07:55 UTC (rev 2018) @@ -39,7 +39,7 @@ /** * @author Pawel Wrzeszcz -* A class handling plugins used by the Status Matrix. +* A class storing plugins used by the Status Matrix. */ public class Plugins {; @@ -69,6 +69,7 @@ /** * @param pluginsNode Node with plugins definitions + * @param portalName portal name * @param projects Projects present in the Status Matrix * @param scorePlugins flag indicating whether plugins are ScorePlugins */ @@ -110,6 +111,7 @@ return null; } + // Get plugin properties Node pluginPropertiesNode = XmlTools.getFirstNodeWithName(pluginNode, PLUGIN_PROPERTIES_ELEMENT); Properties pluginProperties = getPluginProperties(pluginPropertiesNode); @@ -127,8 +129,7 @@ } catch (InvalidPluginPropertiesException e) { log.warn(e); return null; - } - catch (Exception e) { + } catch (Exception e) { log.error("Plugin class: " + pluginClassString + ". Instantination failed.", e); return null; } @@ -138,6 +139,12 @@ return plugin; } + /** + * Computes plugin properites from given properties Node. + * + * @param propertiesNode Node containging plugin properties + * @return plugin properties or null if properties are not specified + */ private Properties getPluginProperties(Node propertiesNode) { if (propertiesNode == null) @@ -165,6 +172,8 @@ } /** + * Returns plugin with the gieven id. + * * @param pluginId * @return Plugin with the given <code>pluginId</code> */ @@ -174,9 +183,10 @@ } /** - * Adds Plugins described in the pluginsNode. + * Adds Plugins defined in the given Node. * * @param pluginsNode Node with plugins definitions + * @param portalName portal name * @param scorePlugins flag indicating whether plugins are ScorePlugins */ public void addAll(Node pluginsNode, String portalName, boolean scorePlugins) { Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusNodeWatcher.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusNodeWatcher.java 2006-01-07 17:00:46 UTC (rev 2017) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusNodeWatcher.java 2006-01-07 18:07:55 UTC (rev 2018) @@ -50,11 +50,12 @@ /* Watch projects.xml file*/ rw.watchResource(StatusTools.getProjectsXmlPath(portalName)); - /* Watch all project.xml files */ + /* Watch all project.xml files + * We assume that they contain entries used by plugins */ Set<String> projectXmlPathsSet = StatusTools.getProjectXmlPathsSet(portalName); for (String projectXmlPath : projectXmlPathsSet) { - rw.watchResource(projectXmlPath);; + rw.watchResource(projectXmlPath); } return desc; |