Add JIT base provision and enrollment handlers #230

Merged
pahansith merged 5 commits from rajitha/device-mgt-core:jit-feature into master 1 year ago
rajitha commented 1 year ago
Collaborator

Purpose

  • Add JIT provision and enrollment support handlers.

http://roadmap.entgra.net/issues/10270
http://roadmap.entgra.net/issues/10308

## Purpose * Add JIT provision and enrollment support handlers. http://roadmap.entgra.net/issues/10270 http://roadmap.entgra.net/issues/10308
rajitha force-pushed jit-feature from 93a3d511a4 to 5e65a74acd 1 year ago
rajitha force-pushed jit-feature from ca2a15374e to 87ea4e642d 1 year ago
pahansith requested changes 1 year ago
private String getTemplateName(String deviceType, String prefix, String separator) throws NoSuchFileException {
String templateName = deviceType + separator + prefix;
File template = new File(CarbonUtils.getCarbonHome() + File.separator + "repository" + File.separator
Owner

Better to use StringBuilder to concatenate these values, since this is running inside a loop

Better to use StringBuilder to concatenate these values, since this is running inside a loop
rajitha marked this conversation as resolved
return templateName;
}
String defaultTemplateName = "default" + separator + prefix;
File defaultTemplate = new File(CarbonUtils.getCarbonHome() + File.separator + "repository" + File.separator
Owner

Use StringBuilder

Use StringBuilder
rajitha marked this conversation as resolved
return defaultTemplateName;
}
String msg = "Didn't found template file for " + templateName;
Owner

Since msg variable is not using any other places, better to avoid using variable

Since msg variable is not using any other places, better to avoid using variable
rajitha marked this conversation as resolved
Document JITConfigurationDoc = documentBuilder.parse(JITConfigurationFile);
JITConfigurationDoc.getDocumentElement().normalize();
Element enrollmentScopes;
if (Objects.equals(JITEnrollmentInfo.getOs(), "android")) {
Owner

Move these device type names and tagnames to a constant file

Move these device type names and tagnames to a constant file
rajitha marked this conversation as resolved
* @return boolean true when successful initialization, otherwise false
* @throws JITProvisionException throws when error occurred
*/
private boolean initializeJITConfigurations() throws JITProvisionException {
Owner

Why do we initiate this configuration by reading the file for each request? Since reading file operations are costly, better to initiate once and keep it in a dataholder

Why do we initiate this configuration by reading the file for each request? Since reading file operations are costly, better to initiate once and keep it in a dataholder
rajitha marked this conversation as resolved
rajitha force-pushed jit-feature from 87ea4e642d to b144be0f97 1 year ago
pahansith merged commit 9ae64c718c into master 1 year ago

Reviewers

pahansith requested changes 1 year ago
The pull request has been merged as 9ae64c718c.
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: community/device-mgt-core#230
Loading…
There is no content yet.