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
|
From: <jbo...@li...> - 2005-12-07 18:08:25
|
Author: wrzep Date: 2005-12-07 13:08:17 -0500 (Wed, 07 Dec 2005) New Revision: 1724 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/StatusPlugin.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java Log: something was wrong with prev commit http://jira.jboss.com/jira/browse/JBLAB-415 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-12-07 17:40:38 UTC (rev 1723) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2005-12-07 18:08:17 UTC (rev 1724) @@ -42,9 +42,9 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import org.jboss.forge.status.plugins.InvalidPluginPropertiesException; +//import org.jboss.forge.status.plugins.InvalidPluginPropertiesException; import org.jboss.forge.status.plugins.StatusPlugin; -import org.jboss.logging.Logger; +//import org.jboss.logging.Logger; /** * @author Pawel Wrzeszcz @@ -65,7 +65,7 @@ private Projects projects; private List<StatusPlugin> plugins; - private Logger log; + //private Logger log; private HashSet<String> pluginsElements; @@ -73,7 +73,7 @@ this.portalName = portalName; this.scoreAlgorithm = scoreAlgorithm; - log = Logger.getLogger(this.getClass()); + //log = Logger.getLogger(this.getClass()); initPluginElements(); // Get the projects @@ -189,7 +189,7 @@ try { pluginClass = Class.forName(pluginClassString); } catch (ClassNotFoundException e) { - log.error("Plugin class not found: " + pluginClassString); + //log.error("Plugin class not found: " + pluginClassString); return null; } @@ -198,7 +198,7 @@ try { plugin = (StatusPlugin) pluginClass.newInstance(); } catch (Exception e) { - log.error("Plugin class: " + pluginClassString + ". Instantination failed.", e); + //log.error("Plugin class: " + pluginClassString + ". Instantination failed.", e); return null; } @@ -211,12 +211,12 @@ // Initialize plugin - try { + //try { plugin.init(projects, pluginSpecificPropertiesMap); - } catch (InvalidPluginPropertiesException e) { - log.warn(e); - return null; - } + //} catch (InvalidPluginPropertiesException e) { + //log.warn(e); + //return null; + //} return plugin; } Modified: 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-12-07 17:40:38 UTC (rev 1723) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/StatusPlugin.java 2005-12-07 18:08:17 UTC (rev 1724) @@ -35,7 +35,7 @@ protected Projects projects; protected Map properties; - public void init(Projects projects, Map<String,String> properties) throws InvalidPluginPropertiesException { + public void init(Projects projects, Map<String,String> properties)/* throws InvalidPluginPropertiesException */{ this.projects = projects; this.properties = properties; } Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java 2005-12-07 17:40:38 UTC (rev 1723) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java 2005-12-07 18:08:17 UTC (rev 1724) @@ -23,7 +23,6 @@ package org.jboss.forge.status.plugins.svn; import org.jboss.forge.common.projects.Projects; -import org.jboss.forge.status.plugins.InvalidPluginPropertiesException; import org.jboss.forge.status.plugins.StatusPlugin; import java.net.MalformedURLException; @@ -32,7 +31,7 @@ import java.util.List; import java.util.Map; -import org.jboss.logging.Logger; +//import org.jboss.logging.Logger; import com.caucho.hessian.client.HessianProxyFactory; @@ -49,7 +48,7 @@ private Map<String,Map> projectsMaps; - private Logger log; + //private Logger log; private String serviceURL; @@ -57,27 +56,27 @@ super(); projectsMaps = new HashMap<String,Map>(); - log = Logger.getLogger(this.getClass()); + //log = Logger.getLogger(this.getClass()); } - public void init(Projects projects, Map<String,String> properties) throws InvalidPluginPropertiesException { + public void init(Projects projects, Map<String,String> properties) /*throws InvalidPluginPropertiesException*/ { super.init(projects,properties); getProperties(properties); } - private void getProperties(Map<String, String> properties) throws InvalidPluginPropertiesException { - if (properties == null) { + private void getProperties(Map<String, String> properties) /*throws InvalidPluginPropertiesException*/ { + /*if (properties == null) { throw new InvalidPluginPropertiesException("Missing properties for " + getName() + " plugin."); } - + */ serviceURL = properties.get(SVN_SERVICE_PROPERTY); - + /* if (serviceURL == null) { throw new InvalidPluginPropertiesException( "Missing " + SVN_SERVICE_PROPERTY + " property for " + getName() + " plugin."); - } + }*/ } protected abstract int getPluginSpecyficValue(Map projectMap); @@ -101,7 +100,7 @@ try { service = (SvnService) factory.create(SvnService.class, serviceURL); } catch (MalformedURLException e) { - log.error("Can not connect to kosmos svn service: " + serviceURL); + //log.error("Can not connect to kosmos svn service: " + serviceURL); return null; } @@ -110,7 +109,7 @@ try { repositories = service.getRepositories(repoURL); } catch (Exception e) { - log.error("Can not analyze repo: " + repoURL, e); + //log.error("Can not analyze repo: " + repoURL, e); return null; } |
From: <jbo...@li...> - 2005-12-07 17:40:46
|
Author: wrzep Date: 2005-12-07 12:40:38 -0500 (Wed, 07 Dec 2005) New Revision: 1723 Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/InvalidPluginPropertiesException.java Log: invalid properites handling http://jira.jboss.com/jira/browse/JBLAB-415 Pawel Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/InvalidPluginPropertiesException.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/InvalidPluginPropertiesException.java 2005-12-07 17:17:26 UTC (rev 1722) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/InvalidPluginPropertiesException.java 2005-12-07 17:40:38 UTC (rev 1723) @@ -0,0 +1,9 @@ +package org.jboss.forge.status.plugins; + +public class InvalidPluginPropertiesException extends Exception { + + public InvalidPluginPropertiesException(String msg) { + super(msg); + } + +} |
From: <jbo...@li...> - 2005-12-07 17:17:31
|
Author: wrzep Date: 2005-12-07 12:17:26 -0500 (Wed, 07 Dec 2005) New Revision: 1722 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/StatusPlugin.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java Log: missing or incorrect plugin properties handling http://jira.jboss.com/jira/browse/JBLAB-415 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-12-07 16:06:26 UTC (rev 1721) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2005-12-07 17:17:26 UTC (rev 1722) @@ -42,6 +42,7 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import org.jboss.forge.status.plugins.InvalidPluginPropertiesException; import org.jboss.forge.status.plugins.StatusPlugin; import org.jboss.logging.Logger; @@ -210,7 +211,12 @@ // Initialize plugin - plugin.init(projects, pluginSpecificPropertiesMap); + try { + plugin.init(projects, pluginSpecificPropertiesMap); + } catch (InvalidPluginPropertiesException e) { + log.warn(e); + return null; + } return plugin; } Modified: 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-12-07 16:06:26 UTC (rev 1721) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/StatusPlugin.java 2005-12-07 17:17:26 UTC (rev 1722) @@ -35,7 +35,7 @@ protected Projects projects; protected Map properties; - public void init(Projects projects, Map<String,String> properties) { + public void init(Projects projects, Map<String,String> properties) throws InvalidPluginPropertiesException { this.projects = projects; this.properties = properties; } Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java 2005-12-07 16:06:26 UTC (rev 1721) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java 2005-12-07 17:17:26 UTC (rev 1722) @@ -23,6 +23,7 @@ package org.jboss.forge.status.plugins.svn; import org.jboss.forge.common.projects.Projects; +import org.jboss.forge.status.plugins.InvalidPluginPropertiesException; import org.jboss.forge.status.plugins.StatusPlugin; import java.net.MalformedURLException; @@ -44,12 +45,13 @@ public abstract class SvnStatusPlugin extends StatusPlugin { + private static final String SVN_SERVICE_PROPERTY = "svn-service"; + private Map<String,Map> projectsMaps; private Logger log; private String serviceURL; - //"http://localhost:8080/kosmos-server/kosmos-services/svn-service"; public SvnStatusPlugin() { super(); @@ -58,11 +60,26 @@ log = Logger.getLogger(this.getClass()); } - public void init(Projects projects, Map<String,String> properties) { + public void init(Projects projects, Map<String,String> properties) throws InvalidPluginPropertiesException { super.init(projects,properties); - serviceURL = properties.get("svn-service"); + + getProperties(properties); + } + private void getProperties(Map<String, String> properties) throws InvalidPluginPropertiesException { + if (properties == null) { + throw new InvalidPluginPropertiesException("Missing properties for " + getName() + " plugin."); + } + + serviceURL = properties.get(SVN_SERVICE_PROPERTY); + + if (serviceURL == null) { + throw new InvalidPluginPropertiesException( + "Missing " + SVN_SERVICE_PROPERTY + " property for " + getName() + " plugin."); + } + } + protected abstract int getPluginSpecyficValue(Map projectMap); protected abstract int getPluginSpecyficDefaultValue(); |
From: <jbo...@li...> - 2005-12-07 16:06:38
|
Author: wrzep Date: 2005-12-07 11:06:26 -0500 (Wed, 07 Dec 2005) New Revision: 1721 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/StatusDescriptor.java 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/StatusPortlet.java 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/WeightedScoreAlgorithmFactory.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java Log: - cleanup afer finding out what was wrong with kosmos service - fixed one bug in plugin instantination http://jira.jboss.com/jira/browse/JBLAB-415 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-12-06 22:33:48 UTC (rev 1720) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2005-12-07 16:06:26 UTC (rev 1721) @@ -202,9 +202,13 @@ } // Get plugin properies node + Map<String,String> pluginSpecificPropertiesMap = null; Node pluginSpecificPropertiesNode = pluginProperties.get("properties"); - Map<String,String> pluginSpecificPropertiesMap = getChildNodesStringMap(pluginSpecificPropertiesNode); + if (pluginSpecificPropertiesNode != null) { + pluginSpecificPropertiesMap = getChildNodesStringMap(pluginSpecificPropertiesNode); + } + // Initialize plugin plugin.init(projects, pluginSpecificPropertiesMap); 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-12-06 22:33:48 UTC (rev 1720) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusDescriptor.java 2005-12-07 16:06:26 UTC (rev 1721) @@ -23,25 +23,16 @@ package org.jboss.forge.status; import java.io.IOException; -import java.util.Set; -import java.util.HashSet; - import org.apache.xerces.parsers.DOMParser; -import org.jboss.forge.common.ForgeHelper; -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; /** * @author Pawel Wrzeszcz @@ -49,14 +40,12 @@ */ public class StatusDescriptor { - private static final Logger log = Logger.getLogger(StatusDescriptor.class); - private DelegateContext context; private Status status; public StatusDescriptor(String portalName, ContentManager cm) { try { - String pluginsPath = StatusTools.getXmlCmPath(portalName,"status.xml"); + String pluginsPath = StatusTools.getXmlCmPath(portalName); Node pluginsRoot = getRoot(cm, pluginsPath); /* 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 2005-12-06 22:33:48 UTC (rev 1720) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusNodeWatcher.java 2005-12-07 16:06:26 UTC (rev 1721) @@ -22,7 +22,6 @@ package org.jboss.forge.status; import org.jboss.forge.common.service.NodeWatcher; -import org.jboss.forge.common.service.ResourceWatcher; import org.jboss.shotoku.ContentManager; public class StatusNodeWatcher implements NodeWatcher { Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPortlet.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPortlet.java 2005-12-06 22:33:48 UTC (rev 1720) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPortlet.java 2005-12-07 16:06:26 UTC (rev 1721) @@ -28,11 +28,6 @@ import javax.portlet.PortletRequestDispatcher; import org.jboss.forge.common.ForgeHelper; -import org.jboss.forge.common.projects.Projects; -import org.jboss.forge.common.projects.ProjectsHelper; -import org.jboss.forge.common.projects.permissions.PermissionsChecker; -import org.jboss.forge.common.projects.permissions.RenderRequestPermissionsChecker; - import org.jboss.portal.common.context.DelegateContext; import org.jboss.portal.core.servlet.jsp.PortalJsp; 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-12-06 22:33:48 UTC (rev 1720) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusTools.java 2005-12-07 16:06:26 UTC (rev 1721) @@ -24,19 +24,13 @@ private final static String STATUS_JSP = "status.jsp"; private final static String STATUS_JSP_DIR = "status"; - private final static String MEMBERS_DIR = "members"; - private final static String PROJECTS_XML = "projects.xml"; - @Inject private static ContentManager cm; - /** - * Path to the xml file defining list of watched feeds. - */ - public static String getPrjXmlCmPath(String portalName) { - return portalName + "/" + MEMBERS_DIR + "/" + PROJECTS_XML; + public static String getXmlCmPath(String portalName) { + return portalName + "/" + STATUS_DIR + "/" + STATUS_XML; } - + public static String getXmlCmPath(String portalName, String filename) { return portalName + "/" + STATUS_DIR + "/" + filename; } Modified: 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-12-06 22:33:48 UTC (rev 1720) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/WeightedScoreAlgorithmFactory.java 2005-12-07 16:06:26 UTC (rev 1721) @@ -24,12 +24,6 @@ import java.util.Collection; import java.util.Iterator; -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; /** Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java 2005-12-06 22:33:48 UTC (rev 1720) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java 2005-12-07 16:06:26 UTC (rev 1721) @@ -61,7 +61,6 @@ public void init(Projects projects, Map<String,String> properties) { super.init(projects,properties); serviceURL = properties.get("svn-service"); - System.out.println("service-url " + serviceURL); } protected abstract int getPluginSpecyficValue(Map projectMap); @@ -71,7 +70,6 @@ // Get project repository URL String repoURL = getRepoURL(projectId); - //System.out.println("repo for project " + projectId + " " + repoURL); if (repoURL == null) { return null; |
Author: rl...@jb... Date: 2005-12-06 17:33:48 -0500 (Tue, 06 Dec 2005) New Revision: 1720 Added: trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/ trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/pom.xml trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/ trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/ trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/ trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/ trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/ trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/ trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/plugins/ trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/plugins/artifact_utils/ trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/plugins/artifact_utils/ArtifactItem.java trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/plugins/artifact_utils/ArtifactMojoParent.java trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/plugins/artifact_utils/CopyMojo.java trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/plugins/artifact_utils/ExplodeMojo.java Log: initial entry Added: trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/pom.xml =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/pom.xml 2005-12-06 21:55:58 UTC (rev 1719) +++ trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/pom.xml 2005-12-06 22:33:48 UTC (rev 1720) @@ -0,0 +1,31 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.stchome.maven.plugins</groupId> + <artifactId>artifact-utils</artifactId> + <packaging>maven-plugin</packaging> + <version>1.1</version> + <name>Artifact Utilities Plugin</name> + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-artifact</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-archiver</artifactId> + <version>1.0-alpha-3</version> + </dependency> + </dependencies> +</project> Added: trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/plugins/artifact_utils/ArtifactItem.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/plugins/artifact_utils/ArtifactItem.java 2005-12-06 21:55:58 UTC (rev 1719) +++ trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/plugins/artifact_utils/ArtifactItem.java 2005-12-06 22:33:48 UTC (rev 1720) @@ -0,0 +1,124 @@ +/** + * Copyright 2005 Scientific Technologies Corporation. All rights reserved. + * Filename: ArtifactItem.java + * Author : brianf + * Created : Nov 28, 2005 + * @version $Id$ */ +package com.stchome.maven.plugins.artifact_utils; + +import java.io.File; + +/** + * @author brianf + * + * ArtifactItem + * + */ +public class ArtifactItem +{ + private String groupId; + private String artifactId; + private String version; + private String type; + private File location; + private boolean overWrite = true; + + /** + * @return Returns the artifactId. + */ + public String getArtifactId() + { + return artifactId; + } + /** + * @param artifactId The artifactId to set. + */ + public void setArtifactId( String artifact ) + { + this.artifactId = artifact; + } + /** + * @return Returns the groupId. + */ + public String getGroupId() + { + return groupId; + } + /** + * @param groupId The groupId to set. + */ + public void setGroupId( String groupId ) + { + this.groupId = groupId; + } + /** + * @return Returns the type. + */ + public String getType() + { + return type; + } + /** + * @param type The type to set. + */ + public void setType( String type ) + { + this.type = type; + } + /** + * @return Returns the version. + */ + public String getVersion() + { + return version; + } + /** + * @param version The version to set. + */ + public void setVersion( String version ) + { + this.version = version; + } + /** + * + */ + public ArtifactItem() + { + super(); + location = null; + + } + public String toString() + { + return groupId+":"+artifactId+":"+version+":"+type; + } + + /** + * @return Returns the location. + */ + public File getLocation() + { + return location; + } + /** + * @param location The location to set. + */ + public void setLocation( File location ) + { + this.location = location; + } +/** + * @return Returns the overWrite. + */ +public boolean isOverWrite() +{ + return this.overWrite; +} +/** + * @param overWrite The overWrite to set. + */ +public void setOverWrite( boolean overWrite ) +{ + this.overWrite = overWrite; +} +} Added: trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/plugins/artifact_utils/ArtifactMojoParent.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/plugins/artifact_utils/ArtifactMojoParent.java 2005-12-06 21:55:58 UTC (rev 1719) +++ trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/plugins/artifact_utils/ArtifactMojoParent.java 2005-12-06 22:33:48 UTC (rev 1720) @@ -0,0 +1,129 @@ +package com.stchome.maven.plugins.artifact_utils; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.File; +import java.util.ArrayList; +import java.util.Iterator; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.resolver.ArtifactNotFoundException; +import org.apache.maven.artifact.resolver.ArtifactResolutionException; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.logging.Log; +import org.codehaus.plexus.archiver.manager.ArchiverManager; + +public abstract class ArtifactMojoParent extends AbstractMojo +{ + + /** + * @component + */ + private org.apache.maven.artifact.factory.ArtifactFactory factory; + + /** + * @component + */ + private org.apache.maven.artifact.resolver.ArtifactResolver resolver; + + /** + * @parameter expression="${localRepository}" + * @readonly + * @required + */ + private org.apache.maven.artifact.repository.ArtifactRepository local; + + /** + * @parameter expression="${project.remoteArtifactRepositories}" + * @readonly + * @required + */ + private java.util.List remoteRepos; + + /** + * Directory to unpack JARs into if needed + * + * @parameter + * @required + */ + protected File defaultWorkDirectory; + + /** + * To look up Archiver/UnArchiver implementations + * + * @parameter expression="${component.org.codehaus.plexus.archiver.manager.ArchiverManager}" + * @required + */ + + protected ArchiverManager archiverManager; + + /** + * List of Artifacts. + * @parameter + * @required + */ + private ArrayList artifactItems; + + Log log; + + public ArtifactMojoParent() + { + super(); + log = getLog(); + } + public void execute() throws MojoExecutionException + { + + Iterator iter = artifactItems.iterator(); + while (iter.hasNext()) + { + ArtifactItem artifactItem = (ArtifactItem) iter.next(); + log.info("Configured Artifact: "+artifactItem.toString()); + try + { + Artifact artifact = getArtifact(artifactItem); + File file = artifactItem.getLocation(); + if (file == null) + { + file = defaultWorkDirectory; + } + file.mkdirs(); + doMojo(artifact,file,artifactItem); + } + catch (Exception e) + { + throw new MojoExecutionException("Nested:",e); + } + } + } + + /** + * gets the Artifact and resolves from repository. + */ + protected Artifact getArtifact(ArtifactItem artifactItem) throws ArtifactResolutionException, ArtifactNotFoundException + { + Artifact artifact; + + artifact = factory.createArtifact(artifactItem.getGroupId(), artifactItem.getArtifactId(), artifactItem.getVersion(), Artifact.SCOPE_PROVIDED, artifactItem.getType()); + + resolver.resolve(artifact, remoteRepos, local); + return artifact; + } + + protected abstract void doMojo(Artifact artifact, File location, ArtifactItem artifactItem) throws Exception; +} Added: trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/plugins/artifact_utils/CopyMojo.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/plugins/artifact_utils/CopyMojo.java 2005-12-06 21:55:58 UTC (rev 1719) +++ trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/plugins/artifact_utils/CopyMojo.java 2005-12-06 22:33:48 UTC (rev 1720) @@ -0,0 +1,48 @@ +package com.stchome.maven.plugins.artifact_utils; + +import java.io.File; +import java.io.IOException; + +import org.apache.maven.artifact.Artifact; +import org.codehaus.plexus.util.FileUtils; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Goal which touches a timestamp file. + * + * @goal copy + * + * @phase process-sources + */ +public class CopyMojo extends ArtifactMojoParent +{ + + protected void doMojo( Artifact artifact, File location, ArtifactItem artifactItem ) throws Exception + { + log.info("Copying " + artifact.getFile().getAbsolutePath() + " to " + location); + if (!artifact.getFile().exists() || artifactItem.isOverWrite()) + { + FileUtils.copyFileToDirectory(artifact.getFile(), location); + } + else + { + log.info("File Exists, skipping."); + } + } + +} Added: trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/plugins/artifact_utils/ExplodeMojo.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/plugins/artifact_utils/ExplodeMojo.java 2005-12-06 21:55:58 UTC (rev 1719) +++ trunk/labs/jbossbuild/projects/maven-plugins/artifact-utils/src/main/java/com/stchome/maven/plugins/artifact_utils/ExplodeMojo.java 2005-12-06 22:33:48 UTC (rev 1720) @@ -0,0 +1,83 @@ +package com.stchome.maven.plugins.artifact_utils; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.File; +import java.io.IOException; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.plugin.MojoExecutionException; +import org.codehaus.plexus.archiver.ArchiverException; +import org.codehaus.plexus.archiver.UnArchiver; +import org.codehaus.plexus.archiver.manager.NoSuchArchiverException; +import org.codehaus.plexus.util.FileUtils; +/** + * Goal which touches a timestamp file. + * + * @goal explode + * + * @phase process-sources + */ +public class ExplodeMojo extends ArtifactMojoParent +{ + + + protected void doMojo(Artifact artifact, File location, ArtifactItem artifactItem)throws Exception + { + unpack(artifact.getFile(), location,artifactItem.isOverWrite()); + } + + /** + * Unpacks the archive file. + * + * @param file + * File to be unpacked. + * @param location + * Location where to put the unpacked files. + */ + protected void unpack( File file, File location, boolean overWrite ) throws MojoExecutionException, + NoSuchArchiverException + { + log.info("Unpacking File " + file.getAbsolutePath() + " to " + + location.getAbsolutePath()); + String archiveExt = FileUtils.getExtension(file.getAbsolutePath()).toLowerCase(); + + try + { + UnArchiver unArchiver; + + unArchiver = this.archiverManager.getUnArchiver(archiveExt); + + unArchiver.setOverwrite(overWrite); + unArchiver.setSourceFile(file); + + unArchiver.setDestDirectory(location); + + unArchiver.extract(); + } + catch (IOException e) + { + throw new MojoExecutionException("Error unpacking file: " + file + "to: " + location, e); + } + catch (ArchiverException e) + { + throw new MojoExecutionException("Error unpacking file: " + file + "to: " + location, e); + } + } + + +} |
From: <jbo...@li...> - 2005-12-06 21:56:10
|
Author: rl...@jb... Date: 2005-12-06 16:55:58 -0500 (Tue, 06 Dec 2005) New Revision: 1719 Modified: trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java Log: added support for additional directory cleaning Modified: trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java 2005-12-06 21:49:34 UTC (rev 1718) +++ trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java 2005-12-06 21:55:58 UTC (rev 1719) @@ -16,11 +16,13 @@ * limitations under the License. */ +import java.io.File; +import java.util.Iterator; +import java.util.List; + import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; -import java.io.File; - /** * Goal which cleans the build. @@ -43,6 +45,12 @@ private File directory; /** + * A list of additional directories to clean. + * + * @parameter + */ + private List additionalDirs; + /** * This is where compiled classes go. * * @parameter expression="${project.build.outputDirectory}" @@ -66,6 +74,16 @@ removeDirectory( directory ); removeDirectory( outputDirectory ); removeDirectory( testOutputDirectory ); + + if (additionalDirs != null) + { + for (Iterator it=additionalDirs.iterator(); it.hasNext(); ) + { + File addDir = new File((String) it.next()); + removeDirectory(addDir); + } + + } } private void removeDirectory( File dir ) @@ -160,4 +178,10 @@ // } } } + /** + * @return Returns the additionalDirs. + */ + public List getAdditionalDirs() { + return additionalDirs; + } } |
From: <jbo...@li...> - 2005-12-06 21:49:42
|
Author: adamw Date: 2005-12-06 16:49:34 -0500 (Tue, 06 Dec 2005) New Revision: 1718 Modified: trunk/forge/portal-extensions/forge-kosmos/maven.xml Log: Build fix Modified: trunk/forge/portal-extensions/forge-kosmos/maven.xml =================================================================== --- trunk/forge/portal-extensions/forge-kosmos/maven.xml 2005-12-06 21:22:46 UTC (rev 1717) +++ trunk/forge/portal-extensions/forge-kosmos/maven.xml 2005-12-06 21:49:34 UTC (rev 1718) @@ -47,7 +47,7 @@ <!-- Deploying new packages --> <ant:copy todir="../${forge.ear.dir}/target/${forge.ear.name}" overwrite="true"> <ant:fileset dir="target"> - <ant:filename name="kosmos**/*" /> + <ant:filename name="kosmos*/**" /> </ant:fileset> </ant:copy> </goal> |
From: <jbo...@li...> - 2005-12-06 21:22:51
|
Author: rl...@jb... Date: 2005-12-06 16:22:46 -0500 (Tue, 06 Dec 2005) New Revision: 1717 Modified: trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/java/org/codehaus/mojo/javacc/JavaCCMojo.java Log: fixed the additional source directory being added Modified: trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/java/org/codehaus/mojo/javacc/JavaCCMojo.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/java/org/codehaus/mojo/javacc/JavaCCMojo.java 2005-12-06 20:03:01 UTC (rev 1716) +++ trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/java/org/codehaus/mojo/javacc/JavaCCMojo.java 2005-12-06 21:22:46 UTC (rev 1717) @@ -50,6 +50,11 @@ */ private Integer lookAhead; + /** + * @parameter expression="${ccFile}" + */ + private String ccFile; + /** * @parameter expression="${choiceAmbiguityCheck}" */ @@ -251,7 +256,6 @@ if ( project != null ) { project.addCompileSourceRoot( outputDirectory.getAbsolutePath() ); - project.addCompileSourceRoot( "C:\\projects\\maven-jboss-head\\jboss-head\\server\\target\\gensrc" ); } } @@ -383,6 +387,18 @@ private Set computeStaleGrammars() throws MojoExecutionException { + File outDir = new File( timestampDirectory ); + + Set staleSources = new HashSet(); + + File sourceDir = sourceDirectory ; + + if (ccFile != null) { + this.getLog().info("Generating java for single file: " + ccFile); + File grammarFile = new File(sourceDirectory + "/" + ccFile); + staleSources.add(grammarFile); + } else { + SuffixMapping mapping = new SuffixMapping( ".jj", ".jj" ); SuffixMapping mappingCAP = new SuffixMapping( ".JJ", ".JJ" ); @@ -391,12 +407,7 @@ scanner.addSourceMapping( mapping ); scanner.addSourceMapping( mappingCAP); - File outDir = new File( timestampDirectory ); - Set staleSources = new HashSet(); - - File sourceDir = sourceDirectory ; - try { staleSources.addAll( scanner.getIncludedSources( sourceDir, outDir ) ); @@ -405,10 +416,16 @@ { throw new MojoExecutionException( "Error scanning source root: \'" + sourceDir + "\' for stale grammars to reprocess.", e ); } - + } return staleSources; } + /** + * @return Returns the ccFile. + */ + public String getCcFile() { + return ccFile; + } } |
Author: rl...@jb... Date: 2005-12-06 15:03:01 -0500 (Tue, 06 Dec 2005) New Revision: 1716 Added: trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/ trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/pom.xml trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/ trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/ trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/java/ trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/java/org/ trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/java/org/codehaus/ trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/java/org/codehaus/mojo/ trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/java/org/codehaus/mojo/javacc/ trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/java/org/codehaus/mojo/javacc/JJTreeMojo.java trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/java/org/codehaus/mojo/javacc/JavaCCMojo.java trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/scripts/ trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/site/ trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/site/apt/ trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/site/apt/index.apt trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/site/site.xml trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/pom.xml trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/AbstractRmiMojo.java trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/DefaultRmiCompilerManager.java trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/NoSuchRmiCompilerException.java trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/PackageRmiMojo.java trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/ProcessClassesRmiMojo.java trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/RmiCompiler.java trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/RmiCompilerException.java trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/RmiCompilerManager.java trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/SunRmiCompiler.java trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/resources/ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/resources/META-INF/ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/resources/META-INF/plexus/ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/resources/META-INF/plexus/components.xml Log: initial entry of plugins Added: trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/pom.xml =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/pom.xml 2005-12-06 19:36:59 UTC (rev 1715) +++ trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/pom.xml 2005-12-06 20:03:01 UTC (rev 1716) @@ -0,0 +1,34 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>mojo</artifactId> + <groupId>org.codehaus.mojo</groupId> + <version>4</version> + </parent> + <artifactId>javacc-maven-plugin</artifactId> + <packaging>maven-plugin</packaging> + <version>0.6.1-SNAPSHOT</version> + <name>Maven Javacc Plugin</name> + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-project</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-compiler-api</artifactId> + <version>1.5.1</version> + </dependency> + <dependency> + <groupId>plexus</groupId> + <artifactId>plexus-utils</artifactId> + <version>1.0.1</version> + </dependency> + <dependency> + <groupId>javacc</groupId> + <artifactId>javacc</artifactId> + <version>3.2</version> + </dependency> + </dependencies> +</project> Added: trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/java/org/codehaus/mojo/javacc/JJTreeMojo.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/java/org/codehaus/mojo/javacc/JJTreeMojo.java 2005-12-06 19:36:59 UTC (rev 1715) +++ trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/java/org/codehaus/mojo/javacc/JJTreeMojo.java 2005-12-06 20:03:01 UTC (rev 1716) @@ -0,0 +1,279 @@ +package org.codehaus.mojo.javacc; + +/* + * Copyright 2001-2005 The Codehaus. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.compiler.util.scan.InclusionScanException; +import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner; +import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner; +import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping; +import org.codehaus.plexus.util.FileUtils; +import org.javacc.jjtree.JJTree; + +/** + * @goal jjtree + * @phase generate-sources + * @description Goal which parse a JJ file and transform it to Java Source + * Files. + * @author jesse <jes...@gm...> + * @version $Id: JJTreeMojo.java 893 2005-11-21 20:18:03Z jesse $ + */ +public class JJTreeMojo extends AbstractMojo { + + /** + * @parameter expression="${buildNodeFiles}" + */ + private Boolean buildNodeFiles; + + /** + * @parameter expression="${jjFile}" + */ + private String jjFile; + + /** + * @parameter expression="${multi}" + */ + private Boolean multi; + + /** + * @parameter expression="${nodeDefaultVoid}" + */ + private Boolean nodeDefaultVoid; + + /** + * @parameter expression="${nodeFactory}" + */ + private Boolean nodeFactory; + + /** + * @parameter expression="${nodeScopeHook}" + */ + private Boolean nodeScopeHook; + + /** + * @parameter expression="${nodeUsesParser}" + */ + private Boolean nodeUsesParser; + + /** + * @parameter expression="${staticOption}" + */ + private Boolean staticOption; + + /** + * @parameter expression="${visitor}" + */ + private Boolean visitor; + + /** + * @parameter expression="${nodePackage}" + */ + private String nodePackage; + + /** + * @parameter expression="${visitorException}" + */ + private String visitorException; + + /** + * @parameter expression="${nodePrefix}" + */ + private String nodePrefix; + + /** + * Directory where the JJT file(s) are located. + * + * @parameter expression="${basedir}/src/main/jjtree" + * @required + */ + private File sourceDirectory; + + /** + * Directory where the output Java Files will be located. + * + * @parameter expression="${project.build.directory}/generated-sources/jjtree" + * @required + */ + private File outputDirectory; + + /** + * the directory to store the processed .jjt files + * + * @parameter expression="${basedir}/target" + */ + private String timestampDirectory; + + + + /** + * The granularity in milliseconds of the last modification date for testing + * whether a source needs recompilation + * + * @parameter expression="${lastModGranularityMs}" default-value="0" + */ + private int staleMillis; + + /** + * @parameter expression="${project}" + * @required + */ + private MavenProject project; + + public void execute() throws MojoExecutionException { + if (!outputDirectory.exists()) { + + outputDirectory.mkdirs(); + + } + + if (!FileUtils.fileExists(timestampDirectory)) { + FileUtils.mkdir(timestampDirectory); + } + + Set staleGrammars = computeStaleGrammars(); + + if (staleGrammars.isEmpty()) { + getLog().info("Nothing to process - all grammars are up to date"); + if (project != null) { + project.addCompileSourceRoot(outputDirectory.getAbsolutePath()); + } + return; + } + + for (Iterator i = staleGrammars.iterator(); i.hasNext();) { + File jjTreeFile = (File) i.next(); + try { + JJTree jjtree = new JJTree(); + jjtree.main(generateArgumentList(jjTreeFile.getAbsolutePath())); + + + FileUtils.copyFileToDirectory(jjTreeFile, new File( + timestampDirectory)); + } catch (Exception e) { + throw new MojoExecutionException("JJTree execution failed", e); + } + } + + if (project != null) { + project.addCompileSourceRoot(outputDirectory.getAbsolutePath()); + + } + } + + private String[] generateArgumentList(String jjTreeFilename) { + + ArrayList argsList = new ArrayList(); + + if (buildNodeFiles != null) { + argsList.add("-BUILD_NODE_FILES=" + buildNodeFiles.toString()); + } + + if (multi != null) { + argsList.add("-MULTI=" + multi); + } + + if (nodeDefaultVoid != null) { + argsList.add("-NODE_DEFAULT_VOID=" + nodeDefaultVoid); + } + + if (nodeFactory != null) { + argsList.add("-NODE_FACTORY=" + nodeFactory); + } + + if (nodePackage != null) { + argsList.add("-NODE_PACKAGE=" + nodePackage); + } + + if (nodePrefix != null) { + argsList.add("-NODE_PREFIX=" + nodePrefix); + } + + if (nodeScopeHook != null) { + argsList.add("-NODE_SCOPE_HOOK=" + nodeScopeHook); + } + + if (nodeUsesParser != null) { + argsList.add("-NODE_USES_PARSER=" + nodeUsesParser); + } + + if (visitor != null) { + argsList.add("-VISITOR=" + visitor); + } + + if (staticOption != null) { + argsList.add("-STATIC=" + staticOption); + } + + if (visitorException != null) { + argsList.add("-VISITOR_EXCEPTION=\'" + visitorException + "\'"); + } + + argsList.add("-OUTPUT_DIRECTORY=" + outputDirectory); + + argsList.add(jjTreeFilename); + + getLog().debug("argslist: " + argsList.toString()); + + return (String[]) argsList.toArray(new String[argsList.size()]); + } + + private Set computeStaleGrammars() throws MojoExecutionException { + File outDir = new File(timestampDirectory); + File sourceDir = sourceDirectory; + Set staleSources = new HashSet(); + + if (jjFile != null) { + this.getLog().info("Generating grammar for single file: " + jjFile); + File grammarFile = new File(sourceDirectory + "/" + jjFile); + staleSources.add(grammarFile); + } else { + SuffixMapping mapping = new SuffixMapping(".jjt", ".jjt"); + SuffixMapping mappingCAP = new SuffixMapping(".JJT", ".JJT"); + + SourceInclusionScanner scanner = new StaleSourceScanner(staleMillis); + + scanner.addSourceMapping(mapping); + scanner.addSourceMapping(mappingCAP); + + try { + staleSources.addAll(scanner.getIncludedSources(sourceDir, + outDir)); + } catch (InclusionScanException e) { + throw new MojoExecutionException( + "Error scanning source root: \'" + sourceDir + + "\' for stale grammars to reprocess.", e); + } + } + return staleSources; + } + + /** + * @return Returns the jjFile. + */ + public String getJjFile() { + return jjFile; + } +} Added: trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/java/org/codehaus/mojo/javacc/JavaCCMojo.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/java/org/codehaus/mojo/javacc/JavaCCMojo.java 2005-12-06 19:36:59 UTC (rev 1715) +++ trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/main/java/org/codehaus/mojo/javacc/JavaCCMojo.java 2005-12-06 20:03:01 UTC (rev 1716) @@ -0,0 +1,414 @@ +package org.codehaus.mojo.javacc; + +/* + * Copyright 2001-2005 The Codehaus. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.compiler.util.scan.InclusionScanException; +import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner; +import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner; +import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping; +import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.StringUtils; + + +/** + * @goal javacc + * @phase generate-sources + * @description Goal which parse a JJ file and transform it to Java Source Files. + * @author jr...@ex... + * @author jesse <jes...@gm...> + * @version $Id: JavaCCMojo.java 951 2005-11-29 19:53:12Z jesse $ + */ +public class JavaCCMojo + extends AbstractMojo +{ + /** + * @parameter expression=${lookAhead}" + */ + private Integer lookAhead; + + /** + * @parameter expression="${choiceAmbiguityCheck}" + */ + private Integer choiceAmbiguityCheck; + + /** + * @parameter expression=${otherAmbiguityCheck}" + */ + private Integer otherAmbiguityCheck; + + /** + * @parameter expression=${isStatic}" + */ + private Boolean isStatic; + + /** + * @parameter expression="${debugParser}" + */ + private Boolean debugParser; + + /** + * @parameter expression="${debugLookAhead}" + */ + private Boolean debugLookAhead; + + /** + * @parameter expression="${debugTokenManager}" + */ + private Boolean debugTokenManager; + + /** + * @parameter expression="${optimizeTokenManager}" + */ + private Boolean optimizeTokenManager; + + /** + * @parameter expression="${errorReporting}" + */ + private Boolean errorReporting; + + /** + * @parameter expression="${javaUnicodeEscape}" + */ + private Boolean javaUnicodeEscape; + + /** + * @parameter expression="${unicodeInput}" + */ + private Boolean unicodeInput; + + /** + * @parameter expression="${ignoreCase}" + */ + private Boolean ignoreCase; + + /** + * @parameter expression="${commonTokenAction}" + */ + private Boolean commonTokenAction; + + /** + * @parameter expression="${userTokenManager}" + */ + private Boolean userTokenManager; + + /** + * @parameter expression="${userCharStream}" + */ + private Boolean userCharStream; + + /** + * @parameter expression="${buildParser}" + */ + private Boolean buildParser; + + /** + * @parameter expression="${buildTokenManager}" + */ + private Boolean buildTokenManager; + + /** + * @parameter expression="${sanityCheck}" + */ + private Boolean sanityCheck; + + /** + * @parameter expression="${forceLaCheck}" + */ + private Boolean forceLaCheck; + + /** + * @parameter expression="${cacheTokens}" + */ + private Boolean cacheTokens; + + /** + * @parameter expression="${keepLineColumn}" + */ + private Boolean keepLineColumn; + + /** + * @parameter expression="${packageName}" + */ + private String packageName; + + /** + * Directory where the JJ file(s) are located. + * @parameter expression="${basedir}/src/main/javacc" + * @required + */ + private File sourceDirectory; + + /** + * Directory where the output Java Files will be located. + * @parameter expression="${project.build.directory}/generated-sources/javacc" + * @required + */ + private File outputDirectory; + + /** + * the directory to store the processed .jj files + * + * @parameter expression="${basedir}/target" + */ + private String timestampDirectory; + + /** + * The granularity in milliseconds of the last modification + * date for testing whether a source needs recompilation + * + * @parameter expression="${lastModGranularityMs}" default-value="0" + */ + private int staleMillis; + + /** + * @parameter expression="${project}" + * @required + */ + private MavenProject project; + + public void execute() + throws MojoExecutionException + { + // check packageName for . vs / + if ( packageName != null ) + { + packageName = StringUtils.replace(packageName, '.', File.separatorChar); + } + + if ( outputDirectory.exists() ) + { + if ( packageName != null ) + { + FileUtils.mkdir( outputDirectory + File.separator + packageName ); + } + else + { + try { + outputDirectory.createNewFile(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + if ( !FileUtils.fileExists( timestampDirectory ) ) + { + FileUtils.mkdir( timestampDirectory ); + } + + Set staleGrammars = computeStaleGrammars(); + + if ( staleGrammars.isEmpty() ) + { + getLog().info( "Nothing to process - all grammars are up to date" ); + if ( project != null ) + { + project.addCompileSourceRoot( outputDirectory.getAbsolutePath() ); + } + return; + } + + for ( Iterator i = staleGrammars.iterator(); i.hasNext(); ) + { + File javaccFile = (File) i.next(); + try + { + org.javacc.parser.Main.mainProgram( generateJavaCCArgumentList( javaccFile.getAbsolutePath()) ); + + FileUtils.copyFileToDirectory(javaccFile, new File(timestampDirectory)); + } + catch ( Exception e ) + { + throw new MojoExecutionException( "JavaCC execution failed", e ); + } + } + + if ( project != null ) + { + project.addCompileSourceRoot( outputDirectory.getAbsolutePath() ); + project.addCompileSourceRoot( "C:\\projects\\maven-jboss-head\\jboss-head\\server\\target\\gensrc" ); + } + } + + + private String[] generateJavaCCArgumentList(String javaccInput) { + + ArrayList argsList = new ArrayList(); + + if ( lookAhead != null ) + { + argsList.add("-LOOKAHEAD=" + lookAhead); + } + + if ( choiceAmbiguityCheck != null) + { + argsList.add("-CHOICE_AMBIGUITY_CHECK=" + choiceAmbiguityCheck); + } + + if ( otherAmbiguityCheck != null ) + { + argsList.add("-OTHER_AMBIGUITY_CHECK=" + otherAmbiguityCheck); + } + + if ( isStatic != null ) + { + argsList.add("-STATIC=" + isStatic); + } + + if ( debugParser != null ) + { + argsList.add("-DEBUG_PARSER=" + debugParser); + } + + if ( debugLookAhead != null ) + { + argsList.add("-DEBUG_LOOKAHEAD=" + debugLookAhead); + } + + if ( debugTokenManager != null ) + { + argsList.add("-DEBUG_TOKEN_MANAGER=" + debugTokenManager); + } + + if ( optimizeTokenManager != null ) + { + argsList.add("-OPTIMIZE_TOKEN_MANAGER=" + optimizeTokenManager); + } + + if ( errorReporting != null ) + { + argsList.add("-ERROR_REPORTING="+ errorReporting); + } + + if ( javaUnicodeEscape != null ) + { + argsList.add("-JAVA_UNICODE_ESCAPE=" + javaUnicodeEscape); + } + + if ( unicodeInput != null ) + { + argsList.add("-UNICODE_INPUT=" + unicodeInput); + } + + if ( ignoreCase != null ) + { + argsList.add("-IGNORE_CASE=" + ignoreCase); + } + + if ( commonTokenAction != null ) + { + argsList.add("-COMMON_TOKEN_ACTION=" + commonTokenAction); + } + + if ( userTokenManager != null ) + { + argsList.add("-USER_TOKEN_MANAGER=" + userTokenManager); + } + + if ( userCharStream != null ) + { + argsList.add("-USER_CHAR_STREAM=" + userCharStream); + } + + if ( buildParser != null ) + { + argsList.add("-BUILD_PARSER=" + buildParser); + } + + if ( buildTokenManager != null ) + { + argsList.add("-BUILD_TOKEN_MANAGER=" + buildTokenManager); + } + + if ( sanityCheck != null ) + { + argsList.add("-SANITY_CHECK=" + sanityCheck); + } + + if ( forceLaCheck != null ) + { + argsList.add("-FORCE_LA_CHECK=" + forceLaCheck); + } + + if ( cacheTokens != null ) + { + argsList.add("-CACHE_TOKENS=" + cacheTokens); + } + + if ( keepLineColumn != null ) + { + argsList.add("-KEEP_LINE_COLUMN=" + keepLineColumn); + } + + if ( packageName != null ) + { + argsList.add("-OUTPUT_DIRECTORY:" + outputDirectory + File.separator + packageName ); + } + else + { + argsList.add("-OUTPUT_DIRECTORY:" + outputDirectory ); + } + + argsList.add(javaccInput); + + getLog().debug("argslist: " + argsList.toString()); + + return (String[])argsList.toArray(new String[argsList.size()]); + } + + private Set computeStaleGrammars() throws MojoExecutionException + { + SuffixMapping mapping = new SuffixMapping( ".jj", ".jj" ); + SuffixMapping mappingCAP = new SuffixMapping( ".JJ", ".JJ" ); + + SourceInclusionScanner scanner = new StaleSourceScanner( staleMillis ); + + scanner.addSourceMapping( mapping ); + scanner.addSourceMapping( mappingCAP); + + File outDir = new File( timestampDirectory ); + + Set staleSources = new HashSet(); + + File sourceDir = sourceDirectory ; + + try + { + staleSources.addAll( scanner.getIncludedSources( sourceDir, outDir ) ); + } + catch ( InclusionScanException e ) + { + throw new MojoExecutionException( "Error scanning source root: \'" + sourceDir + "\' for stale grammars to reprocess.", e ); + } + + return staleSources; + } + + +} + Added: trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/site/apt/index.apt =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/site/apt/index.apt 2005-12-06 19:36:59 UTC (rev 1715) +++ trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/site/apt/index.apt 2005-12-06 20:03:01 UTC (rev 1716) @@ -0,0 +1,97 @@ + ------ + Maven 2 JavaCC plugin + ------ + <jr...@ex...> + Jesse McConnell <jes...@gm...> + ------ + July 27 2005 + ------ + +Maven 2 JavaCC plugin + + This plugin is for processing javacc files into java sources. + + http://www.javacc.org + + This plugin will process all *.jj files in the sourceDirectory into a + common generated sources output directory. This will occur during the + generate-resources phase and the sources directory will be added to the project + for the compile phase. + +Available Configuration Options: (param - default value) + + * sourceDirectory - src/main/javacc + + * outputDirectory - target/generated-sources/javacc + + * timestampDirectory - target (used so grammers are not constantly regenerated) + + * lookAhead - 1 + + * choiceAmbiguityCheck - 2 + + * otherAmbiguityCheck - 1 + + * isStatic - true + + * debugParser - false + + * debugLookAhead - false + + * debugTokenManager - false + + * optimizeTokenManager - true + + * errorReporting - true + + * javaUnicodeEscape - false + + * unicodeInput - false + + * ignoreCase - false + + * commonTokenAction - false + + * userTokenManager - false + + * userCharStream - false + + * buildParser - true + + * buildTokenManager - true + + * sanityCheck - true + + * forceLaCheck - false + + * cacheTokens - false + + * keepLineColumn - true + + [] + +Usage: + +------------------- +<project> + ... + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>javacc-maven-plugin</artifactId> + <version>0.6-SNAPSHOT</version> + <executions> + <execution> + <goals> + <goal>javacc</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + ... + </build> + ... +</project> +------------------- Added: trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/site/site.xml =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/site/site.xml 2005-12-06 19:36:59 UTC (rev 1715) +++ trunk/labs/jbossbuild/projects/maven-plugins/javacc-maven-plugin/src/site/site.xml 2005-12-06 20:03:01 UTC (rev 1716) @@ -0,0 +1,22 @@ +<project name="Mojo"> + <bannerLeft> + <name>Mojo</name> + <src>/images/mojo_logo.png</src> + <href>http://mojo.codehaus.org</href> + </bannerLeft> + <bannerRight> + <name>Codehaus</name> + <src>http://mojo.codehaus.org/images/codehaus-small.png</src> + <href>http://www.codehaus.org</href> + </bannerRight> + <body> + <links> + <item name="Mojo" href="http://mojo.codehaus.org"/> + <item name="Maven" href="http://maven.apache.org/maven2"/> + </links> + <menu name="Mojo"> + <item name="mojo" href="http://mojo.codehaus.org"/> + </menu> + ${reports} + </body> +</project> Added: trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/pom.xml =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/pom.xml 2005-12-06 19:36:59 UTC (rev 1715) +++ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/pom.xml 2005-12-06 20:03:01 UTC (rev 1716) @@ -0,0 +1,34 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>maven-plugin-parent</artifactId> + <groupId>org.apache.maven.plugins</groupId> + <version>2.0</version> + </parent> + <artifactId>maven-rmic-plugin</artifactId> + <version>1.0-alpha-1-SNAPSHOT</version> + <packaging>maven-plugin</packaging> + <name>Maven RMI Compiler Plugin</name> + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>2.0-alpha-3</version> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-archiver</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>plexus</groupId> + <artifactId>plexus-archiver</artifactId> + <version>1.0-alpha-1</version> + </dependency> + <dependency> + <groupId>plexus</groupId> + <artifactId>plexus-container-default</artifactId> + <version>1.0-alpha-3</version> + </dependency> + </dependencies> +</project> Added: trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/AbstractRmiMojo.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/AbstractRmiMojo.java 2005-12-06 19:36:59 UTC (rev 1715) +++ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/AbstractRmiMojo.java 2005-12-06 20:03:01 UTC (rev 1716) @@ -0,0 +1,299 @@ +package org.apache.maven.plugin.rmic; + +/* + * Copyright (c) 2005 Trygve Laugstol. All Rights Reserved. + */ + +import java.io.File; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.StringTokenizer; + +import org.apache.maven.artifact.DependencyResolutionRequiredException; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.project.MavenProject; + +/** + * @author <a href="mailto:tr...@in...">Trygve Laugstøl</a> + * @version $Id: AbstractRmiMojo.java 337 2005-07-26 21:33:58Z trygvis $ + */ +public abstract class AbstractRmiMojo + extends AbstractMojo +{ + // ---------------------------------------------------------------------- + // Configurable parameters + // ---------------------------------------------------------------------- + + + /** + * @parameter expression="${project}" + * @required + * @readonly + */ + private MavenProject project; + /** + * The class or classes to compile with the RMI compiler. + * + * @parameter + * @required + */ + private List remoteClasses; + + /** + * Specifies compiler location to use + * @parameter expression="sun" + * @required + */ + private String compilerId; + + /** + * Specifies path to where the rmic outputs should be stored + * @parameter expression="${project.build.directory}/rmi-stub-classes" + * @required + */ + private File outputClasses; + + /** + * The directory output location of generated source, casues -keepgenerated flag to be used + * @parameter + */ + private File sourcebase; + + /** + * Specify the jdk version for the generated stub code. Specifiy "1.1" to pass the "-v1.1" option + * to RMIC + * @parameter + */ + private String stubversion; + + /** + * Specify an inclusion pattern or comma seperated list of includsion patterns + * not yet implemented + * @parameter + */ + private String includes; + + /** + * Specify an exclusion pattern or comma seperated list of inclusion patterns + * not yet implemented + * @parameter + */ + private String excludes; + + /** + * indicates whether default excludes should be used or not ("yes/no") Default excludes are used when omitted + * @parameter + */ + private String defaultExcludes; + + /** + * check that classes implement Remote before handing them to rmic (default is false) + * @parameter expression="false" + */ + private boolean verify; + + /** + * indicates that portable (RMI/IIOP) stubs should be generated + * @parameter expression="false" + */ + private boolean iiop; + + /** + * additional arguments for IIOP class generation + * valid arguments are -always or -alwaysgenerate + * -nolocalstubs, -noValueMethods, -poa + * @parameter + */ + private List iiopOpts; + + /** + * indicates that IDL output files shold be generated + * @parameter expression=false + */ + private boolean idl; + + /** + * additional arguments for IDL file generation + * valid arguments are -always or -alwaysgenerate + * -factory, -idlModule + * + */ + private List idlopts; + + /** + * generate debug info (passes -g to rmic). Defaults to false + * @parameter expression="false" + */ + private boolean debug; + + + // ---------------------------------------------------------------------- + // Constant parameters + // ---------------------------------------------------------------------- + + /** + * @parameter expression="${project.build.outputDirectory}" + * @required + * @readonly + */ + private File classes; + + + //private List compileClasspaths; + + /** + * Specifies the path rmic used to look up classes. This option overrides + * the default or the CLASSPATH environment variable if it is set. + * Directories are seperated by semicolons. + * @parameter + */ + private String classPath; + + public List getRemoteClasses() + { + return remoteClasses; + } + + public String getCompilerId() + { + return compilerId; + } + + public File getOutputClasses() + { + return outputClasses; + } + + public File getClasses() + { + return classes; + } + + public List getClasspath() + { + List classPaths = new ArrayList(); + + StringTokenizer tokenizer = new StringTokenizer( classPath, ";" ); + + while ( tokenizer.hasMoreElements() ) + { + String s = (String) tokenizer.nextElement(); + + s = s.trim(); + + classPaths.add( s ); + } + + try { + for (Iterator it=project.getCompileClasspathElements().iterator(); it.hasNext(); ) + { + classPaths.add((String) it.next()); + } + } catch (DependencyResolutionRequiredException e) { + this.getLog().error("Error when resolving the classpath"); + + } + + + + return classPaths; + + } + + protected List getSourceClasses() + { + List sourceClasses = new ArrayList(); + + + + for (Iterator it=getRemoteClasses().iterator(); it.hasNext(); ) + { + sourceClasses.add((String) it.next()); + } + + /* + while (it.hasNext()) + // sourceClasses.add(it.) + /* + StringTokenizer tokenizer = new StringTokenizer( getRemoteClasses(), "," ); + + while ( tokenizer.hasMoreElements() ) + { + String s = (String) tokenizer.nextElement(); + + s = s.trim(); + + sourceClasses.add( s ); + } +*/ + return sourceClasses; + } + /** + * @return Returns the debug. + */ + public boolean getDebug() { + return debug; + } + /** + * @return Returns the defaultExcludes. + */ + public String getDefaultExcludes() { + return defaultExcludes; + } + /** + * @return Returns the excludes. + */ + public String getExcludes() { + return excludes; + } + /** + * @return Returns the idl. + */ + public boolean getIdl() { + return idl; + } + /** + * @return Returns the idlopts. + */ + public List getIdlopts() { + return idlopts; + } + /** + * @return Returns the iiop. + */ + public boolean getIiop() { + return iiop; + } + /** + * @return Returns the iiopOpts. + */ + public List getIiopOpts() { + return iiopOpts; + } + /** + * @return Returns the includes. + */ + public String getIncludes() { + return includes; + } + /** + * @return Returns the sourcebase. + */ + public File getSourcebase() { + return sourcebase; + } + /** + * @return Returns the stubversion. + */ + public String getStubversion() { + return stubversion; + } + /** + * @return Returns the verify. + */ + public boolean getVerify() { + return verify; + } +} Added: trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/DefaultRmiCompilerManager.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/DefaultRmiCompilerManager.java 2005-12-06 19:36:59 UTC (rev 1715) +++ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/DefaultRmiCompilerManager.java 2005-12-06 20:03:01 UTC (rev 1716) @@ -0,0 +1,54 @@ +package org.apache.maven.plugin.rmic; + +/* + * Copyright (c) 2004, Codehaus.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import java.util.Map; + +/** + * @author <a href="mailto:tr...@in...">Trygve Laugstøl</a> + * @version $Id: DefaultRmiCompilerManager.java 337 2005-07-26 21:33:58Z trygvis $ + */ +public class DefaultRmiCompilerManager implements RmiCompilerManager +{ + /** + * @plexus.requirement role=RmiCompiler + */ + private Map rmiCompilers; + + // ---------------------------------------------------------------------- + // + // ---------------------------------------------------------------------- + + public RmiCompiler getRmiCompiler( String id ) + throws NoSuchRmiCompilerException + { + RmiCompiler rmiCompiler = (RmiCompiler) rmiCompilers.get( id ); + + if ( rmiCompiler == null ) + { + throw new NoSuchRmiCompilerException( id ); + } + + return rmiCompiler; + } +} Added: trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/NoSuchRmiCompilerException.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/NoSuchRmiCompilerException.java 2005-12-06 19:36:59 UTC (rev 1715) +++ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/NoSuchRmiCompilerException.java 2005-12-06 20:03:01 UTC (rev 1716) @@ -0,0 +1,43 @@ +package org.apache.maven.plugin.rmic; + +/* + * Copyright (c) 2004, Codehaus.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/** + * @author <a href="mailto:tr...@in...">Trygve Laugstøl</a> + * @version $Id: NoSuchRmiCompilerException.java 337 2005-07-26 21:33:58Z trygvis $ + */ +public class NoSuchRmiCompilerException + extends Exception +{ + private String id; + + public NoSuchRmiCompilerException( String id ) + { + this.id = id; + } + + public String getId() + { + return id; + } +} Added: trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/PackageRmiMojo.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/PackageRmiMojo.java 2005-12-06 19:36:59 UTC (rev 1715) +++ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/PackageRmiMojo.java 2005-12-06 20:03:01 UTC (rev 1716) @@ -0,0 +1,87 @@ +package org.apache.maven.plugin.rmic; + +/* + * Copyright (c) 2005 Trygve Laugstol. All Rights Reserved. + */ + +import java.io.File; +import java.io.IOException; +import java.util.Iterator; +import java.util.jar.JarFile; + +import org.apache.maven.archiver.MavenArchiver; +import org.apache.maven.archiver.MavenArchiveConfiguration; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.project.MavenProject; + +import org.codehaus.plexus.archiver.jar.JarArchiver; +import org.codehaus.plexus.archiver.ArchiverException; + +/** + * @goal package + * + * @phase package + * + * @requiresDependencyResolution + * + * @description Packages the RMI stubs and client classes. + * + * @author <a href="mailto:tr...@in...">Trygve Laugstøl</a> + * @version $Id: PackageRmiMojo.java 337 2005-07-26 21:33:58Z trygvis $ + */ +public class PackageRmiMojo + extends AbstractRmiMojo +{ + /** + * @parameter expression="${project.build.directory}" + * @required + */ + private File target; + + /** + * @parameter expression="${project.build.finalname}" + * @required + */ + private String finalName; + + /** + * @parameter expression="${project}" + */ + private MavenProject project; + + // ---------------------------------------------------------------------- + // + // ---------------------------------------------------------------------- + + public void execute() + throws MojoExecutionException + { + File clientJar = new File( target, finalName + "-client.jar" ); + + try + { + JarArchiver jarArchiver = new JarArchiver(); + + jarArchiver.setDestFile( clientJar ); + + // ---------------------------------------------------------------------- + // Add the *_Stub classes + // ---------------------------------------------------------------------- + + for ( Iterator it = getSourceClasses().iterator(); it.hasNext(); ) + { + String clazz = (String) it.next(); + + String[] includes = new String[] { + clazz.replace( '.', '/' ) + "_Stub.class", + }; + + jarArchiver.addDirectory( getOutputClasses(), includes, new String[ 0 ] ); + } + } + catch ( ArchiverException e ) + { + throw new MojoExecutionException( "Could not create the client jar", e ); + } + } +} Added: trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/ProcessClassesRmiMojo.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/ProcessClassesRmiMojo.java 2005-12-06 19:36:59 UTC (rev 1715) +++ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/ProcessClassesRmiMojo.java 2005-12-06 20:03:01 UTC (rev 1716) @@ -0,0 +1,149 @@ +package org.apache.maven.plugin.rmic; + +/* + * Copyright (c) 2004, Codehaus.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import java.io.File; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.StringTokenizer; + +import org.apache.maven.plugin.MojoExecutionException; + +/** + * @goal process-classes + * + * @phase process-classes + * + * @requiresDependencyResolution + * + * @description Enhances the application data objects. + * + * @author <a href="mailto:tr...@in...">Trygve Laugstøl </a> + * @version $Id: ProcessClassesRmiMojo.java 337 2005-07-26 21:33:58Z trygvis $ + */ +public class ProcessClassesRmiMojo extends AbstractRmiMojo { + // ---------------------------------------------------------------------- + // Configurable parameters + // ---------------------------------------------------------------------- + + /** + * @parameter expression="sun" + * @required + */ + private String compilerId; + + // ---------------------------------------------------------------------- + // Constant parameters + // ---------------------------------------------------------------------- + + /** + * @parameter expression="${component.org.apache.maven.plugin.rmic.RmiCompilerManager}" + * @required + * @readonly + */ + private RmiCompilerManager rmiCompilerManager; + + public void execute() throws MojoExecutionException { + RmiCompiler rmiCompiler; + + try { + rmiCompiler = rmiCompilerManager.getRmiCompiler(compilerId); + } catch (NoSuchRmiCompilerException e) { + throw new MojoExecutionException("No such RMI compiler installed '" + + compilerId + "'."); + } + + if (!getOutputClasses().isDirectory()) { + if (!getOutputClasses().mkdirs()) { + throw new MojoExecutionException( + "Could not make output directory: " + "'" + + getOutputClasses().getAbsolutePath() + "'."); + } + } + + try { + List classPaths = getClasspath(); + + File[] compileClasspath = new File[classPaths.size()]; + + Iterator it; + + int i; + + for (it = classPaths.iterator(), i = 0; it.hasNext(); i++) { + compileClasspath[i] = new File((String) it.next()); + } + + List sourceClasses = getSourceClasses(); + + if (getVerify() == true) { + this.getLog().info("Verify is not yet implemented."); + + for (it = sourceClasses.iterator(), i = 0; it.hasNext(); i++) { + boolean result = this.isValidRmiRemote((String) it.next()); + + } + + } + + rmiCompiler.execute(compileClasspath, sourceClasses, + getOutputClasses(), getSourcebase(), getStubversion(), + getIncludes(), getExcludes(), getDefaultExcludes(), + getVerify(), getIiop(), getIiopOpts(), getIdl(), + getIdlopts(), getDebug()); + + this.getLog().info("RMIC completed."); + } catch (RmiCompilerException e) { + throw new MojoExecutionException( + "Error while executing the RMI compiler.", e); + } + } + + public boolean isValidRmiRemote(String classname) { + try { + //TODO: need to define our own classloader to load the class + Class testClass = Class.forName(classname); + // One cannot RMIC an interface for "classic" RMI (JRMP) + if (testClass.isInterface() && !getIiop() && !getIdl()) { + return false; + } + + } catch (ClassNotFoundException e) { + this.getLog().error( + "Unable to verify class " + classname + + ". It could not be found."); + } catch (NoClassDefFoundError e) { + this.getLog().error( + "Unable to verify class " + classname + + ". It is not defined."); + } catch (Throwable t) { + this.getLog().error( + "Unable to verify class " + classname + + ". Loading caused Exception: " + t.getMessage()); + } + // we only get here if an exception has been thrown + return false; + } + +} Added: trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/RmiCompiler.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/RmiCompiler.java 2005-12-06 19:36:59 UTC (rev 1715) +++ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/RmiCompiler.java 2005-12-06 20:03:01 UTC (rev 1716) @@ -0,0 +1,41 @@ +package org.apache.maven.plugin.rmic; + +/* + * Copyright (c) 2004, Codehaus.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import java.util.List; +import java.io.File; +import java.net.URL; + +/** + * @author <a href="mailto:tr...@in...">Trygve Laugstøl</a> + * @version $Id: RmiCompiler.java 337 2005-07-26 21:33:58Z trygvis $ + */ +public interface RmiCompiler +{ + String ROLE = RmiCompiler.class.getName(); + + void execute( File[] classLoader, List remoteClasses, File outputClasses, File sourceBase, String stubVersion, String includes, + String excludes, String defaultExcludes, boolean verify, boolean iiop, List iiopOpts, boolean idl, List idlOpts, + boolean debug) + throws RmiCompilerException; +} Added: trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/RmiCompilerException.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/RmiCompilerException.java 2005-12-06 19:36:59 UTC (rev 1715) +++ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/RmiCompilerException.java 2005-12-06 20:03:01 UTC (rev 1716) @@ -0,0 +1,41 @@ +package org.apache.maven.plugin.rmic; + +/* + * Copyright (c) 2004, Codehaus.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/** + * @author <a href="mailto:tr...@in...">Trygve Laugstøl</a> + * @version $Id: RmiCompilerException.java 337 2005-07-26 21:33:58Z trygvis $ + */ +public class RmiCompilerException + extends Exception +{ + public RmiCompilerException( String message ) + { + super( message ); + } + + public RmiCompilerException( String message, Throwable cause ) + { + super( message, cause ); + } +} Added: trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/RmiCompilerManager.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/RmiCompilerManager.java 2005-12-06 19:36:59 UTC (rev 1715) +++ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/RmiCompilerManager.java 2005-12-06 20:03:01 UTC (rev 1716) @@ -0,0 +1,11 @@ +package org.apache.maven.plugin.rmic; + +/** + * @author <a href="mailto:tr...@in...">Trygve Laugstøl</a> + * @version $Id: RmiCompilerManager.java 337 2005-07-26 21:33:58Z trygvis $ + */ +public interface RmiCompilerManager +{ + RmiCompiler getRmiCompiler( String id ) + throws NoSuchRmiCompilerException; +} Added: trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/SunRmiCompiler.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/SunRmiCompiler.java 2005-12-06 19:36:59 UTC (rev 1715) +++ trunk/labs/jbossbuild/projects/maven-plugins/maven-rmic-plugin/src/main/java/org/apache/maven/plugin/rmic/SunRmiCompiler.java 2005-12-06 20:03:01 UTC (rev 1716) @@ -0,0 +1,263 @@ +package org.apache.maven.plugin.rmic; + +/* + * Copyright (c) 2004, Codehaus.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import java.io.File; +import java.io.OutputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + +import org.codehaus.plexus.logging.AbstractLogEnabled; + +/** + * @author <a href="mailto:tr...@in...">Trygve Laugstøl </a> + * @version $Id: SunRmiCompiler.java 337 2005-07-26 21:33:58Z trygvis $ + */ +public class SunRmiCompiler extends AbstractLogEnabled implements RmiCompiler { + // ---------------------------------------------------------------------- + // RmiCompiler Implementation + // ---------------------------------------------------------------------- + +public void execute( File[] path, List remoteClasses, File outputClasses, File sourceBase, String stubVersion, String includes, + String excludes, String defaultExcludes, boolean verify, boolean iiop, List iiopOpts, boolean idl, List idlOpts, + boolean debug) + throws RmiCompilerException + { + //first we must find the path to the SUN rmic classes + String[] classes = { + "sun.rmi.rmic.newrmic.Main", + "sun.rmi.rmic.Main", + }; + + List elements = new ArrayList(); + + elements.addAll( Arrays.asList( path ) ); + + File toolsJar = new File( System.getProperty( "java.home" ), "../lib/tools.jar" ); + + if ( toolsJar.isFile() ) + { + elements.add( toolsJar ); + } + + URL[] classpath = new URL[ elements.size() ]; + + for ( int i = 0; i < elements.size(); i++ ) + { + classpath[ i ] = fileToURL( (File) elements.get( i ) ); + } + + ClassLoader classLoader = new URLClassLoader( classpath, ClassLoader.getSystemClassLoader() ); + + Class clazz = null; + + for ( int i = 0; i < classes.length; i++ ) + { + String className = classes[ i ]; + + clazz = findClass( classLoader, className ); + + if ( clazz != null ) + { + break; + } + } + + //throw error if classes are not found + if ( clazz == null ) + { + getLogger().info( "Looked for these classes:" ); + + for ( int i = 0; i < classes.length; i++ ) + { + String className = classes[ i ]; + + getLogger().info( " * " + className ); + } + + getLogger().info( "With this classpath:" ); + + for ( int it = 0; it < classpath.length; it++ ) + { + URL url = classpath[ it ]; + + getLogger().info( " * " + url.t... [truncated message content] |
From: <jbo...@li...> - 2005-12-06 19:37:22
|
Author: aron.gombas Date: 2005-12-06 14:36:59 -0500 (Tue, 06 Dec 2005) New Revision: 1715 Modified: trunk/labs/kosmos/build/kosmos-project.properties Log: Verno inced Modified: trunk/labs/kosmos/build/kosmos-project.properties =================================================================== --- trunk/labs/kosmos/build/kosmos-project.properties 2005-12-06 19:17:26 UTC (rev 1714) +++ trunk/labs/kosmos/build/kosmos-project.properties 2005-12-06 19:36:59 UTC (rev 1715) @@ -1,3 +1,3 @@ project.name=Kosmos project.name.short=kosmos -project.version=0.1.5 +project.version=0.1.6-dev |
From: <jbo...@li...> - 2005-12-06 19:17:30
|
Author: rl...@jb... Date: 2005-12-06 14:17:26 -0500 (Tue, 06 Dec 2005) New Revision: 1714 Removed: trunk/labs/jbossbuild/projects/maven-plugins/pom.xml trunk/labs/jbossbuild/projects/maven-plugins/src/ Log: get rid of bad files Deleted: trunk/labs/jbossbuild/projects/maven-plugins/pom.xml =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/pom.xml 2005-12-06 18:58:54 UTC (rev 1713) +++ trunk/labs/jbossbuild/projects/maven-plugins/pom.xml 2005-12-06 19:17:26 UTC (rev 1714) @@ -1,13 +0,0 @@ -<project> - <parent> - <artifactId>maven-plugin-parent</artifactId> - <groupId>org.apache.maven.plugins</groupId> - <version>2.0</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>maven-clean-plugin</artifactId> - <packaging>maven-plugin</packaging> - <name>Maven Clean Plugin</name> - <version>2.0.1-SNAPSHOT</version> - <inceptionYear>2001</inceptionYear> -</project> \ No newline at end of file |
Author: rl...@jb... Date: 2005-12-06 13:58:54 -0500 (Tue, 06 Dec 2005) New Revision: 1713 Added: trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/ trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/pom.xml trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/src/ trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/src/main/ trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/src/main/java/ trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/src/main/java/org/ trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/src/main/java/org/apache/ trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/ trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/ trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/ trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java Log: intial entry Added: trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/pom.xml =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/pom.xml 2005-12-06 18:58:06 UTC (rev 1712) +++ trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/pom.xml 2005-12-06 18:58:54 UTC (rev 1713) @@ -0,0 +1,13 @@ +<project> + <parent> + <artifactId>maven-plugin-parent</artifactId> + <groupId>org.apache.maven.plugins</groupId> + <version>2.0</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>maven-clean-plugin</artifactId> + <packaging>maven-plugin</packaging> + <name>Maven Clean Plugin</name> + <version>2.0.1-SNAPSHOT</version> + <inceptionYear>2001</inceptionYear> +</project> \ No newline at end of file Added: trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java 2005-12-06 18:58:06 UTC (rev 1712) +++ trunk/labs/jbossbuild/projects/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java 2005-12-06 18:58:54 UTC (rev 1713) @@ -0,0 +1,163 @@ +package org.apache.maven.plugin.clean; + +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; + +import java.io.File; + +/** + * Goal which cleans the build. + + * @goal clean + * @author <a href="mailto:eve...@ma...">Emmanuel Venisse</a> + * @version $Id: CleanMojo.java 307230 2005-10-08 01:19:09Z brett $ + */ +public class CleanMojo + extends AbstractMojo +{ + private static final int DELETE_RETRY_SLEEP_MILLIS = 10; + + /** + * This is where build results go. + * + * @parameter expression="${project.build.directory}" + * @required + * @readonly + */ + private File directory; + + /** + * This is where compiled classes go. + * + * @parameter expression="${project.build.outputDirectory}" + * @required + * @readonly + */ + private File outputDirectory; + + /** + * This is where compiled test classes go. + * + * @parameter expression="${project.build.testOutputDirectory}" + * @required + * @readonly + */ + private File testOutputDirectory; + + public void execute() + throws MojoExecutionException + { + removeDirectory( directory ); + removeDirectory( outputDirectory ); + removeDirectory( testOutputDirectory ); + } + + private void removeDirectory( File dir ) + throws MojoExecutionException + { + if ( dir != null ) + { + if ( dir.exists() && dir.isDirectory() ) + { + getLog().info( "Deleting directory " + dir.getAbsolutePath() ); + removeDir( dir ); + } + } + } + + /** + * Accommodate Windows bug encountered in both Sun and IBM JDKs. + * Others possible. If the delete does not work, call System.gc(), + * wait a little and try again. + */ + private boolean delete( File f ) + { + if ( !f.delete() ) + { + if ( System.getProperty( "os.name" ).toLowerCase().indexOf( "windows" ) > -1 ) + { + System.gc(); + } + try + { + Thread.sleep( DELETE_RETRY_SLEEP_MILLIS ); + return f.delete(); + } + catch ( InterruptedException ex ) + { + return f.delete(); + } + } + return true; + } + + /** + * Delete a directory + * + * @param d the directory to delete + */ + protected void removeDir( File d ) + throws MojoExecutionException + { + String[] list = d.list(); + if ( list == null ) + { + list = new String[0]; + } + for ( int i = 0; i < list.length; i++ ) + { + String s = list[i]; + File f = new File( d, s ); + if ( f.isDirectory() ) + { + removeDir( f ); + } + else + { + if ( !delete( f ) ) + { + String message = "Unable to delete file " + f.getAbsolutePath(); +// TODO:... +// if ( failOnError ) +// { + throw new MojoExecutionException( message ); +// } +// else +// { +// getLog().info( message ); +// } + } + } + } + + if ( !delete( d ) ) + { + String message = "Unable to delete directory " + d.getAbsolutePath(); +// TODO:... +// if ( failOnError ) +// { + throw new MojoExecutionException( message ); +// } +// else +// { +// getLog().info( message ); +// } + } + } +} |
Author: rl...@jb... Date: 2005-12-06 13:58:06 -0500 (Tue, 06 Dec 2005) New Revision: 1712 Added: trunk/labs/jbossbuild/projects/ trunk/labs/jbossbuild/projects/maven-plugins/ trunk/labs/jbossbuild/projects/maven-plugins/pom.xml trunk/labs/jbossbuild/projects/maven-plugins/src/ trunk/labs/jbossbuild/projects/maven-plugins/src/main/ trunk/labs/jbossbuild/projects/maven-plugins/src/main/java/ trunk/labs/jbossbuild/projects/maven-plugins/src/main/java/org/ trunk/labs/jbossbuild/projects/maven-plugins/src/main/java/org/apache/ trunk/labs/jbossbuild/projects/maven-plugins/src/main/java/org/apache/maven/ trunk/labs/jbossbuild/projects/maven-plugins/src/main/java/org/apache/maven/plugin/ trunk/labs/jbossbuild/projects/maven-plugins/src/main/java/org/apache/maven/plugin/clean/ trunk/labs/jbossbuild/projects/maven-plugins/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java Log: Initial entry of maven clean plugin Added: trunk/labs/jbossbuild/projects/maven-plugins/pom.xml =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/pom.xml 2005-12-06 17:19:16 UTC (rev 1711) +++ trunk/labs/jbossbuild/projects/maven-plugins/pom.xml 2005-12-06 18:58:06 UTC (rev 1712) @@ -0,0 +1,13 @@ +<project> + <parent> + <artifactId>maven-plugin-parent</artifactId> + <groupId>org.apache.maven.plugins</groupId> + <version>2.0</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>maven-clean-plugin</artifactId> + <packaging>maven-plugin</packaging> + <name>Maven Clean Plugin</name> + <version>2.0.1-SNAPSHOT</version> + <inceptionYear>2001</inceptionYear> +</project> \ No newline at end of file Added: trunk/labs/jbossbuild/projects/maven-plugins/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java 2005-12-06 17:19:16 UTC (rev 1711) +++ trunk/labs/jbossbuild/projects/maven-plugins/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java 2005-12-06 18:58:06 UTC (rev 1712) @@ -0,0 +1,163 @@ +package org.apache.maven.plugin.clean; + +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; + +import java.io.File; + +/** + * Goal which cleans the build. + + * @goal clean + * @author <a href="mailto:eve...@ma...">Emmanuel Venisse</a> + * @version $Id: CleanMojo.java 307230 2005-10-08 01:19:09Z brett $ + */ +public class CleanMojo + extends AbstractMojo +{ + private static final int DELETE_RETRY_SLEEP_MILLIS = 10; + + /** + * This is where build results go. + * + * @parameter expression="${project.build.directory}" + * @required + * @readonly + */ + private File directory; + + /** + * This is where compiled classes go. + * + * @parameter expression="${project.build.outputDirectory}" + * @required + * @readonly + */ + private File outputDirectory; + + /** + * This is where compiled test classes go. + * + * @parameter expression="${project.build.testOutputDirectory}" + * @required + * @readonly + */ + private File testOutputDirectory; + + public void execute() + throws MojoExecutionException + { + removeDirectory( directory ); + removeDirectory( outputDirectory ); + removeDirectory( testOutputDirectory ); + } + + private void removeDirectory( File dir ) + throws MojoExecutionException + { + if ( dir != null ) + { + if ( dir.exists() && dir.isDirectory() ) + { + getLog().info( "Deleting directory " + dir.getAbsolutePath() ); + removeDir( dir ); + } + } + } + + /** + * Accommodate Windows bug encountered in both Sun and IBM JDKs. + * Others possible. If the delete does not work, call System.gc(), + * wait a little and try again. + */ + private boolean delete( File f ) + { + if ( !f.delete() ) + { + if ( System.getProperty( "os.name" ).toLowerCase().indexOf( "windows" ) > -1 ) + { + System.gc(); + } + try + { + Thread.sleep( DELETE_RETRY_SLEEP_MILLIS ); + return f.delete(); + } + catch ( InterruptedException ex ) + { + return f.delete(); + } + } + return true; + } + + /** + * Delete a directory + * + * @param d the directory to delete + */ + protected void removeDir( File d ) + throws MojoExecutionException + { + String[] list = d.list(); + if ( list == null ) + { + list = new String[0]; + } + for ( int i = 0; i < list.length; i++ ) + { + String s = list[i]; + File f = new File( d, s ); + if ( f.isDirectory() ) + { + removeDir( f ); + } + else + { + if ( !delete( f ) ) + { + String message = "Unable to delete file " + f.getAbsolutePath(); +// TODO:... +// if ( failOnError ) +// { + throw new MojoExecutionException( message ); +// } +// else +// { +// getLog().info( message ); +// } + } + } + } + + if ( !delete( d ) ) + { + String message = "Unable to delete directory " + d.getAbsolutePath(); +// TODO:... +// if ( failOnError ) +// { + throw new MojoExecutionException( message ); +// } +// else +// { +// getLog().info( message ); +// } + } + } +} |
Author: szimano Date: 2005-12-06 12:19:16 -0500 (Tue, 06 Dec 2005) New Revision: 1711 Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/MediaDataSource.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/ShotokuDataSource.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiPage.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/GetRefsFromPagePlugin.java trunk/forge/portal-extensions/jbosswiki/wiki-management/src/java/org/jboss/wiki/management/WikiService.java Log: general support for wikipage metadata http://jira.jboss.com/jira/browse/JBWIKI-16 Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java 2005-12-06 13:13:22 UTC (rev 1710) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java 2005-12-06 17:19:16 UTC (rev 1711) @@ -82,7 +82,7 @@ private File pageDictionaryFile; private WikiEngine wikiEngine; - + private Logger log; public void setWikiEngine(WikiEngine wikiEngine) { @@ -91,7 +91,7 @@ public FileDataSource() { log = Logger.getLogger(FileDataSource.class); - + log.info("Looking for props file !"); Properties fileDSProps = new Properties(); @@ -102,21 +102,20 @@ .getResourceAsStream(propFileName)); } catch (IOException ioe) { - log.error("Can't load the file " + propFileName + "\n" - , ioe); + log.error("Can't load the file " + propFileName + "\n", ioe); } loadProperties(fileDSProps); File mainWikiDir = new File(pathToMedia); File attWikiDir = new File(pathToAttachments); - + if (!mainWikiDir.exists()) mainWikiDir.mkdirs(); - + if (!attWikiDir.exists()) attWikiDir.mkdirs(); - + pageModProps = new Properties(); modFile = new File(pathToMedia + "/" + propModFileName); @@ -132,13 +131,12 @@ pageModProps.load(fis); } catch (IOException ioe) { - log.error("Can't load the file " + propModFileName + "\n" - , ioe); + log.error("Can't load the file " + propModFileName + "\n", ioe); } finally { try { fis.close(); } catch (IOException ioe) { - log.error("Can't close input stream \n" , ioe); + log.error("Can't close input stream \n", ioe); } } @@ -174,7 +172,7 @@ try { pageDictionaryFile.createNewFile(); } catch (IOException e) { - log.error("Cannot create dictionary file: ",e); + log.error("Cannot create dictionary file: ", e); } } else { // there is dictionary file. Load props from it @@ -250,10 +248,9 @@ } log.info("Opening files"); - File pageFile = new File(pathToMedia + "/OLD/" + uid - + "/" + (page.getLastVersion() - 1) + ".txt"); - File pageOldFile = new File(pathToMedia + "/" + uid - + ".txt"); + File pageFile = new File(pathToMedia + "/OLD/" + uid + "/" + + (page.getLastVersion() - 1) + ".txt"); + File pageOldFile = new File(pathToMedia + "/" + uid + ".txt"); FileOutputStream pageFileWriter; FileInputStream pageFileReader; @@ -285,11 +282,9 @@ pageFileWriter.close(); status = true; } catch (FileNotFoundException fnfe) { - log.error("[FILEDATASOURCE]: Cannot save page: " - , fnfe); + log.error("[FILEDATASOURCE]: Cannot save page: ", fnfe); } catch (IOException ioe) { - log.error("[FILEDATASOURCE]: Cannot save page: " - , ioe); + log.error("[FILEDATASOURCE]: Cannot save page: ", ioe); } } else { // there is no page on disk. We have to create new one. @@ -297,8 +292,7 @@ try { // create needed dirs - File newPageFile = new File(pathToMedia + "/OLD/" - + uid); + File newPageFile = new File(pathToMedia + "/OLD/" + uid); newPageFile.mkdirs(); // write the page @@ -388,8 +382,9 @@ } } catch (IOException e) { - log.error("Cannot create page props file for page: " - + pageName,e); + log.error( + "Cannot create page props file for page: " + pageName, + e); } return pageProps; } @@ -448,33 +443,34 @@ } } - - public void saveRolesSet(String uid, Set<String> roles, int action) throws DataSourceException { + + public void saveRolesSet(String uid, Set<String> roles, int action) + throws DataSourceException { File rolesFile; try { rolesFile = getRolesFile(uid, action); - + if (rolesFile == null) throw new DataSourceException("Wrong action number"); - + } catch (IOException e) { throw new DataSourceException(e); } - + FileOutputStream fos = null; try { fos = new FileOutputStream(rolesFile); - + Properties roleProps = new Properties(); - + int i = 1; - + for (String roleName : roles) { - roleProps.setProperty("Role."+i++, roleName); + roleProps.setProperty("Role." + i++, roleName); } - + roleProps.store(fos, SAVE_COMMENT); - + fos.close(); } catch (FileNotFoundException e) { throw new DataSourceException(e); @@ -486,47 +482,49 @@ } throw new DataSourceException(e); } - + } - + private File getRolesFile(String uid, int action) throws IOException { - String fileName = (action == MediaDataSource.EDITABLE) ? "editRoles" : (action == MediaDataSource.VIEWABLE) ? "viewRoles" : null; - + String fileName = (action == MediaDataSource.EDITABLE) ? "editRoles" + : (action == MediaDataSource.VIEWABLE) ? "viewRoles" : null; + if (fileName == null) return null; - - File rolesFile = new File(pathToMedia + "/OLD/" + uid + "/" + fileName + ".properties"); - + + File rolesFile = new File(pathToMedia + "/OLD/" + uid + "/" + fileName + + ".properties"); + if (!rolesFile.exists()) { rolesFile.createNewFile(); } - + return rolesFile; } - + private Set<String> getRoles(String uid, int action) throws IOException { Set<String> set = new TreeSet<String>(); - + File rolesFile = getRolesFile(uid, action); - + if (rolesFile == null) return null; - + FileInputStream rolesFileIs = new FileInputStream(rolesFile); - + Properties roleProps = new Properties(); - + roleProps.load(rolesFileIs); - + int i = 1; - - while (roleProps.getProperty("Role."+i) != null) { - set.add(roleProps.getProperty("Role."+i)); + + while (roleProps.getProperty("Role." + i) != null) { + set.add(roleProps.getProperty("Role." + i)); i++; } - + rolesFileIs.close(); - + return set; } @@ -577,20 +575,26 @@ (pageMods & EDITABLE) == EDITABLE); page.setLength(pageFile.length()); - + try { page.setEditRoles(getRoles(pageName, EDITABLE)); } catch (IOException e) { - log.error("Couldn't read edit roles for page: "+pageName, e); + log.error("Couldn't read edit roles for page: " + pageName, + e); } try { page.setViewRoles(getRoles(pageName, VIEWABLE)); } catch (IOException e) { - log.error("Couldn't read view roles for page: "+pageName, e); + log.error("Couldn't read view roles for page: " + pageName, + e); } } } + // get Metadata props. + if (page != null) // page exists at all + page.setMetaDataProps(getMetadataProps(pageName)); + return page; } @@ -601,7 +605,8 @@ public WikiPage getPage(String pageName, String languageCode) { if (languageCode != null) { - log.info("As for now, languages aren't supported in the wiki. Please do not use language codes"); + log + .info("As for now, languages aren't supported in the wiki. Please do not use language codes"); } return getPage(pageName); } @@ -609,7 +614,8 @@ public WikiPage getPageAtVersion(WikiPage originPage, boolean loadContent, String languageCode, int version) { if (languageCode != null) { - log.info("As for now, languages aren't supported in the wiki. Please do not use language codes"); + log + .info("As for now, languages aren't supported in the wiki. Please do not use language codes"); } return getPageAtVersion(originPage, loadContent, version); @@ -633,8 +639,8 @@ if (page != null) { if (page.getLastVersion() < version) { - log.info("There is no version " + version - + " of page " + page.getName()); + log.info("There is no version " + version + " of page " + + page.getName()); return null; } @@ -651,8 +657,8 @@ /* * cal.setTime(new Date()); * - * log.info("PAGE "+page.getName()+" loaded in: - * "+(cal.getTimeInMillis() - oldMilis)); + * log.info("PAGE "+page.getName()+" loaded in: "+(cal.getTimeInMillis() - + * oldMilis)); */ return page; } @@ -717,8 +723,8 @@ } } - public void addAttachment(InputStream attFile, String attName, WikiPage page, - String user) { + public void addAttachment(InputStream attFile, String attName, + WikiPage page, String user) { String pageName = page.getName(); Properties attProps = getAttProps(pageName, attName, true); @@ -880,15 +886,13 @@ FileInputStream fis; try { fis = new FileInputStream(file); - return new WikiAttachment(attachementName, - new Date(file.lastModified()), user, file.length(), fis, - version); + return new WikiAttachment(attachementName, new Date(file + .lastModified()), user, file.length(), fis, version); } catch (FileNotFoundException e) { e.printStackTrace(); return null; } - - + } public int getLastAttachmentVersion(String pageName, String attachementName) { @@ -973,12 +977,12 @@ fos = new FileOutputStream(modFile); pageModProps.store(fos, SAVE_COMMENT); } catch (IOException ioe) { - log.error("Couldn't store mod props: ",ioe); + log.error("Couldn't store mod props: ", ioe); } finally { try { fos.close(); } catch (IOException ioe) { - log.error("Can't close input stream \n",ioe); + log.error("Can't close input stream \n", ioe); } } } @@ -1106,8 +1110,8 @@ } if (!attFile.renameTo(attTrashFile)) { - log.error("[ATTACHMENT DS]:Problems with moving " - + attName + " to " + attTrashName); + log.error("[ATTACHMENT DS]:Problems with moving " + attName + + " to " + attTrashName); return false; } @@ -1148,8 +1152,8 @@ } if (!attFile.renameTo(new File(attTrashName))) { - log.error("[ATTACHMENT DS]:Problems with moving " - + attName + " to " + attTrashName); + log.error("[ATTACHMENT DS]:Problems with moving " + attName + + " to " + attTrashName); return false; } @@ -1179,14 +1183,14 @@ public synchronized void rename(String uid, String newName) throws PageRenamingException { - + if (wikiEngine.pageExists(newName)) { throw new PageRenamingException( "Page with the name you're trying rename to already exists."); } - + lock = true; - + pageDictionary.setProperty(uid, newName); pageRevDictionary.setProperty(newName, uid); @@ -1194,7 +1198,7 @@ // find apropriate uid int i = 2; - + while ((pageExists(uid + String.valueOf(i))) || (pageDictionary.containsKey(uid + String.valueOf(i)))) { log.info(i++); @@ -1203,11 +1207,11 @@ // add maping for new (to be done) with name translated to old uid pageDictionary.setProperty(uid + String.valueOf(i), uid); pageRevDictionary.setProperty(uid, uid + String.valueOf(i)); - + saveDictionary(); - log.info("Renamed (uid) "+uid+" to "+newName); - + log.info("Renamed (uid) " + uid + " to " + newName); + lock = false; } @@ -1242,7 +1246,8 @@ return pageRevDictionary.contains(realName); } - public synchronized void removeDictForPage(String uid) throws PageRenamingException { + public synchronized void removeDictForPage(String uid) + throws PageRenamingException { if (!pageDictionary.contains(uid)) { throw new PageRenamingException( "There is no dictionary entry for uid: " + uid); @@ -1253,7 +1258,78 @@ // remove all dict entries pageDictionary.remove(uid); pageRevDictionary.remove(realName); - + saveDictionary(); } + + public Properties getMetadataProps(String uid) { + + if (!pageExists(uid)) { + // don't get matedata props for nonexisting page + return new Properties(); + } + + File propsFile = new File(pathToMedia + "/OLD/" + uid + + "/metadata.properties"); + + if (!propsFile.exists()) { + + // create file if it doesn't exist yet + try { + propsFile.createNewFile(); + } catch (IOException e) { + log.error(e); + } + } + + Properties props = new Properties(); + FileInputStream fis = null; + + try { + fis = new FileInputStream(propsFile); + } catch (FileNotFoundException e1) { + log.error(e1); + } + + try { + props.load(fis); + } catch (IOException e) { + log.error(e); + } + + try { + fis.close(); + } catch (IOException e) { + log.error(e); + } + + return props; + } + + public void saveMetadataProps(String uid, Properties props) { + getMetadataProps(uid); //this will create file if needed. + + File propsFile = new File(pathToMedia + "/OLD/" + uid + + "/metadata.properties"); + + FileOutputStream fos = null; + + try { + fos = new FileOutputStream(propsFile); + } catch (FileNotFoundException e) { + log.error(e); + } + + try { + props.store(fos, SAVE_COMMENT); + } catch (IOException e) { + log.error(e); + } + + try { + fos.close(); + } catch (IOException e) { + log.error(e); + } + } } Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/MediaDataSource.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/MediaDataSource.java 2005-12-06 13:13:22 UTC (rev 1710) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/MediaDataSource.java 2005-12-06 17:19:16 UTC (rev 1711) @@ -21,6 +21,8 @@ */ package org.jboss.wiki; +import java.util.HashMap; +import java.util.Properties; import java.util.Set; import org.jboss.wiki.exceptions.DataSourceException; @@ -214,4 +216,16 @@ * @param action can be MediaDataSource.EDITABLE or MediaDataSource.VIEWABLE */ public void saveRolesSet(String uid, Set<String> roles, int action) throws DataSourceException; + + /**Save metadata properties for given page. + * @param uid Page uid to save properties to. + */ + public void saveMetadataProps(String uid, Properties props); + + /**Gets metadata properties for given page. + * @param uid Page uid to get properties for. + * @return + */ + public Properties getMetadataProps(String uid); + } Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/ShotokuDataSource.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/ShotokuDataSource.java 2005-12-06 13:13:22 UTC (rev 1710) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/ShotokuDataSource.java 2005-12-06 17:19:16 UTC (rev 1711) @@ -1529,4 +1529,15 @@ // TODO Auto-generated method stub } + + public void saveMetadataProps(String uid, Properties props) { + // TODO Auto-generated method stub + + } + + public Properties getMetadataProps(String uid) { + // TODO Auto-generated method stub + return null; + } + } Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiPage.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiPage.java 2005-12-06 13:13:22 UTC (rev 1710) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiPage.java 2005-12-06 17:19:16 UTC (rev 1711) @@ -27,6 +27,7 @@ import java.util.Date; import java.util.HashMap; import java.util.HashSet; +import java.util.Properties; import java.util.Set; import java.util.TreeSet; @@ -49,6 +50,7 @@ */ public class WikiPage implements Serializable, WikiProperties, Cloneable { + public static final String METADATA = "MetaData:Properties"; /** * */ @@ -88,21 +90,6 @@ private Logger log; - /** - * <p> - * Represents ... - * </p> - * - * WikiPage This class is _abstract_ and has to be extended by the class - * that we're willing to show our content - * - * functions to be extended: WikiPage(...) - constructor getAttributes() - - * gets set of atributes to be send to the appropriate JSP page - * saveThisPage(data:Object) - saves next version of this page with new data - * getJSPPath() - gets apropriate JSP page to show plugin - * getDataProviderName - gets name of the plugin _must_ be the same as in - * the plugin name in plugin.xml - */ private Credentials lastAuthor; /** @@ -539,7 +526,10 @@ } public void addPermVariable(String key, Object value) { - permVariables.put(key, value); + //TODO - cannot add METADATA property - tho must be thrown an Exception or sth. + if (!key.equals(WikiPage.METADATA)) { + permVariables.put(key, value); + } } public Object getPermVariable(String key) { @@ -623,4 +613,11 @@ public void setTempVariables(HashMap<String, Object> tempVariables) { this.tempVariables = tempVariables; } + + /**Has to be executed explicitely - so user knows he IS changing metaProps + * @param metaProps + */ + public void setMetaDataProps(Properties metaProps) { + permVariables.put(METADATA, metaProps); + } } Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/GetRefsFromPagePlugin.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/GetRefsFromPagePlugin.java 2005-12-06 13:13:22 UTC (rev 1710) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/GetRefsFromPagePlugin.java 2005-12-06 17:19:16 UTC (rev 1711) @@ -49,13 +49,10 @@ pageUid = pageUid.substring(1, pageUid.indexOf(']')); - if (!HTMLTranslatorParts.checkImageLink(pageUid) && !HTMLTranslatorParts.isExternalLink(pageUid) && !HTMLTranslatorParts.isNumber(pageUid)) { - pageUid = HTMLTranslatorParts.cleanLink(pageUid); - - if (pageUid != null && !HTMLTranslatorParts.isNumber(pageUid) ) { - refs.add(wikiEngine.getRealName(pageUid)); - } - } + pageUid = checkRef(pageUid); + + if (pageUid != null) + refs.add(wikiEngine.getRealName(pageUid)); } matcher = Pattern.compile(pattern2).matcher(pageContent); @@ -67,16 +64,28 @@ pageUid = pageUid.substring(pageUid.indexOf('|') + 1, pageUid .indexOf(']')); - if (!HTMLTranslatorParts.checkImageLink(pageUid) && !HTMLTranslatorParts.isExternalLink(pageUid) && !HTMLTranslatorParts.isNumber(pageUid)) { - pageUid = HTMLTranslatorParts.cleanLink(pageUid); - - if (pageUid != null && !HTMLTranslatorParts.isNumber(pageUid)) { - refs.add(wikiEngine.getRealName(pageUid)); - } - } + pageUid = checkRef(pageUid); + + if (pageUid != null) + refs.add(wikiEngine.getRealName(pageUid)); } return refs; } + + private String checkRef(String pageUid) { + + pageUid = pageUid.trim(); + + if (!HTMLTranslatorParts.checkImageLink(pageUid) && !HTMLTranslatorParts.isExternalLink(pageUid) && !HTMLTranslatorParts.isNumber(pageUid)) { + pageUid = HTMLTranslatorParts.cleanLink(pageUid); + if (pageUid != null && !HTMLTranslatorParts.isNumber(pageUid)) { + return pageUid; + } + } + + return null; + } + } Modified: trunk/forge/portal-extensions/jbosswiki/wiki-management/src/java/org/jboss/wiki/management/WikiService.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-management/src/java/org/jboss/wiki/management/WikiService.java 2005-12-06 13:13:22 UTC (rev 1710) +++ trunk/forge/portal-extensions/jbosswiki/wiki-management/src/java/org/jboss/wiki/management/WikiService.java 2005-12-06 17:19:16 UTC (rev 1711) @@ -23,6 +23,7 @@ import javax.ejb.Local; import javax.ejb.Remote; + import org.jboss.annotation.ejb.Management; import org.jboss.annotation.ejb.Service; import org.jboss.logging.Logger; @@ -30,15 +31,17 @@ import org.jboss.wiki.WikiEngine; import org.jboss.wiki.management.WikiServiceMenagement; -@Service (objectName = WikiCommon.WIKI_SERVICE_NAME) +@Service(objectName = WikiCommon.WIKI_SERVICE_NAME) @Local(WikiServiceLocal.class) @Remote(WikiServiceRemote.class) @Management(WikiServiceMenagement.class) - public class WikiService implements WikiServiceLocal, WikiServiceRemote, WikiServiceMenagement { - +public class WikiService implements WikiServiceLocal, WikiServiceRemote, + WikiServiceMenagement { + private WikiEngine wikiEngine; + private Logger log = Logger.getLogger(WikiService.class); - + public synchronized WikiEngine getWikiEngine() { if (wikiEngine == null) { wikiEngine = new WikiEngine(); @@ -61,6 +64,5 @@ public void destroy() { log.info("WikiService - Destroying"); } - - + } |
From: <jbo...@li...> - 2005-12-06 13:13:33
|
Author: aron.gombas Date: 2005-12-06 08:13:22 -0500 (Tue, 06 Dec 2005) New Revision: 1710 Modified: trunk/labs/kosmos/xdocs/reference/reference-manual.xml Log: Lang list removed Modified: trunk/labs/kosmos/xdocs/reference/reference-manual.xml =================================================================== --- trunk/labs/kosmos/xdocs/reference/reference-manual.xml 2005-12-06 11:19:38 UTC (rev 1709) +++ trunk/labs/kosmos/xdocs/reference/reference-manual.xml 2005-12-06 13:13:22 UTC (rev 1710) @@ -1576,9 +1576,8 @@ <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>). + language is available in your distribution. Please see the project site + for localized versions available. </para> <para> |
From: <jbo...@li...> - 2005-12-06 11:19:46
|
Author: rem...@jb... Date: 2005-12-06 06:19:38 -0500 (Tue, 06 Dec 2005) New Revision: 1709 Modified: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/startup/ContextConfig.java trunk/labs/jbossweb/src/share/classes/org/apache/catalina/startup/EngineConfig.java Log: - Allow extending those two classes. Modified: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/startup/ContextConfig.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/catalina/startup/ContextConfig.java 2005-12-06 11:18:40 UTC (rev 1708) +++ trunk/labs/jbossweb/src/share/classes/org/apache/catalina/startup/ContextConfig.java 2005-12-06 11:19:38 UTC (rev 1709) @@ -67,7 +67,7 @@ * @version $Revision: 322459 $ $Date: 2005-10-16 08:46:45 +0200 (dim., 16 oct. 2005) $ */ -public final class ContextConfig +public class ContextConfig implements LifecycleListener { protected static org.apache.commons.logging.Log log= @@ -79,7 +79,7 @@ /* * Custom mappings of login methods to authenticators */ - private Map customAuthenticators; + protected Map customAuthenticators; /** @@ -170,7 +170,7 @@ protected static long deploymentCount = 0L; - private static final LoginConfig DUMMY_LOGIN_CONFIG = + protected static final LoginConfig DUMMY_LOGIN_CONFIG = new LoginConfig("NONE", null, null, null); Modified: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/startup/EngineConfig.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/catalina/startup/EngineConfig.java 2005-12-06 11:18:40 UTC (rev 1708) +++ trunk/labs/jbossweb/src/share/classes/org/apache/catalina/startup/EngineConfig.java 2005-12-06 11:19:38 UTC (rev 1709) @@ -33,11 +33,11 @@ * @version $Revision: 302976 $ $Date: 2004-06-23 15:51:38 +0200 (mer., 23 juin 2004) $ */ -public final class EngineConfig +public class EngineConfig implements LifecycleListener { - private static org.apache.commons.logging.Log log= + protected static org.apache.commons.logging.Log log= org.apache.commons.logging.LogFactory.getLog( EngineConfig.class ); // ----------------------------------------------------- Instance Variables @@ -46,13 +46,13 @@ /** * The Engine we are associated with. */ - private Engine engine = null; + protected Engine engine = null; /** * The string resources for this package. */ - private static final StringManager sm = + protected static final StringManager sm = StringManager.getManager(Constants.Package); @@ -83,13 +83,13 @@ } - // -------------------------------------------------------- Private Methods + // ------------------------------------------------------ Protected Methods /** * Process a "start" event for this Engine. */ - private void start() { + protected void start() { if (engine.getLogger().isDebugEnabled()) engine.getLogger().debug(sm.getString("engineConfig.start")); @@ -100,7 +100,7 @@ /** * Process a "stop" event for this Engine. */ - private void stop() { + protected void stop() { if (engine.getLogger().isDebugEnabled()) engine.getLogger().debug(sm.getString("engineConfig.stop")); |
From: <jbo...@li...> - 2005-12-06 11:19:06
|
Author: rem...@jb... Date: 2005-12-06 06:18:40 -0500 (Tue, 06 Dec 2005) New Revision: 1708 Modified: trunk/labs/jbossweb/src/share/classes/org/apache/tomcat/util/buf/MessageBytes.java Log: - toString update. Modified: trunk/labs/jbossweb/src/share/classes/org/apache/tomcat/util/buf/MessageBytes.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/tomcat/util/buf/MessageBytes.java 2005-12-06 11:18:02 UTC (rev 1707) +++ trunk/labs/jbossweb/src/share/classes/org/apache/tomcat/util/buf/MessageBytes.java 2005-12-06 11:18:40 UTC (rev 1708) @@ -195,21 +195,24 @@ // -------------------- Conversion and getters -------------------- - /** Compute the string value + /** + * Compute the string value */ public String toString() { - if( hasStrValue ) return strValue; - hasStrValue=true; - - switch (type) { - case T_CHARS: - strValue=charC.toString(); - return strValue; - case T_BYTES: - strValue=byteC.toString(); - return strValue; - } - return null; + if (hasStrValue) + return strValue; + + switch (type) { + case T_CHARS: + strValue = charC.toString(); + hasStrValue = true; + return strValue; + case T_BYTES: + strValue = byteC.toString(); + hasStrValue = true; + return strValue; + } + return null; } //---------------------------------------- |
From: <jbo...@li...> - 2005-12-06 11:18:22
|
Author: rem...@jb... Date: 2005-12-06 06:18:02 -0500 (Tue, 06 Dec 2005) New Revision: 1707 Modified: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/core/StandardEngine.java Log: - Remove hardcoded JAASRealm default. Modified: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/core/StandardEngine.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/catalina/core/StandardEngine.java 2005-12-06 11:17:34 UTC (rev 1706) +++ trunk/labs/jbossweb/src/share/classes/org/apache/catalina/core/StandardEngine.java 2005-12-06 11:18:02 UTC (rev 1707) @@ -31,7 +31,6 @@ import org.apache.catalina.LifecycleException; import org.apache.catalina.Realm; import org.apache.catalina.Service; -import org.apache.catalina.realm.JAASRealm; import org.apache.catalina.util.ServerInfo; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -132,12 +131,6 @@ */ public Realm getRealm() { Realm configured=super.getRealm(); - // If no set realm has been called - default to JAAS - // This can be overriden at engine, context and host level - if( configured==null ) { - configured=new JAASRealm(); - this.setRealm( configured ); - } return configured; } |
From: <jbo...@li...> - 2005-12-06 11:17:40
|
Author: rem...@jb... Date: 2005-12-06 06:17:34 -0500 (Tue, 06 Dec 2005) New Revision: 1706 Modified: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/core/AprLifecycleListener.java Log: - Update required version number. Modified: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/core/AprLifecycleListener.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/catalina/core/AprLifecycleListener.java 2005-12-06 11:17:16 UTC (rev 1705) +++ trunk/labs/jbossweb/src/share/classes/org/apache/catalina/core/AprLifecycleListener.java 2005-12-06 11:17:34 UTC (rev 1706) @@ -52,7 +52,7 @@ protected static final int REQUIRED_MAJOR = 1; protected static final int REQUIRED_MINOR = 1; - protected static final int REQUIRED_PATCH = 0; + protected static final int REQUIRED_PATCH = 1; // ---------------------------------------------- LifecycleListener Methods |
From: <jbo...@li...> - 2005-12-06 11:17:22
|
Author: rem...@jb... Date: 2005-12-06 06:17:16 -0500 (Tue, 06 Dec 2005) New Revision: 1705 Modified: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/core/ApplicationContext.java Log: - New (temporary) algorithm for getContext. Modified: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/core/ApplicationContext.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/catalina/core/ApplicationContext.java 2005-12-06 02:07:49 UTC (rev 1704) +++ trunk/labs/jbossweb/src/share/classes/org/apache/catalina/core/ApplicationContext.java 2005-12-06 11:17:16 UTC (rev 1705) @@ -208,43 +208,32 @@ if ((uri == null) || (!uri.startsWith("/"))) return (null); - // Return the current context if requested - String contextPath = context.getPath(); - if (!contextPath.endsWith("/")) - contextPath = contextPath + "/"; - - if (((contextPath.length() > 1) && (uri.startsWith(contextPath))) || - ((contextPath.equals("/")) && (uri.equals("/")))) { - return (this); + Context child = null; + Host host = (Host) context.getParent(); + String mapuri = uri; + while (true) { + child = (Context) host.findChild(mapuri); + if (child != null) + break; + int slash = mapuri.lastIndexOf('/'); + if (slash < 0) + break; + mapuri = mapuri.substring(0, slash); } - // Return other contexts only if allowed - if (!context.getCrossContext()) + if (child == null) return (null); - try { - Host host = (Host) context.getParent(); - Context child = null; - String mapuri = uri; - while (true) { - child = (Context) host.findChild(mapuri); - if (child != null) - break; - int slash = mapuri.lastIndexOf('/'); - if (slash < 0) - break; - mapuri = mapuri.substring(0, slash); - } - if (child == null) { - child = (Context) host.findChild(""); - } - if (child != null) - return (child.getServletContext()); - else - return (null); - } catch (Throwable t) { + + if (context.getCrossContext()) { + // If crossContext is enabled, can always return the context + return child.getServletContext(); + } else if (child == context) { + // Can still return the current context + return context.getServletContext(); + } else { + // Nothing to return return (null); } - } |
From: <jbo...@li...> - 2005-12-06 00:26:49
|
Author: wrzep Date: 2005-12-05 19:26:42 -0500 (Mon, 05 Dec 2005) New Revision: 1703 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/StatusPlugin.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java Log: improved plugin instantination (passing plugin-specific properties to plugin, for svn plugin- passing service adress) http://jira.jboss.com/jira/browse/JBLAB-415 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-12-06 00:00:41 UTC (rev 1702) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2005-12-06 00:26:42 UTC (rev 1703) @@ -50,12 +50,13 @@ */ public class Status extends AbstractDescriptor { - private final static String PLUGIN_ELEMENT = "plugin"; + 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 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 final static String PLUGIN_PROPERTIES_ELEMENT = "properties"; private String portalName; private ScoreAlgorithmFactory scoreAlgorithm; @@ -64,12 +65,15 @@ private List<StatusPlugin> plugins; private Logger log; + + private HashSet<String> pluginsElements; Status(String portalName, Node pluginsRoot, ScoreAlgorithmFactory scoreAlgorithm) { this.portalName = portalName; this.scoreAlgorithm = scoreAlgorithm; log = Logger.getLogger(this.getClass()); + initPluginElements(); // Get the projects projects = ProjectsHelper.getProjects(portalName); @@ -81,8 +85,18 @@ plugins = getPlugins(pluginsNodes); } + private void initPluginElements() { + pluginsElements = new HashSet<String>(); + + pluginsElements.add(PLUGIN_ID_ELEMENT); //TODO currently id is NOT used!! + pluginsElements.add(PLUGIN_NAME_ELEMENT); + pluginsElements.add(PLUGIN_CLASS_ELEMENT); + pluginsElements.add(PLUGIN_WEIGHT_ELEMENT); + pluginsElements.add(PLUGIN_PROPERTIES_ELEMENT); + } + - + /** * Fills the given context with podcast information. * @@ -146,51 +160,73 @@ } } - List<StatusPlugin> getPlugins(Set<Node> pluginsNodes) { + private List<StatusPlugin> getPlugins(Set<Node> pluginsNodes) { ArrayList<StatusPlugin> plugins = new ArrayList<StatusPlugin>(); - - HashSet<String> 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); + StatusPlugin plugin = getPlugin(pluginNode); - // Get plugin name - String pluginClassString = XmlTools.unmarshallText(pluginProperties.get("class")); - System.out.println("pluginClassString " + pluginClassString); - - // Get plugin class - - Class pluginClass = null; - try { - pluginClass = Class.forName(pluginClassString); - } catch (ClassNotFoundException e) { - log.error("Plugin class not found: " + pluginClassString); - continue; - } - - // Get plugin instance - StatusPlugin plugin = null; - try { - plugin = (StatusPlugin) pluginClass.newInstance(); - } catch (Exception e) { - log.error("Plugin class: " + pluginClassString + ". Instantination failed.", e); - continue; - } - - // Initialize plugin and add it to the plugins set - plugin.init(projects); - plugins.add(plugin); + if (plugin != null) { + plugins.add(plugin); + } } return plugins; } + private StatusPlugin getPlugin(Node pluginNode) { + Map<String,Node> pluginProperties = getChildNodesMap(pluginNode, pluginsElements); + + // Get plugin name + String pluginClassString = XmlTools.unmarshallText(pluginProperties.get("class")); + System.out.println("pluginClassString " + pluginClassString); + + // Get plugin class + Class pluginClass = null; + try { + pluginClass = Class.forName(pluginClassString); + } catch (ClassNotFoundException e) { + log.error("Plugin class not found: " + pluginClassString); + return null; + } + + // Get plugin instance + StatusPlugin plugin = null; + try { + plugin = (StatusPlugin) pluginClass.newInstance(); + } catch (Exception e) { + log.error("Plugin class: " + pluginClassString + ". Instantination failed.", e); + return null; + } + + // Get plugin properies node + Node pluginSpecificPropertiesNode = pluginProperties.get("properties"); + Map<String,String> pluginSpecificPropertiesMap = getChildNodesStringMap(pluginSpecificPropertiesNode); + + // Initialize plugin + plugin.init(projects, pluginSpecificPropertiesMap); + + return plugin; + } + + + + private Map<String,String> getChildNodesStringMap(Node root) { + HashMap<String,String> ret = new HashMap<String,String>(); + NodeList list = root.getChildNodes(); + + for (int i = 0; i < list.getLength(); i++) { + Node n = list.item(i); + if (n.getNodeType() == Node.ELEMENT_NODE) { + ret.put(n.getNodeName(),XmlTools.unmarshallText(n)); + } + } + + return ret; + } + private int calculateScore(String projectId) { return scoreAlgorithm.calculateScore(projectId, plugins); } Modified: 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-12-06 00:00:41 UTC (rev 1702) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/StatusPlugin.java 2005-12-06 00:26:42 UTC (rev 1703) @@ -22,6 +22,8 @@ package org.jboss.forge.status.plugins; +import java.util.Map; + import org.jboss.forge.common.projects.Projects; /** @@ -31,9 +33,11 @@ public abstract class StatusPlugin { protected Projects projects; + protected Map properties; - public void init(Projects projects) { + public void init(Projects projects, Map<String,String> properties) { this.projects = projects; + this.properties = properties; } public abstract String getId(); Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java 2005-12-06 00:00:41 UTC (rev 1702) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java 2005-12-06 00:26:42 UTC (rev 1703) @@ -22,6 +22,7 @@ package org.jboss.forge.status.plugins.svn; +import org.jboss.forge.common.projects.Projects; import org.jboss.forge.status.plugins.StatusPlugin; import java.net.MalformedURLException; @@ -47,9 +48,8 @@ private Logger log; - private final static String KOSMOS_SVN_SERVICE_URL = - "http://localhost:8080/kosmos-server/kosmos-services/svn-service"; - //TODO shoud be parameter in xml config file + private String serviceURL; + //"http://localhost:8080/kosmos-server/kosmos-services/svn-service"; public SvnStatusPlugin() { super(); @@ -58,6 +58,12 @@ log = Logger.getLogger(this.getClass()); } + public void init(Projects projects, Map<String,String> properties) { + super.init(projects,properties); + serviceURL = properties.get("svn-service"); + System.out.println("service-url " + serviceURL); + } + protected abstract int getPluginSpecyficValue(Map projectMap); protected abstract int getPluginSpecyficDefaultValue(); @@ -78,15 +84,21 @@ SvnService service; try { - service = (SvnService) factory.create(SvnService.class, - KOSMOS_SVN_SERVICE_URL); + service = (SvnService) factory.create(SvnService.class, serviceURL); } catch (MalformedURLException e) { - log.error("Can not connect to kosmos svn service: " + KOSMOS_SVN_SERVICE_URL); + log.error("Can not connect to kosmos svn service: " + serviceURL); return null; } // Get repository map - List repositories = service.getRepositories(repoURL); + List repositories = null; + try { + repositories = service.getRepositories(repoURL); + } catch (Exception e) { + log.error("Can not analyze repo: " + repoURL, e); + return null; + } + repositoryMap = (Map) repositories.get(0); //printRepo(repositoryMap); |
From: <jbo...@li...> - 2005-12-06 00:00:45
|
Author: dam...@jb... Date: 2005-12-05 19:00:41 -0500 (Mon, 05 Dec 2005) New Revision: 1702 Added: prod/labs/jbossrules/ Log: added labs to labels. |
From: <jbo...@li...> - 2005-12-06 00:00:36
|
Author: dam...@jb... Date: 2005-12-05 19:00:33 -0500 (Mon, 05 Dec 2005) New Revision: 1701 Added: prod/labs/ Log: added labs to labels. |
From: <jbo...@li...> - 2005-12-06 00:00:12
|
Author: dam...@jb... Date: 2005-12-05 19:00:06 -0500 (Mon, 05 Dec 2005) New Revision: 1700 Added: labels/labs/jbossrules/ Log: added labs to labels. |
From: <jbo...@li...> - 2005-12-06 00:00:07
|
Author: dam...@jb... Date: 2005-12-05 18:59:58 -0500 (Mon, 05 Dec 2005) New Revision: 1699 Added: labels/labs/ Log: added labs to labels. |