Sho SHIMIZU
Committed by Gerrit Code Review

Refactor: Rename to more descriptive name

Change-Id: I013c45690f7f405b66d656fd8e53d4a41c31e6da
......@@ -46,7 +46,7 @@ import org.onosproject.net.intent.OpticalCircuitIntent;
import org.onosproject.net.intent.OpticalConnectivityIntent;
import org.onosproject.net.intent.PointToPointIntent;
import org.onosproject.net.newresource.ResourceService;
import org.onosproject.net.resource.device.DeviceResourceStore;
import org.onosproject.net.resource.device.IntentSetMultimap;
import org.onosproject.net.resource.link.LinkResourceAllocations;
import org.onosproject.net.resource.link.LinkResourceService;
import org.onosproject.net.topology.LinkWeight;
......@@ -98,7 +98,7 @@ public class OpticalPathProvisioner {
protected DeviceService deviceService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected DeviceResourceStore deviceResourceStore;
protected IntentSetMultimap intentSetMultimap;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected LinkResourceService linkResourceService;
......@@ -385,7 +385,7 @@ public class OpticalPathProvisioner {
}
} else if (intent instanceof OpticalCircuitIntent) {
resourceService.release(intent.id());
deviceResourceStore.releaseMapping(intent.id());
intentSetMultimap.releaseMapping(intent.id());
if (lra != null) {
linkResourceService.releaseResources(lra);
}
......
......@@ -19,7 +19,7 @@ import org.onosproject.net.intent.IntentId;
import java.util.Set;
public interface DeviceResourceStore {
public interface IntentSetMultimap {
/**
* Allocates the mapping between the given intents.
......
......@@ -52,7 +52,7 @@ import org.onosproject.net.intent.impl.IntentCompilationException;
import org.onosproject.net.newresource.ResourceAllocation;
import org.onosproject.net.newresource.ResourcePath;
import org.onosproject.net.newresource.ResourceService;
import org.onosproject.net.resource.device.DeviceResourceStore;
import org.onosproject.net.resource.device.IntentSetMultimap;
import org.onosproject.net.resource.link.LinkResourceAllocations;
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
......@@ -98,7 +98,7 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu
protected ResourceService resourceService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected DeviceResourceStore deviceResourceStore;
protected IntentSetMultimap intentSetMultimap;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected IntentService intentService;
......@@ -208,7 +208,7 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu
circuitIntent = new FlowRuleIntent(appId, rules, intent.resources());
// Save circuit to connectivity intent mapping
deviceResourceStore.allocateMapping(connIntent.id(), intent.id());
intentSetMultimap.allocateMapping(connIntent.id(), intent.id());
intents.add(circuitIntent);
return intents;
......@@ -226,7 +226,7 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu
return true;
}
Set<IntentId> mapping = deviceResourceStore.getMapping(resource);
Set<IntentId> mapping = intentSetMultimap.getMapping(resource);
if (mapping == null) {
return true;
......
......@@ -23,7 +23,7 @@ import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.intent.IntentId;
import org.onosproject.net.resource.device.DeviceResourceStore;
import org.onosproject.net.resource.device.IntentSetMultimap;
import org.onosproject.store.serializers.KryoNamespaces;
import org.onosproject.store.service.ConsistentMap;
import org.onosproject.store.service.Serializer;
......@@ -37,11 +37,12 @@ import java.util.Set;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Store that manages device resources using Copycat-backed TransactionalMaps.
* A collection that maps Intent IDs as keys to values as Intent IDs,
* where each key may associated with multiple values without duplication.
*/
@Component(immediate = true, enabled = true)
@Service
public class ConsistentDeviceResourceStore implements DeviceResourceStore {
public class ConsistentIntentSetMultimap implements IntentSetMultimap {
private final Logger log = getLogger(getClass());
private static final String INTENT_MAPPING = "IntentMapping";
......