Skip to content

Commit

Permalink
KAA-876: Changed names of the API methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ashvayka committed Apr 21, 2016
1 parent 8a75a86 commit 533e363
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 43 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -25,6 +25,7 @@ server/common/server-shared/src/main/java/org/kaaproject/kaa/server/common/Versi
pom.xml.versionsBackup
server/common/dao/src/main/resources/dao.properties
server/common/dao/src/main/resources/sql-dao.properties
server/node/src/main/resources/admin-dao.properties
build/
DerivedData
Pods/
Expand Down
Expand Up @@ -1063,20 +1063,20 @@ public List<EndpointProfileDto> getEndpointProfilesByUserExternalId(String endpo
return response.getBody();
}

public CredentialsDto provideCredentials (String applicationId, byte[] credentialsBody) {
public CredentialsDto provisionCredentials (String applicationId, byte[] credentialsBody) {
MultiValueMap<String, Object> parameters = new LinkedMultiValueMap<>();
parameters.add("applicationId", applicationId);
parameters.add("credentialsBody", Base64Utils.encodeToString(credentialsBody));
return this.restTemplate.postForObject(restTemplate.getUrl() + "provideCredentials", parameters, CredentialsDto.class);
return this.restTemplate.postForObject(restTemplate.getUrl() + "provisionCredentials", parameters, CredentialsDto.class);
}

public void provideRegistration(String applicationId, String credentialsId, Integer serverProfileVersion, String serverProfileBody){
public void provisionRegistration(String applicationId, String credentialsId, Integer serverProfileVersion, String serverProfileBody){
MultiValueMap<String, Object> parameters = new LinkedMultiValueMap<>();
parameters.add("applicationId", applicationId);
parameters.add("credentialsId", credentialsId);
parameters.add("serverProfileVersion", serverProfileVersion);
parameters.add("serverProfileBody", serverProfileBody);
this.restTemplate.postForLocation(restTemplate.getUrl() + "provideRegistration", parameters);
this.restTemplate.postForLocation(restTemplate.getUrl() + "provisionRegistration", parameters);
}

public void revokeCredentials(String applicationId, String credentialsId){
Expand Down
Expand Up @@ -2116,13 +2116,13 @@ private byte[] getFileContent(MultipartFile file) throws KaaAdminServiceExceptio
*
* @throws KaaAdminServiceException - if an exception occures.
*/
@RequestMapping(value = "provideCredentials", params = { "applicationId", "credentialsBody" }, method = RequestMethod.POST)
@RequestMapping(value = "provisionCredentials", params = { "applicationId", "credentialsBody" }, method = RequestMethod.POST)
@ResponseBody
public CredentialsDto provideCredentials(
public CredentialsDto provisionCredentials(
@RequestParam String applicationId,
@RequestParam String credentialsBody)
throws KaaAdminServiceException {
return this.kaaAdminService.provideCredentials(applicationId, credentialsBody);
return this.kaaAdminService.provisionCredentials(applicationId, credentialsBody);
}

/**
Expand All @@ -2135,15 +2135,15 @@ public CredentialsDto provideCredentials(
*
* @throws KaaAdminServiceException - if an exception occures.
*/
@RequestMapping(value = "provideRegistration", params = { "applicationId", "credentialsId" }, method = RequestMethod.POST)
@RequestMapping(value = "provisionRegistration", params = { "applicationId", "credentialsId" }, method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)
public void provideRegistration(
public void provisionRegistration(
@RequestParam String applicationId,
@RequestParam String credentialsId,
@RequestParam Integer serverProfileVersion,
@RequestParam String serverProfileBody)
throws KaaAdminServiceException {
this.kaaAdminService.provideRegistration(applicationId, credentialsId, serverProfileVersion, serverProfileBody);
this.kaaAdminService.provisionRegistration(applicationId, credentialsId, serverProfileVersion, serverProfileBody);
}

/**
Expand Down
Expand Up @@ -3608,11 +3608,11 @@ private void validateServerProfile(ServerProfileSchemaDto serverProfileSchema, S
}

@Override
public CredentialsDto provideCredentials(String applicationId, String credentialsBody) throws KaaAdminServiceException {
public CredentialsDto provisionCredentials(String applicationId, String credentialsBody) throws KaaAdminServiceException {
this.checkAuthority(KaaAuthorityDto.TENANT_ADMIN);
try {
this.checkApplicationId(applicationId);
return this.controlService.provideCredentials(applicationId, credentialsBody);
return this.controlService.provisionCredentials(applicationId, credentialsBody);
} catch (Exception cause) {
throw Utils.handleException(cause);
}
Expand Down Expand Up @@ -3644,7 +3644,7 @@ public void onCredentialsRevoked(String applicationId, String credentialsId) thr
}

@Override
public void provideRegistration(
public void provisionRegistration(
String applicationId,
String credentialsId,
Integer serverProfileVersion,
Expand All @@ -3664,7 +3664,7 @@ public void provideRegistration(
String message = MessageFormat.format("The server-side endpoint profile {0} provided is empty!", missingParameter);
throw new IllegalArgumentException(message);
}
this.controlService.provideRegistration(applicationId, credentialsId, serverProfileVersion, serverProfileBody);
this.controlService.provisionRegistration(applicationId, credentialsId, serverProfileVersion, serverProfileBody);
} catch (Exception cause) {
throw Utils.handleException(cause);
}
Expand Down
Expand Up @@ -424,11 +424,11 @@ CtlSchemaFormDto createNewCTLSchemaFormInstance(String metaInfoId,

List<EndpointProfileDto> getEndpointProfilesByUserExternalId(String endpointUserExternalId) throws KaaAdminServiceException;

CredentialsDto provideCredentials(String applicationId, String credentialsBody) throws KaaAdminServiceException;
CredentialsDto provisionCredentials(String applicationId, String credentialsBody) throws KaaAdminServiceException;

void revokeCredentials(String applicationId, String credentialsId) throws KaaAdminServiceException;

void provideRegistration(String applicationId, String credentialsId, Integer serverProfileVersion, String serverProfileBody) throws KaaAdminServiceException;
void provisionRegistration(String applicationId, String credentialsId, Integer serverProfileVersion, String serverProfileBody) throws KaaAdminServiceException;

void onCredentialsRevoked(String applicationId, String credentialsId) throws KaaAdminServiceException;

Expand Down
Expand Up @@ -1703,7 +1703,7 @@ ApplicationEventFamilyMapDto editApplicationEventFamilyMap(ApplicationEventFamil
*
* @throws ControlServiceException - if an exception occures.
*/
CredentialsDto provideCredentials(String applicationId, String credentialsBody) throws ControlServiceException;
CredentialsDto provisionCredentials(String applicationId, String credentialsBody) throws ControlServiceException;

/**
* Returns credentials by application ID and credentials ID.
Expand Down Expand Up @@ -1752,7 +1752,7 @@ ApplicationEventFamilyMapDto editApplicationEventFamilyMap(ApplicationEventFamil
*
* @throws ControlServiceException - if an exception occures.
*/
void provideRegistration(String applicationId, String credentialsId, Integer serverProfileVersion, String serverProfileBody) throws ControlServiceException;
void provisionRegistration(String applicationId, String credentialsId, Integer serverProfileVersion, String serverProfileBody) throws ControlServiceException;

/**
* Returns the names of credentials services configured.
Expand Down
Expand Up @@ -2254,7 +2254,7 @@ public void removeEndpointProfile(EndpointProfileDto endpointProfile) throws Con
}

@Override
public CredentialsDto provideCredentials(String applicationId, String credentialsBody) throws ControlServiceException {
public CredentialsDto provisionCredentials(String applicationId, String credentialsBody) throws ControlServiceException {
CredentialsDto credentials = new CredentialsDto(Base64Utils.decodeFromString(credentialsBody), CredentialsStatus.AVAILABLE);
try {
return this.credentialsServiceLocator.getCredentialsService(applicationId).provideCredentials(credentials);
Expand Down Expand Up @@ -2320,7 +2320,7 @@ public void onCredentailsRevoked(String applicationId, String credentialsId) thr
}

@Override
public void provideRegistration(
public void provisionRegistration(
String applicationId,
String credentialsId,
Integer serverProfileVersion,
Expand Down
23 changes: 0 additions & 23 deletions server/node/src/main/resources/admin-dao.properties

This file was deleted.

0 comments on commit 533e363

Please sign in to comment.