Skip to content

Commit

Permalink
Fix code style and problem with renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill380 committed Oct 3, 2016
1 parent 2084a94 commit 8e42ce8
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 162 deletions.
Expand Up @@ -918,33 +918,35 @@ public void downloadSdk(SdkProfileDto key, String destination) throws Exception
LOG.info("Downloaded sdk to file '{}'", extractor.getDestFile());
}

public FileData downloadLogRecordLibrary(RecordKey key) throws Exception {

public FileData downloadSdk(SdkProfileDto key) throws Exception {
FileDataResponseExtractor extractor = new FileDataResponseExtractor();
RequestCallback request = new DataRequestCallback<>(key);
FileData data = restTemplate.execute(restTemplate.getUrl() + "logLibrary",
FileData data = restTemplate.execute(restTemplate.getUrl() + "sdk",
HttpMethod.POST, request, extractor);
return data;
}

public FileData downloadLogRecordSchema(RecordKey key) throws Exception {

public FileData downloadLogRecordLibrary(RecordKey key) throws Exception {
FileDataResponseExtractor extractor = new FileDataResponseExtractor();
RequestCallback request = new DataRequestCallback<>(key);
FileData data = restTemplate.execute(restTemplate.getUrl() + "logRecordSchema",
FileData data = restTemplate.execute(restTemplate.getUrl() + "logLibrary",
HttpMethod.POST, request, extractor);
return data;
}

public FileData downloadSdk(SdkProfileDto key) throws Exception {
public FileData downloadLogRecordSchema(RecordKey key) throws Exception {
FileDataResponseExtractor extractor = new FileDataResponseExtractor();
RequestCallback request = new DataRequestCallback<>(key);
FileData data = restTemplate.execute(restTemplate.getUrl() + "sdk",
FileData data = restTemplate.execute(restTemplate.getUrl() + "logRecordSchema",
HttpMethod.POST, request, extractor);
return data;
}

public FileData downloadCtlSchemaByAppToken(CTLSchemaDto ctlSchemaDto,
CTLSchemaExportMethod method, String appToken) {
FileDataResponseExtractor extractor = new FileDataResponseExtractor();
final FileDataResponseExtractor extractor = new FileDataResponseExtractor();
MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
parameters.add("fqn", ctlSchemaDto.getMetaInfo().getFqn());
parameters.add("version", Integer.toString(ctlSchemaDto.getVersion()));
Expand Down
Expand Up @@ -45,13 +45,14 @@
import org.kaaproject.kaa.server.common.core.configuration.RawData;
import org.kaaproject.kaa.server.common.core.configuration.RawDataFactory;
import org.kaaproject.kaa.server.common.core.schema.RawSchema;
import org.kaaproject.kaa.server.common.dao.CtlService;
import org.kaaproject.kaa.server.common.dao.exception.DatabaseProcessingException;
import org.kaaproject.kaa.server.common.dao.exception.IncorrectParameterException;
import org.kaaproject.kaa.server.common.dao.impl.CtlSchemaMetaInfoDao;
import org.kaaproject.kaa.server.common.dao.impl.CtlSchemaDao;
import org.kaaproject.kaa.server.common.dao.impl.CtlSchemaMetaInfoDao;
import org.kaaproject.kaa.server.common.dao.impl.DaoUtil;
import org.kaaproject.kaa.server.common.dao.model.sql.CtlSchema;
import org.kaaproject.kaa.server.common.dao.model.sql.CTLSchemaMetaInfo;
import org.kaaproject.kaa.server.common.dao.model.sql.CtlSchema;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -73,13 +74,13 @@

@Service
@Transactional
public class CtlService implements CtlService {
public class CtlServiceImpl implements CtlService {

private static final String JSON = "application/json";
private static final String ZIP = "application/zip";
private static final String VERSION = "version";
private static final String FQN = "fqn";
private static final Logger LOG = LoggerFactory.getLogger(CtlService.class);
private static final Logger LOG = LoggerFactory.getLogger(CtlServiceImpl.class);
private static final String DEPENDENCIES = "dependencies";
private static final String DEFAULT_SYSTEM_EMPTY_SCHEMA_FILE = "/default_system_empty_schema"
+ ".avsc";
Expand Down Expand Up @@ -118,7 +119,7 @@ public CTLSchemaDto getOrCreateEmptySystemSchema(String createdUsername) {
ctlSchema.setVersion(DEFAULT_SYSTEM_EMPTY_SCHEMA_VERSION);
ctlSchema.setCreatedUsername(createdUsername);
ctlSchema.setDependencySet(new HashSet<CTLSchemaDto>());
String body = getStringFromFile(DEFAULT_SYSTEM_EMPTY_SCHEMA_FILE, CtlService.class);
String body = getStringFromFile(DEFAULT_SYSTEM_EMPTY_SCHEMA_FILE, CtlServiceImpl.class);
if (!body.isEmpty()) {
ctlSchema.setBody(body);
} else {
Expand Down
Expand Up @@ -27,24 +27,15 @@
* @author ashvayka
*/
public class RegisterProfileRequest {
/**
* The application token.
*/

private final String appToken;

/**
* The endpoint key.
*/

private final byte[] endpointKey;

/**
* The profile.
*/

private final byte[] profile;

/**
* The sdk token.
*/
private final String sdkToken;

private final String accessToken;
Expand All @@ -57,7 +48,8 @@ public class RegisterProfileRequest {
* @param sdkToken the sdk token
* @param profile the profile body
*/
public RegisterProfileRequest(String appToken, byte[] endpointKey, String sdkToken, byte[] profile) {
public RegisterProfileRequest(String appToken, byte[] endpointKey, String sdkToken,
byte[] profile) {
this(appToken, endpointKey, sdkToken, profile, null);
}

Expand All @@ -70,7 +62,8 @@ public RegisterProfileRequest(String appToken, byte[] endpointKey, String sdkTok
* @param profile the profile body
* @param accessToken the access token
*/
public RegisterProfileRequest(String appToken, byte[] endpointKey, String sdkToken, byte[] profile, String accessToken) {
public RegisterProfileRequest(String appToken, byte[] endpointKey, String sdkToken,
byte[] profile, String accessToken) {
super();
this.appToken = appToken;
this.endpointKey = Arrays.copyOf(endpointKey, endpointKey.length);
Expand All @@ -79,47 +72,23 @@ public RegisterProfileRequest(String appToken, byte[] endpointKey, String sdkTok
this.accessToken = accessToken;
}

/**
* Gets the endpoint key.
*
* @return the endpoint key
*/

public byte[] getEndpointKey() {
return Arrays.copyOf(endpointKey, endpointKey.length);
}

/**
* Gets the profile.
*
* @return the profile
*/
public byte[] getProfile() {
return Arrays.copyOf(profile, profile.length);
}

/**
* Gets the application token.
*
* @return the application token
*/
public String getAppToken() {
return appToken;
}

/**
* Gets the sdk token.
*
* @return the sdk token
*/
public String getSdkToken() {
return sdkToken;
}

/**
* Gets the endpoint access token.
*
* @return the endpoint access token
*/
public String getAccessToken() {
return accessToken;
}
Expand Down
Expand Up @@ -26,14 +26,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* The Class ApplicationLogActor
*/

public class ApplicationLogActor extends UntypedActor {

/**
* The Constant LOG.
*/

private static final Logger LOG = LoggerFactory.getLogger(ApplicationLogActor.class);

private final String applicationToken;
Expand Down Expand Up @@ -89,19 +85,12 @@ public void postStop() {
LOG.info("[{}] Stoped ", applicationToken);
}

/**
* The Class ActorCreator.
*/

public static class ActorCreator implements Creator<ApplicationLogActor> {

/**
* The Constant serialVersionUID.
*/
private static final long serialVersionUID = 1L;

/**
* The Akka service context
*/

private final AkkaContext context;

private final String applicationToken;
Expand Down
Expand Up @@ -25,14 +25,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* The Class ApplicationLogActor
*/

public class ApplicationUserVerifierActor extends UntypedActor {

/**
* The Constant LOG.
*/
private static final Logger LOG = LoggerFactory.getLogger(ApplicationUserVerifierActor.class);

private final String applicationId;
Expand All @@ -46,8 +41,12 @@ public class ApplicationUserVerifierActor extends UntypedActor {
* @param applicationToken the application token
*/
private ApplicationUserVerifierActor(AkkaContext context, String applicationToken) {
this.applicationId = context.getApplicationService().findAppByApplicationToken(applicationToken).getId();
this.messageProcessor = new ApplicationUserVerifierActorMessageProcessor(context.getEndpointUserService(), applicationId);
this.applicationId = context.getApplicationService()
.findAppByApplicationToken(applicationToken)
.getId();
this.messageProcessor = new ApplicationUserVerifierActorMessageProcessor(
context.getEndpointUserService(), applicationId
);
}

/*
Expand Down Expand Up @@ -88,19 +87,11 @@ public void postStop() {
LOG.info("[{}] Stoped ", applicationId);
}

/**
* The Class ActorCreator.
*/
public static class ActorCreator implements Creator<ApplicationUserVerifierActor> {

/**
* The Constant serialVersionUID.
*/
private static final long serialVersionUID = 1L;

/**
* The Akka service context
*/

private final AkkaContext context;

private final String applicationToken;
Expand Down

0 comments on commit 8e42ce8

Please sign in to comment.