You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Dave Sag <ds...@visualitylife.com> on 2005/05/03 13:11:09 UTC

Re: examples of writing binary data to JCR

hmm... a patch you say.

sorry mate but I have no idea how to generate a patch file, or even  
how to apply one?  i usually just update my src using CCS (SVN in  
this case) and never bother about patch files.

cheers

dave

On 29/04/2005, at 4:32 PM, David Nuescheler wrote:

> hi dave,
>
> thanks, looks great.
> do you think you could send a patch?
>
> regards,
> david
>
> On 4/29/05, Dave Sag <ds...@visualitylife.com> wrote:
>
>> hey David that's great and many thanks.  I was very close with my own
>> code but your example filled in the blanks for me.  ta.  sorry for  
>> the
>> delay but i went off on holiday for a few days.  ahh yorkshire is
>> beautiful.
>>
>> I updated it slightly to extract the actual mime type...  see methods
>> below.
>>
>> used the sun.net.www.MimeTable
>>
>>     //
>> --------------------------------------------------------------------- 
>> ---
>> --
>>     /**
>>      * Return the filename without any path data, but with the  
>> suffix.
>>      *
>>      * @param   url  the url or path of the file
>>      *
>>      * @return  filename without any path data but including the  
>> suffix.
>>      */
>>     public static String getFilename(String url) {
>>         int i = url.lastIndexOf(File.separator);
>>
>>         if (i == -1) {
>>             return url;
>>         } else {
>>             return url.substring(i + 1);
>>         }
>>     }
>>
>>     //
>> --------------------------------------------------------------------- 
>> ---
>> --
>>     /**
>>      * gets the correct MIME content type for the given file.
>>      *
>>      * @param   url  the url of the file.
>>      *
>>      * @return  the mime type.
>>      */
>>     public static String getContentType(String url) {
>>         // get the mime type
>>         MimeTable mt = MimeTable.getDefaultTable();
>>
>>         String mime = mt.getContentTypeFor(getFilename(url));
>>
>>         return mime;
>>     }
>>
>> cheers and thanks
>>
>> dave
>>
>>
>> On 26/04/2005, at 12:48 AM, David Nuescheler wrote:
>>
>>
>>> hi dave,
>>>
>>> with respect to the question about importing binaries
>>> into the repository, i checked-in a simple fs-import example into
>>> the "examples"-contrib.
>>>
>>> http://svn.apache.org/repos/asf/incubator/jackrabbit/trunk/contrib/
>>> examples/src/java/org/apache/jackrabbit/examples/FSImport.java
>>>
>>> its main method takes one command-line argument specifying a
>>> path to a directory to be imported into the repositories root node.
>>>
>>> let me know if this is helpful at all...
>>> extensions, fixes and clean-up are very welcome ;)
>>>
>>> regards,
>>> david
>>>
>>
>>
>>
>
>
> -- 
> ----------------------------------------------------------------------
> standardize your content-repository !
>                                http://www.jcp.org/en/jsr/detail?id=170
> ---------------------------------------< david.nuescheler@day.com >---
>
> This message is a private communication. If you are not the intended
> recipient, please do not read, copy, or use it, and do not disclose it
> to others. Please notify the sender of the delivery error by replying
> to this message, and then delete it from your system. Thank you.
>
> The sender does not assume any liability for timely, trouble free,
> complete, virus free, secure, error free or uninterrupted arrival of
> this e-mail. For verification please request a hard copy version.
>
>
> mailto:david.nuescheler@day.com
> http://www.day.com
>
> David Nuescheler
> Chief Technology Officer
> Day Software AG
> Barfuesserplatz 6 / Postfach
> 4001 Basel
> Switzerland
>
> T  41 61 226 98 98
> F  41 61 226 98 97
>


Re: examples of writing binary data to JCR

Posted by David Nuescheler <da...@gmail.com>.
hi dave,

thanks a lot for the contribution.
unfortunately, i only now got around to do it. i adapted your
code slightly, but functionality wise it should do the same thing.
please feel free to correct the changes if it is not what you anticipated.

regards,
david

On 5/3/05, Dave Sag <ds...@visualitylife.com> wrote:
> i guess that would presume that the source file i changed was the one
> in SVN already.  I took the code from the example and did stuff to it
> for my own app here, and the changed i added were to my app, not the
> jackrabbit src
> 
> i suppose i should go and read up on patch files :-)  but we have
> never used them here.
> 
> i am sure someone with commit rights to jackrabbit can copy and paste
> that code into place.  I have a short unit test for those methods too
> of course.
> 
> cheers
> 
> dave
> 
> 
> On 03/05/2005, at 4:21 PM, Brian Moseley wrote:
> 
> > Dave Sag wrote:
> >
> >
> >> sorry mate but I have no idea how to generate a patch file, or
> >> even  how to apply one?  i usually just update my src using CCS
> >> (SVN in  this case) and never bother about patch files.
> >>
> >
> > svn diff > my.patch
> >
> 
> 


-- 
----------------------------------------------------------------------
standardize your content-repository !
                               http://www.jcp.org/en/jsr/detail?id=170
---------------------------------------< david.nuescheler@day.com >---

This message is a private communication. If you are not the intended
recipient, please do not read, copy, or use it, and do not disclose it
to others. Please notify the sender of the delivery error by replying
to this message, and then delete it from your system. Thank you.

The sender does not assume any liability for timely, trouble free,
complete, virus free, secure, error free or uninterrupted arrival of
this e-mail. For verification please request a hard copy version.


mailto:david.nuescheler@day.com
http://www.day.com

David Nuescheler
Chief Technology Officer
Day Software AG
Barfuesserplatz 6 / Postfach
4001 Basel
Switzerland

T  41 61 226 98 98
F  41 61 226 98 97

Re: examples of writing binary data to JCR

Posted by Brian Moseley <bc...@osafoundation.org>.
Dave Sag wrote:
> i guess that would presume that the source file i changed was the one  
> in SVN already.  I took the code from the example and did stuff to it  
> for my own app here, and the changed i added were to my app, not the  
> jackrabbit src

ok then... diff <original file> <file with changes> > my.patch

> i suppose i should go and read up on patch files :-)  but we have  never 
> used them here.
> 
> i am sure someone with commit rights to jackrabbit can copy and paste  
> that code into place.  I have a short unit test for those methods too  
> of course.

well, one of those guys asked you for a patch, so clearly at least he 
doesn't want to copy and paste :)

Re: examples of writing binary data to JCR

Posted by Dave Sag <ds...@visualitylife.com>.
i guess that would presume that the source file i changed was the one  
in SVN already.  I took the code from the example and did stuff to it  
for my own app here, and the changed i added were to my app, not the  
jackrabbit src

i suppose i should go and read up on patch files :-)  but we have  
never used them here.

i am sure someone with commit rights to jackrabbit can copy and paste  
that code into place.  I have a short unit test for those methods too  
of course.

cheers

dave




On 03/05/2005, at 4:21 PM, Brian Moseley wrote:

> Dave Sag wrote:
>
>
>> sorry mate but I have no idea how to generate a patch file, or  
>> even  how to apply one?  i usually just update my src using CCS  
>> (SVN in  this case) and never bother about patch files.
>>
>
> svn diff > my.patch
>


Re: examples of writing binary data to JCR

Posted by Brian Moseley <bc...@osafoundation.org>.
Dave Sag wrote:

> sorry mate but I have no idea how to generate a patch file, or even  how 
> to apply one?  i usually just update my src using CCS (SVN in  this 
> case) and never bother about patch files.

svn diff > my.patch