I was debugging the code.
And between commit that is ok and next it fails, the changes was 2.6.0-Alpha1 ->
2.6.0-Alpha3.
Also there was dropped in this commit a PortalApplicationLifecycle component that seems
that uses SessionManagerContainer to manipulate SessionContext.
So, in this change is where we have this error.
I'm trying to learn the changes in the kernel version and see how these ones have
impacted in this area to study a workaround.
Thx,
Lucas
----- Mensaje original -----
De: "Nicolas Filotto"
<nicolas.filotto(a)exoplatform.com>
Para: "Lucas Ponce" <lponce(a)redhat.com>
CC: "gatein-dev" <gatein-dev(a)lists.jboss.org>
Enviados: Jueves, 28 de Noviembre 2013 18:08:29
Asunto: Re: [gatein-dev] SessionManagerContainer in exo.kernel.container 2.6.0-Alpha3
If you use the SessionManagerContainer, why don't you have a compilation
error ?
On Thu, Nov 28, 2013 at 4:50 PM, Lucas Ponce <lponce(a)redhat.com> wrote:
> Hello Nicolas,
>
> POMSessionManager.java needs to access to SessionContext at this point:
>
> public POMSession getSession() {
> SessionContext context = configurator.getContext();
> return context != null ? (POMSession)
> context.getAttachment("mopsession") : null;
> }
>
> This is needed to PortalNamesCache.java to perform a query to
> POMDataStorage component:
>
> @Override
> public <V> V execute(POMSession session, POMTask<V> task) throws
> Exception {
> if (!session.isModified()) {
> if (task instanceof SearchTask.FindSiteKey) {
> SearchTask.FindSiteKey find = (SearchTask.FindSiteKey)
> task;
> List<PortalKey> data = (List<PortalKey>)
> session.getFromCache(find.getKey());
> if (data == null) {
> V result = super.execute(session, task);
> LazyPageList<PortalKey> list =
> (LazyPageList<PortalKey>) result;
> session.putInCache(find.getKey(),
> Collections.unmodifiableList(new ArrayList<PortalKey>(list.getAll())));
> return result;
> } else {
> return (V) new LazyPageList<PortalKey>(new
> ListAccessImpl<PortalKey>(PortalKey.class, data), 10);
> }
> } else if (task instanceof PortalConfigTask.Save || task
> instanceof PortalConfigTask.Remove) {
> V result = super.execute(session, task);
>
> session.scheduleForEviction(SearchTask.FindSiteKey.PORTAL_KEY);
>
> session.scheduleForEviction(SearchTask.FindSiteKey.GROUP_KEY);
> return result;
> }
> }
>
> //
> return super.execute(session, task);
> }
>
> With the current change of version in exo.core, the getSession() in
> POMSessionManager is always null, so a NPE is thrown breaking the POM
> service.
>
> I wonder how I can integrate these new changes to have same behaviour that
> previous version.
>
> Thanks,
> Lucas
>
>
> ----- Mensaje original -----
> > De: "Nicolas Filotto" <nicolas.filotto(a)exoplatform.com>
> > Para: "Lucas Ponce" <lponce(a)redhat.com>
> > CC: "gatein-dev" <gatein-dev(a)lists.jboss.org>
> > Enviados: Jueves, 28 de Noviembre 2013 17:29:27
> > Asunto: Re: [gatein-dev] SessionManagerContainer in exo.kernel.container
> 2.6.0-Alpha3
> >
> > What is the need exactly ? Beeing able to scope a component to a Session?
> > If so it is now possible to define a scope to a component thanks to
> >
https://jira.exoplatform.org/browse/KER-258. Out of the box, the kernel
> > supports the scope Singleton, ApplicationScoped and Dependent. By adding
> > some configuration you can extend the list to SessionScoped and
> > RequestScoped. Here is the configuration to add if you want both:
> >
> > <component>
> > <key>org.exoplatform.container.context.ContextManager</key>
> > <type>org.exoplatform.container.context.ContextManagerImpl</type>
> > <component-plugins>
> > <component-plugin>
> > <name>main-scopes</name>
> > <set-method>addContexts</set-method>
> > <type>org.exoplatform.container.context.ContextPlugin</type>
> > <init-params>
> > <object-param>
> > <name>request-scope</name>
> > <object
type="org.exoplatform.container.context.RequestContext"/>
> > </object-param>
> > <object-param>
> > <name>session-scope</name>
> > <object
type="org.exoplatform.container.context.SessionContext"/>
> > </object-param>
> > </init-params>
> > </component-plugin>
> > </component-plugins>
> > </component>
> >
> > Please note that the components that you want to scope to SessionScoped
> or
> > RequestScoped must be proxyable as they are normal scopes (which means
> that
> > you will access to the methods through a proxy and you must not access to
> > the fields directly), moreover components that you want to scope to
> > SessionScoped must be Serializable as SessionScoped is a passivating
> scope.
> >
> > Please also note that thanks to KER-252 you can use the annotations
> defined
> > in JSR 330 such as Inject
> >
> >
> > On Thu, Nov 28, 2013 at 3:36 PM, Lucas Ponce <lponce(a)redhat.com> wrote:
> >
> > > Hello,
> > >
> > > There is a issue in current master that is impacting to REST management
> > > services in GateIn.
> > >
> > >
https://issues.jboss.org/browse/GTNPORTAL-3308
> > >
> > > Investigating it looks like that issue appears since migration to
> > > 2.6.0-Alpha3 core.
> > >
> > > Main symptom is a NPE in POMSessionManager class:
> > >
> > >
> > >
>
https://github.com/gatein/gatein-portal/blob/428874e25ee9e6dada3fd1a54a4a...
> > >
> > > One of the changes of 2.6.0-Alpha3 is to drop the
> SessionManagerContainer
> > > interface from PortalContainer.
> > >
> > > Is there a workaround to access to same functionality in order to fix
> this
> > > issue ?
> > >
> > > Thanks in advance,
> > > Lucas
> > > _______________________________________________
> > > gatein-dev mailing list
> > > gatein-dev(a)lists.jboss.org
> > >
https://lists.jboss.org/mailman/listinfo/gatein-dev
> > >
> >
>