maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From denn...@apache.org
Subject svn commit: r737615 - in /maven/doxia/doxia-sitetools/branches/doxia-sitetools-1.0.x: ./ doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/
Date Mon, 26 Jan 2009 00:02:26 GMT
Author: dennisl
Date: Mon Jan 26 00:02:26 2009
New Revision: 737615

URL: http://svn.apache.org/viewvc?rev=737615&view=rev
Log:
o Merge r733390 from trunk.

Modified:
    maven/doxia/doxia-sitetools/branches/doxia-sitetools-1.0.x/   (props changed)
    maven/doxia/doxia-sitetools/branches/doxia-sitetools-1.0.x/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/DefaultDecorationModelInheritanceAssembler.java
    maven/doxia/doxia-sitetools/branches/doxia-sitetools-1.0.x/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptor.java

Propchange: maven/doxia/doxia-sitetools/branches/doxia-sitetools-1.0.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jan 26 00:02:26 2009
@@ -1 +1 @@
-/maven/doxia/doxia-sitetools/trunk:629097,641296,693844,736602-736603,736628-736630,736929
+/maven/doxia/doxia-sitetools/trunk:629097,641296,693844,733390,736602-736603,736628-736630,736929

Modified: maven/doxia/doxia-sitetools/branches/doxia-sitetools-1.0.x/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/DefaultDecorationModelInheritanceAssembler.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/branches/doxia-sitetools-1.0.x/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/DefaultDecorationModelInheritanceAssembler.java?rev=737615&r1=737614&r2=737615&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/branches/doxia-sitetools-1.0.x/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/DefaultDecorationModelInheritanceAssembler.java
(original)
+++ maven/doxia/doxia-sitetools/branches/doxia-sitetools-1.0.x/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/DefaultDecorationModelInheritanceAssembler.java
Mon Jan 26 00:02:26 2009
@@ -44,6 +44,7 @@
  */
 public class DefaultDecorationModelInheritanceAssembler implements DecorationModelInheritanceAssembler
 {
+    /** {@inheritDoc} */
     public void assembleModelInheritance( String name, DecorationModel child, DecorationModel
parent,
                                           String childBaseUrl, String parentBaseUrl )
     {
@@ -88,9 +89,10 @@
         }
     }
 
