You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by bu...@cs.man.ac.uk on 2011/03/11 17:50:23 UTC

logon without a password

Hi again,

I've made a lot of progress with my sample app. I need to be able to log
on without a password which works for the dnd, html and scimpi viewer.
However I had planned to use the wicket viewer. Can anyone suggest what I
would need to change to make it work?

Also I've been using the sql object store with hsqldb. It works well for
my app but I noticed something strange when using the dnd viewer eg

Class A one->many Class B
Class B one->many Class C

If I traverse to Class A from a repository, then traverse to Class B,
Class B shows an empty list for Class C. I'm guessing this has to do with
lazy loading? I've found that loading Class B before Class A solves this
problem for me.

Thanks again,
Christophe

Re: logon without a password

Posted by Dan Haywood <dk...@gmail.com>.
On 12/03/2011 20:32, Kevin Meyer - KMZ wrote:
> Dear Christophe,
>
>> I've made a lot of progress with my sample app. I need to be able to log
>> on without a password which works for the dnd, html and scimpi viewer.
>> However I had planned to use the wicket viewer. Can anyone suggest what I
>> would need to change to make it work?
> Hmm. Without knowing any better, I would have thought Dan's
> suggestion of the 24th Feb would have worked here too! I'll leave Dan
> to handle queries about the wicket viewer ;)
>

Unfortunately not, because the wicket viewer leverages Apache Wicket's 
own security mechanisms, so the trick I outlined there doesn't really work.

As a quick fix, I've just committed (rev 1081982) a new class, 
IsisWicketUnsecuredApplication, which you can use in the web.xml instead 
of IsisWicketApplication.  I'm not sure if this is a long-term solution, 
because there isn't any way to protect individual pages (eg for 
checkout); but hopefully it'll get you going.

Let me know if that works for you,
Dan


Re: logon without a password

Posted by Dan Haywood <dk...@gmail.com>.
On 12/03/2011 20:32, Kevin Meyer - KMZ wrote:
>
>> but I noticed something strange when using the dnd viewer eg
>>
>> Class A one->many Class B
>> Class B one->many Class C
>>
>> If I traverse to Class A from a repository, then traverse to Class B,
>> Class B shows an empty list for Class C. I'm guessing this has to do with
>> lazy loading? I've found that loading Class B before Class A solves this
>> problem for me.
> Thanks for raising this.. I thought I tried something like this a long time
> ago - or it may have had to do with changes in one instance
> propagating to other open views of the same object - but the problems
> I had occurred only when my classes did not extend (sub-class?)
> DomainObjectContainer (if memory serves).
>
> Can you confirm which, if any, of your Class A / B / C extend
> DomainObjectContainer?
>
quick correction: I think you mean AbstractDomainObject, not 
DomainObjectContainer?  Not that it helps you any...

Dan




Re: logon without a password

Posted by Dan Haywood <dk...@gmail.com>.
On 15/03/2011 16:06, burlinc7@cs.man.ac.uk wrote:
>
> Finally, I've got another problem now :) In one of my services I create a
> new Thread which calls DomainObjectContainer methods. This works for me in
> the dnd viewer but when I run it in the html view it gives me:
>
> java.lang.IllegalStateException: No Session opened for this thread
>

Yup, that's gonna happen.  The (default runtime for) Isis uses a class 
called IsisContext that is used as a service locator for sessions.  In 
DnD, this is a singleton (called IsisContextStatic), but on HTML we use 
an implementation that binds to the thread-local 
(IsisContextThreadLocal).  That's why you see no session.

In fact, it is possible - and relatively straightforward - to write your 
own implementation of IsisContext, though you'd need to find a means to 
recognize that the two threads are meant to share the same info.  The 
Wicket viewer, in fact, does have its own implementation, namely 
IsisContextForWicket, which shares contexts on a Wicket Session.  You 
could use that for inspiration if you want.

Cheers
Dan

PS: it's this sort of complexity that is one of the reasons I want to 
move to CDI/JSR-299.  However, determining the "scope" of a session etc 
will still be required, even under CDI.


Re: logon without a password

Posted by Kevin Meyer - KMZ <ke...@kmz.co.za>.
Hi Christophe,

> > Can you confirm which, if any, of your Class A / B / C extend
> > DomainObjectContainer?
> 
> All the classes extend AbstractDomainObjectContainer, I've changed the
> default object container in the isis.properties file in case that makes a
> difference.
> 
> >Otherwise, you may have to manually call resolve() on class B's
> >property collection of class C..
> 
> I've tried manually calling resolve() but it doesn't seem to work for me.
> 
> I've also tried my example again with the xml and in-memory store but the
> dnd viewer seems to work as expected.

Hmm. So you're saying that (only) with the DnD viewer and (only) with 
the SQL object store, Class B's collection of Class C is not resolved? 
(wrt the original problem statement)?

I might have an opportunity to look into this on Friday - but not likely, 
I'm going away for a bit on Saturday - it'll have to wait until I get back.

Care to take a dive into the sources and see if you can find anything 
odd/asymmetric in the mean time?

> Finally, I've got another problem now :) In one of my services I create a
> new Thread which calls DomainObjectContainer methods. This works for me in
> the dnd viewer but when I run it in the html view it gives me:
> 
> java.lang.IllegalStateException: No Session opened for this thread

Anyone else care to respond to this?


Re: Re: logon without a password

Posted by bu...@cs.man.ac.uk.
Hi Kevin,

> Can you confirm which, if any, of your Class A / B / C extend
> DomainObjectContainer?

All the classes extend AbstractDomainObjectContainer, I've changed the
default object container in the isis.properties file in case that makes a
difference.

>Otherwise, you may have to manually call resolve() on class B's
>property collection of class C..

I've tried manually calling resolve() but it doesn't seem to work for me.

I've also tried my example again with the xml and in-memory store but the
dnd viewer seems to work as expected.


Finally, I've got another problem now :) In one of my services I create a
new Thread which calls DomainObjectContainer methods. This works for me in
the dnd viewer but when I run it in the html view it gives me:

java.lang.IllegalStateException: No Session opened for this thread



Thanks,
Christophe










Re: logon without a password

Posted by Kevin Meyer - KMZ <ke...@kmz.co.za>.
Dear Christophe,

> I've made a lot of progress with my sample app. I need to be able to log
> on without a password which works for the dnd, html and scimpi viewer.
> However I had planned to use the wicket viewer. Can anyone suggest what I
> would need to change to make it work?

Hmm. Without knowing any better, I would have thought Dan's 
suggestion of the 24th Feb would have worked here too! I'll leave Dan 
to handle queries about the wicket viewer ;)

> Also I've been using the sql object store with hsqldb. It works well for
> my app 

Glad to hear! 

> but I noticed something strange when using the dnd viewer eg
> 
> Class A one->many Class B
> Class B one->many Class C
> 
> If I traverse to Class A from a repository, then traverse to Class B,
> Class B shows an empty list for Class C. I'm guessing this has to do with
> lazy loading? I've found that loading Class B before Class A solves this
> problem for me.

Thanks for raising this.. I thought I tried something like this a long time 
ago - or it may have had to do with changes in one instance 
propagating to other open views of the same object - but the problems 
I had occurred only when my classes did not extend (sub-class?)  
DomainObjectContainer (if memory serves).

Can you confirm which, if any, of your Class A / B / C extend 
DomainObjectContainer?

Otherwise, you may have to manually call resolve() on class B's 
property collection of class C..

If you haven't come right already, send me a note and I'll create an 
example app to try reproduce this behaviour.

Regards,
Kevin