merge with upstream

apim420
ayyoob 8 years ago
commit eba2683863

@ -21,7 +21,7 @@
<parent> <parent>
<artifactId>virtual-fire-alarm-plugin</artifactId> <artifactId>virtual-fire-alarm-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>3.0.5-SNAPSHOT</version> <version>3.0.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -235,6 +235,10 @@
<artifactId>org.wso2.carbon.device.mgt.extensions</artifactId> <artifactId>org.wso2.carbon.device.mgt.extensions</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>

@ -18,14 +18,12 @@
package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl; package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl;
import io.swagger.annotations.SwaggerDefinition; import io.swagger.annotations.*;
import io.swagger.annotations.Info;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
/** /**
@ -50,8 +48,20 @@ import javax.ws.rs.core.Response;
@Tag(name = "virtual_firealarm", description = "") @Tag(name = "virtual_firealarm", description = "")
} }
) )
@Scopes(
scopes = {
@Scope(
name = "Enroll device",
description = "",
key = "perm:firealarm:enroll",
permissions = {"/device-mgt/devices/enroll/firealarm"}
)
}
)
public interface VirtualFireAlarmService { public interface VirtualFireAlarmService {
String SCOPE = "scope";
/** /**
* This is an API called/used from within the Server(Front-End) or by a device Owner. It sends a control command to * This is an API called/used from within the Server(Front-End) or by a device Owner. It sends a control command to
* the VirtualFirealarm device to switch `ON` or `OFF` its buzzer. The method also takes in the protocol to be used * the VirtualFirealarm device to switch `ON` or `OFF` its buzzer. The method also takes in the protocol to be used
@ -63,7 +73,19 @@ public interface VirtualFireAlarmService {
*/ */
@POST @POST
@Path("device/{deviceId}/buzz") @Path("device/{deviceId}/buzz")
@Scope(key = "device:firealarm:enroll", name = "", description = "") @ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Switch Buzzer",
notes = "",
response = Response.class,
tags = "virtual_firealarm",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:firealarm:enroll")
})
}
)
Response switchBuzzer(@PathParam("deviceId") String deviceId, Response switchBuzzer(@PathParam("deviceId") String deviceId,
@FormParam("state") String state); @FormParam("state") String state);
@ -72,7 +94,19 @@ public interface VirtualFireAlarmService {
*/ */
@Path("device/stats/{deviceId}") @Path("device/stats/{deviceId}")
@GET @GET
@Scope(key = "device:firealarm:enroll", name = "", description = "") @ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Retrieve Sensor data for the device type",
notes = "",
response = Response.class,
tags = "virtual_firealarm",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:firealarm:enroll")
})
}
)
@Consumes("application/json") @Consumes("application/json")
@Produces("application/json") @Produces("application/json")
Response getVirtualFirealarmStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from, Response getVirtualFirealarmStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from,
@ -81,7 +115,19 @@ public interface VirtualFireAlarmService {
@Path("device/download") @Path("device/download")
@GET @GET
@Produces("application/zip") @Produces("application/zip")
@Scope(key = "device:firealarm:enroll", name = "", description = "") @ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Download agent",
notes = "",
response = Response.class,
tags = "virtual_firealarm",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:firealarm:enroll")
})
}
)
Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketchType") String sketchType); Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketchType") String sketchType);
} }

Loading…
Cancel
Save