<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">If you use the SessionManagerContainer, why don't you have a compilation error ?</span><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Thu, Nov 28, 2013 at 4:50 PM, Lucas Ponce <span dir="ltr"><<a href="mailto:lponce@redhat.com" target="_blank">lponce@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello Nicolas,<br>
<br>
POMSessionManager.java needs to access to SessionContext at this point:<br>
<br>
public POMSession getSession() {<br>
SessionContext context = configurator.getContext();<br>
return context != null ? (POMSession) context.getAttachment("mopsession") : null;<br>
}<br>
<br>
This is needed to PortalNamesCache.java to perform a query to POMDataStorage component:<br>
<br>
@Override<br>
public <V> V execute(POMSession session, POMTask<V> task) throws Exception {<br>
if (!session.isModified()) {<br>
if (task instanceof SearchTask.FindSiteKey) {<br>
SearchTask.FindSiteKey find = (SearchTask.FindSiteKey) task;<br>
List<PortalKey> data = (List<PortalKey>) session.getFromCache(find.getKey());<br>
if (data == null) {<br>
V result = super.execute(session, task);<br>
LazyPageList<PortalKey> list = (LazyPageList<PortalKey>) result;<br>
session.putInCache(find.getKey(), Collections.unmodifiableList(new ArrayList<PortalKey>(list.getAll())));<br>
return result;<br>
} else {<br>
return (V) new LazyPageList<PortalKey>(new ListAccessImpl<PortalKey>(PortalKey.class, data), 10);<br>
}<br>
} else if (task instanceof PortalConfigTask.Save || task instanceof PortalConfigTask.Remove) {<br>
V result = super.execute(session, task);<br>
session.scheduleForEviction(SearchTask.FindSiteKey.PORTAL_KEY);<br>
session.scheduleForEviction(SearchTask.FindSiteKey.GROUP_KEY);<br>
return result;<br>
}<br>
}<br>
<br>
//<br>
return super.execute(session, task);<br>
}<br>
<br>
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.<br>
<br>
I wonder how I can integrate these new changes to have same behaviour that previous version.<br>
<br>
Thanks,<br>
Lucas<br>
<br>
<br>
----- Mensaje original -----<br>
> De: "Nicolas Filotto" <<a href="mailto:nicolas.filotto@exoplatform.com">nicolas.filotto@exoplatform.com</a>><br>
> Para: "Lucas Ponce" <<a href="mailto:lponce@redhat.com">lponce@redhat.com</a>><br>
> CC: "gatein-dev" <<a href="mailto:gatein-dev@lists.jboss.org">gatein-dev@lists.jboss.org</a>><br>
> Enviados: Jueves, 28 de Noviembre 2013 17:29:27<br>
> Asunto: Re: [gatein-dev] SessionManagerContainer in exo.kernel.container 2.6.0-Alpha3<br>
<div class="HOEnZb"><div class="h5">><br>
> What is the need exactly ? Beeing able to scope a component to a Session?<br>
> If so it is now possible to define a scope to a component thanks to<br>
> <a href="https://jira.exoplatform.org/browse/KER-258" target="_blank">https://jira.exoplatform.org/browse/KER-258</a>. Out of the box, the kernel<br>
> supports the scope Singleton, ApplicationScoped and Dependent. By adding<br>
> some configuration you can extend the list to SessionScoped and<br>
> RequestScoped. Here is the configuration to add if you want both:<br>
><br>
> <component><br>
> <key>org.exoplatform.container.context.ContextManager</key><br>
> <type>org.exoplatform.container.context.ContextManagerImpl</type><br>
> <component-plugins><br>
> <component-plugin><br>
> <name>main-scopes</name><br>
> <set-method>addContexts</set-method><br>
> <type>org.exoplatform.container.context.ContextPlugin</type><br>
> <init-params><br>
> <object-param><br>
> <name>request-scope</name><br>
> <object type="org.exoplatform.container.context.RequestContext"/><br>
> </object-param><br>
> <object-param><br>
> <name>session-scope</name><br>
> <object type="org.exoplatform.container.context.SessionContext"/><br>
> </object-param><br>
> </init-params><br>
> </component-plugin><br>
> </component-plugins><br>
> </component><br>
><br>
> Please note that the components that you want to scope to SessionScoped or<br>
> RequestScoped must be proxyable as they are normal scopes (which means that<br>
> you will access to the methods through a proxy and you must not access to<br>
> the fields directly), moreover components that you want to scope to<br>
> SessionScoped must be Serializable as SessionScoped is a passivating scope.<br>
><br>
> Please also note that thanks to KER-252 you can use the annotations defined<br>
> in JSR 330 such as Inject<br>
><br>
><br>
> On Thu, Nov 28, 2013 at 3:36 PM, Lucas Ponce <<a href="mailto:lponce@redhat.com">lponce@redhat.com</a>> wrote:<br>
><br>
> > Hello,<br>
> ><br>
> > There is a issue in current master that is impacting to REST management<br>
> > services in GateIn.<br>
> ><br>
> > <a href="https://issues.jboss.org/browse/GTNPORTAL-3308" target="_blank">https://issues.jboss.org/browse/GTNPORTAL-3308</a><br>
> ><br>
> > Investigating it looks like that issue appears since migration to<br>
> > 2.6.0-Alpha3 core.<br>
> ><br>
> > Main symptom is a NPE in POMSessionManager class:<br>
> ><br>
> ><br>
> > <a href="https://github.com/gatein/gatein-portal/blob/428874e25ee9e6dada3fd1a54a4aa9f02f42d641/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java#L224-L229" target="_blank">https://github.com/gatein/gatein-portal/blob/428874e25ee9e6dada3fd1a54a4aa9f02f42d641/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java#L224-L229</a><br>
> ><br>
> > One of the changes of 2.6.0-Alpha3 is to drop the SessionManagerContainer<br>
> > interface from PortalContainer.<br>
> ><br>
> > Is there a workaround to access to same functionality in order to fix this<br>
> > issue ?<br>
> ><br>
> > Thanks in advance,<br>
> > Lucas<br>
> > _______________________________________________<br>
> > gatein-dev mailing list<br>
> > <a href="mailto:gatein-dev@lists.jboss.org">gatein-dev@lists.jboss.org</a><br>
> > <a href="https://lists.jboss.org/mailman/listinfo/gatein-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/gatein-dev</a><br>
> ><br>
><br>
</div></div></blockquote></div><br></div>