Re: Guice 1.0rc2

2007-02-26 Thread Konstantin Priblouda

--- Paul Benedict [EMAIL PROTECTED] wrote:

 Bob,
 
 I see some interesting similarities to other
 projects. Tapestry has an 
 @Inject annotation, and Spring has a @Required
 annotation. I guess my 
 question is why would someone prefer Guice support
 over Spring? I read 
 the Why Guice? section, but I didn't see this
 question.


I would  ask why to prefer guice over
pico/nanocontainer instead ;) 

IMHO, Annotations are cool and sexy, but they are not
usefull in this context as they are bound to compile
time. 

My typical usage pattern for dependency injection is:

I have some generic tools / frameworks  which I like
to integrate in a webapp (for example,
user management, security and menu system:
http://www.sourceforge.net/projects/jtec) 

And some of those tools need ( say ) hibernate
session.
But I have more than one hibernate session in my 
web application.

If my wiring is configured via annotations ( compile
time )  I'm lost - I have to recompile my rfamworks
just to be used in some project.

Thats where externalized configuration rules. 
( and pico contaienr supports not only xml , but also 
groovy and other scriupting configuration  )


regards,

[ Konstantin Pribluda http://www.pribluda.de ]
Still using XDoclet 1.x?  XDoclet 2 is released and of production quality.
check it out: http://xdoclet.codehaus.org


 

Looking for earth-friendly autos? 
Browse Top Cars by Green Rating at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Guice 1.0rc2

2007-02-26 Thread Bob Lee

On 2/26/07, Konstantin Priblouda [EMAIL PROTECTED] wrote:


I would  ask why to prefer guice over
pico/nanocontainer instead ;)



Type checking, performance, documentation, less code, generic types support,
cleaner configuration (Guice uses a nice EDSL), no setter method
requirement, up front error checking with user friendly messages, simpler
API...

IMHO, Annotations are cool and sexy, but they are not

usefull in this context as they are bound to compile
time.



So are interfaces. :)

What's important is that you don't depend on the implementation. Depending
on the interface and annotation is OK. Strings are a pain.

I have some generic tools / frameworks  which I like

to integrate in a webapp (for example,
user management, security and menu system:
http://www.sourceforge.net/projects/jtec)

And some of those tools need ( say ) hibernate
session.
But I have more than one hibernate session in my
web application.

If my wiring is configured via annotations ( compile
time )  I'm lost - I have to recompile my rfamworks
just to be used in some project.



This is where custom providers come in. You inject the provider and then
create your object. If you provide a more detailed example, I'll provide a
code example.

Thats where externalized configuration rules.

( and pico contaienr supports not only xml , but also
groovy and other scriupting configuration  )



Guice supports properties files and can convert the types at startup. I also
see no reason why you couldn't implement Module using Groovy.

Bob


Re: Guice 1.0rc2

2007-02-26 Thread Konstantin Priblouda

--- Bob Lee [EMAIL PROTECTED] wrote:

Hi Bob,  
I'd like to say that I'm codeveloper of
pico/nanocontainer. 

 Type checking, performance, documentation, less
 code, generic types support,
 cleaner configuration (Guice uses a nice EDSL), no
 setter method
 requirement, up front error checking with user
 friendly messages, simpler
 API...

let separate DI container from DI container buildup. 
pico (di-only part)  offers nothing than DI, 
you can build up hierarchical tree of containers. 
you request component from a leaf - it is delivered. 

distinctive feature are component adapters, which
determine how components are wired together. 
adapters can be stacked  to provide specific behaviour
( caching / hot swapable / remoting /aspects /
constructor injection / setter injection / etc. ) 

Everything can be done in  java code.

nanocontainer is a next step and provides various 
means  to externalize this configuration. 
(xml, groovy, whatever else) 


 IMHO, Annotations are cool and sexy, but they are
 not
  usefull in this context as they are bound to
 compile
  time.

 So are interfaces. :)

well, but I do not use interfaces to wire my
components
together ( explicitely )

 What's important is that you don't depend on the
 implementation. Depending
 on the interface and annotation is OK. Strings are a
 pain.

We do not depend on string keys to dientify components
- key in container  is just object, and is
needed only in case of ambiguity ( but it could be
string as well ) 




 This is where custom providers come in. You inject
 the provider and then
 create your object. If you provide a more detailed
 example, I'll provide a
 code example.

