You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Thorsten Scherler <th...@apache.org> on 2008/12/15 00:30:00 UTC

AbstractUsecase.getView() are called multiple times.

Hi all,

I noticed in a module I am currently developing that the getView() from
AbstractUsecase are called multiple times. I am not sure why but it
feels like a bug that it is called more then once. 

I tried to debug and counted that the method is invoked 6 times. If you
start lenya in debug mode and set a breakpoint at line 666 (no kidding
the 'evil' line) in AbstractUsecase then you will note requesting
lenya.usecase=admin.usecases exactly this phenomenon.

The whole problem about it is that the first time all parameter are in
the request but after that not anymore. 

My class is very simple:

public class ShowReports extends AbstractUsecase {
...
 protected void prepareView() throws Exception {
 ...
 }
}

Meaning I just want to override the prepareView() method. 

My xconf looks like:
<xconf xpath="/cocoon/usecases"
unless="/cocoon/usecases/component-instance[@name =
'reporter.showReports']">
  <component-instance name="reporter.showReports"
logger="lenya.reporter"
    class="org.apache.lenya.modules.reporter.ShowReports">
    <view uri="modules/reporter/usecases/showReports.jx" menu="true"
createContinuation="false">
      <tab group="admin" name="reporter"/>
    </view>
  </component-instance>
</xconf>

Does anybody see the same problem? 

Any ideas?

salu2
-- 
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>


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


Re: AbstractUsecase.getView() are called multiple times.

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
El lun, 15-12-2008 a las 09:47 +0100, Thorsten Scherler escribió:
> El lun, 15-12-2008 a las 08:49 +0100, Andreas Hartmann escribió:
> > Hi Thorsten,
> > 
> > Thorsten Scherler schrieb:
> > > I noticed in a module I am currently developing that the getView() from
> > > AbstractUsecase are called multiple times. I am not sure why but it
> > > feels like a bug that it is called more then once. 
> > > 
> > > I tried to debug and counted that the method is invoked 6 times. If you
> > > start lenya in debug mode and set a breakpoint at line 666 (no kidding
> > > the 'evil' line) in AbstractUsecase then you will note requesting
> > > lenya.usecase=admin.usecases exactly this phenomenon.
> > 
> > I just placed a breakpoint in this line and tried it with a different 
> > usecase, it was invoked 2 times:
> > 
> >    * directly by the usecases.js
> >    * when the UsecaseProxy is initialized
> > 
> > Do you use the trunk or 2.0.2?
> 
> First I was on trunk and then switched to the release tag. I am using
> java 1.5 on a ubuntu box. I may find time this morning to test with
> another box.
> 
> will let you know my findings.
> 

The same with Guadalinux and a fresh checkout install:

thorsten@eric:~/src/apache/lenya-2.0.2$ uname -a
Linux eric 2.6.24-22-generic #1 SMP Mon Nov 24 18:32:42 UTC 2008 i686
GNU/Linux


thorsten@eric:~/src/apache/lenya-2.0.2$ java -version
java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Server VM (build 1.5.0_11-b03, mixed mode)

thorsten@eric:~/src/apache/lenya-2.0.2$ svn info
Ruta: .
URL: http://svn.apache.org/repos/asf/lenya/tags/RELEASE_2_0_2
Raíz del repositorio: http://svn.apache.org/repos/asf
UUID del repositorio: 13f79535-47bb-0310-9956-ffa450edef68
Revisión: 726652
Tipo de nodo: directorio
Agendado: normal
Autor del último cambio: ragaller
Revisión del último cambio: 688479
Fecha de último cambio: 2008-08-24 11:32:06 +0200 (dom 24 de ago de
2008)


Request 
http://localhost:8888/default/authoring/index.html?lenya.usecase=admin.usecases

and see that the breakpoint you added to line 666 in AbstractUsecase get
hit >=6 times. :(

Maybe it is because of cocoon?

salu2


> salu2
> 
> > 
> > -- Andreas
> > 
> > 
> > > 
> > > The whole problem about it is that the first time all parameter are in
> > > the request but after that not anymore. 
> > > 
> > > My class is very simple:
> > > 
> > > public class ShowReports extends AbstractUsecase {
> > > ...
> > >  protected void prepareView() throws Exception {
> > >  ...
> > >  }
> > > }
> > > 
> > > Meaning I just want to override the prepareView() method. 
> > > 
> > > My xconf looks like:
> > > <xconf xpath="/cocoon/usecases"
> > > unless="/cocoon/usecases/component-instance[@name =
> > > 'reporter.showReports']">
> > >   <component-instance name="reporter.showReports"
> > > logger="lenya.reporter"
> > >     class="org.apache.lenya.modules.reporter.ShowReports">
> > >     <view uri="modules/reporter/usecases/showReports.jx" menu="true"
> > > createContinuation="false">
> > >       <tab group="admin" name="reporter"/>
> > >     </view>
> > >   </component-instance>
> > > </xconf>
> > > 
> > > Does anybody see the same problem? 
> > > 
> > > Any ideas?
> > > 
> > > salu2
> > 
> > 
-- 
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>

Sociedad Andaluza para el Desarrollo de la Sociedad 
de la Información, S.A.U. (SADESI)





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


