You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Michael Wolf <wu...@scirem.de> on 2003/12/10 12:40:47 UTC
ojb in flow
Hello,
I'm trying to use ojb from the flow.
To start I only want to use the ojb PersistenceBroker like it is shown
in the GT2003 slides from Christian Haul.
I have installed the ojb block, but without jdo (i didn't include
jdo.jar and jori.jar)
So far I wasn't able to do it.
What classes do I have to import to make it run?
Is there a special place to put them.
Thanks,
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: ojb in flow
Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
Michael Wolf dijo:
> My question was more about the flow.
>
> To use the PersistenceBroker I tried:
>
> importClass(Packages.org.apache.ojb.broker.PersistenceBroker);
> importClass(Packages.org.apache.ojb.broker.PersistenceBrokerFactory);
> importClass(Packages.org.apache.ojb.broker.util.ui.AsciiSplash);
>
> function ojbTest(){
> broker = PersistenceBrokerFactory.defaultPersistenceBroker();
> }
>
> when calling the function I get the following error message:
> java.lang.NoClassDefFoundError
Ok. I understand. To be honest I don't use OJB inside javascript, because
it turns to me to be hardly debugable. Note I don't said you can not debug
javascript at all.
Also it looks very complicated to me. I prefer to build a serie of handler
and call them from inside the flow. As a Java IDE I use eclipse
(http://www.eclipse.org/)
In eclipse I create a project with the following libs:
db.jar -- created using druid - it is a container for JDO beans.
(autogenerated).
jdo.jar
jdori.jar
cocoon-ojb-block.jar
avalon-framework.jar
commons-lang-2.0.jar
commons-beanutils-1.6.1.jar (optional)
commons-jxpath-20030909.jar (optional)
db-ojb-1.0rc520031210.jar
most of the libs are from cocoon.
Then I build a dbHandler.jar with the Handler classes (one for each woody
form) using eclipse.org.
Copy the dbHandler.jar to your WEB-INF/lib and restart tomcat.
After that we can call the classes from dbHandler.jar from inside script.
Example, this script manage the creation of a user:
cocoon.load("resource://org/apache/cocoon/woody/flow/javascript/woody2.js");
cocoon.load("context://resources/flow/autentificar.js");
function createform(form) {
if (autorizar("auth")) {
form.showForm("create-form-display");
var bean = new Packages.net.agssa.sga.Auth_user();
var handler = new
Packages.net.agssa.sga.forms.auth_user.Auth_userHandler();
var factory;
form.save(bean);
try {
factory =
cocoon.getComponent(Packages.org.apache.cocoon.ojb.jdo.components.JdoPMF.ROLE);
handler.insert(bean, factory);
} finally {
cocoon.releaseComponent(factory);
}
success("Users", "Users inserted successfully", "Create a another
user?","create");
}
}
BTW, the Handler written in javascript will look very ugly to my eyes.
This is my view point.
I hope this would help. If not feel free to ask again :-D
Best Regards,
Antonio Gallardo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: ojb in flow
Posted by Michael Wolf <wu...@scirem.de>.
My question was more about the flow.
To use the PersistenceBroker I tried:
importClass(Packages.org.apache.ojb.broker.PersistenceBroker);
importClass(Packages.org.apache.ojb.broker.PersistenceBrokerFactory);
importClass(Packages.org.apache.ojb.broker.util.ui.AsciiSplash);
function ojbTest(){
broker = PersistenceBrokerFactory.defaultPersistenceBroker();
}
when calling the function I get the following error message:
java.lang.NoClassDefFoundError
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: ojb in flow
Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
Michael Wolf dijo:
> Hello,
>
> I'm trying to use ojb from the flow.
> To start I only want to use the ojb PersistenceBroker like it is shown
> in the GT2003 slides from Christian Haul.
>
> I have installed the ojb block, but without jdo (i didn't include
> jdo.jar and jori.jar)
PLease update from the CVS. I just committed a new OJB lib to allow the
use of JDO 1.01
Just copy jdo.jar and jdori.jar in WEB-INF/lib
> So far I wasn't able to do it.
> What classes do I have to import to make it run?
Check if you have uncommented the OJB block in your local.blocks.properties.
> Is there a special place to put them.
If you want to include them in the war, then copy the jdo.jar and
jdori.jar in /$COCOON/lib/local
then rebuild, the libs will be included in you war file.
Best Regards,
Antonio Gallardo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org