Jonathan Hart
Committed by Gerrit Code Review

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

Change-Id: Iddfe8a7d42d432e09424cede04b6c847198a9c85
Showing 17 changed files with 47 additions and 34 deletions
...@@ -59,6 +59,11 @@ ...@@ -59,6 +59,11 @@
59 <groupId>org.onosproject</groupId> 59 <groupId>org.onosproject</groupId>
60 <artifactId>onlab-osgi</artifactId> 60 <artifactId>onlab-osgi</artifactId>
61 </dependency> 61 </dependency>
62 + <dependency>
63 + <groupId>org.onosproject</groupId>
64 + <artifactId>onlab-rest</artifactId>
65 + <version>${project.version}</version>
66 + </dependency>
62 </dependencies> 67 </dependencies>
63 68
64 </project> 69 </project>
......
...@@ -13,11 +13,12 @@ ...@@ -13,11 +13,12 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.rest; 16 +package org.onosproject.rest.resources;
17 17
18 import org.onosproject.app.ApplicationAdminService; 18 import org.onosproject.app.ApplicationAdminService;
19 import org.onosproject.core.Application; 19 import org.onosproject.core.Application;
20 import org.onosproject.core.ApplicationId; 20 import org.onosproject.core.ApplicationId;
21 +import org.onosproject.rest.AbstractWebResource;
21 22
22 import javax.ws.rs.Consumes; 23 import javax.ws.rs.Consumes;
23 import javax.ws.rs.DELETE; 24 import javax.ws.rs.DELETE;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.rest; 16 +package org.onosproject.rest.resources;
17 17
18 import com.fasterxml.jackson.databind.node.ArrayNode; 18 import com.fasterxml.jackson.databind.node.ArrayNode;
19 import com.fasterxml.jackson.databind.node.ObjectNode; 19 import com.fasterxml.jackson.databind.node.ObjectNode;
...@@ -22,6 +22,7 @@ import org.onosproject.cluster.ClusterService; ...@@ -22,6 +22,7 @@ import org.onosproject.cluster.ClusterService;
22 import org.onosproject.cluster.ControllerNode; 22 import org.onosproject.cluster.ControllerNode;
23 import org.onosproject.cluster.NodeId; 23 import org.onosproject.cluster.NodeId;
24 import org.onosproject.codec.JsonCodec; 24 import org.onosproject.codec.JsonCodec;
25 +import org.onosproject.rest.AbstractWebResource;
25 26
26 import javax.ws.rs.GET; 27 import javax.ws.rs.GET;
27 import javax.ws.rs.POST; 28 import javax.ws.rs.POST;
......
...@@ -13,11 +13,12 @@ ...@@ -13,11 +13,12 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.rest; 16 +package org.onosproject.rest.resources;
17 17
18 import com.fasterxml.jackson.databind.node.ObjectNode; 18 import com.fasterxml.jackson.databind.node.ObjectNode;
19 import org.onosproject.cfg.ComponentConfigService; 19 import org.onosproject.cfg.ComponentConfigService;
20 import org.onosproject.cfg.ConfigProperty; 20 import org.onosproject.cfg.ConfigProperty;
21 +import org.onosproject.rest.AbstractWebResource;
21 22
22 import javax.ws.rs.DELETE; 23 import javax.ws.rs.DELETE;
23 import javax.ws.rs.GET; 24 import javax.ws.rs.GET;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.rest; 16 +package org.onosproject.rest.resources;
17 17
18 import com.fasterxml.jackson.databind.JsonNode; 18 import com.fasterxml.jackson.databind.JsonNode;
19 import com.google.common.collect.Lists; 19 import com.google.common.collect.Lists;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.rest; 16 +package org.onosproject.rest.resources;
17 17
18 import com.fasterxml.jackson.databind.JsonNode; 18 import com.fasterxml.jackson.databind.JsonNode;
19 import com.fasterxml.jackson.databind.ObjectMapper; 19 import com.fasterxml.jackson.databind.ObjectMapper;
......
...@@ -13,12 +13,13 @@ ...@@ -13,12 +13,13 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.rest; 16 +package org.onosproject.rest.resources;
17 17
18 import com.fasterxml.jackson.databind.node.ObjectNode; 18 import com.fasterxml.jackson.databind.node.ObjectNode;
19 import org.onosproject.net.Device; 19 import org.onosproject.net.Device;
20 import org.onosproject.net.Port; 20 import org.onosproject.net.Port;
21 import org.onosproject.net.device.DeviceService; 21 import org.onosproject.net.device.DeviceService;
22 +import org.onosproject.rest.AbstractWebResource;
22 23
23 import javax.ws.rs.GET; 24 import javax.ws.rs.GET;
24 import javax.ws.rs.Path; 25 import javax.ws.rs.Path;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.rest; 16 +package org.onosproject.rest.resources;
17 17
18 import com.fasterxml.jackson.databind.node.ArrayNode; 18 import com.fasterxml.jackson.databind.node.ArrayNode;
19 import com.fasterxml.jackson.databind.node.ObjectNode; 19 import com.fasterxml.jackson.databind.node.ObjectNode;
...@@ -23,6 +23,7 @@ import org.onosproject.net.DeviceId; ...@@ -23,6 +23,7 @@ import org.onosproject.net.DeviceId;
23 import org.onosproject.net.device.DeviceService; 23 import org.onosproject.net.device.DeviceService;
24 import org.onosproject.net.flow.FlowEntry; 24 import org.onosproject.net.flow.FlowEntry;
25 import org.onosproject.net.flow.FlowRuleService; 25 import org.onosproject.net.flow.FlowRuleService;
26 +import org.onosproject.rest.AbstractWebResource;
26 27
27 import javax.ws.rs.GET; 28 import javax.ws.rs.GET;
28 import javax.ws.rs.Path; 29 import javax.ws.rs.Path;
......
...@@ -13,7 +13,12 @@ ...@@ -13,7 +13,12 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.rest; 16 +package org.onosproject.rest.resources;
17 +
18 +import com.fasterxml.jackson.databind.node.ObjectNode;
19 +import org.onosproject.net.Host;
20 +import org.onosproject.net.host.HostService;
21 +import org.onosproject.rest.AbstractWebResource;
17 22
18 import javax.ws.rs.GET; 23 import javax.ws.rs.GET;
19 import javax.ws.rs.Path; 24 import javax.ws.rs.Path;
...@@ -22,11 +27,6 @@ import javax.ws.rs.Produces; ...@@ -22,11 +27,6 @@ import javax.ws.rs.Produces;
22 import javax.ws.rs.core.MediaType; 27 import javax.ws.rs.core.MediaType;
23 import javax.ws.rs.core.Response; 28 import javax.ws.rs.core.Response;
24 29
25 -import org.onosproject.net.Host;
26 -import org.onosproject.net.host.HostService;
27 -
28 -import com.fasterxml.jackson.databind.node.ObjectNode;
29 -
30 import static org.onlab.util.Tools.nullIsNotFound; 30 import static org.onlab.util.Tools.nullIsNotFound;
31 import static org.onosproject.net.HostId.hostId; 31 import static org.onosproject.net.HostId.hostId;
32 32
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.rest; 16 +package org.onosproject.rest.resources;
17 17
18 import java.util.Objects; 18 import java.util.Objects;
19 import java.util.concurrent.CountDownLatch; 19 import java.util.concurrent.CountDownLatch;
...@@ -37,6 +37,7 @@ import org.onosproject.net.intent.IntentService; ...@@ -37,6 +37,7 @@ import org.onosproject.net.intent.IntentService;
37 import org.onosproject.net.intent.IntentState; 37 import org.onosproject.net.intent.IntentState;
38 import org.onosproject.net.intent.Key; 38 import org.onosproject.net.intent.Key;
39 import org.onosproject.net.intent.PointToPointIntent; 39 import org.onosproject.net.intent.PointToPointIntent;
40 +import org.onosproject.rest.AbstractWebResource;
40 import org.slf4j.Logger; 41 import org.slf4j.Logger;
41 42
42 import com.fasterxml.jackson.databind.node.ObjectNode; 43 import com.fasterxml.jackson.databind.node.ObjectNode;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.rest; 16 +package org.onosproject.rest.resources;
17 17
18 import com.fasterxml.jackson.databind.ObjectMapper; 18 import com.fasterxml.jackson.databind.ObjectMapper;
19 import com.fasterxml.jackson.databind.node.ObjectNode; 19 import com.fasterxml.jackson.databind.node.ObjectNode;
......
...@@ -13,12 +13,13 @@ ...@@ -13,12 +13,13 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.rest; 16 +package org.onosproject.rest.resources;
17 17
18 import org.onosproject.net.ConnectPoint; 18 import org.onosproject.net.ConnectPoint;
19 import org.onosproject.net.DeviceId; 19 import org.onosproject.net.DeviceId;
20 import org.onosproject.net.Link; 20 import org.onosproject.net.Link;
21 import org.onosproject.net.link.LinkService; 21 import org.onosproject.net.link.LinkService;
22 +import org.onosproject.rest.AbstractWebResource;
22 23
23 import javax.ws.rs.GET; 24 import javax.ws.rs.GET;
24 import javax.ws.rs.Path; 25 import javax.ws.rs.Path;
...@@ -27,7 +28,6 @@ import javax.ws.rs.core.Response; ...@@ -27,7 +28,6 @@ import javax.ws.rs.core.Response;
27 28
28 import static org.onosproject.net.DeviceId.deviceId; 29 import static org.onosproject.net.DeviceId.deviceId;
29 import static org.onosproject.net.PortNumber.portNumber; 30 import static org.onosproject.net.PortNumber.portNumber;
30 -import static org.onosproject.rest.LinksWebResource.Direction.valueOf;
31 31
32 /** 32 /**
33 * REST resource for interacting with the inventory of infrastructure links. 33 * REST resource for interacting with the inventory of infrastructure links.
...@@ -60,7 +60,7 @@ public class LinksWebResource extends AbstractWebResource { ...@@ -60,7 +60,7 @@ public class LinksWebResource extends AbstractWebResource {
60 String direction, 60 String direction,
61 LinkService service) { 61 LinkService service) {
62 Direction dir = direction != null ? 62 Direction dir = direction != null ?
63 - valueOf(direction.toUpperCase()) : Direction.ALL; 63 + Direction.valueOf(direction.toUpperCase()) : Direction.ALL;
64 switch (dir) { 64 switch (dir) {
65 case INGRESS: 65 case INGRESS:
66 return service.getIngressLinks(point); 66 return service.getIngressLinks(point);
...@@ -75,7 +75,7 @@ public class LinksWebResource extends AbstractWebResource { ...@@ -75,7 +75,7 @@ public class LinksWebResource extends AbstractWebResource {
75 String direction, 75 String direction,
76 LinkService service) { 76 LinkService service) {
77 Direction dir = direction != null ? 77 Direction dir = direction != null ?
78 - valueOf(direction.toUpperCase()) : Direction.ALL; 78 + Direction.valueOf(direction.toUpperCase()) : Direction.ALL;
79 switch (dir) { 79 switch (dir) {
80 case INGRESS: 80 case INGRESS:
81 return service.getDeviceIngressLinks(deviceId); 81 return service.getDeviceIngressLinks(deviceId);
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.rest; 16 +package org.onosproject.rest.resources;
17 17
18 import java.util.Set; 18 import java.util.Set;
19 19
...@@ -30,6 +30,7 @@ import org.onosproject.net.HostId; ...@@ -30,6 +30,7 @@ import org.onosproject.net.HostId;
30 import org.onosproject.net.topology.PathService; 30 import org.onosproject.net.topology.PathService;
31 31
32 import com.fasterxml.jackson.databind.node.ObjectNode; 32 import com.fasterxml.jackson.databind.node.ObjectNode;
33 +import org.onosproject.rest.AbstractWebResource;
33 34
34 /** 35 /**
35 * REST resource for interacting with path calculations. 36 * REST resource for interacting with path calculations.
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.rest; 16 +package org.onosproject.rest.resources;
17 17
18 import com.fasterxml.jackson.databind.node.ArrayNode; 18 import com.fasterxml.jackson.databind.node.ArrayNode;
19 import com.fasterxml.jackson.databind.node.ObjectNode; 19 import com.fasterxml.jackson.databind.node.ObjectNode;
...@@ -26,6 +26,7 @@ import org.onosproject.net.topology.ClusterId; ...@@ -26,6 +26,7 @@ import org.onosproject.net.topology.ClusterId;
26 import org.onosproject.net.topology.Topology; 26 import org.onosproject.net.topology.Topology;
27 import org.onosproject.net.topology.TopologyCluster; 27 import org.onosproject.net.topology.TopologyCluster;
28 import org.onosproject.net.topology.TopologyService; 28 import org.onosproject.net.topology.TopologyService;
29 +import org.onosproject.rest.AbstractWebResource;
29 30
30 import javax.ws.rs.GET; 31 import javax.ws.rs.GET;
31 import javax.ws.rs.Path; 32 import javax.ws.rs.Path;
......
...@@ -17,4 +17,4 @@ ...@@ -17,4 +17,4 @@
17 /** 17 /**
18 * Set of resources implementing the ONOS REST API. 18 * Set of resources implementing the ONOS REST API.
19 */ 19 */
20 -package org.onosproject.rest; 20 +package org.onosproject.rest.resources;
......
...@@ -61,19 +61,19 @@ ...@@ -61,19 +61,19 @@
61 org.onosproject.rest.exceptions.ServerErrorMapper, 61 org.onosproject.rest.exceptions.ServerErrorMapper,
62 org.onosproject.rest.exceptions.BadRequestMapper, 62 org.onosproject.rest.exceptions.BadRequestMapper,
63 org.onosproject.rest.exceptions.WebApplicationExceptionMapper, 63 org.onosproject.rest.exceptions.WebApplicationExceptionMapper,
64 - org.onosproject.rest.JsonBodyWriter, 64 + org.onosproject.rest.resources.JsonBodyWriter,
65 65
66 - org.onosproject.rest.ApplicationsWebResource, 66 + org.onosproject.rest.resources.ApplicationsWebResource,
67 - org.onosproject.rest.ComponentConfigWebResource, 67 + org.onosproject.rest.resources.ComponentConfigWebResource,
68 - org.onosproject.rest.ClusterWebResource, 68 + org.onosproject.rest.resources.ClusterWebResource,
69 - org.onosproject.rest.DevicesWebResource, 69 + org.onosproject.rest.resources.DevicesWebResource,
70 - org.onosproject.rest.LinksWebResource, 70 + org.onosproject.rest.resources.LinksWebResource,
71 - org.onosproject.rest.HostsWebResource, 71 + org.onosproject.rest.resources.HostsWebResource,
72 - org.onosproject.rest.IntentsWebResource, 72 + org.onosproject.rest.resources.IntentsWebResource,
73 - org.onosproject.rest.FlowsWebResource, 73 + org.onosproject.rest.resources.FlowsWebResource,
74 - org.onosproject.rest.TopologyWebResource, 74 + org.onosproject.rest.resources.TopologyWebResource,
75 - org.onosproject.rest.ConfigWebResource, 75 + org.onosproject.rest.resources.ConfigWebResource,
76 - org.onosproject.rest.PathsWebResource 76 + org.onosproject.rest.resources.PathsWebResource
77 </param-value> 77 </param-value>
78 </init-param> 78 </init-param>
79 <load-on-startup>1</load-on-startup> 79 <load-on-startup>1</load-on-startup>
......