Re: flow - database.js - Componentmanager

2003-06-23 Thread Stefano Mazzocchi
on 6/22/03 1:36 PM Christopher Oliver wrote:

> Agree. I've moved Database.js and related out of the core and into the 
> scratchpad for now, until petstore gets refactored.

Thanks dude.

-- 
Stefano.




RE: flow - database.js - Componentmanager

2003-06-23 Thread Reinhard Pötz
> From: Stefano Mazzocchi
> 
> 
> on 6/20/03 11:52 AM Reinhard Pötz wrote:
> 
> > Yes, you are right. The current draft of the FOM does not contain a
> > database layer.
> > 
> > I see two options:
> >  
> >  1.) remove it complety
> >  2.) add it to the petstore examples (which are based on those JS
> > functions)
> > 
> > I'm in favour of removing them complety and encapsulate the
> database
> > calls in the petstore examples using Java objects. So we
> can show our
> > users what we envision as the best way of writing flow apps with
> > database access.
> 
> In theory, if the new FOM is complete, you can have access to
> the database connection avalon component directly from 
> getComponent() and the petstore can be changed accordingly. 
> This would:
> 
>  1) remove the need for database.js
>  2) keep concerns separate
>  3) avoid the need for a javascript extension concept that we
> planned but never came to even design.
> 
> What do you think?

a late +1 (Christian has already moved it into the scratchpad examples)

Reinhard



Re: flow - database.js - Componentmanager

2003-06-22 Thread Christopher Oliver
Agree. I've moved Database.js and related out of the core and into the 
scratchpad for now, until petstore gets refactored.

Chris

Stefano Mazzocchi wrote:

on 6/20/03 11:52 AM Reinhard Pötz wrote:

 

Yes, you are right. The current draft of the FOM does not contain a
database layer.
I see two options:

1.) remove it complety
2.) add it to the petstore examples (which are based on those JS
functions)
I'm in favour of removing them complety and encapsulate the database
calls in the petstore examples using Java objects. So we can show our
users what we envision as the best way of writing flow apps with
database access.
   

In theory, if the new FOM is complete, you can have access to the
database connection avalon component directly from getComponent() and
the petstore can be changed accordingly. This would:
1) remove the need for database.js
2) keep concerns separate
3) avoid the need for a javascript extension concept that we planned
but never came to even design.
What do you think?

 





Re: flow - database.js - Componentmanager

2003-06-21 Thread Stefano Mazzocchi
on 6/20/03 11:52 AM Reinhard Pötz wrote:

> Yes, you are right. The current draft of the FOM does not contain a
> database layer.
> 
> I see two options:
>  
>  1.) remove it complety
>  2.) add it to the petstore examples (which are based on those JS
> functions)
> 
> I'm in favour of removing them complety and encapsulate the database
> calls in the petstore examples using Java objects. So we can show our
> users what we envision as the best way of writing flow apps with
> database access.

In theory, if the new FOM is complete, you can have access to the
database connection avalon component directly from getComponent() and
the petstore can be changed accordingly. This would:

 1) remove the need for database.js
 2) keep concerns separate
 3) avoid the need for a javascript extension concept that we planned
but never came to even design.

What do you think?

-- 
Stefano.




Re: flow - database.js - Componentmanager

2003-06-20 Thread Nuno Santos
For what i can tell you, i didn't found  any reference to the
deprecation of the Database.js script, although i think it would be 
wiser to take the Database.getConnection to the ScriptableConnection.

On Fri, 2003-06-20 at 17:43, Geoff Howard wrote:
> um, isn't this database access directly from flow one of the deprecated
> parts of the API??
> 
> Geoff
> 
> At 11:55 AM 6/20/2003, you wrote:
> >I think i solve it. Check this new Database.js
> >I've changed the original one:
> >[ Starts here ]---
> >//
> >// CVS $Id: Database.js,v 1.2 2003/03/20 02:46:32 vgritsenko Exp $
> >//
> >// Prototype Database API
> >//
> >// TBD: Move this Database stuff to its own library outside of flow
> >//
> >
> >defineClass("org.apache.cocoon.components.flow.javascript.ScriptableConnection");
> >defineClass("org.apache.cocoon.components.flow.javascript.ScriptableResult");
> >
> >Database.componentManager=this.cocoon.componentManager;
> >
> >Database.getConnection = function(selectorValue) {
> >   var selector =
> >this.componentManager.lookup(Packages.org.apache.avalon.excalibur.datasource.DataSourceComponent.ROLE
> > 
> >+ "Selector");
> >   try {
> > var ds = selector.select(selectorValue);
> > return new Database(ds.getConnection());
> >   } finally {
> > this.componentManager.release(selector);
> >   }
> >}
> >
> >[ Ends here ]---
> >
> >On Fri, 2003-06-20 at 16:25, Nuno Santos wrote:
> > > What i've found is that the flowscript works just fine when i start the
> > > cocoon engine, but whenever i make any change to the script, it
> > > just loose the cocoon.componentManager!
> > >
> > >
> > > On Fri, 2003-06-20 at 16:19, Frank Taffelt wrote:
> > > > > I also found this bug in the flow Database.js!
> > > > > It seems that the componentManager is null whenever the
> > > > > script is reloaded!
> > > >
> > > > Hmm, what do you mean with "script is reloaded"? I didn't find any 
> > rational
> > > > reason for this ...
> >--
> >Nuno Santos <[EMAIL PROTECTED]>
-- 
Nuno Santos <[EMAIL PROTECTED]>