What kind of exmaple do you like? 
http://jtec.svn.sourceforge.net/viewvc/jtec/jtec-user/trunk/src/java/de/jtec/user/hibernate/HibernateUserManager.java?revision=106view=markup

This is my hibernate user manager.  Using constructor
injection it only needs hibernate session
( and does not care where it comes from ) 

As hibernate guys decided to use weird factories
everywhere, there was a need for custom wrapper 
for it which is proxying session (part of persistence
subproject of pico/nanocontainer) 

Basically I just register this session component - 
and my HibernateUserManager receives it in
constructor.

Why do I need an annotation to achieve this? 




 Guice supports properties files and can convert the
 types at startup. I also
 see no reason why you couldn't implement Module
 using Groovy.

Well, there is still a question why it is better than
pico ;) 

Pico is also integated with WW2 and struts ( if not - 
I can contribute it if you like ) 

regards,


[ Konstantin Pribluda http://www.pribluda.de ]
Still using XDoclet 1.x?  XDoclet 2 is released and of production quality.
check it out: http://xdoclet.codehaus.org


 

Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Guice 1.0rc2

2007-02-26 Thread Philip Luppens

On 2/26/07, Konstantin Priblouda [EMAIL PROTECTED] wrote:


--- Bob Lee [EMAIL PROTECTED] wrote:
[snip]

Pico is also integated with WW2 and struts ( if not -
I can contribute it if you like )

regards,



Afaik, there's no Pico plugin available for Struts 2. So, yes,
Konstantin, if you're willing to provide us with one and register it
on the Plugin registry, that would certainly be welcome.

Cheers,

Phil
--
iDTV System Engineer
Always code as if the guy who ends up maintaining your code will be a
violent psychopath who knows where you live. - John F. Woods

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Guice 1.0rc2

2007-02-26 Thread Tom Schneider

There is no pico/nanocontainer support in struts2 at the moment.  (I
don't think it made it over in the merger)  IMO this is best
implemented as an external plugin anyhow.  All external plugins thus
far have used googlecode to host their projects.  If you do create
this plugin, please register your plugin in the plugin registry:
http://cwiki.apache.org/S2PLUGINS/home.html

It shouldn't be too difficult to convert the existing WW support to
struts2, although ironically, you'll have to register it with Guice.
:o)
Tom

On 2/26/07, Philip Luppens [EMAIL PROTECTED] wrote:

On 2/26/07, Konstantin Priblouda [EMAIL PROTECTED] wrote:

 --- Bob Lee [EMAIL PROTECTED] wrote:
 [snip]

 Pico is also integated with WW2 and struts ( if not -
 I can contribute it if you like )

 regards,


Afaik, there's no Pico plugin available for Struts 2. So, yes,
Konstantin, if you're willing to provide us with one and register it
on the Plugin registry, that would certainly be welcome.

Cheers,

Phil
--
iDTV System Engineer
Always code as if the guy who ends up maintaining your code will be a
violent psychopath who knows where you live. - John F. Woods

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Guice 1.0rc2

2007-02-26 Thread Bob Lee

On 2/26/07, Konstantin Priblouda [EMAIL PROTECTED] wrote:


Hi Bob,
I'd like to say that I'm codeveloper of
pico/nanocontainer.



I've used Pico and Nano. Nano uses my AOP framework. You should try Guice.


What's important is that you don't depend on the
 implementation. Depending
 on the interface and annotation is OK. Strings are a
 pain.

We do not depend on string keys to dientify components
- key in container  is just object, and is
needed only in case of ambiguity ( but it could be
string as well )



Using these key objects is more verbose than using annotations with Guice.



Basically I just register this session component -
and my HibernateUserManager receives it in
constructor.

Why do I need an annotation to achieve this?



The annotation indicates which constructor you want injected (to the
framework as well as other programmers). What happens if you forget to
configure a PasswordHasher in Pico? No hashing? That's not very secure.

If you can't annotate a constructor (because you don't control the code),
you can use a custom provider. For example:

class HibernateUserManagerProvider implements ProviderHibernateUserManager
{
 @Inject Session session;
 @Inject PasswordHasher passwordHasher;
 public HibernateUserManager get() {
   return new HibernateUserManager(session, passwordHasher);
 }
}

Well, there is still a question why it is better than

pico ;)