-    public void resolvePaths( final DecorationModel decoration, final String childBaseUrl
)
+    /** {@inheritDoc} */
+    public void resolvePaths( final DecorationModel decoration, final String baseUrl )
     {
-        URLContainer urlContainer = new URLContainer( null, childBaseUrl );
+        URLContainer urlContainer = new URLContainer( null, baseUrl );
 
         if ( decoration.getBannerLeft() != null )
         {
@@ -139,8 +141,7 @@
      * to the oldBaseUrl, these are changed to the newBannerUrl.
      *
      * @param banner
-     * @param prefix
-     * @param baseUrl
+     * @param urlContainer
      */
     private void resolveBannerPaths( final Banner banner, final URLContainer urlContainer
)
     {
@@ -151,7 +152,7 @@
         }
     }
 
-    private void assembleCustomInheritance( DecorationModel child, DecorationModel parent
)
+    private void assembleCustomInheritance( final DecorationModel child, final DecorationModel
parent )
     {
         if ( child.getCustom() == null )
         {
@@ -250,7 +251,7 @@
         }
     }
 
-    private void resolveLinkItemPaths( LinkItem item, final URLContainer urlContainer )
+    private void resolveLinkItemPaths( final LinkItem item, final URLContainer urlContainer
)
     {
         if ( StringUtils.isNotEmpty( item.getHref() ) )
         {
@@ -347,6 +348,9 @@
         }
     }
 
+    /**
+     * Contains an old and a new path.
+     */
     public final class URLContainer
     {
 
@@ -354,17 +358,33 @@
 
         private final String newPath;
 
+        /**
+         * Construct a URLContainer.
+         *
+         * @param oldPath the old path.
+         * @param newPath the new path.
+         */
         public URLContainer( final String oldPath, final String newPath )
         {
             this.oldPath = oldPath;
             this.newPath = newPath;
         }
 
+        /**
+         * Get the new path.
+         *
+         * @return the new path.
+         */
         public String getNewPath()
         {
             return this.newPath;
         }
 
+        /**
+         * Get the old path.
+         *
+         * @return the old path.
+         */
         public String getOldPath()
         {
             return this.oldPath;

Modified: maven/doxia/doxia-sitetools/branches/doxia-sitetools-1.0.x/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptor.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/branches/doxia-sitetools-1.0.x/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptor.java?rev=737615&r1=737614&r2=737615&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/branches/doxia-sitetools-1.0.x/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptor.java
(original)
+++ maven/doxia/doxia-sitetools/branches/doxia-sitetools-1.0.x/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptor.java
Mon Jan 26 00:02:26 2009
@@ -42,31 +42,55 @@
 
     private final String relativePath;
 
+    /**
+     * Construct a PathDescriptor from a path.
+     *
+     * @param path the path.
+     *
+     * @throws java.net.MalformedURLException if a URL cannot be formed from the path.
+     */
     public PathDescriptor( final String path ) throws MalformedURLException
     {
         this( (URL) null, path );
     }
 
+    /**
+     * Construct a PathDescriptor from a path and a base.
+     *
+     * @param base a base reference.
+     * @param path the path.
+     *
+     * @throws java.net.MalformedURLException if a URL cannot be formed from the path.
+     */
     public PathDescriptor( final String base, final String path ) throws MalformedURLException
     {
         this( PathDescriptor.buildBaseUrl( base ), path );
     }
 
+    /**
+     * Construct a PathDescriptor from a path and a base.
+     *
+     * @param baseUrl a base reference.
+     * @param path the path.
+     *
+     * @throws java.net.MalformedURLException if a URL cannot be formed from the path.
+     */
     public PathDescriptor( final URL baseUrl, final String path ) throws MalformedURLException
     {
         this.baseUrl = baseUrl;
 
-        URL pathUrl = null;
-        String relativePath = null;
+        URL pathURL = null;
+        String relPath = null;
+
         try
         {
-            pathUrl = new URL( path );
+            pathURL = new URL( path );
         }
         catch ( MalformedURLException e )
         {
             try
             {
-                pathUrl = buildUrl( baseUrl, path );
+                pathURL = buildUrl( baseUrl, path );
             }
             catch ( MalformedURLException e2 )
             {
@@ -75,19 +99,20 @@
                 // to which it has been anchored.
                 if ( path != null && path.startsWith( "/" ) )
                 {
-                    relativePath = path.substring( 1 );
+                    relPath = path.substring( 1 );
                 }
                 else
                 {
-                    relativePath = path;
+                    relPath = path;
                 }
             }
         }
-        this.pathUrl = pathUrl;
-        this.relativePath = relativePath;
+
+        this.pathUrl = pathURL;
+        this.relativePath = relPath;
     }
 
-    private static final URL buildBaseUrl( final String base ) throws MalformedURLException
+    private static URL buildBaseUrl( final String base ) throws MalformedURLException
     {
         if ( base == null )
         {
@@ -100,11 +125,11 @@
         }
         catch ( MalformedURLException e )
         {
-            return new File( base ).toURL();
+            return new File( base ).toURI().toURL();
         }
     }
 
-    private static final URL buildUrl( final URL baseUrl, final String path ) throws MalformedURLException
+    private static URL buildUrl( final URL baseUrl, final String path ) throws MalformedURLException
     {
         if ( baseUrl == null )
         {
@@ -118,7 +143,7 @@
 
         if ( baseUrl.getProtocol().equals( "file" ) )
         {
-            return new File( baseUrl.getFile(), path ).toURL();
+            return new File( baseUrl.getFile(), path ).toURI().toURL();
         }
 
         if ( path.startsWith( "/" ) && baseUrl.getPath().endsWith( "/" ) )
@@ -129,26 +154,51 @@
         return new URL( baseUrl, path );
     }
 
+    /**
+     * Check if this PathDescriptor decribes a file.
+     *
+     * @return true for file, false otherwise.
+     */
     public boolean isFile()
     {
         return isRelative() || pathUrl.getProtocol().equals( "file" );
     }
 
+    /**
+     * Check if this PathDescriptor decribes a relative path.
+     *
+     * @return true if {@link #getPathUrl()} returns null.
+     */
     public boolean isRelative()
     {
         return pathUrl == null;
     }
 
+    /**
+     * Get the base URL.
+     *
+     * @return the base URL.
+     */
     public URL getBaseUrl()
     {
         return baseUrl;
     }
 
+    /**
+     * Get the path as a URL.
+     *
+     * @return the path as a URL.
+     */
     public URL getPathUrl()
     {
         return pathUrl;
     }
 
+    /**
+     * Get the path.
+     *
+     * @return the path.
+     */
     public String getPath()
     {
         if ( getPathUrl() != null )
@@ -168,6 +218,11 @@
         }
     }
 
+    /**
+     * Get the location for files.
+     *
+     * @return the location.
+     */
     public String getLocation()
     {
         if ( isFile() )
@@ -187,6 +242,7 @@
         }
     }
 
+    /** {@inheritDoc} */
     public String toString()
     {
         StringBuffer res =



Mime
View raw message