batchee-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Struberg <strub...@yahoo.de>
Subject Re: git commit: BATCHEE-16 prevent to use actions when not holding batches - to enhance when embedded but there is another jira for that + reactivating war packaging
Date Sun, 30 Mar 2014 19:38:33 GMT
romain I'm really -1 to this commit!

It just brings NOTHING and adds just clumsy overhead. What is the benefit of it? You still
fail to explain the benefit!
Give me a description of the environment you have and where having an empty WAR is beneficial
and I'm good. Until then I gonna revert this.

LieGrue,
strub


On Sunday, 30 March 2014, 21:00, "rmannibucau@apache.org" <rmannibucau@apache.org> wrote:
 
Repository: incubator-batchee
>Updated Branches:
>  refs/heads/master 2523e389a -> 23c4ecae4
>
>
>BATCHEE-16 prevent to use actions when not holding batches - to enhance when embedded
but there is another jira for that + reactivating war packaging
>
>
>Project: http://git-wip-us.apache.org/repos/asf/incubator-batchee/repo
>Commit: http://git-wip-us.apache.org/repos/asf/incubator-batchee/commit/23c4ecae
>Tree: http://git-wip-us.apache.org/repos/asf/incubator-batchee/tree/23c4ecae
>Diff: http://git-wip-us.apache.org/repos/asf/incubator-batchee/diff/23c4ecae
>
>Branch: refs/heads/master
>Commit: 23c4ecae4e2c2144cbcc8a719e3c47f2043d0482
>Parents: 2523e38
>Author: Romain Manni-Bucau <rmannibucau@gmail.com>
>Authored: Sun Mar 30 21:00:05 2014 +0200
>Committer: Romain Manni-Bucau <rmannibucau@gmail.com>
>Committed: Sun Mar 30 21:00:05 2014 +0200
>
>----------------------------------------------------------------------
>gui/servlet/pom.xml                             |  1 +
>.../batchee/servlet/JBatchController.java       | 37 +++++++++++++++-----
>.../servlet/JBatchServletInitializer.java       | 15 +++++++-
>.../resources/internal/batchee/read-only.jsp    | 19 ++++++++++
>4 files changed, 63 insertions(+), 9 deletions(-)
>----------------------------------------------------------------------
>
>
>http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/23c4ecae/gui/servlet/pom.xml
>----------------------------------------------------------------------
>diff --git a/gui/servlet/pom.xml b/gui/servlet/pom.xml
>index 7c42298..d635301 100644
>--- a/gui/servlet/pom.xml
>+++ b/gui/servlet/pom.xml
>@@ -28,6 +28,7 @@
>
>   <artifactId>batchee-servlet</artifactId>
>   <name>BatchEE :: GUI :: Servlet</name>
>+  <packaging>war</packaging>
>
>   <dependencies>
>     <dependency>
>
>http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/23c4ecae/gui/servlet/src/main/java/org/apache/batchee/servlet/JBatchController.java
>----------------------------------------------------------------------
>diff --git a/gui/servlet/src/main/java/org/apache/batchee/servlet/JBatchController.java
b/gui/servlet/src/main/java/org/apache/batchee/servlet/JBatchController.java
>index 87cf32b..aaab084 100644
>--- a/gui/servlet/src/main/java/org/apache/batchee/servlet/JBatchController.java
>+++ b/gui/servlet/src/main/java/org/apache/batchee/servlet/JBatchController.java
>@@ -61,6 +61,7 @@ public class JBatchController extends HttpServlet {
>     private String context;
>     private String mapping = DEFAULT_MAPPING_SERVLET25;
>     private int executionByPage = DEFAULT_PAGE_SIZE;
>+    private boolean readOnly = false;
>
>     public JBatchController mapping(final String rawMapping) {
>         this.mapping = rawMapping.substring(0, rawMapping.length() - 2); // mapping
pattern is /xxx/*
>@@ -72,6 +73,11 @@ public class JBatchController extends HttpServlet {
>         return this;
>     }
>
>+    public JBatchController readOnly(final boolean readOnly) {
>+        this.readOnly = readOnly;
>+        return this;
>+    }
>+
>     @Override
>     public void init(final ServletConfig config) throws ServletException {
>         this.operator = BatchRuntime.getJobOperator();
>@@ -103,15 +109,23 @@ public class JBatchController extends HttpServlet {
>             final String name = URLDecoder.decode(path.substring(VIEW_MAPPING.length()),
"UTF-8");
>             view(req, name);
>         } else if (path != null && path.startsWith(START_MAPPING)) {
>-            final String name = URLDecoder.decode(path.substring(START_MAPPING.length()),
"UTF-8");
>-            start(req, name);
>-        } else if (path != null && path.startsWith(DO_START_MAPPING)) {
>-            String name = URLDecoder.decode(path.substring(DO_START_MAPPING.length()),
"UTF-8");
>-            if (name.isEmpty()) {
>-                name = req.getParameter(FORM_JOB_NAME);
>+            if (readOnly) {
>+                reportReadOnly(req);
>+            } else {
>+                final String name = URLDecoder.decode(path.substring(START_MAPPING.length()),
"UTF-8");
>+                start(req, name);
>             }
>+        } else if (path != null && path.startsWith(DO_START_MAPPING)) {
>+            if (readOnly) {
>+                reportReadOnly(req);
>+            } else {
>+                String name = URLDecoder.decode(path.substring(DO_START_MAPPING.length()),
"UTF-8");
>+                if (name.isEmpty()) {
>+                    name = req.getParameter(FORM_JOB_NAME);
>+                }
>
>-            doStart(req, name, readProperties(req));
>+                doStart(req, name, readProperties(req));
>+            }
>         } else {
>             listJobs(req);
>         }
>@@ -119,6 +133,10 @@ public class JBatchController extends HttpServlet {
>         req.getRequestDispatcher("/internal/batchee/layout.jsp").forward(req, resp);
>     }
>
>+    private void reportReadOnly(final HttpServletRequest req) {
>+        req.setAttribute("view", "read-only");
>+    }
>+
>     private void view(final HttpServletRequest req, final String name) {
>         req.setAttribute("name", name);
>         req.setAttribute("view", "view");
>@@ -169,7 +187,7 @@ public class JBatchController extends HttpServlet {
>     }
>
>     private void listExecutions(final HttpServletRequest req, final String name, final
int pageSize, final int inStart) {
>-        { // can be an auto refresh asking for a stop
>+        if (!readOnly) { // can be an auto refresh asking for a stop
>             final String stopId = req.getParameter("stop");
>             if (stopId != null) {
>                 try {
>@@ -180,6 +198,9 @@ public class JBatchController extends HttpServlet {
>                     // no-op
>                 }
>             }
>+        } else {
>+            reportReadOnly(req);
>+            return;
>         }
>
>         final int jobInstanceCount = operator.getJobInstanceCount(name);
>
>http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/23c4ecae/gui/servlet/src/main/java/org/apache/batchee/servlet/JBatchServletInitializer.java
>----------------------------------------------------------------------
>diff --git a/gui/servlet/src/main/java/org/apache/batchee/servlet/JBatchServletInitializer.java
b/gui/servlet/src/main/java/org/apache/batchee/servlet/JBatchServletInitializer.java
>index fc1ac72..808ed74 100644
>--- a/gui/servlet/src/main/java/org/apache/batchee/servlet/JBatchServletInitializer.java
>+++ b/gui/servlet/src/main/java/org/apache/batchee/servlet/JBatchServletInitializer.java
>@@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletRequest;
>import javax.servlet.http.HttpServletResponse;
>import java.io.IOException;
>import java.net.HttpURLConnection;
>+import java.util.Collections;
>import java.util.EnumSet;
>import java.util.Set;
>
>@@ -61,7 +62,11 @@ public class JBatchServletInitializer implements ServletContainerInitializer
{
>             byPage += byPage;
>         }
>
>-        ctx.addServlet("JBatch Servlet", new JBatchController().mapping(mapping).executionByPage(Integer.parseInt(byPage))).addMapping(mapping);
>+        ctx.addServlet("JBatch Servlet", new JBatchController()
>+                                            .readOnly(isReadOnly(ctx.getClassLoader()))
>+                                            .mapping(mapping)
>+                                            .executionByPage(Integer.parseInt(byPage)))
>+                                            .addMapping(mapping);
>
>         final String activePrivateFilter = ctx.getInitParameter(ACTIVE_PRIVATE_FILTER);
>         if (activePrivateFilter == null || Boolean.parseBoolean(activePrivateFilter))
{
>@@ -70,6 +75,14 @@ public class JBatchServletInitializer implements ServletContainerInitializer
{
>         }
>     }
>
>+    private static boolean isReadOnly(final ClassLoader classLoader) {
>+        try {
>+            return Collections.list(classLoader.getResources("META-INF/batch-jobs")).isEmpty();
>+        } catch (final IOException e) {
>+            return false;
>+        }
>+    }
>+
>     public static class PrivateFilter implements Filter {
>         @Override
>         public void doFilter(final ServletRequest request, final ServletResponse
response, final FilterChain chain) throws IOException, ServletException {
>
>http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/23c4ecae/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/read-only.jsp
>----------------------------------------------------------------------
>diff --git a/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/read-only.jsp
b/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/read-only.jsp
>new file mode 100644
>index 0000000..2ddee9a
>--- /dev/null
>+++ b/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/read-only.jsp
>@@ -0,0 +1,19 @@
>+<%--
>+    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.
>+--%>
>+<%@ page session="false" %>
>+<p>This deployment is read only since deployed out of the JBatch application
>+so you can't run/stop batches.</p>
>
>
>
>
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message