You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2009/07/28 21:41:04 UTC

[JEXL] 2.0 and BSF / JSR-223

Although Jexl 2.0 works OK currently with Apache BSF 3.0, it relies on
the factory & engine provided by BSF 3.0.

Now Java 1.6 has scripting built-in, so I think it would make sense to
include the necessary classes and property file in Jexl. This would
allow it to be used without the BSF jar.

It should still work with the BSF jar as well - BeanShell takes a
similar approach and works OK for me with BSF 3.0 or Java 1.6.

I'll have a look at providing these classes shortly.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [JEXL] 2.0 and BSF / JSR-223

Posted by Henrib <hb...@gmail.com>.


sebb-2-2 wrote:
> 
> The code I'm working on currently uses JexlEngine (whatever that
> represents).
> 
> It would be possible to add another factory implementation, provided
> that it had a different language name and default extension.
> 
> Or the JexlScriptEngine could be sensitive to particular variables in
> the context.
> 
Right, both options have respective merits.
UnifiedJEXL having a different syntax (the ${} #{}), a different factory
might reduce the potential element of surprise. But since UnifiedJEXL is
just an augmentation of Jexl, it might be overkill since as a dev using it,
you probably know which set of features you want to use. 
I dont know if there is a use-case for using both at the same time.

sebb-2-2 wrote:
> 
> Perhaps; not sure how this would work for non-JSR-223 usage though.
> 
For non JSR-233, we would regular commons.LogFactory created logger; when
JSR-233 is in use, we would pass down that specific error writer "wrapping"
instance (although I dont know if we've got enough flexibility for each
ScriptContext to pass its own). As I said, it might be a stupid / irrelevant
idea.
-- 
View this message in context: http://www.nabble.com/-JEXL--2.0-and-BSF---JSR-223-tp24706519p24735171.html
Sent from the Commons - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [JEXL] 2.0 and BSF / JSR-223

Posted by sebb <se...@gmail.com>.
On 30/07/2009, Henrib <hb...@gmail.com> wrote:
>
>  Thanks again for the explanation.
>
>  Just one question: are we "exposing" Jexl or UnifiedJEXL ? (or both)

The code I'm working on currently uses JexlEngine (whatever that represents).

It would be possible to add another factory implementation, provided
that it had a different language name and default extension.

Or the JexlScriptEngine could be sensitive to particular variables in
the context.

>  BTW, just a stupid thought about logging (versus usage of a Writer -
>  ScriptContext.setErrorWriter), I guess we could use a simple Log
>  implementation that wraps the error Writer and pass it down to Jexl if we
>  want to be more faithfull to the jsr-223 API intent in this respect (if this
>  is what you had in mind a couple of message ago).

Perhaps; not sure how this would work for non-JSR-223 usage though.

> --
>  View this message in context: http://www.nabble.com/-JEXL--2.0-and-BSF---JSR-223-tp24706519p24734383.html
>
> Sent from the Commons - Dev mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [JEXL] 2.0 and BSF / JSR-223

Posted by Henrib <hb...@gmail.com>.
Thanks again for the explanation.

Just one question: are we "exposing" Jexl or UnifiedJEXL ? (or both)

BTW, just a stupid thought about logging (versus usage of a Writer -
ScriptContext.setErrorWriter), I guess we could use a simple Log
implementation that wraps the error Writer and pass it down to Jexl if we
want to be more faithfull to the jsr-223 API intent in this respect (if this
is what you had in mind a couple of message ago).
-- 
View this message in context: http://www.nabble.com/-JEXL--2.0-and-BSF---JSR-223-tp24706519p24734383.html
Sent from the Commons - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [JEXL] 2.0 and BSF / JSR-223

Posted by sebb <se...@gmail.com>.
On 29/07/2009, Henrib <hb...@gmail.com> wrote:
>
>
>
>  sebb-2-2 wrote:
>  >
>  > Of course if you try to use the new classes on Java 1.5  without also
>  > providing BSF 3.0 the JVM will complain, but otherwise the Jexl jar
>  > will run fine on Java 1.5.
>  >
>
>
> I'm sorry I don't understand this correctly. Are you saying that that BSF3.0
>  will become an added dependency to Jexl for those wishing to run on Java5
>  (please dont say yes...)?

No.

But if you wish to use JSR-223 methods to invoke Jexl when using Java
1.5, you will need to include bsf-api as a dependency.

I've already tested this, and it works fine.

>  Looking at the BSF 3.0b2 branch, it seems it is an implementation of jsr-233
>  for pre-java6 (packages being javax.script);

Yes.

>  if so, it also seems there is
>  no impossibility to derive several of the Jexl classes to make a different
>  jar (jexl-233.jar) that depend upon it.

No need; bsf-api is already available.

>  If the premises stand, it would allow those who can use jsr-233 (if you use
>  JDK6) or deploy the BSF beta 2 (if you are allowed to deploy beta) to use
>  Jexl by just adding the jexl-233.jar on top of jexl.jar. It does not force
>  everyone who uses Jexl to change their current set of dependencies.

Exactly.

>   A lot has been done to "customize" Jexl and if there are some missing parts
>  for such a task, I'd happily help if allowed.

I've just about finished the code; just need to create some more tests.

I'll need to commit some changes to pom.xml.

>
>  --
>  View this message in context: http://www.nabble.com/-JEXL--2.0-and-BSF---JSR-223-tp24706519p24727425.html
>
> Sent from the Commons - Dev mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [JEXL] 2.0 and BSF / JSR-223

Posted by Henrib <hb...@gmail.com>.
Ok, thank you both for the explanation. 

-- 
View this message in context: http://www.nabble.com/-JEXL--2.0-and-BSF---JSR-223-tp24706519p24733769.html
Sent from the Commons - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [JEXL] 2.0 and BSF / JSR-223

Posted by Rahul Akolkar <ra...@gmail.com>.
On Wed, Jul 29, 2009 at 4:58 PM, Henrib<hb...@gmail.com> wrote:
>
> sebb-2-2 wrote:
>>
>> Of course if you try to use the new classes on Java 1.5  without also
>> providing BSF 3.0 the JVM will complain, but otherwise the Jexl jar
>> will run fine on Java 1.5.
>>
>
> I'm sorry I don't understand this correctly. Are you saying that that BSF3.0
> will become an added dependency to Jexl for those wishing to run on Java5
> (please dont say yes...)?
>
<snip/>

No. Dependency will be optional at runtime.


> Looking at the BSF 3.0b2 branch, it seems it is an implementation of jsr-233
> for pre-java6 (packages being javax.script); if so, it also seems there is
> no impossibility to derive several of the Jexl classes to make a different
> jar (jexl-233.jar) that depend upon it.
>
> If the premises stand, it would allow those who can use jsr-233 (if you use
> JDK6) or deploy the BSF beta 2 (if you are allowed to deploy beta) to use
> Jexl by just adding the jexl-233.jar on top of jexl.jar. It does not force
> everyone who uses Jexl to change their current set of dependencies.
>  A lot has been done to "customize" Jexl and if there are some missing parts
> for such a task, I'd happily help if allowed.
>
<snap/>

You mean 223. Nothing special needs doing to JEXL as an expression
language really, beyond allowing the framework part of javax.script to
pick up JEXL. See r799042 [1] for starters (I have some comments on
that, but thats a separate thread).

-Rahul

[1] http://svn.apache.org/viewvc?view=rev&revision=799042

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [JEXL] 2.0 and BSF / JSR-223

Posted by Henrib <hb...@gmail.com>.


sebb-2-2 wrote:
> 
> Of course if you try to use the new classes on Java 1.5  without also
> providing BSF 3.0 the JVM will complain, but otherwise the Jexl jar
> will run fine on Java 1.5.
> 

I'm sorry I don't understand this correctly. Are you saying that that BSF3.0
will become an added dependency to Jexl for those wishing to run on Java5
(please dont say yes...)?

Looking at the BSF 3.0b2 branch, it seems it is an implementation of jsr-233
for pre-java6 (packages being javax.script); if so, it also seems there is
no impossibility to derive several of the Jexl classes to make a different
jar (jexl-233.jar) that depend upon it.

If the premises stand, it would allow those who can use jsr-233 (if you use
JDK6) or deploy the BSF beta 2 (if you are allowed to deploy beta) to use
Jexl by just adding the jexl-233.jar on top of jexl.jar. It does not force
everyone who uses Jexl to change their current set of dependencies.
 A lot has been done to "customize" Jexl and if there are some missing parts
for such a task, I'd happily help if allowed.

-- 
View this message in context: http://www.nabble.com/-JEXL--2.0-and-BSF---JSR-223-tp24706519p24727425.html
Sent from the Commons - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [JEXL] 2.0 and BSF / JSR-223

Posted by sebb <se...@gmail.com>.
On 29/07/2009, Henrib <hb...@gmail.com> wrote:
>
>  Could we envision this JSR-233 as a second & optional jar.

No; the whole point is that the classes need to be in the same jar.

>  Many of us are still stuck with Java5 and having to add the javax.api as a
>  dependency to Jexl could be inconvenient.
>  May be we can expose what is necessary from Jexl for the jsr-233 to be
>  efficiently implemented but still leave it as an option ?
>  Cheers

I'm proposing to use BSF 3.0 API which defines the JSR-223 APIs but
runs on Java 1.4+ as a compile-time only dependency.

I've already got the code compiling.

Of course if you try to use the new classes on Java 1.5  without also
providing BSF 3.0 the JVM will complain, but otherwise the Jexl jar
will run fine on Java 1.5.

> --
>  View this message in context: http://www.nabble.com/-JEXL--2.0-and-BSF---JSR-223-tp24706519p24724270.html
>  Sent from the Commons - Dev mailing list archive at Nabble.com.
>
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [JEXL] 2.0 and BSF / JSR-223

Posted by Henrib <hb...@gmail.com>.
Could we envision this JSR-233 as a second & optional jar.
Many of us are still stuck with Java5 and having to add the javax.api as a
dependency to Jexl could be inconvenient.
May be we can expose what is necessary from Jexl for the jsr-233 to be
efficiently implemented but still leave it as an option ?
Cheers
-- 
View this message in context: http://www.nabble.com/-JEXL--2.0-and-BSF---JSR-223-tp24706519p24724270.html
Sent from the Commons - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [JEXL] 2.0 and BSF / JSR-223

Posted by Rahul Akolkar <ra...@gmail.com>.
On Tue, Jul 28, 2009 at 9:21 PM, sebb<se...@gmail.com> wrote:
> On 29/07/2009, Rahul Akolkar <ra...@gmail.com> wrote:
>> On Tue, Jul 28, 2009 at 3:41 PM, sebb<se...@gmail.com> wrote:
>>  > Although Jexl 2.0 works OK currently with Apache BSF 3.0, it relies on
>>  > the factory & engine provided by BSF 3.0.
>>  >
>>  > Now Java 1.6 has scripting built-in, so I think it would make sense to
>>  > include the necessary classes and property file in Jexl. This would
>>  > allow it to be used without the BSF jar.
>>  >
>>
>> <snip/>
>>
>>  Right, JEXL shouldn't have additional dependencies (even optional) but
>>  javax.script is almost part of the JDK (we are at JDK 1.5, but thats
>>  OK IMO).
>
> JEXL does currently require commons-logging (non-optional).
>
<snip/>

Yeah, to clarify -- by additional I meant more than the deps today.


> I'm not sure how useful the logging is - should it be kept?
> Could it be made optional at run-time?
>
<snap/>

I've found it useful. Its now possible to control whether to log or
throw on error conditions (and IIRC, we don't log much beyond error
conditions).

-Rahul



>>
>>  > It should still work with the BSF jar as well - BeanShell takes a
>>  > similar approach and works OK for me with BSF 3.0 or Java 1.6.
>>  >
>>  > I'll have a look at providing these classes shortly.
>>
>>
>>
>> Cool.
>>
>>  -Rahul
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [JEXL] 2.0 and BSF / JSR-223

Posted by sebb <se...@gmail.com>.
On 29/07/2009, Rahul Akolkar <ra...@gmail.com> wrote:
> On Tue, Jul 28, 2009 at 3:41 PM, sebb<se...@gmail.com> wrote:
>  > Although Jexl 2.0 works OK currently with Apache BSF 3.0, it relies on
>  > the factory & engine provided by BSF 3.0.
>  >
>  > Now Java 1.6 has scripting built-in, so I think it would make sense to
>  > include the necessary classes and property file in Jexl. This would
>  > allow it to be used without the BSF jar.
>  >
>
> <snip/>
>
>  Right, JEXL shouldn't have additional dependencies (even optional) but
>  javax.script is almost part of the JDK (we are at JDK 1.5, but thats
>  OK IMO).

JEXL does currently require commons-logging (non-optional).

I'm not sure how useful the logging is - should it be kept?
Could it be made optional at run-time?

>
>  > It should still work with the BSF jar as well - BeanShell takes a
>  > similar approach and works OK for me with BSF 3.0 or Java 1.6.
>  >
>  > I'll have a look at providing these classes shortly.
>
>
>
> Cool.
>
>  -Rahul
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [JEXL] 2.0 and BSF / JSR-223

Posted by Rahul Akolkar <ra...@gmail.com>.
On Tue, Jul 28, 2009 at 3:41 PM, sebb<se...@gmail.com> wrote:
> Although Jexl 2.0 works OK currently with Apache BSF 3.0, it relies on
> the factory & engine provided by BSF 3.0.
>
> Now Java 1.6 has scripting built-in, so I think it would make sense to
> include the necessary classes and property file in Jexl. This would
> allow it to be used without the BSF jar.
>
<snip/>

Right, JEXL shouldn't have additional dependencies (even optional) but
javax.script is almost part of the JDK (we are at JDK 1.5, but thats
OK IMO).


> It should still work with the BSF jar as well - BeanShell takes a
> similar approach and works OK for me with BSF 3.0 or Java 1.6.
>
> I'll have a look at providing these classes shortly.


Cool.

-Rahul

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org