merge with upstream master

4.x.x
lasantha 7 years ago
commit 02415dfd92

@ -22,13 +22,13 @@
<parent> <parent>
<artifactId>apimgt-extensions</artifactId> <artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId> <artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Annotations</name> <name>WSO2 Carbon - API Management Annotations</name>
<description>WSO2 Carbon - API Management Custom Annotation Module</description> <description>WSO2 Carbon - API Management Custom Annotation Module</description>

@ -21,12 +21,12 @@
<parent> <parent>
<artifactId>apimgt-extensions</artifactId> <artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<artifactId>org.wso2.carbon.apimgt.application.extension.api</artifactId> <artifactId>org.wso2.carbon.apimgt.application.extension.api</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<name>WSO2 Carbon - API Application Management API</name> <name>WSO2 Carbon - API Application Management API</name>

@ -22,12 +22,12 @@
<parent> <parent>
<artifactId>apimgt-extensions</artifactId> <artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<artifactId>org.wso2.carbon.apimgt.application.extension</artifactId> <artifactId>org.wso2.carbon.apimgt.application.extension</artifactId>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>WSO2 Carbon - API Application Management</name> <name>WSO2 Carbon - API Application Management</name>

@ -21,13 +21,13 @@
<parent> <parent>
<artifactId>apimgt-extensions</artifactId> <artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.handlers</artifactId> <artifactId>org.wso2.carbon.apimgt.handlers</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>WSO2 Carbon - API Security Handler Component</name> <name>WSO2 Carbon - API Security Handler Component</name>
<description>WSO2 Carbon - API Management Security Handler Module</description> <description>WSO2 Carbon - API Management Security Handler Module</description>

@ -13,13 +13,13 @@
<parent> <parent>
<artifactId>apimgt-extensions</artifactId> <artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.integration.client</artifactId> <artifactId>org.wso2.carbon.apimgt.integration.client</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Integration Client</name> <name>WSO2 Carbon - API Management Integration Client</name>
<description>WSO2 Carbon - API Management Integration Client</description> <description>WSO2 Carbon - API Management Integration Client</description>

@ -13,13 +13,13 @@
<parent> <parent>
<artifactId>apimgt-extensions</artifactId> <artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.integration.generated.client</artifactId> <artifactId>org.wso2.carbon.apimgt.integration.generated.client</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Integration Generated Client</name> <name>WSO2 Carbon - API Management Integration Generated Client</name>
<description>WSO2 Carbon - API Management Integration Client</description> <description>WSO2 Carbon - API Management Integration Client</description>

@ -22,13 +22,13 @@
<parent> <parent>
<artifactId>apimgt-extensions</artifactId> <artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher</artifactId> <artifactId>org.wso2.carbon.apimgt.webapp.publisher</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Webapp Publisher</name> <name>WSO2 Carbon - API Management Webapp Publisher</name>
<description>WSO2 Carbon - API Management Webapp Publisher</description> <description>WSO2 Carbon - API Management Webapp Publisher</description>

@ -22,13 +22,13 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId> <artifactId>carbon-devicemgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>apimgt-extensions</artifactId> <artifactId>apimgt-extensions</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>WSO2 Carbon - API Management Extensions Component</name> <name>WSO2 Carbon - API Management Extensions Component</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>certificate-mgt</artifactId> <artifactId>certificate-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>certificate-mgt</artifactId> <artifactId>certificate-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -24,7 +24,7 @@
<parent> <parent>
<artifactId>certificate-mgt</artifactId> <artifactId>certificate-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -21,13 +21,13 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt</artifactId> <artifactId>certificate-mgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.certificate.mgt.core</artifactId> <artifactId>org.wso2.carbon.certificate.mgt.core</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>WSO2 Carbon - Certificate Management Core</name> <name>WSO2 Carbon - Certificate Management Core</name>
<description>WSO2 Carbon - Certificate Management Core</description> <description>WSO2 Carbon - Certificate Management Core</description>

@ -427,7 +427,10 @@ public class CertificateGenerator {
Date validityBeginDate = commonUtil.getValidityStartDate(); Date validityBeginDate = commonUtil.getValidityStartDate();
Date validityEndDate = commonUtil.getValidityEndDate(); Date validityEndDate = commonUtil.getValidityEndDate();
X500Name certSubject = new X500Name(CertificateManagementConstants.DEFAULT_PRINCIPAL); X500Name certSubject = request.getSubject();
if (certSubject == null) { //This is highly unlikely as the csr must have a subject name.
certSubject = new X500Name(CertificateManagementConstants.DEFAULT_PRINCIPAL);
}
Attribute attributes[] = request.getAttributes(); Attribute attributes[] = request.getAttributes();
RDN[] certUniqueIdRDN; RDN[] certUniqueIdRDN;

@ -45,6 +45,7 @@
<minRetriesToMarkInactive>20</minRetriesToMarkInactive> <minRetriesToMarkInactive>20</minRetriesToMarkInactive>
<!--<PolicyEvaluationPoint>Simple</PolicyEvaluationPoint>--> <!--<PolicyEvaluationPoint>Simple</PolicyEvaluationPoint>-->
<PolicyEvaluationPoint>Simple</PolicyEvaluationPoint> <PolicyEvaluationPoint>Simple</PolicyEvaluationPoint>
<CacheEnable>true</CacheEnable>
</PolicyConfiguration> </PolicyConfiguration>
<!--This specifies whether to enable the DeviceStatus Task in this node.--> <!--This specifies whether to enable the DeviceStatus Task in this node.-->
<DeviceStatusTaskConfig> <DeviceStatusTaskConfig>

@ -24,7 +24,7 @@
<parent> <parent>
<artifactId>certificate-mgt</artifactId> <artifactId>certificate-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,14 +22,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId> <artifactId>carbon-devicemgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt</artifactId> <artifactId>certificate-mgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>WSO2 Carbon - Certificate Management Component</name> <name>WSO2 Carbon - Certificate Management Component</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>device-mgt-extensions</artifactId> <artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>device-mgt-extensions</artifactId> <artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>device-mgt-extensions</artifactId> <artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>device-mgt-extensions</artifactId> <artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>device-mgt-extensions</artifactId> <artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>device-mgt-extensions</artifactId> <artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>carbon-devicemgt</artifactId> <artifactId>carbon-devicemgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId> <artifactId>device-mgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>device-mgt</artifactId> <artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -21,7 +21,7 @@
<parent> <parent>
<artifactId>device-mgt</artifactId> <artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId> <artifactId>device-mgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -299,6 +299,7 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
applicationMappingDAO.removeApplicationMapping(device.getId(), appIdsToRemove, tenantId); applicationMappingDAO.removeApplicationMapping(device.getId(), appIdsToRemove, tenantId);
Application installedApp; Application installedApp;
List<Integer> applicationIds = new ArrayList<>(); List<Integer> applicationIds = new ArrayList<>();
List<Application> applicationsToMap = new ArrayList<>();
for (Application application : applications) { for (Application application : applications) {
if (!installedAppList.contains(application)) { if (!installedAppList.contains(application)) {
@ -307,7 +308,8 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
if (installedApp == null) { if (installedApp == null) {
appsToAdd.add(application); appsToAdd.add(application);
} else { } else {
applicationIds.add(installedApp.getId()); application.setId(installedApp.getId());
applicationsToMap.add(application);
} }
} }
} }
@ -315,11 +317,18 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
log.debug("num of apps add:" + appsToAdd.size()); log.debug("num of apps add:" + appsToAdd.size());
} }
applicationIds.addAll(applicationDAO.addApplications(appsToAdd, tenantId)); applicationIds.addAll(applicationDAO.addApplications(appsToAdd, tenantId));
// Getting the applications ids for the second time
for (Application application : appsToAdd) {
installedApp = applicationDAO.getApplication(application.getApplicationIdentifier(),
application.getVersion(), tenantId);
application.setId(installedApp.getId());
applicationsToMap.add(application);
}
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("num of app Ids:" + applicationIds.size()); log.debug("num of app Ids:" + applicationIds.size());
} }
applicationMappingDAO.addApplicationMappings(device.getId(), applicationIds, tenantId); applicationMappingDAO.addApplicationMappingsWithApps(device.getId(), applicationsToMap, tenantId);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("num of remove app Ids:" + appIdsToRemove.size()); log.debug("num of remove app Ids:" + appIdsToRemove.size());

@ -34,6 +34,7 @@ public class PolicyConfiguration {
private int minRetriesToMarkInactive; private int minRetriesToMarkInactive;
private List<String> platforms; private List<String> platforms;
private String policyEvaluationPoint; private String policyEvaluationPoint;
private boolean cacheEnable;
@XmlElement(name = "MonitoringClass", required = true) @XmlElement(name = "MonitoringClass", required = true)
public String getMonitoringClass() { public String getMonitoringClass() {
@ -108,4 +109,13 @@ public class PolicyConfiguration {
this.policyEvaluationPoint = policyEvaluationPointName; this.policyEvaluationPoint = policyEvaluationPointName;
} }
@XmlElement(name = "CacheEnable", required = true)
public boolean getCacheEnable() {
return cacheEnable;
}
public void setCacheEnable(boolean cacheEnable) {
this.cacheEnable = cacheEnable;
}
} }

@ -34,5 +34,7 @@ public interface ApplicationDAO {
Application getApplication(String identifier, String version,int tenantId) throws DeviceManagementDAOException; Application getApplication(String identifier, String version,int tenantId) throws DeviceManagementDAOException;
Application getApplication(String identifier, String version, int deviceId, int tenantId) throws DeviceManagementDAOException;
List<Application> getInstalledApplications(int deviceId) throws DeviceManagementDAOException; List<Application> getInstalledApplications(int deviceId) throws DeviceManagementDAOException;
} }

