You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eagle.apache.org by ha...@apache.org on 2016/07/28 09:31:20 UTC

incubator-eagle git commit: [EAGLE-400] Fix char case bug

Repository: incubator-eagle
Updated Branches:
  refs/heads/develop 4d7ccd18e -> 7e9dfaf3d


[EAGLE-400] Fix char case bug

Author: Hao Chen <ha...@apache.org>

Closes #283 from haoch/fixCharCaseBug.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/7e9dfaf3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/7e9dfaf3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/7e9dfaf3

Branch: refs/heads/develop
Commit: 7e9dfaf3d5a51b52539ba5b298fbeb9d559ddd07
Parents: 4d7ccd1
Author: Hao Chen <ha...@apache.org>
Authored: Thu Jul 28 17:30:55 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Thu Jul 28 17:30:55 2016 +0800

----------------------------------------------------------------------
 .../app/spi/AbstractApplicationProvider.java    |   2 +-
 .../eagle/metadata/resource/RESTResponse.java   | 210 +++++++++++++++++++
 .../eagle/metadata/resource/RestResponse.java   | 210 -------------------
 3 files changed, 211 insertions(+), 211 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/7e9dfaf3/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/spi/AbstractApplicationProvider.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/spi/AbstractApplicationProvider.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/spi/AbstractApplicationProvider.java
index 4cb4367..37311eb 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/spi/AbstractApplicationProvider.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/spi/AbstractApplicationProvider.java
@@ -47,7 +47,7 @@ public abstract class AbstractApplicationProvider<T extends Application> impleme
     protected void configure (){
         // do nothing by default
     }
