Moved AbstractWebResource to api bundle so it is accessible by applications.

Change-Id: Iddfe8a7d42d432e09424cede04b6c847198a9c85
diff --git a/core/api/pom.xml b/core/api/pom.xml
index 5e98ca8..24499fb 100644
--- a/core/api/pom.xml
+++ b/core/api/pom.xml
@@ -59,6 +59,11 @@
             <groupId>org.onosproject</groupId>
             <artifactId>onlab-osgi</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onlab-rest</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 
 </project>
diff --git a/web/api/src/main/java/org/onosproject/rest/AbstractWebResource.java b/core/api/src/main/java/org/onosproject/rest/AbstractWebResource.java
similarity index 100%
rename from web/api/src/main/java/org/onosproject/rest/AbstractWebResource.java
rename to core/api/src/main/java/org/onosproject/rest/AbstractWebResource.java
diff --git a/web/api/src/main/java/org/onosproject/rest/ApplicationsWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/ApplicationsWebResource.java
similarity index 97%
rename from web/api/src/main/java/org/onosproject/rest/ApplicationsWebResource.java
rename to web/api/src/main/java/org/onosproject/rest/resources/ApplicationsWebResource.java
index 1b3bd3a..91148db 100644
--- a/web/api/src/main/java/org/onosproject/rest/ApplicationsWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/ApplicationsWebResource.java
@@ -13,11 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.rest;
+package org.onosproject.rest.resources;
 
 import org.onosproject.app.ApplicationAdminService;
 import org.onosproject.core.Application;
 import org.onosproject.core.ApplicationId;
+import org.onosproject.rest.AbstractWebResource;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
diff --git a/web/api/src/main/java/org/onosproject/rest/ClusterWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java
similarity index 96%
rename from web/api/src/main/java/org/onosproject/rest/ClusterWebResource.java
rename to web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java
index 7f15bdc..690637e 100644
--- a/web/api/src/main/java/org/onosproject/rest/ClusterWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.rest;
+package org.onosproject.rest.resources;
 
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -22,6 +22,7 @@
 import org.onosproject.cluster.ControllerNode;
 import org.onosproject.cluster.NodeId;
 import org.onosproject.codec.JsonCodec;
+import org.onosproject.rest.AbstractWebResource;
 
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
diff --git a/web/api/src/main/java/org/onosproject/rest/ComponentConfigWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/ComponentConfigWebResource.java
similarity index 97%
rename from web/api/src/main/java/org/onosproject/rest/ComponentConfigWebResource.java
rename to web/api/src/main/java/org/onosproject/rest/resources/ComponentConfigWebResource.java
index 7de3d70..1155be2 100644
--- a/web/api/src/main/java/org/onosproject/rest/ComponentConfigWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/ComponentConfigWebResource.java
@@ -13,11 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.rest;
+package org.onosproject.rest.resources;
 
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.onosproject.cfg.ComponentConfigService;
 import org.onosproject.cfg.ConfigProperty;
+import org.onosproject.rest.AbstractWebResource;
 
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
diff --git a/web/api/src/main/java/org/onosproject/rest/ConfigProvider.java b/web/api/src/main/java/org/onosproject/rest/resources/ConfigProvider.java
similarity index 99%
rename from web/api/src/main/java/org/onosproject/rest/ConfigProvider.java
rename to web/api/src/main/java/org/onosproject/rest/resources/ConfigProvider.java
index 8a9f3aa..f25531b 100644
--- a/web/api/src/main/java/org/onosproject/rest/ConfigProvider.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/ConfigProvider.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.rest;
+package org.onosproject.rest.resources;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.collect.Lists;
diff --git a/web/api/src/main/java/org/onosproject/rest/ConfigWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/ConfigWebResource.java
similarity index 98%
rename from web/api/src/main/java/org/onosproject/rest/ConfigWebResource.java
rename to web/api/src/main/java/org/onosproject/rest/resources/ConfigWebResource.java
index ce799c6..746b76a 100644
--- a/web/api/src/main/java/org/onosproject/rest/ConfigWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/ConfigWebResource.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.rest;
+package org.onosproject.rest.resources;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
diff --git a/web/api/src/main/java/org/onosproject/rest/DevicesWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/DevicesWebResource.java
similarity index 96%
rename from web/api/src/main/java/org/onosproject/rest/DevicesWebResource.java
rename to web/api/src/main/java/org/onosproject/rest/resources/DevicesWebResource.java
index 9e311d9..5e393fa 100644
--- a/web/api/src/main/java/org/onosproject/rest/DevicesWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/DevicesWebResource.java
@@ -13,12 +13,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.rest;
+package org.onosproject.rest.resources;
 
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.onosproject.net.Device;
 import org.onosproject.net.Port;
 import org.onosproject.net.device.DeviceService;
