EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #01517
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
[EP-tech] Re: Difficulty in getting object retrieval working in custom storage module
- To: eprints-tech@ecs.soton.ac.uk
- Subject: [EP-tech] Re: Difficulty in getting object retrieval working in custom storage module
- From: Simon McLeish <simon.mcleish@gmail.com>
- Date: Tue, 5 Feb 2013 14:34:14 +0000
Hi again,
I can answer my own question: the code is fine and works properly. I was trying to access one of my test uploads from before I got the uploader working properly, without realising it. A new uploaded file downloads fine. The lack of log information appears to be due to EPrints doing some local caching of the data - is there any way to turn that off?On Tue, Feb 5, 2013 at 12:54 PM, Simon McLeish <simon.mcleish@gmail.com> wrote:
SimonThanks,Any suggestions would be very welcome!I've based the list of arguments to the sub on those in Local.pm - is is much of the rest of the EPrints interacting part of the code. This list is different from both the list at http://wiki.eprints.org/w/API:EPrints/Storage ($self, $fileobj, $offset, $n, CALLBACK ) and http://trac.eprints.org/eprints/browser/trunk/system/perl_lib/EPrints/Plugin/Storage/AmazonS3.pm?rev=4327 (the Amazon S3 module) ($self, $fileobj, $uri, $f) - could you possibly indicate which list is correct, if this isn't?should feed back the content from the response to the callback function ("this function will be called for each chunk of the response content as it is received from the server" - http://search.cpan.org/~gaas/libwww-perl-6.04/lib/LWP/UserAgent.pm).The log doesn't seem to be receiving the debug info, either (which works fine in the open_write, write, and close_write subs). create_ua sets up the LWP object with the cookies needed for authentication, and saves it as $self->{_ua}->{$fileobj} - again, this works perfectly in the write routines. According to the LWP docs,The retrieve sub in the module looks like this:Hi,I'm trying to set up a custom storage module which communicates with a REST interface using LWP. I can store objects OK, and retrieve them directly (i.e. not through eprints). But when I try to retrieve an object through the EPrints interface I get the following in the log:
------------------------------------------------------------------
---------------- EPrints System Error ----------------------------
------------------------------------------------------------------
Error in file retrieval: failed to get file contents
------------------------------------------------------------------
at /usr/share/eprints3/perl_lib/EPrints/Apache/Storage.pm line 261
EPrints::Apache::Storage::handler('Apache2::RequestRec=SCALAR(0x7f9a1fb053c0)') called at -e line 0
eval {...} called at -e line 0
[Tue Feb 05 12:35:20 2013] [error] [client 138.38.192.151] EPrints::abort()\n, referer: https://float.bath.ac.uk/cgi/users/home?screen=EPrint::Edit&eprintid=1&stage=files
sub retrieve
{
my( $self, $fileobj, $sourceid, $offset, $n, $f ) = @_;
my $repository = $self->{session}->get_repository;
$repository->log( "Attempting to set up user agent" ) if ($self->{debug}); # for testing
if (create_ua( $self, $fileobj))
{
$repository->log( "Attempting to access HCP " . $self->{_url}->{$fileobj} ) if ($self->{debug}); # for testing
my $ua = $self->{_ua}->{$fileobj};
my $request = new HTTP::Request('GET',$self->{_url}->{$fileobj});
my $response = $ua->request( $request,$f ); # feed the response to the callback function
$repository->log( "Have response" ) if ($self->{debug}); # for testing
if( $response->is_error )
{
$repository->log( $response->as_string );
}
return $response->is_success;
}
else
{
$repository->log("Could not define LWP user agent: aborting file save\n");
return 0;
}
}
$ua->request( $request,$f )
*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
- Follow-Ups:
- [EP-tech] Re: Difficulty in getting object retrieval working in custom storage module
- From: Tim Brody <tdb2@ecs.soton.ac.uk>
- [EP-tech] Re: Difficulty in getting object retrieval working in custom storage module
- References:
- [EP-tech] Difficulty in getting object retrieval working in custom storage module
- From: Simon McLeish <simon.mcleish@gmail.com>
- [EP-tech] Difficulty in getting object retrieval working in custom storage module
- Prev by Date: [EP-tech] Difficulty in getting object retrieval working in custom storage module
- Next by Date: [EP-tech] Re: size of tables in mysql
- Previous by thread: [EP-tech] Difficulty in getting object retrieval working in custom storage module
- Next by thread: [EP-tech] Re: Difficulty in getting object retrieval working in custom storage module
- Index(es):