From c8cbd1af52379547d85aa70f0c931b63a5e56dbc Mon Sep 17 00:00:00 2001 From: "m.dalakov" Date: Tue, 17 Oct 2017 12:31:45 +0300 Subject: [PATCH] *update javaDoc --- .../java/com/samsung/commons/domain/Device.java | 9 +- .../com/samsung/commons/domain/ReportType.java | 4 +- .../main/java/com/samsung/commons/domain/Rule.java | 163 ++++++++++++++++++++- .../main/java/com/samsung/commons/domain/User.java | 15 +- .../samsung/commons/repository/RuleRepository.java | 24 ++- .../com/samsung/commons/service/DeviceService.java | 2 + .../com/samsung/commons/service/RuleService.java | 21 +++ .../commons/service/impl/RuleServiceImpl.java | 3 + .../java/com/samsung/commons/utils/TestUtils.java | 1 - .../com/samsung/commons/utils/sync/AsyncCode.java | 6 + .../samsung/commons/utils/sync/ResultCallback.java | 2 +- .../samsung/commons/utils/sync/Synchronous.java | 6 +- servers/dsm/pom.xml | 6 - .../java/com/samsung/dsm/model/view/BaseView.java | 4 +- .../com/samsung/dsm/model/view/ViewReport.java | 2 +- .../java/com/samsung/dsm/policy/PolicyConfig.java | 14 +- .../dsm/policy/parser/PolicyParserFactory.java | 16 +- .../dsm/report/analyzer/ReportAnalyzerKeys.java | 4 +- .../dsm/report/analyzer/impl/RuleAnalyzer.java | 33 +++++ .../dsm/rest/accesstoken/AccessTokenApi.java | 5 +- .../com/samsung/dsm/rest/alive/AliveApiSender.java | 10 ++ .../dsm/rest/alive/AliveApiSenderError.java | 3 + .../samsung/dsm/rest/alive/AliveApiSenderImpl.java | 9 ++ .../com/samsung/dsm/rest/report/ReportApi.java | 2 +- .../java/com/samsung/dsm/rest/rule/RuleApi.java | 20 +++ .../dsm/rule/parser/JSONRuleConfigParser.java | 3 + .../com/samsung/dsm/rule/parser/RuleConfig.java | 146 +++++++++++++++++- .../samsung/dsm/rule/parser/RuleConfigParser.java | 27 ++++ .../impl/OAuth2AuthorizationServiceImpl.java | 1 - .../main/java/com/samsung/servermq/ServerMQ.java | 3 + .../servermq/iotivity/KafkaConsumerWrapper.java | 17 +++ .../DeviceUnRegistrationPostDataExtractor.java | 5 + servers/pom.xml | 1 - 33 files changed, 537 insertions(+), 50 deletions(-) diff --git a/servers/commons/src/main/java/com/samsung/commons/domain/Device.java b/servers/commons/src/main/java/com/samsung/commons/domain/Device.java index 1e284da..bfd72d2 100644 --- a/servers/commons/src/main/java/com/samsung/commons/domain/Device.java +++ b/servers/commons/src/main/java/com/samsung/commons/domain/Device.java @@ -56,11 +56,11 @@ public class Device implements Serializable { /** * Disconnected status. */ - DISCONNECTED(0), + DISCONNECTED(0), /** * Connected status. */ - CONNECTED(1), + CONNECTED(1), /** * Issues status. */ @@ -348,7 +348,7 @@ public class Device implements Serializable { /** * Is removed boolean. * - * @return removed + * @return removed boolean */ public boolean isRemoved() { return removed; @@ -356,7 +356,8 @@ public class Device implements Serializable { /** * Isn't removed boolean - * @return removed + * + * @return removed boolean */ public boolean isNotRemoved() { return !removed; diff --git a/servers/commons/src/main/java/com/samsung/commons/domain/ReportType.java b/servers/commons/src/main/java/com/samsung/commons/domain/ReportType.java index fb60e25..5a3cfc4 100644 --- a/servers/commons/src/main/java/com/samsung/commons/domain/ReportType.java +++ b/servers/commons/src/main/java/com/samsung/commons/domain/ReportType.java @@ -33,11 +33,11 @@ public class ReportType { /** * Dac type. */ - DAC("dac"), + DAC("dac"), /** * Smack type. */ - SMACK("smack"), + SMACK("smack"), /** * Syscall type. */ diff --git a/servers/commons/src/main/java/com/samsung/commons/domain/Rule.java b/servers/commons/src/main/java/com/samsung/commons/domain/Rule.java index 9846f41..facfaec 100644 --- a/servers/commons/src/main/java/com/samsung/commons/domain/Rule.java +++ b/servers/commons/src/main/java/com/samsung/commons/domain/Rule.java @@ -14,14 +14,32 @@ import javax.validation.constraints.NotNull; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; +/** + * The type Rule. + */ @Entity @Table(name = "rule") public class Rule implements Serializable { private static final long serialVersionUID = 5203088734346852227L; + /** + * The enum Rule type. + */ public enum RuleType { - ALL("all"), GLOBAL("global"), CUSTOM("custom"), DEFAULT("default"); + /** + * All rule type. + */ + ALL("all"), /** + * Global rule type. + */ + GLOBAL("global"), /** + * Custom rule type. + */ + CUSTOM("custom"), /** + * Default rule type. + */ + DEFAULT("default"); private String name; @@ -29,6 +47,11 @@ public class Rule implements Serializable { this.name = name; } + /** + * Gets name. + * + * @return the name + */ public String getName() { return name; } @@ -82,9 +105,27 @@ public class Rule implements Serializable { @Column private String policy; + /** + * Instantiates a new Rule. + */ public Rule() { } + /** + * Instantiates a new Rule. + * + * @param message the message + * @param title the title + * @param code the code + * @param fields the fields + * @param find the find + * @param reportType the report type + * @param ruleType the rule type + * @param priority the priority + * @param look the look + * @param used the used + * @param policy the policy + */ public Rule(String message, String title, String code, String fields, String find, String reportType, String ruleType, int priority, String look, String used, String policy) { super(); @@ -101,98 +142,218 @@ public class Rule implements Serializable { this.policy = policy; } + /** + * Gets id. + * + * @return the id + */ public Long getId() { return id; } + /** + * Sets id. + * + * @param id the id + */ public void setId(Long id) { this.id = id; } + /** + * Gets message. + * + * @return the message + */ public String getMessage() { return message; } + /** + * Sets message. + * + * @param message the message + */ public void setMessage(String message) { this.message = message; } + /** + * Gets title. + * + * @return the title + */ public String getTitle() { return title; } + /** + * Sets title. + * + * @param title the title + */ public void setTitle(String title) { this.title = title; } + /** + * Gets code. + * + * @return the code + */ public String getCode() { return code; } + /** + * Sets code. + * + * @param code the code + */ public void setCode(String code) { this.code = code; } + /** + * Gets fields. + * + * @return the fields + */ public String getFields() { return fields; } + /** + * Sets fields. + * + * @param fields the fields + */ public void setFields(String fields) { this.fields = fields; } + /** + * Gets find. + * + * @return the find + */ public String getFind() { return find; } + /** + * Sets find. + * + * @param find the find + */ public void setFind(String find) { this.find = find; } + /** + * Gets report type. + * + * @return the report type + */ public String getReportType() { return reportType; } + /** + * Sets report type. + * + * @param reportType the report type + */ public void setReportType(String reportType) { this.reportType = reportType; } + /** + * Gets rule type. + * + * @return the rule type + */ public String getRuleType() { return ruleType; } + /** + * Sets rule type. + * + * @param ruleType the rule type + */ public void setRuleType(String ruleType) { this.ruleType = ruleType; } + /** + * Gets priority. + * + * @return the priority + */ public int getPriority() { return priority; } + /** + * Sets priority. + * + * @param priority the priority + */ public void setPriority(int priority) { this.priority = priority; } + /** + * Gets look. + * + * @return the look + */ public String getLook() { return look; } + /** + * Sets look. + * + * @param look the look + */ public void setLook(String look) { this.look = look; } + /** + * Gets used. + * + * @return the used + */ public String getUsed() { return used; } + /** + * Sets used. + * + * @param used the used + */ public void setUsed(String used) { this.used = used; } + /** + * Gets policy. + * + * @return the policy + */ public String getPolicy() { return policy; } + /** + * Sets policy. + * + * @param policy the policy + */ public void setPolicy(String policy) { this.policy = policy; } diff --git a/servers/commons/src/main/java/com/samsung/commons/domain/User.java b/servers/commons/src/main/java/com/samsung/commons/domain/User.java index 4ff89c1..8ce97ea 100644 --- a/servers/commons/src/main/java/com/samsung/commons/domain/User.java +++ b/servers/commons/src/main/java/com/samsung/commons/domain/User.java @@ -79,8 +79,8 @@ public class User implements Serializable { * and locked = false; * * @param username username of user. - * @param email e-mail of user. - * @param role {@link Role} of user. + * @param email e-mail of user. + * @param role {@link Role} of user. */ public User(String username, String email, Role role) { this.username = username; @@ -94,10 +94,10 @@ public class User implements Serializable { * Public constructor for class User with all fields for Tests. * * @param username the username - * @param email the email - * @param locked the locked - * @param date the date - * @param role the role + * @param email the email + * @param locked the locked + * @param date the date + * @param role the role */ public User(String username, String email, Boolean locked, Date date, Role role) { this.username = username; @@ -146,8 +146,7 @@ public class User implements Serializable { /** * Method provides setting information is user locked or not. * - * @param locked TRUE - setting user as locked; FALSE - setting user as - * isn't locked. + * @param locked TRUE - setting user as locked; FALSE - setting user as isn't locked. */ public void setLocked(Boolean locked) { this.locked = locked; diff --git a/servers/commons/src/main/java/com/samsung/commons/repository/RuleRepository.java b/servers/commons/src/main/java/com/samsung/commons/repository/RuleRepository.java index b5dbd67..56f2f90 100644 --- a/servers/commons/src/main/java/com/samsung/commons/repository/RuleRepository.java +++ b/servers/commons/src/main/java/com/samsung/commons/repository/RuleRepository.java @@ -7,13 +7,35 @@ import org.springframework.stereotype.Repository; import com.samsung.commons.domain.Rule; +/** + * The interface Rule repository. + */ @Repository public interface RuleRepository extends CrudRepository { - + + /** + * Find by report type order by priority desc list. + * + * @param reportType the report type + * @return the list + */ List findByReportTypeOrderByPriorityDesc(String reportType); + /** + * Find by rule type order by priority desc list. + * + * @param ruleType the rule type + * @return the list + */ List findByRuleTypeOrderByPriorityDesc(String ruleType); + /** + * Find by rule type and report type order by priority desc list. + * + * @param ruleType the rule type + * @param reportType the report type + * @return the list + */ List findByRuleTypeAndReportTypeOrderByPriorityDesc(String ruleType, String reportType); } diff --git a/servers/commons/src/main/java/com/samsung/commons/service/DeviceService.java b/servers/commons/src/main/java/com/samsung/commons/service/DeviceService.java index 84d5920..9878032 100644 --- a/servers/commons/src/main/java/com/samsung/commons/service/DeviceService.java +++ b/servers/commons/src/main/java/com/samsung/commons/service/DeviceService.java @@ -52,6 +52,8 @@ public interface DeviceService extends CommonService { * Devices by user id *

* Shows all devices (ignores "removed" field) + * + * @param userId the user id * @return list of devices */ List findByUserId(Long userId); diff --git a/servers/commons/src/main/java/com/samsung/commons/service/RuleService.java b/servers/commons/src/main/java/com/samsung/commons/service/RuleService.java index e014d7c..23f914d 100644 --- a/servers/commons/src/main/java/com/samsung/commons/service/RuleService.java +++ b/servers/commons/src/main/java/com/samsung/commons/service/RuleService.java @@ -4,12 +4,33 @@ import java.util.List; import com.samsung.commons.domain.Rule; +/** + * The interface Rule service. + */ public interface RuleService extends CommonService { + /** + * Find by report type order by priority desc list. + * + * @param reportType the report type + * @return the list + */ List findByReportTypeOrderByPriorityDesc(String reportType); + /** + * Find for all reports list. + * + * @return the list + */ List findForAllReports(); + /** + * Find by rule type by report type order by priority desc list. + * + * @param ruleType the rule type + * @param reportType the report type + * @return the list + */ List findByRuleTypeByReportTypeOrderByPriorityDesc(String ruleType, String reportType); } diff --git a/servers/commons/src/main/java/com/samsung/commons/service/impl/RuleServiceImpl.java b/servers/commons/src/main/java/com/samsung/commons/service/impl/RuleServiceImpl.java index 56ae0de..9593731 100644 --- a/servers/commons/src/main/java/com/samsung/commons/service/impl/RuleServiceImpl.java +++ b/servers/commons/src/main/java/com/samsung/commons/service/impl/RuleServiceImpl.java @@ -9,6 +9,9 @@ import com.samsung.commons.domain.Rule; import com.samsung.commons.repository.RuleRepository; import com.samsung.commons.service.RuleService; +/** + * The type Rule service. + */ @Service("ruleService") public class RuleServiceImpl implements RuleService { diff --git a/servers/commons/src/main/java/com/samsung/commons/utils/TestUtils.java b/servers/commons/src/main/java/com/samsung/commons/utils/TestUtils.java index 7acfd4b..0d90383 100644 --- a/servers/commons/src/main/java/com/samsung/commons/utils/TestUtils.java +++ b/servers/commons/src/main/java/com/samsung/commons/utils/TestUtils.java @@ -91,7 +91,6 @@ public class TestUtils { * Create and save devices. * * @param removed removed field - * * @return the devices */ public List createAndSaveDevices(boolean removed) { diff --git a/servers/commons/src/main/java/com/samsung/commons/utils/sync/AsyncCode.java b/servers/commons/src/main/java/com/samsung/commons/utils/sync/AsyncCode.java index dd3a331..a63b1ef 100644 --- a/servers/commons/src/main/java/com/samsung/commons/utils/sync/AsyncCode.java +++ b/servers/commons/src/main/java/com/samsung/commons/utils/sync/AsyncCode.java @@ -7,5 +7,11 @@ package com.samsung.commons.utils.sync; */ @FunctionalInterface public interface AsyncCode { + /** + * Async. + * + * @param resultCallback the result callback + * @throws Exception the exception + */ void async(ResultCallback resultCallback) throws Exception; } diff --git a/servers/commons/src/main/java/com/samsung/commons/utils/sync/ResultCallback.java b/servers/commons/src/main/java/com/samsung/commons/utils/sync/ResultCallback.java index 6ddba24..ddd3f6d 100644 --- a/servers/commons/src/main/java/com/samsung/commons/utils/sync/ResultCallback.java +++ b/servers/commons/src/main/java/com/samsung/commons/utils/sync/ResultCallback.java @@ -3,7 +3,7 @@ package com.samsung.commons.utils.sync; /** * Result callback * - * @param + * @param the type parameter */ public class ResultCallback { diff --git a/servers/commons/src/main/java/com/samsung/commons/utils/sync/Synchronous.java b/servers/commons/src/main/java/com/samsung/commons/utils/sync/Synchronous.java index 9341f58..eac252d 100644 --- a/servers/commons/src/main/java/com/samsung/commons/utils/sync/Synchronous.java +++ b/servers/commons/src/main/java/com/samsung/commons/utils/sync/Synchronous.java @@ -52,10 +52,10 @@ public class Synchronous { /** * Create with parameters * + * @param result * @param maxRounds max rounds * @param timeout timeout - * @param result - * @return this + * @return this synchronous */ public static Synchronous withParams(int maxRounds, int timeout) { return new Synchronous<>(maxRounds, timeout); @@ -86,7 +86,7 @@ public class Synchronous { * Execute async code * * @param asyncCode async code - * @return result + * @return result optional */ public Optional execute(AsyncCode asyncCode) { diff --git a/servers/dsm/pom.xml b/servers/dsm/pom.xml index fa658eb..7cc91a3 100644 --- a/servers/dsm/pom.xml +++ b/servers/dsm/pom.xml @@ -390,12 +390,6 @@ test - - org.iotivity.base - iotivity-linux - 1.0.0 - - diff --git a/servers/dsm/src/main/java/com/samsung/dsm/model/view/BaseView.java b/servers/dsm/src/main/java/com/samsung/dsm/model/view/BaseView.java index fe94fa8..27c36c3 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/model/view/BaseView.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/model/view/BaseView.java @@ -147,9 +147,9 @@ public class BaseView { /** * Instantiates a new Device status view. * - * @param status the status + * @param status the status * @param statusText the status text - * @param readonly the readonly flag + * @param readonly the readonly flag */ public DeviceStatusView(String status, String statusText, Boolean readonly) { this.status = status; diff --git a/servers/dsm/src/main/java/com/samsung/dsm/model/view/ViewReport.java b/servers/dsm/src/main/java/com/samsung/dsm/model/view/ViewReport.java index fc3d664..3042d79 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/model/view/ViewReport.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/model/view/ViewReport.java @@ -43,7 +43,7 @@ public class ViewReport extends BaseView { /** * Instantiates a new View report. * - * @param type the type + * @param type the type * @param reports the reports */ public ViewReport(ReportType.Type type, List reports) { diff --git a/servers/dsm/src/main/java/com/samsung/dsm/policy/PolicyConfig.java b/servers/dsm/src/main/java/com/samsung/dsm/policy/PolicyConfig.java index e73edb0..5a2aae9 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/policy/PolicyConfig.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/policy/PolicyConfig.java @@ -53,7 +53,7 @@ public class PolicyConfig { /** * Instantiates a new Policy group. * - * @param name the name + * @param name the name * @param policies the policies */ public PolicyGroup(String name, Policy[] policies) { @@ -91,7 +91,7 @@ public class PolicyConfig { /** * Instantiates a new Policy. * - * @param name the name + * @param name the name * @param state the state * @param items the items */ @@ -128,10 +128,20 @@ public class PolicyConfig { return items; } + /** + * Sets state. + * + * @param state the state + */ public void setState(int state) { this.state = state; } + /** + * Sets items. + * + * @param items the items + */ public void setItems(String[] items) { this.items = Arrays.copyOf(items, items.length); } diff --git a/servers/dsm/src/main/java/com/samsung/dsm/policy/parser/PolicyParserFactory.java b/servers/dsm/src/main/java/com/samsung/dsm/policy/parser/PolicyParserFactory.java index 03ed4de..68b5ea7 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/policy/parser/PolicyParserFactory.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/policy/parser/PolicyParserFactory.java @@ -18,14 +18,14 @@ public class PolicyParserFactory { * The enum Type. */ public enum Type { - /** - * Json type. - */ - JSON, - /** - * Xml type. Need for tests - */ - XML; + /** + * Json type. + */ + JSON, + /** + * Xml type. Need for tests + */ + XML; } /** diff --git a/servers/dsm/src/main/java/com/samsung/dsm/report/analyzer/ReportAnalyzerKeys.java b/servers/dsm/src/main/java/com/samsung/dsm/report/analyzer/ReportAnalyzerKeys.java index 1c37d29..7017ae7 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/report/analyzer/ReportAnalyzerKeys.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/report/analyzer/ReportAnalyzerKeys.java @@ -227,7 +227,7 @@ public final class ReportAnalyzerKeys { /** * operation=[read, write, execute] - type of operation of trap */ - public static final String PAD_OPERATION = "operation"; + public static final String PAD_OPERATION = "operation"; /** * gpa=[hexa string address] - physical address of trap */ @@ -254,7 +254,7 @@ public final class ReportAnalyzerKeys { */ public static final String DLP_TIME = "time"; /** - * Unique appid + * Unique appid */ public static final String DLP_APPID = "appid"; /** diff --git a/servers/dsm/src/main/java/com/samsung/dsm/report/analyzer/impl/RuleAnalyzer.java b/servers/dsm/src/main/java/com/samsung/dsm/report/analyzer/impl/RuleAnalyzer.java index 7b22b9b..35d2f7b 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/report/analyzer/impl/RuleAnalyzer.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/report/analyzer/impl/RuleAnalyzer.java @@ -21,8 +21,14 @@ import com.samsung.dsm.rule.parser.JSONRuleConfigParser; import com.samsung.dsm.rule.parser.RuleConfig; import com.samsung.dsm.rule.parser.RuleConfigParser; +/** + * The type Rule analyzer. + */ public class RuleAnalyzer { + /** + * The constant REPORT_APPNAME. + */ public static final String REPORT_APPNAME = "appname"; private static final Logger LOG = Logger.getLogger(RuleAnalyzer.class); private static final Map MAP_REPORTS; @@ -35,6 +41,13 @@ public class RuleAnalyzer { MAP_REPORTS.put(ReportType.Type.SYSCALL.toString(), "[syscall]"); } + /** + * Create message string. + * + * @param rule the rule + * @param map the map + * @return the string + */ public String createMessage(Rule rule, Map map) { String message = rule.getMessage(); String value = map.get(rule.getLook()); @@ -60,6 +73,13 @@ public class RuleAnalyzer { return message; } + /** + * Extract report data map. + * + * @param report the report + * @param reportType the report type + * @return the map + */ public Map extractReportData(String report, String reportType) { String logData = extractLog(report); String[] rows = logData.trim().split("\n"); @@ -120,6 +140,13 @@ public class RuleAnalyzer { } } + /** + * Analyze list. + * + * @param map the map + * @param rules the rules + * @return the list + */ public List analyze(Map map, List rules) { List list = new ArrayList<>(); for (Rule rule : rules) { @@ -180,6 +207,12 @@ public class RuleAnalyzer { return parser.toString(config); } + /** + * Update policy group. + * + * @param rulePolicies the rule policies + * @param group the group + */ public void updatePolicyGroup(RuleConfig.Rule.Policy[] rulePolicies, PolicyConfig.PolicyGroup group) { for (PolicyConfig.PolicyGroup.Policy policy : group.getPolicies()) { for (RuleConfig.Rule.Policy rulePolicy : rulePolicies) { diff --git a/servers/dsm/src/main/java/com/samsung/dsm/rest/accesstoken/AccessTokenApi.java b/servers/dsm/src/main/java/com/samsung/dsm/rest/accesstoken/AccessTokenApi.java index 12878d9..0264282 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/rest/accesstoken/AccessTokenApi.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/rest/accesstoken/AccessTokenApi.java @@ -54,10 +54,7 @@ public class AccessTokenApi { * @param login login * @param password password * @return (OK) auth code - * @throws LoginServiceGeneralException (UNAUTHORIZED) in case if - * credentials are wrong or auth code can't be generated for some - * other reason (database connection problems, database table - * was absent/corrupted etc.) + * @throws LoginServiceGeneralException (UNAUTHORIZED) in case if credentials are wrong or auth code can't be generated for some other reason (database connection problems, database table was absent/corrupted etc.) */ @RequestMapping(value = "/login") @ResponseBody diff --git a/servers/dsm/src/main/java/com/samsung/dsm/rest/alive/AliveApiSender.java b/servers/dsm/src/main/java/com/samsung/dsm/rest/alive/AliveApiSender.java index 6def716..e90846c 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/rest/alive/AliveApiSender.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/rest/alive/AliveApiSender.java @@ -1,6 +1,16 @@ package com.samsung.dsm.rest.alive; +/** + * The interface Alive api sender. + */ public interface AliveApiSender { + /** + * Alive boolean. + * + * @param username the username + * @return the boolean + * @throws AliveApiSenderError the alive api sender error + */ boolean alive(String username) throws AliveApiSenderError; } \ No newline at end of file diff --git a/servers/dsm/src/main/java/com/samsung/dsm/rest/alive/AliveApiSenderError.java b/servers/dsm/src/main/java/com/samsung/dsm/rest/alive/AliveApiSenderError.java index f46d00f..8037f31 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/rest/alive/AliveApiSenderError.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/rest/alive/AliveApiSenderError.java @@ -1,6 +1,9 @@ package com.samsung.dsm.rest.alive; +/** + * The type Alive api sender error. + */ public class AliveApiSenderError extends Exception { /** diff --git a/servers/dsm/src/main/java/com/samsung/dsm/rest/alive/AliveApiSenderImpl.java b/servers/dsm/src/main/java/com/samsung/dsm/rest/alive/AliveApiSenderImpl.java index 58ace66..6954e5e 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/rest/alive/AliveApiSenderImpl.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/rest/alive/AliveApiSenderImpl.java @@ -12,6 +12,9 @@ import java.net.URISyntaxException; import static java.lang.String.format; +/** + * The type Alive api sender. + */ public class AliveApiSenderImpl implements AliveApiSender { private static final Logger LOG = Logger.getLogger(AliveApiSenderImpl.class); @@ -23,6 +26,12 @@ public class AliveApiSenderImpl implements AliveApiSender { private String password; + /** + * Instantiates a new Alive api sender. + * + * @param host the host + * @param password the password + */ public AliveApiSenderImpl(String host, String password) { this.host = host; this.password = password; diff --git a/servers/dsm/src/main/java/com/samsung/dsm/rest/report/ReportApi.java b/servers/dsm/src/main/java/com/samsung/dsm/rest/report/ReportApi.java index 78bd363..78c8788 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/rest/report/ReportApi.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/rest/report/ReportApi.java @@ -209,7 +209,7 @@ public class ReportApi { * Find reports by date between response entity. * * @param dateFrom the date from - * @param dateTo the date to + * @param dateTo the date to * @return the response entity */ @RequestMapping(value = "/findReportsByDateBetween", method = RequestMethod.GET, produces = { diff --git a/servers/dsm/src/main/java/com/samsung/dsm/rest/rule/RuleApi.java b/servers/dsm/src/main/java/com/samsung/dsm/rest/rule/RuleApi.java index 21c7440..9bac641 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/rest/rule/RuleApi.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/rest/rule/RuleApi.java @@ -21,6 +21,9 @@ import com.samsung.dsm.rule.parser.JSONRuleConfigParser; import com.samsung.dsm.rule.parser.RuleConfig; import com.samsung.dsm.rule.parser.RuleConfigParser; +/** + * The type Rule api. + */ @RestController @RequestMapping(value = "/restapi/rule") public class RuleApi { @@ -30,6 +33,12 @@ public class RuleApi { @Autowired private RuleService ruleService; + /** + * Sets rule. + * + * @param request the request + * @return the rule + */ @RequestMapping(value = "/set", method = RequestMethod.POST) @ResponseBody public ResponseEntity setRule(HttpServletRequest request) { @@ -51,6 +60,12 @@ public class RuleApi { return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } + /** + * Remove rule response entity. + * + * @param request the request + * @return the response entity + */ @RequestMapping(value = "/remove", method = RequestMethod.POST) @ResponseBody public ResponseEntity removeRule(HttpServletRequest request) { @@ -73,6 +88,11 @@ public class RuleApi { return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } + /** + * Remove rule. + * + * @param rule the rule + */ public void removeRule(Rule rule) { String ruleType = rule.getRuleType(); String reportType = rule.getReportType(); diff --git a/servers/dsm/src/main/java/com/samsung/dsm/rule/parser/JSONRuleConfigParser.java b/servers/dsm/src/main/java/com/samsung/dsm/rule/parser/JSONRuleConfigParser.java index 4a1e6e5..f510309 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/rule/parser/JSONRuleConfigParser.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/rule/parser/JSONRuleConfigParser.java @@ -3,6 +3,9 @@ package com.samsung.dsm.rule.parser; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +/** + * The type Json rule config parser. + */ public class JSONRuleConfigParser implements RuleConfigParser { @Override diff --git a/servers/dsm/src/main/java/com/samsung/dsm/rule/parser/RuleConfig.java b/servers/dsm/src/main/java/com/samsung/dsm/rule/parser/RuleConfig.java index e77e101..d4a9afa 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/rule/parser/RuleConfig.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/rule/parser/RuleConfig.java @@ -7,18 +7,34 @@ import org.apache.commons.lang3.builder.HashCodeBuilder; import com.google.common.base.Objects; +/** + * The type Rule config. + */ public class RuleConfig { private Rule[] rules; + /** + * Instantiates a new Rule config. + * + * @param rules the rules + */ public RuleConfig(Rule[] rules) { this.rules = Arrays.copyOf(rules, rules.length); } + /** + * Get rules rule [ ]. + * + * @return the rule [ ] + */ public Rule[] getRules() { return rules; } + /** + * The type Rule. + */ public static class Rule { private String message; @@ -33,90 +49,200 @@ public class RuleConfig { private String used; private Policy[] policies; + /** + * Gets message. + * + * @return the message + */ public String getMessage() { return message; } + /** + * Sets message. + * + * @param message the message + */ public void setMessage(String message) { this.message = message; } + /** + * Gets title. + * + * @return the title + */ public String getTitle() { return title; } + /** + * Sets title. + * + * @param title the title + */ public void setTitle(String title) { this.title = title; } + /** + * Gets code. + * + * @return the code + */ public String getCode() { return code; } + /** + * Sets code. + * + * @param code the code + */ public void setCode(String code) { this.code = code; } + /** + * Gets fields. + * + * @return the fields + */ public String getFields() { return fields; } + /** + * Sets fields. + * + * @param fields the fields + */ public void setFields(String fields) { this.fields = fields; } + /** + * Gets find. + * + * @return the find + */ public String getFind() { return find; } + /** + * Sets find. + * + * @param find the find + */ public void setFind(String find) { this.find = find; } + /** + * Gets report type. + * + * @return the report type + */ public String getReportType() { return reportType; } + /** + * Sets report type. + * + * @param reportType the report type + */ public void setReportType(String reportType) { this.reportType = reportType; } + /** + * Gets rule type. + * + * @return the rule type + */ public String getRuleType() { return ruleType; } + /** + * Sets rule type. + * + * @param ruleType the rule type + */ public void setRuleType(String ruleType) { this.ruleType = ruleType; } + /** + * Gets priority. + * + * @return the priority + */ public String getPriority() { return priority; } + /** + * Sets priority. + * + * @param priority the priority + */ public void setPriority(String priority) { this.priority = priority; } + /** + * Gets look. + * + * @return the look + */ public String getLook() { return look; } + /** + * Sets look. + * + * @param look the look + */ public void setLook(String look) { this.look = look; } + /** + * Gets used. + * + * @return the used + */ public String getUsed() { return used; } + /** + * Sets used. + * + * @param used the used + */ public void setUsed(String used) { this.used = used; } + /** + * Get policies policy [ ]. + * + * @return the policy [ ] + */ public Policy[] getPolicies() { return policies; } + /** + * Sets policies. + * + * @param policies the policies + */ public void setPolicies(Policy[] policies) { this.policies = Arrays.copyOf(policies, policies.length); } @@ -157,6 +283,9 @@ public class RuleConfig { + look + ", used=" + used + "]"; } + /** + * The type Policy. + */ public static class Policy { private String name; @@ -166,7 +295,7 @@ public class RuleConfig { /** * Instantiates a new Policy. * - * @param name the name + * @param name the name * @param state the state * @param items the items */ @@ -203,14 +332,29 @@ public class RuleConfig { return items; } + /** + * Sets name. + * + * @param name the name + */ public void setName(String name) { this.name = name; } + /** + * Sets state. + * + * @param state the state + */ public void setState(int state) { this.state = state; } + /** + * Sets items. + * + * @param items the items + */ public void setItems(String[] items) { this.items = Arrays.copyOf(items, items.length); } diff --git a/servers/dsm/src/main/java/com/samsung/dsm/rule/parser/RuleConfigParser.java b/servers/dsm/src/main/java/com/samsung/dsm/rule/parser/RuleConfigParser.java index 7e5bb14..af09aa6 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/rule/parser/RuleConfigParser.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/rule/parser/RuleConfigParser.java @@ -1,13 +1,40 @@ package com.samsung.dsm.rule.parser; +/** + * The interface Rule config parser. + */ public interface RuleConfigParser { + /** + * To rule object rule config. + * + * @param ruleConfig the rule config + * @return the rule config + */ RuleConfig toRuleObject(String ruleConfig); + /** + * To rule string string. + * + * @param config the config + * @return the string + */ String toRuleString(RuleConfig config); + /** + * To policies string string. + * + * @param policy the policy + * @return the string + */ String toPoliciesString(RuleConfig.Rule.Policy[] policy); + /** + * To policies array rule config . rule . policy [ ]. + * + * @param policies the policies + * @return the rule config . rule . policy [ ] + */ RuleConfig.Rule.Policy[] toPoliciesArray(String policies); } diff --git a/servers/dsm/src/main/java/com/samsung/dsm/service/impl/OAuth2AuthorizationServiceImpl.java b/servers/dsm/src/main/java/com/samsung/dsm/service/impl/OAuth2AuthorizationServiceImpl.java index d2a4403..66e1b88 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/service/impl/OAuth2AuthorizationServiceImpl.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/service/impl/OAuth2AuthorizationServiceImpl.java @@ -28,7 +28,6 @@ import com.samsung.dsm.service.OAuth2AuthorizationService; /** * Simple implementation of OAuth2AuthorizationService * - * @see OAuth2AuthorizationService Created by o.abakumov on 7/7/2017. */ @Service public class OAuth2AuthorizationServiceImpl implements OAuth2AuthorizationService { diff --git a/servers/mq/src/main/java/com/samsung/servermq/ServerMQ.java b/servers/mq/src/main/java/com/samsung/servermq/ServerMQ.java index 1fa209f..4bcb764 100644 --- a/servers/mq/src/main/java/com/samsung/servermq/ServerMQ.java +++ b/servers/mq/src/main/java/com/samsung/servermq/ServerMQ.java @@ -36,6 +36,9 @@ public class ServerMQ { return context; } + /** + * Instantiates a new Server mq. + */ protected ServerMQ(){ } } diff --git a/servers/mq/src/main/java/com/samsung/servermq/iotivity/KafkaConsumerWrapper.java b/servers/mq/src/main/java/com/samsung/servermq/iotivity/KafkaConsumerWrapper.java index 12d593e..5997f73 100644 --- a/servers/mq/src/main/java/com/samsung/servermq/iotivity/KafkaConsumerWrapper.java +++ b/servers/mq/src/main/java/com/samsung/servermq/iotivity/KafkaConsumerWrapper.java @@ -44,7 +44,13 @@ public class KafkaConsumerWrapper { private static final Logger LOG = Logger.getLogger(KafkaConsumerWrapper.class); private static final int FETCH_SIZE = 100000; + /** + * The Time out. + */ static final int TIME_OUT = 100000; + /** + * The Buffer size. + */ static final int BUFFER_SIZE = 64 * 1024; private long lastOffset = -1; @@ -154,6 +160,12 @@ public class KafkaConsumerWrapper { mConsumerConnector = getJavaConsumerConnector(consumerConfig); } + /** + * Gets java consumer connector. + * + * @param consumerConfig the consumer config + * @return the java consumer connector + */ ConsumerConnector getJavaConsumerConnector(ConsumerConfig consumerConfig) { return Consumer.createJavaConsumerConnector(consumerConfig); } @@ -294,6 +306,11 @@ public class KafkaConsumerWrapper { } } + /** + * Build properties for subscribe properties. + * + * @return the properties + */ Properties buildPropertiesForSubscribe() { // TODO check property settings Properties props = new Properties(); diff --git a/servers/mq/src/main/java/com/samsung/servermq/iotivity/extractor/impl/DeviceUnRegistrationPostDataExtractor.java b/servers/mq/src/main/java/com/samsung/servermq/iotivity/extractor/impl/DeviceUnRegistrationPostDataExtractor.java index 1596be9..4454c2b 100644 --- a/servers/mq/src/main/java/com/samsung/servermq/iotivity/extractor/impl/DeviceUnRegistrationPostDataExtractor.java +++ b/servers/mq/src/main/java/com/samsung/servermq/iotivity/extractor/impl/DeviceUnRegistrationPostDataExtractor.java @@ -51,6 +51,11 @@ public class DeviceUnRegistrationPostDataExtractor implements PostDataExtractor } } + /** + * Sets device service. + * + * @param deviceService the device service + */ public void setDeviceService(DeviceService deviceService) { this.deviceService = deviceService; } diff --git a/servers/pom.xml b/servers/pom.xml index 2c82f15..51020cb 100644 --- a/servers/pom.xml +++ b/servers/pom.xml @@ -16,7 +16,6 @@ commons dsm mq - alive -- 2.7.4