Performance improvements

revert-dabc3590
Charitha Goonetilleke 5 years ago
parent 56c39e504f
commit c8fe5b45b7

@ -21,6 +21,8 @@ package org.wso2.carbon.device.mgt.mqtt.notification.listener;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.pull.notification.PullNotificationExecutionFailedException; import org.wso2.carbon.device.mgt.common.pull.notification.PullNotificationExecutionFailedException;
import org.wso2.carbon.device.mgt.mqtt.notification.listener.internal.MqttNotificationDataHolder; import org.wso2.carbon.device.mgt.mqtt.notification.listener.internal.MqttNotificationDataHolder;
import org.wso2.carbon.event.input.adapter.core.InputEventAdapterSubscription; import org.wso2.carbon.event.input.adapter.core.InputEventAdapterSubscription;
@ -48,11 +50,14 @@ public class DeviceTypeOperationAdapterSubscription implements InputEventAdapter
PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(PrivilegedCarbonContext. PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(PrivilegedCarbonContext.
getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration().getAdminUserName()); getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration().getAdminUserName());
deviceType = notificationMessage.getDeviceIdentifier().getType(); deviceType = notificationMessage.getDeviceIdentifier().getType();
Device device = MqttNotificationDataHolder.getInstance().getDeviceManagementProviderService()
.getDevice(notificationMessage.getDeviceIdentifier(), false);
MqttNotificationDataHolder.getInstance().getDeviceManagementProviderService(). MqttNotificationDataHolder.getInstance().getDeviceManagementProviderService().
notifyPullNotificationSubscriber(notificationMessage.getDeviceIdentifier(), notifyPullNotificationSubscriber(device, notificationMessage.getOperation());
notificationMessage.getOperation());
} catch (UserStoreException e) { } catch (UserStoreException e) {
log.error("Failed to retrieve tenant username", e); log.error("Failed to retrieve tenant username", e);
} catch (DeviceManagementException e) {
log.error("Failed to retrieve device " + notificationMessage.getDeviceIdentifier(), e);
} catch (PullNotificationExecutionFailedException e) { } catch (PullNotificationExecutionFailedException e) {
log.error("Failed to execute device type pull notification subscriber execution for device type" + deviceType, log.error("Failed to execute device type pull notification subscriber execution for device type" + deviceType,
e); e);

@ -625,9 +625,8 @@ public class DeviceManagementProviderServiceMock implements DeviceManagementProv
} }
@Override @Override
public void notifyPullNotificationSubscriber(DeviceIdentifier deviceIdentifier, Operation operation) public void notifyPullNotificationSubscriber(Device device, Operation operation)
throws PullNotificationExecutionFailedException { throws PullNotificationExecutionFailedException {
} }
@Override @Override

@ -18,6 +18,7 @@
package org.wso2.carbon.mdm.services.android.mocks; package org.wso2.carbon.mdm.services.android.mocks;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationRequest;
import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.PaginationResult;
@ -34,6 +35,11 @@ public class NotificationManagementServiceMock implements NotificationManagement
return false; return false;
} }
@Override
public boolean addNotification(Device device, Notification notification) throws NotificationManagementException {
return false;
}
@Override @Override
public boolean updateNotification(Notification notification) throws NotificationManagementException { public boolean updateNotification(Notification notification) throws NotificationManagementException {
return false; return false;

@ -17,6 +17,7 @@
*/ */
package org.wso2.carbon.mdm.services.android.mocks; package org.wso2.carbon.mdm.services.android.mocks;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.Feature; import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationRequest;
@ -121,22 +122,42 @@ public class PolicyManagerServiceMock implements PolicyManagerService {
return null; return null;
} }
@Override
public Policy getAppliedPolicyToDevice(Device device) throws PolicyManagementException {
return null;
}
@Override @Override
public List<ComplianceFeature> checkPolicyCompliance(DeviceIdentifier deviceIdentifier, Object o) public List<ComplianceFeature> checkPolicyCompliance(DeviceIdentifier deviceIdentifier, Object o)
throws PolicyComplianceException { throws PolicyComplianceException {
return null; return null;
} }
@Override
public List<ComplianceFeature> checkPolicyCompliance(Device device, Object o) throws PolicyComplianceException {
return null;
}
@Override @Override
public boolean checkCompliance(DeviceIdentifier deviceIdentifier, Object o) throws PolicyComplianceException { public boolean checkCompliance(DeviceIdentifier deviceIdentifier, Object o) throws PolicyComplianceException {
return false; return false;
} }
@Override
public boolean checkCompliance(Device device, Object o) throws PolicyComplianceException {
return false;
}
@Override @Override
public NonComplianceData getDeviceCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException { public NonComplianceData getDeviceCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
return null; return null;
} }
@Override
public NonComplianceData getDeviceCompliance(Device device) throws PolicyComplianceException {
return null;
}
@Override @Override
public boolean isCompliant(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException { public boolean isCompliant(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
return false; return false;

Loading…
Cancel
Save