-�
+
     protected AbstractApplicationProvider(String applicationDescConfig) {
         this();
         ApplicationProviderDescConfig descWrapperConfig = ApplicationProviderDescConfig.loadFromXML(applicationDescConfig);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/7e9dfaf3/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/RESTResponse.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/RESTResponse.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/RESTResponse.java
new file mode 100644
index 0000000..4431c8c
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/RESTResponse.java
@@ -0,0 +1,210 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.eagle.metadata.resource;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+
+@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
+public class RESTResponse<T>{
+    private boolean success = false;
+    private String message;
+    private String exception;
+    private T data;
+
+    public T getData() {
+        return data;
+    }
+
+    public void setData(T data) {
+        this.data = data;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public boolean isSuccess() {
+        return success;
+    }
+
+    public void setSuccess(boolean success) {
+        this.success = success;
+    }
+
+    public static <E> RestResponseBuilder<E> builder(){
+        return new RestResponseBuilder<>();
+    }
+
+    public static <E> RestResponseBuilder<E> of(E data){
+        return RESTResponse.<E>builder().data(data);
+    }
+
+    public static <E> RestResponseBuilder<E> of(Consumer<RestResponseBuilder<E>> func){
+        return RESTResponse.<E>builder().of(func);
+    }
+
+    public static <E> RestResponseBuilder<E> of(Supplier<E> func){
+        return RESTResponse.<E>builder().of(func);
+    }
+
+    public static <E> RestResponseBuilder<E> async(UnhandledSupplier<E,Exception> func) {
+        return RESTResponse.<E>builder().async(func);
+    }
+
+    public static <E> RestResponseBuilder<E> async(UnhandledConsumer<RestResponseBuilder<E>, Exception> func){
+        return RESTResponse.<E>builder().async(func);
+    }
+
+    public String getException() {
+        return exception;
+    }
+
+    public void setThrowable(Throwable exception) {
+        this.setException(ExceptionUtils.getStackTrace(exception));
+    }
+
+    public void setException(String exception) {
+        this.exception = exception;
+    }
+
+
+    public static class RestResponseBuilder<E>{
+        private RESTResponse current = new RESTResponse();
+        private Response.Status status = Response.Status.OK;
+
+        public RestResponseBuilder<E> success(boolean success){
+            this.current.setSuccess(success);
+            return this;
+        }
+
+        public RestResponseBuilder<E> status(Response.Status status){
+            this.status = status;
+            return this;
+        }
+
+        public RestResponseBuilder<E> message(String message){
+            this.current.setMessage(message);
+            return this;
+        }
+
+        public RestResponseBuilder<E> data(E data){
+            this.current.setData(data);
+            return this;
+        }
+
+        public RestResponseBuilder<E> exception(Throwable exception){
+            this.current.setThrowable(exception);
+            return this;
+        }
+
+        public RestResponseBuilder<E> of(Consumer<RestResponseBuilder<E>> func){
+            try {
+                this.success(true).status(Response.Status.OK);
+                func.accept(this);
+            } catch (Exception ex){
+                this.success(false).data(null).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage());
+                raiseWebAppException(ex);
+            }
+            return this;
+        }
+
+        public RestResponseBuilder<E>  of(Supplier<E> func){
+            try {
+                this.success(true).status(Response.Status.OK).data(func.get());
+            } catch (Throwable ex){
+                this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage());
+                raiseWebAppException(ex);
+            }
+            return this;
+        }
+
+        public RestResponseBuilder<E> async(UnhandledSupplier<E,Exception> func) {
+            CompletableFuture future = CompletableFuture.runAsync(() -> {
+                try {
+                    this.status(Response.Status.OK).success(true).data(func.get());
+                } catch (Throwable e) {
+                    this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(e.getMessage()).exception(e);
+                    raiseWebAppException(e);
+                }
+            });
+            runAsync(future);
+            return this;
+        }
+
+        private void runAsync(CompletableFuture future){
+            try {
+                future.get();
+            } catch (InterruptedException ex) {
+                Thread.currentThread().interrupt();
+                future.cancel(true);
+                this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage()).exception(ex);
+            } catch (Throwable ex) {
+                this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage()).exception(ex);
+                raiseWebAppException(ex);
+            }
+        }
+
+        private void raiseWebAppException(Throwable ex){
+            throw new WebApplicationException(ex,Response.status(this.status).entity(this.current).build());
+        }
+
+        public RestResponseBuilder<E> async(UnhandledConsumer<RestResponseBuilder<E>, Exception> func){
+            CompletableFuture future = CompletableFuture.runAsync(() -> {
+                try {
+                    func.accept(this);
+                    this.success(true);
+                } catch (Throwable ex) {
+                    this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage()).exception(ex);
+                    raiseWebAppException(ex);
+                }
+            });
+            runAsync(future);
+            return this;
+        }
+
+        public RestResponseBuilder<E> then(UnhandledConsumer<RestResponseBuilder<E>, Exception> func){
+            try {
+                func.accept(this);
+            } catch (Throwable ex) {
+                this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage()).exception(ex);
+                raiseWebAppException(ex);
+            }
+            return this;
+        }
+
+        public RESTResponse<E> get(){
+            return current;
+        }
+
+        public RestResponseBuilder<E> status(boolean success, Response.Status status) {
+            this.success(success);
+            this.status(status);
+            return this;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/7e9dfaf3/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/RestResponse.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/RestResponse.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/RestResponse.java
deleted file mode 100644
index 4431c8c..0000000
--- a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/RestResponse.java
+++ /dev/null
@@ -1,210 +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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.eagle.metadata.resource;
-
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import org.apache.commons.lang3.exception.ExceptionUtils;
-
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Response;
-import java.util.concurrent.CompletableFuture;
-import java.util.function.Consumer;
-import java.util.function.Supplier;
-
-@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
-public class RESTResponse<T>{
-    private boolean success = false;
-    private String message;
-    private String exception;
-    private T data;
-
-    public T getData() {
-        return data;
-    }
-
-    public void setData(T data) {
-        this.data = data;
-    }
-
-    public String getMessage() {
-        return message;
-    }
-
-    public void setMessage(String message) {
-        this.message = message;
-    }
-
-    public boolean isSuccess() {
-        return success;
-    }
-
-    public void setSuccess(boolean success) {
-        this.success = success;
-    }
-
-    public static <E> RestResponseBuilder<E> builder(){
-        return new RestResponseBuilder<>();
-    }
-
-    public static <E> RestResponseBuilder<E> of(E data){
-        return RESTResponse.<E>builder().data(data);
-    }
-
-    public static <E> RestResponseBuilder<E> of(Consumer<RestResponseBuilder<E>> func){
-        return RESTResponse.<E>builder().of(func);
-    }
-
-    public static <E> RestResponseBuilder<E> of(Supplier<E> func){
-        return RESTResponse.<E>builder().of(func);
-    }
-
-    public static <E> RestResponseBuilder<E> async(UnhandledSupplier<E,Exception> func) {
-        return RESTResponse.<E>builder().async(func);
-    }
-
-    public static <E> RestResponseBuilder<E> async(UnhandledConsumer<RestResponseBuilder<E>, Exception> func){
-        return RESTResponse.<E>builder().async(func);
-    }
-
-    public String getException() {
-        return exception;
-    }
-
-    public void setThrowable(Throwable exception) {
-        this.setException(ExceptionUtils.getStackTrace(exception));
-    }
-
-    public void setException(String exception) {
-        this.exception = exception;
-    }
-
-
-    public static class RestResponseBuilder<E>{
-        private RESTResponse current = new RESTResponse();
-        private Response.Status status = Response.Status.OK;
-
-        public RestResponseBuilder<E> success(boolean success){
-            this.current.setSuccess(success);
-            return this;
-        }
-
-        public RestResponseBuilder<E> status(Response.Status status){
-            this.status = status;
-            return this;
-        }
-
-        public RestResponseBuilder<E> message(String message){
-            this.current.setMessage(message);
-            return this;
-        }
-
-        public RestResponseBuilder<E> data(E data){
-            this.current.setData(data);
-            return this;
-        }
-
-        public RestResponseBuilder<E> exception(Throwable exception){
-            this.current.setThrowable(exception);
-            return this;
-        }
-
-        public RestResponseBuilder<E> of(Consumer<RestResponseBuilder<E>> func){
-            try {
-                this.success(true).status(Response.Status.OK);
-                func.accept(this);
-            } catch (Exception ex){
-                this.success(false).data(null).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage());
-                raiseWebAppException(ex);
-            }
-            return this;
-        }
-
-        public RestResponseBuilder<E>  of(Supplier<E> func){
-            try {
-                this.success(true).status(Response.Status.OK).data(func.get());
-            } catch (Throwable ex){
-                this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage());
-                raiseWebAppException(ex);
-            }
-            return this;
-        }
-
-        public RestResponseBuilder<E> async(UnhandledSupplier<E,Exception> func) {
-            CompletableFuture future = CompletableFuture.runAsync(() -> {
-                try {
-                    this.status(Response.Status.OK).success(true).data(func.get());
-                } catch (Throwable e) {
-                    this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(e.getMessage()).exception(e);
-                    raiseWebAppException(e);
-                }
-            });
-            runAsync(future);
-            return this;
-        }
-
-        private void runAsync(CompletableFuture future){
-            try {
-                future.get();
-            } catch (InterruptedException ex) {
-                Thread.currentThread().interrupt();
-                future.cancel(true);
-                this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage()).exception(ex);
-            } catch (Throwable ex) {
-                this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage()).exception(ex);
-                raiseWebAppException(ex);
-            }
-        }
-
-        private void raiseWebAppException(Throwable ex){
-            throw new WebApplicationException(ex,Response.status(this.status).entity(this.current).build());
-        }
-
-        public RestResponseBuilder<E> async(UnhandledConsumer<RestResponseBuilder<E>, Exception> func){
-            CompletableFuture future = CompletableFuture.runAsync(() -> {
-                try {
-                    func.accept(this);
-                    this.success(true);
-                } catch (Throwable ex) {
-                    this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage()).exception(ex);
-                    raiseWebAppException(ex);
-                }
-            });
-            runAsync(future);
-            return this;
-        }
-
-        public RestResponseBuilder<E> then(UnhandledConsumer<RestResponseBuilder<E>, Exception> func){
-            try {
-                func.accept(this);
-            } catch (Throwable ex) {
-                this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage()).exception(ex);
-                raiseWebAppException(ex);
-            }
-            return this;
-        }
-
-        public RESTResponse<E> get(){
-            return current;
-        }
-
-        public RestResponseBuilder<E> status(boolean success, Response.Status status) {
-            this.success(success);
-            this.status(status);
-            return this;
-        }
-    }
-}
\ No newline at end of file