diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java index 04bfeff0d74..fc34cfba0da 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java @@ -31,15 +31,15 @@ import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementConstants.GeoServices; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationException; import org.wso2.carbon.device.mgt.common.geo.service.Alert; import org.wso2.carbon.device.mgt.common.geo.service.Event; import org.wso2.carbon.device.mgt.common.geo.service.GeoFence; -import org.wso2.carbon.device.mgt.common.geo.service.GeoLocationProviderService; import org.wso2.carbon.device.mgt.common.geo.service.GeoLocationBasedServiceException; +import org.wso2.carbon.device.mgt.common.geo.service.GeoLocationProviderService; import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroupConstants; -import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; -import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig; +import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil; import org.wso2.carbon.device.mgt.jaxrs.service.api.GeoLocationBasedService; import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils; @@ -76,13 +76,13 @@ public class GeoLocationBasedServiceImpl implements GeoLocationBasedService { public Response getGeoDeviceStats(@PathParam("deviceId") String deviceId, @PathParam("deviceType") String deviceType, @QueryParam("from") long from, @QueryParam("to") long to) { - //First, check whether the Geo Location service has been enabled in the cdmf-config.xml file - DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance() - .getDeviceManagementConfig(); - if (deviceManagementConfig != null) { - if(!deviceManagementConfig.getGeoLocationConfiguration().getPublishLocationOperationResponse()){ - return Response.status(Response.Status.BAD_REQUEST.getStatusCode()).build(); + try { + if (!DeviceManagerUtil.isPublishOperationResponseEnabled()) { + return Response.status(Response.Status.BAD_REQUEST.getStatusCode()) + .entity("Unable to retrive Geo Device stats. Geo Data publishing does not enabled.").build(); } + } catch (DeviceManagementException e) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(e.getMessage()).build(); } String tableName = "IOT_PER_DEVICE_STREAM_GEO_FUSEDSPATIALEVENT"; String fromDate = String.valueOf(from); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/util/DeviceMgtAPITestHelper.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/util/DeviceMgtAPITestHelper.java index 5fa279b6a0f..f1f0d1628df 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/util/DeviceMgtAPITestHelper.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/util/DeviceMgtAPITestHelper.java @@ -19,7 +19,6 @@ package org.wso2.carbon.device.mgt.jaxrs.service.impl.util; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; -import org.wso2.carbon.device.mgt.common.Feature; import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; import org.wso2.carbon.device.mgt.common.type.mgt.DeviceTypeMetaDefinition; @@ -37,7 +36,6 @@ public class DeviceMgtAPITestHelper { private static final String DEVICE_TYPE_DESCRIPTION = "Dummy Description"; public static final String DEVICE_TYPE = "TEST_DEVICE_TYPE"; public static final String DEVICE_NAME = "TEST_DEVICE"; - public static final String DEVICE_IDENTIFIER = "12345"; public final static String OWNER = "admin"; /** @@ -110,8 +108,6 @@ public class DeviceMgtAPITestHelper { public static DeviceInfo generateDeviceInfo() { DeviceInfo deviceInfo = new DeviceInfo(); - deviceInfo.setIMEI("IMEI-12345"); - deviceInfo.setIMSI("IMSI-12344"); deviceInfo.setDeviceModel("DUMMY_MODEL"); deviceInfo.setVendor("WSO2"); deviceInfo.setOsVersion("OREO"); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/device/details/DeviceInfo.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/device/details/DeviceInfo.java index b7f5a5b14cd..05c8345183f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/device/details/DeviceInfo.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/device/details/DeviceInfo.java @@ -144,30 +144,6 @@ public class DeviceInfo implements Serializable { this.location = location; } - public String getIMEI() { - if (IMEI != null) { - return IMEI; - } else { - return ""; - } - } - - public void setIMEI(String IMEI) { - this.IMEI = IMEI; - } - - public String getIMSI() { - if (IMSI != null) { - return IMSI; - } else { - return ""; - } - } - - public void setIMSI(String IMSI) { - this.IMSI = IMSI; - } - public String getDeviceModel() { if (deviceModel != null) { return deviceModel; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfig.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfig.java index 72f9944fb2d..2c039b0bef8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfig.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfig.java @@ -18,7 +18,7 @@ package org.wso2.carbon.device.mgt.core.config; import org.wso2.carbon.device.mgt.core.config.cache.CertificateCacheConfiguration; -import org.wso2.carbon.device.mgt.core.config.geo.location.GeoLocationConfiguration; +import org.wso2.carbon.device.mgt.core.config.geo.location.OperationAnalyticsConfiguration; import org.wso2.carbon.device.mgt.core.config.cache.DeviceCacheConfiguration; import org.wso2.carbon.device.mgt.core.config.identity.IdentityConfigurations; import org.wso2.carbon.device.mgt.core.config.pagination.PaginationConfiguration; @@ -48,7 +48,7 @@ public final class DeviceManagementConfig { private DeviceStatusTaskConfig deviceStatusTaskConfig; private DeviceCacheConfiguration deviceCacheConfiguration; private CertificateCacheConfiguration certificateCacheConfiguration; - private GeoLocationConfiguration geoLocationConfiguration; + private OperationAnalyticsConfiguration operationAnalyticsConfiguration; private String defaultGroupsConfiguration; @XmlElement(name = "ManagementRepository", required = true) @@ -142,13 +142,13 @@ public final class DeviceManagementConfig { this.certificateCacheConfiguration = certificateCacheConfiguration; } - @XmlElement(name = "GeoLocationConfiguration", required = true) - public GeoLocationConfiguration getGeoLocationConfiguration() { - return geoLocationConfiguration; + @XmlElement(name = "OperationAnalyticsConfiguration", required = true) + public OperationAnalyticsConfiguration getOperationAnalyticsConfiguration() { + return operationAnalyticsConfiguration; } - public void setGeoLocationConfiguration(GeoLocationConfiguration geoLocationConfiguration) { - this.geoLocationConfiguration = geoLocationConfiguration; + public void setOperationAnalyticsConfiguration(OperationAnalyticsConfiguration operationAnalyticsConfiguration) { + this.operationAnalyticsConfiguration = operationAnalyticsConfiguration; } @XmlElement(name = "DefaultGroupsConfiguration", required = true) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/GeoLocationConfiguration.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/OperationAnalyticsConfiguration.java similarity index 65% rename from components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/GeoLocationConfiguration.java rename to components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/OperationAnalyticsConfiguration.java index e1aeb1a45c5..8cc2053e646 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/GeoLocationConfiguration.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/OperationAnalyticsConfiguration.java @@ -22,21 +22,21 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; /** - * This class represents the information related to Geo Location configuration. + * This class represents the information related to Device Operation Analytics configuration. */ -@XmlRootElement(name = "GeoLocationConfiguration") -public class GeoLocationConfiguration { +@XmlRootElement(name = "OperationAnalyticsConfiguration") +public class OperationAnalyticsConfiguration { - private boolean publishLocationOperationResponse; + private boolean publishOperationResponse; private boolean isEnabled; - public boolean getPublishLocationOperationResponse() { - return publishLocationOperationResponse; + public boolean getPublishOperationResponse() { + return publishOperationResponse; } - @XmlElement(name = "PublishLocationOperationResponse", required = true) - public void setPublishLocationOperationResponse(boolean publishLocationOperationResponse) { - this.publishLocationOperationResponse = publishLocationOperationResponse; + @XmlElement(name = "PublishOperationResponse", required = true) + public void setPublishOperationResponse(boolean publishOperationResponse) { + this.publishOperationResponse = publishOperationResponse; } public boolean getIsEnabled() { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java index e3568021176..0a7f22dbf03 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java @@ -41,6 +41,7 @@ import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -50,7 +51,9 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { private DeviceDetailsDAO deviceDetailsDAO; private DeviceDAO deviceDAO; private static final Log log = LogFactory.getLog(DeviceInformationManagerImpl.class); - private static final String EVENT_STREAM_DEFINITION = "org.wso2.iot.LocationStream"; + private static final String LOCATION_EVENT_STREAM_DEFINITION = "org.wso2.iot.LocationStream"; + private static final String DEVICE_INFO_EVENT_STREAM_DEFINITION = "org.wso2.iot.DeviceInfoStream"; + public DeviceInformationManagerImpl() { this.deviceDAO = DeviceManagementDAOFactory.getDeviceDAO(); @@ -70,6 +73,35 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { deviceDetailsDAO.addDeviceInformation(device.getId(), deviceInfo); deviceDetailsDAO.addDeviceProperties(deviceInfo.getDeviceDetailsMap(), device.getId()); DeviceManagementDAOFactory.commitTransaction(); + + if (DeviceManagerUtil.isPublishOperationResponseEnabled()) { + Object[] metaData = {device.getDeviceIdentifier(), device.getType()}; + Object[] payload = new Object[]{ + Calendar.getInstance().getTimeInMillis(), + deviceInfo.getDeviceDetailsMap().get("IMEI"), + deviceInfo.getDeviceDetailsMap().get("IMSI"), + deviceInfo.getDeviceModel(), + deviceInfo.getVendor(), + deviceInfo.getOsVersion(), + deviceInfo.getOsBuildDate(), + deviceInfo.getBatteryLevel(), + deviceInfo.getInternalTotalMemory(), + deviceInfo.getInternalAvailableMemory(), + deviceInfo.getExternalTotalMemory(), + deviceInfo.getExternalAvailableMemory(), + deviceInfo.getOperator(), + deviceInfo.getConnectionType(), + deviceInfo.getMobileSignalStrength(), + deviceInfo.getSsid(), + deviceInfo.getCpuUsage(), + deviceInfo.getTotalRAMMemory(), + deviceInfo.getAvailableRAMMemory(), + deviceInfo.isPluggedIn() + }; + DeviceManagerUtil.getEventPublisherService().publishEvent( + DEVICE_INFO_EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload + ); + } } catch (TransactionManagementException e) { DeviceManagementDAOFactory.rollbackTransaction(); throw new DeviceDetailsMgtException("Transactional error occurred while adding the device information.", e); @@ -82,7 +114,10 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { } catch (DeviceManagementDAOException e) { DeviceManagementDAOFactory.rollbackTransaction(); throw new DeviceDetailsMgtException("Error occurred while updating the last update timestamp of the " + - "device", e); + "device", e); + } catch (DataPublisherConfigurationException e) { + DeviceManagementDAOFactory.rollbackTransaction(); + throw new DeviceDetailsMgtException("Error occurred while publishing the device location information.", e); } finally { DeviceManagementDAOFactory.closeConnection(); } @@ -90,19 +125,9 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { @Override public DeviceInfo getDeviceInfo(DeviceIdentifier deviceId) throws DeviceDetailsMgtException { - Device device; - try { - device = DeviceManagementDataHolder.getInstance(). - getDeviceManagementProvider().getDevice(deviceId, false); - if (device == null) { - if (log.isDebugEnabled()) { - log.debug("No device is found upon the device identifier '" + deviceId.getId() + - "' and type '" + deviceId.getType() + "'. Therefore returning null"); - } - return null; - } - } catch (DeviceManagementException e) { - throw new DeviceDetailsMgtException("Exception occurred while retrieving the device.", e); + Device device = getDevice(deviceId); + if (device == null) { + return null; } try { DeviceManagementDAOFactory.openConnection(); @@ -111,7 +136,8 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { return deviceInfo; } catch (SQLException e) { - throw new DeviceDetailsMgtException("SQL error occurred while retrieving device from database.", e); + throw new DeviceDetailsMgtException("SQL error occurred while retrieving device " + deviceId.toString() + + "'s info from database.", e); } catch (DeviceDetailsMgtDAOException e) { throw new DeviceDetailsMgtException("Exception occurred while retrieving device details.", e); } finally { @@ -166,15 +192,15 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { deviceDAO.updateDevice(device, CarbonContext.getThreadLocalCarbonContext().getTenantId()); deviceDetailsDAO.deleteDeviceLocation(deviceLocation.getDeviceId()); deviceDetailsDAO.addDeviceLocation(deviceLocation); - if (DeviceManagerUtil.isPublishLocationOperationResEnabled()) { - Object metaData[] = {device.getDeviceIdentifier(), device.getType()}; - Object payload[] = new Object[]{ + if (DeviceManagerUtil.isPublishOperationResponseEnabled()) { + Object[] metaData = {device.getDeviceIdentifier(), device.getType()}; + Object[] payload = new Object[]{ deviceLocation.getUpdatedTime().getTime(), deviceLocation.getLatitude(), deviceLocation.getLongitude() }; DeviceManagerUtil.getEventPublisherService().publishEvent( - EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload + LOCATION_EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload ); } DeviceManagementDAOFactory.commitTransaction(); @@ -201,29 +227,37 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { @Override public DeviceLocation getDeviceLocation(DeviceIdentifier deviceId) throws DeviceDetailsMgtException { + Device device = getDevice(deviceId); + if (device == null) { + return null; + } + try { + DeviceManagementDAOFactory.openConnection(); + return deviceDetailsDAO.getDeviceLocation(device.getId()); + } catch (SQLException e) { + throw new DeviceDetailsMgtException("SQL error occurred while retrieving device from database.", e); + } catch (DeviceDetailsMgtDAOException e) { + throw new DeviceDetailsMgtException("Exception occurred while retrieving device location.", e); + } finally { + DeviceManagementDAOFactory.closeConnection(); + } + } + + private Device getDevice(DeviceIdentifier deviceId) throws DeviceDetailsMgtException { Device device; try { device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceId, false); if (device == null) { if (log.isDebugEnabled()) { log.debug("No device is found upon the device identifier '" + deviceId.getId() + - "' and type '" + deviceId.getType() + "'. Therefore returning null"); + "' and type '" + deviceId.getType() + "'. Therefore returning null"); } return null; } } catch (DeviceManagementException e) { throw new DeviceDetailsMgtException("Exception occurred while retrieving the device.", e); } - try { - DeviceManagementDAOFactory.openConnection(); - return deviceDetailsDAO.getDeviceLocation(device.getId()); - } catch (SQLException e) { - throw new DeviceDetailsMgtException("SQL error occurred while retrieving device from database.", e); - } catch (DeviceDetailsMgtDAOException e) { - throw new DeviceDetailsMgtException("Exception occurred while retrieving device location.", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } + return device; } @Override diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderService.java index 0187e8dca63..27aa73f3584 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderService.java @@ -26,8 +26,8 @@ import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup; import org.wso2.carbon.device.mgt.common.group.mgt.GroupAlreadyExistException; import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException; -import org.wso2.carbon.device.mgt.common.group.mgt.RoleDoesNotExistException; import org.wso2.carbon.device.mgt.common.group.mgt.GroupNotExistException; +import org.wso2.carbon.device.mgt.common.group.mgt.RoleDoesNotExistException; import java.util.List; @@ -215,10 +215,19 @@ public interface GroupManagementProviderService { /** * Checks for the default group existence and create group based on device ownership. - * @param groupName - * @return + * @param groupName of the group + * @return DeviceGroup object * @throws GroupManagementException */ DeviceGroup createDefaultGroup(String groupName) throws GroupManagementException; + /** + * Check device is belonging to a Device Group. + * + * @param groupId of Device Group. + * @param deviceIdentifier of the device. + * @throws GroupManagementException on errors. + */ + boolean isDeviceMappedToGroup(int groupId, DeviceIdentifier deviceIdentifier) throws GroupManagementException; + } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java index 2b6a7b0bb4e..d2e4efdcb0b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java @@ -30,7 +30,12 @@ import org.wso2.carbon.device.mgt.common.DeviceNotFoundException; import org.wso2.carbon.device.mgt.common.GroupPaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.TransactionManagementException; -import org.wso2.carbon.device.mgt.common.group.mgt.*; +import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup; +import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroupConstants; +import org.wso2.carbon.device.mgt.common.group.mgt.GroupAlreadyExistException; +import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException; +import org.wso2.carbon.device.mgt.common.group.mgt.GroupNotExistException; +import org.wso2.carbon.device.mgt.common.group.mgt.RoleDoesNotExistException; import org.wso2.carbon.device.mgt.core.dao.GroupDAO; import org.wso2.carbon.device.mgt.core.dao.GroupManagementDAOException; import org.wso2.carbon.device.mgt.core.dao.GroupManagementDAOFactory; @@ -823,4 +828,39 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid return defaultGroup; } } + + /** + * {@inheritDoc} + */ + @Override + public boolean isDeviceMappedToGroup(int groupId, DeviceIdentifier deviceIdentifier) + throws GroupManagementException { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); + Device device; + try { + device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider(). + getDevice(deviceIdentifier, false); + if (device == null) { + throw new GroupManagementException("Device not found for id '" + deviceIdentifier.getId() + + "' type '" + deviceIdentifier.getType() + "'"); + } + } catch (DeviceManagementException e) { + throw new GroupManagementException("Device management exception occurred when retrieving device. " + + e.getMessage(), e); + } + + try{ + GroupManagementDAOFactory.openConnection(); + return this.groupDAO.isDeviceMappedToGroup(groupId, device.getId(), tenantId); + } catch (GroupManagementDAOException e) { + throw new GroupManagementException("Error occurred when checking device, group mapping between device id '" + + deviceIdentifier.getId() + "' and group id '" + groupId + "'", e); + } catch (SQLException e) { + throw new GroupManagementException("Error occurred when opening db connection to check device, group " + + "mapping between device id '" + deviceIdentifier.getId() + + "' and group id '" + groupId + "'", e); + } finally { + GroupManagementDAOFactory.closeConnection(); + } + } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java index bfb48267621..87b6e70ac7f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java @@ -31,6 +31,7 @@ import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.GroupPaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.TransactionManagementException; +import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo; import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; @@ -415,11 +416,23 @@ public final class DeviceManagerUtil { return limit; } - public static boolean isPublishLocationOperationResEnabled() throws DeviceManagementException { + public static boolean isOperationAnalyticsEnabled() throws DeviceManagementException { DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance(). getDeviceManagementConfig(); if (deviceManagementConfig != null) { - return deviceManagementConfig.getGeoLocationConfiguration().getPublishLocationOperationResponse(); + return deviceManagementConfig.getOperationAnalyticsConfiguration().getIsEnabled(); + } else { + throw new DeviceManagementException("Device-Mgt configuration has not initialized. Please check the " + + "cdm-config.xml file."); + } + } + + public static boolean isPublishOperationResponseEnabled() throws DeviceManagementException { + DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance(). + getDeviceManagementConfig(); + if (deviceManagementConfig != null) { + return isOperationAnalyticsEnabled() + && deviceManagementConfig.getOperationAnalyticsConfiguration().getPublishOperationResponse(); } else { throw new DeviceManagementException("Device-Mgt configuration has not initialized. Please check the " + "cdm-config.xml file."); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/TestDataHolder.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/TestDataHolder.java index 68079eeb241..1320f99e5b1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/TestDataHolder.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/TestDataHolder.java @@ -66,8 +66,6 @@ public class TestDataHolder { public static DeviceInfo generateDummyDeviceInfo() { DeviceInfo deviceInfo = new DeviceInfo(); - deviceInfo.setIMEI("IMEI-12345"); - deviceInfo.setIMSI("IMSI-12344"); deviceInfo.setDeviceModel("DUMMY_MODEL"); deviceInfo.setVendor("WSO2"); deviceInfo.setOsVersion("OREO"); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/search/util/Utils.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/search/util/Utils.java index c46844dee41..ea466351162 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/search/util/Utils.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/search/util/Utils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -20,26 +20,17 @@ package org.wso2.carbon.device.mgt.core.search.util; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo; import org.wso2.carbon.device.mgt.common.device.details.DeviceLocation; -import org.wso2.carbon.device.mgt.common.search.Condition; -import org.wso2.carbon.device.mgt.common.search.SearchContext; import org.wso2.carbon.device.mgt.core.common.TestDataHolder; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; -import static org.wso2.carbon.device.mgt.common.search.Condition.State.AND; -import static org.wso2.carbon.device.mgt.common.search.Condition.State.OR; - public class Utils { public static DeviceInfo getDeviceInfo() { DeviceInfo deviceInfo = new DeviceInfo(); - deviceInfo.setIMSI("e6f236ac82537a8e"); deviceInfo.setSsid("FAFDA"); - deviceInfo.setAvailableRAMMemory(1.24); deviceInfo.setBatteryLevel(40.0); deviceInfo.setConnectionType("GSM"); @@ -47,8 +38,6 @@ public class Utils { deviceInfo.setDeviceModel("SM-T520"); deviceInfo.setExternalAvailableMemory(2.45); deviceInfo.setExternalTotalMemory(16.23); - deviceInfo.setIMEI("e6f236ac82537a8e"); - deviceInfo.setIMSI("GT-0WDA"); deviceInfo.setInternalAvailableMemory(3.56); deviceInfo.setInternalTotalMemory(7.89); deviceInfo.setMobileSignalStrength(0.67); @@ -70,6 +59,8 @@ public class Utils { propertyMap.put("MEMORY_THRESHOLD", "100663296"); propertyMap.put("CPU_IOW", "12"); propertyMap.put("CPU_IRQ", "1"); + propertyMap.put("IMEI", "e6f236ac82537a8e"); + propertyMap.put("IMSI", "432659632123654845"); deviceInfo.setDeviceDetailsMap(propertyMap); @@ -77,7 +68,7 @@ public class Utils { } - public static DeviceLocation getSampleDeviceLocation(){ + private static DeviceLocation getSampleDeviceLocation(){ DeviceLocation deviceLocation = new DeviceLocation(); deviceLocation.setDeviceIdentifier(Utils.getDeviceIdentifier()); deviceLocation.setLatitude(76.2422); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceTest.java index 7ac1c9a2d8e..e1c3be07cc0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceTest.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceTest.java @@ -16,21 +16,27 @@ * under the License. */ - package org.wso2.carbon.device.mgt.core.service; - import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import org.wso2.carbon.device.mgt.common.*; -import org.wso2.carbon.device.mgt.common.group.mgt.*; +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.device.mgt.common.DeviceNotFoundException; +import org.wso2.carbon.device.mgt.common.GroupPaginationRequest; +import org.wso2.carbon.device.mgt.common.PaginationResult; +import org.wso2.carbon.device.mgt.common.TransactionManagementException; +import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup; +import org.wso2.carbon.device.mgt.common.group.mgt.GroupAlreadyExistException; +import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException; +import org.wso2.carbon.device.mgt.common.group.mgt.GroupNotExistException; +import org.wso2.carbon.device.mgt.common.group.mgt.RoleDoesNotExistException; import org.wso2.carbon.device.mgt.core.TestUtils; import org.wso2.carbon.device.mgt.core.common.BaseDeviceManagementTest; import org.wso2.carbon.device.mgt.core.common.TestDataHolder; import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; import org.wso2.carbon.device.mgt.core.config.cache.DeviceCacheConfiguration; -import org.wso2.carbon.device.mgt.core.dao.GroupManagementDAOFactory; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.registry.core.jdbc.realm.InMemoryRealmService; import org.wso2.carbon.user.api.Permission; @@ -66,7 +72,6 @@ public class GroupManagementProviderServiceTest extends BaseDeviceManagementTest @Test(expectedExceptions = {GroupManagementException.class, GroupAlreadyExistException.class, TransactionManagementException.class}) public void createGroupError() throws GroupManagementException, GroupAlreadyExistException, TransactionManagementException { - GroupManagementDAOFactory.beginTransaction(); groupManagementProviderService.createGroup(TestUtils.createDeviceGroup4(), DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_PERMISSIONS); } @@ -126,7 +131,6 @@ public class GroupManagementProviderServiceTest extends BaseDeviceManagementTest @Test(dependsOnMethods = ("createGroup")) public void getGroup() throws GroupManagementException { - DeviceGroup deviceGroup = groupManagementProviderService.getGroup(TestUtils.createDeviceGroup3().getName()); Assert.assertNotNull(groupManagementProviderService.getGroup(deviceGroup.getGroupId())); } @@ -161,8 +165,7 @@ public class GroupManagementProviderServiceTest extends BaseDeviceManagementTest @Test(dependsOnMethods = ("createGroup"), expectedExceptions = {GroupManagementException.class}) public void getGroupsByPaginationError() throws GroupManagementException { - GroupPaginationRequest request = null; - groupManagementProviderService.getGroups(request); + groupManagementProviderService.getGroups((GroupPaginationRequest) null); } @Test(dependsOnMethods = ("createGroup")) @@ -282,5 +285,29 @@ public class GroupManagementProviderServiceTest extends BaseDeviceManagementTest groupManagementProviderService.createDefaultGroup("BYOD"); } + @Test(dependsOnMethods = {"createGroup", "addDevices", "updateGroupSecondTime"}) + public void checkDeviceBelongsToGroup() throws GroupManagementException { + List list = TestUtils.getDeviceIdentifiersList(); + boolean isMapped = groupManagementProviderService + .isDeviceMappedToGroup(groupManagementProviderService.getGroup( + TestUtils.createDeviceGroup1().getName()).getGroupId(), list.get(0)); + Assert.assertEquals(isMapped, true); + } + + @Test + public void checkDeviceBelongsToNonExistingGroup() throws GroupManagementException { + List list = TestUtils.getDeviceIdentifiersList(); + boolean isMapped = groupManagementProviderService + .isDeviceMappedToGroup(1500, list.get(0)); + Assert.assertEquals(isMapped, false); + } + + + @Test(dependsOnMethods = {"createGroup", "updateGroupSecondTime"}, expectedExceptions = {GroupManagementException.class}) + public void checkNullDeviceBelongsToGroup() throws GroupManagementException { + groupManagementProviderService.isDeviceMappedToGroup(groupManagementProviderService.getGroup( + TestUtils.createDeviceGroup1().getName()).getGroupId(), null); + } + } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml index 9097a645cb4..ff6b302002b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml @@ -87,10 +87,10 @@ false 86400 - + false - false - + false + BYOD,COPE diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js index c83585e96b9..ef6cf7357f3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js @@ -73,7 +73,7 @@ deviceModule = function () { } var userName = carbonUser.username + "@" + carbonUser.domain; var locationHistory = []; - var geoServicesEnabled = devicemgtProps.serverConfig.geoLocationConfiguration.isEnabled; + var geoServicesEnabled = devicemgtProps.serverConfig.operationAnalyticsConfiguration.isEnabled; if (geoServicesEnabled) { try { var fromDate = new Date(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.js index f18b1172595..4094fc89dc4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.js @@ -60,6 +60,6 @@ function onRequest(context) { } else { viewModel.lastLocation = stringify({}); } - viewModel.geoServicesEnabled = devicemgtProps.serverConfig.geoLocationConfiguration.isEnabled; + viewModel.geoServicesEnabled = devicemgtProps.serverConfig.operationAnalyticsConfiguration.isEnabled; return viewModel; } \ No newline at end of file diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml new file mode 100644 index 00000000000..4f44e1cdc7b --- /dev/null +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml @@ -0,0 +1,172 @@ + + + + + + + org.wso2.carbon.devicemgt + device-mgt-feature + 3.0.170-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.device.mgt.basics.feature + pom + WSO2 Carbon - Device Management Basics Feature + http://wso2.org + This feature contains the core bundles required for Basic Device Management functionality + + + + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.core + + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.common + + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.analytics.data.publisher + + + org.wso2.carbon.registry + org.wso2.carbon.registry.indexing + + + org.wso2.carbon.analytics-common + org.wso2.carbon.event.receiver.stub + + + org.wso2.carbon.analytics-common + org.wso2.carbon.event.stream.stub + + + org.wso2.carbon.analytics-common + org.wso2.carbon.event.publisher.stub + + + org.wso2.carbon.analytics-common + org.wso2.carbon.event.stream.persistence.stub + + + org.wso2.orbit.org.scannotation + scannotation + + + + + + + maven-resources-plugin + 2.6 + + + copy-resources + generate-resources + + copy-resources + + + src/main/resources + + + resources + + build.properties + p2.inf + + + + + + + + + org.wso2.maven + carbon-p2-plugin + ${carbon.p2.plugin.version} + + + p2-feature-generation + package + + p2-feature-gen + + + org.wso2.carbon.device.mgt.basics + ../../../features/etc/feature.properties + + + org.wso2.carbon.p2.category.type:server + org.eclipse.equinox.p2.type.group:false + + + + + org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.core:${carbon.device.mgt.version} + + + org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.common:${carbon.device.mgt.version} + + + org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.analytics.data.publisher:${carbon.device.mgt.version} + + + org.wso2.carbon.analytics-common:org.wso2.carbon.event.receiver.stub:${carbon.analytics.common.version} + + + org.wso2.carbon.analytics-common:org.wso2.carbon.event.stream.stub:${carbon.analytics.common.version} + + + org.wso2.carbon.analytics-common:org.wso2.carbon.event.publisher.stub:${carbon.analytics.common.version} + + + org.wso2.carbon.analytics-common:org.wso2.carbon.event.stream.persistence.stub:${carbon.analytics.common.version} + + + org.wso2.orbit.com.fasterxml.jackson.core:jackson-annotations:${jackson-annotations.version} + + + org.wso2.orbit.org.scannotation:scannotation:${scannotation.version} + + + + + org.wso2.carbon.registry:org.wso2.carbon.registry.indexing:${carbon.registry.version} + + + + + org.wso2.carbon.core.server:${carbon.kernel.version} + + + org.wso2.carbon.email.sender:${carbon.device.mgt.version} + + + + + + + + + diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/build.properties b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/build.properties similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/build.properties rename to features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/build.properties diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/cdm-config.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml similarity index 96% rename from features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/cdm-config.xml rename to features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml index 58ed4e61670..518edb4d8d3 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/cdm-config.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml @@ -87,10 +87,10 @@ true 86400 - + false - false - + false + BYOD,COPE diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/license-config.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/license-config.xml similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/license-config.xml rename to features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/license-config.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/remote-appmanager-config.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/remote-appmanager-config.xml similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/remote-appmanager-config.xml rename to features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/remote-appmanager-config.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql rename to features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql rename to features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql rename to features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql rename to features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql rename to features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/email/templates/user-enrollment.vm b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/email/templates/user-enrollment.vm similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/email/templates/user-enrollment.vm rename to features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/email/templates/user-enrollment.vm diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/email/templates/user-registration.vm b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/email/templates/user-registration.vm similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/email/templates/user-registration.vm rename to features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/email/templates/user-registration.vm diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/p2.inf b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/p2.inf similarity index 72% rename from features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/p2.inf rename to features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/p2.inf index 56759191648..3c343f6e312 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/p2.inf +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/p2.inf @@ -1,8 +1,8 @@ instructions.configure = \ -org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/conf/cdm-config.xml,target:${installFolder}/../../conf/cdm-config.xml,overwrite:true);\ -org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/conf/license-config.xml,target:${installFolder}/../../conf/etc/license-config.xml,overwrite:true);\ -org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/conf/remote-appmanager-config.xml,target:${installFolder}/../../conf/etc/remote-appmanager-config.xml,overwrite:true);\ -org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/dbscripts/cdm,target:${installFolder}/../../../dbscripts/cdm,overwrite:true);\ -org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/rxts/license.rxt,target:${installFolder}/../../../repository/resources/rxts/license.rxt,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.basics_${feature.version}/conf/cdm-config.xml,target:${installFolder}/../../conf/cdm-config.xml,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.basics_${feature.version}/conf/license-config.xml,target:${installFolder}/../../conf/etc/license-config.xml,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.basics_${feature.version}/conf/remote-appmanager-config.xml,target:${installFolder}/../../conf/etc/remote-appmanager-config.xml,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.basics_${feature.version}/dbscripts/cdm,target:${installFolder}/../../../dbscripts/cdm,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.basics_${feature.version}/rxts/license.rxt,target:${installFolder}/../../../repository/resources/rxts/license.rxt,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/resources/email-templates);\ -org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/email/templates,target:${installFolder}/../../../repository/resources/email-templates,overwrite:true);\ \ No newline at end of file +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.basics_${feature.version}/email/templates,target:${installFolder}/../../../repository/resources/email-templates,overwrite:true);\ \ No newline at end of file diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/rxts/license.rxt b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/rxts/license.rxt similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/rxts/license.rxt rename to features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/rxts/license.rxt diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml index 8198e7001c7..cb98cb72c8a 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml @@ -42,45 +42,21 @@ org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.url.printer + org.wso2.carbon.device.mgt.api.feature + zip org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.common + org.wso2.carbon.device.mgt.url.printer org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.api.feature - zip + org.wso2.carbon.device.mgt.extensions.pull.notification org.wso2.orbit.org.apache.pdfbox pdfbox - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.extensions.pull.notification - - - org.wso2.carbon.registry - org.wso2.carbon.registry.indexing - - - org.wso2.carbon.analytics-common - org.wso2.carbon.event.receiver.stub - - - org.wso2.carbon.analytics-common - org.wso2.carbon.event.stream.stub - - - org.wso2.carbon.analytics-common - org.wso2.carbon.event.publisher.stub - - - org.wso2.carbon.analytics-common - org.wso2.carbon.event.stream.persistence.stub - @@ -131,55 +107,31 @@ + + org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.basics.feature:${carbon.device.mgt.version} + org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.api.feature:${carbon.device.mgt.version} - - org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.core:${carbon.device.mgt.version} - - - org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.common:${carbon.device.mgt.version} - org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.url.printer:${carbon.device.mgt.version} org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.extensions.pull.notification:${carbon.device.mgt.version} - - - org.wso2.carbon.identity.inbound.auth.oauth2:org.wso2.carbon.identity.oauth.stub:${identity.inbound.auth.oauth.version} - - org.wso2.orbit.com.fasterxml.jackson.core:jackson-annotations:${jackson-annotations.version} - - - org.wso2.carbon.analytics-common:org.wso2.carbon.event.receiver.stub:${carbon.analytics.common.version} - - - org.wso2.carbon.analytics-common:org.wso2.carbon.event.stream.stub:${carbon.analytics.common.version} - - - org.wso2.carbon.analytics-common:org.wso2.carbon.event.publisher.stub:${carbon.analytics.common.version} - - - org.wso2.carbon.analytics-common:org.wso2.carbon.event.stream.persistence.stub:${carbon.analytics.common.version} - - org.wso2.carbon.apimgt:org.wso2.carbon.apimgt.keymgt:${carbon.api.mgt.version} org.wso2.orbit.org.apache.pdfbox:pdfbox:${orbit.version.pdfbox} - org.wso2.carbon.registry:org.wso2.carbon.registry.indexing:${carbon.registry.version} org.wso2.carbon.core.server:${carbon.kernel.version} org.wso2.carbon.device.mgt.extensions:${carbon.device.mgt.version} - org.wso2.carbon.email.sender:${carbon.device.mgt.version} diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index 9e276cb479f..301a2aa81cc 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -33,6 +33,7 @@ http://wso2.org + org.wso2.carbon.device.mgt.basics.feature org.wso2.carbon.device.mgt.server.feature org.wso2.carbon.device.mgt.ui.feature org.wso2.carbon.device.mgt.api.feature