few changes after testing HTTP and MQTT flow

revert-70aa11f8
ayyoob 8 years ago
parent a7ebc96cb7
commit 7cba43ccbb

@ -81,8 +81,10 @@ public class DeviceEventManagementServiceImpl implements DeviceEventManagementSe
private static final String THRIFT_ADAPTER_TYPE = "iot-event"; private static final String THRIFT_ADAPTER_TYPE = "iot-event";
private static final String DEFAULT_DEVICE_ID_ATTRIBUTE = "deviceId"; private static final String DEFAULT_DEVICE_ID_ATTRIBUTE = "deviceId";
private static final String DEFAULT_META_DEVICE_ID_ATTRIBUTE = "meta_deviceId"; private static final String DEFAULT_META_DEVICE_ID_ATTRIBUTE = "meta_deviceId";
private static final String MQTT_CONTENT_TRANSFORMER = "device-meta-transformer";
private static final String MQTT_CONTENT_TRANSFORMER_TYPE = "contentTransformer";
private static final String MQTT_CONTENT_VALIDATOR_TYPE = "contentValidator";
private static final String MQTT_CONTENT_VALIDATOR = "default";
@GET @GET
@Path("/{type}") @Path("/{type}")
@ -182,14 +184,9 @@ public class DeviceEventManagementServiceImpl implements DeviceEventManagementSe
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain( PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(
MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, true); MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, true);
if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) { if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) {
if (transportType == TransportType.MQTT) {
publishStreamDefinitons(streamName, Constants.DEFAULT_STREAM_VERSION, deviceType, eventAttributes); publishStreamDefinitons(streamName, Constants.DEFAULT_STREAM_VERSION, deviceType, eventAttributes);
publishEventReceivers(eventReceiverName, streamNameWithVersion, transportType, tenantDomain, publishEventReceivers(eventReceiverName, streamNameWithVersion, transportType, tenantDomain,
deviceType); deviceType);
} else {
publishStreamDefinitons(streamName, Constants.DEFAULT_STREAM_VERSION, deviceType, eventAttributes);
}
} }
DeviceMgtAPIUtils.getDynamicEventCache().remove(deviceType); DeviceMgtAPIUtils.getDynamicEventCache().remove(deviceType);
return Response.ok().build(); return Response.ok().build();
@ -412,9 +409,13 @@ public class DeviceEventManagementServiceImpl implements DeviceEventManagementSe
String adapterType = OAUTH_MQTT_ADAPTER_TYPE; String adapterType = OAUTH_MQTT_ADAPTER_TYPE;
BasicInputAdapterPropertyDto basicInputAdapterPropertyDtos[]; BasicInputAdapterPropertyDto basicInputAdapterPropertyDtos[];
if (transportType == TransportType.MQTT) { if (transportType == TransportType.MQTT) {
basicInputAdapterPropertyDtos = new BasicInputAdapterPropertyDto[1]; basicInputAdapterPropertyDtos = new BasicInputAdapterPropertyDto[3];
basicInputAdapterPropertyDtos[0] = getBasicInputAdapterPropertyDto("topic", requestedTenantDomain basicInputAdapterPropertyDtos[0] = getBasicInputAdapterPropertyDto("topic", requestedTenantDomain
+ "/" + deviceType + "/+/events"); + "/" + deviceType + "/+/events");
basicInputAdapterPropertyDtos[1] = getBasicInputAdapterPropertyDto(MQTT_CONTENT_TRANSFORMER_TYPE
, MQTT_CONTENT_TRANSFORMER);
basicInputAdapterPropertyDtos[2] = getBasicInputAdapterPropertyDto(MQTT_CONTENT_VALIDATOR_TYPE
, MQTT_CONTENT_VALIDATOR);
} else { } else {
adapterType = THRIFT_ADAPTER_TYPE; adapterType = THRIFT_ADAPTER_TYPE;
basicInputAdapterPropertyDtos = new BasicInputAdapterPropertyDto[1]; basicInputAdapterPropertyDtos = new BasicInputAdapterPropertyDto[1];
@ -425,8 +426,6 @@ public class DeviceEventManagementServiceImpl implements DeviceEventManagementSe
receiverAdminServiceStub.deployJsonEventReceiverConfiguration(eventRecieverName, streamNameWithVersion receiverAdminServiceStub.deployJsonEventReceiverConfiguration(eventRecieverName, streamNameWithVersion
, adapterType, null, basicInputAdapterPropertyDtos, false); , adapterType, null, basicInputAdapterPropertyDtos, false);
} else { } else {
EventMappingPropertyDto eventMappingPropertyDto = new EventMappingPropertyDto();
receiverAdminServiceStub.deployWso2EventReceiverConfiguration(eventRecieverName, streamNameWithVersion receiverAdminServiceStub.deployWso2EventReceiverConfiguration(eventRecieverName, streamNameWithVersion
, adapterType, null, null, null, basicInputAdapterPropertyDtos, false, null); , adapterType, null, null, null, basicInputAdapterPropertyDtos, false, null);
} }

