Introduction
NanoContainer is collection of bespoke containers that deliver extra
value to PicoContainer.
StringRegistrationNanoContainer
This container takes strings (class names) instead of class definitions
as PicoContainer does. This basically means that components can
be
soft configured one by one.
Implementations -
- StringRegistrationNanoContainerImpl - takes a parent
container
- StringRegistrationNanoContainerImpl.Default - no args
StringRegistrationNanoContainer nc = new StringRegistrationNanoContainerImpl.Default();
nc.registerComponent("org.org.nanocontainer.testmodel.DefaultWebServerConfig");
nc.registerComponent("org.org.nanocontainer.testmodel.WebServer", "org.org.nanocontainer.testmodel.WebServerImpl");
nc.start();
InputSourceRegistrationNanoContainer
This container takes a single InputSource (from the SAX API) .
This basically
means that components can be
soft configured in a single document. The single implementation
takes
a DOM document. That document mabe inlined or external to the class
that uses the container. External could be on file system, in jar, on
URL, in fact anything.
Implementations -
- DomRegistrationNanoContainer - document builder (DOM) and parent
container
- DomRegistrationNanoContainer.Default - no args
- DomRegistrationNanoContainer.WithParentContainer - parent
container
- DomRegistrationNanoContainer.WithDocumentBuilder - document
builder
InputSourceRegistrationNanoContainer nc = new DomRegistrationNanoContainer.Default();
nc.registerComponents(new InputSource(new StringReader(
"<components>" +
" <component class=\"org.org.nanocontainer.testmodel.DefaultWebServerConfig\"/>" +
" <component type=\"org.org.nanocontainer.testmodel.WebServer\" class=\"org.org.nanocontainer.testmodel.WebServerImpl\"/>" +
"</components>")));
nc.start();
AggregatingNanoContainer
This container takes many components and aggregates them together to
become a single component that offers all of the methods that each
would individually offer.
Implementations -
- AggregatingNanoContainer - object array of components, invocation
handler
- AggregatingNanoContainer.ComponentsFromContainer - container ro
aggregate components for, invocation handler
- AggregatingNanoContainer.Default - container ro
aggregate components for
PicoContainer pc = // some Picocontainer with components in it.
AggregatedContainersContainer acc = new AggregatedContainersContainer(pc,getComponents());
NanningComponentFactory
The nanning component factory basically adds aspect orientated
programming (AOP) capability to arbitary components with a normal
PicoContainer.