+import org.onosproject.rest.AbstractWebResource;
 
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
diff --git a/web/api/src/main/java/org/onosproject/rest/FlowsWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/FlowsWebResource.java
similarity index 97%
rename from web/api/src/main/java/org/onosproject/rest/FlowsWebResource.java
rename to web/api/src/main/java/org/onosproject/rest/resources/FlowsWebResource.java
index 9978799..49840c4 100644
--- a/web/api/src/main/java/org/onosproject/rest/FlowsWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/FlowsWebResource.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.rest;
+package org.onosproject.rest.resources;
 
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -23,6 +23,7 @@
 import org.onosproject.net.device.DeviceService;
 import org.onosproject.net.flow.FlowEntry;
 import org.onosproject.net.flow.FlowRuleService;
+import org.onosproject.rest.AbstractWebResource;
 
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
diff --git a/web/api/src/main/java/org/onosproject/rest/HostsWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/HostsWebResource.java
similarity index 96%
rename from web/api/src/main/java/org/onosproject/rest/HostsWebResource.java
rename to web/api/src/main/java/org/onosproject/rest/resources/HostsWebResource.java
index 8854003..7b24929 100644
--- a/web/api/src/main/java/org/onosproject/rest/HostsWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/HostsWebResource.java
@@ -13,7 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.rest;
+package org.onosproject.rest.resources;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.net.Host;
+import org.onosproject.net.host.HostService;
+import org.onosproject.rest.AbstractWebResource;
 
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
@@ -22,11 +27,6 @@
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
-import org.onosproject.net.Host;
-import org.onosproject.net.host.HostService;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
 import static org.onlab.util.Tools.nullIsNotFound;
 import static org.onosproject.net.HostId.hostId;
 
diff --git a/web/api/src/main/java/org/onosproject/rest/IntentsWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/IntentsWebResource.java
similarity index 98%
rename from web/api/src/main/java/org/onosproject/rest/IntentsWebResource.java
rename to web/api/src/main/java/org/onosproject/rest/resources/IntentsWebResource.java
index 6c25482..f49e6be 100644
--- a/web/api/src/main/java/org/onosproject/rest/IntentsWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/IntentsWebResource.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.rest;
+package org.onosproject.rest.resources;
 
 import java.util.Objects;
 import java.util.concurrent.CountDownLatch;
@@ -37,6 +37,7 @@
 import org.onosproject.net.intent.IntentState;
 import org.onosproject.net.intent.Key;
 import org.onosproject.net.intent.PointToPointIntent;
+import org.onosproject.rest.AbstractWebResource;
 import org.slf4j.Logger;
 
 import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/web/api/src/main/java/org/onosproject/rest/JsonBodyWriter.java b/web/api/src/main/java/org/onosproject/rest/resources/JsonBodyWriter.java
similarity index 97%
rename from web/api/src/main/java/org/onosproject/rest/JsonBodyWriter.java
rename to web/api/src/main/java/org/onosproject/rest/resources/JsonBodyWriter.java
index 19635b7..31f2069 100644
--- a/web/api/src/main/java/org/onosproject/rest/JsonBodyWriter.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/JsonBodyWriter.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.rest;
+package org.onosproject.rest.resources;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/web/api/src/main/java/org/onosproject/rest/LinksWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/LinksWebResource.java
similarity index 92%
rename from web/api/src/main/java/org/onosproject/rest/LinksWebResource.java
rename to web/api/src/main/java/org/onosproject/rest/resources/LinksWebResource.java
index 90e6b93..1ef6b3f 100644
--- a/web/api/src/main/java/org/onosproject/rest/LinksWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/LinksWebResource.java
@@ -13,12 +13,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.rest;
+package org.onosproject.rest.resources;
 
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.Link;
 import org.onosproject.net.link.LinkService;
+import org.onosproject.rest.AbstractWebResource;
 
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
@@ -27,7 +28,6 @@
 
 import static org.onosproject.net.DeviceId.deviceId;
 import static org.onosproject.net.PortNumber.portNumber;
