Refactor: Rename ResourcePath to Resource for a better name

Also the followings
- Rename variables from path to resource
- Update Javadoc

Change-Id: I07da7e7d13882f2134a3687c66ed91a9de5b0849
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MplsPathIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MplsPathIntentCompiler.java
index 5549918..a9bf1b7 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MplsPathIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MplsPathIntentCompiler.java
@@ -49,7 +49,7 @@
 import org.onosproject.net.intent.IntentCompiler;
 import org.onosproject.net.intent.IntentExtensionService;
 import org.onosproject.net.intent.MplsPathIntent;
-import org.onosproject.net.newresource.ResourcePath;
+import org.onosproject.net.newresource.Resource;
 import org.onosproject.net.newresource.ResourceService;
 import org.onosproject.net.resource.link.LinkResourceAllocations;
 import org.slf4j.Logger;
@@ -123,10 +123,10 @@
 
         // for short term solution: same label is used for both directions
         // TODO: introduce the concept of Tx and Rx resources of a port
-        Set<ResourcePath> resources = labels.entrySet().stream()
+        Set<Resource> resources = labels.entrySet().stream()
                 .flatMap(x -> Stream.of(
-                        ResourcePath.discrete(x.getKey().src().deviceId(), x.getKey().src().port(), x.getValue()),
-                        ResourcePath.discrete(x.getKey().dst().deviceId(), x.getKey().dst().port(), x.getValue())
+                        Resource.discrete(x.getKey().src().deviceId(), x.getKey().src().port(), x.getValue()),
+                        Resource.discrete(x.getKey().dst().deviceId(), x.getKey().dst().port(), x.getValue())
                 ))
                 .collect(Collectors.toSet());
         List<org.onosproject.net.newresource.ResourceAllocation> allocations =
@@ -154,7 +154,7 @@
     }
 
     private Set<MplsLabel> findMplsLabel(ConnectPoint cp) {
-        return resourceService.getAvailableResources(ResourcePath.discrete(cp.deviceId(), cp.port())).stream()
+        return resourceService.getAvailableResources(Resource.discrete(cp.deviceId(), cp.port())).stream()
                 .filter(x -> x.last() instanceof MplsLabel)
                 .map(x -> (MplsLabel) x.last())
                 .collect(Collectors.toSet());
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java
index 2c547ea..9bcd7a9 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java
@@ -50,7 +50,7 @@
 import org.onosproject.net.intent.OpticalConnectivityIntent;
 import org.onosproject.net.intent.impl.IntentCompilationException;
 import org.onosproject.net.newresource.ResourceAllocation;
-import org.onosproject.net.newresource.ResourcePath;
+import org.onosproject.net.newresource.Resource;
 import org.onosproject.net.newresource.ResourceService;
 import org.onosproject.net.resource.device.IntentSetMultimap;
 import org.onosproject.net.resource.link.LinkResourceAllocations;
@@ -160,9 +160,9 @@
         log.debug("Compiling optical circuit intent between {} and {}", src, dst);
 
         // Reserve OduClt ports
-        ResourcePath srcPortPath = ResourcePath.discrete(src.deviceId(), src.port());
-        ResourcePath dstPortPath = ResourcePath.discrete(dst.deviceId(), dst.port());
-        List<ResourceAllocation> allocation = resourceService.allocate(intent.id(), srcPortPath, dstPortPath);
+        Resource srcPortResource = Resource.discrete(src.deviceId(), src.port());
+        Resource dstPortResource = Resource.discrete(dst.deviceId(), dst.port());
+        List<ResourceAllocation> allocation = resourceService.allocate(intent.id(), srcPortResource, dstPortResource);
         if (allocation.isEmpty()) {
             throw new IntentCompilationException("Unable to reserve ports for intent " + intent);
         }
@@ -312,7 +312,7 @@
         if (ochCP != null) {
             OchPort ochPort = (OchPort) deviceService.getPort(ochCP.deviceId(), ochCP.port());
             Optional<IntentId> intentId =
-                    resourceService.getResourceAllocation(ResourcePath.discrete(ochCP.deviceId(), ochCP.port()))
+                    resourceService.getResourceAllocation(Resource.discrete(ochCP.deviceId(), ochCP.port()))
                             .stream()
                             .map(ResourceAllocation::consumer)
                             .filter(x -> x instanceof IntentId)
@@ -333,7 +333,7 @@
             }
 
             Optional<IntentId> intentId =
-                    resourceService.getResourceAllocation(ResourcePath.discrete(oduPort.deviceId(), port.number()))
+                    resourceService.getResourceAllocation(Resource.discrete(oduPort.deviceId(), port.number()))
                             .stream()
                             .map(ResourceAllocation::consumer)
                             .filter(x -> x instanceof IntentId)
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
index 2d4545c..44d0894 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
@@ -44,7 +44,7 @@
 import org.onosproject.net.intent.OpticalPathIntent;
 import org.onosproject.net.intent.impl.IntentCompilationException;
 import org.onosproject.net.newresource.ResourceAllocation;
-import org.onosproject.net.newresource.ResourcePath;
+import org.onosproject.net.newresource.Resource;
 import org.onosproject.net.newresource.ResourceService;
 import org.onosproject.net.resource.link.LinkResourceAllocations;
 import org.onosproject.net.topology.LinkWeight;
@@ -109,10 +109,10 @@
         log.debug("Compiling optical connectivity intent between {} and {}", src, dst);
 
         // Reserve OCh ports
-        ResourcePath srcPortPath = ResourcePath.discrete(src.deviceId(), src.port());
-        ResourcePath dstPortPath = ResourcePath.discrete(dst.deviceId(), dst.port());
+        Resource srcPortResource = Resource.discrete(src.deviceId(), src.port());
+        Resource dstPortResource = Resource.discrete(dst.deviceId(), dst.port());
         List<org.onosproject.net.newresource.ResourceAllocation> allocation =
-                resourceService.allocate(intent.id(), srcPortPath, dstPortPath);
+                resourceService.allocate(intent.id(), srcPortResource, dstPortResource);
         if (allocation.isEmpty()) {
             throw new IntentCompilationException("Unable to reserve ports for intent " + intent);
         }
@@ -182,10 +182,10 @@
         }
 
         List<OchSignal> minLambda = findFirstLambda(lambdas, slotCount());
