Fixing the EMM-900, Ading the LB host name and port to the email url

4.x.x
geethkokila 9 years ago
parent b7edc80c0e
commit 30c53b7d14

@ -28,6 +28,8 @@ public class EmailConfigurations {
private int maxNumOfThread; private int maxNumOfThread;
private int keepAliveTime; private int keepAliveTime;
private int threadQueueCapacity; private int threadQueueCapacity;
private String lBHostPortPrefix;
private String enrollmentContextPath;
@XmlElement(name = "minimumThread", required = true) @XmlElement(name = "minimumThread", required = true)
public int getMinNumOfThread() { public int getMinNumOfThread() {
@ -62,4 +64,22 @@ public class EmailConfigurations {
public void setThreadQueueCapacity(int threadQueueCapacity) { public void setThreadQueueCapacity(int threadQueueCapacity) {
this.threadQueueCapacity = threadQueueCapacity; this.threadQueueCapacity = threadQueueCapacity;
} }
@XmlElement(name = "LBHostPortPrefix", required = true)
public String getlBHostPortPrefix() {
return lBHostPortPrefix;
}
public void setlBHostPortPrefix(String lBHostPortPrefix) {
this.lBHostPortPrefix = lBHostPortPrefix;
}
@XmlElement(name = "enrollmentContextPath", required = true)
public String getEnrollmentContextPath() {
return enrollmentContextPath;
}
public void setEnrollmentContextPath(String enrollmentContextPath) {
this.enrollmentContextPath = enrollmentContextPath;
}
} }

@ -29,6 +29,7 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementExcept
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
import org.wso2.carbon.device.mgt.core.DeviceManagementPluginRepository; import org.wso2.carbon.device.mgt.core.DeviceManagementPluginRepository;
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager;
import org.wso2.carbon.device.mgt.core.config.email.EmailConfigurations;
import org.wso2.carbon.device.mgt.core.config.email.NotificationMessages; import org.wso2.carbon.device.mgt.core.config.email.NotificationMessages;
import org.wso2.carbon.device.mgt.core.dao.*; import org.wso2.carbon.device.mgt.core.dao.*;
import org.wso2.carbon.device.mgt.core.dto.DeviceType; import org.wso2.carbon.device.mgt.core.dto.DeviceType;
@ -494,6 +495,13 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
StringBuilder messageBuilder = new StringBuilder(); StringBuilder messageBuilder = new StringBuilder();
try { try {
// Reading the download url from the cdm-config.xml file
EmailConfigurations emailConfig =
DeviceConfigurationManager.getInstance().getDeviceManagementConfig().
getDeviceManagementConfigRepository().getEmailConfigurations();
emailMessageProperties.setEnrolmentUrl(emailConfig.getlBHostPortPrefix()+ emailConfig.getEnrollmentContextPath());
messageHeader = messageHeader.replaceAll("\\{" + EmailConstants.EnrolmentEmailConstants.FIRST_NAME + "\\}", messageHeader = messageHeader.replaceAll("\\{" + EmailConstants.EnrolmentEmailConstants.FIRST_NAME + "\\}",
URLEncoder.encode(emailMessageProperties.getFirstName(), URLEncoder.encode(emailMessageProperties.getFirstName(),
EmailConstants.EnrolmentEmailConstants.ENCODED_SCHEME)); EmailConstants.EnrolmentEmailConstants.ENCODED_SCHEME));
@ -549,6 +557,14 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
StringBuilder messageBuilder = new StringBuilder(); StringBuilder messageBuilder = new StringBuilder();
try { try {
// Reading the download url from the cdm-config.xml file
EmailConfigurations emailConfig =
DeviceConfigurationManager.getInstance().getDeviceManagementConfig().
getDeviceManagementConfigRepository().getEmailConfigurations();
emailMessageProperties.setEnrolmentUrl(emailConfig.getlBHostPortPrefix()+ emailConfig.getEnrollmentContextPath());
messageHeader = messageHeader.replaceAll("\\{" + EmailConstants.EnrolmentEmailConstants.FIRST_NAME + "\\}", messageHeader = messageHeader.replaceAll("\\{" + EmailConstants.EnrolmentEmailConstants.FIRST_NAME + "\\}",
URLEncoder.encode(emailMessageProperties.getFirstName(), URLEncoder.encode(emailMessageProperties.getFirstName(),
EmailConstants.EnrolmentEmailConstants.ENCODED_SCHEME)); EmailConstants.EnrolmentEmailConstants.ENCODED_SCHEME));

@ -29,6 +29,8 @@
<maximumThread>100</maximumThread> <maximumThread>100</maximumThread>
<keepAliveTime>20</keepAliveTime> <keepAliveTime>20</keepAliveTime>
<ThreadQueueCapacity>1000</ThreadQueueCapacity> <ThreadQueueCapacity>1000</ThreadQueueCapacity>
<LBHostPortPrefix>https://localhost:9443</LBHostPortPrefix>
<enrollmentContextPath>/mdm/enrollment</enrollmentContextPath>
</EmailClientConfiguration> </EmailClientConfiguration>
<IdentityConfiguration> <IdentityConfiguration>
<ServerUrl>https://localhost:9443</ServerUrl> <ServerUrl>https://localhost:9443</ServerUrl>

Loading…
Cancel
Save