diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml index 82f30811ab..2557f2bd35 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml @@ -247,16 +247,16 @@ io.entgra.device.mgt.core.identity.jwt.client.extension provided - - org.wso2.carbon - org.wso2.carbon.registry.core - provided - - - org.wso2.carbon.registry - org.wso2.carbon.registry.resource - provided - + + + + + + + + + + org.wso2.carbon.identity.framework org.wso2.carbon.identity.user.store.count diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml index 2e2888b88a..ef521e355b 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml @@ -250,14 +250,14 @@ org.wso2.carbon org.wso2.carbon.user.api - - org.wso2.carbon - org.wso2.carbon.registry.api - - - org.wso2.carbon - org.wso2.carbon.registry.core - + + + + + + + + org.apache.tomcat.wso2 jdbc-pool diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml index 37082c6fc6..ab26265be0 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml @@ -154,6 +154,7 @@ io.entgra.device.mgt.core.device.mgt.common provided + org.wso2.carbon org.wso2.carbon.registry.core diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml index 7434c58e54..3d8f77e97d 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml @@ -39,6 +39,7 @@ org.apache.felix.scr.ds-annotations provided + org.wso2.carbon org.wso2.carbon.registry.core @@ -70,6 +71,7 @@ com.googlecode.json-simple.wso2 json-simple + org.wso2.carbon.registry org.wso2.carbon.registry.indexing diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml index d23f1863cd..80a5aa9122 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml @@ -233,10 +233,10 @@ org.wso2.carbon org.wso2.carbon.user.core - - org.wso2.carbon.registry - org.wso2.carbon.registry.indexing - + + + + org.slf4j slf4j-simple diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml index 8b1dc93e22..8c1652858a 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml @@ -80,25 +80,25 @@ powermock-module-testng test - - org.wso2.carbon.registry - org.wso2.carbon.registry.indexing - test - - - org.slf4j - jcl-over-slf4j - - - org.slf4j - slf4j-api - - - org.slf4j - log4j-over-slf4j - - - + + + + + + + + + + + + + + + + + + + io.entgra.device.mgt.core io.entgra.device.mgt.core.device.mgt.core diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml index c357cd7566..1250eb0c47 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml @@ -43,14 +43,14 @@ org.wso2.carbon.governance org.wso2.carbon.governance.api - - org.wso2.carbon - org.wso2.carbon.registry.api - - - org.wso2.carbon - org.wso2.carbon.registry.core - + + + + + + + + io.entgra.device.mgt.core io.entgra.device.mgt.core.device.mgt.common diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml index 17a7c4b6ff..d92b2e0ede 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml @@ -43,14 +43,14 @@ org.wso2.carbon.governance org.wso2.carbon.governance.api - - org.wso2.carbon - org.wso2.carbon.registry.api - - - org.wso2.carbon - org.wso2.carbon.registry.core - + + + + + + + + io.entgra.device.mgt.core io.entgra.device.mgt.core.device.mgt.common diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index ed434c7873..90f5f78a5c 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -43,10 +43,11 @@ org.wso2.carbon.governance org.wso2.carbon.governance.api - - org.wso2.carbon - org.wso2.carbon.registry.api - + + + + + org.wso2.carbon org.wso2.carbon.registry.core diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index 6291d849a5..6c8a11e886 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -43,15 +43,15 @@ org.wso2.carbon.governance org.wso2.carbon.governance.api - - org.wso2.carbon - org.wso2.carbon.registry.api - - - org.wso2.carbon - org.wso2.carbon.registry.core - - + + + + + + + + + io.entgra.device.mgt.core io.entgra.device.mgt.core.device.mgt.common diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml index 09ac87fdb8..416cc20fb9 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml @@ -321,11 +321,13 @@ io.entgra.device.mgt.core.identity.jwt.client.extension provided + org.wso2.carbon org.wso2.carbon.registry.core provided + org.wso2.carbon.registry org.wso2.carbon.registry.resource diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/GeoLocationProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/GeoLocationProviderService.java index 1d1cbf1d95..9178be7c16 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/GeoLocationProviderService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/GeoLocationProviderService.java @@ -22,6 +22,7 @@ import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfig; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfigurationException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; import java.util.List; @@ -31,7 +32,7 @@ import java.util.List; */ public interface GeoLocationProviderService { - List getWithinAlerts(DeviceIdentifier identifier, String owner) throws GeoLocationBasedServiceException; + List getWithinAlerts(DeviceIdentifier identifier, String owner) throws GeoLocationBasedServiceException, MetadataManagementException; List getWithinAlerts() throws GeoLocationBasedServiceException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml index 521ff65c5c..51a4d7dea1 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml @@ -359,11 +359,13 @@ org.wso2.carbon org.wso2.carbon.user.api + org.wso2.carbon org.wso2.carbon.registry.api provided + org.wso2.carbon org.wso2.carbon.registry.core diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java index eca73e2fc6..532ee8466e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java @@ -27,8 +27,12 @@ import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfig; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfigurationException; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfigurationProviderService; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataKeyAlreadyExistsException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.common.geo.service.*; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService; import io.entgra.device.mgt.core.device.mgt.core.cache.impl.GeoCacheManagerImpl; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; @@ -134,7 +138,8 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic } @Override - public List getWithinAlerts(DeviceIdentifier identifier, String owner) throws GeoLocationBasedServiceException { + public List getWithinAlerts(DeviceIdentifier identifier, String owner) throws + GeoLocationBasedServiceException, MetadataManagementException { Registry registry = getGovernanceRegistry(); String registryPath = GeoServices.REGISTRY_PATH_FOR_ALERTS + @@ -147,9 +152,22 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic return null; } + MetadataManagementService metadataManagementService = DeviceManagementDataHolder.getInstance().getMetadataManagementService(); + Metadata metaData = metadataManagementService.retrieveMetadata(registryPath); + try { List fences = new ArrayList<>(); - if (resource != null) { + if (metaData != null) { + String[] metaValues = metaData.getMetaValue().split(":"); + + for (String res : metaValues) { + Metadata childMeta = metadataManagementService.retrieveMetadata(registryPath); + + GeoFence geoFence = new GeoFence(); + + fences.add(geoFence); + } + Object contentObj = resource.getContent(); if (contentObj instanceof String[]) { String[] content = (String[]) contentObj; @@ -1135,6 +1153,21 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic "Error occurred while setting the Within Alert for " + identifier.getType() + " with id: " + identifier.getId(), e); } + + + Metadata metaData = new Metadata(); +// metaData.setMetaKey(identifier); + String metaValue = path; + metaData.setMetaValue(metaValue); + + MetadataManagementService metadataManagementService = DeviceManagementDataHolder.getInstance().getMetadataManagementService(); + try { + metadataManagementService.updateMetadata(metaData); + } catch (MetadataManagementException e) { + String msg = "Error occurred while creating meta data for meta key: " + path; + log.error(msg, e); + throw new GeoLocationBasedServiceException(msg, e); + } } private void updateRegistry(String path, Object content, Map options) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml index a9814241de..4e62851554 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml @@ -43,10 +43,12 @@ org.wso2.carbon.governance org.wso2.carbon.governance.api + org.wso2.carbon org.wso2.carbon.registry.api + org.wso2.carbon org.wso2.carbon.registry.core @@ -117,25 +119,25 @@ - - org.wso2.carbon.registry - org.wso2.carbon.registry.indexing - test - - - org.slf4j - jcl-over-slf4j - - - org.slf4j - slf4j-api - - - org.slf4j - log4j-over-slf4j - - - + + + + + + + + + + + + + + + + + + + org.apache.sling org.apache.sling.testing.osgi-mock diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index cb1c9dba67..65e64106d2 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -25,6 +25,39 @@ 5.0.26-SNAPSHOT ../../pom.xml + + + io.entgra.device.mgt.core + io.entgra.device.mgt.core.identity.jwt.client.extension + + + org.wso2.carbon.event-processing + org.wso2.carbon.event.processor.stub + + + org.wso2.carbon.commons + org.wso2.carbon.tenant.common + 4.7.39 + compile + + + io.entgra.device.mgt.core + io.entgra.device.mgt.core.device.mgt.common + + + io.entgra.device.mgt.core + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon + + + io.entgra.device.mgt.core + io.entgra.device.mgt.core.transport.mgt.email.sender.core + + + org.wso2.carbon.multitenancy + org.wso2.carbon.tenant.mgt + compile + + 4.0.0 device-mgt diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml index 8b646fa964..51194f19b5 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml @@ -43,10 +43,11 @@ org.wso2.carbon.governance org.wso2.carbon.governance.api - - org.wso2.carbon - org.wso2.carbon.registry.api - + + + + + org.wso2.carbon org.wso2.carbon.registry.core @@ -83,6 +84,7 @@ commons-lang.wso2 commons-lang + org.wso2.carbon.registry org.wso2.carbon.registry.indexing diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml index c71669f41e..b3b544694e 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml @@ -259,11 +259,12 @@ io.entgra.device.mgt.core.device.mgt.core provided - - org.wso2.carbon - org.wso2.carbon.registry.api - provided - + + + + + + org.wso2.carbon org.wso2.carbon.registry.core diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml index 6887a4f3e5..7b7f615b3c 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml @@ -192,10 +192,11 @@ - - org.wso2.carbon - org.wso2.carbon.registry.api - + + + + + org.wso2.carbon org.wso2.carbon.registry.core diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml index e274b0192a..04019124f7 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml @@ -240,11 +240,12 @@ io.entgra.device.mgt.core.device.mgt.core provided - - org.wso2.carbon - org.wso2.carbon.registry.api - provided - + + + + + + org.wso2.carbon org.wso2.carbon.registry.core diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml index 5ed3918990..9eefb0a18c 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml @@ -97,10 +97,10 @@ org.wso2.carbon.tenant.common ${carbon.commons.version} - - org.wso2.carbon - org.wso2.carbon.registry.core - + + + + org.wso2.carbon org.wso2.carbon.user.core diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml index 6476fc0aa6..27f32933e6 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml @@ -250,10 +250,12 @@ commons-pool.wso2 commons-pool + org.wso2.carbon.registry org.wso2.carbon.registry.indexing + org.wso2.carbon org.wso2.carbon.registry.core diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml index 3867d0806e..688b3a2ae3 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml @@ -63,6 +63,7 @@ commons-codec.wso2 commons-codec + org.wso2.carbon.registry org.wso2.carbon.registry.indexing diff --git a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml index 7f96d0da93..0a7e9ec6c6 100644 --- a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml +++ b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml @@ -52,6 +52,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.policy.information.point + org.wso2.carbon.registry org.wso2.carbon.registry.indexing diff --git a/pom.xml b/pom.xml index dd387b813a..1d612b5ba8 100644 --- a/pom.xml +++ b/pom.xml @@ -384,6 +384,7 @@ + org.wso2.carbon org.wso2.carbon.registry.api @@ -404,6 +405,7 @@ org.wso2.carbon.application.deployer ${carbon.kernel.version} + org.wso2.carbon org.wso2.carbon.registry.core @@ -1394,6 +1396,7 @@ + org.wso2.carbon.registry org.wso2.carbon.registry.indexing @@ -1414,21 +1417,21 @@ - - org.wso2.carbon.registry - org.wso2.carbon.registry.common - ${carbon.registry.version} - - - org.wso2.carbon.identity - org.wso2.carbon.user.mgt.stub - - - org.wso2.carbon.identity - org.wso2.carbon.user.mgt - - - + + + + + + + + + + + + + + + io.entgra.org.scannotation @@ -1647,6 +1650,7 @@ org.wso2.carbon.event.stream.stub ${carbon.analytics.common.version} + org.wso2.carbon.registry org.wso2.carbon.registry.resource