You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2006/05/07 16:35:17 UTC

DO NOT REPLY [Bug 39507] New: - [PATCH] read/write XML support

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39507>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39507

           Summary: [PATCH] read/write XML support
           Product: Commons
           Version: Nightly Builds
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: VFS
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: benoit.callebaut@gmail.com


Here is the patch and necessary files for adding XML support for VFS.
I don't know how to include new files in a patch, so I will put them on the
mailing list.
I am not a test writer specialist, so there is no specific test case for this
provider but I tested it and it works.

Index: vfs/src/test/org/apache/commons/vfs/RunTest.java
===================================================================
--- vfs/src/test/org/apache/commons/vfs/RunTest.java    (revision 404758)
+++ vfs/src/test/org/apache/commons/vfs/RunTest.java    (working copy)
@@ -26,6 +26,7 @@
 import org.apache.commons.vfs.provider.url.test.UrlProviderHttpTestCase;
 import org.apache.commons.vfs.provider.test.VirtualProviderTestCase;
 import org.apache.commons.vfs.provider.test.GenericFileNameTestCase;
+import org.apache.commons.vfs.provider.xml.test.XmlProviderTestCase;

 import java.util.Properties;

@@ -67,6 +68,7 @@
                // WebdavProviderTestCase.suite(),

                SftpProviderTestCase.suite(),
+               XmlProviderTestCase.suite(),

                // JarProviderTestCase.suite(),
                // NestedJarTestCase.suite(),
Index: vfs/src/java/org/apache/commons/vfs/impl/providers.xml
===================================================================
--- vfs/src/java/org/apache/commons/vfs/impl/providers.xml      (revision 404758)
+++ vfs/src/java/org/apache/commons/vfs/impl/providers.xml      (working copy)
@@ -51,6 +51,9 @@
     <provider
class-name="org.apache.commons.vfs.provider.res.ResourceFileProvider">
         <scheme name="res"/>
     </provider>
+    <provider class-name="org.apache.commons.vfs.provider.xml.VFSXmlFileProvider">
+        <scheme name="xml"/>
+    </provider>
     <!--
         <provider class-name="org.apache.commons.vfs.provider.tar.TgzFileProvider">
             <scheme name="tgz"/>
@@ -78,8 +81,10 @@
         <scheme name="ram"/>
     </provider>

+    <extension-map extension="xml" scheme="xml"/>
     <extension-map extension="zip" scheme="zip"/>
     <extension-map extension="tar" scheme="tar"/>
+    <mime-type-map mime-type="application/xml" scheme="xml"/>
     <mime-type-map mime-type="application/zip" scheme="zip"/>
     <mime-type-map mime-type="application/x-tar" scheme="tar"/>
     <mime-type-map mime-type="application/x-gzip" scheme="gz"/>
Index: vfs/src/java/org/apache/commons/vfs/FileType.java
===================================================================
--- vfs/src/java/org/apache/commons/vfs/FileType.java   (revision 404758)
+++ vfs/src/java/org/apache/commons/vfs/FileType.java   (working copy)
@@ -46,7 +46,7 @@
     private final boolean hasContent;
     private final boolean hasAttrs;

-    private FileType(final String name,
+    public FileType(final String name,
                      final boolean hasChildren,
                      final boolean hasContent,
                      final boolean hasAttrs)
@@ -96,4 +96,14 @@
     {
         return hasAttrs;
     }
+
+    public boolean equals(Object obj){
+        if (!(obj instanceof FileType)) return false;
+        FileType ob = (FileType)obj;
+        if (this.hasContent() && ob.hasContent()) return true;
+        if (this.hasChildren() && ob.hasChildren()) return true;
+        if (this.hasAttributes() && ob.hasAttributes()) return true;
+
+        return false;
+    }
 }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 39507] - [PATCH] read/write XML support

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39507>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39507





------- Additional Comments From benoit.callebaut@gmail.com  2006-05-07 14:52 -------
Created an attachment (id=18237)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=18237&action=view)
XML test file

must be put under src/test-data/

Sample test file.
Can be used to test empty node, text only node, node with attributes and mixed
node (text/sub nodes)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 39507] - [PATCH] read/write XML support

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39507>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39507





------- Additional Comments From benoit.callebaut@gmail.com  2006-05-07 14:54 -------
Created an attachment (id=18239)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=18239&action=view)
Provider source

put it undersrc/java/org/apache/commons/vfs/provider/xml/

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 39507] - [PATCH] read/write XML support

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39507>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39507





------- Additional Comments From benoit.callebaut@gmail.com  2006-05-07 14:54 -------
Created an attachment (id=18240)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=18240&action=view)
FileSystem source

put it undersrc/java/org/apache/commons/vfs/provider/xml/

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 39507] - [PATCH] read/write XML support

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39507>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39507





------- Additional Comments From benoit.callebaut@gmail.com  2006-05-07 14:53 -------
Created an attachment (id=18238)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=18238&action=view)
FileObject source

put it undersrc/java/org/apache/commons/vfs/provider/xml/ 

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 39507] - [PATCH] read/write XML support

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39507>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39507





------- Additional Comments From benoit.callebaut@gmail.com  2006-05-07 14:55 -------
Created an attachment (id=18241)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=18241&action=view)
package file

put it undersrc/java/org/apache/commons/vfs/provider/xml/

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 39507] - [PATCH] read/write XML support

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39507>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39507





------- Additional Comments From benoit.callebaut@gmail.com  2006-05-07 14:50 -------
Created an attachment (id=18236)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=18236&action=view)
the patch itself

Contains only diffs needed to existing files.
Mainly new entry in providers.xml
A change in the implementation of FileType.java. A new FileType object may be
created (constructor is made public). So that we can support an xml node that
can have content like a file and children like a folder.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 39507] - [PATCH] read/write XML support

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39507>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39507





------- Additional Comments From tcurdt@apache.org  2006-05-07 16:07 -------
Hm... IMO this seems a bit out of scope for VFS

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 39507] - [VFS] read/write XML support

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39507>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39507


bayard@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[PATCH] read/write XML      |[VFS] read/write XML support
                   |support                     |




-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org