RE: flow - database.js - Componentmanager

2003-06-20 Thread Reinhard Pötz
Yes, you are right. The current draft of the FOM does not contain a
database layer.

I see two options:
 
 1.) remove it complety
 2.) add it to the petstore examples (which are based on those JS
functions)

I'm in favour of removing them complety and encapsulate the database
calls in the petstore examples using Java objects. So we can show our
users what we envision as the best way of writing flow apps with
database access.

Reinhard

> -Original Message-
> From: Geoff Howard [mailto:[EMAIL PROTECTED] 
> Sent: Friday, June 20, 2003 6:44 PM
> To: [EMAIL PROTECTED]
> Subject: Re: flow - database.js - Componentmanager
> 
> 
> um, isn't this database access directly from flow one of the 
> deprecated parts of the API??
> 
> Geoff
> 
> At 11:55 AM 6/20/2003, you wrote:
> >I think i solve it. Check this new Database.js
> >I've changed the original one:
> >[ Starts here 
> ]--- 
> >// // CVS $Id: Database.js,v 1.2 2003/03/20 02:46:32 vgritsenko Exp $
> >//
> >// Prototype Database API
> >//
> >// TBD: Move this Database stuff to its own library outside of flow
> >//
> >
> >defineClass("org.apache.cocoon.components.flow.javascript.Scr
> iptableCon
> >nection");
> >defineClass("org.apache.cocoon.components.flow.javascript.Scr
> iptableResult");
> >
> >Database.componentManager=this.cocoon.componentManager;
> >
> >Database.getConnection = function(selectorValue) {
> >   var selector = 
> >this.componentManager.lookup(Packages.org.apache.avalon.excal
> ibur.datas
> >ource.DataSourceComponent.ROLE
> >+ "Selector");
> >   try {
> > var ds = selector.select(selectorValue);
> > return new Database(ds.getConnection());
> >   } finally {
> > this.componentManager.release(selector);
> >   }
> >}
> >
> >[ Ends here ]---
> >
> >On Fri, 2003-06-20 at 16:25, Nuno Santos wrote:
> > > What i've found is that the flowscript works just fine 
> when i start 
> > > the cocoon engine, but whenever i make any change to the 
> script, it 
> > > just loose the cocoon.componentManager!
> > >
> > >
> > > On Fri, 2003-06-20 at 16:19, Frank Taffelt wrote:
> > > > > I also found this bug in the flow Database.js!
> > > > > It seems that the componentManager is null whenever 
> the script 
> > > > > is reloaded!
> > > >
> > > > Hmm, what do you mean with "script is reloaded"? I 
> didn't find any
> > rational
> > > > reason for this ...
> >--
> >Nuno Santos <[EMAIL PROTECTED]>
> 



Re: flow - database.js - Componentmanager

2003-06-20 Thread Geoff Howard
um, isn't this database access directly from flow one of the deprecated
parts of the API??
Geoff

At 11:55 AM 6/20/2003, you wrote:
I think i solve it. Check this new Database.js
I've changed the original one:
[ Starts here ]---
//
// CVS $Id: Database.js,v 1.2 2003/03/20 02:46:32 vgritsenko Exp $
//
// Prototype Database API
//
// TBD: Move this Database stuff to its own library outside of flow
//
defineClass("org.apache.cocoon.components.flow.javascript.ScriptableConnection");
defineClass("org.apache.cocoon.components.flow.javascript.ScriptableResult");
Database.componentManager=this.cocoon.componentManager;

Database.getConnection = function(selectorValue) {
  var selector =
this.componentManager.lookup(Packages.org.apache.avalon.excalibur.datasource.DataSourceComponent.ROLE 
+ "Selector");
  try {
var ds = selector.select(selectorValue);
return new Database(ds.getConnection());
  } finally {
this.componentManager.release(selector);
  }
}

[ Ends here ]---

On Fri, 2003-06-20 at 16:25, Nuno Santos wrote:
> What i've found is that the flowscript works just fine when i start the
> cocoon engine, but whenever i make any change to the script, it
> just loose the cocoon.componentManager!
>
>
> On Fri, 2003-06-20 at 16:19, Frank Taffelt wrote:
> > > I also found this bug in the flow Database.js!
> > > It seems that the componentManager is null whenever the
> > > script is reloaded!
> >
> > Hmm, what do you mean with "script is reloaded"? I didn't find any 
rational
> > reason for this ...
--
Nuno Santos <[EMAIL PROTECTED]>



Re: flow - database.js - Componentmanager

2003-06-20 Thread Nuno Santos
I think i solve it. Check this new Database.js
I've changed the original one:
[ Starts here ]---
//
// CVS $Id: Database.js,v 1.2 2003/03/20 02:46:32 vgritsenko Exp $
//
// Prototype Database API
//
// TBD: Move this Database stuff to its own library outside of flow
//

defineClass("org.apache.cocoon.components.flow.javascript.ScriptableConnection");
defineClass("org.apache.cocoon.components.flow.javascript.ScriptableResult");

Database.componentManager=this.cocoon.componentManager;

Database.getConnection = function(selectorValue) {
  var selector =
this.componentManager.lookup(Packages.org.apache.avalon.excalibur.datasource.DataSourceComponent.ROLE
 + "Selector");
  try {
var ds = selector.select(selectorValue);
return new Database(ds.getConnection());
  } finally {
this.componentManager.release(selector);
  }
}

[ Ends here ]---

On Fri, 2003-06-20 at 16:25, Nuno Santos wrote:
> What i've found is that the flowscript works just fine when i start the 
> cocoon engine, but whenever i make any change to the script, it 
> just loose the cocoon.componentManager!
> 
> 
> On Fri, 2003-06-20 at 16:19, Frank Taffelt wrote:
> > > I also found this bug in the flow Database.js!
> > > It seems that the componentManager is null whenever the
> > > script is reloaded!
> > 
> > Hmm, what do you mean with "script is reloaded"? I didn't find any rational
> > reason for this ...
-- 
Nuno Santos <[EMAIL PROTECTED]>



Re: flow - database.js - Componentmanager

2003-06-20 Thread Nuno Santos
What i've found is that the flowscript works just fine when i start the 
cocoon engine, but whenever i make any change to the script, it 
just loose the cocoon.componentManager!


On Fri, 2003-06-20 at 16:19, Frank Taffelt wrote:
> > I also found this bug in the flow Database.js!
> > It seems that the componentManager is null whenever the
> > script is reloaded!
> 
> Hmm, what do you mean with "script is reloaded"? I didn't find any rational
> reason for this ...
-- 
Nuno Santos <[EMAIL PROTECTED]>



Re: flow - database.js - Componentmanager

2003-06-20 Thread Frank Taffelt
> I also found this bug in the flow Database.js!
> It seems that the componentManager is null whenever the
> script is reloaded!

Hmm, what do you mean with "script is reloaded"? I didn't find any rational
reason for this ...



Re: flow - database.js - Componentmanager

2003-06-20 Thread Nuno Santos
I also found this bug in the flow Database.js!
It seems that the componentManager is null whenever the
script is reloaded!

On Thu, 2003-06-12 at 18:59, Christopher Oliver wrote:
> You're right, this is a serious problem. I'll try to look into it. Can 
> you provide more information about what is causing it?
> 
> Frank Taffelt wrote:
> 
> >Hi All,
> >
> >it seems that the glue between javascript and java is not alway's working
> >properly. I make some database queries from my flow and sometimes i'm
> >getting the following error from database.js:
> >
> >"resource://org/apache/cocoon/components/flow/javascript/Database.js", line
> >13: uncaught JavaScript exception: TypeError: Cannot convert null to an
> >object.(resource://org/apache/cocoon/components/flow/javascript/Database.js;
> >line 13)
> >
> >I'put some debug statements into databsae.js and found that the
> >componentManager object
> >
> >  var selector = cocoon.componentManager.lookup(..)
> >
> >is null.
> >
> >The problem occurs under cocoon-2.1m2 and current cvs (11.06.2003). In my
> >eyes this is a serious issue and we should try to find a solution till the
> >final release.
> >
> >regards Frank
> >
> >
> >
> >
> >
> >  
> >
> 
> 
-- 
Nuno Santos <[EMAIL PROTECTED]>



Re: flow - database.js - Componentmanager

2003-06-13 Thread Frank Taffelt
> You're right, this is a serious problem. I'll try to look into it. Can
> you provide more information about what is causing it?

my flowscript code looks like the following example:
---
cocoon.load("resource://org/apache/cocoon/components/flow/javascript/Databas
e.js");

function myLogic {
  var conn = Database.getConnection(poolname);
  // begin db stuff
conn.update(...)
  // end db stuff
  conn.close();
}



the strange thing is, that this occurs unpredictable ;-(



Re: flow - database.js - Componentmanager

2003-06-12 Thread Christopher Oliver
You're right, this is a serious problem. I'll try to look into it. Can 
you provide more information about what is causing it?

Frank Taffelt wrote:

Hi All,

it seems that the glue between javascript and java is not alway's working
properly. I make some database queries from my flow and sometimes i'm
getting the following error from database.js:
"resource://org/apache/cocoon/components/flow/javascript/Database.js", line
13: uncaught JavaScript exception: TypeError: Cannot convert null to an
object.(resource://org/apache/cocoon/components/flow/javascript/Database.js;
line 13)
I'put some debug statements into databsae.js and found that the
componentManager object
 var selector = cocoon.componentManager.lookup(..)

is null.

The problem occurs under cocoon-2.1m2 and current cvs (11.06.2003). In my
eyes this is a serious issue and we should try to find a solution till the
final release.
regards Frank