home list archives users mailing list

Subject: Save a file stored in DB with DeliverToGFTP

Date view Thread view Subject view Author view Attachment view

From: Wilson Jr. (wilsonjr@gmail.com)
Date: Dec 03, 2007 00:37

Hi Folks,

did you see my last email? I send to the list, but I don't know, last days
I didn't receive any mail from OGSA-DAI users list, I think there's any
problem.
I'm putting an attachment with my last email to the list.

An joining the opportunity , I'm in the last days to deliver my project
working, and have no much time, 'cause I need to present the project
and unfortunately I'm having problems with a critical part, that's bring
some files stored in Db's.

I have a table, called: Imagem. each row has a id and a important field I
need is imagem_minucia.
This is a file stored in DB, the type I put first was OID in Postgresql,
after I changed to bytea, they'e fields
that I can store a file, maybe you can say me what kind of type is better to
work with OGSA-DAI?

A file stored in this field, it's just a txt file with some informations,
this is a example:
94 337 236 16
141 356 67 36
148 124 225 15
154 175 236 21
160 409 247 76
160 331 247 37
162 210 56 42
167 171 45 20

I have to bring this to my server and save it in a file like minutia.xyt
I suppose I need to use DeliveryToGFTP, but I'm having problems, I got this
activity to work
with others selects, but with this kind of type no.

I want to do a select like this: SELECT imagem_minucia FROM imagem WHERE
(imagem_id='something')
then save this in a file.
I'm doing this, but I'm having errors:

SQLQuery query = new SQLQuery();
query.setResourceID("MYResource");
query.addExpression("SELECT ...");

DeliverToGFTP delivery = new DeliverToGFTP();
delivery.connectDataInput(query.getDataOutput());
delivery.addFilename("/tmp/01.xyt");
delivery.addHost("192.168.254.2:2811");

PipelineWorkflow workflow = new PipelineWorkflow();
workflow.add(query);
workflow.add(delivery);

RequestResource rr = conf.getDRER().execute(workflow,
RequestExecutionType.SYNCHRONOUS);
RequestStatus rs = rr.getRequestStatus();
System.out.println(rs.getExecutionStatus());
System.out.println("File: /tmp/"+sus_num+".xyt generated");

I'm getting this message error:
uk.org.ogsadai.client.toolkit.exception.ActivityIllegalStateException:
Activity uk.org.ogsadai.DeliverToGFTP is in an illegal state.
    at uk.org.ogsadai.client.toolkit.activity.BaseActivity.validateState(Unknown
Source)
    at uk.org.ogsadai.client.toolkit.activity.BaseActivity.buildRequest(Unknown
Source)
    at uk.org.ogsadai.client.toolkit.PipelineWorkflow.buildRequest(Unknown
Source)
    at
uk.org.ogsadai.client.toolkit.presentation.gt.GTDataRequestExecutionResource.executeRequest(Unknown
Source)
    at
uk.org.ogsadai.client.toolkit.resource.BaseDataRequestExecutionResource.execute(Unknown
Source)
    at
uk.org.ogsadai.client.toolkit.resource.BaseDataRequestExecutionResource.execute(Unknown
Source)
    at
br.topgrid.dcc.ufba.grid.services.afisdcc.client.OgsaDaiClient.getSuspectsMinituae
(OgsaDaiClient.java:153)
    at br.topgrid.dcc.ufba.grid.services.afisdcc.client.OgsaDaiClient.main(
OgsaDaiClient.java:229)
Caused by:
uk.org.ogsadai.client.toolkit.exception.ActivityInputUnspecifiedException:
Required input data must be either connected or have literal data values.
    at
uk.org.ogsadai.client.toolkit.activity.SimpleSingleActivityInput.validateState(Unknown
Source)
    at
uk.org.ogsadai.client.toolkit.activity.SimpleActivityInput.validateState(Unknown
Source)
    ... 8 more

I don't know exactly, but when I put a Transform activity between Query and
Delivery the error go away,
but the files generated aren't what I want. I'm putting the files generated
when I use the TupleToCSV and TupleToWebRowSetCharArrays in attachment.

What I can do? I'm needing to do this urgently, and brings these files is
the principal key to my application,
if you can help me, I'll thank you a lot.

Ah, other doubt, in fact I need to bring lots of files like this, like I
said in the las mail
i suppose deliverToGFTP just brings one file, and then I'm doing a for to
brings the files, or be a workflow for each select to bring a file.

Is this right? I say 'cause I know in a sqlQuery activity I can add sql's
with addExpression, but I can link one deliverToGFTP for
each expression? Or I'm right, and have to do lots of workflows for each
one?

Cheers,

-- 
"É este um mundo no qual devemos esconder nossas virtudes?"
                     Willian Shakespeare
****************
Wilson Júnior
****************




Date view Thread view Subject view Author view Attachment view