1 7 package org.ejtools.beans.beancontext; 8 9 import java.beans.beancontext.BeanContextServiceProvider ; 10 import java.beans.beancontext.BeanContextServices ; 11 12 import org.apache.log4j.Logger; 13 14 20 public abstract class CustomBeanContextServiceProvider extends CustomBeanContextServicesSupport implements BeanContextServiceProvider 21 { 22 23 private static Logger logger = Logger.getLogger(CustomBeanContextServiceProvider.class); 24 25 26 31 protected abstract Class [] getServiceClass(); 32 33 34 35 protected void initializeBeanContextResources() 36 { 37 super.initializeBeanContextResources(); 38 39 Class [] services = this.getServiceClass(); 40 for (int i = 0; i < services.length; i++) 41 { 42 ((BeanContextServices ) this.getBeanContext()).addService(services[i], this); 43 logger.debug("Service " + services[i] + " added"); 44 } 45 } 46 47 48 49 protected void releaseBeanContextResources() 50 { 51 Class [] services = this.getServiceClass(); 52 for (int i = 0; i < services.length; i++) 53 { 54 ((BeanContextServices ) this.getBeanContext()).revokeService(services[i], this, true); 55 logger.debug("Service " + services[i] + " revoked"); 56 } 57 58 super.releaseBeanContextResources(); 59 } 60 } 61 | Popular Tags |