Author: rfeng
Date: Tue Mar 23 16:59:14 2010
New Revision: 926662

URL: http://svn.apache.org/viewvc?rev=926662&view=rev
Log:
An eclipse plugin that can run in headless mode to configure the eclipse 
workspace using command line

Added:
    tuscany/sandbox/rfeng/eclipse-workspace/   (with props)
    tuscany/sandbox/rfeng/eclipse-workspace-feature/
    tuscany/sandbox/rfeng/eclipse-workspace-feature/.project
    tuscany/sandbox/rfeng/eclipse-workspace-feature/build.properties   (with 
props)
    tuscany/sandbox/rfeng/eclipse-workspace-feature/feature.xml   (with props)
    tuscany/sandbox/rfeng/eclipse-workspace-updatesite/   (with props)
    tuscany/sandbox/rfeng/eclipse-workspace-updatesite/.project
    tuscany/sandbox/rfeng/eclipse-workspace-updatesite/features/   (with props)
    tuscany/sandbox/rfeng/eclipse-workspace-updatesite/index.html   (with props)
    tuscany/sandbox/rfeng/eclipse-workspace-updatesite/plugins/   (with props)
    tuscany/sandbox/rfeng/eclipse-workspace-updatesite/site.xml   (with props)
    tuscany/sandbox/rfeng/eclipse-workspace-updatesite/web/
    tuscany/sandbox/rfeng/eclipse-workspace-updatesite/web/site.css
    tuscany/sandbox/rfeng/eclipse-workspace-updatesite/web/site.xsl
    tuscany/sandbox/rfeng/eclipse-workspace/.classpath
    tuscany/sandbox/rfeng/eclipse-workspace/.project
    tuscany/sandbox/rfeng/eclipse-workspace/.settings/
    tuscany/sandbox/rfeng/eclipse-workspace/.settings/org.eclipse.jdt.core.prefs
    tuscany/sandbox/rfeng/eclipse-workspace/META-INF/
    tuscany/sandbox/rfeng/eclipse-workspace/META-INF/MANIFEST.MF
    tuscany/sandbox/rfeng/eclipse-workspace/build.properties   (with props)
    tuscany/sandbox/rfeng/eclipse-workspace/plugin.xml   (with props)
    tuscany/sandbox/rfeng/eclipse-workspace/src/
    tuscany/sandbox/rfeng/eclipse-workspace/src/main/
    tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/
    tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/
    tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/
    tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/
    
tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/
    
tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/
    
tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/Activator.java
   (with props)
    
tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/WorkspaceConfigurator.java
   (with props)

Propchange: tuscany/sandbox/rfeng/eclipse-workspace/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Mar 23 16:59:14 2010
@@ -0,0 +1 @@
+target

Added: tuscany/sandbox/rfeng/eclipse-workspace-feature/.project
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/rfeng/eclipse-workspace-feature/.project?rev=926662&view=auto
==============================================================================
--- tuscany/sandbox/rfeng/eclipse-workspace-feature/.project (added)
+++ tuscany/sandbox/rfeng/eclipse-workspace-feature/.project Tue Mar 23 
16:59:14 2010
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>tuscany-eclipse-workspace-feature</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.pde.FeatureBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.FeatureNature</nature>
+       </natures>
+</projectDescription>

Added: tuscany/sandbox/rfeng/eclipse-workspace-feature/build.properties
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/rfeng/eclipse-workspace-feature/build.properties?rev=926662&view=auto
==============================================================================
--- tuscany/sandbox/rfeng/eclipse-workspace-feature/build.properties (added)
+++ tuscany/sandbox/rfeng/eclipse-workspace-feature/build.properties Tue Mar 23 
16:59:14 2010
@@ -0,0 +1 @@
+bin.includes = feature.xml

Propchange: tuscany/sandbox/rfeng/eclipse-workspace-feature/build.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/rfeng/eclipse-workspace-feature/build.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sandbox/rfeng/eclipse-workspace-feature/feature.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/rfeng/eclipse-workspace-feature/feature.xml?rev=926662&view=auto
==============================================================================
--- tuscany/sandbox/rfeng/eclipse-workspace-feature/feature.xml (added)
+++ tuscany/sandbox/rfeng/eclipse-workspace-feature/feature.xml Tue Mar 23 
16:59:14 2010
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+      id="org.apache.tuscany.eclipse.workspace.feature"
+      label="org.apache.tuscany.eclipse.workspace.feature"
+      version="1.0.0"
+      provider-name="Apache Software Foundation">
+
+   <description url="http://www.example.com/description";>
+      [Enter Feature Description here.]
+   </description>
+
+   <copyright url="http://www.example.com/copyright";>
+      [Enter Copyright Description here.]
+   </copyright>
+
+   <license url="http://www.example.com/license";>
+      [Enter License Description here.]
+   </license>
+
+   <plugin
+         id="org.apache.tuscany.eclipse.workspace"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+</feature>

