Here you go, Vincent:

http://sourceforge.net/mailarchive/message.php?msg_id=29350617

As Matteo noted, this is to find just objects, not datastreams.  He 
tweaked it to return the path to the datastream:

echo -n 
"info:fedora/yournamespace:somePID/SOMEDATASTREAM/SOMEDATASTREAM.0" | md5sum

I agree this is a hack, but if you have access to the filesystem where 
the datastreams are stored, it is a very fast solution.

-- Scott

On 06/05/2012 07:53 AM, Nguyen, Vincent (CDC/OD/OADS) (CTR) wrote:
> Benjamin,
>
> The script does have access to the Fedora managed content.  I thought about 
> doing it this way as well, it would work but it does seem like a bit of a 
> "hack".
>
> Do you happen to have a link to the script that Scott Praeter posted to get 
> this info?
>
> Thanks everyone for your reply!
>
> Vincent Vu Nguyen
>
>
> -----Original Message-----
> From: Benjamin Armintor [mailto:armin...@gmail.com]
> Sent: Monday, June 04, 2012 5:02 PM
> To: Support and info exchange list for Fedora users.
> Subject: Re: [fcrepo-user] File size of content/datastream
>
> Where is the script that needs this information running? Does it have access 
> to the device that Fedora is storing managed content on?  I think Scott 
> Praeter posted a script to this list a couple of days ago that formulated a 
> file path to the managed data using the same algorithm Fedora does 
> internally, and something like that might be your best option until you can 
> upgrade to 3.4+.
>
> - Ben
>
> On Mon, Jun 4, 2012 at 4:57 PM, James, Eric<eric.ja...@yale.edu>  wrote:
>> Vincent,
>>
>> You could get the size programmatically with a java method such as below.  I 
>> commented out the urlConn.getContentLength() as, as you found out that 
>> returns 0., But the byte counter loop works:
>>
>> public int getEADSize(String hostname,String pid) throws Exception {
>>         String urlString = hostname + "/fedora/get/"+pid+"/EAD";
>>         URL url = new URL(urlString);
>>         URLConnection urlConn = url.openConnection();
>>         //int len = urlConn.getContentLength();
>>         InputStream is = urlConn.getInputStream();
>>         int len = 0;
>>         while (is.read()!=-1) {
>>             len++;
>>         }
>>         return len;
>> }
>>
>> -Eric
>> ________________________________________
>> From: Nguyen, Vincent (CDC/OD/OADS) (CTR) [v...@cdc.gov]
>> Sent: Monday, June 04, 2012 4:03 PM
>> To: Support and info exchange list for Fedora users.
>> Subject: Re: [fcrepo-user] File size of content/datastream
>>
>> Thanks for the Replies.
>>
>> Rebecca, the getSize() returns '0' for Managed Datastreams like the ticket 
>> says.  We plan on upgrading but for now, we're locked in with version 3.2 
>> for at least 6 months.
>>
>> Kyle, unfortunately the HTTP HEAD request does the same thing.  It doesn't 
>> return "Content-Length".  When I print getHeaderFieldKey and getHeaderField, 
>> this is what I get (DS1 is the managed datastream I want to grab the info 
>> for).
>>
>> DC - 417MODS - 3489THUMBNAIL_LARGE - 0THUMBNAIL_SMALL - 0RELS-EXT - 385DS1 - 
>> 0Server HTTP version, Response code:
>> HTTP/1.1 200 OK
>>
>> Server=Apache-Coyote/1.1
>> Set-Cookie=JSESSIONID=A7F1672733ECCB504E5C8ACD4A556C91; Path=/muradora
>> Content-Disposition=attachment; filename=demo_12679DS1.pdf
>> Content-Type=application/pdf Transfer-Encoding=chunked Date=Mon, 04
>> Jun 2012 19:58:30 GMT
>>
>>
>> The only work around I can think of is to index the 'filesize' value during 
>> Ingest.  Which means we'll have to reindex every object.
>>
>>
>> Vincent Vu Nguyen
>>
>> -----Original Message-----
>> From: Rebecca Sutton Koeser [mailto:rebecca.s.koe...@emory.edu]
>> Sent: Monday, June 04, 2012 2:47 PM
>> To: Support and info exchange list for Fedora users.
>> Subject: Re: [fcrepo-user] File size of content/datastream
>>
>> On Monday June 04, 2012 at 06:35 PM, Nguyen, Vincent (CDC/OD/OADS) (CTR) 
>> wrote:
>>> Is there a way to get the Filesize of a Managed Datastream without
>>> having to actually download the file?
>>>
>>> We're on Fedora 3.2.
>>
>> The datastream information provided by API-M getDatastream should include 
>> the size of the datastream.
>>
>> However, there have been issues with datastream size in certain versions of 
>> Fedora, and I think managed datastreams in 3.2 might be problematic.  You 
>> can probably confirm by checking on some of your content.  The JIRA ticket 
>> I'm thinking of indicates this was fixed in Fedora 3.4:
>>
>> https://jira.duraspace.org/browse/FCREPO-64
>>
>>
>> --
>> Rebecca Sutton Koeser, Ph.D.
>> rebecca.s.koe...@emory.edu
>> Digital Programs&  Systems - Woodruff Library, Emory University
>>
>> ----------------------------------------------------------------------
>> --------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond.
>> Discussions will include endpoint security, mobile security and the
>> latest in malware threats.
>> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Fedora-commons-users mailing list
>> Fedora-commons-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/fedora-commons-users
>> ----------------------------------------------------------------------
>> --------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond.
>> Discussions will include endpoint security, mobile security and the
>> latest in malware threats.
>> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Fedora-commons-users mailing list
>> Fedora-commons-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/fedora-commons-users
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and threat 
> landscape has changed and how IT managers can respond. Discussions will 
> include endpoint security, mobile security and the latest in malware threats. 
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Fedora-commons-users mailing list
> Fedora-commons-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fedora-commons-users
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Fedora-commons-users mailing list
> Fedora-commons-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fedora-commons-users


-- 
Scott Prater
Shared Development Group
General Library System
University of Wisconsin - Madison
pra...@wisc.edu
5-5415

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

Reply via email to