-        List<ResourcePath> lambdaResources = path.links().stream()
+        List<Resource> lambdaResources = path.links().stream()
                 .flatMap(x -> Stream.of(
-                        ResourcePath.discrete(x.src().deviceId(), x.src().port()),
-                        ResourcePath.discrete(x.dst().deviceId(), x.dst().port())
+                        Resource.discrete(x.src().deviceId(), x.src().port()),
+                        Resource.discrete(x.dst().deviceId(), x.dst().port())
                 ))
                 .flatMap(x -> minLambda.stream().map(l -> x.child(l)))
                 .collect(Collectors.toList());
@@ -214,8 +214,8 @@
     private Set<OchSignal> findCommonLambdasOverLinks(List<Link> links) {
         return links.stream()
                 .flatMap(x -> Stream.of(
-                        ResourcePath.discrete(x.src().deviceId(), x.src().port()),
-                        ResourcePath.discrete(x.dst().deviceId(), x.dst().port())
+                        Resource.discrete(x.src().deviceId(), x.src().port()),
+                        Resource.discrete(x.dst().deviceId(), x.dst().port())
                 ))
                 .map(resourceService::getAvailableResources)
                 .map(x -> Iterables.filter(x, r -> r.last() instanceof OchSignal))
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathIntentCompiler.java
index ffced6c..ec7cfd7 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathIntentCompiler.java
@@ -44,7 +44,7 @@
 import org.onosproject.net.intent.PathIntent;
 import org.onosproject.net.intent.constraint.EncapsulationConstraint;
 import org.onosproject.net.intent.impl.IntentCompilationException;
-import org.onosproject.net.newresource.ResourcePath;
+import org.onosproject.net.newresource.Resource;
 import org.onosproject.net.newresource.ResourceService;
 import org.onosproject.net.resource.link.LinkResourceAllocations;
 import org.slf4j.Logger;
@@ -250,10 +250,10 @@
         }
 
         //same VLANID is used for both directions
-        Set<ResourcePath> resources = vlanIds.entrySet().stream()
+        Set<Resource> resources = vlanIds.entrySet().stream()
                 .flatMap(x -> Stream.of(
-                        ResourcePath.discrete(x.getKey().src().deviceId(), x.getKey().src().port(), x.getValue()),
-                        ResourcePath.discrete(x.getKey().dst().deviceId(), x.getKey().dst().port(), x.getValue())
+                        Resource.discrete(x.getKey().src().deviceId(), x.getKey().src().port(), x.getValue()),
+                        Resource.discrete(x.getKey().dst().deviceId(), x.getKey().dst().port(), x.getValue())
                 ))
                 .collect(Collectors.toSet());
         List<org.onosproject.net.newresource.ResourceAllocation> allocations =
@@ -280,7 +280,7 @@
     }
 
     private Set<VlanId> findVlanId(ConnectPoint cp) {
-        return resourceService.getAvailableResources(ResourcePath.discrete(cp.deviceId(), cp.port())).stream()
+        return resourceService.getAvailableResources(Resource.discrete(cp.deviceId(), cp.port())).stream()
                 .filter(x -> x.last() instanceof VlanId)
                 .map(x -> (VlanId) x.last())
                 .collect(Collectors.toSet());