1 5 6 package org.exoplatform.services.wsrp.consumer.impl; 7 8 9 import java.util.Iterator ; 10 import java.util.Map ; 11 import java.util.HashMap ; 12 import org.exoplatform.services.wsrp.consumer.PortletKey; 13 import org.exoplatform.services.wsrp.consumer.PortletRegistry; 14 import org.exoplatform.services.wsrp.consumer.WSRPPortlet; 15 import org.exoplatform.services.wsrp.exceptions.WSRPException; 16 17 23 24 public class PortletRegistryImpl implements PortletRegistry{ 25 26 private Map portlets = new HashMap (); 27 28 public void addPortlet(WSRPPortlet portlet) throws WSRPException { 29 portlets.put(portlet.getPortletKey(), portlet); 30 } 31 32 public WSRPPortlet getPortlet(PortletKey portletKey) { 33 return (WSRPPortlet) portlets.get(portletKey); 34 } 35 36 public WSRPPortlet removePortlet(PortletKey portletKey) { 37 WSRPPortlet p = (WSRPPortlet) portlets.get(portletKey); 38 portlets.remove(portletKey); 39 return p; 40 } 41 42 public boolean existsPortlet(PortletKey portletKey) { 43 return portlets.containsKey(portletKey); 44 } 45 46 public Iterator getAllPortlets() { 47 return portlets.values().iterator(); 48 } 49 50 public void removeAllPortlets() { 51 portlets.clear(); 52 } 53 54 } | Popular Tags |