-import static org.onosproject.rest.LinksWebResource.Direction.valueOf;
 
 /**
  * REST resource for interacting with the inventory of infrastructure links.
@@ -60,7 +60,7 @@
                                                 String direction,
                                                 LinkService service) {
         Direction dir = direction != null ?
-                valueOf(direction.toUpperCase()) : Direction.ALL;
+                Direction.valueOf(direction.toUpperCase()) : Direction.ALL;
         switch (dir) {
             case INGRESS:
                 return service.getIngressLinks(point);
@@ -75,7 +75,7 @@
                                           String direction,
                                           LinkService service) {
         Direction dir = direction != null ?
-                valueOf(direction.toUpperCase()) : Direction.ALL;
+                Direction.valueOf(direction.toUpperCase()) : Direction.ALL;
         switch (dir) {
             case INGRESS:
                 return service.getDeviceIngressLinks(deviceId);
diff --git a/web/api/src/main/java/org/onosproject/rest/PathsWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/PathsWebResource.java
similarity index 96%
rename from web/api/src/main/java/org/onosproject/rest/PathsWebResource.java
rename to web/api/src/main/java/org/onosproject/rest/resources/PathsWebResource.java
index 063f6e5..a97a933 100644
--- a/web/api/src/main/java/org/onosproject/rest/PathsWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/PathsWebResource.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.rest;
+package org.onosproject.rest.resources;
 
 import java.util.Set;
 
@@ -30,6 +30,7 @@
 import org.onosproject.net.topology.PathService;
 
 import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.rest.AbstractWebResource;
 
 /**
  * REST resource for interacting with path calculations.
diff --git a/web/api/src/main/java/org/onosproject/rest/TopologyWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/TopologyWebResource.java
similarity index 98%
rename from web/api/src/main/java/org/onosproject/rest/TopologyWebResource.java
rename to web/api/src/main/java/org/onosproject/rest/resources/TopologyWebResource.java
index c1a8fcf..55b6803 100644
--- a/web/api/src/main/java/org/onosproject/rest/TopologyWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/TopologyWebResource.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.rest;
+package org.onosproject.rest.resources;
 
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -26,6 +26,7 @@
 import org.onosproject.net.topology.Topology;
 import org.onosproject.net.topology.TopologyCluster;
 import org.onosproject.net.topology.TopologyService;
+import org.onosproject.rest.AbstractWebResource;
 
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
diff --git a/web/api/src/main/java/org/onosproject/rest/package-info.java b/web/api/src/main/java/org/onosproject/rest/resources/package-info.java
similarity index 94%
rename from web/api/src/main/java/org/onosproject/rest/package-info.java
rename to web/api/src/main/java/org/onosproject/rest/resources/package-info.java
index 8ec4d35..5eb305c 100644
--- a/web/api/src/main/java/org/onosproject/rest/package-info.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/package-info.java
@@ -17,4 +17,4 @@
 /**
  * Set of resources implementing the ONOS REST API.
  */
-package org.onosproject.rest;
+package org.onosproject.rest.resources;
diff --git a/web/api/src/main/webapp/WEB-INF/web.xml b/web/api/src/main/webapp/WEB-INF/web.xml
index e018c6f..a3e2060 100644
--- a/web/api/src/main/webapp/WEB-INF/web.xml
+++ b/web/api/src/main/webapp/WEB-INF/web.xml
@@ -61,19 +61,19 @@
                 org.onosproject.rest.exceptions.ServerErrorMapper,
                 org.onosproject.rest.exceptions.BadRequestMapper,
                 org.onosproject.rest.exceptions.WebApplicationExceptionMapper,
-                org.onosproject.rest.JsonBodyWriter,
+                org.onosproject.rest.resources.JsonBodyWriter,
 
-                org.onosproject.rest.ApplicationsWebResource,
-                org.onosproject.rest.ComponentConfigWebResource,
-                org.onosproject.rest.ClusterWebResource,
-                org.onosproject.rest.DevicesWebResource,
-                org.onosproject.rest.LinksWebResource,
-                org.onosproject.rest.HostsWebResource,
-                org.onosproject.rest.IntentsWebResource,
-                org.onosproject.rest.FlowsWebResource,
-                org.onosproject.rest.TopologyWebResource,
-                org.onosproject.rest.ConfigWebResource,
-                org.onosproject.rest.PathsWebResource
+                org.onosproject.rest.resources.ApplicationsWebResource,
+                org.onosproject.rest.resources.ComponentConfigWebResource,
+                org.onosproject.rest.resources.ClusterWebResource,
+                org.onosproject.rest.resources.DevicesWebResource,
+                org.onosproject.rest.resources.LinksWebResource,
+                org.onosproject.rest.resources.HostsWebResource,
+                org.onosproject.rest.resources.IntentsWebResource,
+                org.onosproject.rest.resources.FlowsWebResource,
+                org.onosproject.rest.resources.TopologyWebResource,
+                org.onosproject.rest.resources.ConfigWebResource,
+                org.onosproject.rest.resources.PathsWebResource
             </param-value>
         </init-param>
         <load-on-startup>1</load-on-startup>