diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml
index 00d349fe8c..d3c6b6474f 100644
--- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml
+++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
grafana-mgt
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml
index b3756bfa14..6e76873544 100644
--- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml
+++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
grafana-mgt
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml
index 24f5dbdcab..411df90000 100644
--- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml
+++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
grafana-mgt
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/analytics-mgt/grafana-mgt/pom.xml b/components/analytics-mgt/grafana-mgt/pom.xml
index 110c64f553..8d10307c7e 100644
--- a/components/analytics-mgt/grafana-mgt/pom.xml
+++ b/components/analytics-mgt/grafana-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
analytics-mgt
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/analytics-mgt/pom.xml b/components/analytics-mgt/pom.xml
index 6482bc57da..2bacce641b 100644
--- a/components/analytics-mgt/pom.xml
+++ b/components/analytics-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml
index 6cc8bc074f..135b883d73 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml
@@ -20,7 +20,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
4.0.0
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml
index 1566bb9350..40482d0575 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml
@@ -22,7 +22,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml
index 22d092d948..124d0b1ca9 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml
@@ -21,7 +21,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml
index 87866c92a8..99184211a6 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml
@@ -22,7 +22,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml
index b6a55ecce8..c754bea431 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml
@@ -22,7 +22,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java
index f5b766b119..4e7d79403a 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java
@@ -24,13 +24,12 @@ import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIService
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo;
+import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Scope;
+import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Mediation;
+import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Documentation;
+import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIRevision;
+import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIRevisionDeployment;
import org.json.JSONObject;
-import org.wso2.carbon.apimgt.api.model.APIIdentifier;
-import org.wso2.carbon.apimgt.api.model.Scope;
-import org.wso2.carbon.apimgt.api.model.Mediation;
-import org.wso2.carbon.apimgt.api.model.APIRevision;
-import org.wso2.carbon.apimgt.api.model.APIRevisionDeployment;
-import org.wso2.carbon.apimgt.api.model.Documentation;
import java.util.List;
@@ -48,7 +47,7 @@ public interface PublisherRESTAPIServices {
boolean updateSharedScope(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, Scope scope)
throws APIServicesException, BadRequestException, UnexpectedResponseException;
- JSONObject getApi(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, APIIdentifier apiIdentifier)
+ JSONObject getApi(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String apiUuid)
throws APIServicesException, BadRequestException, UnexpectedResponseException;
JSONObject getApis(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo)
@@ -65,15 +64,15 @@ public interface PublisherRESTAPIServices {
throws APIServicesException, BadRequestException, UnexpectedResponseException;
JSONObject getAllApiSpecificMediationPolicies(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
- APIIdentifier apiIdentifier)
+ String apiUuid)
throws APIServicesException, BadRequestException, UnexpectedResponseException;
boolean addApiSpecificMediationPolicy(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
String uuid, Mediation mediation)
throws APIServicesException, BadRequestException, UnexpectedResponseException;
- boolean updateApiSpecificMediationPolicyContent(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
- String uuid, Mediation mediation)
+ boolean deleteApiSpecificMediationPolicy(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
+ String uuid, Mediation mediation)
throws APIServicesException, BadRequestException, UnexpectedResponseException;
boolean changeLifeCycleStatus(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
@@ -108,11 +107,11 @@ public interface PublisherRESTAPIServices {
String uuid, String documentID)
throws APIServicesException, BadRequestException, UnexpectedResponseException;
- Documentation addDocumentation(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
+ io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Documentation addDocumentation(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
String uuid, Documentation documentation)
throws APIServicesException, BadRequestException, UnexpectedResponseException;
boolean addDocumentationContent(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
- APIInfo api, String docId, String docContent)
+ String apiUuid, String docId, String docContent)
throws APIServicesException, BadRequestException, UnexpectedResponseException;
}
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java
index b3ae5c8f92..40a8e92c61 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java
@@ -21,30 +21,26 @@ package io.entgra.device.mgt.core.apimgt.extension.rest.api;
import com.google.gson.Gson;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.constants.Constants;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey;
+import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo;
+import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Scope;
+import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Mediation;
+import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Documentation;
+import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIRevision;
+import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIRevisionDeployment;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException;
-import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.util.HttpsTrustManagerUtils;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.util.ScopeUtils;
-import okhttp3.MediaType;
-import okhttp3.OkHttpClient;
-import okhttp3.Request;
-import okhttp3.Response;
-import okhttp3.RequestBody;
+import okhttp3.*;
+import okhttp3.Request.Builder;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.ssl.Base64;
import org.json.JSONArray;
import org.json.JSONObject;
-import org.wso2.carbon.apimgt.api.model.APIIdentifier;
-import org.wso2.carbon.apimgt.api.model.Scope;
-import org.wso2.carbon.apimgt.api.model.Mediation;
-import org.wso2.carbon.apimgt.api.model.APIRevision;
-import org.wso2.carbon.apimgt.api.model.APIRevisionDeployment;
-import org.wso2.carbon.apimgt.api.model.Documentation;
import java.io.IOException;
import java.util.List;
@@ -237,10 +233,10 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices {
}
@Override
- public JSONObject getApi(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, APIIdentifier apiIdentifier)
+ public JSONObject getApi(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String apiUuid)
throws APIServicesException, BadRequestException, UnexpectedResponseException {
- String getAllApi = endPointPrefix + Constants.API_ENDPOINT + apiIdentifier.getUUID();
+ String getAllApi = endPointPrefix + Constants.API_ENDPOINT + apiUuid;
Request request = new Request.Builder()
.url(getAllApi)
.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER
@@ -259,7 +255,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices {
generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(),
apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret());
//TODO: max attempt count
- return getApi(apiApplicationKey, refreshedAccessToken, apiIdentifier);
+ return getApi(apiApplicationKey, refreshedAccessToken, apiUuid);
} else if (HttpStatus.SC_BAD_REQUEST == response.code()) {
String msg = "Bad Request, Invalid request";
log.error(msg);
@@ -344,6 +340,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices {
" \"apiThrottlingPolicy\": " + api.getApiThrottlingPolicy() + ",\n" +
" \"authorizationHeader\": \"" + api.getAuthorizationHeader() + "\",\n" +
" \"visibility\": \"" + api.getVisibility() + "\",\n" +
+ " \"mediationPolicies\": " + (api.getInSequence() != null ? "[{\"name\": \"" + api.getInSequence() + "\",\"type\": \"in\"}]" : null) + ",\n" +
" \"subscriptionAvailability\": \"" + api.getSubscriptionAvailability() + "\",\n" +
" \"subscriptionAvailableTenants\": [],\n" +
" \"additionalProperties\": [],\n" +
@@ -359,7 +356,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices {
" \"endpointConfig\": " + api.getEndpointConfig().toString() + ",\n" +
" \"endpointImplementationType\": \"ENDPOINT\",\n" +
" \"scopes\": " + api.getScopes().toString() + ",\n" +
- " \"operations\": " + api.getOperations().toString() + ",\n" +
+ " \"operations\": " + (api.getOperations() != null ? api.getOperations().toString() : null) + ",\n" +
" \"threatProtectionPolicies\": null,\n" +
" \"categories\": [],\n" +
" \"keyManagers\": " + gson.toJson(api.getKeyManagers()) + ",\n" +
@@ -431,6 +428,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices {
" \"apiThrottlingPolicy\": " + api.getApiThrottlingPolicy() + ",\n" +
" \"authorizationHeader\": \"" + api.getAuthorizationHeader() + "\",\n" +
" \"visibility\": \"" + api.getVisibility() + "\",\n" +
+ " \"mediationPolicies\": " + (api.getInSequence() != null ? "[{\"name\": \"" + api.getInSequence() + "\",\"type\": \"in\"}]" : null) + ",\n" +
" \"subscriptionAvailability\": \"" + api.getSubscriptionAvailability() + "\",\n" +
" \"subscriptionAvailableTenants\": [],\n" +
" \"additionalProperties\": [],\n" +
@@ -446,7 +444,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices {
" \"endpointConfig\": " + api.getEndpointConfig().toString() + ",\n" +
" \"endpointImplementationType\": \"ENDPOINT\",\n" +
" \"scopes\": " + api.getScopes().toString() + ",\n" +
- " \"operations\": " + api.getOperations().toString() + ",\n" +
+ " \"operations\": " + (api.getOperations() != null? api.getOperations().toString() : null) + ",\n" +
" \"threatProtectionPolicies\": null,\n" +
" \"categories\": [],\n" +
" \"keyManagers\": " + gson.toJson(api.getKeyManagers()) + ",\n" +
@@ -493,11 +491,16 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices {
String uuid, String asyncApiDefinition)
throws APIServicesException, BadRequestException, UnexpectedResponseException {
- String addNewScope = endPointPrefix + Constants.API_ENDPOINT + uuid;
+ String saveAsyncAPI = endPointPrefix + Constants.API_ENDPOINT + uuid + "/asyncapi";
+
+ RequestBody requestBody = new MultipartBody.Builder()
+ .setType(MultipartBody.FORM)
+ .addFormDataPart("apiDefinition", asyncApiDefinition)
+ .build();
- RequestBody requestBody = RequestBody.create(JSON, asyncApiDefinition);
Request request = new Request.Builder()
- .url(addNewScope)
+ .url(saveAsyncAPI)
+ .addHeader(Constants.HEADER_CONTENT_TYPE, "multipart/form-data")
.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER
+ accessTokenInfo.getAccess_token())
.put(requestBody)
@@ -532,10 +535,10 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices {
@Override
public JSONObject getAllApiSpecificMediationPolicies(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
- APIIdentifier apiIdentifier)
+ String apiUuid)
throws APIServicesException, BadRequestException, UnexpectedResponseException {
- String getAPIMediationEndPoint = endPointPrefix + Constants.API_ENDPOINT + apiIdentifier.getUUID() + "/mediation-policies";
+ String getAPIMediationEndPoint = endPointPrefix + Constants.API_ENDPOINT + apiUuid + "/mediation-policies";
Request request = new Request.Builder()
.url(getAPIMediationEndPoint)
.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER
@@ -554,7 +557,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices {
generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(),
apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret());
//TODO: max attempt count
- return getAllApiSpecificMediationPolicies(apiApplicationKey, refreshedAccessToken, apiIdentifier);
+ return getAllApiSpecificMediationPolicies(apiApplicationKey, refreshedAccessToken, apiUuid);
} else if (HttpStatus.SC_BAD_REQUEST == response.code()) {
String msg = "Bad Request, Invalid request";
log.error(msg);
@@ -575,12 +578,17 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices {
String uuid, Mediation mediation)
throws APIServicesException, BadRequestException, UnexpectedResponseException {
- String addAPIMediation = endPointPrefix + Constants.API_ENDPOINT + uuid + "/mediation-policies/" + mediation.getUuid()
- + "/content";
+ String addAPIMediation = endPointPrefix + Constants.API_ENDPOINT + uuid + "/mediation-policies";
- RequestBody requestBody = RequestBody.create(JSON, String.valueOf(mediation));
- Request request = new Request.Builder()
+ RequestBody requestBody = new MultipartBody.Builder()
+ .setType(MultipartBody.FORM)
+ .addFormDataPart("inlineContent", mediation.getConfig())
+ .addFormDataPart("type", mediation.getType())
+ .build();
+
+ Request request = new Builder()
.url(addAPIMediation)
+ .addHeader(Constants.HEADER_CONTENT_TYPE, "multipart/form-data")
.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER
+ accessTokenInfo.getAccess_token())
.post(requestBody)
@@ -613,26 +621,23 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices {
}
-
@Override
- public boolean updateApiSpecificMediationPolicyContent(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
+ public boolean deleteApiSpecificMediationPolicy(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
String uuid, Mediation mediation)
throws APIServicesException, BadRequestException, UnexpectedResponseException {
- String updateApiMediationEndPOint = endPointPrefix + Constants.API_ENDPOINT + uuid + "/mediation-policies/" + mediation.getUuid()
- + "/content";
+ String deleteApiMediationEndPOint = endPointPrefix + Constants.API_ENDPOINT + uuid + "/mediation-policies/" + mediation.getUuid();
- RequestBody requestBody = RequestBody.create(JSON, String.valueOf(mediation));
Request request = new Request.Builder()
- .url(updateApiMediationEndPOint)
+ .url(deleteApiMediationEndPOint)
.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER
+ accessTokenInfo.getAccess_token())
- .put(requestBody)
+ .delete()
.build();
try {
Response response = client.newCall(request).execute();
- if (HttpStatus.SC_CREATED == response.code()) { // Check response status
+ if (HttpStatus.SC_NO_CONTENT == response.code()) { // Check response status
return true;
} else if (HttpStatus.SC_UNAUTHORIZED == response.code()) {
APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl();
@@ -640,7 +645,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices {
generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(),
apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret());
//TODO: max attempt count
- return updateApiSpecificMediationPolicyContent(apiApplicationKey, refreshedAccessToken, uuid, mediation);
+ return deleteApiSpecificMediationPolicy(apiApplicationKey, refreshedAccessToken, uuid, mediation);
} else if (HttpStatus.SC_BAD_REQUEST == response.code()) {
String msg = "Bad Request, Invalid mediation policy";
log.error(msg);
@@ -1018,18 +1023,19 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices {
String addNewScope = endPointPrefix + Constants.API_ENDPOINT + uuid + "/documents";
String document = "{\n" +
- " \"name\": \" " + documentation.getName() + " \",\n" +
- " \"type\": \" " + documentation.getType() + " \",\n" +
- " \"summary\": \" " + documentation.getSummary() + " \",\n" +
- " \"sourceType\": \" " + documentation.getSourceType() + " \",\n" +
- " \"inlineContent\": \" " + documentation.getSourceType() + " \",\n" +
- " \"visibility\": \" " + documentation.getVisibility() + " \",\n" +
- " \"createdBy\": \" admin \"\n" +
+ " \"name\": \"" + documentation.getName() + "\",\n" +
+ " \"type\": \"" + documentation.getType() + "\",\n" +
+ " \"summary\": \"" + documentation.getSummary() + "\",\n" +
+ " \"sourceType\": \"" + documentation.getSourceType() + "\",\n" +
+ " \"inlineContent\": \"" + documentation.getSourceType() + "\",\n" +
+ " \"visibility\": \"" + documentation.getVisibility() + "\",\n" +
+ " \"createdBy\": \"admin\"\n" +
"}";
RequestBody requestBody = RequestBody.create(JSON, document);
Request request = new Request.Builder()
.url(addNewScope)
+ .addHeader(Constants.HEADER_CONTENT_TYPE, Constants.APPLICATION_JSON)
.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER
+ accessTokenInfo.getAccess_token())
.post(requestBody)
@@ -1063,14 +1069,19 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices {
@Override
public boolean addDocumentationContent(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
- APIInfo api, String docId, String docContent)
+ String apiUuid, String docId, String docContent)
throws APIServicesException, BadRequestException, UnexpectedResponseException {
- String addDocumentationContentEndPoint = endPointPrefix + Constants.API_ENDPOINT + api.getId() + "/documents/" + docId;
+ String addDocumentationContentEndPoint = endPointPrefix + Constants.API_ENDPOINT + apiUuid + "/documents/" + docId + "/content";
+
+ RequestBody requestBody = new MultipartBody.Builder()
+ .setType(MultipartBody.FORM)
+ .addFormDataPart("inlineContent", docContent)
+ .build();
- RequestBody requestBody = RequestBody.create(JSON, docContent);
Request request = new Request.Builder()
.url(addDocumentationContentEndPoint)
+ .addHeader(Constants.HEADER_CONTENT_TYPE, "multipart/form-data")
.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER
+ accessTokenInfo.getAccess_token())
.post(requestBody)
@@ -1086,7 +1097,7 @@ public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices {
generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(),
apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret());
//TODO: max attempt count
- return addDocumentationContent(apiApplicationKey, refreshedAccessToken, api, docId, docContent);
+ return addDocumentationContent(apiApplicationKey, refreshedAccessToken, apiUuid, docId, docContent);
} else if (HttpStatus.SC_BAD_REQUEST == response.code()) {
String msg = "Bad Request, Invalid documentation request body";
log.error(msg);
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIInfo.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIInfo.java
index a6f76116d9..b7443b0f53 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIInfo.java
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIInfo.java
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
+ * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@@ -19,13 +19,8 @@
package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo;
import org.json.JSONObject;
-import org.wso2.carbon.apimgt.api.model.APICategory;
-import org.wso2.carbon.apimgt.api.model.CORSConfiguration;
-import org.wso2.carbon.apimgt.api.model.WebsubSubscriptionConfiguration;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
/**
* This class represents the API response.
@@ -70,7 +65,6 @@ public class APIInfo {
private String accessControlRoles;
private BusinessInformation businessInformation;
private CORSConfiguration corsConfiguration;
- private WebsubSubscriptionConfiguration websubSubscriptionConfiguration;
private String workflowStatus;
private String createdTime;
private String lastUpdatedTime;
@@ -79,11 +73,16 @@ public class APIInfo {
private List scopes = new ArrayList();
private List operations;
private String threatProtectionPolicies;
- private List apiCategories;
private List keyManagers = new ArrayList();
private JSONObject serviceInfo = new JSONObject();
private AdvertiseInfo advertiseInfo;
+ private String asyncApiDefinition;
+
+ private Set uriTemplates = new LinkedHashSet();
+ private String inSequence;
+
+ private Map wsUriMapping;
public String getId() {
return id;
}
@@ -372,14 +371,6 @@ public class APIInfo {
this.corsConfiguration = corsConfiguration;
}
- public WebsubSubscriptionConfiguration getWebsubSubscriptionConfiguration() {
- return websubSubscriptionConfiguration;
- }
-
- public void setWebsubSubscriptionConfiguration(WebsubSubscriptionConfiguration websubSubscriptionConfiguration) {
- this.websubSubscriptionConfiguration = websubSubscriptionConfiguration;
- }
-
public String getWorkflowStatus() {
return workflowStatus;
}
@@ -444,14 +435,6 @@ public class APIInfo {
this.threatProtectionPolicies = threatProtectionPolicies;
}
- public List getApiCategories() {
- return apiCategories;
- }
-
- public void setApiCategories(List apiCategories) {
- this.apiCategories = apiCategories;
- }
-
public List getKeyManagers() {
return keyManagers;
}
@@ -475,4 +458,36 @@ public class APIInfo {
public void setAdvertiseInfo(AdvertiseInfo advertiseInfo) {
this.advertiseInfo = advertiseInfo;
}
+
+ public String getInSequence() {
+ return inSequence;
+ }
+
+ public void setInSequence(String inSequence) {
+ this.inSequence = inSequence;
+ }
+
+ public String getAsyncApiDefinition() {
+ return asyncApiDefinition;
+ }
+
+ public void setAsyncApiDefinition(String asyncApiDefinition) {
+ this.asyncApiDefinition = asyncApiDefinition;
+ }
+
+ public Set getUriTemplates() {
+ return uriTemplates;
+ }
+
+ public void setUriTemplates(Set uriTemplates) {
+ this.uriTemplates = uriTemplates;
+ }
+
+ public Map getWsUriMapping() {
+ return wsUriMapping;
+ }
+
+ public void setWsUriMapping(Map wsUriMapping) {
+ this.wsUriMapping = wsUriMapping;
+ }
}
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevision.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevision.java
new file mode 100644
index 0000000000..581fbb1792
--- /dev/null
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevision.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
+ *
+ * Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo;
+
+import org.wso2.carbon.apimgt.api.model.APIRevisionDeployment;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class APIRevision implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private int id;
+ private String apiUUID;
+ private String revisionUUID;
+ private String description;
+ private String createdBy;
+ private String createdTime;
+ private List apiRevisionDeploymentList;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getApiUUID() {
+ return apiUUID;
+ }
+
+ public void setApiUUID(String apiUUID) {
+ this.apiUUID = apiUUID;
+ }
+
+ public String getRevisionUUID() {
+ return revisionUUID;
+ }
+
+ public void setRevisionUUID(String revisionUUID) {
+ this.revisionUUID = revisionUUID;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ public String getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(String createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public List getApiRevisionDeploymentList() {
+ return apiRevisionDeploymentList;
+ }
+
+ public void setApiRevisionDeploymentList(List apiRevisionDeploymentList) {
+ this.apiRevisionDeploymentList = apiRevisionDeploymentList;
+ }
+}
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevisionDeployment.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevisionDeployment.java
new file mode 100644
index 0000000000..20c84232cc
--- /dev/null
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/APIRevisionDeployment.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
+ *
+ * Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo;
+
+import java.io.Serializable;
+
+public class APIRevisionDeployment implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private int id;
+ private String revisionUUID;
+ private String deployment;
+ private String vhost;
+ private boolean isDisplayOnDevportal;
+ private String deployedTime;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getRevisionUUID() {
+ return revisionUUID;
+ }
+
+ public void setRevisionUUID(String revisionUUID) {
+ this.revisionUUID = revisionUUID;
+ }
+
+ public String getDeployment() {
+ return deployment;
+ }
+
+ public void setDeployment(String deployment) {
+ this.deployment = deployment;
+ }
+
+ public String getVhost() {
+ return vhost;
+ }
+
+ public void setVhost(String vhost) {
+ this.vhost = vhost;
+ }
+
+ public boolean isDisplayOnDevportal() {
+ return isDisplayOnDevportal;
+ }
+
+ public void setDisplayOnDevportal(boolean displayOnDevportal) {
+ isDisplayOnDevportal = displayOnDevportal;
+ }
+
+ public String getDeployedTime() {
+ return deployedTime;
+ }
+
+ public void setDeployedTime(String deployedTime) {
+ this.deployedTime = deployedTime;
+ }
+}
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/AdvertiseInfo.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/AdvertiseInfo.java
index 93511526aa..9ed465bc72 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/AdvertiseInfo.java
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/AdvertiseInfo.java
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
+ * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@@ -15,7 +15,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo;
/**
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/BusinessInformation.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/BusinessInformation.java
index ad32e51f15..4310d50cbf 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/BusinessInformation.java
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/BusinessInformation.java
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
+ * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/CORSConfiguration.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/CORSConfiguration.java
new file mode 100644
index 0000000000..1bee613429
--- /dev/null
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/CORSConfiguration.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
+ *
+ * Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo;
+
+import java.util.List;
+
+/**
+ * API CORS Configuration
+ */
+public class CORSConfiguration {
+
+ private boolean corsConfigurationEnabled;
+ private List accessControlAllowOrigins;
+ private boolean accessControlAllowCredentials;
+ private List accessControlAllowHeaders;
+ private List accessControlAllowMethods;
+
+ public CORSConfiguration(boolean corsConfigurationEnabled, List accessControlAllowOrigins,
+ boolean accessControlAllowCredentials,
+ List accessControlAllowHeaders, List accessControlAllowMethods) {
+ this.corsConfigurationEnabled = corsConfigurationEnabled;
+ this.accessControlAllowOrigins = accessControlAllowOrigins;
+ this.accessControlAllowCredentials = accessControlAllowCredentials;
+ this.accessControlAllowHeaders = accessControlAllowHeaders;
+ this.accessControlAllowMethods = accessControlAllowMethods;
+ }
+
+ public boolean isCorsConfigurationEnabled() {
+ return corsConfigurationEnabled;
+ }
+
+ public void setCorsConfigurationEnabled(boolean corsConfigurationEnabled) {
+ this.corsConfigurationEnabled = corsConfigurationEnabled;
+ }
+
+ public List getAccessControlAllowOrigins() {
+ return accessControlAllowOrigins;
+ }
+
+ public void setAccessControlAllowOrigins(List accessControlAllowOrigins) {
+ this.accessControlAllowOrigins = accessControlAllowOrigins;
+ }
+
+ public boolean isAccessControlAllowCredentials() {
+ return accessControlAllowCredentials;
+ }
+
+ public void setAccessControlAllowCredentials(boolean accessControlAllowCredentials) {
+ this.accessControlAllowCredentials = accessControlAllowCredentials;
+ }
+
+ public List getAccessControlAllowHeaders() {
+ return accessControlAllowHeaders;
+ }
+
+ public void setAccessControlAllowHeaders(List accessControlAllowHeaders) {
+ this.accessControlAllowHeaders = accessControlAllowHeaders;
+ }
+
+ public List getAccessControlAllowMethods() {
+ return accessControlAllowMethods;
+ }
+
+ public void setAccessControlAllowMethods(List accessControlAllowMethods) {
+ this.accessControlAllowMethods = accessControlAllowMethods;
+ }
+}
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Documentation.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Documentation.java
new file mode 100644
index 0000000000..5d54bc7567
--- /dev/null
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Documentation.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
+ *
+ * Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo;
+
+import java.util.Date;
+
+public class Documentation {
+
+ private static final long serialVersionUID = 1L;
+ private String id;
+ private String documentId;
+ private DocumentationType type;
+ private String name;
+ private String summary;
+ private DocumentSourceType sourceType;
+ private String sourceUrl;
+ private DocumentVisibility visibility;
+ private Date lastUpdated;
+ private String filePath;
+ private Date createdDate;
+ private String otherTypeName;
+
+ public String getOtherTypeName() {
+ return this.otherTypeName;
+ }
+
+ public void setOtherTypeName(String otherTypeName) {
+ this.otherTypeName = otherTypeName;
+ }
+
+ public String getFilePath() {
+ return this.filePath;
+ }
+
+ public void setFilePath(String filePath) {
+ this.filePath = filePath;
+ }
+
+ public String getSourceUrl() {
+ return this.sourceUrl;
+ }
+
+ public void setSourceUrl(String sourceUrl) {
+ this.sourceUrl = sourceUrl;
+ }
+
+ public Documentation(DocumentationType type, String name) {
+ this.type = type;
+ this.name = name;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ } else if (o != null && this.getClass() == o.getClass()) {
+ Documentation that = (Documentation)o;
+ return this.name.equals(that.name) && this.type == that.type;
+ } else {
+ return false;
+ }
+ }
+
+ public DocumentationType getType() {
+ return this.type;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public String getSummary() {
+ return this.summary;
+ }
+
+ public void setSummary(String summary) {
+ this.summary = summary;
+ }
+
+ public DocumentVisibility getVisibility() {
+ return this.visibility;
+ }
+
+ public void setVisibility(DocumentVisibility visibility) {
+ this.visibility = visibility;
+ }
+
+ public DocumentSourceType getSourceType() {
+ return this.sourceType;
+ }
+
+ public void setSourceType(DocumentSourceType sourceType) {
+ this.sourceType = sourceType;
+ }
+
+ public int hashCode() {
+ int result = this.type.hashCode();
+ result = 31 * result + this.name.hashCode();
+ return result;
+ }
+
+ public Date getLastUpdated() {
+ return this.lastUpdated;
+ }
+
+ public void setLastUpdated(Date lastUpdated) {
+ this.lastUpdated = lastUpdated;
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getDocumentId() {
+ return documentId;
+ }
+
+ public void setDocumentId(String documentId) {
+ this.documentId = documentId;
+ }
+
+ public Date getCreatedDate() {
+ return this.createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public static enum DocumentVisibility {
+ OWNER_ONLY("owner_only"),
+ PRIVATE("private"),
+ API_LEVEL("api_level");
+
+ private String visibility;
+
+ private DocumentVisibility(String visibility) {
+ this.visibility = visibility;
+ }
+ }
+
+ public static enum DocumentSourceType {
+ INLINE("In line"),
+ MARKDOWN("Markdown"),
+ URL("URL"),
+ FILE("File");
+
+ private String type;
+
+ private DocumentSourceType(String type) {
+ this.type = type;
+ }
+ }
+
+ public static enum DocumentationType {
+ HOWTO("How To"),
+ SAMPLES("Samples"),
+ PUBLIC_FORUM("Public Forum"),
+ SUPPORT_FORUM("Support Forum"),
+ API_MESSAGE_FORMAT("API Message Format"),
+ SWAGGER_DOC("Swagger API Definition"),
+ OTHER("Other");
+
+ private String type;
+
+ private DocumentationType(String type) {
+ this.type = type;
+ }
+
+ public String getType() {
+ return type;
+ }
+ }
+}
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Mediation.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Mediation.java
new file mode 100644
index 0000000000..5e5125006c
--- /dev/null
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Mediation.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
+ *
+ * Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo;
+
+public class Mediation {
+
+ private String uuid;
+ private String name;
+ private String type;
+ private String config;
+ private boolean isGlobal;
+
+ public Mediation(){}
+
+ public void setUuid(String id){
+ this.uuid=id;
+ }
+ public String getUuid(){return uuid;}
+
+ public void setName(String name){this.name=name;}
+
+ public String getName(){return name;}
+
+ public void setType(String mType){this.type=mType;}
+
+ public String getType(){return type;}
+
+ public void setConfig(String mConfig){this.config=mConfig;}
+
+ public String getConfig(){return config;}
+
+ public boolean isGlobal() {
+ return isGlobal;
+ }
+
+ public void setGlobal(boolean isGlobal) {
+ this.isGlobal = isGlobal;
+ }
+}
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Operations.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Operations.java
index 51f2c1ee4c..2dd00c4482 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Operations.java
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Operations.java
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
+ * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Scope.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Scope.java
new file mode 100644
index 0000000000..01d3f53d36
--- /dev/null
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/Scope.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
+ *
+ * Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+public class Scope implements Serializable{
+
+ private static final long serialVersionUID = 1L;
+
+ String key;
+ String name;
+ String roles;
+ String description;
+ String id;
+ int usageCount;
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getRoles() {
+ return roles;
+ }
+
+ public void setRoles(String roles) {
+ this.roles = roles;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public int getUsageCount() {
+ return usageCount;
+ }
+
+ public void setUsageCount(int usageCount) {
+ this.usageCount = usageCount;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Scope scope = (Scope) o;
+
+ if (id != null ? !id.equals(scope.id) : scope.id != null) return false;
+ if (!key.equals(scope.key)) return false;
+ if (!name.equals(scope.name)) return false;
+ if (roles != null ? !roles.equals(scope.roles) : scope.roles != null) return false;
+ return description != null ? description.equals(scope.description) : scope.description == null;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(key, name, roles, description, id);
+ }
+}
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/URITemplate.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/URITemplate.java
new file mode 100644
index 0000000000..9cd69a9f11
--- /dev/null
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIInfo/URITemplate.java
@@ -0,0 +1,440 @@
+/*
+ * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
+ *
+ * Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo;
+
+import org.json.simple.JSONValue;
+import org.wso2.carbon.apimgt.api.dto.ConditionGroupDTO;
+import org.wso2.carbon.apimgt.api.model.APIProductIdentifier;
+import org.wso2.carbon.apimgt.api.model.Scope;
+import org.wso2.carbon.apimgt.api.model.policy.PolicyConstants;
+
+import java.io.Serializable;
+import java.util.*;
+
+public class URITemplate implements Serializable{
+
+ private static final long serialVersionUID = 1L;
+
+ private String uriTemplate;
+ private String resourceURI;
+ private String resourceSandboxURI;
+ private String httpVerb;
+ private String authType;
+ private LinkedHashSet httpVerbs = new LinkedHashSet();
+ private List authTypes = new ArrayList();
+ private List throttlingConditions = new ArrayList();
+ private String applicableLevel;
+ private String throttlingTier;
+ private List throttlingTiers = new ArrayList();
+ private org.wso2.carbon.apimgt.api.model.Scope scope;
+ private String mediationScript;
+ private List scopes = new ArrayList();
+ private Map mediationScripts = new HashMap();
+ private ConditionGroupDTO[] conditionGroups;
+ private int id;
+ private Set usedByProducts = new HashSet<>();
+ private String amznResourceName;
+ private int amznResourceTimeout;
+
+ public ConditionGroupDTO[] getConditionGroups() {
+ return conditionGroups;
+ }
+
+ public void setConditionGroups(ConditionGroupDTO[] conditionGroups) {
+ this.conditionGroups = conditionGroups;
+ }
+
+ public String getMediationScript() {
+ return mediationScript;
+ }
+
+
+ public List getThrottlingConditions() {
+ return throttlingConditions;
+ }
+
+ public void setThrottlingConditions(List throttlingConditions) {
+ this.throttlingConditions = throttlingConditions;
+ }
+
+ public void setMediationScript(String mediationScript) {
+ this.mediationScript = mediationScript;
+ }
+ /**
+ * Set mediation script for a given http method
+ * @param method http method name
+ * @param mediationScript mediation script content
+ */
+ public void setMediationScripts(String method, String mediationScript){
+ if (mediationScript != null && !mediationScript.trim().equals("") && !mediationScript.trim().equals("null")){
+ mediationScripts.put(method, mediationScript);
+ }
+
+ }
+
+ /**
+ * Generating the script by aggregating scripts of each http method to form a single script in to be
+ * used when generating synapse configuration file.
+ *
+ * @return aggregated script in the following format,
+ * if (http-method = 'GET'){
+ * //script for GET
+ * }
+ * ....
+ * ....
+ * if (http-method = 'POST'){
+ * //script for POST
+ * }
+ */
+ public String getAggregatedMediationScript(){
+ if (mediationScripts.isEmpty()){
+ return "null";
+ }else if (mediationScripts.size() == 1 && httpVerbs.size() == 1){
+ return mediationScript;
+ }else{
+ StringBuilder aggregatedScript = new StringBuilder();
+
+ for (Map.Entry entry : mediationScripts.entrySet()){
+ String httpMethod = entry.getKey();
+ String mediationScript = entry.getValue();
+
+ aggregatedScript.append("if (mc.getProperty('REST_METHOD') == '").append(httpMethod).append("'){");
+ aggregatedScript.append(mediationScript);
+ aggregatedScript.append("}");
+
+ }
+
+ return aggregatedScript.toString();
+ }
+ }
+
+ public String getThrottlingTier() {
+ return throttlingTier;
+ }
+
+ public void setThrottlingTier(String throttlingTier) {
+ this.throttlingTier = throttlingTier;
+ }
+
+ public List getThrottlingTiers(){
+ return throttlingTiers;
+ }
+
+ public void setThrottlingTiers(List throttlingTiers) {
+ this.throttlingTiers = throttlingTiers;
+ }
+
+ public String getHTTPVerb() {
+ return httpVerb;
+ }
+
+ public void setHTTPVerb(String httpVerb) {
+ this.httpVerb = httpVerb;
+ }
+
+ public String getAuthType() {
+ return authType;
+ }
+
+ public void setAuthType(String authType) {
+ this.authType = authType;
+
+ }
+
+ public String getResourceURI() {
+ return resourceURI;
+ }
+
+ public void setResourceURI(String resourceURI) {
+ this.resourceURI = resourceURI;
+ }
+
+ public boolean isResourceURIExist(){
+ return this.resourceURI != null;
+ }
+
+ public String getResourceSandboxURI() {
+ return resourceSandboxURI;
+ }
+
+ public void setResourceSandboxURI(String resourceSandboxURI) {
+ this.resourceSandboxURI = resourceSandboxURI;
+ }
+
+ public boolean isResourceSandboxURIExist(){
+ return this.resourceSandboxURI != null;
+ }
+
+ public String getUriTemplate() {
+ return uriTemplate;
+ }
+
+ public void setUriTemplate(String template) {
+ this.uriTemplate = template;
+ }
+
+ public void setHttpVerbs(String httpVerb) {
+
+ httpVerbs.add(httpVerb);
+ }
+
+ public LinkedHashSet getHttpVerbs() {
+
+ return httpVerbs;
+ }
+
+
+
+ public void setAuthTypes(String authType) {
+
+ authTypes.add(authType);
+ }
+
+ public String getAuthTypes() {
+
+ return authType;
+ }
+
+
+ public String getMethodsAsString() {
+ StringBuilder stringBuilder = new StringBuilder();
+ for (String method : httpVerbs) {
+ stringBuilder.append(method).append(" ");
+ }
+ return stringBuilder.toString().trim();
+ }
+
+ public String getAuthTypeAsString() {
+ StringBuilder stringBuilder = new StringBuilder();
+ for (String authType : authTypes) {
+ stringBuilder.append(authType).append(" ");
+ }
+ return stringBuilder.toString().trim();
+ }
+
+ public String getThrottlingConditionsAsString() {
+ StringBuilder stringBuilder = new StringBuilder();
+ for (String authType : throttlingConditions) {
+ stringBuilder.append(authType).append(" ");
+ }
+ return stringBuilder.toString().trim();
+ }
+
+ public void setThrottlingTiers(String tier) {
+ throttlingTiers.add(tier);
+ }
+
+ public String getThrottlingTiersAsString() {
+ StringBuilder stringBuilder = new StringBuilder();
+ for (String tier : throttlingTiers) {
+ if (tier.contains(PolicyConstants.THROTTLING_TIER_CONTENT_AWARE_SEPERATOR)) {
+ stringBuilder.append(tier.substring(0,
+ tier.indexOf(PolicyConstants.THROTTLING_TIER_CONTENT_AWARE_SEPERATOR)).trim()).append(" ");
+ } else {
+ stringBuilder.append(tier.trim()).append(" ");
+ }
+ }
+ return stringBuilder.toString().trim();
+ }
+
+ public boolean checkContentAwareFromThrottlingTiers() {
+ // use the content aware property appended to throttling tiers
+ if (!throttlingTiers.isEmpty()) {
+ String throttlingTierWithContentAware = throttlingTiers.get(0);
+ if (throttlingTierWithContentAware != null &&
+ throttlingTierWithContentAware.contains(PolicyConstants.THROTTLING_TIER_CONTENT_AWARE_SEPERATOR)) {
+ String[] splitThrottlingTiers =
+ throttlingTierWithContentAware.split(PolicyConstants.THROTTLING_TIER_CONTENT_AWARE_SEPERATOR);
+ return Boolean.valueOf(splitThrottlingTiers[splitThrottlingTiers.length - 1]);
+ }
+ }
+ return false;
+ }
+
+ public org.wso2.carbon.apimgt.api.model.Scope getScope() {
+ return scope;
+ }
+ public List getScopes() {
+ return scopes;
+ }
+
+ public void setScope(org.wso2.carbon.apimgt.api.model.Scope scope) {
+ this.scope = scope;
+ }
+
+ public void setScopes(org.wso2.carbon.apimgt.api.model.Scope scope){
+ this.scopes.add(scope);
+ }
+
+ public String getResourceMap(){
+ Map verbs = new LinkedHashMap();
+ int i = 0;
+ for (String method : httpVerbs) {
+ Map verb = new LinkedHashMap();
+ verb.put("auth_type",authTypes.get(i));
+ verb.put("throttling_tier",throttlingTiers.get(i));
+ //Following parameter is not required as it not need to reflect UI level. If need please enable it.
+ // /verb.put("throttling_conditions", throttlingConditions.get(i));
+ try{
+ org.wso2.carbon.apimgt.api.model.Scope tmpScope = scopes.get(i);
+ if(tmpScope != null){
+ verb.put("scope",tmpScope.getKey());
+ }
+ }catch(IndexOutOfBoundsException e){
+ //todo need to rewrite to prevent this type of exceptions
+ }
+ verbs.put(method,verb);
+ i++;
+ }
+ //todo this is a hack to make key validation service stub from braking need to rewrite.
+ return JSONValue.toJSONString(verbs);
+ }
+
+ public String getApplicableLevel() {
+ return applicableLevel;
+ }
+
+ public void setApplicableLevel(String applicableLevel) {
+ this.applicableLevel = applicableLevel;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ URITemplate that = (URITemplate) o;
+
+ if (!uriTemplate.equals(that.uriTemplate)) {
+ return false;
+ }
+ if (resourceURI != null ? !resourceURI.equals(that.resourceURI) : that.resourceURI != null) {
+ return false;
+ }
+ if (resourceSandboxURI != null ? !resourceSandboxURI.equals(that.resourceSandboxURI) : that
+ .resourceSandboxURI != null) {
+ return false;
+ }
+ if (!httpVerb.equals(that.httpVerb)) {
+ return false;
+ }
+ if (!authType.equals(that.authType)) {
+ return false;
+ }
+ if (!httpVerbs.equals(that.httpVerbs)) {
+ return false;
+ }
+ if (!authTypes.equals(that.authTypes)) {
+ return false;
+ }
+ if (throttlingConditions != null ? !throttlingConditions.equals(that.throttlingConditions) : that
+ .throttlingConditions != null) {
+ return false;
+ }
+ if (applicableLevel != null ? !applicableLevel.equals(that.applicableLevel) : that.applicableLevel != null) {
+ return false;
+ }
+ if (!throttlingTier.equals(that.throttlingTier)) {
+ return false;
+ }
+ if (!throttlingTiers.equals(that.throttlingTiers)) {
+ return false;
+ }
+ if (scope != null ? !scope.equals(that.scope) : that.scope != null) {
+ return false;
+ }
+ if (mediationScript != null ? !mediationScript.equals(that.mediationScript) : that.mediationScript != null) {
+ return false;
+ }
+ if (scopes != null ? !scopes.equals(that.scopes) : that.scopes != null) {
+ return false;
+ }
+ if (mediationScripts != null ? !mediationScripts.equals(that.mediationScripts) : that.mediationScripts !=
+ null) {
+ return false;
+ }
+ // Probably incorrect - comparing Object[] arrays with Arrays.equals
+ return Arrays.equals(conditionGroups, that.conditionGroups);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = uriTemplate.hashCode();
+ result = 31 * result + (resourceURI != null ? resourceURI.hashCode() : 0);
+ result = 31 * result + (resourceSandboxURI != null ? resourceSandboxURI.hashCode() : 0);
+ result = 31 * result + (httpVerb != null ? httpVerb.hashCode() : 0);
+ result = 31 * result + (authType != null ? authType.hashCode() : 0);
+ result = 31 * result + (httpVerbs != null ? httpVerbs.hashCode() : 0);
+ result = 31 * result + (authTypes != null ? authTypes.hashCode() : 0);
+ result = 31 * result + (throttlingConditions != null ? throttlingConditions.hashCode() : 0);
+ result = 31 * result + (applicableLevel != null ? applicableLevel.hashCode() : 0);
+ result = 31 * result + (throttlingTier != null ? throttlingTier.hashCode() : 0);
+ result = 31 * result + (throttlingTiers != null ? throttlingTiers.hashCode() : 0);
+ result = 31 * result + (scope != null ? scope.hashCode() : 0);
+ result = 31 * result + (mediationScript != null ? mediationScript.hashCode() : 0);
+ result = 31 * result + (scopes != null ? scopes.hashCode() : 0);
+ result = 31 * result + (mediationScripts != null ? mediationScripts.hashCode() : 0);
+ result = 31 * result + Arrays.hashCode(conditionGroups);
+ return result;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public List retrieveAllScopes() {
+ return this.scopes;
+ }
+
+ public void addAllScopes(List scopes) {
+
+ this.scopes = scopes;
+ }
+
+ public Set retrieveUsedByProducts() {
+ return usedByProducts;
+ }
+
+ public void addUsedByProduct(APIProductIdentifier usedByProduct) {
+ usedByProducts.add(usedByProduct);
+ }
+
+ public void setAmznResourceName(String amznResourceName) {
+ this.amznResourceName = amznResourceName;
+ }
+
+ public String getAmznResourceName() {
+ return amznResourceName;
+ }
+
+ public void setAmznResourceTimeout(int amznResourceTimeout) {
+ this.amznResourceTimeout = amznResourceTimeout;
+ }
+
+ public int getAmznResourceTimeout() {
+ return amznResourceTimeout;
+ }
+}
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml
index 596890a486..7f9c6e3f59 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml
@@ -21,7 +21,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
4.0.0
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml
index 16473e86bf..28dfb387b7 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml
@@ -21,7 +21,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml
index 6b8e5d4cc6..d93e9c2838 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml
@@ -22,7 +22,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java
index 0c3b336f0b..871450c824 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java
@@ -23,26 +23,29 @@ import io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServi
import io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServicesImpl;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.constants.Constants;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey;
+import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo;
+import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Scope;
+import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Mediation;
+import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Documentation;
+import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIRevision;
+import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIRevisionDeployment;
+import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.CORSConfiguration;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException;
-import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo;
+import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.WebappPublisherConfig;
+import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiScope;
+import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiUriTemplate;
+import io.entgra.device.mgt.core.apimgt.webapp.publisher.exception.APIManagerPublisherException;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.apimgt.api.model.Documentation;
-import org.wso2.carbon.apimgt.api.model.DocumentationType;
import org.json.JSONArray;
import org.json.JSONObject;
import org.wso2.carbon.apimgt.api.APIManagementException;
import org.wso2.carbon.apimgt.api.APIProvider;
import org.wso2.carbon.apimgt.api.model.APIIdentifier;
-import org.wso2.carbon.apimgt.api.model.APIRevision;
-import org.wso2.carbon.apimgt.api.model.APIRevisionDeployment;
-import org.wso2.carbon.apimgt.api.model.CORSConfiguration;
-import org.wso2.carbon.apimgt.api.model.Mediation;
-import org.wso2.carbon.apimgt.api.model.Scope;
import org.wso2.carbon.apimgt.impl.APIConstants;
import org.wso2.carbon.apimgt.impl.APIManagerFactory;
import org.wso2.carbon.apimgt.impl.utils.APIUtil;
@@ -167,6 +170,7 @@ public class APIPublisherServiceImpl implements APIPublisherService {
break;
}
}
+ String apiUuid = apiIdentifier.getUUID();
if (!apiFound) {
// add new scopes as shared scopes
for (ApiScope apiScope : apiConfig.getScopes()) {
@@ -182,9 +186,10 @@ public class APIPublisherServiceImpl implements APIPublisherService {
}
APIInfo api = getAPI(apiConfig, true);
JSONObject createdAPI = publisherRESTAPIServices.addAPI(apiApplicationKey, accessTokenInfo, api);
+ apiUuid = createdAPI.getString("id");
if (apiConfig.getEndpointType() != null && "WS".equals(apiConfig.getEndpointType())) {
publisherRESTAPIServices.saveAsyncApiDefinition(apiApplicationKey, accessTokenInfo,
- createdAPI.getString("id"), apiConfig.getAsyncApiDefinition());
+ apiUuid, apiConfig.getAsyncApiDefinition());
}
if (CREATED_STATUS.equals(createdAPI.getString("lifeCycleStatus"))) {
// if endpoint type "dynamic" and then add in sequence
@@ -195,13 +200,13 @@ public class APIPublisherServiceImpl implements APIPublisherService {
mediation.setType("in");
mediation.setGlobal(false);
publisherRESTAPIServices.addApiSpecificMediationPolicy(apiApplicationKey,
- accessTokenInfo, createdAPI.getString("id"), mediation);
+ accessTokenInfo, apiUuid, mediation);
}
publisherRESTAPIServices.changeLifeCycleStatus(apiApplicationKey, accessTokenInfo,
- createdAPI.getString("id"), PUBLISH_ACTION);
+ apiUuid, PUBLISH_ACTION);
APIRevision apiRevision = new APIRevision();
- apiRevision.setApiUUID(createdAPI.getString("id"));
+ apiRevision.setApiUUID(apiUuid);
apiRevision.setDescription("Initial Revision");
String apiRevisionId = publisherRESTAPIServices.addAPIRevision(apiApplicationKey,
accessTokenInfo, apiRevision).getString("id");
@@ -214,7 +219,7 @@ public class APIPublisherServiceImpl implements APIPublisherService {
List apiRevisionDeploymentList = new ArrayList<>();
apiRevisionDeploymentList.add(apiRevisionDeployment);
publisherRESTAPIServices.deployAPIRevision(apiApplicationKey, accessTokenInfo,
- createdAPI.getString("id"), apiRevisionId, apiRevisionDeploymentList);
+ apiUuid, apiRevisionId, apiRevisionDeploymentList);
}
} else {
if (WebappPublisherConfig.getInstance().isEnabledUpdateApi()) {
@@ -257,7 +262,7 @@ public class APIPublisherServiceImpl implements APIPublisherService {
// Get existing API
JSONObject existingAPI = publisherRESTAPIServices.getApi(apiApplicationKey, accessTokenInfo,
- apiIdentifier);
+ apiUuid);
if (scopesToMoveAsSharedScopes.size() > 0) {
// update API to remove local scopes
APIInfo api = getAPI(apiConfig, false);
@@ -274,15 +279,15 @@ public class APIPublisherServiceImpl implements APIPublisherService {
}
}
- existingAPI = publisherRESTAPIServices.getApi(apiApplicationKey, accessTokenInfo, apiIdentifier);
+ existingAPI = publisherRESTAPIServices.getApi(apiApplicationKey, accessTokenInfo, apiUuid);
APIInfo api = getAPI(apiConfig, true);
api.setLastUpdatedTime(existingAPI.getString("lifeCycleStatus"));
- api.setId(existingAPI.getString("id"));
+ api.setId(apiUuid);
publisherRESTAPIServices.updateApi(apiApplicationKey, accessTokenInfo, api);
if (apiConfig.getEndpointType() != null && "WS".equals(apiConfig.getEndpointType())) {
publisherRESTAPIServices.saveAsyncApiDefinition(apiApplicationKey, accessTokenInfo,
- existingAPI.getString("id"), apiConfig.getAsyncApiDefinition());
+ apiUuid, apiConfig.getAsyncApiDefinition());
}
// if endpoint type "dynamic" and then add /update in sequence
@@ -293,48 +298,55 @@ public class APIPublisherServiceImpl implements APIPublisherService {
mediation.setType("in");
mediation.setGlobal(false);
- List mediationList = (List) publisherRESTAPIServices
+ JSONArray mediationList = (JSONArray) publisherRESTAPIServices
.getAllApiSpecificMediationPolicies(apiApplicationKey, accessTokenInfo,
- apiIdentifier).get("list");
+ apiUuid).get("list");
boolean isMediationPolicyFound = false;
- for (Mediation m : mediationList) {
- if (apiConfig.getInSequenceName().equals(m.getName())) {
- m.setConfig(apiConfig.getInSequenceConfig());
- publisherRESTAPIServices.
- updateApiSpecificMediationPolicyContent(apiApplicationKey,
- accessTokenInfo, existingAPI.getString("id"), m);
+ for (int i = 0; i < mediationList.length(); i++) {
+ JSONObject mediationObj = mediationList.getJSONObject(i);
+ if (apiConfig.getInSequenceName().equals(mediationObj.getString("name"))) {
+ mediation.setUuid(mediationObj.getString("id"));
+ publisherRESTAPIServices.deleteApiSpecificMediationPolicy(apiApplicationKey,
+ accessTokenInfo, apiUuid, mediation);
+ publisherRESTAPIServices.addApiSpecificMediationPolicy(apiApplicationKey,
+ accessTokenInfo, apiUuid, mediation);
isMediationPolicyFound = true;
break;
}
}
if (!isMediationPolicyFound) {
publisherRESTAPIServices.addApiSpecificMediationPolicy(apiApplicationKey,
- accessTokenInfo, existingAPI.getString("id"), mediation);
+ accessTokenInfo, apiUuid, mediation);
}
}
- // This will retrieve the deployed revision
- JSONArray revisionDeploymentList = (JSONArray) publisherRESTAPIServices.getAPIRevisions(apiApplicationKey,
- accessTokenInfo, existingAPI.getString("id"), true).get("list");
- // This will retrieve the un deployed revision list
- JSONArray undeployedRevisionList = (JSONArray) publisherRESTAPIServices.getAPIRevisions(apiApplicationKey,
- accessTokenInfo, existingAPI.getString("id"), false).get("list");
int apiRevisionCount = (int) publisherRESTAPIServices.getAPIRevisions(apiApplicationKey,
- accessTokenInfo, existingAPI.getString("id"), null).get("count");
-
+ accessTokenInfo, apiUuid, null).get("count");
if (apiRevisionCount >= 5) {
- JSONObject latestRevisionDeployment = revisionDeploymentList.getJSONObject(0);
- JSONObject earliestUndeployRevision = undeployedRevisionList.getJSONObject(0);
- publisherRESTAPIServices.undeployAPIRevisionDeployment(apiApplicationKey,
- accessTokenInfo, latestRevisionDeployment, existingAPI.getString("id"));
- publisherRESTAPIServices.deleteAPIRevision(apiApplicationKey, accessTokenInfo,
- earliestUndeployRevision, existingAPI.getString("id"));
+ // This will retrieve the deployed revision
+ JSONArray revisionDeploymentList = (JSONArray) publisherRESTAPIServices.getAPIRevisions(
+ apiApplicationKey, accessTokenInfo, apiUuid,
+ true).get("list");
+ if (revisionDeploymentList.length() > 0) {
+ JSONObject latestRevisionDeployment = revisionDeploymentList.getJSONObject(0);
+ publisherRESTAPIServices.undeployAPIRevisionDeployment(apiApplicationKey,
+ accessTokenInfo, latestRevisionDeployment, apiUuid);
+ }
+ // This will retrieve the un deployed revision list
+ JSONArray undeployedRevisionList = (JSONArray) publisherRESTAPIServices.getAPIRevisions(
+ apiApplicationKey, accessTokenInfo, apiUuid,
+ false).get("list");
+ if (undeployedRevisionList.length() > 0) {
+ JSONObject earliestUndeployRevision = undeployedRevisionList.getJSONObject(0);
+ publisherRESTAPIServices.deleteAPIRevision(apiApplicationKey, accessTokenInfo,
+ earliestUndeployRevision, apiUuid);
+ }
}
// create new revision
APIRevision apiRevision = new APIRevision();
- apiRevision.setApiUUID(existingAPI.getString("id"));
+ apiRevision.setApiUUID(apiUuid);
apiRevision.setDescription("Updated Revision");
String apiRevisionId = publisherRESTAPIServices.addAPIRevision(apiApplicationKey,
accessTokenInfo, apiRevision).getString("id");
@@ -348,17 +360,15 @@ public class APIPublisherServiceImpl implements APIPublisherService {
apiRevisionDeploymentList.add(apiRevisionDeployment);
publisherRESTAPIServices.deployAPIRevision(apiApplicationKey, accessTokenInfo,
- existingAPI.getString("id"), apiRevisionId, apiRevisionDeploymentList);
+ apiUuid, apiRevisionId, apiRevisionDeploymentList);
if (CREATED_STATUS.equals(existingAPI.getString("lifeCycleStatus"))) {
publisherRESTAPIServices.changeLifeCycleStatus(apiApplicationKey,accessTokenInfo,
- existingAPI.getString("id"), PUBLISH_ACTION);
+ apiUuid, PUBLISH_ACTION);
}
}
}
- if (apiConfig.getApiDocumentationSourceFile() != null) {
- APIInfo api = getAPI(apiConfig, true);
-
+ if (apiUuid != null && apiConfig.getApiDocumentationSourceFile() != null) {
String fileName =
CarbonUtils.getCarbonHome() + File.separator + "repository" +
File.separator + "resources" + File.separator + "api-docs" + File.separator +
@@ -376,7 +386,7 @@ public class APIPublisherServiceImpl implements APIPublisherService {
br.close();
String docContent = stringBuilder.toString();
- Documentation apiDocumentation = new Documentation(DocumentationType.HOWTO, apiConfig.getApiDocumentationName());
+ Documentation apiDocumentation = new Documentation(Documentation.DocumentationType.HOWTO, apiConfig.getApiDocumentationName());
apiDocumentation.setVisibility(Documentation.DocumentVisibility.API_LEVEL);
apiDocumentation.setSourceType(Documentation.DocumentSourceType.MARKDOWN);
apiDocumentation.setCreatedDate(new Date());
@@ -385,25 +395,27 @@ public class APIPublisherServiceImpl implements APIPublisherService {
apiDocumentation.setOtherTypeName(null);
JSONArray documentList = (JSONArray) publisherRESTAPIServices.getDocumentations(apiApplicationKey,
- accessTokenInfo, api.getId()).get("list");
+ accessTokenInfo, apiUuid).get("list");
if (documentList.length() > 0) {
for (int i = 0; i < documentList.length(); i++) {
JSONObject existingDoc = documentList.getJSONObject(i);
if (existingDoc.getString("name").equals(apiConfig.getApiDocumentationName())
- && existingDoc.getString("type").equals(DocumentationType.HOWTO)) {
+ && existingDoc.getString("type").equals(Documentation.DocumentationType.HOWTO.name())) {
publisherRESTAPIServices.deleteDocumentations(apiApplicationKey, accessTokenInfo,
- api.getId(), existingDoc.getString("documentId"));
+ apiUuid, existingDoc.getString("documentId"));
}
}
} else {
log.info("There is no any existing api documentation.");
}
- Documentation createdDoc = publisherRESTAPIServices.addDocumentation(apiApplicationKey, accessTokenInfo,
- api.getId(), apiDocumentation);
- publisherRESTAPIServices.addDocumentationContent(apiApplicationKey, accessTokenInfo, api,
- createdDoc.getId(), docContent);
+ io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.Documentation createdDoc = publisherRESTAPIServices.addDocumentation(apiApplicationKey, accessTokenInfo,
+ apiUuid, apiDocumentation);
+
+ publisherRESTAPIServices.addDocumentationContent(apiApplicationKey, accessTokenInfo, apiUuid,
+ createdDoc.getDocumentId(), docContent);
+
}
} catch (APIManagementException | IOException | APIServicesException |
BadRequestException | UnexpectedResponseException e) {
@@ -572,45 +584,49 @@ public class APIPublisherServiceImpl implements APIPublisherService {
}
apiInfo.setPolicies(availableTiers);
- if (config.getEndpointType() == null) {
- List operations = new ArrayList();
- List scopeSet = new ArrayList();
- Iterator iterator;
- for (iterator = config.getUriTemplates().iterator(); iterator.hasNext(); ) {
- ApiUriTemplate apiUriTemplate = iterator.next();
- JSONObject operation = new JSONObject();
- operation.put("target", apiUriTemplate.getUriTemplate());
- operation.put("verb", apiUriTemplate.getHttpVerb());
- operation.put("authType", apiUriTemplate.getAuthType());
- operation.put("throttlingPolicy", UNLIMITED_TIER);
- if (includeScopes) {
- if (apiUriTemplate.getScope() != null) {
- String scopeString = "{\n" +
- " \"scope\": {\n" +
- " \"id\": null,\n" +
- " \"name\": \"" + apiUriTemplate.getScope().getKey() + "\",\n" +
- " \"displayName\": \"" + apiUriTemplate.getScope().getName() + "\",\n" +
- " \"description\": \"" + apiUriTemplate.getScope().getDescription() + "\",\n" +
- " \"bindings\": [\n" +
- " \"" + apiUriTemplate.getScope().getRoles() + "\"\n" +
- " ],\n" +
- " \"usageCount\": null\n" +
- " },\n" +
- " \"shared\": true\n" +
- " }";
- JSONObject scope = new JSONObject(scopeString);
- scopeSet.add(scope);
-
- Set scopes = new HashSet<>();
- scopes.add(apiUriTemplate.getScope().getKey());
- operation.put("scopes", scopes);
- }
+ if (config.getEndpointType() != null && "WS".equals(config.getEndpointType())) {
+ apiInfo.setAsyncApiDefinition(config.getAsyncApiDefinition());
+ }
+
+ //set operations and scopes
+ List operations = new ArrayList();
+ List scopeSet = new ArrayList();
+ Iterator iterator;
+ for (iterator = config.getUriTemplates().iterator(); iterator.hasNext(); ) {
+ ApiUriTemplate apiUriTemplate = iterator.next();
+ JSONObject operation = new JSONObject();
+ operation.put("target", apiUriTemplate.getUriTemplate());
+ operation.put("verb", apiUriTemplate.getHttpVerb());
+ operation.put("authType", apiUriTemplate.getAuthType());
+ operation.put("throttlingPolicy", UNLIMITED_TIER);
+ operation.put("uriMapping", apiUriTemplate.getUriMapping());
+ if (includeScopes) {
+ if (apiUriTemplate.getScope() != null) {
+ String scopeString = "{\n" +
+ " \"scope\": {\n" +
+ " \"id\": null,\n" +
+ " \"name\": \"" + apiUriTemplate.getScope().getKey() + "\",\n" +
+ " \"displayName\": \"" + apiUriTemplate.getScope().getName() + "\",\n" +
+ " \"description\": \"" + apiUriTemplate.getScope().getDescription() + "\",\n" +
+ " \"bindings\": [\n" +
+ " \"" + apiUriTemplate.getScope().getRoles() + "\"\n" +
+ " ],\n" +
+ " \"usageCount\": null\n" +
+ " },\n" +
+ " \"shared\": true\n" +
+ " }";
+ JSONObject scope = new JSONObject(scopeString);
+ scopeSet.add(scope);
+
+ Set scopes = new HashSet<>();
+ scopes.add(apiUriTemplate.getScope().getKey());
+ operation.put("scopes", scopes);
}
- operations.add(operation);
}
- apiInfo.setScopes(scopeSet);
- apiInfo.setOperations(operations);
+ operations.add(operation);
}
+ apiInfo.setScopes(scopeSet);
+ apiInfo.setOperations(operations);
if (config.isSharedWithAllTenants()) {
apiInfo.setSubscriptionAvailability(SUBSCRIPTION_TO_ALL_TENANTS);
@@ -640,7 +656,7 @@ public class APIPublisherServiceImpl implements APIPublisherService {
if (config.getEndpointType() != null && "dynamic".equals(config.getEndpointType())) {
endpointConfig = "{\n" +
- " \"endpoint_type\": \"http\",\n" +
+ " \"endpoint_type\": \"default\",\n" +
" \"sandbox_endpoints\": {\n" +
" \"url\": \" default \"\n" +
" },\n" +
@@ -649,8 +665,7 @@ public class APIPublisherServiceImpl implements APIPublisherService {
" }\n" +
" }";
endPointConfig = new JSONObject(endpointConfig);
- //TODO: Will be used in dynamic endpoints
-// apiInfo.setInSequence(config.getInSequenceName());
+ apiInfo.setInSequence(config.getInSequenceName());
}
// if ws endpoint
@@ -702,42 +717,5 @@ public class APIPublisherServiceImpl implements APIPublisherService {
apiInfo.setServiceInfo(null);
return apiInfo;
-
- //TODO: Will be used in WS or dynamic endpoints
-// if (config.getEndpointType() != null && "WS".equals(config.getEndpointType())) {
-// api.setAsyncApiDefinition(config.getAsyncApiDefinition());
-// AsyncApiParser asyncApiParser = new AsyncApiParser();
-// try {
-// api.setUriTemplates(asyncApiParser.getURITemplates(config.getAsyncApiDefinition(), true));
-// } catch (APIManagementException e) {
-//
-// }
-// api.setWsUriMapping(asyncApiParser.buildWSUriMapping(config.getAsyncApiDefinition()));
-// } else {
-// api.setSwaggerDefinition(APIPublisherUtil.getSwaggerDefinition(config));
-//
-// Set uriTemplates = new HashSet<>();
-// Iterator iterator;
-// for (iterator = config.getUriTemplates().iterator(); iterator.hasNext(); ) {
-// ApiUriTemplate apiUriTemplate = iterator.next();
-// URITemplate uriTemplate = new URITemplate();
-// uriTemplate.setAuthType(apiUriTemplate.getAuthType());
-// uriTemplate.setHTTPVerb(apiUriTemplate.getHttpVerb());
-// uriTemplate.setResourceURI(apiUriTemplate.getResourceURI());
-// uriTemplate.setUriTemplate(apiUriTemplate.getUriTemplate());
-// if (includeScopes) {
-// Scope scope = new Scope();
-// if (apiUriTemplate.getScope() != null) {
-// scope.setName(apiUriTemplate.getScope().getName());
-// scope.setDescription(apiUriTemplate.getScope().getDescription());
-// scope.setKey(apiUriTemplate.getScope().getKey());
-// scope.setRoles(apiUriTemplate.getScope().getRoles());
-// uriTemplate.setScopes(scope);
-// }
-// }
-// uriTemplates.add(uriTemplate);
-// }
-// api.setUriTemplates(uriTemplates);
-// }
}
}
diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml
index dc1fbb9f93..869a18e9ad 100644
--- a/components/apimgt-extensions/pom.xml
+++ b/components/apimgt-extensions/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml
index 8c07c96b32..e14d3e5998 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
application-mgt
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml
index 22ea770699..c2eef70be0 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
application-mgt
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml
index 1c96bb5443..42d9d984f9 100644
--- a/components/application-mgt/pom.xml
+++ b/components/application-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml
index 39dd733ced..acf86abad7 100644
--- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml
+++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml
@@ -22,7 +22,7 @@
certificate-mgt
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml
index 55f9414ffe..892f10fefd 100644
--- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml
+++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml
@@ -22,7 +22,7 @@
certificate-mgt
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml
index 65734f6ffb..84d4790af8 100644
--- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml
+++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
certificate-mgt
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGenerator.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGenerator.java
index 328c2fcbfb..4dfe921787 100755
--- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGenerator.java
+++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGenerator.java
@@ -847,8 +847,9 @@ public class CertificateGenerator {
X500Name issuerName = new X500Name(subjectDn);
String commonName = certificationRequest.getSubject().getRDNs(BCStyle.CN)[0].getFirst()
.getValue().toString();
- X500Name subjectName = new X500Name("O=" + commonName + "O=AndroidDevice,CN=" +
- serialNumber);
+ int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
+ X500Name subjectName = new X500Name("O=" + commonName + " ,CN=" +
+ serialNumber + ", OU=tenant_" + tenantId);
Date startDate = new Date(System.currentTimeMillis());
Date endDate = new Date(System.currentTimeMillis()
+ TimeUnit.DAYS.toMillis(365 * 100));
@@ -869,7 +870,7 @@ public class CertificateGenerator {
io.entgra.device.mgt.core.certificate.mgt.core.bean.Certificate certificate =
new io.entgra.device.mgt.core.certificate.mgt.core.bean.Certificate();
List certificates = new ArrayList<>();
- certificate.setTenantId(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
+ certificate.setTenantId(tenantId);
certificate.setCertificate(issuedCert);
certificates.add(certificate);
saveCertInKeyStore(certificates);
diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml
index ea2fe08c57..4d2a1bf77a 100644
--- a/components/certificate-mgt/pom.xml
+++ b/components/certificate-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml
index f478949233..23f5841e76 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml
index c192cd958e..795c737521 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml
index 8cdbf53776..67308af45c 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml
@@ -21,7 +21,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml
index 8dd43e524a..a0e00c6203 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml
index 412e17f8c2..67dcdf12e8 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml
index 6f75e674c9..7bcbbaaebe 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml
index efd79f733f..5e47d43171 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml
index 76e937fab1..454afea709 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml
index e5dbc5a131..35d9c423a9 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml
index a5122df554..9332ab0d0c 100644
--- a/components/device-mgt-extensions/pom.xml
+++ b/components/device-mgt-extensions/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml
index c9b7c2e0bc..23dd513ac9 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml
@@ -22,7 +22,7 @@
device-mgt
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java
index 33614a7328..c447c48a5b 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java
@@ -533,7 +533,14 @@ public interface GroupManagementService {
defaultValue = "1")
@DefaultValue("1")
@QueryParam("depth")
- int depth);
+ int depth,
+ @ApiParam(
+ name = "allowed",
+ value = "Whether to return allowed group",
+ defaultValue = "false")
+ @QueryParam("allowed")
+ @DefaultValue("false")
+ boolean allowed);
@Path("/name/{groupName}")
@GET
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java
index de2991e7a7..4c43698395 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java
@@ -176,10 +176,11 @@ public class GroupManagementServiceImpl implements GroupManagementService {
}
@Override
- public Response getGroup(int groupId, boolean requireGroupProps, int depth) {
+ public Response getGroup(int groupId, boolean requireGroupProps, int depth, boolean allowed) {
try {
GroupManagementProviderService service = DeviceMgtAPIUtils.getGroupManagementProviderService();
- DeviceGroup deviceGroup = service.getGroup(groupId, requireGroupProps, depth);
+ DeviceGroup deviceGroup = allowed ? service.getUserOwnGroup(groupId, requireGroupProps, depth):
+ service.getGroup(groupId, requireGroupProps, depth);
if (deviceGroup != null) {
return Response.status(Response.Status.OK).entity(deviceGroup).build();
} else {
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java
index 077e814fe7..748bcc485c 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java
@@ -126,11 +126,14 @@ public class RoleManagementServiceImpl implements RoleManagementService {
List visibleRoles;
RoleList visibleRoleList = new RoleList();
try {
- metadata = DeviceMgtAPIUtils.getMetadataManagementService().retrieveMetadata(metaKey);
- String metaValue = metadata.getMetaValue();
- JSONParser parser = new JSONParser();
- JSONObject jsonObject = (JSONObject) parser.parse(metaValue);
- boolean decision = (boolean) jsonObject.get(Constants.IS_USER_ABLE_TO_VIEW_ALL_ROLES);
+ boolean decision = false;
+ if(DeviceMgtAPIUtils.getMetadataManagementService().retrieveMetadata(metaKey) != null){
+ metadata = DeviceMgtAPIUtils.getMetadataManagementService().retrieveMetadata(metaKey);
+ String metaValue = metadata.getMetaValue();
+ JSONParser parser = new JSONParser();
+ JSONObject jsonObject = (JSONObject) parser.parse(metaValue);
+ decision = (boolean) jsonObject.get(Constants.IS_USER_ABLE_TO_VIEW_ALL_ROLES);
+ }
if (decision) {
if (userStore == null || "".equals(userStore)){
userStore = PRIMARY_USER_STORE;
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImplTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImplTest.java
index d648120b0d..4c069623c7 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImplTest.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImplTest.java
@@ -176,13 +176,13 @@ public class GroupManagementServiceImplTest {
Mockito.doReturn(new DeviceGroup()).when(groupManagementProviderService).getGroup(1, false, 1);
Mockito.doReturn(null).when(groupManagementProviderService).getGroup(2, false, 1);
Mockito.doThrow(new GroupManagementException()).when(groupManagementProviderService).getGroup(3, false, 1);
- Response response = groupManagementService.getGroup(1, false, 1);
+ Response response = groupManagementService.getGroup(1, false, 1, false);
Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(),
"getGroup request failed for a request with valid parameters");
- response = groupManagementService.getGroup(2, false, 1);
+ response = groupManagementService.getGroup(2, false, 1, false);
Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode(),
"getGroup request returned a group for a non-existing group");
- response = groupManagementService.getGroup(3, false, 1);
+ response = groupManagementService.getGroup(3, false, 1, false);
Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),
"getGroup request returned a group for a in-valid request");
}
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml
index c177d7ee78..dd6b701335 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml
@@ -21,7 +21,7 @@
device-mgt
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml
index d9d82dbc63..0b1d2d2b25 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml
@@ -22,7 +22,7 @@
device-mgt
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml
index 9a2cfd1802..fe00cd6d35 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java
index f7d8e533ea..657924ca80 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java
@@ -1353,7 +1353,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
+ "FROM DM_DEVICE d, "
+ "(SELECT dgm.DEVICE_ID "
+ "FROM DM_DEVICE_GROUP_MAP dgm "
- + "WHERE dgm.GROUP_ID = (SELECT ID FROM DM_GROUP WHERE GROUP_NAME = ? )) dgm1 "
+ + "WHERE dgm.GROUP_ID = (SELECT ID FROM DM_GROUP WHERE GROUP_NAME = ? AND TENANT_ID = ?)) dgm1 "
+ "WHERE d.ID = dgm1.DEVICE_ID AND d.TENANT_ID = ?) gd, DM_DEVICE_TYPE t "
+ "WHERE gd.DEVICE_TYPE_ID = t.ID) d1 "
+ "WHERE d1.DEVICE_ID = e.DEVICE_ID AND TENANT_ID = ?";
@@ -1362,6 +1362,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
stmt.setString(1, groupName);
stmt.setInt(2, tenantId);
stmt.setInt(3, tenantId);
+ stmt.setInt(4, tenantId);
try (ResultSet rs = stmt.executeQuery()) {
devices = new ArrayList<>();
while (rs.next()) {
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java
index 20d9bbd386..9447f6a9ea 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java
@@ -351,4 +351,6 @@ public interface GroupManagementProviderService {
* @throws GroupManagementException
*/
DeviceTypesOfGroups getDeviceTypesOfGroups(List identifiers) throws GroupManagementException;
+
+ DeviceGroup getUserOwnGroup(int groupId, boolean requireGroupProps, int depth) throws GroupManagementException;
}
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
index d5ef09b14e..c63810fb1f 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
@@ -570,20 +570,28 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
String parentPath;
List childrenGroups;
if (StringUtils.isBlank(username)) {
- GroupManagementDAOFactory.openConnection();
- rootGroups = groupDAO.getGroups(request, tenantId);
- for (DeviceGroup rootGroup : rootGroups) {
- parentPath = DeviceManagerUtil.createParentPath(rootGroup);
- childrenGroups = groupDAO.getChildrenGroups(parentPath, tenantId);
- createGroupWithChildren(
- rootGroup, childrenGroups, requireGroupProps, tenantId, request.getDepth(), 0);
- if (requireGroupProps) {
- populateGroupProperties(rootGroup, tenantId);
+ try {
+ GroupManagementDAOFactory.openConnection();
+ rootGroups = groupDAO.getGroups(request, tenantId);
+ for (DeviceGroup rootGroup : rootGroups) {
+ parentPath = DeviceManagerUtil.createParentPath(rootGroup);
+ childrenGroups = groupDAO.getChildrenGroups(parentPath, tenantId);
+ createGroupWithChildren(
+ rootGroup, childrenGroups, requireGroupProps, tenantId, request.getDepth(), 0);
+ if (requireGroupProps) {
+ populateGroupProperties(rootGroup, tenantId);
+ }
}
+ } catch (SQLException e) {
+ String msg = "Error occurred while opening a connection to the data source to retrieve all groups "
+ + "with hierarchy";
+ log.error(msg, e);
+ throw new GroupManagementException(msg, e);
+ } finally {
+ GroupManagementDAOFactory.closeConnection();
}
} else {
List allDeviceGroupIdsOfUser = getGroupIds(username);
- GroupManagementDAOFactory.openConnection();
rootGroups = this.getGroups(allDeviceGroupIdsOfUser, tenantId);
if (requireGroupProps) {
for (DeviceGroup rootGroup : rootGroups) {
@@ -591,19 +599,12 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
}
}
}
-
} catch (GroupManagementDAOException e) {
String msg = "Error occurred while retrieving all groups with hierarchy";
log.error(msg, e);
throw new GroupManagementException(msg, e);
- } catch (SQLException e) {
- String msg = "Error occurred while opening a connection to the data source to retrieve all groups "
- + "with hierarchy";
- log.error(msg, e);
- throw new GroupManagementException(msg, e);
- } finally {
- GroupManagementDAOFactory.closeConnection();
}
+
PaginationResult groupResult = new PaginationResult();
groupResult.setData(rootGroups);
if (StringUtils.isBlank(username)) {
@@ -616,6 +617,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
private List getGroups(List groupIds, int tenantId) throws GroupManagementException {
try {
+ GroupManagementDAOFactory.openConnection();
Listgroups = groupDAO.getGroups(groupIds, tenantId);
if (groups == null) {
String msg = "Retrieved null when getting groups for group ids " + groupIds.toString();
@@ -625,10 +627,17 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
if (groups.isEmpty()) return groups;
groups.sort(Comparator.comparing(DeviceGroup::getGroupId));
return getTree(groups);
+ } catch (SQLException e) {
+ String msg = "Error occurred while opening a connection to the data source to retrieve all groups "
+ + "with hierarchy";
+ log.error(msg, e);
+ throw new GroupManagementException(msg, e);
} catch (GroupManagementDAOException ex) {
String msg = "Error occurred while getting groups for group ids " + groupIds.toString();
log.error(msg, ex);
throw new GroupManagementException(msg, ex);
+ } finally {
+ GroupManagementDAOFactory.closeConnection();
}
}
@@ -636,8 +645,8 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
List tree = new ArrayList<>();
for (DeviceGroup deviceGroup : groups) {
DeviceGroup treeNode = tree.stream().
- filter(node -> deviceGroup.getParentPath().
- contains(Integer.toString(node.getGroupId()))).
+ filter(node -> Arrays.stream(deviceGroup.getParentPath().split("/")).
+ collect(Collectors.toList()).contains(Integer.toString(node.getGroupId()))).
findFirst().orElse(null);
if (treeNode != null) {
if (Objects.equals(treeNode.getParentPath(), deviceGroup.getParentPath())) {
@@ -657,6 +666,76 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
return tree;
}
+ private DeviceGroup findGroupFromTree(List tree, int groupId) {
+ for (DeviceGroup node: tree) {
+ if (node.getGroupId() == groupId) return node;
+ if (node.getChildrenGroups() != null) {
+ DeviceGroup tempNode = findGroupFromTree(node.getChildrenGroups(), groupId);
+ if (tempNode != null) {
+ return tempNode;
+ }
+ }
+ }
+ return null;
+ }
+
+ private boolean isAdminUser(String username, UserStoreManager userStoreManager)
+ throws GroupManagementException {
+ try {
+ if (!userStoreManager.isExistingUser(username)) {
+ String msg = "User doesn't exists with given username " + username;
+ throw new GroupManagementException(msg);
+ }
+
+ String []currentRoles = userStoreManager.getRoleListOfUser(username);
+ for (String role : currentRoles) {
+ if (role.equals("admin")) return true;
+ }
+
+ return false;
+ } catch (UserStoreException e) {
+ String msg = "Error occurred while requesting user details";
+ log.error(msg, e);
+ throw new GroupManagementException(msg, e);
+ }
+ }
+
+ @Override
+ public DeviceGroup getUserOwnGroup(int groupId, boolean requireGroupProps, int depth) throws GroupManagementException {
+ PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
+ String username = ctx.getUsername();
+ int tenantId = ctx.getTenantId();
+ try {
+ UserStoreManager userStoreManager = DeviceManagementDataHolder.getInstance().
+ getRealmService().getTenantUserRealm(tenantId).getUserStoreManager();
+ if (isAdminUser(username, userStoreManager)) {
+ return getGroup(groupId, requireGroupProps);
+ }
+
+ List userOwnGroupIds = this.getGroupIds(username);
+ if (userOwnGroupIds == null) {
+ String msg = "Retrieved null when getting group ids for user " + username;
+ log.error(msg);
+ throw new GroupManagementException(msg);
+ }
+
+ DeviceGroup deviceGroup = findGroupFromTree(
+ getGroups(userOwnGroupIds, tenantId), groupId);
+ if (deviceGroup != null && requireGroupProps)
+ populateGroupProperties(deviceGroup, tenantId);
+
+ return deviceGroup;
+ } catch (UserStoreException e) {
+ String msg = "Error occurred while getting user store manager service";
+ log.error(msg, e);
+ throw new GroupManagementException(msg, e);
+ } catch (GroupManagementDAOException e) {
+ String msg = "Error occurred while obtaining group '" + groupId + "'";
+ log.error(msg, e);
+ throw new GroupManagementException(msg, e);
+ }
+ }
+
@Override
public List getGroups(String username, boolean requireGroupProps) throws GroupManagementException {
if (username == null || username.isEmpty()) {
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestHeartBeatManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestHeartBeatManagementService.java
index 0e5f71243c..8d5924709c 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestHeartBeatManagementService.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestHeartBeatManagementService.java
@@ -66,4 +66,9 @@ public class TestHeartBeatManagementService implements HeartBeatManagementServic
@Override public Map getActiveServers() throws HeartBeatManagementException {
return null;
}
+
+ @Override
+ public void notifyClusterFormationChanged(int elapsedTimeInSeconds) throws HeartBeatManagementException {
+
+ }
}
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml
index 9118e3842d..5bc3abbd03 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml
@@ -22,7 +22,7 @@
device-mgt
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml
index cbe6d7bcc2..1988b3acbd 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml
@@ -23,7 +23,7 @@
device-mgt
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml
index 921d771ec9..a004f7fdae 100644
--- a/components/device-mgt/pom.xml
+++ b/components/device-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml
index a8b011b968..83e9788b9d 100644
--- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml
+++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
heartbeat-management
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/config/HeartBeatBeaconConfig.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/config/HeartBeatBeaconConfig.java
index e7df3d8468..ca3cc09610 100644
--- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/config/HeartBeatBeaconConfig.java
+++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/config/HeartBeatBeaconConfig.java
@@ -22,6 +22,7 @@ import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.HeartBeatBeaconC
import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.HeartBeatBeaconUtils;
import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.config.datasource.DataSourceConfig;
import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception.InvalidConfigurationStateException;
+import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.ClusterFormationChangedNotifier;
import org.w3c.dom.Document;
import org.wso2.carbon.utils.CarbonUtils;
@@ -29,8 +30,10 @@ import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.File;
+import java.util.List;
@XmlRootElement(name = "HeartBeatBeaconConfig")
public class HeartBeatBeaconConfig {
@@ -50,6 +53,7 @@ public class HeartBeatBeaconConfig {
private static final String SERVER_UUID_FILE_LOCATION =
CarbonUtils.getCarbonConfigDirPath() + File.separator + "server-credentials.properties";
+ private List notifiers;
private HeartBeatBeaconConfig() {
}
@@ -135,4 +139,13 @@ public class HeartBeatBeaconConfig {
}
}
+ @XmlElementWrapper(name = "ClusterFormationChangedNotifiers", required = true)
+ @XmlElement(name = "Notifier", required = true)
+ public List getNotifiers() {
+ return notifiers;
+ }
+
+ public void setNotifiers(List notifiers) {
+ this.notifiers = notifiers;
+ }
}
diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java
index c7e874c3f5..a526e216fb 100644
--- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java
+++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java
@@ -22,6 +22,7 @@ import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.HeartBeatBeaconU
import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.config.HeartBeatBeaconConfig;
import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.config.datasource.DataSourceConfig;
import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dao.HeartBeatBeaconDAOFactory;
+import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.ClusterFormationChangedNotifierRepository;
import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService;
import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementServiceImpl;
import org.apache.commons.logging.Log;
@@ -29,6 +30,8 @@ import org.apache.commons.logging.LogFactory;
import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.ndatasource.core.DataSourceService;
+import java.util.List;
+
/**
* @scr.component name="io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.heartbeatBeaconComponent"
* immediate="true"
@@ -58,10 +61,23 @@ public class HeartBeatBeaconComponent {
DataSourceConfig dsConfig = HeartBeatBeaconConfig.getInstance().getDataSourceConfig();
HeartBeatBeaconDAOFactory.init(dsConfig);
+ ClusterFormationChangedNotifierRepository clusterFormationChangedNotifierRepository
+ = new ClusterFormationChangedNotifierRepository();
+ List notifiers = HeartBeatBeaconConfig.getInstance().getNotifiers();
+ if (notifiers != null && notifiers.size() > 0) {
+ for (String notifier : notifiers) {
+ clusterFormationChangedNotifierRepository.addNotifier(notifier);
+ }
+ }
+ HeartBeatBeaconDataHolder.getInstance().setClusterFormationChangedNotifierRepository(
+ clusterFormationChangedNotifierRepository);
+
//Setting up executors to notify heart beat status */
HeartBeatExecutor.setUpNotifiers(HeartBeatBeaconUtils.getServerDetails());
}
+
+
if (log.isDebugEnabled()) {
log.debug("Heart Beat Notifier bundle has been successfully initialized");
}
diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconDataHolder.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconDataHolder.java
index bde95e33c4..a3119d6064 100644
--- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconDataHolder.java
+++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconDataHolder.java
@@ -18,6 +18,7 @@
package io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.internal;
+import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.ClusterFormationChangedNotifierRepository;
import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService;
public class HeartBeatBeaconDataHolder {
@@ -27,6 +28,7 @@ public class HeartBeatBeaconDataHolder {
private static HeartBeatBeaconDataHolder thisInstance = new HeartBeatBeaconDataHolder();
+ private ClusterFormationChangedNotifierRepository clusterFormationChangedNotifierRepository;
private HeartBeatBeaconDataHolder() {}
public static HeartBeatBeaconDataHolder getInstance() {
@@ -48,4 +50,12 @@ public class HeartBeatBeaconDataHolder {
public void setLocalServerUUID(String localServerUUID) {
this.localServerUUID = localServerUUID;
}
+
+ public ClusterFormationChangedNotifierRepository getClusterFormationChangedNotifierRepository() {
+ return clusterFormationChangedNotifierRepository;
+ }
+
+ public void setClusterFormationChangedNotifierRepository(ClusterFormationChangedNotifierRepository clusterFormationChangedNotifierRepository) {
+ this.clusterFormationChangedNotifierRepository = clusterFormationChangedNotifierRepository;
+ }
}
diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatExecutor.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatExecutor.java
index 81be3a999f..bd19a185a8 100644
--- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatExecutor.java
+++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatExecutor.java
@@ -69,6 +69,7 @@ public class HeartBeatExecutor {
try {
recordHeartBeat(designatedUUID);
electDynamicTaskExecutionCandidate(cumilativeTimeOut);
+ notifyClusterFormationChanged(cumilativeTimeOut);
} catch (Exception e) {
log.error("Error while executing record heart beat task. This will result in schedule operation malfunction.", e);
}
@@ -98,5 +99,8 @@ public class HeartBeatExecutor {
HeartBeatBeaconDataHolder.getInstance().getHeartBeatManagementService().electCandidate(cumilativeTimeOut);
}
+ static void notifyClusterFormationChanged(int cumilativeTimeOut) throws HeartBeatManagementException {
+ HeartBeatBeaconDataHolder.getInstance().getHeartBeatManagementService().notifyClusterFormationChanged(cumilativeTimeOut);
+ }
}
diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifier.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifier.java
new file mode 100644
index 0000000000..ecd53d98ef
--- /dev/null
+++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifier.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
+ *
+ * Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service;
+
+public interface ClusterFormationChangedNotifier {
+
+ String getType();
+
+ void notifyClusterFormationChanged(int hashIndex, int activeServerCount);
+}
diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifierRepository.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifierRepository.java
new file mode 100644
index 0000000000..bb0c7726de
--- /dev/null
+++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/ClusterFormationChangedNotifierRepository.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
+ *
+ * Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class ClusterFormationChangedNotifierRepository {
+
+ private Map notifiers;
+ private static final Log log = LogFactory.getLog(ClusterFormationChangedNotifierRepository.class);
+
+ public ClusterFormationChangedNotifierRepository() {
+ this.notifiers = new ConcurrentHashMap<>();
+ }
+
+ public void addNotifier(ClusterFormationChangedNotifier notifier) {
+ notifiers.put(notifier.getType(), notifier);
+ }
+
+ public void addNotifier(String className) {
+ try {
+ if (!StringUtils.isEmpty(className)) {
+ Class> clz = Class.forName(className);
+ ClusterFormationChangedNotifier notifier = (ClusterFormationChangedNotifier) clz.newInstance();
+ notifiers.put(notifier.getType(), notifier);
+ }
+ } catch (ClassNotFoundException e) {
+ log.error("Provided ClusterFormationChangedNotifier implementation '" + className + "' cannot be found", e);
+ } catch (InstantiationException e) {
+ log.error("Error occurred while instantiating ClusterFormationChangedNotifier implementation '" +
+ className + "'", e);
+ } catch (IllegalAccessException e) {
+ log.error("Error occurred while adding ClusterFormationChangedNotifier implementation '" + className + "'", e);
+ }
+ }
+
+ public ClusterFormationChangedNotifier getNotifier(String type) {
+ return notifiers.get(type);
+ }
+
+ public Map getNotifiers() {
+ return notifiers;
+ }
+}
diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementService.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementService.java
index 50a42d5d59..f8c6afcc56 100644
--- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementService.java
+++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementService.java
@@ -36,6 +36,7 @@ public interface HeartBeatManagementService {
boolean recordHeartBeat(HeartBeatEvent event) throws HeartBeatManagementException;
void electCandidate(int elapsedTimeInSeconds) throws HeartBeatManagementException;
+ void notifyClusterFormationChanged(int elapsedTimeInSeconds) throws HeartBeatManagementException;
boolean updateTaskExecutionAcknowledgement(String newTask) throws HeartBeatManagementException;
diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java
index f39eda3c78..7a31a6ebcc 100644
--- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java
+++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java
@@ -48,6 +48,9 @@ public class HeartBeatManagementServiceImpl implements HeartBeatManagementServic
private final HeartBeatDAO heartBeatDAO;
+ private static int lastActiveCount = -1;
+ private static int lastHashIndex = -1;
+
public HeartBeatManagementServiceImpl() {
this.heartBeatDAO = HeartBeatBeaconDAOFactory.getHeartBeatDAO();
}
@@ -254,6 +257,55 @@ public class HeartBeatManagementServiceImpl implements HeartBeatManagementServic
throw new HeartBeatManagementException(msg);
}
}
+ @Override
+ public void notifyClusterFormationChanged(int elapsedTimeInSeconds) throws HeartBeatManagementException {
+ if (HeartBeatBeaconConfig.getInstance().isEnabled()) {
+ try {
+ HeartBeatBeaconDAOFactory.beginTransaction();
+ Map servers = heartBeatDAO.getActiveServerDetails(elapsedTimeInSeconds);
+ HeartBeatBeaconDAOFactory.commitTransaction();
+ if (servers != null && !servers.isEmpty()) {
+ String serverUUID = HeartBeatBeaconDataHolder.getInstance().getLocalServerUUID();
+ ServerContext serverContext = servers.get(serverUUID);
+
+ // cluster change can be identified, either by changing hash index or changing active server count
+ if ((lastHashIndex != serverContext.getIndex()) || (lastActiveCount != servers.size())) {
+ lastHashIndex = serverContext.getIndex();
+ lastActiveCount = servers.size();
+
+ ClusterFormationChangedNotifierRepository repository = HeartBeatBeaconDataHolder.getInstance().getClusterFormationChangedNotifierRepository();
+ Map notifiers = repository.getNotifiers();
+ for (String type : notifiers.keySet()) {
+ ClusterFormationChangedNotifier notifier = notifiers.get(type);
+ Runnable r = new Runnable() {
+ @Override
+ public void run() {
+ notifier.notifyClusterFormationChanged(lastHashIndex, lastActiveCount);
+ }
+ };
+ new Thread(r).start();
+ }
+ }
+ }
+ } catch (HeartBeatDAOException e) {
+ String msg = "Error occurred while notifyClusterFormationChanged.";
+ log.error(msg, e);
+ throw new HeartBeatManagementException(msg, e);
+ } catch (TransactionManagementException e) {
+ HeartBeatBeaconDAOFactory.rollbackTransaction();
+ String msg = "Error occurred while electing candidate for dynamic task execution. Issue in opening a connection to the underlying data source";
+ log.error(msg, e);
+ throw new HeartBeatManagementException(msg, e);
+ } finally {
+ HeartBeatBeaconDAOFactory.closeConnection();
+ }
+ } else {
+ String msg = "Heart Beat Configuration Disabled. Error while notifyClusterFormationChanged.";
+ log.error(msg);
+ throw new HeartBeatManagementException(msg);
+ }
+ }
+
private void electCandidate(Map servers) throws HeartBeatDAOException {
String electedCandidate = getRandomElement(servers.keySet());
diff --git a/components/heartbeat-management/pom.xml b/components/heartbeat-management/pom.xml
index 7bf1a8fbdb..bc020852a5 100644
--- a/components/heartbeat-management/pom.xml
+++ b/components/heartbeat-management/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml
index 42624a617f..1b9eeb5968 100644
--- a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml
+++ b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
identity-extensions
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml
index 7079c15045..e1fd294cc1 100644
--- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml
+++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
identity-extensions
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml
index 1dbcfad35a..31026334f9 100644
--- a/components/identity-extensions/pom.xml
+++ b/components/identity-extensions/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml
index bf5fbf176f..5579244e98 100644
--- a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml
+++ b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
logger
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
io.entgra.device.mgt.core.notification.logger
diff --git a/components/logger/pom.xml b/components/logger/pom.xml
index 23a989ebeb..2b81c9b1bc 100644
--- a/components/logger/pom.xml
+++ b/components/logger/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml
index 26624fa0d1..9edcd52f95 100644
--- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml
+++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
operation-template-mgt
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/operation-template-mgt/pom.xml b/components/operation-template-mgt/pom.xml
index 94c29533fe..be9af17775 100644
--- a/components/operation-template-mgt/pom.xml
+++ b/components/operation-template-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml
index e7471d5d85..5ae6c5318b 100644
--- a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml
+++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
policy-mgt
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml
index 311409587a..fae49b1eb5 100644
--- a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml
+++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
policy-mgt
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml
index 4407436f5a..55d8346817 100644
--- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml
+++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
policy-mgt
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml
index 4f6fca7f5c..fb7fee0d34 100644
--- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml
+++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
policy-mgt
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mock/TestHeartBeatManagementService.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mock/TestHeartBeatManagementService.java
index 3272091675..2254ea57ee 100644
--- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mock/TestHeartBeatManagementService.java
+++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mock/TestHeartBeatManagementService.java
@@ -66,4 +66,9 @@ public class TestHeartBeatManagementService implements HeartBeatManagementServic
@Override public Map getActiveServers() throws HeartBeatManagementException {
return null;
}
+
+ @Override
+ public void notifyClusterFormationChanged(int elapsedTimeInSeconds) throws HeartBeatManagementException {
+
+ }
}
diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml
index a4a9943df1..c40c2be2c6 100644
--- a/components/policy-mgt/pom.xml
+++ b/components/policy-mgt/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml
index 666ab61c33..5357522cc5 100644
--- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml
+++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml
@@ -20,7 +20,7 @@
io.entgra.device.mgt.core
subtype-mgt
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/subtype-mgt/pom.xml b/components/subtype-mgt/pom.xml
index 91d04c4c33..6aa8dde6c9 100644
--- a/components/subtype-mgt/pom.xml
+++ b/components/subtype-mgt/pom.xml
@@ -20,7 +20,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/components/task-mgt/pom.xml b/components/task-mgt/pom.xml
index 26e51edae7..f61896efe1 100755
--- a/components/task-mgt/pom.xml
+++ b/components/task-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml
index 15c0e8eea1..229d1b2649 100755
--- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml
+++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml
@@ -20,7 +20,7 @@
task-manager
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml
index b5d33d664c..dd2071131b 100755
--- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml
+++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
task-manager
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/task-mgt/task-manager/pom.xml b/components/task-mgt/task-manager/pom.xml
index f0eb908782..2c32e8fa3c 100755
--- a/components/task-mgt/task-manager/pom.xml
+++ b/components/task-mgt/task-manager/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
task-mgt
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml
index ab2eba0b18..b0756f6c22 100755
--- a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml
+++ b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
task-watcher
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/task-mgt/task-watcher/pom.xml b/components/task-mgt/task-watcher/pom.xml
index d14ddd7d18..74c6286d30 100755
--- a/components/task-mgt/task-watcher/pom.xml
+++ b/components/task-mgt/task-watcher/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
task-mgt
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml
index 28ecfe0b90..1ba672260f 100644
--- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml
+++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml
@@ -20,7 +20,7 @@
tenant-mgt
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml
index ba54eee2a8..5bd0f06bd0 100644
--- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml
+++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml
@@ -20,7 +20,7 @@
tenant-mgt
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/tenant-mgt/pom.xml b/components/tenant-mgt/pom.xml
index bdc00ce03d..48bcd27692 100644
--- a/components/tenant-mgt/pom.xml
+++ b/components/tenant-mgt/pom.xml
@@ -20,7 +20,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml
index 9c4e0f9679..5ef659f5d7 100644
--- a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml
+++ b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
email-sender
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/transport-mgt/email-sender/pom.xml b/components/transport-mgt/email-sender/pom.xml
index 8fe1aef399..1f5f3f2346 100644
--- a/components/transport-mgt/email-sender/pom.xml
+++ b/components/transport-mgt/email-sender/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
transport-mgt
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/transport-mgt/pom.xml b/components/transport-mgt/pom.xml
index 7c275e0a25..e5c2e9cfbf 100644
--- a/components/transport-mgt/pom.xml
+++ b/components/transport-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml
index 1b07612778..1e909a73fe 100644
--- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml
+++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
sms-handler
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml
index 9f0f053843..d7ed22ada0 100644
--- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml
+++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
sms-handler
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml
index 0056dec525..d3b162575b 100644
--- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml
+++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
sms-handler
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/transport-mgt/sms-handler/pom.xml b/components/transport-mgt/sms-handler/pom.xml
index 18baf3dd9d..adebcc43c4 100644
--- a/components/transport-mgt/sms-handler/pom.xml
+++ b/components/transport-mgt/sms-handler/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
transport-mgt
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml
index 14db803388..599283fd5e 100644
--- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml
+++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml
@@ -21,7 +21,7 @@
ui-request-interceptor
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
4.0.0
diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/DefaultOauth2TokenHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/DefaultOauth2TokenHandler.java
new file mode 100644
index 0000000000..343a9c620d
--- /dev/null
+++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/DefaultOauth2TokenHandler.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
+ *
+ * Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package io.entgra.device.mgt.core.ui.request.interceptor;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import io.entgra.device.mgt.core.ui.request.interceptor.beans.AuthData;
+import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerConstants;
+import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerUtil;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.HttpHeaders;
+import org.apache.http.HttpStatus;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.entity.ContentType;
+import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse;
+
+import javax.servlet.annotation.MultipartConfig;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+
+@MultipartConfig
+@WebServlet("/default-oauth2-credentials")
+public class DefaultOauth2TokenHandler extends HttpServlet {
+ private static final Log log = LogFactory.getLog(DefaultTokenHandler.class);
+
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
+ try {
+ HttpSession httpSession = req.getSession(false);
+
+ if (httpSession != null) {
+ AuthData authData = (AuthData) httpSession.getAttribute(HandlerConstants.SESSION_AUTH_DATA_KEY);
+ if (authData == null) {
+ HandlerUtil.sendUnAuthorizeResponse(resp);
+ return;
+ }
+
+ AuthData defaultAuthData = (AuthData) httpSession
+ .getAttribute(HandlerConstants.SESSION_DEFAULT_AUTH_DATA_KEY);
+ if (defaultAuthData != null) {
+ HandlerUtil.handleSuccess(resp, constructSuccessProxyResponse(defaultAuthData.getAccessToken()));
+ return;
+ }
+
+ String clientId = authData.getClientId();
+ String clientSecret = authData.getClientSecret();
+
+ String queryString = req.getQueryString();
+ String scopeString = "";
+ if (StringUtils.isNotEmpty(queryString)) {
+ scopeString = req.getParameter("scopes");
+ if (scopeString != null) {
+ scopeString = "?scopes=" + scopeString;
+ }
+ }
+
+ String iotsCoreUrl = req.getScheme() + HandlerConstants.SCHEME_SEPARATOR
+ + System.getProperty(HandlerConstants.IOT_GW_HOST_ENV_VAR)
+ + HandlerConstants.COLON + HandlerUtil.getGatewayPort(req.getScheme());
+ String tokenUrl = iotsCoreUrl + "/api/device-mgt/v1.0/devices/" + clientId
+ + "/" + clientSecret + "/default-token" + scopeString;
+
+ HttpGet defaultTokenRequest = new HttpGet(tokenUrl);
+ defaultTokenRequest
+ .setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BEARER + authData.getAccessToken());
+ defaultTokenRequest
+ .setHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_FORM_URLENCODED.toString());
+ ProxyResponse tokenResultResponse = HandlerUtil.execute(defaultTokenRequest);
+
+ if (tokenResultResponse.getExecutorResponse().contains(HandlerConstants.EXECUTOR_EXCEPTION_PREFIX)) {
+ log.error("Error occurred while invoking the API to get default token data.");
+ HandlerUtil.handleError(resp, tokenResultResponse);
+ return;
+ }
+ String tokenResult = tokenResultResponse.getData();
+ if (tokenResult == null) {
+ log.error("Invalid default token response is received.");
+ HandlerUtil.handleError(resp, tokenResultResponse);
+ return;
+ }
+
+ JsonParser jsonParser = new JsonParser();
+ JsonElement jTokenResult = jsonParser.parse(tokenResult);
+ if (jTokenResult.isJsonObject()) {
+ JsonObject jTokenResultAsJsonObject = jTokenResult.getAsJsonObject();
+ AuthData newDefaultAuthData = new AuthData();
+ newDefaultAuthData.setClientId(clientId);
+ newDefaultAuthData.setClientSecret(clientSecret);
+
+ String defaultToken = jTokenResultAsJsonObject.get("accessToken").getAsString();
+ newDefaultAuthData.setAccessToken(defaultToken);
+ newDefaultAuthData.setRefreshToken(jTokenResultAsJsonObject.get("refreshToken").getAsString());
+ newDefaultAuthData.setScope(jTokenResultAsJsonObject.get("scopes").getAsString());
+ httpSession.setAttribute(HandlerConstants.SESSION_DEFAULT_AUTH_DATA_KEY, newDefaultAuthData);
+
+ HandlerUtil.handleSuccess(resp, constructSuccessProxyResponse(defaultToken));
+ }
+ } else {
+ HandlerUtil.sendUnAuthorizeResponse(resp);
+ }
+ } catch (IOException e) {
+ log.error("Error occurred when processing GET request to get default token.", e);
+ }
+ }
+
+ /**
+ * Get Success Proxy Response
+ * @param defaultAccessToken Access token which has default scope
+ * @return {@link ProxyResponse}
+ */
+ private ProxyResponse constructSuccessProxyResponse (String defaultAccessToken) {
+
+ URIBuilder ub = new URIBuilder();
+ ub.setScheme(HandlerConstants.WSS_PROTOCOL);
+ ub.setHost(System.getProperty(HandlerConstants.IOT_REMOTE_SESSION_HOST_ENV_VAR));
+ ub.setPort(Integer.parseInt(System.getProperty(HandlerConstants.IOT_REMOTE_SESSION_HTTPS_PORT_ENV_VAR)));
+ ub.setPath(HandlerConstants.REMOTE_SESSION_CONTEXT);
+
+ URIBuilder ub2 = new URIBuilder();
+ ub2.setScheme(HandlerConstants.WSS_PROTOCOL);
+ ub2.setHost(System.getProperty(HandlerConstants.IOT_GW_HOST_ENV_VAR));
+ ub2.setPort(Integer.parseInt(System.getProperty(HandlerConstants.IOT_GATEWAY_WEBSOCKET_WSS_PORT_ENV_VAR)));
+
+ URIBuilder ub3 = new URIBuilder();
+ ub3.setScheme(HandlerConstants.WS_PROTOCOL);
+ ub3.setHost(System.getProperty(HandlerConstants.IOT_GW_HOST_ENV_VAR));
+ ub3.setPort(Integer.parseInt(System.getProperty(HandlerConstants.IOT_GATEWAY_WEBSOCKET_WS_PORT_ENV_VAR)));
+
+ JsonObject responseJsonObj = new JsonObject();
+ responseJsonObj.addProperty("default-access-token", defaultAccessToken);
+ responseJsonObj.addProperty("remote-session-base-url", ub.toString());
+ responseJsonObj.addProperty("secured-websocket-gateway-url", ub2.toString());
+ responseJsonObj.addProperty("unsecured-websocket-gateway-url", ub3.toString());
+
+ Gson gson = new Gson();
+ String payload = gson.toJson(responseJsonObj);
+
+ ProxyResponse proxyResponse = new ProxyResponse();
+ proxyResponse.setCode(HttpStatus.SC_OK);
+ proxyResponse.setStatus(ProxyResponse.Status.SUCCESS);
+ proxyResponse.setData(payload);
+ return proxyResponse;
+ }
+}
diff --git a/components/ui-request-interceptor/pom.xml b/components/ui-request-interceptor/pom.xml
index 0faab0c2fa..10874166b4 100644
--- a/components/ui-request-interceptor/pom.xml
+++ b/components/ui-request-interceptor/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml
index 7e3bd80758..3676d4ac34 100644
--- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml
+++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
webapp-authenticator-framework
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml
index f2b6a87bca..bd44c3c9df 100644
--- a/components/webapp-authenticator-framework/pom.xml
+++ b/components/webapp-authenticator-framework/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml
index c087fc0b4a..9a7dc8a557 100644
--- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml
+++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
grafana-mgt-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml
index 834a46bb70..29c45acc91 100644
--- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml
+++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
grafana-mgt-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/analytics-mgt/grafana-mgt/pom.xml b/features/analytics-mgt/grafana-mgt/pom.xml
index 7dd4d6fb94..79c9fb75f9 100644
--- a/features/analytics-mgt/grafana-mgt/pom.xml
+++ b/features/analytics-mgt/grafana-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
analytics-mgt-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/analytics-mgt/pom.xml b/features/analytics-mgt/pom.xml
index 2ebf097dd7..9f1b1ba316 100644
--- a/features/analytics-mgt/pom.xml
+++ b/features/analytics-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml
index 3d4c3038af..3af15a55a7 100644
--- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml
+++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml
@@ -20,7 +20,7 @@
io.entgra.device.mgt.core
apimgt-extensions-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml
index 3722df051a..598711cadb 100644
--- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml
+++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
apimgt-extensions-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml
index 98ac163d22..9e6d5d780b 100644
--- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml
+++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
apimgt-extensions-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml
index 6c0202db0e..27c7281b55 100644
--- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml
+++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
apimgt-extensions-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml
index c01f0bcc2f..5f79b7a979 100644
--- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml
+++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
apimgt-extensions-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml
index d95c81a79a..73a460e975 100644
--- a/features/apimgt-extensions/pom.xml
+++ b/features/apimgt-extensions/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml
index e80ecf4da3..2bc8bb9b47 100644
--- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml
+++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
application-mgt-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/application-mgt/pom.xml b/features/application-mgt/pom.xml
index 499e95ba46..21cfa686de 100644
--- a/features/application-mgt/pom.xml
+++ b/features/application-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml
index e8a4a4465c..8733172bf2 100644
--- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml
+++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
certificate-mgt-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml
index 05e61d8d73..fa77ee766a 100644
--- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml
+++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
certificate-mgt-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml
index 2a4facce46..f587885535 100644
--- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml
+++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
certificate-mgt-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml
index 5248d250ea..c64d6c9c9f 100644
--- a/features/certificate-mgt/pom.xml
+++ b/features/certificate-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml
index 05593dffd1..1e457a4f18 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml
index 687b2ab864..c52a430c3a 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml
index a9a90aa701..a4db3180ae 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml
index 2283248c6e..d8f3b9cbba 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml
index 549f1dfd55..bcb9252892 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml
index cd6b6d32b1..d03b8021cf 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml
index a5e62dc0fe..4218cbcc1e 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml
index 06cc986d05..f95a49f3c6 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml
index cdc79c6e84..2cc14fcb6e 100644
--- a/features/device-mgt-extensions/pom.xml
+++ b/features/device-mgt-extensions/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml
index 0d97b9c041..1b7eeed81d 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml
index 19c25b738d..6143f9028f 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql
index 20786cfe2d..b3bc1c36ea 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql
@@ -9,12 +9,13 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE (
);
CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE (
- ID INTEGER auto_increment NOT NULL,
- SERIAL_NUMBER VARCHAR(500) DEFAULT NULL,
- CERTIFICATE BLOB DEFAULT NULL,
- TENANT_ID INTEGER DEFAULT 0,
- USERNAME VARCHAR(500) DEFAULT NULL,
- PRIMARY KEY (ID)
+ ID INTEGER auto_increment NOT NULL,
+ SERIAL_NUMBER VARCHAR(500) DEFAULT NULL,
+ CERTIFICATE BLOB DEFAULT NULL,
+ TENANT_ID INTEGER DEFAULT 0,
+ DEVICE_IDENTIFIER VARCHAR(300),
+ USERNAME VARCHAR(500) DEFAULT NULL,
+ PRIMARY KEY (ID)
);
CREATE TABLE IF NOT EXISTS DM_GROUP (
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql
index 5b6b3b93f1..34ff7ef1a7 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql
@@ -21,9 +21,10 @@ IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[D
CREATE TABLE DM_DEVICE_CERTIFICATE (
ID INTEGER IDENTITY(1,1) NOT NULL,
SERIAL_NUMBER VARCHAR(500) DEFAULT NULL,
- CERTIFICATE VARBINARY(max) DEFAULT NULL,
- TENANT_ID INTEGER DEFAULT 0,
- USERNAME VARCHAR(500) DEFAULT NULL,
+ CERTIFICATE VARBINARY(max) DEFAULT NULL,
+ TENANT_ID INTEGER DEFAULT 0,
+ DEVICE_IDENTIFIER VARCHAR(300),
+ USERNAME VARCHAR(500) DEFAULT NULL,
PRIMARY KEY (ID)
);
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql
index 86da197b12..e55274e49f 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql
@@ -13,12 +13,13 @@ CREATE INDEX IDX_DEVICE_NAME ON DM_DEVICE_TYPE (NAME);
CREATE INDEX IDX_DEVICE_TYPE_DEVICE_NAME ON DM_DEVICE_TYPE(ID, NAME);
CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE (
- ID INTEGER auto_increment NOT NULL,
- SERIAL_NUMBER VARCHAR(500) DEFAULT NULL,
- CERTIFICATE BLOB DEFAULT NULL,
- TENANT_ID INTEGER DEFAULT 0,
- USERNAME VARCHAR(500) DEFAULT NULL,
- PRIMARY KEY (ID)
+ ID INTEGER auto_increment NOT NULL,
+ SERIAL_NUMBER VARCHAR(500) DEFAULT NULL,
+ CERTIFICATE BLOB DEFAULT NULL,
+ TENANT_ID INTEGER DEFAULT 0,
+ DEVICE_IDENTIFIER VARCHAR(300),
+ USERNAME VARCHAR(500) DEFAULT NULL,
+ PRIMARY KEY (ID)
)ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS DM_GROUP (
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql
index 6cc55f7e74..708f135b78 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql
@@ -24,10 +24,11 @@ WHEN (NEW.ID IS NULL)
/
CREATE TABLE DM_DEVICE_CERTIFICATE (
- ID NUMBER(10) NOT NULL,
- SERIAL_NUMBER VARCHAR2(500) DEFAULT NULL,
- CERTIFICATE BLOB DEFAULT NULL,
+ ID NUMBER(10) NOT NULL,
+ SERIAL_NUMBER VARCHAR2(500) DEFAULT NULL,
+ CERTIFICATE BLOB DEFAULT NULL,
TENANT_ID NUMBER(10) DEFAULT 0,
+ DEVICE_IDENTIFIER VARCHAR(300),
USERNAME VARCHAR2(500) DEFAULT NULL,
PRIMARY KEY (ID)
)
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql
index b1fc128cf9..3ff77c0242 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql
@@ -830,4 +830,15 @@ CREATE TABLE SUB_OPERATION_TEMPLATE (
-- END OF SUB_OPERATION_TEMPLATE TABLE--
+CREATE SEQUENCE DM_DEVICE_CERTIFICATE_seq;
+
+CREATE TABLE DM_DEVICE_CERTIFICATE (
+ ID NUMBER(10) NOT NULL,
+ SERIAL_NUMBER VARCHAR2(500) DEFAULT NULL,
+ CERTIFICATE BLOB DEFAULT NULL,
+ TENANT_ID NUMBER(10) DEFAULT 0,
+ DEVICE_IDENTIFIER VARCHAR(300),
+ USERNAME VARCHAR2(500) DEFAULT NULL,
+ PRIMARY KEY (ID)
+)
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml
index e2ea761dac..2720311c7a 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml
index 9ab721691f..3ab937f699 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml
index 1d1e233b3c..6871767234 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml
index 6570c46eb0..6cae36ae75 100644
--- a/features/device-mgt/pom.xml
+++ b/features/device-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml
index a528743788..8900cf19e6 100644
--- a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml
+++ b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
heart-beat-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/conf/heart-beat-config.xml b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/conf/heart-beat-config.xml
index a434001e72..afdc9b3971 100644
--- a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/conf/heart-beat-config.xml
+++ b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/conf/heart-beat-config.xml
@@ -49,4 +49,7 @@
300
5
600
+
+
+
diff --git a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/conf_templates/templates/repository/conf/heart-beat-config.xml.j2 b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/conf_templates/templates/repository/conf/heart-beat-config.xml.j2
index f128b56c19..a294c876e3 100644
--- a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/conf_templates/templates/repository/conf/heart-beat-config.xml.j2
+++ b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/conf_templates/templates/repository/conf/heart-beat-config.xml.j2
@@ -51,11 +51,21 @@
{{heart_beat_beacon_conf.notifier_frequency_in_seconds}}
{{heart_beat_beacon_conf.time_skew_in_seconds}}
{{heart_beat_beacon_conf.sever_timeout_interval_in_seconds}}
+ {% if heart_beat_beacon_conf.cluster_formation_changed_configs.cluster_formation_changed_notifiers is defined %}
+
+ {%- for cluster_formation_changed_notifier in heart_beat_beacon_conf.cluster_formation_changed_configs.cluster_formation_changed_notifiers -%}
+ {{cluster_formation_changed_notifier}}
+ {% endfor %}
+
+ {% endif %}
{% else %}
false
30
300
5
600
+
+
+
{% endif %}
diff --git a/features/heartbeat-management/pom.xml b/features/heartbeat-management/pom.xml
index a2d4bed8ba..8cbf3eeb8e 100644
--- a/features/heartbeat-management/pom.xml
+++ b/features/heartbeat-management/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml
index 511aee8ac8..6d1547b8db 100644
--- a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml
+++ b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
jwt-client-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml
index 827addde60..552307e550 100644
--- a/features/jwt-client/pom.xml
+++ b/features/jwt-client/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml
index 23a8a3bffd..46d82e6b3a 100644
--- a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml
+++ b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
logger-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/logger/pom.xml b/features/logger/pom.xml
index 34a5aa4ccf..726a7256f3 100644
--- a/features/logger/pom.xml
+++ b/features/logger/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml
index 5bcdf81f74..fd14d3ff3c 100644
--- a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml
+++ b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
operation-template-mgt-plugin-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/operation-template-mgt-plugin-feature/pom.xml b/features/operation-template-mgt-plugin-feature/pom.xml
index 8351d50946..8f6b7be783 100644
--- a/features/operation-template-mgt-plugin-feature/pom.xml
+++ b/features/operation-template-mgt-plugin-feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml
index 9ba47c2fe9..3e42c13a27 100644
--- a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml
+++ b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
policy-mgt-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml
index 760c777394..3c9108a566 100644
--- a/features/policy-mgt/pom.xml
+++ b/features/policy-mgt/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml
index 3383dd46b2..d5b803d410 100644
--- a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml
+++ b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../../pom.xml
diff --git a/features/subtype-mgt/pom.xml b/features/subtype-mgt/pom.xml
index 3cccf87ad1..f20e1e179e 100644
--- a/features/subtype-mgt/pom.xml
+++ b/features/subtype-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml
index 124da1ecd7..3164b15e1a 100755
--- a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml
+++ b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../../pom.xml
diff --git a/features/task-mgt/pom.xml b/features/task-mgt/pom.xml
index d7e84d2782..792a4c642b 100755
--- a/features/task-mgt/pom.xml
+++ b/features/task-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml
index 73ef7d79b3..6465284280 100644
--- a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml
+++ b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml
@@ -20,7 +20,7 @@
tenant-mgt-feature
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/tenant-mgt/pom.xml b/features/tenant-mgt/pom.xml
index 8f87de9b1f..bfb68a1d0f 100644
--- a/features/tenant-mgt/pom.xml
+++ b/features/tenant-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml
index 3bd5878e26..9287b02b5d 100644
--- a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml
+++ b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
email-sender-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/transport-mgt/email-sender/pom.xml b/features/transport-mgt/email-sender/pom.xml
index 49163d8857..ddd2061af3 100644
--- a/features/transport-mgt/email-sender/pom.xml
+++ b/features/transport-mgt/email-sender/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
transport-mgt-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/transport-mgt/pom.xml b/features/transport-mgt/pom.xml
index 23513d7ed8..64eaa579c1 100644
--- a/features/transport-mgt/pom.xml
+++ b/features/transport-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml
index b6dd0dcc5c..700f203300 100644
--- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml
+++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
sms-handler-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml
index 4092c4c553..da4c5ed136 100644
--- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml
+++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
sms-handler-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/transport-mgt/sms-handler/pom.xml b/features/transport-mgt/sms-handler/pom.xml
index 8350d1b2d2..736902011c 100644
--- a/features/transport-mgt/sms-handler/pom.xml
+++ b/features/transport-mgt/sms-handler/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
transport-mgt-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml
index 53903a27e5..24c673bfdb 100644
--- a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml
+++ b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml
@@ -21,7 +21,7 @@
ui-request-interceptor-feature
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
4.0.0
diff --git a/features/ui-request-interceptor/pom.xml b/features/ui-request-interceptor/pom.xml
index a3ead6185d..ec03b2a611 100644
--- a/features/ui-request-interceptor/pom.xml
+++ b/features/ui-request-interceptor/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml
index 52e1f1594d..2a7d61052b 100644
--- a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml
+++ b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
webapp-authenticator-framework-feature
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../pom.xml
diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml
index 7d035f3691..2c8f050498 100644
--- a/features/webapp-authenticator-framework/pom.xml
+++ b/features/webapp-authenticator-framework/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
../../pom.xml
diff --git a/pom.xml b/pom.xml
index ea80080466..0b1c8e1e54 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
pom
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
WSO2 Carbon - Device Management - Parent
http://wso2.org
WSO2 Connected Device Manager Components
@@ -2091,7 +2091,7 @@
1.2.11.wso2v10
- 5.0.27-SNAPSHOT
+ 5.0.29-SNAPSHOT
4.7.35