Add simple Registry class to manage singletons 60/82860/3
authorJim Hahn <jrh3@att.com>
Wed, 20 Mar 2019 21:58:49 +0000 (17:58 -0400)
committerJim Hahn <jrh3@att.com>
Thu, 21 Mar 2019 14:12:53 +0000 (10:12 -0400)
commit4ac697769f46e3f6d52a086bcc8e15d89755dd0d
treea6a7028dd9d288730610afd1d556a646eff8afb4
parent6fb97d3373232c16823f374d637533d36ac1049c
Add simple Registry class to manage singletons

Typically, singleton classes have lots of static methods, or use
a getInstance() method to get the singleton.  This provides an alternative
mechanism, similar to the JDNI and the common-paramater property registry,
where singletons can be registered.

Clean up registry after junit test.
Modified a few comments. (I prefer 90 characters for comments.)

Added a method to register or replace an existing key without throwing
an exception.

Change-Id: I3b62719013d3b5f71adb5e9299d3c1257fb55c80
Issue-ID: POLICY-1542
Signed-off-by: Jim Hahn <jrh3@att.com>
utils/src/main/java/org/onap/policy/common/utils/services/Registry.java [new file with mode: 0644]
utils/src/test/java/org/onap/policy/common/utils/services/RegistryTest.java [new file with mode: 0644]