http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/controller/ProjectController.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/controller/ProjectController.java b/server/src/main/java/org/apache/kylin/rest/controller/ProjectController.java index 980ec8c..f829fff 100644 --- a/server/src/main/java/org/apache/kylin/rest/controller/ProjectController.java +++ b/server/src/main/java/org/apache/kylin/rest/controller/ProjectController.java @@ -73,13 +73,13 @@ public class ProjectController extends BasicController { * @return Table metadata array * @throws IOException */ - @RequestMapping(value = "", method = {RequestMethod.GET}) + @RequestMapping(value = "", method = { RequestMethod.GET }) @ResponseBody public List<ProjectInstance> getProjects(@RequestParam(value = "limit", required = false) Integer limit, @RequestParam(value = "offset", required = false) Integer offset) { return projectService.listAllProjects(limit, offset); } - @RequestMapping(value = "/readable", method = {RequestMethod.GET}) + @RequestMapping(value = "/readable", method = { RequestMethod.GET }) @ResponseBody public List<ProjectInstance> getReadableProjects(@RequestParam(value = "limit", required = false) Integer limit, @RequestParam(value = "offset", required = false) Integer offset) { List<ProjectInstance> readableProjects = new ArrayList<ProjectInstance>(); @@ -189,12 +189,11 @@ public class ProjectController extends BasicController { } } - } return readableProjects; } - @RequestMapping(value = "", method = {RequestMethod.POST}) + @RequestMapping(value = "", method = { RequestMethod.POST }) @ResponseBody public ProjectInstance saveProject(@RequestBody CreateProjectRequest projectRequest) { if (StringUtils.isEmpty(projectRequest.getName())) { @@ -212,7 +211,7 @@ public class ProjectController extends BasicController { return createdProj; } - @RequestMapping(value = "", method = {RequestMethod.PUT}) + @RequestMapping(value = "", method = { RequestMethod.PUT }) @ResponseBody public ProjectInstance updateProject(@RequestBody UpdateProjectRequest projectRequest) { if (StringUtils.isEmpty(projectRequest.getFormerProjectName())) { @@ -231,7 +230,7 @@ public class ProjectController extends BasicController { return updatedProj; } - @RequestMapping(value = "/{projectName}", method = {RequestMethod.DELETE}) + @RequestMapping(value = "/{projectName}", method = { RequestMethod.DELETE }) @ResponseBody public void deleteProject(@PathVariable String projectName) { try {
http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/controller/QueryController.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/controller/QueryController.java b/server/src/main/java/org/apache/kylin/rest/controller/QueryController.java index 88cf912..93b71ad 100644 --- a/server/src/main/java/org/apache/kylin/rest/controller/QueryController.java +++ b/server/src/main/java/org/apache/kylin/rest/controller/QueryController.java @@ -26,10 +26,6 @@ import java.util.List; import javax.annotation.PostConstruct; import javax.servlet.http.HttpServletResponse; -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; - import org.apache.commons.io.IOUtils; import org.apache.kylin.common.KylinConfig; import org.apache.kylin.common.debug.BackdoorToggles; @@ -64,6 +60,10 @@ import org.supercsv.prefs.CsvPreference; import com.google.common.base.Preconditions; +import net.sf.ehcache.Cache; +import net.sf.ehcache.CacheManager; +import net.sf.ehcache.Element; + /** * Handle query requests. * http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/controller/StreamingController.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/controller/StreamingController.java b/server/src/main/java/org/apache/kylin/rest/controller/StreamingController.java index e305f2c..f3374c3 100644 --- a/server/src/main/java/org/apache/kylin/rest/controller/StreamingController.java +++ b/server/src/main/java/org/apache/kylin/rest/controller/StreamingController.java @@ -18,9 +18,10 @@ package org.apache.kylin.rest.controller; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonMappingException; +import java.io.IOException; +import java.util.List; +import java.util.UUID; + import org.apache.commons.lang.StringUtils; import org.apache.kylin.common.KylinConfig; import org.apache.kylin.common.util.JsonUtil; @@ -42,13 +43,16 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.AccessDeniedException; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonMappingException; /** * StreamingController is defined as Restful API entrance for UI. @@ -67,7 +71,6 @@ public class StreamingController extends BasicController { @Autowired private CubeService cubeMgmtService; - @RequestMapping(value = "/getConfig", method = { RequestMethod.GET }) @ResponseBody public List<StreamingConfig> getStreamings(@RequestParam(value = "table", required = false) String table, @RequestParam(value = "limit", required = false) Integer limit, @RequestParam(value = "offset", required = false) Integer offset) { @@ -90,7 +93,6 @@ public class StreamingController extends BasicController { } } - /** * * create Streaming Schema @@ -104,13 +106,13 @@ public class StreamingController extends BasicController { TableDesc tableDesc = deserializeTableDesc(streamingRequest); StreamingConfig streamingConfig = deserializeSchemalDesc(streamingRequest); KafkaConfig kafkaConfig = deserializeKafkaSchemalDesc(streamingRequest); - boolean saveStreamingSuccess = false, saveKafkaSuccess = false; + boolean saveStreamingSuccess = false, saveKafkaSuccess = false; try { tableDesc.setUuid(UUID.randomUUID().toString()); MetadataManager metaMgr = MetadataManager.getInstance(KylinConfig.getInstanceFromEnv()); metaMgr.saveSourceTable(tableDesc); - cubeMgmtService.syncTableToProject(new String[]{tableDesc.getIdentity()}, project); + cubeMgmtService.syncTableToProject(new String[] { tableDesc.getIdentity() }, project); } catch (IOException e) { throw new BadRequestException("Failed to add streaming table."); } @@ -143,18 +145,18 @@ public class StreamingController extends BasicController { logger.error("Failed to save KafkaConfig:" + e.getLocalizedMessage(), e); throw new InternalErrorException("Failed to save KafkaConfig: " + e.getLocalizedMessage()); } - }finally { - if(saveKafkaSuccess == false || saveStreamingSuccess == false){ + } finally { + if (saveKafkaSuccess == false || saveStreamingSuccess == false) { - if(saveStreamingSuccess == true){ + if (saveStreamingSuccess == true) { StreamingConfig sConfig = streamingService.getStreamingManager().getStreamingConfig(streamingConfig.getName()); - try { - streamingService.dropStreamingConfig(sConfig); - } catch (IOException e) { - throw new InternalErrorException("Action failed and failed to rollback the created streaming config: " + e.getLocalizedMessage()); - } + try { + streamingService.dropStreamingConfig(sConfig); + } catch (IOException e) { + throw new InternalErrorException("Action failed and failed to rollback the created streaming config: " + e.getLocalizedMessage()); + } } - if(saveKafkaSuccess == true){ + if (saveKafkaSuccess == true) { try { KafkaConfig kConfig = kafkaConfigService.getKafkaConfig(kafkaConfig.getName()); kafkaConfigService.dropKafkaConfig(kConfig); @@ -171,7 +173,7 @@ public class StreamingController extends BasicController { @RequestMapping(value = "", method = { RequestMethod.PUT }) @ResponseBody - public StreamingRequest updateStreamingConfig(@RequestBody StreamingRequest streamingRequest) throws JsonProcessingException { + public StreamingRequest updateStreamingConfig(@RequestBody StreamingRequest streamingRequest) throws JsonProcessingException { StreamingConfig streamingConfig = deserializeSchemalDesc(streamingRequest); KafkaConfig kafkaConfig = deserializeKafkaSchemalDesc(streamingRequest); @@ -188,7 +190,7 @@ public class StreamingController extends BasicController { } try { kafkaConfig = kafkaConfigService.updateKafkaConfig(kafkaConfig); - }catch (AccessDeniedException accessDeniedException) { + } catch (AccessDeniedException accessDeniedException) { throw new ForbiddenException("You don't have right to update this KafkaConfig."); } catch (Exception e) { logger.error("Failed to deal with the request:" + e.getLocalizedMessage(), e); @@ -233,7 +235,7 @@ public class StreamingController extends BasicController { throw new InternalErrorException("Failed to deal with the request:" + e.getMessage(), e); } - String [] dbTable = HadoopUtil.parseHiveTableName(desc.getName()); + String[] dbTable = HadoopUtil.parseHiveTableName(desc.getName()); desc.setName(dbTable[1]); desc.setDatabase(dbTable[0]); desc.getIdentity(); @@ -258,7 +260,6 @@ public class StreamingController extends BasicController { return desc; } - private KafkaConfig deserializeKafkaSchemalDesc(StreamingRequest streamingRequest) { KafkaConfig desc = null; try { @@ -283,7 +284,7 @@ public class StreamingController extends BasicController { } public void setStreamingService(StreamingService streamingService) { - this.streamingService= streamingService; + this.streamingService = streamingService; } public void setKafkaConfigService(KafkaConfigService kafkaConfigService) { http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/controller/TableController.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/controller/TableController.java b/server/src/main/java/org/apache/kylin/rest/controller/TableController.java index a90ab41..1c3377b 100644 --- a/server/src/main/java/org/apache/kylin/rest/controller/TableController.java +++ b/server/src/main/java/org/apache/kylin/rest/controller/TableController.java @@ -19,9 +19,15 @@ package org.apache.kylin.rest.controller; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; -import com.google.common.collect.Sets; import org.apache.commons.lang.StringUtils; import org.apache.kylin.common.KylinConfig; import org.apache.kylin.common.util.JsonUtil; @@ -32,12 +38,15 @@ import org.apache.kylin.metadata.MetadataManager; import org.apache.kylin.metadata.model.ColumnDesc; import org.apache.kylin.metadata.model.TableDesc; import org.apache.kylin.rest.exception.InternalErrorException; -import org.apache.kylin.rest.exception.NotFoundException; import org.apache.kylin.rest.request.CardinalityRequest; import org.apache.kylin.rest.request.HiveTableRequest; import org.apache.kylin.rest.request.StreamingRequest; import org.apache.kylin.rest.response.TableDescResponse; -import org.apache.kylin.rest.service.*; +import org.apache.kylin.rest.service.CubeService; +import org.apache.kylin.rest.service.KafkaConfigService; +import org.apache.kylin.rest.service.ModelService; +import org.apache.kylin.rest.service.ProjectService; +import org.apache.kylin.rest.service.StreamingService; import org.apache.kylin.source.hive.HiveClient; import org.apache.kylin.source.kafka.config.KafkaConfig; import org.slf4j.Logger; @@ -52,6 +61,8 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; +import com.google.common.collect.Sets; + /** * @author xduo */ @@ -141,7 +152,7 @@ public class TableController extends BasicController { cubeMgmtService.syncTableToProject(loaded, project); Map<String, String[]> result = new HashMap<String, String[]>(); result.put("result.loaded", loaded); - result.put("result.unloaded", new String[]{}); + result.put("result.unloaded", new String[] {}); return result; } @@ -171,7 +182,7 @@ public class TableController extends BasicController { * @return */ private boolean unLoadHiveTable(String tableName, String project) { - boolean rtn= false; + boolean rtn = false; int tableType = 0; //remove streaming info @@ -181,14 +192,14 @@ public class TableController extends BasicController { tableType = desc.getSourceType(); try { - if (!modelService.isTableInModel(tableName, project)) { - cubeMgmtService.removeTableFromProject(tableName, project); - rtn = true; - } - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - if(!projectService.isTableInAnyProject(tableName) && !modelService.isTableInAnyModel(tableName)) { + if (!modelService.isTableInModel(tableName, project)) { + cubeMgmtService.removeTableFromProject(tableName, project); + rtn = true; + } + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + if (!projectService.isTableInAnyProject(tableName) && !modelService.isTableInAnyModel(tableName)) { try { cubeMgmtService.unLoadHiveTable(tableName); rtn = true; @@ -198,7 +209,7 @@ public class TableController extends BasicController { } } - if(tableType ==1 && !projectService.isTableInAnyProject(tableName) && !modelService.isTableInAnyModel(tableName)){ + if (tableType == 1 && !projectService.isTableInAnyProject(tableName) && !modelService.isTableInAnyModel(tableName)) { StreamingConfig config = null; KafkaConfig kafkaConfig = null; try { @@ -224,12 +235,11 @@ public class TableController extends BasicController { desc.setUuid(UUID.randomUUID().toString()); MetadataManager metaMgr = MetadataManager.getInstance(KylinConfig.getInstanceFromEnv()); metaMgr.saveSourceTable(desc); - cubeMgmtService.syncTableToProject(new String[]{desc.getName()}, project); - result.put("success","true"); + cubeMgmtService.syncTableToProject(new String[] { desc.getName() }, project); + result.put("success", "true"); return result; } - /** * Regenerate table cardinality * @@ -291,7 +301,6 @@ public class TableController extends BasicController { return descs; } - /** * Show all databases in Hive * http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/controller/UserController.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/controller/UserController.java b/server/src/main/java/org/apache/kylin/rest/controller/UserController.java index 54af010..bccfed4 100644 --- a/server/src/main/java/org/apache/kylin/rest/controller/UserController.java +++ b/server/src/main/java/org/apache/kylin/rest/controller/UserController.java @@ -59,18 +59,17 @@ public class UserController { logger.debug("authentication is null."); return null; } - + if (authentication.getPrincipal() instanceof UserDetails) { logger.debug("authentication.getPrincipal() is " + authentication.getPrincipal()); return (UserDetails) authentication.getPrincipal(); } - if (authentication.getDetails() instanceof UserDetails) { logger.debug("authentication.getDetails() is " + authentication.getDetails()); return (UserDetails) authentication.getDetails(); } - + return null; } http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/model/SelectedColumnMeta.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/model/SelectedColumnMeta.java b/server/src/main/java/org/apache/kylin/rest/model/SelectedColumnMeta.java index fc8d723..95582e4 100644 --- a/server/src/main/java/org/apache/kylin/rest/model/SelectedColumnMeta.java +++ b/server/src/main/java/org/apache/kylin/rest/model/SelectedColumnMeta.java @@ -22,7 +22,7 @@ import java.io.Serializable; /** */ -public class SelectedColumnMeta implements Serializable{ +public class SelectedColumnMeta implements Serializable { public SelectedColumnMeta(boolean isAutoIncrement, boolean isCaseSensitive, boolean isSearchable, boolean isCurrency, int isNullalbe, boolean isSigned, int displaySize, String label, String name, String schemaName, String catelogName, String tableName, int precision, int scale, int columnType, String columnTypeName, boolean isReadOnly, boolean isWritable, boolean isDefinitelyWritable) { super(); this.isAutoIncrement = isAutoIncrement; http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/request/ExternalFilterRequest.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/request/ExternalFilterRequest.java b/server/src/main/java/org/apache/kylin/rest/request/ExternalFilterRequest.java index 6b4e297..887e9ef 100644 --- a/server/src/main/java/org/apache/kylin/rest/request/ExternalFilterRequest.java +++ b/server/src/main/java/org/apache/kylin/rest/request/ExternalFilterRequest.java @@ -16,7 +16,6 @@ * limitations under the License. */ - package org.apache.kylin.rest.request; public class ExternalFilterRequest { @@ -37,7 +36,6 @@ public class ExternalFilterRequest { this.project = project; } - public boolean isSuccessful() { return successful; } http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/request/HiveTableRequest.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/request/HiveTableRequest.java b/server/src/main/java/org/apache/kylin/rest/request/HiveTableRequest.java index c2beb5f..c529360 100644 --- a/server/src/main/java/org/apache/kylin/rest/request/HiveTableRequest.java +++ b/server/src/main/java/org/apache/kylin/rest/request/HiveTableRequest.java @@ -5,7 +5,7 @@ package org.apache.kylin.rest.request; */ public class HiveTableRequest { - public HiveTableRequest(){ + public HiveTableRequest() { } @@ -14,9 +14,9 @@ public class HiveTableRequest { public boolean isCalculate() { return calculate; } + public void setCalculate(boolean calculate) { this.calculate = calculate; } - } http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/request/JobBuildRequest.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/request/JobBuildRequest.java b/server/src/main/java/org/apache/kylin/rest/request/JobBuildRequest.java index 3c74e97..a8ffe5f 100644 --- a/server/src/main/java/org/apache/kylin/rest/request/JobBuildRequest.java +++ b/server/src/main/java/org/apache/kylin/rest/request/JobBuildRequest.java @@ -27,7 +27,7 @@ public class JobBuildRequest { private String buildType; private boolean force; - + @Deprecated private boolean forceMergeEmptySegment = false; @@ -54,7 +54,7 @@ public class JobBuildRequest { public void setBuildType(String buildType) { this.buildType = buildType; } - + public boolean isForce() { return force; } http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/request/JobBuildRequest2.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/request/JobBuildRequest2.java b/server/src/main/java/org/apache/kylin/rest/request/JobBuildRequest2.java index 3a9f4fd..dc3b433 100644 --- a/server/src/main/java/org/apache/kylin/rest/request/JobBuildRequest2.java +++ b/server/src/main/java/org/apache/kylin/rest/request/JobBuildRequest2.java @@ -27,7 +27,7 @@ public class JobBuildRequest2 { private String buildType; private boolean force; - + public long getStartSourceOffset() { return startSourceOffset; } @@ -51,7 +51,7 @@ public class JobBuildRequest2 { public void setBuildType(String buildType) { this.buildType = buildType; } - + public boolean isForce() { return force; } http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/request/PrepareSqlRequest.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/request/PrepareSqlRequest.java b/server/src/main/java/org/apache/kylin/rest/request/PrepareSqlRequest.java index 868e0f9..95bc2f5 100644 --- a/server/src/main/java/org/apache/kylin/rest/request/PrepareSqlRequest.java +++ b/server/src/main/java/org/apache/kylin/rest/request/PrepareSqlRequest.java @@ -80,7 +80,7 @@ public class PrepareSqlRequest extends SQLRequest { return false; if (getClass() != obj.getClass()) return false; - StateParam other = (StateParam)obj; + StateParam other = (StateParam) obj; if (className == null) { if (other.className != null) return false; @@ -113,7 +113,7 @@ public class PrepareSqlRequest extends SQLRequest { return false; if (!super.equals(obj)) return false; - PrepareSqlRequest other = (PrepareSqlRequest)obj; + PrepareSqlRequest other = (PrepareSqlRequest) obj; if (!Arrays.equals(params, other.params)) return false; return true; http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/request/StreamingRequest.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/request/StreamingRequest.java b/server/src/main/java/org/apache/kylin/rest/request/StreamingRequest.java index a8a983b..96db4da 100644 --- a/server/src/main/java/org/apache/kylin/rest/request/StreamingRequest.java +++ b/server/src/main/java/org/apache/kylin/rest/request/StreamingRequest.java @@ -16,10 +16,8 @@ * limitations under the License. */ - package org.apache.kylin.rest.request; -import java.lang.String; public class StreamingRequest { private String project; http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/security/AclPermissionFactory.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/security/AclPermissionFactory.java b/server/src/main/java/org/apache/kylin/rest/security/AclPermissionFactory.java index 4c6c463..d662403 100644 --- a/server/src/main/java/org/apache/kylin/rest/security/AclPermissionFactory.java +++ b/server/src/main/java/org/apache/kylin/rest/security/AclPermissionFactory.java @@ -49,6 +49,7 @@ public class AclPermissionFactory extends DefaultPermissionFactory { permissions.add((Permission) fieldValue); } } catch (Exception ignore) { + //ignore on purpose } } @@ -69,6 +70,7 @@ public class AclPermissionFactory extends DefaultPermissionFactory { } } } catch (Exception ignore) { + //ignore on purpose } } http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/security/KylinAuthenticationProvider.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/security/KylinAuthenticationProvider.java b/server/src/main/java/org/apache/kylin/rest/security/KylinAuthenticationProvider.java index 81a809b..d0dd06a 100644 --- a/server/src/main/java/org/apache/kylin/rest/security/KylinAuthenticationProvider.java +++ b/server/src/main/java/org/apache/kylin/rest/security/KylinAuthenticationProvider.java @@ -18,13 +18,13 @@ package org.apache.kylin.rest.security; -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Arrays; + import org.apache.kylin.rest.service.UserService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.core.Authentication; @@ -33,12 +33,11 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.security.saml.SAMLAuthenticationProvider; import org.springframework.util.Assert; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.Arrays; +import net.sf.ehcache.Cache; +import net.sf.ehcache.CacheManager; +import net.sf.ehcache.Element; /** * A wrapper class for the authentication provider; Will do something more for Kylin. @@ -57,7 +56,7 @@ public class KylinAuthenticationProvider implements AuthenticationProvider { private AuthenticationProvider authenticationProvider; MessageDigest md = null; - + public KylinAuthenticationProvider(AuthenticationProvider authenticationProvider) { super(); Assert.notNull(authenticationProvider, "The embedded authenticationProvider should not be null."); @@ -68,6 +67,7 @@ public class KylinAuthenticationProvider implements AuthenticationProvider { throw new RuntimeException("Failed to init Message Digest ", e); } } + @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { Authentication authed = null; @@ -90,15 +90,15 @@ public class KylinAuthenticationProvider implements AuthenticationProvider { } logger.debug("Authenticated user " + authed.toString()); - + UserDetails user; - + if (authed.getDetails() == null) { //authed.setAuthenticated(false); throw new UsernameNotFoundException("User not found in LDAP, check whether he/she has been added to the groups."); - } - - if (authed.getDetails() instanceof UserDetails) { + } + + if (authed.getDetails() instanceof UserDetails) { user = (UserDetails) authed.getDetails(); } else { user = new User(authentication.getName(), "skippped-ldap", authed.getAuthorities()); http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/security/LdapProvider.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/security/LdapProvider.java b/server/src/main/java/org/apache/kylin/rest/security/LdapProvider.java index 2dae90b..2c5fe50 100644 --- a/server/src/main/java/org/apache/kylin/rest/security/LdapProvider.java +++ b/server/src/main/java/org/apache/kylin/rest/security/LdapProvider.java @@ -22,10 +22,6 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Arrays; -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; - import org.apache.kylin.rest.service.UserService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,6 +35,10 @@ import org.springframework.security.ldap.authentication.LdapAuthenticationProvid import org.springframework.security.ldap.authentication.LdapAuthenticator; import org.springframework.security.ldap.userdetails.LdapAuthoritiesPopulator; +import net.sf.ehcache.Cache; +import net.sf.ehcache.CacheManager; +import net.sf.ehcache.Element; + /** * @author xduo * @deprecated replaced by KylinAuthenticationProvider http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/security/MockAclHBaseStorage.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/security/MockAclHBaseStorage.java b/server/src/main/java/org/apache/kylin/rest/security/MockAclHBaseStorage.java index 70a61a3..6c8081d 100644 --- a/server/src/main/java/org/apache/kylin/rest/security/MockAclHBaseStorage.java +++ b/server/src/main/java/org/apache/kylin/rest/security/MockAclHBaseStorage.java @@ -32,11 +32,11 @@ public class MockAclHBaseStorage implements AclHBaseStorage { private static final String aclTableName = "MOCK-ACL-TABLE"; private static final String userTableName = "MOCK-USER-TABLE"; - + private HTableInterface mockedAclTable; private HTableInterface mockedUserTable; private RealAclHBaseStorage realAcl; - + public MockAclHBaseStorage() { String metadataUrl = KylinConfig.getInstanceFromEnv().getMetadataUrl(); if (metadataUrl != null && metadataUrl.endsWith("hbase")) { @@ -68,7 +68,7 @@ public class MockAclHBaseStorage implements AclHBaseStorage { if (realAcl != null) { return realAcl.getTable(tableName); } - + if (StringUtils.equals(tableName, aclTableName)) { return mockedAclTable; } else if (StringUtils.equals(tableName, userTableName)) { http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/security/PasswordPlaceholderConfigurer.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/security/PasswordPlaceholderConfigurer.java b/server/src/main/java/org/apache/kylin/rest/security/PasswordPlaceholderConfigurer.java index 2022ef0..2692da9 100644 --- a/server/src/main/java/org/apache/kylin/rest/security/PasswordPlaceholderConfigurer.java +++ b/server/src/main/java/org/apache/kylin/rest/security/PasswordPlaceholderConfigurer.java @@ -18,6 +18,11 @@ package org.apache.kylin.rest.security; +import java.util.Properties; + +import javax.crypto.Cipher; +import javax.crypto.spec.SecretKeySpec; + import org.apache.commons.codec.binary.Base64; import org.apache.kylin.common.KylinConfig; import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; @@ -25,10 +30,6 @@ import org.springframework.core.io.InputStreamResource; import org.springframework.core.io.Resource; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import javax.crypto.Cipher; -import javax.crypto.spec.SecretKeySpec; -import java.util.Properties; - /** * @author xduo * @@ -74,7 +75,7 @@ public class PasswordPlaceholderConfigurer extends PropertyPlaceholderConfigurer return props.getProperty(placeholder); } } - + private static void printUsage() { System.out.println("Usage: java org.apache.kylin.rest.security.PasswordPlaceholderConfigurer <EncryptMethod> <your_password>"); System.out.println("EncryptMethod: AES or BCrypt"); http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/security/SAMLUserDetailsService.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/security/SAMLUserDetailsService.java b/server/src/main/java/org/apache/kylin/rest/security/SAMLUserDetailsService.java index 78f9d5e..24f8243 100644 --- a/server/src/main/java/org/apache/kylin/rest/security/SAMLUserDetailsService.java +++ b/server/src/main/java/org/apache/kylin/rest/security/SAMLUserDetailsService.java @@ -43,7 +43,6 @@ public class SAMLUserDetailsService implements org.springframework.security.saml logger.debug("samlCredential.email:" + userEmail); final String userName = userEmail.substring(0, userEmail.indexOf("@")); - UserDetails userDetails = null; try { userDetails = ldapUserDetailsService.loadUserByUsername(userName); http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/service/AccessService.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/service/AccessService.java b/server/src/main/java/org/apache/kylin/rest/service/AccessService.java index 5370bba..9561fbd 100644 --- a/server/src/main/java/org/apache/kylin/rest/service/AccessService.java +++ b/server/src/main/java/org/apache/kylin/rest/service/AccessService.java @@ -147,6 +147,7 @@ public class AccessService { acl.updateAce(indexOfAce, newPermission); acl = aclService.updateAcl(acl); } catch (NotFoundException e) { + //do nothing? } } @@ -178,6 +179,7 @@ public class AccessService { acl.deleteAce(indexOfAce); acl = aclService.updateAcl(acl); } catch (NotFoundException e) { + //do nothing? } } @@ -228,6 +230,7 @@ public class AccessService { try { aclService.deleteAcl(objectIdentity, deleteChildren); } catch (NotFoundException e) { + //do nothing? } } @@ -251,6 +254,7 @@ public class AccessService { try { acl = (MutableAcl) aclService.readAclById(objectIdentity); } catch (NotFoundException e) { + //do nothing? } return acl; http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/service/AclService.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/service/AclService.java b/server/src/main/java/org/apache/kylin/rest/service/AclService.java index 58e093c..d693a67 100644 --- a/server/src/main/java/org/apache/kylin/rest/service/AclService.java +++ b/server/src/main/java/org/apache/kylin/rest/service/AclService.java @@ -217,6 +217,7 @@ public class AclService implements MutableAclService { try { acl = readAclById(objectIdentity); } catch (NotFoundException e) { + //do nothing? } if (null != acl) { throw new AlreadyExistsException("ACL of " + objectIdentity + " exists!"); http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/service/BadQueryDetector.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/service/BadQueryDetector.java b/server/src/main/java/org/apache/kylin/rest/service/BadQueryDetector.java index 9089188..79e1d4a 100644 --- a/server/src/main/java/org/apache/kylin/rest/service/BadQueryDetector.java +++ b/server/src/main/java/org/apache/kylin/rest/service/BadQueryDetector.java @@ -24,7 +24,6 @@ import java.net.UnknownHostException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; -import java.util.HashSet; import java.util.NavigableSet; import java.util.TreeSet; import java.util.concurrent.ConcurrentMap; @@ -37,7 +36,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.collect.Maps; -import com.google.common.collect.Sets; public class BadQueryDetector extends Thread { @@ -111,15 +109,16 @@ public class BadQueryDetector extends Thread { NavigableSet<Pair<Long, String>> cacheQueue = new TreeSet<>(new Comparator<Pair<Long, String>>() { @Override public int compare(Pair<Long, String> o1, Pair<Long, String> o2) { - if (o1.equals(o2)){ + if (o1.equals(o2)) { return 0; } else if (o1.getFirst().equals(o2.getFirst())) { return o2.getSecond().compareTo(o2.getSecond()); } else { - return (int)(o1.getFirst() - o2.getFirst()); + return (int) (o1.getFirst() - o2.getFirst()); } } }); + public PersistenceNotifier() { try { serverHostname = InetAddress.getLocalHost().getHostName(); http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/service/CacheService.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/service/CacheService.java b/server/src/main/java/org/apache/kylin/rest/service/CacheService.java index 48afde6..9185544 100644 --- a/server/src/main/java/org/apache/kylin/rest/service/CacheService.java +++ b/server/src/main/java/org/apache/kylin/rest/service/CacheService.java @@ -28,8 +28,6 @@ import java.util.concurrent.ConcurrentMap; import javax.annotation.PostConstruct; import javax.sql.DataSource; -import net.sf.ehcache.CacheManager; - import org.apache.calcite.jdbc.Driver; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; @@ -59,6 +57,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.stereotype.Component; +import net.sf.ehcache.CacheManager; + /** */ @Component("cacheService") http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/service/DiagnosisService.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/service/DiagnosisService.java b/server/src/main/java/org/apache/kylin/rest/service/DiagnosisService.java index f934fb2..ba51ea1 100644 --- a/server/src/main/java/org/apache/kylin/rest/service/DiagnosisService.java +++ b/server/src/main/java/org/apache/kylin/rest/service/DiagnosisService.java @@ -65,7 +65,7 @@ public class DiagnosisService extends BasicService { return jobInfoExtractor.getExportDest(); } - public static void main(String args1[]) { + public static void main(String[] args1) { String[] args = { "-project", "-all", "-destDir", Files.createTempDir().getAbsolutePath() }; logger.info("DiagnosisInfoCLI args: " + Arrays.toString(args)); DiagnosisInfoCLI diagnosisInfoCli = new DiagnosisInfoCLI(); http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/service/ExtFilterService.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/service/ExtFilterService.java b/server/src/main/java/org/apache/kylin/rest/service/ExtFilterService.java index 576ece9..0c98965 100644 --- a/server/src/main/java/org/apache/kylin/rest/service/ExtFilterService.java +++ b/server/src/main/java/org/apache/kylin/rest/service/ExtFilterService.java @@ -18,6 +18,8 @@ package org.apache.kylin.rest.service; +import java.io.IOException; +import java.util.List; import org.apache.kylin.metadata.model.ExternalFilterDesc; import org.apache.kylin.rest.constant.Constant; @@ -28,21 +30,16 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Component; -import java.io.IOException; -import java.util.List; - @Component("extFilterService") public class ExtFilterService extends BasicService { private static final Logger logger = LoggerFactory.getLogger(ExtFilterService.class); - @Autowired private AccessService accessService; - @PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN) public void saveExternalFilter(ExternalFilterDesc desc) throws IOException { - if(getMetadataManager().getExtFilterDesc(desc.getName()) != null){ + if (getMetadataManager().getExtFilterDesc(desc.getName()) != null) { throw new InternalErrorException("The filter named " + desc.getName() + " already exists"); } getMetadataManager().saveExternalFilter(desc); @@ -50,13 +47,12 @@ public class ExtFilterService extends BasicService { @PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN) public void updateExternalFilter(ExternalFilterDesc desc) throws IOException { - if(getMetadataManager().getExtFilterDesc(desc.getName()) == null){ + if (getMetadataManager().getExtFilterDesc(desc.getName()) == null) { throw new InternalErrorException("The filter named " + desc.getName() + " does not exists"); } getMetadataManager().saveExternalFilter(desc); } - @PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN) public void removeExternalFilter(String name) throws IOException { getMetadataManager().removeExternalFilter(name); @@ -73,7 +69,7 @@ public class ExtFilterService extends BasicService { } @PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN) - public List<ExternalFilterDesc> listAllExternalFilters(){ + public List<ExternalFilterDesc> listAllExternalFilters() { return getMetadataManager().listAllExternalFilters(); } http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/service/JobService.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/service/JobService.java b/server/src/main/java/org/apache/kylin/rest/service/JobService.java index decbff2..c868264 100644 --- a/server/src/main/java/org/apache/kylin/rest/service/JobService.java +++ b/server/src/main/java/org/apache/kylin/rest/service/JobService.java @@ -90,7 +90,6 @@ public class JobService extends BasicService { return jobs.subList(offset, offset + limit); } - public List<JobInstance> listAllJobs(final String cubeName, final String projectName, final List<JobStatusEnum> statusList, final JobTimeFilterEnum timeFilter) { Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/service/KafkaConfigService.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/service/KafkaConfigService.java b/server/src/main/java/org/apache/kylin/rest/service/KafkaConfigService.java index a0b19b2..1f286e3 100644 --- a/server/src/main/java/org/apache/kylin/rest/service/KafkaConfigService.java +++ b/server/src/main/java/org/apache/kylin/rest/service/KafkaConfigService.java @@ -18,6 +18,10 @@ package org.apache.kylin.rest.service; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + import org.apache.kylin.rest.constant.Constant; import org.apache.kylin.rest.exception.InternalErrorException; import org.apache.kylin.source.kafka.config.KafkaConfig; @@ -25,10 +29,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PostFilter; import org.springframework.stereotype.Component; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - @Component("kafkaMgmtService") public class KafkaConfigService extends BasicService { @@ -38,13 +38,13 @@ public class KafkaConfigService extends BasicService { @PostFilter(Constant.ACCESS_POST_FILTER_READ) public List<KafkaConfig> listAllKafkaConfigs(final String kafkaConfigName) throws IOException { List<KafkaConfig> kafkaConfigs = new ArrayList<KafkaConfig>(); -// CubeInstance cubeInstance = (null != cubeName) ? getCubeManager().getCube(cubeName) : null; + // CubeInstance cubeInstance = (null != cubeName) ? getCubeManager().getCube(cubeName) : null; if (null == kafkaConfigName) { kafkaConfigs = getKafkaManager().listAllKafkaConfigs(); } else { List<KafkaConfig> configs = getKafkaManager().listAllKafkaConfigs(); - for(KafkaConfig config : configs){ - if(kafkaConfigName.equals(config.getName())){ + for (KafkaConfig config : configs) { + if (kafkaConfigName.equals(config.getName())) { kafkaConfigs.add(config); } } @@ -69,17 +69,15 @@ public class KafkaConfigService extends BasicService { return kafkaConfigs.subList(offset, offset + limit); } - - public KafkaConfig createKafkaConfig(KafkaConfig config) throws IOException { if (getKafkaManager().getKafkaConfig(config.getName()) != null) { throw new InternalErrorException("The kafkaConfig named " + config.getName() + " already exists"); } - getKafkaManager().createKafkaConfig(config.getName(),config); + getKafkaManager().createKafkaConfig(config.getName(), config); return config; } -// @PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#desc, 'ADMINISTRATION') or hasPermission(#desc, 'MANAGEMENT')") + // @PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#desc, 'ADMINISTRATION') or hasPermission(#desc, 'MANAGEMENT')") public KafkaConfig updateKafkaConfig(KafkaConfig config) throws IOException { return getKafkaManager().updateKafkaConfig(config); } @@ -87,7 +85,8 @@ public class KafkaConfigService extends BasicService { public KafkaConfig getKafkaConfig(String configName) throws IOException { return getKafkaManager().getKafkaConfig(configName); } -// @PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#desc, 'ADMINISTRATION') or hasPermission(#desc, 'MANAGEMENT')") + + // @PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#desc, 'ADMINISTRATION') or hasPermission(#desc, 'MANAGEMENT')") public void dropKafkaConfig(KafkaConfig config) throws IOException { getKafkaManager().removeKafkaConfig(config); } http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/service/ProjectService.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/service/ProjectService.java b/server/src/main/java/org/apache/kylin/rest/service/ProjectService.java index ad5a982..c0610a2 100644 --- a/server/src/main/java/org/apache/kylin/rest/service/ProjectService.java +++ b/server/src/main/java/org/apache/kylin/rest/service/ProjectService.java @@ -106,8 +106,8 @@ public class ProjectService extends BasicService { } public boolean isTableInAnyProject(String tableName) { - for(ProjectInstance projectInstance : ProjectManager.getInstance(getConfig()).listAllProjects()) { - if(projectInstance.containsTable(tableName.toUpperCase())) { + for (ProjectInstance projectInstance : ProjectManager.getInstance(getConfig()).listAllProjects()) { + if (projectInstance.containsTable(tableName.toUpperCase())) { return true; } } @@ -116,8 +116,8 @@ public class ProjectService extends BasicService { public boolean isTableInProject(String tableName, String projectName) { ProjectInstance projectInstance = ProjectManager.getInstance(getConfig()).getProject(projectName); - if(projectInstance != null) { - if(projectInstance.containsTable(tableName.toUpperCase())) { + if (projectInstance != null) { + if (projectInstance.containsTable(tableName.toUpperCase())) { return true; } } http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/service/QueryService.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/service/QueryService.java b/server/src/main/java/org/apache/kylin/rest/service/QueryService.java index 3f8b9d7..84a5c67 100644 --- a/server/src/main/java/org/apache/kylin/rest/service/QueryService.java +++ b/server/src/main/java/org/apache/kylin/rest/service/QueryService.java @@ -181,13 +181,13 @@ public class QueryService extends BasicService { if (null == creator) { return null; } - + List<Query> queries = new ArrayList<Query>(); HTableInterface htable = null; try { HConnection conn = HBaseConnection.get(hbaseUrl); HBaseConnection.createHTableIfNeeded(conn, userTableName, USER_QUERY_FAMILY); - + htable = conn.getTable(userTableName); Get get = new Get(Bytes.toBytes(creator)); get.addFamily(Bytes.toBytes(USER_QUERY_FAMILY)); http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/service/StreamingService.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/service/StreamingService.java b/server/src/main/java/org/apache/kylin/rest/service/StreamingService.java index 9627e8f..e49e882 100644 --- a/server/src/main/java/org/apache/kylin/rest/service/StreamingService.java +++ b/server/src/main/java/org/apache/kylin/rest/service/StreamingService.java @@ -18,9 +18,11 @@ package org.apache.kylin.rest.service; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + import org.apache.commons.lang3.StringUtils; -import org.apache.kylin.common.util.StringUtil; -import org.apache.kylin.cube.CubeInstance; import org.apache.kylin.engine.streaming.StreamingConfig; import org.apache.kylin.rest.constant.Constant; import org.apache.kylin.rest.exception.InternalErrorException; @@ -28,10 +30,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PostFilter; import org.springframework.stereotype.Component; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - @Component("streamingMgmtService") public class StreamingService extends BasicService { @@ -45,7 +43,7 @@ public class StreamingService extends BasicService { streamingConfigs = getStreamingManager().listAllStreaming(); } else { StreamingConfig config = getStreamingManager().getConfig(table); - if(config!=null){ + if (config != null) { streamingConfigs.add(config); } } @@ -73,16 +71,16 @@ public class StreamingService extends BasicService { if (getStreamingManager().getStreamingConfig(config.getName()) != null) { throw new InternalErrorException("The streamingConfig named " + config.getName() + " already exists"); } - StreamingConfig streamingConfig = getStreamingManager().saveStreamingConfig(config); + StreamingConfig streamingConfig = getStreamingManager().saveStreamingConfig(config); return streamingConfig; } -// @PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#desc, 'ADMINISTRATION') or hasPermission(#desc, 'MANAGEMENT')") + // @PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#desc, 'ADMINISTRATION') or hasPermission(#desc, 'MANAGEMENT')") public StreamingConfig updateStreamingConfig(StreamingConfig config) throws IOException { return getStreamingManager().updateStreamingConfig(config); } -// @PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#desc, 'ADMINISTRATION') or hasPermission(#desc, 'MANAGEMENT')") + // @PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#desc, 'ADMINISTRATION') or hasPermission(#desc, 'MANAGEMENT')") public void dropStreamingConfig(StreamingConfig config) throws IOException { getStreamingManager().removeStreamingConfig(config); } http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/service/UserService.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/service/UserService.java b/server/src/main/java/org/apache/kylin/rest/service/UserService.java index 343d160..c1f4e98 100644 --- a/server/src/main/java/org/apache/kylin/rest/service/UserService.java +++ b/server/src/main/java/org/apache/kylin/rest/service/UserService.java @@ -125,7 +125,7 @@ public class UserService implements UserDetailsManager { authorities = Collections.emptyList(); UserGrantedAuthority[] serializing = new UserGrantedAuthority[authorities.size() + 1]; - + // password is stored as the [0] authority serializing[0] = new UserGrantedAuthority(PWD_PREFIX + user.getPassword()); int i = 1; @@ -210,7 +210,7 @@ public class UserService implements UserDetailsManager { } return all; } - + public List<UserDetails> listUsers() { Scan s = new Scan(); s.addColumn(Bytes.toBytes(AclHBaseStorage.USER_AUTHORITY_FAMILY), Bytes.toBytes(AclHBaseStorage.USER_AUTHORITY_COLUMN)); http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/main/java/org/apache/kylin/rest/util/QueryUtil.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/kylin/rest/util/QueryUtil.java b/server/src/main/java/org/apache/kylin/rest/util/QueryUtil.java index 5f87e8d..c15e5f9 100644 --- a/server/src/main/java/org/apache/kylin/rest/util/QueryUtil.java +++ b/server/src/main/java/org/apache/kylin/rest/util/QueryUtil.java @@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory; public class QueryUtil { protected static final Logger logger = LoggerFactory.getLogger(QueryUtil.class); - + private static final String S0 = "\\s*"; private static final String S1 = "\\s"; private static final String SM = "\\s+"; @@ -49,11 +49,11 @@ public class QueryUtil { // Pattern.CASE_INSENSITIVE); private static final Pattern PTN_HAVING_ESCAPE_FUNCTION = Pattern.compile("\\{fn" + "(.*?)" + "\\}", Pattern.CASE_INSENSITIVE); - private static String[] tableauTestQueries = new String[] { "SELECT 1",// - "CREATE LOCAL TEMPORARY TABLE \"XTableau_B_Connect\" ( \"COL\" INTEGER ) ON COMMIT PRESERVE ROWS",// - "DROP TABLE \"XTableau_B_Connect\"",// - "SELECT \"COL\" FROM (SELECT 1 AS \"COL\") AS \"SUBQUERY\"",// - "SELECT TOP 1 \"COL\" FROM (SELECT 1 AS \"COL\") AS \"CHECKTOP\"", "SELECT \"COL\" FROM (SELECT 1 AS \"COL\") AS \"CHECKTOP\" LIMIT 1",// + private static String[] tableauTestQueries = new String[] { "SELECT 1", // + "CREATE LOCAL TEMPORARY TABLE \"XTableau_B_Connect\" ( \"COL\" INTEGER ) ON COMMIT PRESERVE ROWS", // + "DROP TABLE \"XTableau_B_Connect\"", // + "SELECT \"COL\" FROM (SELECT 1 AS \"COL\") AS \"SUBQUERY\"", // + "SELECT TOP 1 \"COL\" FROM (SELECT 1 AS \"COL\") AS \"CHECKTOP\"", "SELECT \"COL\" FROM (SELECT 1 AS \"COL\") AS \"CHECKTOP\" LIMIT 1", // "SELECT \"SUBCOL\" AS \"COL\" FROM ( SELECT 1 AS \"SUBCOL\" ) \"SUBQUERY\" GROUP BY 1", "SELECT \"SUBCOL\" AS \"COL\" FROM ( SELECT 1 AS \"SUBCOL\" ) \"SUBQUERY\" GROUP BY 2", "INSERT INTO \"XTableau_C_Connect\" SELECT * FROM (SELECT 1 AS COL) AS CHECKTEMP LIMIT 1", "DROP TABLE \"XTableau_C_Connect\"", "INSERT INTO \"XTableau_B_Connect\" SELECT * FROM (SELECT 1 AS COL) AS CHECKTEMP LIMIT 1" }; private static SQLResponse temp = new SQLResponse(new LinkedList<SelectedColumnMeta>() { @@ -102,7 +102,7 @@ public class QueryUtil { public static String massageSql(SQLRequest sqlRequest) { String sql = sqlRequest.getSql(); sql = sql.trim(); - + while (sql.endsWith(";")) sql = sql.substring(0, sql.length() - 1); @@ -115,7 +115,7 @@ public class QueryUtil { if (offset > 0 && !sql.toLowerCase().contains("offset")) { sql += ("\nOFFSET " + offset); } - + return healSickSql(sql); } http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java ---------------------------------------------------------------------- diff --git a/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java b/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java index 85665e8..e76caca 100644 --- a/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java +++ b/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java @@ -36,6 +36,7 @@ import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import com.fasterxml.jackson.databind.ObjectMapper; + import com.google.common.collect.Lists; /** @@ -121,7 +122,7 @@ public class CubeControllerTest extends ServiceTestBase { cubeController.deleteCube(newCubeName); } - @Test (expected=InternalErrorException.class) + @Test(expected = InternalErrorException.class) public void testDeleteSegmentNew() throws IOException { String cubeName = "test_kylin_cube_with_slr_ready_3_segments"; CubeDesc[] cubes = cubeDescController.getCube(cubeName); @@ -130,7 +131,7 @@ public class CubeControllerTest extends ServiceTestBase { cubeController.deleteSegment(cubeName, "20131212000000_20140112000000"); } - @Test (expected=InternalErrorException.class) + @Test(expected = InternalErrorException.class) public void testDeleteSegmentNotExist() throws IOException { String cubeName = "test_kylin_cube_with_slr_ready_3_segments"; CubeDesc[] cubes = cubeDescController.getCube(cubeName); @@ -139,8 +140,7 @@ public class CubeControllerTest extends ServiceTestBase { cubeController.deleteSegment(cubeName, "not_exist_segment"); } - - @Test (expected=InternalErrorException.class) + @Test(expected = InternalErrorException.class) public void testDeleteSegmentInMiddle() throws IOException { String cubeName = "test_kylin_cube_with_slr_ready_3_segments"; CubeDesc[] cubes = cubeDescController.getCube(cubeName); @@ -164,5 +164,4 @@ public class CubeControllerTest extends ServiceTestBase { Assert.assertTrue(segNumber == newSegNumber + 1); } - } http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/test/java/org/apache/kylin/rest/controller/JobControllerTest.java ---------------------------------------------------------------------- diff --git a/server/src/test/java/org/apache/kylin/rest/controller/JobControllerTest.java b/server/src/test/java/org/apache/kylin/rest/controller/JobControllerTest.java index 391c16a..3cd994b 100644 --- a/server/src/test/java/org/apache/kylin/rest/controller/JobControllerTest.java +++ b/server/src/test/java/org/apache/kylin/rest/controller/JobControllerTest.java @@ -115,7 +115,7 @@ public class JobControllerTest extends ServiceTestBase { jobBuildRequest.setBuildType("BUILD"); jobBuildRequest.setStartTime(20130331080000L); jobBuildRequest.setEndTime(20131212080000L); - + // Yang: how to rebuild a cube does not exists?! JobInstance job = cubeController.rebuild(CUBE_NAME, jobBuildRequest); http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/test/java/org/apache/kylin/rest/controller/QueryControllerTest.java ---------------------------------------------------------------------- diff --git a/server/src/test/java/org/apache/kylin/rest/controller/QueryControllerTest.java b/server/src/test/java/org/apache/kylin/rest/controller/QueryControllerTest.java index c42a0f6..3180075 100644 --- a/server/src/test/java/org/apache/kylin/rest/controller/QueryControllerTest.java +++ b/server/src/test/java/org/apache/kylin/rest/controller/QueryControllerTest.java @@ -18,8 +18,6 @@ package org.apache.kylin.rest.controller; -import net.sf.ehcache.CacheManager; - import org.apache.kylin.metadata.project.ProjectInstance; import org.apache.kylin.rest.request.MetaRequest; import org.apache.kylin.rest.request.SQLRequest; @@ -32,6 +30,8 @@ import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; +import net.sf.ehcache.CacheManager; + /** * @author xduo */ http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/test/java/org/apache/kylin/rest/service/BadQueryDetectorTest.java ---------------------------------------------------------------------- diff --git a/server/src/test/java/org/apache/kylin/rest/service/BadQueryDetectorTest.java b/server/src/test/java/org/apache/kylin/rest/service/BadQueryDetectorTest.java index 922f1a4..9108990 100644 --- a/server/src/test/java/org/apache/kylin/rest/service/BadQueryDetectorTest.java +++ b/server/src/test/java/org/apache/kylin/rest/service/BadQueryDetectorTest.java @@ -18,7 +18,8 @@ package org.apache.kylin.rest.service; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; import java.util.ArrayList; http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/test/java/org/apache/kylin/rest/service/CacheServiceTest.java ---------------------------------------------------------------------- diff --git a/server/src/test/java/org/apache/kylin/rest/service/CacheServiceTest.java b/server/src/test/java/org/apache/kylin/rest/service/CacheServiceTest.java index 3148e85..d77b9ce 100644 --- a/server/src/test/java/org/apache/kylin/rest/service/CacheServiceTest.java +++ b/server/src/test/java/org/apache/kylin/rest/service/CacheServiceTest.java @@ -18,7 +18,9 @@ package org.apache.kylin.rest.service; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.util.Arrays; import java.util.Set; @@ -32,7 +34,6 @@ import org.apache.kylin.cube.CubeDescManager; import org.apache.kylin.cube.CubeInstance; import org.apache.kylin.cube.CubeManager; import org.apache.kylin.cube.CubeSegment; -import org.apache.kylin.cube.CubeUpdate; import org.apache.kylin.cube.model.CubeDesc; import org.apache.kylin.metadata.MetadataManager; import org.apache.kylin.metadata.model.DataModelDesc; http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/test/java/org/apache/kylin/rest/service/CubeServiceTest.java ---------------------------------------------------------------------- diff --git a/server/src/test/java/org/apache/kylin/rest/service/CubeServiceTest.java b/server/src/test/java/org/apache/kylin/rest/service/CubeServiceTest.java index f93c04f..a3c983d 100644 --- a/server/src/test/java/org/apache/kylin/rest/service/CubeServiceTest.java +++ b/server/src/test/java/org/apache/kylin/rest/service/CubeServiceTest.java @@ -40,7 +40,7 @@ public class CubeServiceTest extends ServiceTestBase { @Autowired private CacheService cacheService; - + @Test public void testBasics() throws JsonProcessingException, JobException, UnknownHostException { Assert.assertNotNull(cubeService.getConfig()); http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/test/java/org/apache/kylin/rest/service/JobServiceTest.java ---------------------------------------------------------------------- diff --git a/server/src/test/java/org/apache/kylin/rest/service/JobServiceTest.java b/server/src/test/java/org/apache/kylin/rest/service/JobServiceTest.java index 41057e5..0493be6 100644 --- a/server/src/test/java/org/apache/kylin/rest/service/JobServiceTest.java +++ b/server/src/test/java/org/apache/kylin/rest/service/JobServiceTest.java @@ -36,7 +36,7 @@ public class JobServiceTest extends ServiceTestBase { @Autowired private CacheService cacheService; - + @Test public void testBasics() throws JobException, IOException { Assert.assertNotNull(jobService.getConfig()); http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/server/src/test/java/org/apache/kylin/rest/service/QueryServiceTest.java ---------------------------------------------------------------------- diff --git a/server/src/test/java/org/apache/kylin/rest/service/QueryServiceTest.java b/server/src/test/java/org/apache/kylin/rest/service/QueryServiceTest.java index 119d88b..ca4e34c 100644 --- a/server/src/test/java/org/apache/kylin/rest/service/QueryServiceTest.java +++ b/server/src/test/java/org/apache/kylin/rest/service/QueryServiceTest.java @@ -39,7 +39,7 @@ public class QueryServiceTest extends ServiceTestBase { @Autowired private CacheService cacheService; - + @Test public void testBasics() throws JobException, IOException, SQLException { Assert.assertNotNull(queryService.getConfig()); http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/source-hive/src/main/java/org/apache/kylin/source/hive/CreateFlatHiveTableStep.java ---------------------------------------------------------------------- diff --git a/source-hive/src/main/java/org/apache/kylin/source/hive/CreateFlatHiveTableStep.java b/source-hive/src/main/java/org/apache/kylin/source/hive/CreateFlatHiveTableStep.java index 93a30d6..d8e2754 100644 --- a/source-hive/src/main/java/org/apache/kylin/source/hive/CreateFlatHiveTableStep.java +++ b/source-hive/src/main/java/org/apache/kylin/source/hive/CreateFlatHiveTableStep.java @@ -1,5 +1,8 @@ package org.apache.kylin.source.hive; +import java.io.IOException; +import java.io.InputStream; + import org.apache.commons.io.IOUtils; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; @@ -17,13 +20,10 @@ import org.apache.kylin.job.execution.ExecuteResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; -import java.io.InputStream; - /** */ public class CreateFlatHiveTableStep extends AbstractExecutable { - + private static final Logger logger = LoggerFactory.getLogger(CreateFlatHiveTableStep.class); private final BufferedLogger stepLogger = new BufferedLogger(logger); @@ -84,8 +84,7 @@ public class CreateFlatHiveTableStep extends AbstractExecutable { try { long rowCount = readRowCountFromFile(); if (!config.isEmptySegmentAllowed() && rowCount == 0) { - stepLogger.log("Detect upstream hive table is empty, " + - "fail the job because \"kylin.job.allow.empty.segment\" = \"false\""); + stepLogger.log("Detect upstream hive table is empty, " + "fail the job because \"kylin.job.allow.empty.segment\" = \"false\""); return new ExecuteResult(ExecuteResult.State.ERROR, stepLogger.getBufferedLog()); } http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/source-hive/src/main/java/org/apache/kylin/source/hive/HiveCmdBuilder.java ---------------------------------------------------------------------- diff --git a/source-hive/src/main/java/org/apache/kylin/source/hive/HiveCmdBuilder.java b/source-hive/src/main/java/org/apache/kylin/source/hive/HiveCmdBuilder.java index 5a8278e..6316b9c 100644 --- a/source-hive/src/main/java/org/apache/kylin/source/hive/HiveCmdBuilder.java +++ b/source-hive/src/main/java/org/apache/kylin/source/hive/HiveCmdBuilder.java @@ -100,7 +100,7 @@ public class HiveCmdBuilder { } public void addStatements(String[] stats) { - for(String s : stats) { + for (String s : stats) { statements.add(s); } } http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/source-hive/src/main/java/org/apache/kylin/source/hive/HiveMRInput.java ---------------------------------------------------------------------- diff --git a/source-hive/src/main/java/org/apache/kylin/source/hive/HiveMRInput.java b/source-hive/src/main/java/org/apache/kylin/source/hive/HiveMRInput.java index 6e5c47c..e4492da 100644 --- a/source-hive/src/main/java/org/apache/kylin/source/hive/HiveMRInput.java +++ b/source-hive/src/main/java/org/apache/kylin/source/hive/HiveMRInput.java @@ -141,7 +141,6 @@ public class HiveMRInput implements IMRInput { public ShellExecutable createLookupHiveViewMaterializationStep(String jobId) { ShellExecutable step = new ShellExecutable(); - ; step.setName(ExecutableConstants.STEP_NAME_MATERIALIZE_HIVE_VIEW_IN_LOOKUP); HiveCmdBuilder hiveCmdBuilder = new HiveCmdBuilder(); http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/source-hive/src/main/java/org/apache/kylin/source/hive/HiveSourceTableLoader.java ---------------------------------------------------------------------- diff --git a/source-hive/src/main/java/org/apache/kylin/source/hive/HiveSourceTableLoader.java b/source-hive/src/main/java/org/apache/kylin/source/hive/HiveSourceTableLoader.java index 33a9ad0..70b097c 100644 --- a/source-hive/src/main/java/org/apache/kylin/source/hive/HiveSourceTableLoader.java +++ b/source-hive/src/main/java/org/apache/kylin/source/hive/HiveSourceTableLoader.java @@ -25,7 +25,6 @@ import java.util.Map; import java.util.Set; import java.util.UUID; -import org.apache.hadoop.hive.metastore.TableType; import org.apache.hadoop.hive.metastore.api.FieldSchema; import org.apache.hadoop.hive.metastore.api.Table; import org.apache.kylin.common.KylinConfig; @@ -117,7 +116,7 @@ public class HiveSourceTableLoader { tableDesc.setUuid(UUID.randomUUID().toString()); tableDesc.setLastModified(0); } - if(table.getTableType() != null) { + if (table.getTableType() != null) { tableDesc.setTableType(table.getTableType()); } http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/source-hive/src/main/java/org/apache/kylin/source/hive/HqlExecutable.java ---------------------------------------------------------------------- diff --git a/source-hive/src/main/java/org/apache/kylin/source/hive/HqlExecutable.java b/source-hive/src/main/java/org/apache/kylin/source/hive/HqlExecutable.java index cb73fc2..aa93324 100644 --- a/source-hive/src/main/java/org/apache/kylin/source/hive/HqlExecutable.java +++ b/source-hive/src/main/java/org/apache/kylin/source/hive/HqlExecutable.java @@ -29,11 +29,12 @@ import org.apache.kylin.job.execution.AbstractExecutable; import org.apache.kylin.job.execution.ExecutableContext; import org.apache.kylin.job.execution.ExecuteResult; import org.datanucleus.store.types.backed.HashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.fasterxml.jackson.core.JsonProcessingException; + import com.google.common.collect.Lists; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** */ http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/source-hive/src/main/java/org/apache/kylin/source/hive/cardinality/ColumnCardinalityMapper.java ---------------------------------------------------------------------- diff --git a/source-hive/src/main/java/org/apache/kylin/source/hive/cardinality/ColumnCardinalityMapper.java b/source-hive/src/main/java/org/apache/kylin/source/hive/cardinality/ColumnCardinalityMapper.java index e06fb68..c90c62d 100644 --- a/source-hive/src/main/java/org/apache/kylin/source/hive/cardinality/ColumnCardinalityMapper.java +++ b/source-hive/src/main/java/org/apache/kylin/source/hive/cardinality/ColumnCardinalityMapper.java @@ -28,15 +28,14 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.BytesWritable; import org.apache.hadoop.io.IntWritable; import org.apache.kylin.common.KylinConfig; -import org.apache.kylin.measure.BufferedMeasureEncoder; -import org.apache.kylin.measure.hllc.HyperLogLogPlusCounter; import org.apache.kylin.common.util.Bytes; -import org.apache.kylin.cube.kv.RowConstants; import org.apache.kylin.engine.mr.IMRInput.IMRTableInputFormat; import org.apache.kylin.engine.mr.KylinMapper; import org.apache.kylin.engine.mr.MRUtil; import org.apache.kylin.engine.mr.common.AbstractHadoopJob; import org.apache.kylin.engine.mr.common.BatchConstants; +import org.apache.kylin.measure.BufferedMeasureEncoder; +import org.apache.kylin.measure.hllc.HyperLogLogPlusCounter; import org.apache.kylin.metadata.MetadataManager; import org.apache.kylin.metadata.model.ColumnDesc; import org.apache.kylin.metadata.model.TableDesc; http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/source-hive/src/main/java/org/apache/kylin/source/hive/cardinality/ColumnCardinalityReducer.java ---------------------------------------------------------------------- diff --git a/source-hive/src/main/java/org/apache/kylin/source/hive/cardinality/ColumnCardinalityReducer.java b/source-hive/src/main/java/org/apache/kylin/source/hive/cardinality/ColumnCardinalityReducer.java index 6596917..1a7a253 100644 --- a/source-hive/src/main/java/org/apache/kylin/source/hive/cardinality/ColumnCardinalityReducer.java +++ b/source-hive/src/main/java/org/apache/kylin/source/hive/cardinality/ColumnCardinalityReducer.java @@ -30,10 +30,9 @@ import java.util.Map; import org.apache.hadoop.io.BytesWritable; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; +import org.apache.kylin.engine.mr.KylinReducer; import org.apache.kylin.measure.BufferedMeasureEncoder; import org.apache.kylin.measure.hllc.HyperLogLogPlusCounter; -import org.apache.kylin.cube.kv.RowConstants; -import org.apache.kylin.engine.mr.KylinReducer; /** * @author Jack http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/source-hive/src/main/java/org/apache/kylin/source/hive/cardinality/HiveColumnCardinalityUpdateJob.java ---------------------------------------------------------------------- diff --git a/source-hive/src/main/java/org/apache/kylin/source/hive/cardinality/HiveColumnCardinalityUpdateJob.java b/source-hive/src/main/java/org/apache/kylin/source/hive/cardinality/HiveColumnCardinalityUpdateJob.java index 9a4d8de..1997f7f 100644 --- a/source-hive/src/main/java/org/apache/kylin/source/hive/cardinality/HiveColumnCardinalityUpdateJob.java +++ b/source-hive/src/main/java/org/apache/kylin/source/hive/cardinality/HiveColumnCardinalityUpdateJob.java @@ -18,6 +18,14 @@ package org.apache.kylin.source.hive.cardinality; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + import org.apache.commons.cli.Option; import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.Options; @@ -36,14 +44,6 @@ import org.apache.kylin.metadata.MetadataManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - /** * This job will update save the cardinality result into Kylin table metadata store. * http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/source-hive/src/test/java/org/apache/kylin/source/hive/HiveCmdBuilderTest.java ---------------------------------------------------------------------- diff --git a/source-hive/src/test/java/org/apache/kylin/source/hive/HiveCmdBuilderTest.java b/source-hive/src/test/java/org/apache/kylin/source/hive/HiveCmdBuilderTest.java index f780efc..acfe0c7 100644 --- a/source-hive/src/test/java/org/apache/kylin/source/hive/HiveCmdBuilderTest.java +++ b/source-hive/src/test/java/org/apache/kylin/source/hive/HiveCmdBuilderTest.java @@ -18,7 +18,8 @@ package org.apache.kylin.source.hive; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.io.File; import java.io.IOException; @@ -56,8 +57,7 @@ public class HiveCmdBuilderTest { @Test public void testBeeline() throws IOException { - String lineSeparator = java.security.AccessController.doPrivileged( - new sun.security.action.GetPropertyAction("line.separator")); + String lineSeparator = java.security.AccessController.doPrivileged(new sun.security.action.GetPropertyAction("line.separator")); System.setProperty("kylin.hive.client", "beeline"); System.setProperty("kylin.hive.beeline.params", "-u jdbc_url"); @@ -71,9 +71,7 @@ public class HiveCmdBuilderTest { String hqlFile = cmd.substring(cmd.lastIndexOf("-f ") + 3).trim(); String hqlStatement = FileUtils.readFileToString(new File(hqlFile)); - assertEquals("USE default;" + - lineSeparator + "DROP TABLE test;" + - lineSeparator + "SHOW\n TABLES;" + lineSeparator, hqlStatement); + assertEquals("USE default;" + lineSeparator + "DROP TABLE test;" + lineSeparator + "SHOW\n TABLES;" + lineSeparator, hqlStatement); FileUtils.forceDelete(new File(hqlFile)); } http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/source-hive/src/test/java/org/apache/kylin/source/hive/cardinality/ColumnCardinalityReducerTest.java ---------------------------------------------------------------------- diff --git a/source-hive/src/test/java/org/apache/kylin/source/hive/cardinality/ColumnCardinalityReducerTest.java b/source-hive/src/test/java/org/apache/kylin/source/hive/cardinality/ColumnCardinalityReducerTest.java index b9f532d..1e45f64 100644 --- a/source-hive/src/test/java/org/apache/kylin/source/hive/cardinality/ColumnCardinalityReducerTest.java +++ b/source-hive/src/test/java/org/apache/kylin/source/hive/cardinality/ColumnCardinalityReducerTest.java @@ -33,10 +33,9 @@ import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.mrunit.mapreduce.ReduceDriver; import org.apache.hadoop.mrunit.types.Pair; +import org.apache.kylin.common.util.Bytes; import org.apache.kylin.measure.BufferedMeasureEncoder; import org.apache.kylin.measure.hllc.HyperLogLogPlusCounter; -import org.apache.kylin.common.util.Bytes; -import org.apache.kylin.cube.kv.RowConstants; import org.junit.Before; import org.junit.Test; http://git-wip-us.apache.org/repos/asf/kylin/blob/5d4982e2/source-kafka/.settings/org.eclipse.core.resources.prefs ---------------------------------------------------------------------- diff --git a/source-kafka/.settings/org.eclipse.core.resources.prefs b/source-kafka/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..365bbd6 --- /dev/null +++ b/source-kafka/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding/<project>=UTF-8