org.nanocontainer.script.bsh
Class BeanShellComponentAdapter

java.lang.Object
  extended by org.picocontainer.defaults.MonitoringComponentAdapter
      extended by org.picocontainer.defaults.AbstractComponentAdapter
          extended by org.nanocontainer.script.bsh.BeanShellComponentAdapter
All Implemented Interfaces:
java.io.Serializable, org.picocontainer.ComponentAdapter, org.picocontainer.defaults.ComponentMonitorStrategy

public class BeanShellComponentAdapter
extends org.picocontainer.defaults.AbstractComponentAdapter

This adapter relies on Bsh for instantiation (and possibly also initialisation) of component instances.

When ComponentAdapter.getComponentInstance(org.picocontainer.PicoContainer) is called (by PicoContainer), the adapter instance will look for a script with the same name as the component implementation class (but with the .bsh extension). This script must reside in the same folder as the class. (It's ok to have them both in a jar).

The bsh script's only contract is that it will have to instantiate a bsh variable called "instance".

The script will have access to the following variables:

Version:
$Id: BeanShellComponentAdapter.java 3144 2006-12-26 10:12:19Z mauro $
Author:
Leo Simons, Aslak Hellesoy
See Also:
Serialized Form

Constructor Summary
BeanShellComponentAdapter(java.lang.Object componentKey, java.lang.Class componentImplementation, org.picocontainer.Parameter[] parameters)
           
BeanShellComponentAdapter(java.lang.Object componentKey, java.lang.Class componentImplementation, org.picocontainer.Parameter[] parameters, java.lang.ClassLoader classLoader)
           
 
Method Summary
 java.lang.Object getComponentInstance(org.picocontainer.PicoContainer pico)
           
 void verify(org.picocontainer.PicoContainer pico)
           
 
Methods inherited from class org.picocontainer.defaults.AbstractComponentAdapter
accept, checkTypeCompatibility, getComponentImplementation, getComponentKey, toString
 
Methods inherited from class org.picocontainer.defaults.MonitoringComponentAdapter
changeMonitor, currentMonitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BeanShellComponentAdapter

public BeanShellComponentAdapter(java.lang.Object componentKey,
                                 java.lang.Class componentImplementation,
                                 org.picocontainer.Parameter[] parameters,
                                 java.lang.ClassLoader classLoader)

BeanShellComponentAdapter

public BeanShellComponentAdapter(java.lang.Object componentKey,
                                 java.lang.Class componentImplementation,
                                 org.picocontainer.Parameter[] parameters)
Method Detail

getComponentInstance

public java.lang.Object getComponentInstance(org.picocontainer.PicoContainer pico)
                                      throws org.picocontainer.PicoInitializationException,
                                             org.picocontainer.PicoIntrospectionException
Throws:
org.picocontainer.PicoInitializationException
org.picocontainer.PicoIntrospectionException

verify

public void verify(org.picocontainer.PicoContainer pico)
            throws org.picocontainer.defaults.UnsatisfiableDependenciesException
Throws:
org.picocontainer.defaults.UnsatisfiableDependenciesException


Copyright © 2003-2010 Codehaus. All Rights Reserved.