Re: AbstractUsecase.getView() are called multiple times.

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
El lun, 15-12-2008 a las 08:49 +0100, Andreas Hartmann escribió:
> Hi Thorsten,
> 
> Thorsten Scherler schrieb:
> > I noticed in a module I am currently developing that the getView() from
> > AbstractUsecase are called multiple times. I am not sure why but it
> > feels like a bug that it is called more then once. 
> > 
> > I tried to debug and counted that the method is invoked 6 times. If you
> > start lenya in debug mode and set a breakpoint at line 666 (no kidding
> > the 'evil' line) in AbstractUsecase then you will note requesting
> > lenya.usecase=admin.usecases exactly this phenomenon.
> 
> I just placed a breakpoint in this line and tried it with a different 
> usecase, it was invoked 2 times:
> 
>    * directly by the usecases.js
>    * when the UsecaseProxy is initialized
> 
> Do you use the trunk or 2.0.2?

First I was on trunk and then switched to the release tag. I am using
java 1.5 on a ubuntu box. I may find time this morning to test with
another box.

will let you know my findings.

salu2

> 
> -- Andreas
> 
> 
> > 
> > The whole problem about it is that the first time all parameter are in
> > the request but after that not anymore. 
> > 
> > My class is very simple:
> > 
> > public class ShowReports extends AbstractUsecase {
> > ...
> >  protected void prepareView() throws Exception {
> >  ...
> >  }
> > }
> > 
> > Meaning I just want to override the prepareView() method. 
> > 
> > My xconf looks like:
> > <xconf xpath="/cocoon/usecases"
> > unless="/cocoon/usecases/component-instance[@name =
> > 'reporter.showReports']">
> >   <component-instance name="reporter.showReports"
> > logger="lenya.reporter"
> >     class="org.apache.lenya.modules.reporter.ShowReports">
> >     <view uri="modules/reporter/usecases/showReports.jx" menu="true"
> > createContinuation="false">
> >       <tab group="admin" name="reporter"/>
> >     </view>
> >   </component-instance>
> > </xconf>
> > 
> > Does anybody see the same problem? 
> > 
> > Any ideas?
> > 
> > salu2
> 
> 
-- 
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>

Sociedad Andaluza para el Desarrollo de la Sociedad 
de la Información, S.A.U. (SADESI)





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


Re: AbstractUsecase.getView() are called multiple times.

Posted by Andreas Hartmann <an...@apache.org>.
Hi Thorsten,

Thorsten Scherler schrieb:
> I noticed in a module I am currently developing that the getView() from
> AbstractUsecase are called multiple times. I am not sure why but it
> feels like a bug that it is called more then once. 
> 
> I tried to debug and counted that the method is invoked 6 times. If you
> start lenya in debug mode and set a breakpoint at line 666 (no kidding
> the 'evil' line) in AbstractUsecase then you will note requesting
> lenya.usecase=admin.usecases exactly this phenomenon.

I just placed a breakpoint in this line and tried it with a different 
usecase, it was invoked 2 times:

   * directly by the usecases.js
   * when the UsecaseProxy is initialized

Do you use the trunk or 2.0.2?

-- Andreas


> 
> The whole problem about it is that the first time all parameter are in
> the request but after that not anymore. 
> 
> My class is very simple:
> 
> public class ShowReports extends AbstractUsecase {
> ...
>  protected void prepareView() throws Exception {
>  ...
>  }
> }
> 
> Meaning I just want to override the prepareView() method. 
> 
> My xconf looks like:
> <xconf xpath="/cocoon/usecases"
> unless="/cocoon/usecases/component-instance[@name =
> 'reporter.showReports']">
>   <component-instance name="reporter.showReports"
> logger="lenya.reporter"
>     class="org.apache.lenya.modules.reporter.ShowReports">
>     <view uri="modules/reporter/usecases/showReports.jx" menu="true"
> createContinuation="false">
>       <tab group="admin" name="reporter"/>
>     </view>
>   </component-instance>
> </xconf>
> 
> Does anybody see the same problem? 
> 
> Any ideas?
> 
> salu2


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


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


Re: AbstractUsecase.getView() are called multiple times.

Posted by Thorsten Scherler <th...@apache.org>.
On Thu, 2008-12-18 at 16:26 +0100, Andreas Hartmann wrote:
> Hi Thorsten,
> 
> Thorsten Scherler schrieb:
> > I noticed in a module I am currently developing that the getView() from
> > AbstractUsecase are called multiple times. I am not sure why but it
> > feels like a bug that it is called more then once. 
> > 
> > I tried to debug and counted that the method is invoked 6 times.
> 
> the reason for this is that Usecase.getView() is called by the 
> MenuFilterTransformer because it needs the area information (which is 
> the tab group for the admin area).
> 
> I have now introduced a method Usecase.setupView(). 
> AbstractUsecase.setupView() calls prepareView(). This way, it is only 
> called once, just before the view is presented to the user.
> 
> The change should be fully backwards compatible.
> 
> Would you mind doing an SVN update and trying it again?
> 

Sweet, works for me. Thanks a million Andreas. :)

salu2

> TIA!
> 
> -- Andreas
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
> 
-- 
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>


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


Re: AbstractUsecase.getView() are called multiple times.

Posted by Andreas Hartmann <an...@apache.org>.
Hi Thorsten,

Thorsten Scherler schrieb:
> I noticed in a module I am currently developing that the getView() from
> AbstractUsecase are called multiple times. I am not sure why but it
> feels like a bug that it is called more then once. 
> 
> I tried to debug and counted that the method is invoked 6 times.

the reason for this is that Usecase.getView() is called by the 
MenuFilterTransformer because it needs the area information (which is 
the tab group for the admin area).

I have now introduced a method Usecase.setupView(). 
AbstractUsecase.setupView() calls prepareView(). This way, it is only 
called once, just before the view is presented to the user.

The change should be fully backwards compatible.

Would you mind doing an SVN update and trying it again?

TIA!

-- Andreas


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