You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by th...@apache.org on 2014/08/27 05:28:07 UTC

git commit: TAP5-2192 : distributed configuration (improvements)

Repository: tapestry-5
Updated Branches:
  refs/heads/master 532cfae85 -> 86302a604


TAP5-2192 : distributed configuration (improvements)


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/86302a60
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/86302a60
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/86302a60

Branch: refs/heads/master
Commit: 86302a604b6a8f055b33ba355aba5da857d5c7b0
Parents: 532cfae
Author: Thiago H. de Paula Figueiredo <th...@apache.org>
Authored: Wed Aug 27 00:27:50 2014 -0300
Committer: Thiago H. de Paula Figueiredo <th...@apache.org>
Committed: Wed Aug 27 00:27:50 2014 -0300

----------------------------------------------------------------------
 .../MavenComponentLibraryInfoSource.java        | 13 +++++-----
 .../tapestry5/modules/TapestryModule.java       | 24 ++++++++++++++-----
 .../services/ComponentLibraryInfo.java          | 24 ++++++++++++-------
 .../corelib/pages/ComponentLibraries.tml        | 25 +++++++++++---------
 4 files changed, 55 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/86302a60/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/MavenComponentLibraryInfoSource.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/MavenComponentLibraryInfoSource.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/MavenComponentLibraryInfoSource.java
index f80dec2..e9f0495 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/MavenComponentLibraryInfoSource.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/MavenComponentLibraryInfoSource.java
@@ -79,6 +79,7 @@ public class MavenComponentLibraryInfoSource implements ComponentLibraryInfoSour
             {
                 InputStream inputStream = getClass().getResourceAsStream("/" + pomPath);
                 info = parse(inputStream);
+                info.setLibraryMapping(libraryMapping);
                 cache.put(libraryMapping.libraryName, info);
             }
             else
@@ -89,10 +90,6 @@ public class MavenComponentLibraryInfoSource implements ComponentLibraryInfoSour
         return info;
     }
 
