Runtime components : Core components : ElementFactory
  
ElementFactory
UNICOM® Digital Transformation Toolkit (UDTT™) provides ElementFactory as a Container for Dependency Injection, you can also call it IoC (Inversion of Control) Container.
If you design your application in Object-Oriented Programming Language, your application will be composed of objects which depend on each other. The following diagram shows a complicated dependency relationship between object instances:
diagramshows a complicated dependency relationship between object instances
ElementFactory fully supports the popular design pattern Dependency Injection. You can run your application in the following phases:
1 Startup
Create object instances and assemble them together (inject dependency) to be a fully configured system.
2 Run
Handle the business logic request.
3 Tear down
Destroy the object instances when tearing down your application.
When the Java classes and interfaces are ready, ElementFactory reads the XML definition which describes how to create the object instances and how to assemble instances together (inject dependency), and then it generates a fully configured system. The following diagram shows how ElementFactory works:
diagramdescribes how ElementFactory works
Not all the objects run in the three-phases way. There are some objects that carry data (value objects), and some objects that are managed by J2EE container (Servlets, EJBs). In order to distinguish the objects managed by UDTT IoC container from those run in the three-phases way, the objects managed by UDTT Ioc are called Element, so the container is named as ElementFactory.
Other than creating and assembling element instances, ElementFactory can also manage the elements in scope (prototype or singleton) and destroy them by LifeCycle support. You can use the ElementFactory in phase 1 Startup and phase 3 Tear down.
See
Tasks
Reference
Go up to
Core components