[ http://issues.apache.org/jira/browse/VFS-39?page=comments#action_12444016 
] 
            
Mario Ivankovits commented on VFS-39:
-------------------------------------

I've tried to apply this patch but didnt manage to get the thing working.

On the one hand there are some internal in VFS changes which the xml 
implementation should take care of, for example the FileName now also knows if 
a name is a folder of file and checks if the fileType is of type file or 
folder, ok, I managed to fix this ;-)

In the end I failed with a NPE in flushChilds (which I renamed to flushChildren 
;-) )

Due to the lack of time I stopped now trying to get this thing running.
If you still would like to have this in VFS, could you please make it running 
again.

Btw: I tried to read the pom.xml file you can find in the VFS root directory.

Sorry!

> [VFS] read/write XML support
> ----------------------------
>
>                 Key: VFS-39
>                 URL: http://issues.apache.org/jira/browse/VFS-39
>             Project: Commons VFS
>          Issue Type: Improvement
>    Affects Versions: Nightly Builds
>         Environment: Operating System: other
> Platform: Other
>            Reporter: Benoit Callebaut
>            Priority: Minor
>         Attachments: package.html, patchfile, test.xml, vfs.patch, 
> VFSXmlFileObject.java, VFSXmlFileProvider.java, VFSXmlFileSystem.java
>
>
> 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;
> +    }
>  }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to