@ -30,6 +30,9 @@ public interface ApplicationMappingDAO {
void addApplicationMappings(int deviceId, List<Integer> applicationIds, int tenantId) void addApplicationMappings(int deviceId, List<Integer> applicationIds, int tenantId)
throws DeviceManagementDAOException; throws DeviceManagementDAOException;
void addApplicationMappingsWithApps(int deviceId, List<Application> applications, int tenantId)
throws DeviceManagementDAOException;
void removeApplicationMapping(int deviceId, List<Integer> appIdList, int tenantId) void removeApplicationMapping(int deviceId, List<Integer> appIdList, int tenantId)
throws DeviceManagementDAOException; throws DeviceManagementDAOException;

@ -112,8 +112,6 @@ public class ApplicationDAOImpl implements ApplicationDAO {
Connection conn; Connection conn;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs; ResultSet rs;
ByteArrayOutputStream bao = null;
ObjectOutputStream oos = null;
List<Integer> applicationIds = new ArrayList<>(); List<Integer> applicationIds = new ArrayList<>();
try { try {
conn = this.getConnection(); conn = this.getConnection();
@ -133,14 +131,15 @@ public class ApplicationDAOImpl implements ApplicationDAO {
stmt.setString(7, application.getImageUrl()); stmt.setString(7, application.getImageUrl());
stmt.setInt(8, tenantId); stmt.setInt(8, tenantId);
bao = new ByteArrayOutputStream(); // Removing the application properties saving from the application table.
oos = new ObjectOutputStream(bao); stmt.setBigDecimal(9, null);
oos.writeObject(application.getAppProperties());
stmt.setBytes(9, bao.toByteArray());
stmt.setString(10, application.getApplicationIdentifier()); stmt.setString(10, application.getApplicationIdentifier());
stmt.setInt(11, application.getMemoryUsage());
stmt.setBoolean(12, application.isActive()); // Removing the application memory
stmt.setInt(11, 0);
stmt.setBoolean(12, true);
stmt.executeUpdate(); stmt.executeUpdate();
rs = stmt.getGeneratedKeys(); rs = stmt.getGeneratedKeys();
@ -151,23 +150,7 @@ public class ApplicationDAOImpl implements ApplicationDAO {
return applicationIds; return applicationIds;
} catch (SQLException e) { } catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while adding bulk application list", e); throw new DeviceManagementDAOException("Error occurred while adding bulk application list", e);
} catch (IOException e) {
throw new DeviceManagementDAOException("Error occurred while serializing application properties object", e);
} finally { } finally {
if (bao != null) {
try {
bao.close();
} catch (IOException e) {
log.error("Error occurred while closing ByteArrayOutputStream", e);
}
}
if (oos != null) {
try {
oos.close();
} catch (IOException e) {
log.error("Error occurred while closing ObjectOutputStream", e);
}
}
DeviceManagementDAOUtil.cleanupResources(stmt, null); DeviceManagementDAOUtil.cleanupResources(stmt, null);
} }
} }
@ -264,6 +247,38 @@ public class ApplicationDAOImpl implements ApplicationDAO {
} }
} }
@Override
public Application getApplication(String identifier, String version, int deviceId, int tenantId) throws DeviceManagementDAOException {
Connection conn;
PreparedStatement stmt = null;
ResultSet rs = null;
Application application = null;
try {
conn = this.getConnection();
stmt = conn.prepareStatement("SELECT ID, NAME, APP_IDENTIFIER, PLATFORM, CATEGORY, VERSION, TYPE, " +
"LOCATION_URL, IMAGE_URL, appmap.APP_PROPERTIES, appmap.MEMORY_USAGE, appmap.IS_ACTIVE, TENANT_ID " +
"FROM DM_APPLICATION app INNER JOIN " +
"(SELECT APPLICATION_ID, APP_PROPERTIES, MEMORY_USAGE, IS_ACTIVE FROM DM_DEVICE_APPLICATION_MAPPING W" +
"HERE DEVICE_ID = ?) appmap WHERE app.APP_IDENTIFIER = ? AND app.VERSION = ? AND " +
"appmap.APPLICATION_ID = app.id AND TENANT_ID = ?");
stmt.setInt(1, deviceId);
stmt.setString(2, identifier);
stmt.setString(3, version);
stmt.setInt(4, tenantId);
rs = stmt.executeQuery();
if (rs.next()) {
application = this.loadApplication(rs);
}
return application;
} catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while retrieving application application '" +
identifier + "' and version '" + version + "'.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
}
private Connection getConnection() throws SQLException { private Connection getConnection() throws SQLException {
return DeviceManagementDAOFactory.getConnection(); return DeviceManagementDAOFactory.getConnection();
} }
@ -278,9 +293,10 @@ public class ApplicationDAOImpl implements ApplicationDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
stmt = conn.prepareStatement("Select ID, NAME, APP_IDENTIFIER, PLATFORM, CATEGORY, VERSION, TYPE, " + stmt = conn.prepareStatement("Select ID, NAME, APP_IDENTIFIER, PLATFORM, CATEGORY, VERSION, TYPE, " +
"LOCATION_URL, IMAGE_URL, APP_PROPERTIES, MEMORY_USAGE, IS_ACTIVE, TENANT_ID From DM_APPLICATION app " + "LOCATION_URL, IMAGE_URL, APPMAP.APP_PROPERTIES, APPMAP.MEMORY_USAGE, APPMAP.IS_ACTIVE, " +
"INNER JOIN " + "TENANT_ID From DM_APPLICATION app INNER JOIN " +
"(Select APPLICATION_ID From DM_DEVICE_APPLICATION_MAPPING WHERE DEVICE_ID=?) APPMAP " + "(Select APPLICATION_ID, APP_PROPERTIES, MEMORY_USAGE, IS_ACTIVE" +
" From DM_DEVICE_APPLICATION_MAPPING WHERE DEVICE_ID=?) APPMAP " +
"ON " + "ON " +
"app.ID = APPMAP.APPLICATION_ID "); "app.ID = APPMAP.APPLICATION_ID ");

