Skip to content
Jonathan Samples edited this page Mar 25, 2016 · 2 revisions

Dependency Injection

The sync engine uses the dependency injection (or inversion of control) pattern to structure it's code and runtime dependencies. We use the Spring framework to facilitate service (bean) creation and dependency resolution.

Because DI is so central to how the sync engine is built any other design patterns found in the code are either offshoots or adaptations of DI patterns.

Registry

Supplementing DI, we use the provider pattern. The provider pattern is where there is a provider registry for a particular type of interface, that gets injected at startup time by all of the available implementations of that interface. Then at runtime the particular provider gets chosen by the registry depending on the type of processing that needs to occur. For example, we use this for authentication because a particular ActiveStack implementation may have more than one auth provider and we need to be able to handle both kinds. The specific auth implementation to be used will be chosen by the the providerId attribute of the message that gets received by the active service when authentication occurs.

Factory

Clone this wiki locally