Get types at startup
[nonrtric.git] / policy-agent / src / main / java / org / oransc / policyagent / repository / PolicyTypes.java
index 47b815b..f686ee4 100644 (file)
@@ -24,18 +24,10 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.oransc.policyagent.exceptions.ServiceException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
 
-@Component
 public class PolicyTypes {
-    private static final Logger logger = LoggerFactory.getLogger(PolicyTypes.class);
-
     private Map<String, PolicyType> types = new HashMap<String, PolicyType>();
 
-    @Autowired
     public PolicyTypes() {
     }
 
@@ -47,8 +39,15 @@ public class PolicyTypes {
         return t;
     }
 
-    public synchronized void putType(String name, PolicyType type) {
-        types.put(name, type);
+    public synchronized void put(PolicyType type) {
+        types.put(type.name(), type);
+    }
+
+    public boolean contains(PolicyType policyType) {
+        return types.containsKey(policyType.name());
     }
 
+    public int size() {
+        return types.size();
+    }
 }