From: Julien V. <ju...@jb...> - 2006-04-14 21:51:31
|
User: julien Date: 06/04/14 17:51:27 Modified: core/src/main/org/jboss/portal/core/model/instance PortletInstanceInvoker.java Log: adding portal-wsrp.sar that is a deployable that expose the core portal portlets instances Revision Changes Path 1.2 +37 -6 jboss-portal/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceInvoker.java (In the diff below, changes in quantity of whitespace are not shown.) Index: PortletInstanceInvoker.java =================================================================== RCS file: /cvsroot/jboss/jboss-portal/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceInvoker.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- PortletInstanceInvoker.java 13 Apr 2006 20:35:28 -0000 1.1 +++ PortletInstanceInvoker.java 14 Apr 2006 21:51:27 -0000 1.2 @@ -31,15 +31,19 @@ import org.jboss.portal.common.invocation.InvocationRuntimeException; import org.jboss.portal.common.invocation.InterceptorStack; import org.jboss.portal.common.system.AbstractJBossService; +import org.jboss.portal.common.transaction.Transactions; +import org.jboss.portal.common.transaction.TransactionManagerProvider; import org.jboss.portal.server.app.WebAppRegistry; +import javax.transaction.TransactionManager; +import javax.transaction.Transaction; import java.util.Set; import java.util.Iterator; import java.util.HashSet; /** * @author <a href="mailto:ju...@jb...">Julien Viet</a> - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ public class PortletInstanceInvoker extends AbstractJBossService implements PortletInvoker { @@ -106,21 +110,48 @@ public Set getPortlets() { + try + { + TransactionManager tm = TransactionManagerProvider.JBOSS_PROVIDER.getTransactionManager(); + Transaction tx = Transactions.applyBefore(Transactions.TYPE_REQUIRED, tm); + try + { Set portlets = new HashSet(); for (Iterator i = instanceContainer.getInstances().iterator(); i.hasNext();) { Instance instance = (Instance)i.next(); Portlet portlet = getPortlet(instance.getId()); + if (portlet != null) + { portlets.add(portlet); } + } return portlets; } + finally + { + Transactions.applyAfter(Transactions.TYPE_REQUIRED, tm, tx); + } + } + catch (Exception e) + { + throw new RuntimeException(e); + } + } public Portlet getPortlet(final String portletId) { Instance instance = instanceContainer.getInstance(portletId); + if (instance == null) + { + return null; + } String containerId = instance.getComponentRef(); final PortletContainer container = registry.getPortletContainer(containerId); + if (container == null) + { + return null; + } Portlet portlet = new Portlet() { public String getId() |