Propchange: tuscany/sandbox/rfeng/eclipse-workspace-feature/feature.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/rfeng/eclipse-workspace-feature/feature.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/sandbox/rfeng/eclipse-workspace-updatesite/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Mar 23 16:59:14 2010
@@ -0,0 +1,2 @@
+artifacts.jar
+content.jar

Added: tuscany/sandbox/rfeng/eclipse-workspace-updatesite/.project
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/rfeng/eclipse-workspace-updatesite/.project?rev=926662&view=auto
==============================================================================
--- tuscany/sandbox/rfeng/eclipse-workspace-updatesite/.project (added)
+++ tuscany/sandbox/rfeng/eclipse-workspace-updatesite/.project Tue Mar 23 
16:59:14 2010
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>tuscany-eclipse-workspace-updatesite</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.pde.UpdateSiteBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.UpdateSiteNature</nature>
+       </natures>
+</projectDescription>

Propchange: tuscany/sandbox/rfeng/eclipse-workspace-updatesite/features/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Mar 23 16:59:14 2010
@@ -0,0 +1 @@
+org.apache.tuscany.eclipse.workspace.feature_1.0.0.jar

Added: tuscany/sandbox/rfeng/eclipse-workspace-updatesite/index.html
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/rfeng/eclipse-workspace-updatesite/index.html?rev=926662&view=auto
==============================================================================
--- tuscany/sandbox/rfeng/eclipse-workspace-updatesite/index.html (added)
+++ tuscany/sandbox/rfeng/eclipse-workspace-updatesite/index.html Tue Mar 23 
16:59:14 2010
@@ -0,0 +1,60 @@
+<html>
+<head>
+<title>tuscany-eclipse-workspace-updatesite</title>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<style>@import url("web/site.css");</style>
+<script type="text/javascript">
+       var returnval = 0;
+       var stylesheet, xmlFile, cache, doc;
+       function init(){
+               // NSCP 7.1+ / Mozilla 1.4.1+ / Safari
+               // Use the standard DOM Level 2 technique, if it is supported
+               if (document.implementation && 
document.implementation.createDocument) {
+                       xmlFile = document.implementation.createDocument("", 
"", null);
+                       stylesheet = document.implementation.createDocument("", 
"", null);
+                       if (xmlFile.load){
+                               xmlFile.load("site.xml");
+                               stylesheet.load("web/site.xsl");
+                       } else {
+                               alert("Document could not be loaded by 
browser.");
+                       }
+                       xmlFile.addEventListener("load", transform, false);
+                       stylesheet.addEventListener("load", transform, false);
+               }
+               //IE 6.0+ solution
+               else if (window.ActiveXObject) {
+                       xmlFile = new ActiveXObject("msxml2.DOMDocument.3.0");
+                       xmlFile.async = false;
+                       xmlFile.load("site.xml");
+                       stylesheet = new 
ActiveXObject("msxml2.FreeThreadedDOMDocument.3.0");
+                       stylesheet.async = false;
+                       stylesheet.load("web/site.xsl");
+                       cache = new ActiveXObject("msxml2.XSLTemplate.3.0");
+                       cache.stylesheet = stylesheet;
+                       transformData();
+               }
+       }
+       // separate transformation function for IE 6.0+
+       function transformData(){
+               var processor = cache.createProcessor();
+               processor.input = xmlFile;
+               processor.transform();
+               data.innerHTML = processor.output;
+       }
+       // separate transformation function for NSCP 7.1+ and Mozilla 1.4.1+ 
+       function transform(){
+               returnval+=1;
+               if (returnval==2){
+                       var processor = new XSLTProcessor();
+                       processor.importStylesheet(stylesheet); 
+                       doc = processor.transformToDocument(xmlFile);
+                       document.getElementById("data").innerHTML = 
doc.documentElement.innerHTML;
+               }
+       }
+</script>
+</head>
+<body onload="init();">
+<!--[insert static HTML here]-->
+<div id="data"><!-- this is where the transformed data goes --></div>
+</body>
+</html>

Propchange: tuscany/sandbox/rfeng/eclipse-workspace-updatesite/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/rfeng/eclipse-workspace-updatesite/index.html
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/sandbox/rfeng/eclipse-workspace-updatesite/plugins/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Mar 23 16:59:14 2010
@@ -0,0 +1 @@
+org.apache.tuscany.eclipse.workspace_1.0.0.jar

Added: tuscany/sandbox/rfeng/eclipse-workspace-updatesite/site.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/rfeng/eclipse-workspace-updatesite/site.xml?rev=926662&view=auto
==============================================================================
--- tuscany/sandbox/rfeng/eclipse-workspace-updatesite/site.xml (added)
+++ tuscany/sandbox/rfeng/eclipse-workspace-updatesite/site.xml Tue Mar 23 
16:59:14 2010
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<site>
+   <description name="Apache Tuscany Headless Eclipse Workspace Configurator 
Update Site" 
url="http://people.apache.org/~rfeng/tuscany/eclipse-workspace-updatesite";>
+      Apache Tuscany Headless Eclipse Workspace Configurator Update Site
+   </description>
+   <feature 
url="features/org.apache.tuscany.eclipse.workspace.feature_1.0.0.jar" 
id="org.apache.tuscany.eclipse.workspace.feature" version="1.0.0">
+      <category name="Headless Eclipse Workspace Configurator"/>
+   </feature>
+   <category-def name="Headless Eclipse Workspace Configurator" 
label="Headless Eclipse Workspace Configurator"/>
+</site>

Propchange: tuscany/sandbox/rfeng/eclipse-workspace-updatesite/site.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/rfeng/eclipse-workspace-updatesite/site.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sandbox/rfeng/eclipse-workspace-updatesite/web/site.css
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/rfeng/eclipse-workspace-updatesite/web/site.css?rev=926662&view=auto
==============================================================================
--- tuscany/sandbox/rfeng/eclipse-workspace-updatesite/web/site.css (added)
+++ tuscany/sandbox/rfeng/eclipse-workspace-updatesite/web/site.css Tue Mar 23 
16:59:14 2010
@@ -0,0 +1,12 @@
+<STYLE type="text/css">
+td.spacer {padding-bottom: 10px; padding-top: 10px;}
+.title { font-family: sans-serif; color: #99AACC;}
+.bodyText { font-family: sans-serif; font-size: 9pt; color:#000000;  }
+.sub-header { font-family: sans-serif; font-style: normal; font-weight: bold; 
font-size: 9pt; color: white;}
+.log-text {font-family: sans-serif; font-style: normal; font-weight: lighter; 
font-size: 8pt; color:black;}
+.big-header { font-family: sans-serif; font-style: normal; font-weight: bold; 
font-size: 9pt; color: white; border-top:10px solid white;}
+.light-row {background:#FFFFFF}
+.dark-row {background:#EEEEFF}
+.header {background:#99AADD}
+#indent {word-wrap : break-word;width :300px;text-indent:10px;}
+</STYLE>

Added: tuscany/sandbox/rfeng/eclipse-workspace-updatesite/web/site.xsl
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/rfeng/eclipse-workspace-updatesite/web/site.xsl?rev=926662&view=auto
==============================================================================
--- tuscany/sandbox/rfeng/eclipse-workspace-updatesite/web/site.xsl (added)
+++ tuscany/sandbox/rfeng/eclipse-workspace-updatesite/web/site.xsl Tue Mar 23 
16:59:14 2010
@@ -0,0 +1,214 @@
+<xsl:stylesheet version = '1.0' 
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' 
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
+<xsl:output method="html" encoding="UTF-8"/>
+<xsl:key name="cat" match="category" use="@name"/>
+<xsl:template match="/">
+<xsl:for-each select="site">
+       <html>
+       <head>
+       <title>tuscany-eclipse-workspace-updatesite</title>
+       <style>@import url("web/site.css");</style>
+       </head>
+       <body>
+       <h1 class="title">tuscany-eclipse-workspace-updatesite</h1>
+       <p class="bodyText"><xsl:value-of select="description"/></p>
+       <table width="100%" border="0" cellspacing="1" cellpadding="2">
+       <xsl:for-each select="category-def">
+               <xsl:sort select="@label" order="ascending" 
case-order="upper-first"/>
+               <xsl:sort select="@name" order="ascending" 
case-order="upper-first"/>
+       <xsl:if test="count(key('cat',@name)) != 0">
+                       <tr class="header">
+                               <td class="sub-header" width="30%">
+                                       <xsl:value-of select="@name"/>
+                               </td>
+                               <td class="sub-header" width="70%">
+                                       <xsl:value-of select="@label"/>
+                               </td>
+                       </tr>
+                       <xsl:for-each select="key('cat',@name)">
+                       <xsl:sort select="ancestor::feature//@version" 
order="ascending"/>
+                       <xsl:sort select="ancestor::feature//@id" 
order="ascending" case-order="upper-first"/>
+                       <tr>
+                               <xsl:choose>
+                               <xsl:when test="(position() mod 2 = 1)">
+                                       <xsl:attribute 
name="class">dark-row</xsl:attribute>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:attribute 
name="class">light-row</xsl:attribute>
+                               </xsl:otherwise>
+                               </xsl:choose>
+                               <td class="log-text" id="indent">
+                                               <xsl:choose>
+                                               <xsl:when 
test="ancestor::feature//@label">
+                                                       <a 
href="{ancestor::feature//@url}"><xsl:value-of 
select="ancestor::feature//@label"/></a>
+                                                       <br/>
+                                                       <div id="indent">
+                                                       (<xsl:value-of 
select="ancestor::feature//@id"/> - <xsl:value-of 
select="ancestor::feature//@version"/>)
+                                                       </div>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                               <a 
href="{ancestor::feature//@url}"><xsl:value-of 
select="ancestor::feature//@id"/> - <xsl:value-of 
select="ancestor::feature//@version"/></a>
+                                               </xsl:otherwise>
+                                               </xsl:choose>
+                                               <br />
+                               </td>
+                               <td>
+                                       <table>
+                                               <xsl:if 
test="ancestor::feature//@os">
+                                                       <tr><td 
class="log-text" id="indent">Operating Systems:</td>
+                                                       <td class="log-text" 
id="indent"><xsl:value-of select="ancestor::feature//@os"/></td>
+                                                       </tr>
+                                               </xsl:if>
+                                               <xsl:if 
test="ancestor::feature//@ws">
+                                                       <tr><td 
class="log-text" id="indent">Windows Systems:</td>
+                                                       <td class="log-text" 
id="indent"><xsl:value-of select="ancestor::feature//@ws"/></td>
+                                                       </tr>
+                                               </xsl:if>
+                                               <xsl:if 
test="ancestor::feature//@nl">
+                                                       <tr><td 
class="log-text" id="indent">Languages:</td>
+                                                       <td class="log-text" 
id="indent"><xsl:value-of select="ancestor::feature//@nl"/></td>
+                                                       </tr>
+                                               </xsl:if>
+                                               <xsl:if 
test="ancestor::feature//@arch">
+                                                       <tr><td 
class="log-text" id="indent">Architecture:</td>
+                                                       <td class="log-text" 
id="indent"><xsl:value-of select="ancestor::feature//@arch"/></td>
+                                                       </tr>
+                                               </xsl:if>
+                                       </table>
+                               </td>
+                       </tr>
+                       </xsl:for-each>
+                       <tr><td class="spacer"><br/></td><td 
class="spacer"><br/></td></tr>
+               </xsl:if>
+       </xsl:for-each>
+       <xsl:if test="count(feature)  &gt; count(feature/category)">
+       <tr class="header">
+               <td class="sub-header" colspan="2">
+               Uncategorized
+               </td>
+       </tr>
+       </xsl:if>
+       <xsl:choose>
+       <xsl:when test="function-available('msxsl:node-set')">
+          <xsl:variable name="rtf-nodes">
+               <xsl:for-each select="feature[not(category)]">
+                       <xsl:sort select="@id" order="ascending" 
case-order="upper-first"/>
+                       <xsl:sort select="@version" order="ascending" />
+                       <xsl:value-of select="."/>
+                       <xsl:copy-of select="." />
+               </xsl:for-each>
+          </xsl:variable>
+          <xsl:variable name="myNodeSet" 
select="msxsl:node-set($rtf-nodes)/*"/>
+       <xsl:for-each select="$myNodeSet">
+       <tr>
+               <xsl:choose>
+               <xsl:when test="position() mod 2 = 1">
+               <xsl:attribute name="class">dark-row</xsl:attribute>
+               </xsl:when>
+               <xsl:otherwise>
+               <xsl:attribute name="class">light-row</xsl:attribute>
+               </xsl:otherwise>
+               </xsl:choose>
+               <td class="log-text" id="indent">
+                       <xsl:choose>
+                       <xsl:when test="@label">
+                               <a href="{...@url}"><xsl:value-of 
select="@label"/></a>
+                               <br />
+                               <div id="indent">
+                               (<xsl:value-of select="@id"/> - <xsl:value-of 
select="@version"/>)
+                               </div>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <a href="{...@url}"><xsl:value-of 
select="@id"/> - <xsl:value-of select="@version"/></a>
+                       </xsl:otherwise>
+                       </xsl:choose>
+                       <br /><br />
+               </td>
+               <td>
+                       <table>
+                               <xsl:if test="@os">
+                                       <tr><td class="log-text" 
id="indent">Operating Systems:</td>
+                                       <td class="log-text" 
id="indent"><xsl:value-of select="@os"/></td>
+                                       </tr>
+                               </xsl:if>
+                               <xsl:if test="@ws">
+                                       <tr><td class="log-text" 
id="indent">Windows Systems:</td>
+                                       <td class="log-text" 
id="indent"><xsl:value-of select="@ws"/></td>
+                                       </tr>
+                               </xsl:if>
+                               <xsl:if test="@nl">
+                                       <tr><td class="log-text" 
id="indent">Languages:</td>
+                                       <td class="log-text" 
id="indent"><xsl:value-of select="@nl"/></td>
+                                       </tr>
+                               </xsl:if>
+                               <xsl:if test="@arch">
+                                       <tr><td class="log-text" 
id="indent">Architecture:</td>
+                                       <td class="log-text" 
id="indent"><xsl:value-of select="@arch"/></td>
+                                       </tr>
+                               </xsl:if>
+                       </table>
+               </td>
+       </tr>
+       </xsl:for-each>
+       </xsl:when>
+       <xsl:otherwise>
+       <xsl:for-each select="feature[not(category)]">
+       <xsl:sort select="@id" order="ascending" case-order="upper-first"/>
+       <xsl:sort select="@version" order="ascending" />
+       <tr>
+               <xsl:choose>
+               <xsl:when 
test="count(preceding-sibling::feature[not(category)]) mod 2 = 1">
+               <xsl:attribute name="class">dark-row</xsl:attribute>
+               </xsl:when>
+               <xsl:otherwise>
+               <xsl:attribute name="class">light-row</xsl:attribute>
+               </xsl:otherwise>
+               </xsl:choose>
+               <td class="log-text" id="indent">
+                       <xsl:choose>
+                       <xsl:when test="@label">
+                               <a href="{...@url}"><xsl:value-of 
select="@label"/></a>
+                               <br />
+                               <div id="indent">
+                               (<xsl:value-of select="@id"/> - <xsl:value-of 
select="@version"/>)
+                               </div>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <a href="{...@url}"><xsl:value-of 
select="@id"/> - <xsl:value-of select="@version"/></a>
+                       </xsl:otherwise>
+                       </xsl:choose>
+                       <br /><br />
+               </td>
+               <td>
+                       <table>
+                               <xsl:if test="@os">
+                                       <tr><td class="log-text" 
id="indent">Operating Systems:</td>
+                                       <td class="log-text" 
id="indent"><xsl:value-of select="@os"/></td>
+                                       </tr>
+                               </xsl:if>
+                               <xsl:if test="@ws">
+                                       <tr><td class="log-text" 
id="indent">Windows Systems:</td>
+                                       <td class="log-text" 
id="indent"><xsl:value-of select="@ws"/></td>
+                                       </tr>
+                               </xsl:if>
+                               <xsl:if test="@nl">
+                                       <tr><td class="log-text" 
id="indent">Languages:</td>
+                                       <td class="log-text" 
id="indent"><xsl:value-of select="@nl"/></td>
+                                       </tr>
+                               </xsl:if>
+                               <xsl:if test="@arch">
+                                       <tr><td class="log-text" 
id="indent">Architecture:</td>
+                                       <td class="log-text" 
id="indent"><xsl:value-of select="@arch"/></td>
+                                       </tr>
+                               </xsl:if>
+                       </table>
+               </td>
+       </tr>
+       </xsl:for-each>
+       </xsl:otherwise>
+       </xsl:choose>
+       </table>
+       </body>
+       </html>
+</xsl:for-each>
+</xsl:template>
+</xsl:stylesheet>

Added: tuscany/sandbox/rfeng/eclipse-workspace/.classpath
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/rfeng/eclipse-workspace/.classpath?rev=926662&view=auto
==============================================================================
--- tuscany/sandbox/rfeng/eclipse-workspace/.classpath (added)
+++ tuscany/sandbox/rfeng/eclipse-workspace/.classpath Tue Mar 23 16:59:14 2010
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" 
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src/main/java"/>
+       <classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: tuscany/sandbox/rfeng/eclipse-workspace/.project
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/rfeng/eclipse-workspace/.project?rev=926662&view=auto
==============================================================================
--- tuscany/sandbox/rfeng/eclipse-workspace/.project (added)
+++ tuscany/sandbox/rfeng/eclipse-workspace/.project Tue Mar 23 16:59:14 2010
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>tuscany-eclipse-workspace</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>

Added: 
tuscany/sandbox/rfeng/eclipse-workspace/.settings/org.eclipse.jdt.core.prefs
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/rfeng/eclipse-workspace/.settings/org.eclipse.jdt.core.prefs?rev=926662&view=auto
==============================================================================
--- 
tuscany/sandbox/rfeng/eclipse-workspace/.settings/org.eclipse.jdt.core.prefs 
(added)
+++ 
tuscany/sandbox/rfeng/eclipse-workspace/.settings/org.eclipse.jdt.core.prefs 
Tue Mar 23 16:59:14 2010
@@ -0,0 +1,8 @@
+#Mon Mar 22 14:57:37 PDT 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6

Added: tuscany/sandbox/rfeng/eclipse-workspace/META-INF/MANIFEST.MF
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/rfeng/eclipse-workspace/META-INF/MANIFEST.MF?rev=926662&view=auto
==============================================================================
--- tuscany/sandbox/rfeng/eclipse-workspace/META-INF/MANIFEST.MF (added)
+++ tuscany/sandbox/rfeng/eclipse-workspace/META-INF/MANIFEST.MF Tue Mar 23 
16:59:14 2010
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.apache.tuscany.eclipse.workspace
+Bundle-SymbolicName: org.apache.tuscany.eclipse.workspace;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.apache.tuscany.eclipse.workspace.Activator
+Bundle-Vendor: Apache Software Foundation
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.jdt.core,
+ org.eclipse.jdt.launching,
+ org.eclipse.pde.core,
+ org.eclipse.core.resources
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy

Added: tuscany/sandbox/rfeng/eclipse-workspace/build.properties
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/rfeng/eclipse-workspace/build.properties?rev=926662&view=auto
==============================================================================
--- tuscany/sandbox/rfeng/eclipse-workspace/build.properties (added)
+++ tuscany/sandbox/rfeng/eclipse-workspace/build.properties Tue Mar 23 
16:59:14 2010
@@ -0,0 +1,5 @@
+source.. = src/main/java/
+output.. = target/classes/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml

Propchange: tuscany/sandbox/rfeng/eclipse-workspace/build.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/rfeng/eclipse-workspace/build.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sandbox/rfeng/eclipse-workspace/plugin.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/rfeng/eclipse-workspace/plugin.xml?rev=926662&view=auto
==============================================================================
--- tuscany/sandbox/rfeng/eclipse-workspace/plugin.xml (added)
+++ tuscany/sandbox/rfeng/eclipse-workspace/plugin.xml Tue Mar 23 16:59:14 2010
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+    * Licensed to the Apache Software Foundation (ASF) under one
+    * or more contributor license agreements.  See the NOTICE file
+    * distributed with this work for additional information
+    * regarding copyright ownership.  The ASF licenses this file
+    * to you 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.    
+-->
+<plugin>
+   <extension
+         id="WorkspaceConfigurator"
+         point="org.eclipse.core.runtime.applications">
+      <application>
+         <run
+               
class="org.apache.tuscany.eclipse.workspace.WorkspaceConfigurator">
+         </run>
+      </application>
+   </extension>
+
+</plugin>

Propchange: tuscany/sandbox/rfeng/eclipse-workspace/plugin.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/rfeng/eclipse-workspace/plugin.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/Activator.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/Activator.java?rev=926662&view=auto
==============================================================================
--- 
tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/Activator.java
 (added)
+++ 
tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/Activator.java
 Tue Mar 23 16:59:14 2010
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.eclipse.workspace;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+    // The plug-in ID
+    public static final String PLUGIN_ID = 
"org.apache.tuscany.eclipse.workspace"; //$NON-NLS-1$
+
+    // The shared instance
+    private static Activator plugin;
+
+    /**
+     * The constructor
+     */
+    public Activator() {
+    }
+
+    public void start(BundleContext context) throws Exception {
+        super.start(context);
+        plugin = this;
+    }
+
+    public void stop(BundleContext context) throws Exception {
+        plugin = null;
+        super.stop(context);
+    }
+
+    /**
+     * Returns the shared instance
+     *
+     * @return the shared instance
+     */
+    public static Activator getDefault() {
+        return plugin;
+    }
+
+}

Propchange: 
tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/Activator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/Activator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/WorkspaceConfigurator.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/WorkspaceConfigurator.java?rev=926662&view=auto
==============================================================================
--- 
tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/WorkspaceConfigurator.java
 (added)
+++ 
tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/WorkspaceConfigurator.java
 Tue Mar 23 16:59:14 2010
@@ -0,0 +1,312 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.eclipse.workspace;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.pde.internal.core.PDECore;
+import org.eclipse.pde.internal.core.target.TargetDefinitionPersistenceHelper;
+import org.eclipse.pde.internal.core.target.provisional.ITargetHandle;
+import org.eclipse.pde.internal.core.target.provisional.ITargetPlatformService;
+import 
org.eclipse.pde.internal.core.target.provisional.LoadTargetDefinitionJob;
+import org.xml.sax.SAXException;
+
+...@suppresswarnings("restriction")
+public class WorkspaceConfigurator implements IApplication {
+    private static final String SOURCE_ROOT = "source.root";
+    private static final String TARGET_DEFINITION = "target.definition";
+    private static final String MAVEN_LOCAL_REPO = "maven.repo";
+    private static final String M2_REPO = "M2_REPO";
+
+    private IWorkspace workspace;
+    private final Object lock = new Object();
+
+    public Object start(final IApplicationContext appcontext) throws Exception 
{
+        IProgressMonitor monitor = createMonitor();
+        final String[] args = 
(String[])appcontext.getArguments().get(IApplicationContext.APPLICATION_ARGS);
+        setM2REPOClassPathVariable(args, monitor);
+        setTargetPlatform(args);
+
+        // Wait for the target platform job is done
+        synchronized (lock) {
+            lock.wait();
+        }
+        configureWorkspace(args, monitor);
+        return EXIT_OK;
+    }
+
+    private void setTargetPlatform(String args[]) throws 
FileNotFoundException, CoreException,
+        ParserConfigurationException, SAXException, IOException {
+        String targetFile = getOptionValue(args, TARGET_DEFINITION);
+        if (targetFile == null) {
+            return;
+        }
+        File tf = new File(targetFile).getAbsoluteFile();
+        print("Setting target platform: " + tf);
+        ITargetPlatformService tps =
+            
(ITargetPlatformService)PDECore.getDefault().acquireService(ITargetPlatformService.class.getName());
+        ITargetHandle th = tps.getTarget(tf.toURI());
+        FileInputStream is = new FileInputStream(tf);
+        try {
+            
TargetDefinitionPersistenceHelper.initFromXML(th.getTargetDefinition(), is);
+        } finally {
+            is.close();
+        }
+        IJobChangeListener jobListener = new JobChangeAdapter() {
+
+            @Override
+            public void done(IJobChangeEvent event) {
+                super.done(event);
+                synchronized (lock) {
+                    print("Target platform is configured: " + 
event.getResult());
+                    lock.notifyAll();
+                }
+            }
+
+        };
+        LoadTargetDefinitionJob.load(th.getTargetDefinition(), jobListener);
+    }
+
+    private IProgressMonitor createMonitor() {
+        return new NullProgressMonitor() {
+
+            @Override
+            public void beginTask(String name, int totalWork) {
+            }
+
+            @Override
+            public void done() {
+                // System.out.println();
+            }
+
+            @Override
+            public void worked(int work) {
+                // System.out.print(".");
+            }
+        };
+    }
+
+    private IPath setM2REPOClassPathVariable(String args[], IProgressMonitor 
monitor) throws JavaModelException {
+        IPath var = JavaCore.getClasspathVariable(M2_REPO);
+        if (var == null) {
+            String localRepo = getOptionValue(args, MAVEN_LOCAL_REPO);
+            if (localRepo == null) {
+                String home = System.getProperty("user.home");
+                localRepo = home + File.separator + ".m2" + File.separator + 
"repository";
+            }
+            File repo = new File(localRepo);
+            IPath path = new Path(repo.getAbsolutePath());
+            JavaCore.setClasspathVariable(M2_REPO, path, monitor);
+            return path;
+        }
+        return var;
+    }
+
+    private void configureWorkspace(final String[] args, IProgressMonitor 
monitor) throws Exception, CoreException {
+        this.workspace = ResourcesPlugin.getWorkspace();
+
+        String sourceRootArg = getOptionValue(args, SOURCE_ROOT);
+        File sourceRoot = null;
+        if (sourceRootArg != null) {
+            sourceRoot = new File(sourceRootArg);
+        }
+
+        configureJDT();
+
+        if (sourceRoot != null) {
+            importProjects(sourceRoot, monitor);
+        }
+
+        // cleanProjects(monitor);
+        buildWorkspace(monitor);
+
+        workspace.save(true, monitor);
+    }
+
+    private String getOptionValue(final String[] args, String option) {
+        String value = null;
+        if (args != null) {
+            List<String> argList = Arrays.asList(args);
+            int index = argList.indexOf("-" + option);
+            if (index != -1 && argList.size() - 1 >= index + 1) {
+                value = argList.get(index + 1);
+            }
+        }
+        return value;
+    }
+
+    public void stop() {
+        this.workspace = null;
+    }
+
+    private void importProjects(File sourceRoot, final IProgressMonitor 
monitor) throws Exception {
+        IWorkspaceRoot workspaceRoot = workspace.getRoot();
+
+        loadProjects(sourceRoot, monitor);
+
+        for (IProject p : workspaceRoot.getProjects()) {
+            if (!p.isOpen()) {
+                // Open the project
+                p.open(monitor);
+            } else {
+                // Refresh the project
+                p.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+            }
+            if (p.getFile(".project") == null) {
+                print("Deleting project: " + p.getName());
+                p.delete(false, true, monitor);
+            }
+        }
+
+    }
+
+    @SuppressWarnings("unchecked")
+    private void configureJDT() {
+        Hashtable<Object, Object> options = JavaCore.getOptions();
+        options.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.ERROR);
+        options.put(JavaCore.CORE_INCOMPLETE_CLASSPATH, JavaCore.WARNING);
+        JavaCore.setOptions(options);
+
+        IVMInstall vminstall = JavaRuntime.getDefaultVMInstall();
+        if (!vminstall.getName().equals("Default JRE")) {
+            vminstall.setName("Default JRE");
+        }
+    }
+
+    private void loadProjects(File sourceRoot, final IProgressMonitor monitor) 
throws CoreException {
+        if (sourceRoot.isDirectory()) {
+            File dotProject = new File(sourceRoot, ".project");
+            if (dotProject.exists() && dotProject.isFile()) {
+                IPath path = new Path(dotProject.getAbsolutePath());
+                IProjectDescription project = 
workspace.loadProjectDescription(path);
+                IProject p = workspace.getRoot().getProject(project.getName());
+                if (!p.exists()) {
+                    print("Importing project: " + project.getName());
+                    p.create(project, monitor);
+                }
+            }
+        } else {
+            return;
+        }
+
+        File[] dirs = sourceRoot.listFiles();
+        if (dirs == null) {
+            return;
+        }
+
+        for (int i = 0; i < dirs.length; i++) {
+            if (dirs[i].isDirectory()) {
+                loadProjects(dirs[i], monitor);
+            }
+        }
+    }
+
+    private void buildWorkspace(IProgressMonitor monitor) throws Exception {
+        print("Running a full build...");
+        workspace.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
+
+        reportErrors();
+    }
+
+    private void reportErrors() throws CoreException {
+        int errorCount = 0;
+        print();
+        IProject[] projects = workspace.getRoot().getProjects();
+        HashMap<String, List<IMarker>> errors = new HashMap<String, 
List<IMarker>>();
+        for (IProject p : projects) {
+            IMarker[] markers = p.findMarkers(null, true, 
IResource.DEPTH_INFINITE);
+            for (int m = 0; m < markers.length; m++) {
+                IMarker marker = markers[m];
+                int severity = marker.getAttribute(IMarker.SEVERITY, 
IMarker.SEVERITY_INFO);
+                if (severity == IMarker.SEVERITY_ERROR) {
+                    List<IMarker> list = errors.get(p.getName());
+                    if (list == null) {
+                        list = new ArrayList<IMarker>();
+                        errors.put(p.getName(), list);
+                    }
+                    list.add(marker);
+                    reportError(marker);
+                    errorCount++;
+                }
+            }
+        }
+
+        Iterator<String> it = errors.keySet().iterator();
+        while (it.hasNext()) {
+            String project = it.next();
+            List<IMarker> list = errors.get(project);
+            print("Project " + project + " has " + list.size() + " errors.");
+        }
+        print();
+
+        if (errorCount > 0) {
+            print("The build is completed with " + errorCount + " errors.");
+        } else {
+            print("The build is completed successfully.");
+        }
+        print();
+    }
+
+    private void reportError(IMarker marker) throws CoreException {
+        print("Error: " + marker.getResource()
+            + ":"
+            + marker.getAttribute(IMarker.LINE_NUMBER, 0)
+            + ": "
+            + marker.getAttribute(IMarker.MESSAGE));
+    }
+
+    private void print(Object... msgs) {
+        for (Object msg : msgs) {
+            System.out.println(msg);
+        }
+    }
+}

Propchange: 
tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/WorkspaceConfigurator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/WorkspaceConfigurator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date


Reply via email to