@ -29,9 +29,7 @@ import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil; import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.core.dto.operation.mgt.ProfileOperation; import org.wso2.carbon.device.mgt.core.dto.operation.mgt.ProfileOperation;
import java.io.ByteArrayInputStream; import java.io.*;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.sql.*; import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -52,7 +50,7 @@ public class ApplicationMappingDAOImpl implements ApplicationMappingDAO {
conn = this.getConnection(); conn = this.getConnection();
String sql = "INSERT INTO DM_DEVICE_APPLICATION_MAPPING (DEVICE_ID, APPLICATION_ID, " + String sql = "INSERT INTO DM_DEVICE_APPLICATION_MAPPING (DEVICE_ID, APPLICATION_ID, " +
"TENANT_ID) VALUES (?, ?, ?)"; "TENANT_ID) VALUES (?, ?, ?)";
stmt = conn.prepareStatement(sql, new String[] {"id"}); stmt = conn.prepareStatement(sql, new String[]{"id"});
stmt.setInt(1, deviceId); stmt.setInt(1, deviceId);
stmt.setInt(2, applicationId); stmt.setInt(2, applicationId);
stmt.setInt(3, tenantId); stmt.setInt(3, tenantId);
@ -99,6 +97,64 @@ public class ApplicationMappingDAOImpl implements ApplicationMappingDAO {
} }
} }
@Override
public void addApplicationMappingsWithApps(int deviceId, List<Application> applications, int tenantId)
throws DeviceManagementDAOException {
Connection conn;
PreparedStatement stmt = null;
ResultSet rs = null;
ByteArrayOutputStream bao = null;
ObjectOutputStream oos = null;
try {
conn = this.getConnection();
String sql = "INSERT INTO DM_DEVICE_APPLICATION_MAPPING (DEVICE_ID, APPLICATION_ID, APP_PROPERTIES, " +
"MEMORY_USAGE, IS_ACTIVE, TENANT_ID) VALUES (?, ?, ?, ?, ?, ?)";
conn.setAutoCommit(false);
stmt = conn.prepareStatement(sql);
for (Application application : applications) {
stmt.setInt(1, deviceId);
stmt.setInt(2, application.getId());
bao = new ByteArrayOutputStream();
oos = new ObjectOutputStream(bao);
oos.writeObject(application.getAppProperties());
stmt.setBytes(3, bao.toByteArray());
stmt.setInt(4, application.getMemoryUsage());
stmt.setBoolean(5, application.isActive());
stmt.setInt(6, tenantId);
stmt.addBatch();
}
stmt.executeBatch();
} catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while adding device application mappings", e);
} catch (IOException e) {
throw new DeviceManagementDAOException("Error occurred while serializing application properties object", e);
} finally {
if (bao != null) {
try {
bao.close();
} catch (IOException e) {
log.error("Error occurred while closing ByteArrayOutputStream", e);
}
}
if (oos != null) {
try {
oos.close();
} catch (IOException e) {
log.error("Error occurred while closing ObjectOutputStream", e);
}
}
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
}
@Override @Override
public void removeApplicationMapping(int deviceId, List<Integer> appIdList, public void removeApplicationMapping(int deviceId, List<Integer> appIdList,
int tenantId) throws DeviceManagementDAOException { int tenantId) throws DeviceManagementDAOException {

@ -26,6 +26,7 @@ import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAO
import java.sql.*; import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -43,14 +44,15 @@ public abstract class AbstractNotificationDAOImpl implements NotificationDAO {
try { try {
conn = NotificationManagementDAOFactory.getConnection(); conn = NotificationManagementDAOFactory.getConnection();
String sql = String sql =
"INSERT INTO DM_NOTIFICATION(DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION, TENANT_ID) " + "INSERT INTO DM_NOTIFICATION(DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION, " +
"VALUES (?, ?, ?, ?, ?)"; "TENANT_ID, LAST_UPDATED_TIMESTAMP) VALUES (?, ?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
stmt.setInt(1, deviceId); stmt.setInt(1, deviceId);
stmt.setInt(2, notification.getOperationId()); stmt.setInt(2, notification.getOperationId());
stmt.setString(3, notification.getStatus().toString()); stmt.setString(3, notification.getStatus().toString());
stmt.setString(4, notification.getDescription()); stmt.setString(4, notification.getDescription());
stmt.setInt(5, tenantId); stmt.setInt(5, tenantId);
stmt.setTimestamp(6, new Timestamp(new Date().getTime()));
stmt.execute(); stmt.execute();
rs = stmt.getGeneratedKeys(); rs = stmt.getGeneratedKeys();
if (rs.next()) { if (rs.next()) {
@ -103,13 +105,14 @@ public abstract class AbstractNotificationDAOImpl implements NotificationDAO {
int rows; int rows;
try { try {
conn = NotificationManagementDAOFactory.getConnection(); conn = NotificationManagementDAOFactory.getConnection();
String sql = "UPDATE DM_NOTIFICATION SET OPERATION_ID = ?, STATUS = ?, DESCRIPTION = ? " + String sql = "UPDATE DM_NOTIFICATION SET OPERATION_ID = ?, STATUS = ?, DESCRIPTION = ?, " +
"WHERE NOTIFICATION_ID = ?"; "LAST_UPDATED_TIMESTAMP = ? WHERE NOTIFICATION_ID = ?";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setInt(1, notification.getOperationId()); stmt.setInt(1, notification.getOperationId());
stmt.setString(2, notification.getStatus().toString()); stmt.setString(2, notification.getStatus().toString());
stmt.setString(3, notification.getDescription()); stmt.setString(3, notification.getDescription());
stmt.setInt(4, notification.getNotificationId()); stmt.setTimestamp(4, new Timestamp(new Date().getTime()));
stmt.setInt(5, notification.getNotificationId());
rows = stmt.executeUpdate(); rows = stmt.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
throw new NotificationManagementException("Error occurred while updating the " + throw new NotificationManagementException("Error occurred while updating the " +
@ -128,10 +131,11 @@ public abstract class AbstractNotificationDAOImpl implements NotificationDAO {
int rows; int rows;
try { try {
conn = NotificationManagementDAOFactory.getConnection(); conn = NotificationManagementDAOFactory.getConnection();
String sql = "UPDATE DM_NOTIFICATION SET STATUS = ? WHERE NOTIFICATION_ID = ?"; String sql = "UPDATE DM_NOTIFICATION SET STATUS = ?, LAST_UPDATED_TIMESTAMP = ? WHERE NOTIFICATION_ID = ?";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setString(1, status.toString()); stmt.setString(1, status.toString());
stmt.setInt(2, notificationId); stmt.setTimestamp(2, new Timestamp(new Date().getTime()));
stmt.setInt(3, notificationId);
rows = stmt.executeUpdate(); rows = stmt.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
throw new NotificationManagementException("Error occurred while updating the status of " + throw new NotificationManagementException("Error occurred while updating the status of " +
@ -150,10 +154,11 @@ public abstract class AbstractNotificationDAOImpl implements NotificationDAO {
int rows; int rows;
try { try {
conn = NotificationManagementDAOFactory.getConnection(); conn = NotificationManagementDAOFactory.getConnection();
String sql = "UPDATE DM_NOTIFICATION SET STATUS = ? WHERE TENANT_ID= ?"; String sql = "UPDATE DM_NOTIFICATION SET STATUS = ?, LAST_UPDATED_TIMESTAMP = ? WHERE TENANT_ID= ?";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setString(1, status.toString()); stmt.setString(1, status.toString());
stmt.setInt(2, tenantID); stmt.setTimestamp(2, new Timestamp(new Date().getTime()));
stmt.setInt(3, tenantID);
rows = stmt.executeUpdate(); rows = stmt.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
throw new NotificationManagementException("Error while trying to clear all " + throw new NotificationManagementException("Error while trying to clear all " +

@ -26,6 +26,7 @@ import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAO
import java.sql.*; import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -41,14 +42,16 @@ public class OracleNotificationDAOImpl extends AbstractNotificationDAOImpl {
int notificationId = -1; int notificationId = -1;
try { try {
conn = NotificationManagementDAOFactory.getConnection(); conn = NotificationManagementDAOFactory.getConnection();
String sql = "INSERT INTO DM_NOTIFICATION(DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION, TENANT_ID) " String sql = "INSERT INTO DM_NOTIFICATION(DEVICE_ID, OPERATION_ID, STATUS, " +
+ "VALUES (?, ?, ?, ?, ?)"; "DESCRIPTION, TENANT_ID, LAST_UPDATED_TIMESTAMP) "
+ "VALUES (?, ?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(sql, new int[] { 1 }); stmt = conn.prepareStatement(sql, new int[] { 1 });
stmt.setInt(1, deviceId); stmt.setInt(1, deviceId);
stmt.setInt(2, notification.getOperationId()); stmt.setInt(2, notification.getOperationId());
stmt.setString(3, notification.getStatus().toString()); stmt.setString(3, notification.getStatus().toString());
stmt.setString(4, notification.getDescription()); stmt.setString(4, notification.getDescription());
stmt.setInt(5, tenantId); stmt.setInt(5, tenantId);
stmt.setTimestamp(6, new Timestamp(new Date().getTime()));
stmt.execute(); stmt.execute();
rs = stmt.getGeneratedKeys(); rs = stmt.getGeneratedKeys();
if (rs.next()) { if (rs.next()) {

@ -565,7 +565,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
DeviceManagementDAOFactory.closeConnection(); DeviceManagementDAOFactory.closeConnection();
} }
if (requireDeviceInfo) { if (!allDevices.isEmpty() && requireDeviceInfo) {
return this.getAllDeviceInfo(allDevices); return this.getAllDeviceInfo(allDevices);
} }
return allDevices; return allDevices;

@ -57,6 +57,7 @@
<!--Simple -> Simple policy evaluation point--> <!--Simple -> Simple policy evaluation point-->
<!--Merged -> Merged policy evaluation point --> <!--Merged -> Merged policy evaluation point -->
<PolicyEvaluationPoint>Simple</PolicyEvaluationPoint> <PolicyEvaluationPoint>Simple</PolicyEvaluationPoint>
<CacheEnable>true</CacheEnable>
</PolicyConfiguration> </PolicyConfiguration>
<!-- Default Page size configuration for paginated DM APIs--> <!-- Default Page size configuration for paginated DM APIs-->
<PaginationConfiguration> <PaginationConfiguration>

@ -57,6 +57,7 @@
<!--Simple -> Simple policy evaluation point--> <!--Simple -> Simple policy evaluation point-->
<!--Merged -> Merged policy evaluation point --> <!--Merged -> Merged policy evaluation point -->
<PolicyEvaluationPoint>Simple</PolicyEvaluationPoint> <PolicyEvaluationPoint>Simple</PolicyEvaluationPoint>
<CacheEnable>true</CacheEnable>
</PolicyConfiguration> </PolicyConfiguration>
<!-- Default Page size configuration for paginated DM APIs--> <!-- Default Page size configuration for paginated DM APIs-->
<PaginationConfiguration> <PaginationConfiguration>

@ -367,6 +367,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INTEGER NOT NULL, DEVICE_ID INTEGER NOT NULL,
APPLICATION_ID INTEGER NOT NULL, APPLICATION_ID INTEGER NOT NULL,
APP_PROPERTIES BLOB NULL,
MEMORY_USAGE INTEGER(10) NULL,
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES
@ -385,6 +388,7 @@ CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
STATUS VARCHAR(10) NULL, STATUS VARCHAR(10) NULL,
DESCRIPTION VARCHAR(1000) NULL, DESCRIPTION VARCHAR(1000) NULL,
LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL,
PRIMARY KEY (NOTIFICATION_ID), PRIMARY KEY (NOTIFICATION_ID),
CONSTRAINT fk_dm_device_notification FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT fk_dm_device_notification FOREIGN KEY (DEVICE_ID) REFERENCES
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>device-mgt</artifactId> <artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -367,6 +367,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INTEGER NOT NULL, DEVICE_ID INTEGER NOT NULL,
APPLICATION_ID INTEGER NOT NULL, APPLICATION_ID INTEGER NOT NULL,
APP_PROPERTIES BLOB NULL,
MEMORY_USAGE INTEGER(10) NULL,
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>device-mgt</artifactId> <artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -9,7 +9,7 @@
"remoteSessionWSURL": "https://%iot.core.host%:%iot.core.https.port%", "remoteSessionWSURL": "https://%iot.core.host%:%iot.core.https.port%",
"portalURL": "https://%iot.analytics.host%:%iot.analytics.https.port%", "portalURL": "https://%iot.analytics.host%:%iot.analytics.https.port%",
"dashboardServerURL": "%https.ip%", "dashboardServerURL": "%https.ip%",
"androidEnrollmentDir": "/android-web-agent/enrollment", "androidAgentDownloadURL": "%https.ip%/devicemgt/public/cdmf.unit.device.type.android.type-view/assets/android-agent.apk",
"windowsEnrollmentDir": "/windows-web-agent/enrollment", "windowsEnrollmentDir": "/windows-web-agent/enrollment",
"iOSEnrollmentDir": "/ios-web-agent/enrollment", "iOSEnrollmentDir": "/ios-web-agent/enrollment",
"iOSConfigRoot": "%https.ip%/ios-enrollment/", "iOSConfigRoot": "%https.ip%/ios-enrollment/",

@ -7,7 +7,7 @@
<p class="page-sub-title">Register</p> <p class="page-sub-title">Register</p>
<p>Create new account on WSO2 IoT (All fields are required.)</p> <p>Create a new account in WSO2 IoT Server(All fields are required.)</p>
<hr/> <hr/>
<!-- validation --> <!-- validation -->
<div class="wr-validation-summary hidden alert alert-danger"> <div class="wr-validation-summary hidden alert alert-danger">

@ -23,7 +23,7 @@
{{#if deviceFound}} {{#if deviceFound}}
{{#if isAuthorized}} {{#if isAuthorized}}
<div class="row"> <div class="row">
<div class="col-lg-4"> <div class="col-lg-5">
<div class="device-info-container"> <div class="device-info-container">
<div class="row"> <div class="row">
<div class="col-lg-3"> <div class="col-lg-3">
@ -68,8 +68,8 @@
{{/defineZone}} {{/defineZone}}
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<!-- /col-lg-4 --> <!-- /col-lg-5 -->
<div class="col-lg-8"> <div class="col-lg-7">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
{{#defineZone "device-view-tabs"}} {{#defineZone "device-view-tabs"}}
<li class="active"><a data-toggle="tab" href="#event_log">Operations Log</a></li> <li class="active"><a data-toggle="tab" href="#event_log">Operations Log</a></li>
@ -118,7 +118,7 @@
{{/defineZone}} {{/defineZone}}
</div> </div>
</div> </div>
<!-- /col-lg-08 --> <!-- /col-lg-7 -->
</div> </div>
<!-- /row --> <!-- /row -->
{{else}} {{else}}

@ -56,7 +56,7 @@ function addTileUrl() {
var serverUrl = "/portal/store/carbon.super/fs/gadget/geo-dashboard/controllers/tile_servers.jag"; var serverUrl = "/portal/store/carbon.super/fs/gadget/geo-dashboard/controllers/tile_servers.jag";
// TODO: If failure happens notify user about the error message // TODO: If failure happens notify user about the error message
$.post(serverUrl, data, function (response) { $.post(serverUrl, data, function (response) {
noty({text: '<span style="color: dodgerblue">' + response + '</span>', type: 'success' }); noty({text: '<span style="color: dodgerblue">' + response + '</span>', type: 'success'});
closeAll(); closeAll();
}); });
} }
@ -75,9 +75,12 @@ function getTileServers() {
});*/ });*/
$.getJSON("/api/controllers/tile_servers?serverId=all", function (data) { $.getJSON("/api/controllers/tile_servers?serverId=all", function (data) {
console.log(JSON.stringify(data));
$.each(data, function (key, val) { $.each(data, function (key, val) {
noty({text: 'Loading... <span style="color: #ccfcff">' + val.NAME + '</span>', type: 'info'}); noty({
text: 'Loading... <span style="color: #ccfcff">' + val.NAME + '</span>',
type: 'info'
});
//baseLayers[val.name] //baseLayers[val.name]
var newTileLayer = L.tileLayer( var newTileLayer = L.tileLayer(
val.URL, { val.URL, {
@ -152,8 +155,10 @@ function addWmsEndPoint() {
var serverUrl = "/api/controllers/wms_endpoints"; var serverUrl = "/api/controllers/wms_endpoints";
// TODO: If failure happens notify user about the error message // TODO: If failure happens notify user about the error message
$.post(serverUrl, data, function (response) { $.post(serverUrl, data, function (response) {
console.log("------->><wms_endpoints>"+ response); noty({
noty({text: '<span style="color: dodgerblue">' + response + '</span>',type: 'success'}); text: '<span style="color: dodgerblue">' + response + '</span>',
type: 'success'
});
closeAll(); closeAll();
}); });
} }
@ -182,12 +187,9 @@ function setSpeedAlert() {
//TODO: get the device Id from the URL //TODO: get the device Id from the URL
var speedAlertValue = $("#speedAlertValue").val(); var speedAlertValue = $("#speedAlertValue").val();
if (speedAlertValue == null || speedAlertValue === undefined || speedAlertValue == "") { if (!speedAlertValue) {
var message = "Speed cannot be empty."; var message = "Speed cannot be empty.";
noty({text: message, type : 'error' }); noty({text: message, type: 'error'});
} else if (areaName.indexOf(" ") > -1) {
var message = "Area Name cannot contain spaces.";
noty({text: message, type : 'error' });
} else { } else {
data = { data = {
'parseData': JSON.stringify({'speedAlertValue': speedAlertValue, 'deviceId': deviceId}), // parseKey : parseValue pair , this key pair is replace with the key in the template file 'parseData': JSON.stringify({'speedAlertValue': speedAlertValue, 'deviceId': deviceId}), // parseKey : parseValue pair , this key pair is replace with the key in the template file
@ -200,7 +202,7 @@ function setSpeedAlert() {
var responseHandler = function (data, textStatus, xhr) { var responseHandler = function (data, textStatus, xhr) {
closeAll(); closeAll();
if (xhr.status == 200) { if (xhr.status == 200) {
noty({text: 'Successfully added alert', type : 'success'}); noty({text: 'Successfully added alert', type: 'success'});
} else { } else {
var ptrn = /(?:<am\:description>)(.*)(?:<\/am\:description>)/g; var ptrn = /(?:<am\:description>)(.*)(?:<\/am\:description>)/g;
var result = (ptrn.exec(data)); var result = (ptrn.exec(data));
@ -210,7 +212,7 @@ function setSpeedAlert() {
} else { } else {
errorTxt = data; errorTxt = data;
} }
noty({text: textStatus + ' : ' + errorTxt, type : 'error'}); noty({text: textStatus + ' : ' + errorTxt, type: 'error'});
} }
}; };
invokerUtil.put(serviceUrl, invokerUtil.put(serviceUrl,
@ -237,30 +239,31 @@ function setWithinAlert(leafletId) {
if (areaName == null || areaName === undefined || areaName == "") { if (areaName == null || areaName === undefined || areaName == "") {
var message = "Area Name cannot be empty."; var message = "Area Name cannot be empty.";
noty({text: message, type : 'error' }); noty({text: message, type: 'error'});
} else if (areaName.indexOf(" ") > -1) { } else if ($.trim(areaName).indexOf(" ") > -1) {
var message = "Area Name cannot contain spaces."; var message = "Area Name cannot contain spaces.";
noty({text: message, type : 'error' }); noty({text: message, type: 'error'});
} else { } else {
areaName = $.trim(areaName);
var data = { var data = {
'parseData': JSON.stringify({ 'parseData': JSON.stringify({
'geoFenceGeoJSON': selectedAreaGeoJson, 'geoFenceGeoJSON': selectedAreaGeoJson,
'executionPlanName': createExecutionPlanName(queryName, "WithIn", deviceId), 'executionPlanName': createExecutionPlanName(queryName, "WithIn", deviceId),
'areaName': areaName, 'areaName': areaName,
'deviceId' : deviceId 'deviceId': deviceId
}), }),
'executionPlan': 'Within', 'executionPlan': 'Within',
'customName': areaName, // TODO: fix , When template copies there can be two queryName and areaName id elements in the DOM 'customName': areaName, // TODO: fix , When template copies there can be two queryName and areaName id elements in the DOM
'queryName': queryName, 'queryName': queryName,
'cepAction': 'deploy', 'cepAction': 'deploy',
'deviceId' : deviceId 'deviceId': deviceId
}; };
var serviceUrl = '/api/device-mgt/v1.0/geo-services/alerts/Within/' + deviceType + '/' + deviceId; var serviceUrl = '/api/device-mgt/v1.0/geo-services/alerts/Within/' + deviceType + '/' + deviceId;
var responseHandler = function (data, textStatus, xhr) { var responseHandler = function (data, textStatus, xhr) {
closeTools(leafletId); closeTools(leafletId);
if (xhr.status == 200) { if (xhr.status == 200) {
noty({text: 'Successfully added alert', type : 'success'}); noty({text: 'Successfully added alert', type: 'success'});
} else { } else {
var ptrn = /(?:<am\:description>)(.*)(?:<\/am\:description>)/g; var ptrn = /(?:<am\:description>)(.*)(?:<\/am\:description>)/g;
var errorTxt; var errorTxt;
@ -270,7 +273,7 @@ function setWithinAlert(leafletId) {
} else { } else {
errorTxt = data; errorTxt = data;
} }
noty({text: textStatus + ' : ' + errorTxt, type : 'error'}); noty({text: textStatus + ' : ' + errorTxt, type: 'error'});
} }
}; };
invokerUtil.post(serviceUrl, invokerUtil.post(serviceUrl,
@ -295,30 +298,31 @@ function setExitAlert(leafletId) {
if (areaName == null || areaName === undefined || areaName == "") { if (areaName == null || areaName === undefined || areaName == "") {
var message = "Area Name cannot be empty."; var message = "Area Name cannot be empty.";
noty({text: message, type : 'error' }); noty({text: message, type: 'error'});
} else if (areaName.indexOf(" ") > -1) { } else if ($.trim(areaName).indexOf(" ") > -1) {
var message = "Area Name cannot contain spaces."; var message = "Area Name cannot contain spaces.";
noty({text: message, type : 'error' }); noty({text: message, type: 'error'});
} else { } else {
areaName = $.trim(areaName);
var data = { var data = {
'parseData': JSON.stringify({ 'parseData': JSON.stringify({
'geoFenceGeoJSON': selectedAreaGeoJson, 'geoFenceGeoJSON': selectedAreaGeoJson,
'executionPlanName': createExecutionPlanName(queryName, "Exit", deviceId), 'executionPlanName': createExecutionPlanName(queryName, "Exit", deviceId),
'areaName': areaName, 'areaName': areaName,
'deviceId' : deviceId 'deviceId': deviceId
}), }),
'executionPlan': 'Exit', 'executionPlan': 'Exit',
'customName': areaName, // TODO: fix , When template copies there can be two queryName and areaName id elements in the DOM 'customName': areaName, // TODO: fix , When template copies there can be two queryName and areaName id elements in the DOM
'queryName': queryName, 'queryName': queryName,
'cepAction': 'deploy', 'cepAction': 'deploy',
'deviceId' : deviceId 'deviceId': deviceId
}; };
var serviceUrl = '/api/device-mgt/v1.0/geo-services/alerts/Exit/' + deviceType + '/' + deviceId; var serviceUrl = '/api/device-mgt/v1.0/geo-services/alerts/Exit/' + deviceType + '/' + deviceId;
var responseHandler = function (data, textStatus, xhr) { var responseHandler = function (data, textStatus, xhr) {
closeTools(leafletId); closeTools(leafletId);
if (xhr.status == 200) { if (xhr.status == 200) {
noty({text: 'Successfully added alert', type : 'success'}); noty({text: 'Successfully added alert', type: 'success'});
} else { } else {
var ptrn = /(?:<am\:description>)(.*)(?:<\/am\:description>)/g; var ptrn = /(?:<am\:description>)(.*)(?:<\/am\:description>)/g;
var errorTxt; var errorTxt;
@ -328,7 +332,7 @@ function setExitAlert(leafletId) {
} else { } else {
errorTxt = data; errorTxt = data;
} }
noty({text: textStatus + ' : ' + errorTxt, type : 'error'}); noty({text: textStatus + ' : ' + errorTxt, type: 'error'});
} }
}; };
invokerUtil.post(serviceUrl, invokerUtil.post(serviceUrl,
@ -360,17 +364,18 @@ function setStationeryAlert(leafletId) {
if (stationeryName == null || stationeryName === undefined || stationeryName == "") { if (stationeryName == null || stationeryName === undefined || stationeryName == "") {
var message = "Stationery Name cannot be empty."; var message = "Stationery Name cannot be empty.";
noty({text: message, type : 'error' }); noty({text: message, type: 'error'});
} else if (stationeryName.indexOf(" ") > -1) { } else if ($.trim(stationeryName).indexOf(" ") > -1) {
var message = "Stationery Name cannot contain spaces."; var message = "Stationery Name cannot contain spaces.";
noty({text: message, type : 'error' }); noty({text: message, type: 'error'});
} else if (fluctuationRadius == null || fluctuationRadius === undefined || fluctuationRadius == "") { } else if (fluctuationRadius == null || fluctuationRadius === undefined || fluctuationRadius == "") {
var message = "Fluctuation Radius cannot be empty."; var message = "Fluctuation Radius cannot be empty.";
noty({text: message, type : 'error' }); noty({text: message, type: 'error'});
} else if (time == null || time === undefined || time == "") { } else if (time == null || time === undefined || time == "") {
var message = "Time cannot be empty."; var message = "Time cannot be empty.";
noty({text: message, type: 'error' }); noty({text: message, type: 'error'});
} else { } else {
stationeryName = $.trim(stationeryName);
var data = { var data = {
'parseData': JSON.stringify({ 'parseData': JSON.stringify({
'geoFenceGeoJSON': selectedProcessedAreaGeoJson, 'geoFenceGeoJSON': selectedProcessedAreaGeoJson,
@ -391,7 +396,7 @@ function setStationeryAlert(leafletId) {
var responseHandler = function (data, textStatus, xhr) { var responseHandler = function (data, textStatus, xhr) {
closeTools(leafletId); closeTools(leafletId);
if (xhr.status == 200) { if (xhr.status == 200) {
noty({text: 'Successfully added alert', type : 'success'}); noty({text: 'Successfully added alert', type: 'success'});
} else { } else {
var ptrn = /(?:<am\:description>)(.*)(?:<\/am\:description>)/g; var ptrn = /(?:<am\:description>)(.*)(?:<\/am\:description>)/g;
var errorTxt; var errorTxt;
@ -401,7 +406,7 @@ function setStationeryAlert(leafletId) {
} else { } else {
errorTxt = data; errorTxt = data;
} }
noty({text: textStatus + ' : ' + errorTxt, type : 'error'}); noty({text: textStatus + ' : ' + errorTxt, type: 'error'});
} }
}; };
invokerUtil.post(serviceUrl, invokerUtil.post(serviceUrl,
@ -461,7 +466,6 @@ function setTrafficAlert(leafletId) {
* this is against JSON standards so has been re-replaced when getting the data from governance registry * this is against JSON standards so has been re-replaced when getting the data from governance registry
* (look in get_alerts for .replace() method) * (look in get_alerts for .replace() method)
* */ * */
console.log("leafletId: " + leafletId);
var selectedAreaGeoJson = map._layers[leafletId].toGeoJSON().geometry; var selectedAreaGeoJson = map._layers[leafletId].toGeoJSON().geometry;
//if a circle is drawn adding radius for the object //if a circle is drawn adding radius for the object
@ -479,11 +483,12 @@ function setTrafficAlert(leafletId) {
if (areaName == null || areaName === undefined || areaName == "") { if (areaName == null || areaName === undefined || areaName == "") {
var message = "Area Name cannot be empty."; var message = "Area Name cannot be empty.";
noty({text: message, type : 'error' }); noty({text: message, type: 'error'});
} else if (areaName.indexOf(" ") > -1) { } else if ($.trim(areaName).indexOf(" ") > -1) {
var message = "Area Name cannot contain spaces."; var message = "Area Name cannot contain spaces.";
noty({text: message, type : 'error' }); noty({text: message, type: 'error'});
} else { } else {
areaName = $.trim(areaName);
var data = { var data = {
'parseData': JSON.stringify({ 'parseData': JSON.stringify({
'geoFenceGeoJSON': selectedProcessedAreaGeoJson, 'geoFenceGeoJSON': selectedProcessedAreaGeoJson,
@ -496,12 +501,12 @@ function setTrafficAlert(leafletId) {
'cepAction': 'deploy', 'cepAction': 'deploy',
'deviceId': deviceId 'deviceId': deviceId
}; };
console.log(JSON.stringify(data));
var serviceUrl = '/api/device-mgt/v1.0/geo-services/alerts/Traffic/' + deviceType + '/' + deviceId; var serviceUrl = '/api/device-mgt/v1.0/geo-services/alerts/Traffic/' + deviceType + '/' + deviceId;
var responseHandler = function (data, textStatus, xhr) { var responseHandler = function (data, textStatus, xhr) {
closeTools(leafletId); closeTools(leafletId);
if (xhr.status == 200) { if (xhr.status == 200) {
noty({text: 'Successfully added alert', type : 'success'}); noty({text: 'Successfully added alert', type: 'success'});
} else { } else {
var ptrn = /(?:<am\:description>)(.*)(?:<\/am\:description>)/g; var ptrn = /(?:<am\:description>)(.*)(?:<\/am\:description>)/g;
var errorTxt; var errorTxt;
@ -511,7 +516,7 @@ function setTrafficAlert(leafletId) {
} else { } else {
errorTxt = data; errorTxt = data;
} }
noty({text: textStatus + ' : ' + errorTxt, type : 'error'}); noty({text: textStatus + ' : ' + errorTxt, type: 'error'});
} }
}; };
invokerUtil.post(serviceUrl, invokerUtil.post(serviceUrl,
@ -544,7 +549,6 @@ function removeGeoFence(geoFenceElement, id) {
} }
function getAlertsHistory(deviceType, deviceId, timeFrom, timeTo) { function getAlertsHistory(deviceType, deviceId, timeFrom, timeTo) {
var timeRange = ''; var timeRange = '';
if (timeFrom && timeTo) { if (timeFrom && timeTo) {
@ -556,11 +560,11 @@ function getAlertsHistory(deviceType, deviceId, timeFrom, timeTo) {
geoAlertsBar.clearAllAlerts(); geoAlertsBar.clearAllAlerts();
var alerts = JSON.parse(data); var alerts = JSON.parse(data);
$.each(alerts, function (key, val) { $.each(alerts, function (key, val) {
if(val.values){ if (val.values) {
val = val.values; val = val.values;
} }
var msg = deviceType.charAt(0).toUpperCase() + deviceType.slice(1) + var msg = deviceType.charAt(0).toUpperCase() + deviceType.slice(1) +
" " + deviceId +" "+ val.information.replace("Alerts: ,", "") + " - " + timeSince(val.timeStamp); " " + deviceId + " " + val.information.replace("Alerts: ,", "") + " - " + timeSince(val.timeStamp);
switch (val.state) { switch (val.state) {
case "NORMAL": case "NORMAL":
return; return;
@ -587,14 +591,16 @@ function setProximityAlert() {
if (proximityDistance == null || proximityDistance === undefined || proximityDistance == "") { if (proximityDistance == null || proximityDistance === undefined || proximityDistance == "") {
var message = "Proximity distance cannot be empty."; var message = "Proximity distance cannot be empty.";
noty({text: message, type : 'error'}); noty({text: message, type: 'error'});
} else if (proximityTime == null || proximityTime === undefined || proximityTime == "") { } else if (proximityTime == null || proximityTime === undefined || proximityTime == "") {
var message = "Proximity Time cannot be empty."; var message = "Proximity Time cannot be empty.";
noty({text: message, type : 'error'}); noty({text: message, type: 'error'});
} else { } else {
var data = { var data = {
'parseData': JSON.stringify({'proximityTime': proximityTime, 'proximityDistance': proximityDistance}), 'parseData': JSON.stringify({
'proximityTime': proximityTime,
'proximityDistance': proximityDistance
}),
'proximityTime': proximityTime, 'proximityTime': proximityTime,
'proximityDistance': proximityDistance, 'proximityDistance': proximityDistance,
'executionPlan': 'Proximity', 'executionPlan': 'Proximity',
@ -606,7 +612,7 @@ function setProximityAlert() {
var responseHandler = function (data, textStatus, xhr) { var responseHandler = function (data, textStatus, xhr) {
closeAll(); closeAll();
if (xhr.status == 200) { if (xhr.status == 200) {
noty({text: 'Successfully added alert', type : 'success'}); noty({text: 'Successfully added alert', type: 'success'});
} else { } else {
var ptrn = /(?:<am\:description>)(.*)(?:<\/am\:description>)/g; var ptrn = /(?:<am\:description>)(.*)(?:<\/am\:description>)/g;
var errorTxt; var errorTxt;
@ -616,7 +622,7 @@ function setProximityAlert() {
} else { } else {
errorTxt = data; errorTxt = data;
} }
noty({text: textStatus + ' : ' + errorTxt, type : 'error'}); noty({text: textStatus + ' : ' + errorTxt, type: 'error'});
} }
}; };
invokerUtil.put(serviceUrl, invokerUtil.put(serviceUrl,
@ -633,7 +639,7 @@ function createExecutionPlanName(queryName, id, deviceId) {
if (id == "WithIn") { if (id == "WithIn") {
return 'Geo-ExecutionPlan-Within' + (queryName ? '_' + queryName : '') + "---" + (deviceId ? '_' + deviceId : '') + '_alert'; // TODO: value of the `queryName` can't be empty, because it will cause name conflicts in CEP, have to do validation(check not empty String) return 'Geo-ExecutionPlan-Within' + (queryName ? '_' + queryName : '') + "---" + (deviceId ? '_' + deviceId : '') + '_alert'; // TODO: value of the `queryName` can't be empty, because it will cause name conflicts in CEP, have to do validation(check not empty String)
} else if(id == "Exit"){ } else if (id == "Exit") {
return 'Geo-ExecutionPlan-Exit' + (queryName ? '_' + queryName : '') + "---" + (deviceId ? '_' + deviceId : '') + '_alert'; // TODO: value of the `queryName` can't be empty, because it will cause name conflicts in CEP, have to do validation(check not empty String) return 'Geo-ExecutionPlan-Exit' + (queryName ? '_' + queryName : '') + "---" + (deviceId ? '_' + deviceId : '') + '_alert'; // TODO: value of the `queryName` can't be empty, because it will cause name conflicts in CEP, have to do validation(check not empty String)
} else if (id == "Stationery") { } else if (id == "Stationery") {
return 'Geo-ExecutionPlan-Stationery' + (queryName ? '_' + queryName : '') + "---" + (deviceId ? '_' + deviceId : '') + '_alert'; // TODO: value of the `queryName` can't be empty, because it will cause name conflicts in CEP, have to do validation(check not empty String) return 'Geo-ExecutionPlan-Stationery' + (queryName ? '_' + queryName : '') + "---" + (deviceId ? '_' + deviceId : '') + '_alert'; // TODO: value of the `queryName` can't be empty, because it will cause name conflicts in CEP, have to do validation(check not empty String)

@ -7472,7 +7472,6 @@ ul.sidebar-messages > li {
* ======================================================================== */ * ======================================================================== */
.body-wrapper { .body-wrapper {
padding: 40px; padding: 40px;
margin-bottom:40px;
} }
.body-wrapper a.btn:hover,.body-wrapper a:hover { .body-wrapper a.btn:hover,.body-wrapper a:hover {

@ -23,7 +23,7 @@
<parent> <parent>
<artifactId>device-mgt</artifactId> <artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>device-mgt</artifactId> <artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId> <artifactId>carbon-devicemgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>email-sender</artifactId> <artifactId>email-sender</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId> <artifactId>carbon-devicemgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

@ -22,13 +22,13 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>identity-extensions</artifactId> <artifactId>identity-extensions</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.oauth.extensions</artifactId> <artifactId>org.wso2.carbon.device.mgt.oauth.extensions</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>WSO2 Carbon - OAuth Extensions</name> <name>WSO2 Carbon - OAuth Extensions</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>

@ -21,7 +21,7 @@
<parent> <parent>
<artifactId>identity-extensions</artifactId> <artifactId>identity-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>identity-extensions</artifactId> <artifactId>identity-extensions</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -62,6 +62,7 @@
<!--Simple -> Simple policy evaluation point--> <!--Simple -> Simple policy evaluation point-->
<!--Merged -> Merged policy evaluation point --> <!--Merged -> Merged policy evaluation point -->
<PolicyEvaluationPoint>Simple</PolicyEvaluationPoint> <PolicyEvaluationPoint>Simple</PolicyEvaluationPoint>
<CacheEnable>true</CacheEnable>
</PolicyConfiguration> </PolicyConfiguration>
<!-- Default Page size configuration for paginated DM APIs--> <!-- Default Page size configuration for paginated DM APIs-->
<PaginationConfiguration> <PaginationConfiguration>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId> <artifactId>carbon-devicemgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

@ -22,14 +22,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId> <artifactId>policy-mgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.complex.policy.decision.point</artifactId> <artifactId>org.wso2.carbon.complex.policy.decision.point</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Decision Point</name> <name>WSO2 Carbon - Policy Decision Point</name>
<description>WSO2 Carbon - Policy Decision Point</description> <description>WSO2 Carbon - Policy Decision Point</description>

@ -3,14 +3,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId> <artifactId>policy-mgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.decision.point</artifactId> <artifactId>org.wso2.carbon.policy.decision.point</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Decision Point</name> <name>WSO2 Carbon - Policy Decision Point</name>
<description>WSO2 Carbon - Policy Decision Point</description> <description>WSO2 Carbon - Policy Decision Point</description>

@ -3,7 +3,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId> <artifactId>policy-mgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -11,7 +11,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.information.point</artifactId> <artifactId>org.wso2.carbon.policy.information.point</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Information Point</name> <name>WSO2 Carbon - Policy Information Point</name>
<description>WSO2 Carbon - Policy Information Point</description> <description>WSO2 Carbon - Policy Information Point</description>

@ -22,14 +22,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId> <artifactId>policy-mgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.common</artifactId> <artifactId>org.wso2.carbon.policy.mgt.common</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Management Common</name> <name>WSO2 Carbon - Policy Management Common</name>
<description>WSO2 Carbon - Policy Management Common</description> <description>WSO2 Carbon - Policy Management Common</description>

@ -22,14 +22,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId> <artifactId>policy-mgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.core</artifactId> <artifactId>org.wso2.carbon.policy.mgt.core</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Management Core</name> <name>WSO2 Carbon - Policy Management Core</name>
<description>WSO2 Carbon - Policy Management Core</description> <description>WSO2 Carbon - Policy Management Core</description>

@ -23,6 +23,8 @@ import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager;
import org.wso2.carbon.device.mgt.core.config.policy.PolicyConfiguration;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.ntask.core.Task; import org.wso2.carbon.ntask.core.Task;
import org.wso2.carbon.policy.mgt.common.PolicyManagementException; import org.wso2.carbon.policy.mgt.common.PolicyManagementException;
@ -39,6 +41,7 @@ import java.util.Map;
public class DelegationTask implements Task { public class DelegationTask implements Task {
private static final Log log = LogFactory.getLog(DelegationTask.class); private static final Log log = LogFactory.getLog(DelegationTask.class);
private PolicyConfiguration policyConfiguration = DeviceConfigurationManager.getInstance().getDeviceManagementConfig().getPolicyConfiguration();
@Override @Override
public void setProperties(Map<String, String> map) { public void setProperties(Map<String, String> map) {
@ -57,9 +60,9 @@ public class DelegationTask implements Task {
PolicyManager policyManager = new PolicyManagerImpl(); PolicyManager policyManager = new PolicyManagerImpl();
UpdatedPolicyDeviceListBean updatedPolicyDeviceList = policyManager.applyChangesMadeToPolicies(); UpdatedPolicyDeviceListBean updatedPolicyDeviceList = policyManager.applyChangesMadeToPolicies();
List<String> deviceTypes = updatedPolicyDeviceList.getChangedDeviceTypes(); List<String> deviceTypes = updatedPolicyDeviceList.getChangedDeviceTypes();
if (policyConfiguration.getCacheEnable()) {
PolicyCacheManagerImpl.getInstance().rePopulateCache(); PolicyCacheManagerImpl.getInstance().rePopulateCache();
}
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Number of device types which policies are changed .......... : " + deviceTypes.size()); log.debug("Number of device types which policies are changed .......... : " + deviceTypes.size());
} }

@ -24,6 +24,8 @@ import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.policy.mgt.Policy; import org.wso2.carbon.device.mgt.common.policy.mgt.Policy;
import org.wso2.carbon.device.mgt.common.policy.mgt.Profile; import org.wso2.carbon.device.mgt.common.policy.mgt.Profile;
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager;
import org.wso2.carbon.device.mgt.core.config.policy.PolicyConfiguration;
import org.wso2.carbon.ntask.common.TaskException; import org.wso2.carbon.ntask.common.TaskException;
import org.wso2.carbon.ntask.core.TaskInfo; import org.wso2.carbon.ntask.core.TaskInfo;
import org.wso2.carbon.ntask.core.TaskManager; import org.wso2.carbon.ntask.core.TaskManager;
@ -53,6 +55,7 @@ public class PolicyAdministratorPointImpl implements PolicyAdministratorPoint {
private ProfileManager profileManager; private ProfileManager profileManager;
private FeatureManager featureManager; private FeatureManager featureManager;
private PolicyCacheManager cacheManager; private PolicyCacheManager cacheManager;
private PolicyConfiguration policyConfiguration;
// private PolicyEnforcementDelegator delegator; // private PolicyEnforcementDelegator delegator;
public PolicyAdministratorPointImpl() { public PolicyAdministratorPointImpl() {
@ -60,6 +63,7 @@ public class PolicyAdministratorPointImpl implements PolicyAdministratorPoint {
this.profileManager = new ProfileManagerImpl(); this.profileManager = new ProfileManagerImpl();
this.featureManager = new FeatureManagerImpl(); this.featureManager = new FeatureManagerImpl();
this.cacheManager = PolicyCacheManagerImpl.getInstance(); this.cacheManager = PolicyCacheManagerImpl.getInstance();
this.policyConfiguration = DeviceConfigurationManager.getInstance().getDeviceManagementConfig().getPolicyConfiguration();
// this.delegator = new PolicyEnforcementDelegatorImpl(); // this.delegator = new PolicyEnforcementDelegatorImpl();
} }
@ -71,7 +75,9 @@ public class PolicyAdministratorPointImpl implements PolicyAdministratorPoint {
// } catch (PolicyDelegationException e) { // } catch (PolicyDelegationException e) {
// throw new PolicyManagementException("Error occurred while delegating policy operation to the devices", e); // throw new PolicyManagementException("Error occurred while delegating policy operation to the devices", e);
// } // }
if (policyConfiguration.getCacheEnable()) {
PolicyCacheManagerImpl.getInstance().rePopulateCache(); PolicyCacheManagerImpl.getInstance().rePopulateCache();
}
return resultantPolicy; return resultantPolicy;
} }
@ -83,42 +89,54 @@ public class PolicyAdministratorPointImpl implements PolicyAdministratorPoint {
// } catch (PolicyDelegationException e) { // } catch (PolicyDelegationException e) {
// throw new PolicyManagementException("Error occurred while delegating policy operation to the devices", e); // throw new PolicyManagementException("Error occurred while delegating policy operation to the devices", e);
// } // }
if (policyConfiguration.getCacheEnable()) {
PolicyCacheManagerImpl.getInstance().rePopulateCache(); PolicyCacheManagerImpl.getInstance().rePopulateCache();
}
return resultantPolicy; return resultantPolicy;
} }
@Override @Override
public boolean updatePolicyPriorities(List<Policy> policies) throws PolicyManagementException { public boolean updatePolicyPriorities(List<Policy> policies) throws PolicyManagementException {
boolean bool = policyManager.updatePolicyPriorities(policies); boolean bool = policyManager.updatePolicyPriorities(policies);
if (policyConfiguration.getCacheEnable()) {
PolicyCacheManagerImpl.getInstance().rePopulateCache(); PolicyCacheManagerImpl.getInstance().rePopulateCache();
}
return bool; return bool;
} }
@Override @Override
public void activatePolicy(int policyId) throws PolicyManagementException { public void activatePolicy(int policyId) throws PolicyManagementException {
policyManager.activatePolicy(policyId); policyManager.activatePolicy(policyId);
if (policyConfiguration.getCacheEnable()) {
PolicyCacheManagerImpl.getInstance().rePopulateCache(); PolicyCacheManagerImpl.getInstance().rePopulateCache();
} }
}
@Override @Override
public void inactivatePolicy(int policyId) throws PolicyManagementException { public void inactivatePolicy(int policyId) throws PolicyManagementException {
policyManager.inactivatePolicy(policyId); policyManager.inactivatePolicy(policyId);
if (policyConfiguration.getCacheEnable()) {
PolicyCacheManagerImpl.getInstance().rePopulateCache(); PolicyCacheManagerImpl.getInstance().rePopulateCache();
} }
}
@Override @Override
public boolean deletePolicy(Policy policy) throws PolicyManagementException { public boolean deletePolicy(Policy policy) throws PolicyManagementException {
boolean bool = policyManager.deletePolicy(policy); boolean bool = policyManager.deletePolicy(policy);
if (policyConfiguration.getCacheEnable()) {
PolicyCacheManager policyCacheManager = PolicyCacheManagerImpl.getInstance(); PolicyCacheManager policyCacheManager = PolicyCacheManagerImpl.getInstance();
policyCacheManager.rePopulateCache(); policyCacheManager.rePopulateCache();
}
return bool; return bool;
} }
@Override @Override
public boolean deletePolicy(int policyId) throws PolicyManagementException { public boolean deletePolicy(int policyId) throws PolicyManagementException {
boolean bool = policyManager.deletePolicy(policyId); boolean bool = policyManager.deletePolicy(policyId);
if (policyConfiguration.getCacheEnable()) {
PolicyCacheManager policyCacheManager = PolicyCacheManagerImpl.getInstance(); PolicyCacheManager policyCacheManager = PolicyCacheManagerImpl.getInstance();
policyCacheManager.rePopulateCache(); policyCacheManager.rePopulateCache();
}
return bool; return bool;
} }
@ -222,25 +240,37 @@ public class PolicyAdministratorPointImpl implements PolicyAdministratorPoint {
public Policy addPolicyToDevice(List<DeviceIdentifier> deviceIdentifierList, Policy policy) throws public Policy addPolicyToDevice(List<DeviceIdentifier> deviceIdentifierList, Policy policy) throws
PolicyManagementException { PolicyManagementException {
policy = policyManager.addPolicyToDevice(deviceIdentifierList, policy); policy = policyManager.addPolicyToDevice(deviceIdentifierList, policy);
if (policyConfiguration.getCacheEnable()) {
PolicyCacheManagerImpl.getInstance().rePopulateCache(); PolicyCacheManagerImpl.getInstance().rePopulateCache();
}
return policy; return policy;
} }
@Override @Override
public Policy addPolicyToRole(List<String> roleNames, Policy policy) throws PolicyManagementException { public Policy addPolicyToRole(List<String> roleNames, Policy policy) throws PolicyManagementException {
policy = policyManager.addPolicyToRole(roleNames, policy); policy = policyManager.addPolicyToRole(roleNames, policy);
if (policyConfiguration.getCacheEnable()) {
PolicyCacheManagerImpl.getInstance().rePopulateCache(); PolicyCacheManagerImpl.getInstance().rePopulateCache();
}
return policy; return policy;
} }
@Override @Override
public List<Policy> getPolicies() throws PolicyManagementException { public List<Policy> getPolicies() throws PolicyManagementException {
if (policyConfiguration.getCacheEnable()) {
return PolicyCacheManagerImpl.getInstance().getAllPolicies(); return PolicyCacheManagerImpl.getInstance().getAllPolicies();
} else {
return policyManager.getPolicies();
}
} }
@Override @Override
public Policy getPolicy(int policyId) throws PolicyManagementException { public Policy getPolicy(int policyId) throws PolicyManagementException {
if (policyConfiguration.getCacheEnable()) {
return PolicyCacheManagerImpl.getInstance().getPolicy(policyId); return PolicyCacheManagerImpl.getInstance().getPolicy(policyId);
} else {
return policyManager.getPolicy(policyId);
}
} }
@Override @Override
@ -340,7 +370,11 @@ public class PolicyAdministratorPointImpl implements PolicyAdministratorPoint {
@Override @Override
public int getPolicyCount() throws PolicyManagementException { public int getPolicyCount() throws PolicyManagementException {
if (policyConfiguration.getCacheEnable()) {
return PolicyCacheManagerImpl.getInstance().getAllPolicies().size(); return PolicyCacheManagerImpl.getInstance().getAllPolicies().size();
} else {
return policyManager.getPolicyCount();
}
} }
} }

@ -33,6 +33,8 @@ import org.wso2.carbon.device.mgt.common.policy.mgt.Policy;
import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyCriterion; import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyCriterion;
import org.wso2.carbon.device.mgt.common.policy.mgt.Profile; import org.wso2.carbon.device.mgt.common.policy.mgt.Profile;
import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature; import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature;
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager;
import org.wso2.carbon.device.mgt.core.config.policy.PolicyConfiguration;
import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation; import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation;
import org.wso2.carbon.device.mgt.core.operation.mgt.OperationMgtConstants; import org.wso2.carbon.device.mgt.core.operation.mgt.OperationMgtConstants;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
@ -42,9 +44,6 @@ import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderServiceImp
import org.wso2.carbon.policy.mgt.common.*; import org.wso2.carbon.policy.mgt.common.*;
import org.wso2.carbon.policy.mgt.core.cache.impl.PolicyCacheManagerImpl; import org.wso2.carbon.policy.mgt.core.cache.impl.PolicyCacheManagerImpl;
import org.wso2.carbon.policy.mgt.core.dao.*; import org.wso2.carbon.policy.mgt.core.dao.*;
import org.wso2.carbon.policy.mgt.core.enforcement.PolicyDelegationException;
import org.wso2.carbon.policy.mgt.core.enforcement.PolicyEnforcementDelegator;
import org.wso2.carbon.policy.mgt.core.enforcement.PolicyEnforcementDelegatorImpl;
import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder; import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder;
import org.wso2.carbon.policy.mgt.core.mgt.PolicyManager; import org.wso2.carbon.policy.mgt.core.mgt.PolicyManager;
import org.wso2.carbon.policy.mgt.core.mgt.ProfileManager; import org.wso2.carbon.policy.mgt.core.mgt.ProfileManager;
@ -61,12 +60,14 @@ public class PolicyManagerImpl implements PolicyManager {
private ProfileDAO profileDAO; private ProfileDAO profileDAO;
private FeatureDAO featureDAO; private FeatureDAO featureDAO;
private ProfileManager profileManager; private ProfileManager profileManager;
private PolicyConfiguration policyConfiguration;
private static Log log = LogFactory.getLog(PolicyManagerImpl.class); private static Log log = LogFactory.getLog(PolicyManagerImpl.class);
public PolicyManagerImpl() { public PolicyManagerImpl() {
this.policyDAO = PolicyManagementDAOFactory.getPolicyDAO(); this.policyDAO = PolicyManagementDAOFactory.getPolicyDAO();
this.profileDAO = PolicyManagementDAOFactory.getProfileDAO(); this.profileDAO = PolicyManagementDAOFactory.getProfileDAO();
this.featureDAO = PolicyManagementDAOFactory.getFeatureDAO(); this.featureDAO = PolicyManagementDAOFactory.getFeatureDAO();
this.policyConfiguration = DeviceConfigurationManager.getInstance().getDeviceManagementConfig().getPolicyConfiguration();
this.profileManager = new ProfileManagerImpl(); this.profileManager = new ProfileManagerImpl();
} }
@ -272,7 +273,12 @@ public class PolicyManagerImpl implements PolicyManager {
boolean bool; boolean bool;
try { try {
// List<Policy> existingPolicies = this.getPolicies(); // List<Policy> existingPolicies = this.getPolicies();
List<Policy> existingPolicies = PolicyCacheManagerImpl.getInstance().getAllPolicies(); List<Policy> existingPolicies;
if (policyConfiguration.getCacheEnable()) {
existingPolicies = PolicyCacheManagerImpl.getInstance().getAllPolicies();
} else {
existingPolicies = this.getPolicies();
}
PolicyManagementDAOFactory.beginTransaction(); PolicyManagementDAOFactory.beginTransaction();
bool = policyDAO.updatePolicyPriorities(policies); bool = policyDAO.updatePolicyPriorities(policies);
@ -683,7 +689,12 @@ public class PolicyManagerImpl implements PolicyManager {
} }
// List<Policy> tempPolicyList = this.getPolicies(); // List<Policy> tempPolicyList = this.getPolicies();
List<Policy> tempPolicyList = PolicyCacheManagerImpl.getInstance().getAllPolicies(); List<Policy> tempPolicyList;
if (policyConfiguration.getCacheEnable()) {
tempPolicyList = PolicyCacheManagerImpl.getInstance().getAllPolicies();
} else {
tempPolicyList = this.getPolicies();
}
for (Policy policy : tempPolicyList) { for (Policy policy : tempPolicyList) {
for (Integer i : policyIdList) { for (Integer i : policyIdList) {
@ -703,7 +714,12 @@ public class PolicyManagerImpl implements PolicyManager {
// try { // try {
// List<Profile> profileList = profileManager.getProfilesOfDeviceType(deviceTypeName); // List<Profile> profileList = profileManager.getProfilesOfDeviceType(deviceTypeName);
// List<Policy> allPolicies = this.getPolicies(); // List<Policy> allPolicies = this.getPolicies();
List<Policy> allPolicies = PolicyCacheManagerImpl.getInstance().getAllPolicies(); List<Policy> allPolicies;
if (policyConfiguration.getCacheEnable()) {
allPolicies = PolicyCacheManagerImpl.getInstance().getAllPolicies();
} else {
allPolicies = this.getPolicies();
}
for (Policy policy : allPolicies) { for (Policy policy : allPolicies) {
if (policy.getProfile().getDeviceType().equalsIgnoreCase(deviceTypeName)) { if (policy.getProfile().getDeviceType().equalsIgnoreCase(deviceTypeName)) {
@ -745,7 +761,12 @@ public class PolicyManagerImpl implements PolicyManager {
} }
// List<Policy> tempPolicyList = this.getPolicies(); // List<Policy> tempPolicyList = this.getPolicies();
List<Policy> tempPolicyList = PolicyCacheManagerImpl.getInstance().getAllPolicies(); List<Policy> tempPolicyList;
if (policyConfiguration.getCacheEnable()) {
tempPolicyList = PolicyCacheManagerImpl.getInstance().getAllPolicies();
} else {
tempPolicyList = this.getPolicies();
}
for (Policy policy : tempPolicyList) { for (Policy policy : tempPolicyList) {
for (Integer i : policyIdList) { for (Integer i : policyIdList) {
@ -775,7 +796,12 @@ public class PolicyManagerImpl implements PolicyManager {
PolicyManagementDAOFactory.closeConnection(); PolicyManagementDAOFactory.closeConnection();
} }
// List<Policy> tempPolicyList = this.getPolicies(); // List<Policy> tempPolicyList = this.getPolicies();
List<Policy> tempPolicyList = PolicyCacheManagerImpl.getInstance().getAllPolicies(); List<Policy> tempPolicyList;
if (policyConfiguration.getCacheEnable()) {
tempPolicyList = PolicyCacheManagerImpl.getInstance().getAllPolicies();
} else {
tempPolicyList = this.getPolicies();
}
for (Policy policy : tempPolicyList) { for (Policy policy : tempPolicyList) {
for (Integer i : policyIdList) { for (Integer i : policyIdList) {
@ -868,8 +894,12 @@ public class PolicyManagerImpl implements PolicyManager {
// List<Policy> inactivePolicies = new ArrayList<>(); // List<Policy> inactivePolicies = new ArrayList<>();
// List<Policy> allPolicies = this.getPolicies(); // List<Policy> allPolicies = this.getPolicies();
List<Policy> allPolicies = PolicyCacheManagerImpl.getInstance().getAllPolicies(); List<Policy> allPolicies;
if (policyConfiguration.getCacheEnable()) {
allPolicies = PolicyCacheManagerImpl.getInstance().getAllPolicies();
} else {
allPolicies = this.getPolicies();
}
for (Policy policy : allPolicies) { for (Policy policy : allPolicies) {
if (policy.isUpdated()) { if (policy.isUpdated()) {
updatedPolicies.add(policy); updatedPolicies.add(policy);

@ -45,6 +45,7 @@
<minRetriesToMarkInactive>20</minRetriesToMarkInactive> <minRetriesToMarkInactive>20</minRetriesToMarkInactive>
<!--<PolicyEvaluationPoint>Simple</PolicyEvaluationPoint>--> <!--<PolicyEvaluationPoint>Simple</PolicyEvaluationPoint>-->
<PolicyEvaluationPoint>Simple</PolicyEvaluationPoint> <PolicyEvaluationPoint>Simple</PolicyEvaluationPoint>
<CacheEnable>true</CacheEnable>
</PolicyConfiguration> </PolicyConfiguration>
<!--This specifies whether to enable the DeviceStatus Task in this node.--> <!--This specifies whether to enable the DeviceStatus Task in this node.-->
<DeviceStatusTaskConfig> <DeviceStatusTaskConfig>

@ -418,6 +418,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INTEGER NOT NULL, DEVICE_ID INTEGER NOT NULL,
APPLICATION_ID INTEGER NOT NULL, APPLICATION_ID INTEGER NOT NULL,
APP_PROPERTIES BLOB NULL,
MEMORY_USAGE INTEGER(10) NULL,
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES

@ -23,13 +23,13 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId> <artifactId>carbon-devicemgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>policy-mgt</artifactId> <artifactId>policy-mgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>WSO2 Carbon - Policy Management Component</name> <name>WSO2 Carbon - Policy Management Component</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>

@ -21,7 +21,7 @@
<parent> <parent>
<artifactId>carbon-devicemgt</artifactId> <artifactId>carbon-devicemgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

@ -21,14 +21,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>webapp-authenticator-framework</artifactId> <artifactId>webapp-authenticator-framework</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.webapp.authenticator.framework</artifactId> <artifactId>org.wso2.carbon.webapp.authenticator.framework</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>WSO2 Carbon - Web Application Authenticator Framework Bundle</name> <name>WSO2 Carbon - Web Application Authenticator Framework Bundle</name>
<description>WSO2 Carbon - Web Application Authenticator Framework Bundle</description> <description>WSO2 Carbon - Web Application Authenticator Framework Bundle</description>

@ -106,6 +106,14 @@ public class WebappAuthenticationValve extends CarbonTomcatValve {
} }
private boolean isNonSecuredEndPoint(Request request) { private boolean isNonSecuredEndPoint(Request request) {
if (request.getCoyoteRequest() != null && request.getCoyoteRequest().getMimeHeaders() !=
null && request.getCoyoteRequest().getMimeHeaders().getValue(Constants
.HTTPHeaders.HEADER_HTTP_AUTHORIZATION) != null) {
//This is to handle the DEP behaviours of the same endpoint being non-secured in the
// first call and then being secured in the second call which comes with the basic
// auth header.
return false;
}
String uri = request.getRequestURI(); String uri = request.getRequestURI();
if (uri == null) { if (uri == null) {
uri = ""; uri = "";
@ -146,8 +154,9 @@ public class WebappAuthenticationValve extends CarbonTomcatValve {
String msg = "Failed to authorize incoming request"; String msg = "Failed to authorize incoming request";
if (authenticationInfo.getMessage() != null && !authenticationInfo.getMessage().isEmpty()) { if (authenticationInfo.getMessage() != null && !authenticationInfo.getMessage().isEmpty()) {
msg = authenticationInfo.getMessage(); msg = authenticationInfo.getMessage();
response.setHeader("WWW-Authenticate", msg); response.setHeader("WWW-Authenticate", "Basic");
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(msg + " , API : " + Encode.forUriComponent(request.getRequestURI())); log.debug(msg + " , API : " + Encode.forUriComponent(request.getRequestURI()));
} }

@ -50,6 +50,14 @@ public class BasicAuthAuthenticator implements WebappAuthenticator {
@Override @Override
public boolean canHandle(Request request) { public boolean canHandle(Request request) {
/*
This is done to avoid every endpoint being able to use basic auth. Add the following to
the required web.xml of the web app.
<context-param>
<param-name>basicAuth</param-name>
<param-value>true</param-value>
</context-param>
*/
if (!isAuthenticationSupported(request)) { if (!isAuthenticationSupported(request)) {
return false; return false;
} }
@ -84,6 +92,7 @@ public class BasicAuthAuthenticator implements WebappAuthenticator {
authenticationInfo.setTenantDomain(Utils.getTenantDomain(tenantId)); authenticationInfo.setTenantDomain(Utils.getTenantDomain(tenantId));
authenticationInfo.setTenantId(tenantId); authenticationInfo.setTenantId(tenantId);
} else { } else {
authenticationInfo.setMessage("Failed to authorize incoming request.");
authenticationInfo.setStatus(Status.FAILURE); authenticationInfo.setStatus(Status.FAILURE);
} }
} catch (UserStoreException e) { } catch (UserStoreException e) {

@ -57,6 +57,7 @@
<!--Simple -> Simple policy evaluation point--> <!--Simple -> Simple policy evaluation point-->
<!--Merged -> Merged policy evaluation point --> <!--Merged -> Merged policy evaluation point -->
<PolicyEvaluationPoint>Simple</PolicyEvaluationPoint> <PolicyEvaluationPoint>Simple</PolicyEvaluationPoint>
<CacheEnable>true</CacheEnable>
</PolicyConfiguration> </PolicyConfiguration>
<!-- Default Page size configuration for paginated DM APIs--> <!-- Default Page size configuration for paginated DM APIs-->
<PaginationConfiguration> <PaginationConfiguration>

@ -22,14 +22,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId> <artifactId>carbon-devicemgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>webapp-authenticator-framework</artifactId> <artifactId>webapp-authenticator-framework</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>WSO2 Carbon - Webapp Authenticator Framework</name> <name>WSO2 Carbon - Webapp Authenticator Framework</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>

@ -21,14 +21,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId> <artifactId>apimgt-extensions-feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.application.extension.feature</artifactId> <artifactId>org.wso2.carbon.apimgt.application.extension.feature</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<name>WSO2 Carbon - API Management Application Extension Feature</name> <name>WSO2 Carbon - API Management Application Extension Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>
<description>This feature contains an implementation of a api application registration, which takes care of subscription <description>This feature contains an implementation of a api application registration, which takes care of subscription

@ -22,14 +22,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId> <artifactId>apimgt-extensions-feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.handler.server.feature</artifactId> <artifactId>org.wso2.carbon.apimgt.handler.server.feature</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management - APIM handler Server Feature</name> <name>WSO2 Carbon - Device Management - APIM handler Server Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>
<description>This feature contains the handler for the api authentications <description>This feature contains the handler for the api authentications

@ -21,13 +21,13 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId> <artifactId>apimgt-extensions-feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.integration.client.feature</artifactId> <artifactId>org.wso2.carbon.apimgt.integration.client.feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>WSO2 Carbon - APIM Integration Client Feature</name> <name>WSO2 Carbon - APIM Integration Client Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>

@ -21,14 +21,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId> <artifactId>apimgt-extensions-feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher.feature</artifactId> <artifactId>org.wso2.carbon.apimgt.webapp.publisher.feature</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<name>WSO2 Carbon - API Management Webapp Publisher Feature</name> <name>WSO2 Carbon - API Management Webapp Publisher Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>
<description>This feature contains an implementation of a Tomcat lifecycle listener, which takes care of publishing <description>This feature contains an implementation of a Tomcat lifecycle listener, which takes care of publishing

@ -22,14 +22,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId> <artifactId>carbon-devicemgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId> <artifactId>apimgt-extensions-feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>WSO2 Carbon - API Management Extensions Feature</name> <name>WSO2 Carbon - API Management Extensions Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId> <artifactId>certificate-mgt-feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId> <artifactId>certificate-mgt-feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,14 +22,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId> <artifactId>certificate-mgt-feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.certificate.mgt.server.feature</artifactId> <artifactId>org.wso2.carbon.certificate.mgt.server.feature</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<name>WSO2 Carbon - Certificate Management Server Feature</name> <name>WSO2 Carbon - Certificate Management Server Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>
<description>This feature contains the core bundles required for back-end Certificate Management functionality <description>This feature contains the core bundles required for back-end Certificate Management functionality

@ -22,14 +22,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId> <artifactId>carbon-devicemgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId> <artifactId>certificate-mgt-feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>WSO2 Carbon - Certificate Management Feature</name> <name>WSO2 Carbon - Certificate Management Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>

@ -22,14 +22,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId> <artifactId>device-mgt-extensions-feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature</artifactId> <artifactId>org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<name>WSO2 Carbon - Device Type Deployer Feature</name> <name>WSO2 Carbon - Device Type Deployer Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>
<description>WSO2 Carbon - Device Type Deployer Feature</description> <description>WSO2 Carbon - Device Type Deployer Feature</description>

@ -22,14 +22,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId> <artifactId>device-mgt-extensions-feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature</artifactId> <artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<name>WSO2 Carbon - FCM Based Push Notification Provider Feature</name> <name>WSO2 Carbon - FCM Based Push Notification Provider Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>
<description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description> <description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description>

@ -22,14 +22,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId> <artifactId>device-mgt-extensions-feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature</artifactId> <artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<name>WSO2 Carbon - MQTT Based Push Notification Provider Feature</name> <name>WSO2 Carbon - MQTT Based Push Notification Provider Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>
<description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description> <description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description>

@ -22,14 +22,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId> <artifactId>device-mgt-extensions-feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature</artifactId> <artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<name>WSO2 Carbon - MQTT Based Push Notification Provider Feature</name> <name>WSO2 Carbon - MQTT Based Push Notification Provider Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>
<description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description> <description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description>

@ -22,14 +22,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId> <artifactId>device-mgt-extensions-feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature</artifactId> <artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<name>WSO2 Carbon - XMPP Based Push Notification Provider Feature</name> <name>WSO2 Carbon - XMPP Based Push Notification Provider Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>
<description>WSO2 Carbon - XMPP Based Push Notification Provider Feature</description> <description>WSO2 Carbon - XMPP Based Push Notification Provider Feature</description>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId> <artifactId>carbon-devicemgt</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

@ -22,14 +22,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId> <artifactId>device-mgt-feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.analytics.data.publisher.feature</artifactId> <artifactId>org.wso2.carbon.device.mgt.analytics.data.publisher.feature</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Server Feature</name> <name>WSO2 Carbon - Device Management Server Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>
<description>This feature contains bundles related to device analytics data publisher</description> <description>This feature contains bundles related to device analytics data publisher</description>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId> <artifactId>device-mgt-feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId> <artifactId>device-mgt-feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -62,6 +62,7 @@
<!--Simple -> Simple policy evaluation point--> <!--Simple -> Simple policy evaluation point-->
<!--Merged -> Merged policy evaluation point --> <!--Merged -> Merged policy evaluation point -->
<PolicyEvaluationPoint>Simple</PolicyEvaluationPoint> <PolicyEvaluationPoint>Simple</PolicyEvaluationPoint>
<CacheEnable>true</CacheEnable>
</PolicyConfiguration> </PolicyConfiguration>
<!-- Default Page size configuration for paginated DM APIs--> <!-- Default Page size configuration for paginated DM APIs-->
<PaginationConfiguration> <PaginationConfiguration>

@ -301,7 +301,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA_PROPERTIES (
POLICY_CRITERION_ID INT NOT NULL, POLICY_CRITERION_ID INT NOT NULL,
PROP_KEY VARCHAR(45) NULL, PROP_KEY VARCHAR(45) NULL,
PROP_VALUE VARCHAR(100) NULL, PROP_VALUE VARCHAR(100) NULL,
CONTENT BLOB NULL COMMENT 'This is used to ', CONTENT BLOB NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT FK_POLICY_CRITERIA_PROPERTIES CONSTRAINT FK_POLICY_CRITERIA_PROPERTIES
FOREIGN KEY (POLICY_CRITERION_ID) FOREIGN KEY (POLICY_CRITERION_ID)
@ -367,6 +367,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INTEGER NOT NULL, DEVICE_ID INTEGER NOT NULL,
APPLICATION_ID INTEGER NOT NULL, APPLICATION_ID INTEGER NOT NULL,
APP_PROPERTIES BLOB NULL,
MEMORY_USAGE INTEGER(10) NULL,
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES
@ -385,6 +388,7 @@ CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
STATUS VARCHAR(10) NULL, STATUS VARCHAR(10) NULL,
DESCRIPTION VARCHAR(1000) NULL, DESCRIPTION VARCHAR(1000) NULL,
LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL,
PRIMARY KEY (NOTIFICATION_ID), PRIMARY KEY (NOTIFICATION_ID),
CONSTRAINT fk_dm_device_notification FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT fk_dm_device_notification FOREIGN KEY (DEVICE_ID) REFERENCES
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,

@ -396,6 +396,9 @@ CREATE TABLE DM_DEVICE_APPLICATION_MAPPING (
ID INTEGER IDENTITY(1,1) NOT NULL, ID INTEGER IDENTITY(1,1) NOT NULL,
DEVICE_ID INTEGER NOT NULL, DEVICE_ID INTEGER NOT NULL,
APPLICATION_ID INTEGER NOT NULL, APPLICATION_ID INTEGER NOT NULL,
APP_PROPERTIES VARBINARY(MAX) NULL,
MEMORY_USAGE INTEGER NULL,
IS_ACTIVE BIT NOT NULL DEFAULT 0,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT FK_DM_DEVICE FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT FK_DM_DEVICE FOREIGN KEY (DEVICE_ID) REFERENCES
@ -437,6 +440,7 @@ CREATE TABLE DM_NOTIFICATION (
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
STATUS VARCHAR(10) NULL, STATUS VARCHAR(10) NULL,
DESCRIPTION VARCHAR(1000) NULL, DESCRIPTION VARCHAR(1000) NULL,
LAST_UPDATED_TIMESTAMP DATETIME2 NOT NULL,
PRIMARY KEY (NOTIFICATION_ID), PRIMARY KEY (NOTIFICATION_ID),
CONSTRAINT FL_DM_NOTIFICATION FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT FL_DM_NOTIFICATION FOREIGN KEY (DEVICE_ID) REFERENCES
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,

@ -452,6 +452,7 @@ CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
STATUS VARCHAR(10) NULL, STATUS VARCHAR(10) NULL,
DESCRIPTION VARCHAR(1000) NULL, DESCRIPTION VARCHAR(1000) NULL,
LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL,
PRIMARY KEY (NOTIFICATION_ID), PRIMARY KEY (NOTIFICATION_ID),
CONSTRAINT fk_dm_device_notification FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT fk_dm_device_notification FOREIGN KEY (DEVICE_ID) REFERENCES
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,

@ -715,6 +715,9 @@ CREATE TABLE DM_DEVICE_APPLICATION_MAPPING (
ID NUMBER(10) NOT NULL, ID NUMBER(10) NOT NULL,
DEVICE_ID NUMBER(10) NOT NULL, DEVICE_ID NUMBER(10) NOT NULL,
APPLICATION_ID NUMBER(10) NOT NULL, APPLICATION_ID NUMBER(10) NOT NULL,
APP_PROPERTIES BLOB NULL,
MEMORY_USAGE NUMBER(10) NULL,
IS_ACTIVE NUMBER(10) DEFAULT 0 NOT NULL,
TENANT_ID NUMBER(10) NOT NULL, TENANT_ID NUMBER(10) NOT NULL,
CONSTRAINT PK_DM_DEVICE_APP_MAPPING PRIMARY KEY (ID), CONSTRAINT PK_DM_DEVICE_APP_MAPPING PRIMARY KEY (ID),
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES
@ -747,6 +750,7 @@ CREATE TABLE DM_NOTIFICATION (
TENANT_ID NUMBER(10) NOT NULL, TENANT_ID NUMBER(10) NOT NULL,
STATUS VARCHAR2(10) NULL, STATUS VARCHAR2(10) NULL,
DESCRIPTION VARCHAR2(1000) NULL, DESCRIPTION VARCHAR2(1000) NULL,
LAST_UPDATED_TIMESTAMP TIMESTAMP(0) NOT NULL,
CONSTRAINT PK_DM_NOTIFICATION PRIMARY KEY (NOTIFICATION_ID), CONSTRAINT PK_DM_NOTIFICATION PRIMARY KEY (NOTIFICATION_ID),
CONSTRAINT FK_DM_DEVICE_NOTIFICATION FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT FK_DM_DEVICE_NOTIFICATION FOREIGN KEY (DEVICE_ID) REFERENCES
DM_DEVICE (ID), DM_DEVICE (ID),

@ -357,6 +357,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
ID BIGSERIAL NOT NULL PRIMARY KEY, ID BIGSERIAL NOT NULL PRIMARY KEY,
DEVICE_ID INTEGER NOT NULL, DEVICE_ID INTEGER NOT NULL,
APPLICATION_ID INTEGER NOT NULL, APPLICATION_ID INTEGER NOT NULL,
APP_PROPERTIES BYTEA NULL,
MEMORY_USAGE INTEGER NULL,
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
@ -395,6 +398,7 @@ CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
STATUS VARCHAR(10) NULL, STATUS VARCHAR(10) NULL,
DESCRIPTION VARCHAR(1000) NULL, DESCRIPTION VARCHAR(1000) NULL,
LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL,
CONSTRAINT fk_dm_device_notification FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT fk_dm_device_notification FOREIGN KEY (DEVICE_ID) REFERENCES
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_dm_operation_notification FOREIGN KEY (OPERATION_ID) REFERENCES CONSTRAINT fk_dm_operation_notification FOREIGN KEY (OPERATION_ID) REFERENCES

@ -4,14 +4,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId> <artifactId>device-mgt-feature</artifactId>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.feature</artifactId> <artifactId>org.wso2.carbon.device.mgt.extensions.feature</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>3.0.192-SNAPSHOT</version> <version>3.0.206-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Extensions Feature</name> <name>WSO2 Carbon - Device Management Extensions Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>
<description>This feature contains common extensions used by key device management functionalities <description>This feature contains common extensions used by key device management functionalities

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save