Write less code, and get better up front checking and better performance.
What more do you want?

Bob


Re: Guice 1.0rc2

2007-02-26 Thread Alexandru Popescu

On 2/26/07, Bob Lee [EMAIL PROTECTED] wrote:

On 2/26/07, Konstantin Priblouda [EMAIL PROTECTED] wrote:

 Hi Bob,
 I'd like to say that I'm codeveloper of
 pico/nanocontainer.


I've used Pico and Nano. Nano uses my AOP framework. You should try Guice.

 What's important is that you don't depend on the
  implementation. Depending
  on the interface and annotation is OK. Strings are a
  pain.

 We do not depend on string keys to dientify components
 - key in container  is just object, and is
 needed only in case of ambiguity ( but it could be
 string as well )


Using these key objects is more verbose than using annotations with Guice.


 Basically I just register this session component -
 and my HibernateUserManager receives it in
 constructor.

 Why do I need an annotation to achieve this?


The annotation indicates which constructor you want injected (to the
framework as well as other programmers). What happens if you forget to
configure a PasswordHasher in Pico? No hashing? That's not very secure.

If you can't annotate a constructor (because you don't control the code),
you can use a custom provider. For example:

class HibernateUserManagerProvider implements ProviderHibernateUserManager
{
  @Inject Session session;
  @Inject PasswordHasher passwordHasher;
  public HibernateUserManager get() {
return new HibernateUserManager(session, passwordHasher);
  }
}

Well, there is still a question why it is better than
 pico ;)


Write less code, and get better up front checking and better performance.
What more do you want?

Bob



Bob it sounds cool, but without documentation I would say that there
are not many chances people will look into it. I will wait for the
moment the documentation becomes available.

./alex
--
.w( the_mindstorm )p.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts html:link

2007-02-26 Thread Dilep
I got the solution for this. 
The issue I am getting is OnClick on a Hyper Link from Search Result page to 
launch the update page.
B'caz even for update, I am using the same FormBean which i have used for 
Add. 
So It is calling the validate() method where I am doing lots of Form 
validation, hence failing and not executing Action Class.

Thanks.
-
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=66672messageID=127620#127620


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Guice 1.0rc2

2007-02-26 Thread Bob Lee

On 2/26/07, Konstantin Priblouda [EMAIL PROTECTED] wrote:


 Using these key objects is more verbose than using
 annotations with Guice.

Not necessarily.  There are no references to keys in
my code,  only in container buildup.  And only in
cases where this is necessary.



My point still holds true--Pico requires more code than Guice.

And annotation introduces explicit dependency to

framework - kind of uncool.



It's a tradeoff--I'll take easier maintainability and more concise code.

If I choose to not to provide such constructor -

then container can not instantiate this component -
there will be an ugly telling you to provide
dependency.



When does Pico give you this error? Guice gives you a pretty message at
startup as opposed to runtime. It even points you to the class and place
where you bound it.

%---

 !--
security and user management components
--

implementation key=securitySession
class=org.nanocontainer.persistence.hibernate.FailoverSessionDelegator
dependency key=userSessionFactory/
/implementation

implementation key=securityLifecycle
class=org.nanocontainer.persistence.hibernate.SessionLifecycle
dependency key=securitySession/
/implementation


!--
user manager
--
implementation key=userManager
class=de.jtec.user.hibernate.HibernateUserManager
dependency key=securitySession/
dependency key=hasher/
/implementation

--%



It's difficult to say exactly because the example is slightly incomplete,
but the equivalent of this in Guice is:

bind(Session.class)
 .annotatedWith(Secure.class)
 .to(FailoverSessionDelegator.class);

Then apply @Inject @Secure wherever you want a secure Session. You can
obviously reuse the @Secure annotation elsewhere, too.

Now any WW2/S2 action wishing to have reference to

UserManager needs to declare it as constructor
parameter.



Guice's Struts 2 plugin injects interceptors and results, too.

Guice also supports scoping using annotations. For example, you can apply
@SessionScoped to an action and it will be stored in the session.

PS: is project space on code.google.com available only

for employees or also for mere mortals?



Google Code is open to anyone!

Bob


Re: Guice 1.0rc2

2007-02-26 Thread Bob Lee

On 2/26/07, Bob Lee [EMAIL PROTECTED] wrote:


bind(Session.class)
  .annotatedWith(Secure.class)
  .to(FailoverSessionDelegator.class);

Then apply @Inject @Secure wherever you want a secure Session. You can
obviously reuse the @Secure annotation elsewhere, too.



If I were to really implement this, I would probably make the secure
implementation the default and bind the insecure implementation to
@Insecure.

Bob


Re: Guice 1.0rc2

2007-02-26 Thread Konstantin Priblouda

--- Tom Schneider [EMAIL PROTECTED] wrote:

 There is no pico/nanocontainer support in struts2 at
 the moment.  (I
 don't think it made it over in the merger)  IMO this
 is best
 implemented as an external plugin anyhow.  All
 external plugins thus
 far have used googlecode to host their projects.  If
 you do create
 this plugin, please register your plugin in the
 plugin registry:
 http://cwiki.apache.org/S2PLUGINS/home.html
 
 It shouldn't be too difficult to convert the
 existing WW support to
 struts2, although ironically, you'll have to
 register it with Guice.
 :o)
 Tom

If S2 architecture is the same than  WW2, then it is
not necessary to register it as plugin - it's just an
object factory  and couple of filters ( which are
independet of S2/WW ) 


regards,

[ Konstantin Pribluda http://www.pribluda.de ]
Still using XDoclet 1.x?  XDoclet 2 is released and of production quality.
check it out: http://xdoclet.codehaus.org


 

Finding fabulous fares is fun.  
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel 
bargains.
http://farechase.yahoo.com/promo-generic-14795097

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Guice 1.0rc2

2007-02-26 Thread Bob Lee

On 2/26/07, Konstantin Priblouda [EMAIL PROTECTED] wrote:


If S2 architecture is the same than  WW2, then it is
not necessary to register it as plugin - it's just an
object factory  and couple of filters ( which are
independet of S2/WW )



XWork 2 uses an older version of Guice to wire together the internal
dependencies, so you'll indirectly use Guice to provide your custom object
factory.

Bob


Re: Guice 1.0rc2

2007-02-26 Thread Konstantin Priblouda

--- Bob Lee [EMAIL PROTECTED] wrote:

 On 2/26/07, Konstantin Priblouda
 [EMAIL PROTECTED] wrote:
 
  If S2 architecture is the same than  WW2, then it
 is
  not necessary to register it as plugin - it's just
 an
  object factory  and couple of filters ( which are
  independet of S2/WW )
 
 
 XWork 2 uses an older version of Guice to wire
 together the internal
 dependencies, so you'll indirectly use Guice to
 provide your custom object
 factory.

I'm still using XW 1.x because I'm using WW2 
( can not move to S2 yet due to 1.5+ requirement )
Though this may change soon...

regards,

[ Konstantin Pribluda http://www.pribluda.de ]
Still using XDoclet 1.x?  XDoclet 2 is released and of production quality.
check it out: http://xdoclet.codehaus.org


 

Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Guice 1.0rc2

2007-02-26 Thread Dave Newton
--- Konstantin Priblouda [EMAIL PROTECTED] wrote:
 I'm still using XW 1.x because I'm using WW2 
 ( can not move to S2 yet due to 1.5+ requirement )

FWIW the Retro'd jars have (so far) worked flawlessly
for us on Weblogic 8.1/JDK1.4.2_08.

d.


 

Don't get soaked.  Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Guice 1.0rc2

2007-02-26 Thread Tom Schneider

The architecture between webwork and struts2 has changed.

Every other project that provides the same functionality, (e.g.
Plexus, Spring, etc.) was written as a plugin in Struts2.  Technically
it is possible to use the object factories, interceptors, etc. without
using the plugin architecture but it makes it much more difficult for
end users.  With a plugin, you can just drop it in, do some very
minimal config and go.

On 2/26/07, Konstantin Priblouda [EMAIL PROTECTED] wrote:



If S2 architecture is the same than  WW2, then it is
not necessary to register it as plugin - it's just an
object factory  and couple of filters ( which are
independet of S2/WW )


regards,

[ Konstantin Pribluda http://www.pribluda.de ]
Still using XDoclet 1.x?  XDoclet 2 is released and of production quality.
check it out: http://xdoclet.codehaus.org




Finding fabulous fares is fun.
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel 
bargains.
http://farechase.yahoo.com/promo-generic-14795097

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Guice 1.0rc2

2007-02-26 Thread Konstantin Priblouda

--- Bob Lee [EMAIL PROTECTED] wrote:
 
 
 My point still holds true--Pico requires more code
 than Guice.

Structly speaking using pico in a webapp requires no
code at all (except of course container configuration 
in xml or whatever else)
 
 
 And annotation introduces explicit dependency to
  framework - kind of uncool.
 
 
 It's a tradeoff--I'll take easier maintainability
 and more concise code.

Well, as said before there is no code related to pico
at all. ( in classes being injected ) 

What is with third party libraries, which do not know
anything about guice? It is really easy to inject
velocity engine with pico ( for example to compose
email message ):

( taken from my webapp, application scope ) 
---%-
   !--
properties for velocity engine for mail system
--
implementation key=renderProperties
class=org.picocontainer.gems.util.ConstructableProperties
constant
stringrender.properties/string
/constant
/implementation
!--
velocity engine
--
implementation
class=org.apache.velocity.app.VelocityEngine
dependency key=renderProperties/
/implementation
---%-

( well, I need little more verbose explicit
configuration because I have more than one properties
object ) 

Now every object which likes to use velocity engine
just gets it. 

And velocity remains the same vanilla velocity coming
out of maven repository at apache. 


If I understood you correctly, in guice there will be
need to write some adapter / factory. Who got more
code?





 If I choose to not to provide such constructor -
  then container can not instantiate this component
 -
  there will be an ugly telling you to provide
  dependency.
 
 
 When does Pico give you this error? Guice gives you
 a pretty message at
 startup as opposed to runtime. It even points you to
 the class and place
 where you bound it.

At container verification. AFAIR this happens before
container in question is started - also pretty soon.

It also tells what is missing ( and depending on WW
setup this even comes on the page ) 



 %---
   !--
  security and user management components
  --
 
  implementation key=securitySession
 

class=org.nanocontainer.persistence.hibernate.FailoverSessionDelegator
  dependency key=userSessionFactory/
  /implementation
 
  implementation key=securityLifecycle
 

class=org.nanocontainer.persistence.hibernate.SessionLifecycle
  dependency key=securitySession/
  /implementation
 
 
  !--
  user manager
  --
  implementation key=userManager
 
 class=de.jtec.user.hibernate.HibernateUserManager
  dependency key=securitySession/
  dependency key=hasher/
  /implementation
 
  --%
 
 
 It's difficult to say exactly because the example is
 slightly incomplete,
 but the equivalent of this in Guice is:

Well, this was request scope ( as hibernate session is
best opened in view ;) ). In aplication scope you will
need something like this:

-%--
!-- hibernate configuration  session factory 
for jtec-user --

implementation key=userDbConfig
class=org.nanocontainer.persistence.hibernate.ConstructableConfiguration
constant
   
string/jtec-user-hibernate.cfg.xml/string
/constant
/implementation

implementation key=userSessionFactory
class=org.nanocontainer.persistence.hibernate.SessionFactoryDelegator
dependency key=userDbConfig/
/implementation
%--

Again, explicit dependencies and keys are provided 
to avoid ambiguity as there are more hibernate
domains. 


 bind(Session.class)
   .annotatedWith(Secure.class)
   .to(FailoverSessionDelegator.class);
 
 Then apply @Inject @Secure wherever you want a
 secure Session. You can
 obviously reuse the @Secure annotation elsewhere,
 too.

Correct me if I'm wrong ( due to lack of complete
undertanging of guice ), but this means that you
need to tell explicitely that org.hibernate.Session
would be represented  by FailoverSessionDelegator
class? 

What if I like to use another session impl in the same
container? 

You do not have to specify this with pico - your
constructor states it need Session , container looks
for implementation of session.  If there is one than
one available -  ambiguity shall be resolved by means
of explicit mapping ( no difference with guice? ) 


 Now any WW2/S2 action wishing to have reference to
  UserManager needs to declare it as constructor
  parameter.
 
 
 Guice's Struts 2 plugin injects interceptors and
 results, too.
 
 Guice also supports scoping using annotations. For
 example, you can apply
 @SessionScoped to an action and it will be stored in
 the session.

Scoping is another issue. Guice users depend on your
wisdom to provide them with annotations. If those
annotations are to be applied on  some framework ( 

Re: Guice 1.0rc2

2007-02-26 Thread Konstantin Priblouda

--- Dave Newton [EMAIL PROTECTED] wrote:

 --- Konstantin Priblouda [EMAIL PROTECTED]
 wrote:
  I'm still using XW 1.x because I'm using WW2 
  ( can not move to S2 yet due to 1.5+ requirement )
 
 FWIW the Retro'd jars have (so far) worked
 flawlessly
 for us on Weblogic 8.1/JDK1.4.2_08.

WW 8.1.6 has some other bugs, and I have fun of
my life trying to explain it to developer relations
engineer, so I'd rather bribe my deployment manager
to assing different host which runs just TC ;) 

anyway, with a really big deployment coming in time
for cebit ( 7.3 ) there is no chance to play around
with 
other frameworks / jre's

So I'd have to postpone it.

regards,

[ Konstantin Pribluda http://www.pribluda.de ]
Still using XDoclet 1.x?  XDoclet 2 is released and of production quality.
check it out: http://xdoclet.codehaus.org


 

It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Guice 1.0rc2

2007-02-26 Thread Bob Lee

On 2/26/07, Konstantin Priblouda [EMAIL PROTECTED] wrote:


 My point still holds true--Pico requires more code
 than Guice.

Structly speaking using pico in a webapp requires no
code at all (except of course container configuration
in xml or whatever else)



U, strictly speaking, that's still code. ;)

What is with third party libraries, which do not know

anything about guice?



You can write a custom Provider as I illustrated above.

If I understood you correctly, in guice there will be

need to write some adapter / factory. Who got more
code?



I'm pretty sure Pico is still more verbose. If you explain what your example
is doing a little better, I'll be happy to illustrate.


bind(Session.class)
   .annotatedWith(Secure.class)
   .to(FailoverSessionDelegator.class);

 Then apply @Inject @Secure wherever you want a
 secure Session. You can
 obviously reuse the @Secure annotation elsewhere,
 too.

Correct me if I'm wrong ( due to lack of complete
undertanging of guice ), but this means that you
need to tell explicitely that org.hibernate.Session
would be represented  by FailoverSessionDelegator
class?



Yes.

What if I like to use another session impl in the same

container?



Use an annotation.

You do not have to specify this with pico - your

constructor states it need Session , container looks
for implementation of session.  If there is one than
one available -  ambiguity shall be resolved by means
of explicit mapping ( no difference with guice? )



Correct.

Scoping is another issue. Guice users depend on your

wisdom to provide them with annotations. If those
annotations are to be applied on  some framework (
say, my menu framework for example ), then there is a
leak of concepts - I have to decide component scope
in a project which has nothing to do with  web
application ( but will be used for it ). What if I
need different scope?



You can override the scope in the configuration. You can also implement your
own scopes and scope annotations. The users' guide explains this.

Bob


Re: Guice 1.0rc2

2007-02-26 Thread Dave Newton
--- Konstantin Priblouda [EMAIL PROTECTED] wrote:
 WW 8.1.6 has some other bugs, 

That's being very polite ;) WW drives me nuts.

I was just saying that the J4 distro seems to work
well.

d.



 

Don't get soaked.  Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Performance degradation for pages with long select

2007-02-26 Thread Nesterenko, Nikolay
Hi.

I had Struts 2 performance problem for any page with very long select,

e.g., page with drop-down for all (2400) cities and all (2650) zips
for the state of California. 
Such pages took 20-30 sec to be displayed. 

Logs show that time was consumed somewhere after page generation.
Removing optional interceptors didn't help.
I replaced jsp with the page HTML source from IE ... the same
performance. 

Extract from the page source is presented below. 
It doesn't look right for the page having s:head theme=css_xhtml/

script language=JavaScript type=text/javascript
// Dojo configuration
djConfig = {
baseRelativePath: /custfind/struts/dojo,
isDebug: false,
bindEncoding: UTF-8,
debugAtAllCosts: true // not needed, but allows the Venkman
debugger to work with the includes
};
/script
script language=JavaScript type=text/javascript
src=/custfind/struts/dojo/dojo.js/script
script language=JavaScript type=text/javascript
src=/custfind/struts/simple/dojoRequire.js/script   

Removing this AJAX related code has fixed the issue.

Questions:
1. Was AJAX template just forgotten in
struts2-core-2.0.6.jar\template\simple\head.ftl and can be safely
removed?
2. How (not existing in my application) /custfind/struts/dojo/dojo.js
managed to take so much time? 

Thank you,
Nick


--
Notice:  This e-mail message, together with any attachments, contains
information of Merck  Co., Inc. (One Merck Drive, Whitehouse Station,
New Jersey, USA 08889), and/or its affiliates (which may be known
outside the United States as Merck Frosst, Merck Sharp  Dohme or MSD
and in Japan, as Banyu - direct contact information for affiliates is 
available at http://www.merck.com/contact/contacts.html) that may be 
confidential, proprietary copyrighted and/or legally privileged. It is 
intended solely for the use of the individual or entity named on this 
message. If you are not the intended recipient, and have received this 
message in error, please notify us immediately by reply e-mail and then 
delete it from your system.


--

Extra parameter value for DispatchAction.

2007-02-26 Thread Dilep
Hi,
Is there a way to pass a extra paramameter for DispatchAction apart from 
parameter=method..
Onclick on a link(html:link action=/someform.do?method=getRecord) from 
Search Results, I wanna to pass the primary key value. I can't use hidden 
values as it is not a form.
I have one solution. But i don't know its proper approach. I tryig to set the 
session in javascript and its not working.
onclick=javascript:clickRequestId(primaryKeyValue));

function clickRequestId(value) {
 
 var primaryKey = value;
 session.setAttribute(id,primaryKey);
 }.
Any one has any idea please..
-
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=67368messageID=127785#127785


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Extra parameter value for DispatchAction.

2007-02-26 Thread Dave Newton
--- Dilep [EMAIL PROTECTED] wrote:
 Is there a way to pass a extra paramameter for
 DispatchAction apart from parameter=method..

This should be moved to the user list.

 Onclick on a link(html:link
 action=/someform.do?method=getRecord) from Search
 Results, I wanna to pass the primary key value. I
 can't use hidden values as it is not a form.

You can either build the URL via EL (by using the
html-el tags) or via the normal parameter map method
(see
http://struts.apache.org/1.2.9/userGuide/struts-html.html#link)

 I have one solution. But i don't know its proper
 approach. I tryig to set the session in javascript
 and its not working.
 
 function clickRequestId(value) {
var primaryKey = value;
session.setAttribute(id,primaryKey);
  }

I'll admit I've never tried that approach... You may
have some very basic misconceptions about Javascript.

d.



 

Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Extra parameter value for DispatchAction.

2007-02-26 Thread Michael Jouravlev

Dilep, use struts-user forum for questions like this.

On 2/26/07, Dilep [EMAIL PROTECTED] wrote:

Hi,
Is there a way to pass a extra paramameter for DispatchAction
apart from parameter=method.


parameter=method is not meant to pass parameters to an action,
parameters are passed in request object.


Onclick on a link(html:link action=/someform.do?method=getRecord)
from Search Results, I wanna to pass the primary key value.
I can't use hidden values as it is not a form.


If you have one link per row then just add your PK to the link
directly. If you have one link per whole table then you will need to
modify the link dynamically with Javascript.


I have one solution. But i don't know its proper approach. I tryig to set the 
session in javascript and its not working.


If it does not work then it's not a solution.


onclick=javascript:clickRequestId(primaryKeyValue));

function clickRequestId(value) {

 var primaryKey = value;
 session.setAttribute(id,primaryKey);
 }.
Any one has any idea please..


You cannot access server-side session object from browser-contained
Javascript code. I mean, not in the fashion above. You need to read
sevlets/JSP book first to understand browser/server interaction.

Michael.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Guice 1.0rc2

2007-02-26 Thread Konstantin Priblouda

--- Dave Newton [EMAIL PROTECTED] wrote:

 --- Konstantin Priblouda [EMAIL PROTECTED]
 wrote:
  WW 8.1.6 has some other bugs, 
 
 That's being very polite ;) WW drives me nuts.
( I meant WLS ) 
You do not have support contract?  If yes, it is even
more fun ;) 


