Thank
you very much, but it didn't work out.
I've
now taken the DatabaseReaser.java and changed it in a little way for my needs -
now it works.
I
think, te DatabaseReader that comes with Cocoon will never work in that case. I
haven't found the solution, to give the reader the informations which "id" or
something else I'm searching for.
It was
REALLY messy to get this working - I'm a Java Developer of course, also I'm a
Cocoon User - but not a Cocoon Developer. So I've tried to get this reader
working, without any good documentation. Hey Cocoon guys, it's really hard to
understand components with a Javadoc Information, that doesn't fit to the
sourcecode of this component !
A
little example for the DatabaseReader:
At
first I have to give the reader the Information, which Datasouce from my Sitemap
I want to use.
Nothing found in Javadoc, in the Source I've found, that there must be an
Parameter "use-connection" for giving the Name of the Database
Connection.
But -
as I said, I'm not a Cocoon-Dev or Avalon Expert, so: is this a Value of a XML
Parameter ? Is this a Attribute ? Where do I have to use the Attribute
?
After
2 hours trial & error I've found, that this is a Element (not map:parameter)
in the map:reader section. Also I've found, that this component doesn't like my
Entrys in the cocoon.xconf like:
<jdbc name="myconn">
(like
any other components), so that there MUST be also a given class
like:
<jdbc name="MyConnectionName" class="org.apache.avalon.util.datasource.JdbcDataSource"> But: how should I know that ? Why does all the other components work without this class ? (Thats an Avalon Issue, I don't know how the selektors work...) Afer
all that work and a lot of Time there was the last two issues for getting this
Reader working:
How
can I give the component the part of the SQL, where I'm looking for
?
(Like:
SELECT * FROM table WHERE id = ?, the "?" Part was never
filled.)
After
that and a new Parameter for that in the Sorce (there was a varaible, that was
never been initialized and used for that (also in the parent-class), don't know
hw this should work) I've got NullPointerExceptions that I can't
resolve.
(Hey,
I'm not a Cocoon Expert ! :-)
So
I've found, that I also need to give the reader the mime-type like any redirect
to an Image, so that there will be a correct output.
This
Issue was fast to resolve, because in the procedure getMimeType() was an entry
like super.getMimeType() and the super.getMimeType() will ever give
NULL.
So
I've taken the Mimetsype from the Database for supporting DOc/PDF/GIF/JPG ...
and so on.
My
Sitemap looks like this right now:
<map:match pattern="BLOB">
<map:act type="request"> <map:parameter name="parameters" value="true"/> <map:read type="db"> <parameter name="table" value="teasermessage_blob"/> <parameter name="image" value="data"/> <parameter name="key" value="id"/> <parameter name="find" value="{id}"/> <parameter name="filename" value="filename"/> <parameter name="mime" value="mimetype"/> </map:read> </map:act> </map:match> So, If
anybody is interested in my source, I can give it to you, but what I want to say
is, that this was REALLY messy to get a reader working, and a lot of the soruce
in Cocoon isn't right documented - so If you aren't a cocoon-source-expert you
have to look and invest a lot of time to get thinks working.
Especially all of the Actions / Readers / Generators that aren't in any
HowTo are not easy to understand and there is a documentation, that won't give
any correct answer to that question.
Also there was
been saved with examples and so on. Sometimes it isn't clear, if there will be a
Sitemap entry at the component or where do you use this
component.
Ok,
thats
enough for today,
greetings,
Sascha
|
Title: Nachricht
- RE: Return BLOB Value / redesigned DatabaseReader / a NO t... Sascha Kulawik
- RE: Return BLOB Value / redesigned DatabaseReader / a... Vadim Gritsenko
- RE: Return BLOB Value / redesigned DatabaseReader / a... Sascha Kulawik
- RE: Return BLOB Value / redesigned DatabaseReader... Vadim Gritsenko