Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Commit

Permalink
Expose the portlet instance from the managed life cycle of the portle…
Browse files Browse the repository at this point in the history
…t container
  • Loading branch information
vietj committed Apr 2, 2013
1 parent fcf799c commit 8784966
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

import org.gatein.pc.api.info.PortletInfo;

import javax.portlet.Portlet;

/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
Expand All @@ -37,4 +39,5 @@ public interface ManagedPortletContainer extends ManagedObject

ManagedPortletApplication getManagedPortletApplication();

Portlet getPortletInstance();
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import org.gatein.pc.portlet.container.PortletContainer;
import org.gatein.pc.portlet.container.PortletFilter;

import javax.portlet.Portlet;

/**
* Contains life cycle and wiring details for the kernel environment.
*
Expand Down Expand Up @@ -87,4 +89,11 @@ public interface PortletContainerObject extends PortletContainer
* Destroys the portlet container.
*/
void destroy();

/**
* Returns the current instance held by the container.
*
* @return the instance
*/
Portlet getPortletInstance();
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import org.gatein.pc.portlet.container.PortletContainer;
import org.gatein.pc.api.info.PortletInfo;

import javax.portlet.Portlet;

/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
Expand Down Expand Up @@ -102,6 +104,12 @@ protected void invokeStop()
portletContainer.stop();
}

@Override
public Portlet getPortletInstance()
{
return portletContainer.getPortletInstance();
}

@Override
protected void invokeDestroy() throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ public ContainerPortletInfo getInfo()
throw new IllegalStateException("Portlet " + info.getName() + " is not started");
}

public Portlet getPortletInstance()
{
return portlet;
}

public String getId()
{
return info.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
import org.gatein.pc.portlet.container.object.PortletContainerObject;

import javax.portlet.Portlet;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -108,4 +109,10 @@ public PortletContainerContext getContext()
{
throw new UnsupportedOperationException();
}

@Override
public Portlet getPortletInstance()
{
throw new UnsupportedOperationException();
}
}

0 comments on commit 8784966

Please sign in to comment.