org.yajul.micro
Class MicroContainer

java.lang.Object
  extended by org.picocontainer.DefaultPicoContainer
      extended by org.yajul.micro.MicroContainer
All Implemented Interfaces:
java.io.Serializable, org.picocontainer.ComponentMonitorStrategy, org.picocontainer.Disposable, org.picocontainer.MutablePicoContainer, org.picocontainer.PicoContainer, org.picocontainer.Startable

public class MicroContainer
extends org.picocontainer.DefaultPicoContainer

A picocontainer that does cacheing and auto registration of components specified as classes. It can also bootstrap itself from properties files found in the classpath. The names in the properties files are used as keys, and the values are assumed to be implementation classes. If the names are not interface names, they will be simple string keys. If the implementation class implements Configuration, then it will be immediately instantiated and the addComponents() method will be called to add more components to the container. This way you can have one class in the properties file that bootstraps all of your component definitions in a typesafe manner.
User: josh Date: Mar 5, 2008 Time: 12:10:39 PM

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.picocontainer.DefaultPicoContainer
orderedComponentAdapters
 
Constructor Summary
MicroContainer()
           
MicroContainer(org.picocontainer.ComponentFactory componentFactory)
           
MicroContainer(org.picocontainer.ComponentFactory componentFactory, org.picocontainer.LifecycleStrategy lifecycleStrategy, org.picocontainer.PicoContainer parent)
           
MicroContainer(org.picocontainer.ComponentFactory componentFactory, org.picocontainer.LifecycleStrategy lifecycleStrategy, org.picocontainer.PicoContainer parent, org.picocontainer.ComponentMonitor componentMonitor)
           
MicroContainer(org.picocontainer.ComponentFactory componentFactory, org.picocontainer.PicoContainer parent)
           
MicroContainer(org.picocontainer.ComponentMonitor monitor)
           
MicroContainer(org.picocontainer.ComponentMonitor monitor, org.picocontainer.LifecycleStrategy lifecycleStrategy, org.picocontainer.PicoContainer parent)
           
MicroContainer(org.picocontainer.ComponentMonitor monitor, org.picocontainer.PicoContainer parent)
           
MicroContainer(org.picocontainer.LifecycleStrategy lifecycleStrategy, org.picocontainer.PicoContainer parent)
           
MicroContainer(org.picocontainer.PicoContainer parent)
           
 
Method Summary
 void bootstrap(java.lang.String resourceName, java.lang.ClassLoader classLoader)
          Set up component definitions from properties resources in the classpath.
 java.lang.Object getComponent(java.lang.Object componentKeyOrType, java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
           
 java.lang.String toString()
           
 
Methods inherited from class org.picocontainer.DefaultPicoContainer
accept, addAdapter, addAdapter, addAdapterInternal, addChildContainer, addComponent, addComponent, addConfig, as, change, changeMonitor, currentMonitor, dispose, getComponent, getComponent, getComponent, getComponentAdapter, getComponentAdapter, getComponentAdapter, getComponentAdapters, getComponentAdapters, getComponentAdapters, getComponentKeyToAdapterCache, getComponents, getComponents, getModifiableComponentAdapterList, getOrderedComponentAdapters, getParent, makeChildContainer, removeChildContainer, removeComponent, removeComponentByInstance, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MicroContainer

public MicroContainer(org.picocontainer.ComponentFactory componentFactory,
                      org.picocontainer.LifecycleStrategy lifecycleStrategy,
                      org.picocontainer.PicoContainer parent,
                      org.picocontainer.ComponentMonitor componentMonitor)

MicroContainer

public MicroContainer(org.picocontainer.ComponentFactory componentFactory,
                      org.picocontainer.LifecycleStrategy lifecycleStrategy,
                      org.picocontainer.PicoContainer parent)

MicroContainer

public MicroContainer(org.picocontainer.ComponentMonitor monitor,
                      org.picocontainer.LifecycleStrategy lifecycleStrategy,
                      org.picocontainer.PicoContainer parent)

MicroContainer

public MicroContainer(org.picocontainer.LifecycleStrategy lifecycleStrategy,
                      org.picocontainer.PicoContainer parent)

MicroContainer

public MicroContainer(org.picocontainer.ComponentFactory componentFactory,
                      org.picocontainer.PicoContainer parent)

MicroContainer

public MicroContainer(org.picocontainer.ComponentMonitor monitor,
                      org.picocontainer.PicoContainer parent)

MicroContainer

public MicroContainer(org.picocontainer.ComponentFactory componentFactory)

MicroContainer

public MicroContainer(org.picocontainer.ComponentMonitor monitor)

MicroContainer

public MicroContainer(org.picocontainer.PicoContainer parent)

MicroContainer

public MicroContainer()
Method Detail

getComponent

public java.lang.Object getComponent(java.lang.Object componentKeyOrType,
                                     java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Overrides:
getComponent in class org.picocontainer.DefaultPicoContainer

bootstrap

public void bootstrap(java.lang.String resourceName,
                      java.lang.ClassLoader classLoader)
               throws java.io.IOException
Set up component definitions from properties resources in the classpath. The properties file will have a class name (interface name) as the key, and the implementation class as the value.

Parameters:
resourceName - properties resource name
classLoader - the class loader to use
Throws:
java.io.IOException - if something goes wrong.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2008. All Rights Reserved.