public void addPortlet(WSRPPortlet portlet) throws WSRPException {
if (portlet != null) {
super.addPortlet(portlet);
// store PortletContext to persistent file
ConsumerPortletContext consumerPortletContext = new ConsumerPortletContext();
consumerPortletContext.setPortletContext(portlet.getPortletContext());
consumerPortletContext.setPortletKey(portlet.getPortletKey());
this.contextMap.put(portlet.getPortletKey().toString(), consumerPortletContext);
// add as listener
if (portlet instanceof StateChangedService) {
((StateChangedService)portlet).addListener(this);