* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.sparky.config.oxm;
public class OxmEntityLookup implements OxmModelProcessor {
- // TODO: kill singleton collaborator pattern
- private static OxmEntityLookup instance;
-
private Map<String, HashMap<String, String>> oxmModel;
private Map<String, DynamicType> entityTypeLookup;
private Map<String, OxmEntityDescriptor> entityDescriptors;
- private OxmEntityLookup() {
+ public OxmEntityLookup() {
oxmModel = new LinkedHashMap<String, HashMap<String, String>>();
entityTypeLookup = new LinkedHashMap<String, DynamicType>();
entityDescriptors = new HashMap<String, OxmEntityDescriptor>();
}
- public synchronized static OxmEntityLookup getInstance() {
-
- /*
- * I hate this method and I want it to go away. The singleton pattern is transitory, I want this
- * class to be wired via a bean reference instead. But from the starting point, it would require
- * fixing all the classes across the code base up front and I don't want this task to expand
- * beyond just refactoring the OxmModelLoader. For now I'll keep the singleton pattern, but I
- * really want to get rid of it once we are properly spring wired.
- */
-
- if (instance == null) {
- instance = new OxmEntityLookup();
- }
-
- return instance;
- }
-
-
@Override
public void processOxmModel(DynamicJAXBContext jaxbContext) {
public void setEntityDescriptors(Map<String, OxmEntityDescriptor> entityDescriptors) {
this.entityDescriptors = entityDescriptors;
}
-
+
public void addEntityDescriptor(String type, OxmEntityDescriptor descriptor) {
- if (this.entityDescriptors != null) {
+ if ( this.entityDescriptors != null ) {
this.entityDescriptors.put(type, descriptor);
}
}