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 <[email protected]> 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) [[email protected]]
> 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:[email protected]]
> 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.
> [email protected]
> 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
> [email protected]
> 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
> [email protected]
> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

Reply via email to