You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@griffin.apache.org by gu...@apache.org on 2018/04/16 02:24:16 UTC
incubator-griffin git commit: remove unused files
Repository: incubator-griffin
Updated Branches:
refs/heads/master f149e3a8d -> a792bdd97
remove unused files
Author: evanwan87 <ev...@gmail.com>
Closes #255 from evanwan87/topics/refactor-ut.
Project: http://git-wip-us.apache.org/repos/asf/incubator-griffin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-griffin/commit/a792bdd9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-griffin/tree/a792bdd9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-griffin/diff/a792bdd9
Branch: refs/heads/master
Commit: a792bdd9768fcd429289085e7a9a731a5c8449f0
Parents: f149e3a
Author: evanwan87 <ev...@gmail.com>
Authored: Mon Apr 16 10:24:18 2018 +0800
Committer: Lionel Liu <bh...@163.com>
Committed: Mon Apr 16 10:24:18 2018 +0800
----------------------------------------------------------------------
.../apache/griffin/core/interceptor/Token.java | 28 -------
.../core/interceptor/TokenInterceptor.java | 78 --------------------
.../core/interceptor/WebAppConfigurer.java | 33 ---------
.../apache/griffin/core/job/JobController.java | 2 -
.../griffin/core/measure/MeasureController.java | 2 -
5 files changed, 143 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/a792bdd9/service/src/main/java/org/apache/griffin/core/interceptor/Token.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/interceptor/Token.java b/service/src/main/java/org/apache/griffin/core/interceptor/Token.java
deleted file mode 100644
index 440d2a3..0000000
--- a/service/src/main/java/org/apache/griffin/core/interceptor/Token.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
-*/
-
-package org.apache.griffin.core.interceptor;
-
-import java.lang.annotation.*;
-
-@Target(ElementType.METHOD)
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-public @interface Token {
-}
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/a792bdd9/service/src/main/java/org/apache/griffin/core/interceptor/TokenInterceptor.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/interceptor/TokenInterceptor.java b/service/src/main/java/org/apache/griffin/core/interceptor/TokenInterceptor.java
deleted file mode 100644
index e5b9fdd..0000000
--- a/service/src/main/java/org/apache/griffin/core/interceptor/TokenInterceptor.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
-*/
-
-package org.apache.griffin.core.interceptor;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.web.method.HandlerMethod;
-import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.lang.reflect.Method;
-
-public class TokenInterceptor extends HandlerInterceptorAdapter {
- private static final Logger LOGGER = LoggerFactory.getLogger(TokenInterceptor.class);
- private static final String TOKEN = "token";
-
- @Override
- public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
- if (handler instanceof HandlerMethod) {
- Method method = ((HandlerMethod) handler).getMethod();
- Token annotation = method.getAnnotation(Token.class);
- if (annotation != null) {
- LOGGER.info("enter interceptor");
- if (isRepeatSubmit(request)) {
- LOGGER.warn("Please don't repeat submit url {}.", request.getServletPath());
- return false;
- } else {
- LOGGER.info("not repeat submit");
- }
- return true;
- }
- return true;
- } else {
- return super.preHandle(request, response, handler);
- }
-
- }
-
- private boolean isRepeatSubmit(HttpServletRequest request) {
-// String curToken = request.getHeader(TOKEN);
-// HttpSession session = request.getSession(true);
-// Object preToken = session.getAttribute(TOKEN);
-// //if http header has no token,we ignore to deal with repeated submission.
-// if (curToken == null) {
-// return false;
-// } else if (preToken == null) {
-// session.setAttribute(TOKEN, curToken);
-// return false;
-// } else {
-// if (preToken.toString().equals(curToken)) {
-// return true;
-// } else {
-// session.setAttribute(TOKEN, curToken);
-// return false;
-// }
-// }
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/a792bdd9/service/src/main/java/org/apache/griffin/core/interceptor/WebAppConfigurer.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/interceptor/WebAppConfigurer.java b/service/src/main/java/org/apache/griffin/core/interceptor/WebAppConfigurer.java
deleted file mode 100644
index 4347c52..0000000
--- a/service/src/main/java/org/apache/griffin/core/interceptor/WebAppConfigurer.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
-*/
-
-package org.apache.griffin.core.interceptor;
-
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
-
-@Configuration
-public class WebAppConfigurer extends WebMvcConfigurerAdapter {
- @Override
- public void addInterceptors(InterceptorRegistry registry) {
- registry.addInterceptor(new TokenInterceptor()).addPathPatterns("/api/v1/measures").addPathPatterns("/api/v1/jobs");
- super.addInterceptors(registry);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/a792bdd9/service/src/main/java/org/apache/griffin/core/job/JobController.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/job/JobController.java b/service/src/main/java/org/apache/griffin/core/job/JobController.java
index 37bac4f..2d09d8b 100644
--- a/service/src/main/java/org/apache/griffin/core/job/JobController.java
+++ b/service/src/main/java/org/apache/griffin/core/job/JobController.java
@@ -19,7 +19,6 @@ under the License.
package org.apache.griffin.core.job;
-import org.apache.griffin.core.interceptor.Token;
import org.apache.griffin.core.job.entity.JobDataBean;
import org.apache.griffin.core.job.entity.JobHealth;
import org.apache.griffin.core.job.entity.JobInstanceBean;
@@ -49,7 +48,6 @@ public class JobController {
@RequestMapping(value = "/jobs", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
- @Token
public JobSchedule addJob(@RequestBody JobSchedule jobSchedule) throws Exception {
return jobService.addJob(jobSchedule);
}
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/a792bdd9/service/src/main/java/org/apache/griffin/core/measure/MeasureController.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/measure/MeasureController.java b/service/src/main/java/org/apache/griffin/core/measure/MeasureController.java
index f8ba3bf..d7917e4 100644
--- a/service/src/main/java/org/apache/griffin/core/measure/MeasureController.java
+++ b/service/src/main/java/org/apache/griffin/core/measure/MeasureController.java
@@ -19,7 +19,6 @@ under the License.
package org.apache.griffin.core.measure;
-import org.apache.griffin.core.interceptor.Token;
import org.apache.griffin.core.measure.entity.Measure;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@@ -68,7 +67,6 @@ public class MeasureController {
@RequestMapping(value = "/measures", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
- @Token
public Measure createMeasure(@RequestBody Measure measure) {
return measureService.createMeasure(measure);
}