@ -111,7 +111,8 @@
org.wso2.carbon.utils.dbcreator, org.wso2.carbon.utils.dbcreator,
org.wso2.carbon.utils.multitenancy, org.wso2.carbon.utils.multitenancy,
</Import-Package> </Import-Package>
<DynamicImport-Package>org.wso2.carbon.device.mgt.extensions.pull.notification.*</DynamicImport-Package> <DynamicImport-Package>org.wso2.carbon.device.mgt.extensions.pull.notification,
org.wso2.carbon.device.mgt.extensions.pull.notification.*</DynamicImport-Package>
</instructions> </instructions>
</configuration> </configuration>
</plugin> </plugin>

@ -100,7 +100,7 @@ public class PullNotificationSubscriberConfig {
* *
*/ */
public void setClassName(String value) { public void setClassName(String value) {
this.className = className; this.className = value;
} }
} }

@ -32,9 +32,6 @@ function submitForm(formId) {
var operationDetails = $("#operation-details"); var operationDetails = $("#operation-details");
var deviceId = operationDetails.data("deviceid"); var deviceId = operationDetails.data("deviceid");
var operationEndpoint = operationDetails.data("endpoint"); var operationEndpoint = operationDetails.data("endpoint");
console.log(deviceId);
console.log(operationEndpoint);
var contentType = "application/json"; var contentType = "application/json";
var payload = {}; var payload = {};
@ -44,7 +41,7 @@ function submitForm(formId) {
var operation = {}; var operation = {};
operation["code"] = form.find("#operation-code").val(); operation["code"] = form.find("#operation-code").val();
operation["type"]= form.find("#operation-type").val(); operation["type"]= form.find("#operation-type").val();
operation["status"] = "IN_PROGRESS"; operation["status"] = "PENDING";
operation["control"] = "REPEAT"; operation["control"] = "REPEAT";
operation["payLoad"] = form.find("#operation-payload").val(); operation["payLoad"] = form.find("#operation-payload").val();
operation["enabled"] = true; operation["enabled"] = true;

@ -245,18 +245,18 @@
Operation Response: Operation Response:
<code>{{tenantDomain}}/{{deviceType}}/&lt;device_id&gt;/update/operation</code> <code>{{tenantDomain}}/{{deviceType}}/&lt;device_id&gt;/update/operation</code>
<br/> <br/>
Payload : <code>{operationId:1, payload:"example"}</code> Payload : <code>{"id": 1,"status": "COMPLETED", "operationResponse": "this is my response"}</code>
<br/> <br/>
Topic Structure: Topic Structure:
<ul class="list-unstyled"> <ul class="list-unstyled">
<li class="padding-top-double"> <li class="padding-top-double">
<code>{{tenantDomain}}/{{deviceType}}/&lt;device_id&gt;/operation/command/&lt;feature_code&gt;&lt;operation_id&gt;</code> <code>{{tenantDomain}}/{{deviceType}}/&lt;device_id&gt;/operation/command/&lt;feature_code&gt;/&lt;operation_id&gt;</code>
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<code>{{tenantDomain}}/{{deviceType}}/&lt;device_id&gt;/operation/config/&lt;feature_code&gt;&lt;operation_id&gt;</code> <code>{{tenantDomain}}/{{deviceType}}/&lt;device_id&gt;/operation/config/&lt;feature_code&gt;/&lt;operation_id&gt;</code>
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<code>{{tenantDomain}}/{{deviceType}}/&lt;device_id&gt;/operation/profile/&lt;feature_code&gt;&lt;operation_id&gt;</code> <code>{{tenantDomain}}/{{deviceType}}/&lt;device_id&gt;/operation/profile/&lt;feature_code&gt;/&lt;operation_id&gt;</code>
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<code>{{tenantDomain}}/{{deviceType}}/&lt;device_id&gt;/operation/policy/policy_bundle</code> <code>{{tenantDomain}}/{{deviceType}}/&lt;device_id&gt;/operation/policy/policy_bundle</code>

Loading…
Cancel
Save