PortletApplicationEntity pae = registry.getPortletApplicationEntityList().get(ObjectIDImpl.createFromString("cocoon"));
PortletEntity portletEntity = ((PortletEntityListImpl)pae.getPortletEntityList()).add(pae, portletEntityId, coplet, registry);
if ( portletEntity.getPortletDefinition() != null ) {
// create the window
PortletWindow portletWindow = new PortletWindowImpl(portletEntityId);
((PortletWindowCtrl)portletWindow).setId(coplet.getId());
((PortletWindowCtrl)portletWindow).setPortletEntity(portletEntity);
PortletWindowList windowList = portletEntity.getPortletWindowList();
((PortletWindowListCtrl)windowList).add(portletWindow);
coplet.setTemporaryAttribute("window", portletWindow);