|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| CustomBeanContextServiceProvider.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* EJTools, the Enterprise Java Tools
|
|
| 3 |
*
|
|
| 4 |
* Distributable under LGPL license.
|
|
| 5 |
* See terms of license at www.gnu.org.
|
|
| 6 |
*/
|
|
| 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 |
/**
|
|
| 15 |
* Super class that aggregates the Service support role, and the service provider role.
|
|
| 16 |
*
|
|
| 17 |
* @author Laurent Etiemble
|
|
| 18 |
* @version $Revision: 1.10 $
|
|
| 19 |
*/
|
|
| 20 |
public abstract class CustomBeanContextServiceProvider extends CustomBeanContextServicesSupport implements BeanContextServiceProvider |
|
| 21 |
{
|
|
| 22 |
/** Description of the Field */
|
|
| 23 |
private static Logger logger = Logger.getLogger(CustomBeanContextServiceProvider.class); |
|
| 24 |
|
|
| 25 |
|
|
| 26 |
/**
|
|
| 27 |
* Returns the Service classes provided.
|
|
| 28 |
*
|
|
| 29 |
* @return The array of service provided
|
|
| 30 |
*/
|
|
| 31 |
protected abstract Class[] getServiceClass();
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
/** Registers every service into the parent bean context */
|
|
| 35 | 0 |
protected void initializeBeanContextResources() |
| 36 |
{
|
|
| 37 | 0 |
super.initializeBeanContextResources();
|
| 38 |
|
|
| 39 | 0 |
Class[] services = this.getServiceClass();
|
| 40 | 0 |
for (int i = 0; i < services.length; i++) |
| 41 |
{
|
|
| 42 | 0 |
((BeanContextServices) this.getBeanContext()).addService(services[i], this); |
| 43 | 0 |
logger.debug("Service " + services[i] + " added"); |
| 44 |
} |
|
| 45 |
} |
|
| 46 |
|
|
| 47 |
|
|
| 48 |
/** Registers every service into the parent bean context */
|
|
| 49 | 0 |
protected void releaseBeanContextResources() |
| 50 |
{
|
|
| 51 | 0 |
Class[] services = this.getServiceClass();
|
| 52 | 0 |
for (int i = 0; i < services.length; i++) |
| 53 |
{
|
|
| 54 | 0 |
((BeanContextServices) this.getBeanContext()).revokeService(services[i], this, true); |
| 55 | 0 |
logger.debug("Service " + services[i] + " revoked"); |
| 56 |
} |
|
| 57 |
|
|
| 58 | 0 |
super.releaseBeanContextResources();
|
| 59 |
} |
|
| 60 |
} |
|
| 61 |
|
|
||||||||||