You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Nadim Murr <nm...@ccc.com.lb> on 2006/11/15 09:27:43 UTC

VFS & jar files

Hi,

 

I'm using commons VFS to read and write on different sources. I managed
to read and write on a file system source, ftp source...

My problem is the following; when dealing with jar or zip files, I'm not
able to write, and more specifically I can't create a new folder inside.

Check out the following code:

    FileObject fo = manager.resolveFile("file://C:/c3dq/file.jar");

    FileObject jarSys = manager.createFileSystem(fo);

    FileObject folder = jarSys.resolveFile("new");

    folder.createFolder();

 

I can read the jar file, and list its children, but when I call the
createFolder() method I get the following exception:

 

org.apache.commons.vfs.FileSystemException: Could not create folder
"jar:file://C:/c3dq/file.jar!/new" because its parent folder is
read-only.

      at
org.apache.commons.vfs.provider.AbstractFileObject.createFolder(Abstract
FileObject.java:798)

 

 

Is there anyway I can create new folder and files inside the jar itself?

 

Another question is: Is there a way to access a password protected jar
file in VFS?

 

Thank you...

Regards,

 

Nadim, 


Re: [compress] Re: VFS & jar files

Posted by Will Pugh <wi...@sourcelabs.com>.
Sorry for my delay.   Let me get this out next week.

When grabbing my old code, I found a few things I wanted to fix, and 
with Thanksgiving coming up, it will be a few days before I can get this 
out.

 I'll aim for Wed. of next week.

    Thanks,
    --Will

C. Grobmeier wrote:
> Cheers,
>
> sorry for my delay with compress i was quite busy last months.
>
>> 1) you finish the compress api change so that we can release it (and add
>> your code for sure) :-)
>
> There is not much to do there- look at this:
> http://wiki.apache.org/jakarta-commons/Compress
>
> I would like to simplify the api a bit (delete methods) but thats it. 
> The code could go into compress quite quick if a comitter supports it 
> (i am no one).
>
> Will, could you post a link to your proposal code at the dev list 
> again? I could integrate your code into the compress api. I have a bit 
> time at the moment, so it would be great to take a closer look at it 
> asap.
>
>> 2) you add your zip enhancements to VFS - we added the old compress code
>> so that we are able to get rid of any snapshot dependency so we can have
>> a VFS release. Yes, yes I know, still no time to cut the release ....
>>
>> In either way, please ensure you use the org.apache.compress/vfs
>> namespace, add the AFS license header and file a CLA (in case you didn't
>> in the past already)
>>
>>
>> For sure, I prefer the way 1.
>
> Me 2.
> Regards,
> Chris
>
>>
>> Ciao,
>> Mario
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>

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


Re: [compress] Re: VFS & jar files

Posted by Will Pugh <wi...@sourcelabs.com>.
Sorry, it took me a while.  Work + Holidays made everything pretty crazy.

I've created a new Jira issue 
(https://issues.apache.org/jira/browse/SANDBOX-183)  and attached my 
code there.

It is right now standalone, and not integrated with compress.  I've been 
thinking a little about how to integrate the two together, and there are 
a few issues:

    1)  I use NIO for my IO.  This is pretty useful for me, because when 
I modify the zip files, I try to do as little extra work as possible.  
As a result, I try to not have to re-compress unmodified blocks, but I 
sometimes need to slide them in the file.  I found using ByteBuffers 
here was a bit nicer.   I thought a JDK 1.4 dependency here was not 
crazy, especially since Compress is still in the sandbox.   I think I 
can get rid of this dependency if needed.

    2)  I did not use org.apache.commons.compress.zip.ZipOutputStream.  
This was because it seemed tricky to have a stream that could delete and 
modify entries.  Brainstorming a bit, I was thinking I could potentially 
merge my code with ZipOutputStream by being able to give it the partial 
state of the zip file it is adding to.  That way, all entries written to 
the zip file would be taken care of via the ZipOutputStream, and then 
some kind of ModifiableArchiver class would be able to take care of the 
logic for dealing with deletes and modifications.  (I treat 
modifications as a delete then add).


I had a ModifiableZipFile class that took care of keeping track of all 
the additions and modifications on a ZipFile.

    --Will

