X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=policy-agent%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fpolicyagent%2Frepository%2FPolicyTypes.java;h=7723983191a08800fba98f380f1f0ae773d9d4dd;hb=9f9cde2f0d76ad943f5dfcf50548be5800834a2f;hp=ef3f42d4ab743fcdc848b79680ccfb5c311e92b6;hpb=3ed724aaef96d30347f9a60ca111627b28133721;p=nonrtric.git diff --git a/policy-agent/src/main/java/org/oransc/policyagent/repository/PolicyTypes.java b/policy-agent/src/main/java/org/oransc/policyagent/repository/PolicyTypes.java index ef3f42d4..77239831 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/repository/PolicyTypes.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/repository/PolicyTypes.java @@ -20,20 +20,16 @@ package org.oransc.policyagent.repository; +import java.util.Collection; +import java.util.Collections; 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; public class PolicyTypes { - private static final Logger logger = LoggerFactory.getLogger(PolicyTypes.class); - private Map types = new HashMap(); - @Autowired public PolicyTypes() { } @@ -45,8 +41,27 @@ public class PolicyTypes { return t; } - public synchronized void putType(String name, PolicyType type) { - types.put(name, type); + public synchronized PolicyType get(String name) { + return types.get(name); + } + + public synchronized void put(PolicyType type) { + types.put(type.name(), type); + } + + public synchronized boolean contains(String policyType) { + return types.containsKey(policyType); } + public synchronized Collection getAll() { + return Collections.unmodifiableCollection(types.values()); + } + + public synchronized int size() { + return types.size(); + } + + public synchronized void clear() { + this.types.clear(); + } }