-    /**
-     * @param inputStream
-     * @return
-     */
     private ComponentLibraryInfo parse(InputStream inputStream)
     {
         ComponentLibraryInfo info = null;
@@ -123,7 +120,7 @@ public class MavenComponentLibraryInfoSource implements ComponentLibraryInfoSour
             info.setIssueTrackerUrl(extractText(document, "/project/issueManagement/url"));
             info.setJavadocUrl(extractText(document, "/project/properties/javadocUrl"));
             info.setSourceBrowseUrl(extractText(document, "/project/scm/url"));
-            info.setSourceRootUrl(extractText(document, "/project/scm/connection"));
+            info.setSourceRootUrl(extractText(document, "/project/properties/sourceRootUrl"));
             String tags = extractText(document, "/project/properties/tags");
             if (tags != null && tags.length() > 0)
             {
@@ -149,6 +146,10 @@ public class MavenComponentLibraryInfoSource implements ComponentLibraryInfoSour
         {
             throw new RuntimeException(e);
         }
+        if ("".equals(text)) 
+        {
+            text = null;
+        }
         return text;
     }
 
@@ -205,7 +206,7 @@ public class MavenComponentLibraryInfoSource implements ComponentLibraryInfoSour
         };
         try
         {
-            return classpathScanner.scan("META-INF/maven", classpathMatcher);
+            return classpathScanner.scan("META-INF/maven/", classpathMatcher);
         }
         catch (IOException e)
         {

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/86302a60/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java b/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java
index bb71643..9dac319 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java
@@ -2736,8 +2736,24 @@ public final class TapestryModule
             if (libraryMapping.libraryName.equals("core"))
             {
             
-                final InputStream inputStream = TapestryModule.class
-                        .getResourceAsStream("/META-INF/gradle/org.apache.tapestry/tapestry-core/project.properties");
+                info = new ComponentLibraryInfo();
+                
+                // the information above will probably not change in the future, or change very 
+                // infrequently, so I see no problem in hardwiring them here.
+                info.setArtifactId("tapestry-core");
+                info.setGroupId("org.apache.tapestry");
+                info.setName("Tapestry 5 core component library");
+                info.setDescription("Components provided out-of-the-box by Tapestry");
+                info.setDocumentationUrl("http://tapestry.apache.org/component-reference.html");
+                info.setJavadocUrl("http://tapestry.apache.org/current/apidocs/");
+                info.setSourceBrowseUrl("https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;a=summary");
+                info.setSourceRootUrl("https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;a=blob;f=tapestry-core/src/main/java/");
+                info.setIssueTrackerUrl("https://issues.apache.org/jira/browse/TAP5");
+                info.setHomepageUrl("http://tapestry.apache.org");
+                info.setLibraryMapping(libraryMapping);
+                
+                final InputStream inputStream = TapestryModule.class.getResourceAsStream(
+                        "/META-INF/gradle/org.apache.tapestry/tapestry-core/project.properties");
                 
                 if (inputStream != null)
                 {
@@ -2750,11 +2766,7 @@ public final class TapestryModule
                     {
                         throw new RuntimeException(e);
                     }
-                    info = new ComponentLibraryInfo();
-                    info.setArtifactId("tapestry-core");
-                    info.setGroupId("org.apache.tapestry");
                     info.setVersion(properties.getProperty("version"));
-                    info.setDescription("Tapestry 5 core component library");
                 }
             }
             return info;

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/86302a60/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentLibraryInfo.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentLibraryInfo.java b/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentLibraryInfo.java
index e752e2a..a043c5c 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentLibraryInfo.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentLibraryInfo.java
@@ -85,7 +85,7 @@ public final class ComponentLibraryInfo implements Serializable
 
     /**
      * Returns the URL where the root folder of component library's source can be found.
-     * For example, "https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;a=tree".
+     * For example, "https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;a=tree;f=tapestry-core/src/main/java/".
      */
     public String getSourceRootUrl()
     {
@@ -200,11 +200,6 @@ public final class ComponentLibraryInfo implements Serializable
     {
         if (this.sourceRootUrl != null) throwExceptionIfAlreadySet("sourceRootUrl", sourceRootUrl);
         this.sourceRootUrl = sourceRootUrl;
-        if (sourceUrlResolver == null)
-        {
-            sourceUrlResolver = new DefaultSourceUrlResolver();
-            sourceUrlResolver.setRootUrl(sourceRootUrl);
-        }
     }
 
     public void setJavadocUrl(String javadocUrl)
@@ -305,8 +300,13 @@ public final class ComponentLibraryInfo implements Serializable
     public String getSourceUrl(String className)
     {
         String url = null;
-        if (sourceUrlResolver != null)
+        if (sourceRootUrl != null)
         {
+            if (sourceUrlResolver == null)
+            {
+                sourceUrlResolver = new DefaultSourceUrlResolver();
+                sourceUrlResolver.setRootUrl(sourceRootUrl);
+            }
             url = sourceUrlResolver.resolve(className);
         }
         return url;
@@ -349,15 +349,23 @@ public final class ComponentLibraryInfo implements Serializable
         @Override
         public String resolve(String className)
         {
-            return sourceRootUrl + "/" + className.replace('.', '/') + ".java";
+            return sourceRootUrl + className.replace('.', '/') + ".java";
         }
 
         @Override
         public void setRootUrl(String url)
         {
             this.sourceRootUrl = url;
+            if (sourceRootUrl.startsWith("scm:"))
+            {
+                this.sourceRootUrl = this.sourceRootUrl.replaceFirst("[^:]+:[^:]+:", "");
+            }
         }
         
     }
     
+    public String toString() {
+        return String.format("ComponentLibraryInfo[%s]", libraryMapping);
+    }
+    
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/86302a60/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ComponentLibraries.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ComponentLibraries.tml b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ComponentLibraries.tml
index 5bd16e6..d64a314 100644
--- a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ComponentLibraries.tml
+++ b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ComponentLibraries.tml
@@ -42,6 +42,13 @@
 				        		<a href="${info.homepageUrl}">${info.homepageUrl}</a>
 				        	</t:if>
 				        </dd>
+				        
+				        <dt>Version</dt>
+				        <dd class="version">
+				        	<t:if test="info.version" else="message:not-informed">
+				        		${info.version}
+				        	</t:if>
+				        </dd>
 				
 				        <dt>Documentation URL</dt>
 				        <dd class="documentationUrl">
@@ -62,7 +69,7 @@
 				        	<dd class="dependencyInformation">
 			        			Group id <code class="groupId">${info.groupId}</code>,
 			        			artifact id <code class="groupId">${info.artifactId}</code>,
-			        			version. <code class="groupId">${info.version}</code>
+			        			version <code class="groupId">${info.version}</code>
 			        			<br/>
 				        		<a href="${info.dependencyManagementInfoUrl}" 
 				        			target="_blank">
@@ -77,27 +84,23 @@
 				        		<a href="${info.sourceBrowseUrl}">${info.sourceBrowseUrl}</a>
 				        	</t:if>
 				        </dd>
-				
-				        <dt>Source root URL</dt>
-				        <dd class="sourceRootUrl">
-				        	<t:if test="info.sourceRootUrl" else="message:not-informed">
-				        		<a href="${info.sourceRootUrl}">${info.sourceRootUrl}</a>
-				        	</t:if>
-				        </dd>
-	
+				        
 				        <dt>Issue tracker URL</dt>
 				        <dd class="issueTrackerUrl">
 				        	<t:if test="info.issueTrackerUrl" else="message:not-informed">
 				        		<a href="${info.issueTrackerUrl}">${info.issueTrackerUrl}</a>
 				        	</t:if>
 				        </dd>
+				        
+				        <dt></dt>
+				        <dd class="jsonDescription">
+				        	<a t:type="EventLink" t:event="json" t:context="libraryMapping.libraryName">Generate JSON description</a>
+				        </dd>
 				
 				    </dl>
 			    
 				</t:if>
 	
-				<a t:type="EventLink" t:event="json" t:context="libraryMapping.libraryName">Generate JSON description</a>
-				
 				<p t:type="If" t:test="!info" class="noInformation">No additional information provided for <code>${libraryMapping.libraryName}</code>.</p>
 				
 	<!-- 			<div t:type="Zone" t:id="pages" id="prop:libraryClientZoneClientId"> -->