C. Grobmeier wrote:
> Cheers,
>
> sorry for my delay with compress i was quite busy last months.
>
>> 1) you finish the compress api change so that we can release it (and add
>> your code for sure) :-)
>
> There is not much to do there- look at this:
> http://wiki.apache.org/jakarta-commons/Compress
>
> I would like to simplify the api a bit (delete methods) but thats it. 
> The code could go into compress quite quick if a comitter supports it 
> (i am no one).
>
> Will, could you post a link to your proposal code at the dev list 
> again? I could integrate your code into the compress api. I have a bit 
> time at the moment, so it would be great to take a closer look at it 
> asap.
>
>> 2) you add your zip enhancements to VFS - we added the old compress code
>> so that we are able to get rid of any snapshot dependency so we can have
>> a VFS release. Yes, yes I know, still no time to cut the release ....
>>
>> In either way, please ensure you use the org.apache.compress/vfs
>> namespace, add the AFS license header and file a CLA (in case you didn't
>> in the past already)
>>
>>
>> For sure, I prefer the way 1.
>
> Me 2.
> Regards,
> Chris
>
>>
>> Ciao,
>> Mario
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>

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


Re: [compress] Re: VFS & jar files

Posted by "C. Grobmeier" <gr...@possessed.de>.
Cheers,

sorry for my delay with compress i was quite busy last months.

> 1) you finish the compress api change so that we can release it (and add
> your code for sure) :-)

There is not much to do there- look at this:
http://wiki.apache.org/jakarta-commons/Compress

I would like to simplify the api a bit (delete methods) but thats it. 
The code could go into compress quite quick if a comitter supports it (i 
am no one).

Will, could you post a link to your proposal code at the dev list again? 
I could integrate your code into the compress api. I have a bit time at 
the moment, so it would be great to take a closer look at it asap.

> 2) you add your zip enhancements to VFS - we added the old compress code
> so that we are able to get rid of any snapshot dependency so we can have
> a VFS release. Yes, yes I know, still no time to cut the release ....
> 
> In either way, please ensure you use the org.apache.compress/vfs
> namespace, add the AFS license header and file a CLA (in case you didn't
> in the past already)
> 
> 
> For sure, I prefer the way 1.

Me 2.
Regards,
Chris

> 
> Ciao,
> Mario
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


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


[compress] Re: VFS & jar files

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi Will!
> If folks are interested in code that can write to Zip Files, I've
> offered code to do this before.
Hmmm, looks like I really missed it, sorry!

> I was thinking it would make sense to put it in compress, and then VFS
> could use as well.
I don't know the status of commons-compress, there was a API change
undergoing (for sure, you know), but I am not sure whats the current
state is.


So, I see two ways ...

1) you finish the compress api change so that we can release it (and add
your code for sure) :-)
2) you add your zip enhancements to VFS - we added the old compress code
so that we are able to get rid of any snapshot dependency so we can have
a VFS release. Yes, yes I know, still no time to cut the release ....

In either way, please ensure you use the org.apache.compress/vfs
namespace, add the AFS license header and file a CLA (in case you didn't
in the past already)


For sure, I prefer the way 1.

Ciao,
Mario


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


Re: VFS & jar files

Posted by Will Pugh <wi...@sourcelabs.com>.
If folks are interested in code that can write to Zip Files, I've 
offered code to do this before.

It's a bit rough, but I'd be happy to polish it up.

I was thinking it would make sense to put it in compress, and then VFS 
could use as well.

Is anyone interested in this?  I'm not a committer, but I can attach 
the  zipped code to a Jira bug it that works.

    --Will

Mario Ivankovits wrote:
> Nadim Murr schrieb:
>   
>> My problem is the following; when dealing with jar or zip files, I'm not
>> able to write, and more specifically I can't create a new folder inside.
>>   
>>     
> VFS is not yet able to write to e.g. jar files, please see the
> capabilities matrix [1]
>
>   
>> Another question is: Is there a way to access a password protected jar
>> file in VFS?
>>   
>>     
> You mean signed jars, do you? No, there is no way yet to provide a
> password, but this might be done easily ... do you have some sort of
> code which shows how to do it?
>
> Ciao,
> Mario
>
>
> [1] http://wiki.apache.org/jakarta-commons/VfsCapabilitiesMatrix
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>   

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


Re: VFS & jar files

Posted by Mario Ivankovits <ma...@ops.co.at>.
Nadim Murr schrieb:
> My problem is the following; when dealing with jar or zip files, I'm not
> able to write, and more specifically I can't create a new folder inside.
>   
VFS is not yet able to write to e.g. jar files, please see the
capabilities matrix [1]

> Another question is: Is there a way to access a password protected jar
> file in VFS?
>   
You mean signed jars, do you? No, there is no way yet to provide a
password, but this might be done easily ... do you have some sort of
code which shows how to do it?

Ciao,
Mario


[1] http://wiki.apache.org/jakarta-commons/VfsCapabilitiesMatrix


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