Author: mmerz
Date: Tue Feb  8 21:10:30 2005
New Revision: 153016

URL: http://svn.apache.org/viewcvs?view=rev&rev=153016
Log:
1) Don't copy svn-build files into the distro.
2) Fix relative URLs in HandlerChain.file.
3) Add velocity to WSM deployment unit.

Modified:
    incubator/beehive/trunk/distribution.xml
    incubator/beehive/trunk/wsm/build.xml
    
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java

Modified: incubator/beehive/trunk/distribution.xml
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/distribution.xml?view=diff&r1=153015&r2=153016
==============================================================================
--- incubator/beehive/trunk/distribution.xml (original)
+++ incubator/beehive/trunk/distribution.xml Tue Feb  8 21:10:30 2005
@@ -302,7 +302,7 @@
         <!-- Build the WSM/template -->
         <copy todir="${dist.dir}/samples/wsm-blank" failOnError="true">
             <fileset dir="samples/wsm-blank">
-                <exclude name="WEB-INF/build.xml"/>
+                <exclude name="WEB-INF/build*svn.xml"/>
             </fileset>
         </copy>
 

Modified: incubator/beehive/trunk/wsm/build.xml
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/build.xml?view=diff&r1=153015&r2=153016
==============================================================================
--- incubator/beehive/trunk/wsm/build.xml (original)
+++ incubator/beehive/trunk/wsm/build.xml Tue Feb  8 21:10:30 2005
@@ -250,6 +250,7 @@
             <fileset refid="xbean.fileset"/>
             <fileset refid="jsr173.fileset"/>
             <fileset refid="controls.fileset"/>
+            <fileset refid="velocity.fileset"/>
         </copy>
     </target>
     <!-- ==================================================================== 
-->

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java?view=diff&r1=153015&r2=153016
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java
 (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java
 Tue Feb  8 21:10:30 2005
@@ -97,7 +97,7 @@
     public Jsr181TypeMetadataImpl(JavaTypeInfo jt) throws Exception {
 
         super();
-        
+
         if (null == jt) {
             jt.logError("illegal java type info: <null>");
         }
@@ -376,9 +376,14 @@
     }
 
     /**
-     * Starts with '<protocol>//:': absolute URL
-     * Starts with '/':             URL relative to class' base dir
-     * Else:                        URL relative to class
+     * Finds a resource given a resource path. Tries absolute path (http://...
+     * or file:/...) first, then relative to basePath. This method does not 
use 
+     * class loaders since it needs to work with source files as well as with
+     * (binary) class files.
+     * @resourcePath the path of the resource, either absolute or relative
+     *   (to basePath).
+     * @basePath only required when resourcePath is relative. 
+     * @returns URL of resource.
      */
     private URL findResource(String resourcePath, File basePath) {
 
@@ -390,7 +395,7 @@
         }
         
         // handle absolute URL
-        if (0 < resourcePath.indexOf(":/")) {
+        if (resourcePath.startsWith("http://";) || 
resourcePath.startsWith("file:/")) {
             try {
                 resourceURL = new URL(resourcePath);
                 return resourceURL;
@@ -400,24 +405,24 @@
             }
         }
         
-        // handle relative URL
+        // handle relative URL (we cannot use class loaders here)
         if ((null == basePath) || (! basePath.exists())) {
             return null;
         }
-        String base = basePath.toString();
         if (resourcePath.startsWith("/")) {
+            String base = basePath.toString();
             String temp = className;
             int lastIdx = className.lastIndexOf('.');
-            if (0 < lastIdx) {
-                temp = temp.substring(0, lastIdx);
+            if (0 >= lastIdx) {
+                return null;
             }
-            temp = temp.replace('.', File.separatorChar);
+            temp = temp.substring(0, lastIdx).replace('.', File.separatorChar);
             if (! base.endsWith(temp)) {
                 return null;
             }
-            temp = base.substring(0, temp.length());
+            temp = base.substring(0, base.length() - temp.length());
             try {
-                resourceURL = new File(new File(temp, resourcePath), 
resourcePath).toURL();
+                resourceURL = new File(temp, resourcePath).toURL();
             }
             catch (MalformedURLException e) {
                 return null;
@@ -425,7 +430,7 @@
         }
         else {
             try {
-                resourceURL = new File(base, resourcePath).toURL();
+                resourceURL = new File(basePath, resourcePath).toURL();
             }
             catch (MalformedURLException e) {
                 return null;


Reply via email to