1 7 package org.ejtools.adwt.service; 8 9 import java.beans.beancontext.BeanContextServices ; 10 import java.util.Iterator ; 11 import java.util.Vector ; 12 13 import org.apache.log4j.Logger; 14 import org.ejtools.adwt.action.Command; 15 import org.ejtools.adwt.action.view.ShowConsoleAction; 16 import org.ejtools.beans.beancontext.CustomBeanContextServiceProvider; 17 18 26 public class ConsoleServiceProvider extends CustomBeanContextServiceProvider 27 { 28 29 protected ConsoleService service = null; 30 31 private static Logger logger = Logger.getLogger(ConsoleServiceProvider.class); 32 33 34 35 public ConsoleServiceProvider() 36 { 37 super(); 38 } 39 40 41 48 public Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass) 49 { 50 return (new Vector ().iterator()); 51 } 52 53 54 63 public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector) 64 { 65 return this.service; 66 } 67 68 69 74 public ConsoleService getService() 75 { 76 return service; 77 } 78 79 80 87 public void releaseService(BeanContextServices bcs, Object requestor, Object service) { } 88 89 90 93 protected Class [] getServiceClass() 94 { 95 return new Class []{ConsoleService.class}; 96 } 97 98 99 100 protected void initializeBeanContextResources() 101 { 102 super.initializeBeanContextResources(); 103 this.service = new ConsoleServiceInternalFrame(this.getBeanContext()); 104 105 this.add(new ShowConsoleAction( 106 new Command() 107 { 108 public void execute() 109 { 110 ConsoleServiceProvider.this.service.show(); 111 } 112 } 113 )); 114 115 logger.debug("Console Service installed"); 116 } 117 } 118 | Popular Tags |