regards,

[ Konstantin Pribluda http://www.pribluda.de ]
Still using XDoclet 1.x?  XDoclet 2 is released and of production quality.
check it out: http://xdoclet.codehaus.org


 

Expecting? Get great news right away with email Auto-Check. 
Try the Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Performance degradation for pages with long select

2007-02-26 Thread Philip Luppens

Hi Nikolay,

Please try to ask questions like this on the user mailing list.

I'm going to take a stab at this, and say Dojo is your offender. There
is a setting in Dojo that will cause it to start parsing after the
page has been fully rendered (rather than during it), but I cannot
recall it right now. If you apply that setting, things should speed up
again. I remember a case where this was the problem, so it might be
the same problem you're hitting.

Kind regards,

Phil

On 2/27/07, Nesterenko, Nikolay [EMAIL PROTECTED] wrote:

Hi.

I had Struts 2 performance problem for any page with very long select,

e.g., page with drop-down for all (2400) cities and all (2650) zips
for the state of California.
Such pages took 20-30 sec to be displayed.

Logs show that time was consumed somewhere after page generation.
Removing optional interceptors didn't help.
I replaced jsp with the page HTML source from IE ... the same
performance.

Extract from the page source is presented below.
It doesn't look right for the page having s:head theme=css_xhtml/

script language=JavaScript type=text/javascript
// Dojo configuration
djConfig = {
baseRelativePath: /custfind/struts/dojo,
isDebug: false,
bindEncoding: UTF-8,
debugAtAllCosts: true // not needed, but allows the Venkman
debugger to work with the includes
};
/script
script language=JavaScript type=text/javascript
src=/custfind/struts/dojo/dojo.js/script
script language=JavaScript type=text/javascript
src=/custfind/struts/simple/dojoRequire.js/script

Removing this AJAX related code has fixed the issue.

Questions:
1. Was AJAX template just forgotten in
struts2-core-2.0.6.jar\template\simple\head.ftl and can be safely
removed?
2. How (not existing in my application) /custfind/struts/dojo/dojo.js
managed to take so much time?

Thank you,
Nick


--
Notice:  This e-mail message, together with any attachments, contains
information of Merck  Co., Inc. (One Merck Drive, Whitehouse Station,
New Jersey, USA 08889), and/or its affiliates (which may be known
outside the United States as Merck Frosst, Merck Sharp  Dohme or MSD
and in Japan, as Banyu - direct contact information for affiliates is
available at http://www.merck.com/contact/contacts.html) that may be
confidential, proprietary copyrighted and/or legally privileged. It is
intended solely for the use of the individual or entity named on this
message. If you are not the intended recipient, and have received this
message in error, please notify us immediately by reply e-mail and then
delete it from your system.


--



--
iDTV System Engineer
Always code as if the guy who ends up maintaining your code will be a
violent psychopath who knows where you live. - John F. Woods

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Guice 1.0rc2

2007-02-26 Thread Konstantin Priblouda

--- Bob Lee [EMAIL PROTECTED] wrote:

 On 2/26/07, Konstantin Priblouda
 [EMAIL PROTECTED] wrote:
 
   My point still holds true--Pico requires more
 code
   than Guice.
 
  Structly speaking using pico in a webapp requires
 no
  code at all (except of course container
 configuration
  in xml or whatever else)
 
 
 U, strictly speaking, that's still code. ;)

Strictly speaking yes. But it is externalized and
does not impose anything on  used classes. 



 What is with third party libraries, which do not
 know
  anything about guice?
 
 
 You can write a custom Provider as I illustrated
 above.

Even more code which has to be repeated again and
again . Or subproject proliferation...


 If I understood you correctly, in guice there will
 be
  need to write some adapter / factory. Who got more
  code?
 I'm pretty sure Pico is still more verbose. If you
 explain what your example
 is doing a little better, I'll be happy to
 illustrate.

Well, it is just providing configured hibernate
session 
and its lifecycle - basically open session in view

So it registers configuration + session factory in
application scope,   and session  lifecycle
controller
in request.


 What if I like to use another session impl in the
 same
  container?
 Use an annotation.

And if I need to register the sme class more than
once?
Yet another annotation? And another one? 


 You can override the scope in the configuration. You
 can also implement your
 own scopes and scope annotations. The users' guide
 explains this.

And those scope annotations will leak into my original
code. ( And I prefer my classes to be innocent, and
not
knowing that it is managed by Guice or pico or
whatever
else. Such dependency invalidates whole point of DI /
IoC ) 

regards,

[ Konstantin Pribluda http://www.pribluda.de ]
Still using XDoclet 1.x?  XDoclet 2 is released and of production quality.
check it out: http://xdoclet.codehaus.org


 

Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]