1 16 19 20 package org.apache.pluto.portalImpl.core; 21 22 import java.util.HashMap ; 23 24 import org.apache.pluto.services.ContainerService; 25 26 public class PortletContainerEnvironment 27 implements org.apache.pluto.services.PortletContainerEnvironment { 28 29 private HashMap services = new HashMap (); 30 31 public PortletContainerEnvironment() 32 { 33 } 34 35 37 public ContainerService getContainerService(Class service) 38 { 39 return(ContainerService)services.get(service); 40 } 41 42 44 public void addContainerService(ContainerService service) 45 { 46 Class serviceClass = service.getClass(); 47 while (serviceClass!=null) { 48 Class [] interfaces = serviceClass.getInterfaces(); 49 for (int i = 0; i < interfaces.length; i++) { 50 Class [] interfaces2 = interfaces[i].getInterfaces(); 51 for (int ii = 0; ii < interfaces2.length; ii++) { 52 if (interfaces2[ii].equals(ContainerService.class)) { 53 services.put(interfaces[i], service); 54 } 55 } 56 } 57 serviceClass = serviceClass.getSuperclass(); 58 } 59 } 60 61 } 62 | Popular Tags |